public static void StartNewTrain() { if (ModbusProtocol.GetDataCoils(1) == true) { TrainViewModel.nextTrain = 2; num++; switch (ModbusProtocol.availableTrack) { case 401: visualization.DoStartNewTrain1(num, TrackSensorsViewModel.xTrack401, TrackSensorsViewModel.yTrack401, 1); break; case 403: visualization.DoStartNewTrain1(num, TrackSensorsViewModel.xTrack403, TrackSensorsViewModel.yTrack403, 1); break; case 405: visualization.DoStartNewTrain1(num, TrackSensorsViewModel.xTrack405, TrackSensorsViewModel.yTrack405, 1); break; } ModbusProtocol.SetDataCoils(19, false); } else { ViewModel.VisualizationViewModel.ShowMessage("Error"); ModbusProtocol.SetDataCoils(16, true); ModbusProtocol.SetDataCoils(19, false); } }
private static void StartTrainHelp() { TrainViewModel.nextTrain = 1; ModbusProtocol.SetDataCoils(20, false); num++; switch (ModbusProtocol.availableTrack2) { case 406: visualization.DoStartNewTrain2(num, TrackSensorsViewModel.xTrack406Return, TrackSensorsViewModel.yTrack406Return); break; case 403: visualization.DoStartNewTrain2(num, TrackSensorsViewModel.xTrack403aReturn, TrackSensorsViewModel.yTrack403aReturn); break; } }
public static void ChangeLight3() { if (ModbusProtocol.GetDataCoils(3) == true) { if (TrainViewModel.queueTrainTo402Track.Count != 0 && ModbusProtocol.avaliableDeparture == 402 && ModbusProtocol.GetInputStatus(69) == true) { ChangeLight(3); int number = TrainViewModel.queueTrainTo402Track.First(); View.Train train = TrainViewModel.trainList[number]; TrainViewModel.queueTrainTo402Track.Remove(number); train.storyboard.Resume(); train.timer.Start(); } else if (ModbusProtocol.GetInputStatus(69)) { if (ModbusProtocol.availableTrack2 != 0 && ModbusProtocol.availableTrack == 402) { ChangeLight(3); } else { ViewModel.VisualizationViewModel.ShowMessage("Error"); ModbusProtocol.SetDataCoils(3, false); ModbusProtocol.SetInputStatus(68, true); } } else { ViewModel.VisualizationViewModel.ShowMessage("Error"); ModbusProtocol.SetDataCoils(3, false); ModbusProtocol.SetInputStatus(68, true); } } else { ChangeLight(3); } }
public static void ChangeLight1() { if (ModbusProtocol.GetInputStatus(69)) { if (ModbusProtocol.availableTrack2 != 0 && ModbusProtocol.availableTrack == 401 || ModbusProtocol.availableTrack == 403 || ModbusProtocol.availableTrack == 405) { ChangeLight(1); } else { ViewModel.VisualizationViewModel.ShowMessage("Error"); ModbusProtocol.SetDataCoils(1, false); ModbusProtocol.SetInputStatus(68, true); } } else { ViewModel.VisualizationViewModel.ShowMessage("Error"); ModbusProtocol.SetDataCoils(1, false); ModbusProtocol.SetInputStatus(68, true); } }