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);
            }
        }
Ejemplo n.º 2
0
 private static void ChangeLight(int number)
 {
     if (ModbusProtocol.GetDataCoils(number) == true)
     {
         ViewModel.VisualizationViewModel.ChangeLightOnGreen(number);
     }
     else if (ModbusProtocol.GetDataCoils(number) == false)
     {
         ViewModel.VisualizationViewModel.ChangeLightOnRed(number);
     }
 }
Ejemplo n.º 3
0
        public static void Steering440()
        {
            if (ModbusProtocol.GetDataCoils(9) == false) // zwrotnica 440
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("401e");
                ViewModel.VisualizationViewModel.TrackOnWhite("402e");

                ModbusProtocol.SetInputStatus(9, true);
                ModbusProtocol.SetInputStatus(10, false);
            }
            else if (ModbusProtocol.GetDataCoils(9) == true) // zwrotnica 440
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("402e");
                ViewModel.VisualizationViewModel.TrackOnWhite("401e");

                ModbusProtocol.SetInputStatus(9, false);
                ModbusProtocol.SetInputStatus(10, true);
            }
        }
Ejemplo n.º 4
0
        public static void Steering412()
        {
            if (ModbusProtocol.GetDataCoils(8) == false) // zwrotnica 412
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("402a");
                ViewModel.VisualizationViewModel.TrackOnWhite("404a");

                ModbusProtocol.SetInputStatus(7, true);
                ModbusProtocol.SetInputStatus(8, false);
            }
            else if (ModbusProtocol.GetDataCoils(8) == true) // zwrotnica 412
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("404a");
                ViewModel.VisualizationViewModel.TrackOnWhite("402a");

                ModbusProtocol.SetInputStatus(7, false);
                ModbusProtocol.SetInputStatus(8, true);
            }
        }
Ejemplo n.º 5
0
        public static void Steering410()
        {
            if (ModbusProtocol.GetDataCoils(7) == false) // zwrotnica 410
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("403a");
                ViewModel.VisualizationViewModel.TrackOnWhite("405a");

                ModbusProtocol.SetInputStatus(5, true);
                ModbusProtocol.SetInputStatus(6, false);
            }
            else if (ModbusProtocol.GetDataCoils(7) == true) // zwrotnica 410
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("405a");
                ViewModel.VisualizationViewModel.TrackOnWhite("403a");

                ModbusProtocol.SetInputStatus(5, false);
                ModbusProtocol.SetInputStatus(6, true);
            }
        }
Ejemplo n.º 6
0
        public static void Steering411()
        {
            if (ModbusProtocol.GetDataCoils(6) == false) // zwrotnica 411
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("401a");
                ViewModel.VisualizationViewModel.TrackOnWhite("412");

                ModbusProtocol.SetInputStatus(3, true);
                ModbusProtocol.SetInputStatus(4, false);
            }
            else if (ModbusProtocol.GetDataCoils(6) == true) // zwrotnica 411
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("412");
                ViewModel.VisualizationViewModel.TrackOnWhite("401a");

                ModbusProtocol.SetInputStatus(3, false);
                ModbusProtocol.SetInputStatus(4, true);
            }
        }
Ejemplo n.º 7
0
        public static void Steering445()
        {
            if (ModbusProtocol.GetDataCoils(13) == false) // zwrotnica 445
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("403a_a");
                ViewModel.VisualizationViewModel.TrackOnWhite("406a");

                ModbusProtocol.SetInputStatus(17, true);
                ModbusProtocol.SetInputStatus(18, false);
            }
            else if (ModbusProtocol.GetDataCoils(13) == true) // zwrotnica 445
            {
                ViewModel.VisualizationViewModel.TrackOnWhite("403a_a");
                ViewModel.VisualizationViewModel.TrackOnGreen("406a");

                ModbusProtocol.SetInputStatus(17, false);
                ModbusProtocol.SetInputStatus(18, true);
            }
        }
Ejemplo n.º 8
0
        public static void Steering444()
        {
            if (ModbusProtocol.GetDataCoils(12) == false) // zwrotnica 444
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("441");
                ViewModel.VisualizationViewModel.TrackOnWhite("442");

                ModbusProtocol.SetInputStatus(15, true);
                ModbusProtocol.SetInputStatus(16, false);
            }
            else if (ModbusProtocol.GetDataCoils(12) == true) // zwrotnica 444
            {
                ViewModel.VisualizationViewModel.TrackOnWhite("441");
                ViewModel.VisualizationViewModel.TrackOnGreen("442");

                ModbusProtocol.SetInputStatus(15, false);
                ModbusProtocol.SetInputStatus(16, true);
            }
        }
Ejemplo n.º 9
0
        public static void Steering442()
        {
            if (ModbusProtocol.GetDataCoils(11) == false) // zwrotnica 442
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("403e");
                ViewModel.VisualizationViewModel.TrackOnWhite("405e");

                ModbusProtocol.SetInputStatus(13, true);
                ModbusProtocol.SetInputStatus(14, false);
            }
            else if (ModbusProtocol.GetDataCoils(11) == true) // zwrotnica 442
            {
                ViewModel.VisualizationViewModel.TrackOnWhite("403e");
                ViewModel.VisualizationViewModel.TrackOnGreen("405e");

                ModbusProtocol.SetInputStatus(13, false);
                ModbusProtocol.SetInputStatus(14, true);
            }
        }
Ejemplo n.º 10
0
        public static void Steering441()
        {
            if (ModbusProtocol.GetDataCoils(10) == false) // zwrotnica 441
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("440");
                ViewModel.VisualizationViewModel.TrackOnWhite("404e");

                ModbusProtocol.SetInputStatus(11, true);
                ModbusProtocol.SetInputStatus(12, false);
            }
            else if (ModbusProtocol.GetDataCoils(10) == true) // zwrotnica 441
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("404e");
                ViewModel.VisualizationViewModel.TrackOnWhite("440");

                ModbusProtocol.SetInputStatus(11, false);
                ModbusProtocol.SetInputStatus(12, true);
            }
        }
Ejemplo n.º 11
0
        public static void Steering408()
        {
            if (ModbusProtocol.GetDataCoils(5) == false) // zwrotnica 408
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("411");
                ViewModel.VisualizationViewModel.TrackOnWhite("410");

                ModbusProtocol.SetInputStatus(1, true);
                ModbusProtocol.SetInputStatus(2, false);
            }
            else if (ModbusProtocol.GetDataCoils(5) == true) // zwrotnica 408
            {
                ViewModel.VisualizationViewModel.TrackOnGreen("410");
                ViewModel.VisualizationViewModel.TrackOnWhite("411");

                ModbusProtocol.SetInputStatus(1, false);
                ModbusProtocol.SetInputStatus(2, true);
            }
        }
Ejemplo n.º 12
0
        private void CheckTrack401(double xPoint, double yPoint)
        {
            if (ModbusProtocol.GetDataCoils(4) == false && xPoint < 500 && xPoint != 0 && direction == 0)
            {
                storyboard.Pause();
                timer.Stop();
                TrainViewModel.queueTrainTo401Track.Add(trainNumber);
            }

            TrackSensorsViewModel.Track408(xPoint, yPoint);
            TrackSensorsViewModel.Track411(xPoint, yPoint);
            TrackSensorsViewModel.Track401a(xPoint, yPoint);
            TrackSensorsViewModel.Track401b(xPoint, yPoint);
            TrackSensorsViewModel.Track401c(xPoint, yPoint);
            TrackSensorsViewModel.Track401d(xPoint, yPoint);
            TrackSensorsViewModel.Track401e(xPoint, yPoint);
            TrackSensorsViewModel.Track440(xPoint, yPoint);
            TrackSensorsViewModel.Track441(xPoint, yPoint);
            TrackSensorsViewModel.Track444(xPoint, yPoint);
        }
Ejemplo n.º 13
0
        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);
            }
        }
Ejemplo n.º 14
0
        private void CheckTrack404(double xPoint, double yPoint)
        {
            if (ModbusProtocol.GetDataCoils(2) == false && xPoint < 500 && xPoint != 0)
            {
                TrainViewModel.queueTrainTo404Track.Add(trainNumber);
                storyboard.Pause();
                timer.Stop();
            }


            TrackSensorsViewModel.Track408(xPoint, yPoint);
            TrackSensorsViewModel.Track411(xPoint, yPoint);
            TrackSensorsViewModel.Track412(xPoint, yPoint);
            TrackSensorsViewModel.Track404a(xPoint, yPoint);
            TrackSensorsViewModel.Track404b(xPoint, yPoint);
            TrackSensorsViewModel.Track404c(xPoint, yPoint);
            TrackSensorsViewModel.Track404d(xPoint, yPoint);
            TrackSensorsViewModel.Track404e(xPoint, yPoint);
            TrackSensorsViewModel.Track441(xPoint, yPoint);
            TrackSensorsViewModel.Track444(xPoint, yPoint);
        }
Ejemplo n.º 15
0
        private void CheckTrack402(double xPoint, double yPoint)
        {
            if (ModbusProtocol.GetDataCoils(3) == false && xPoint < 500 && xPoint != 0)
            {
                storyboard.Pause();
                timer.Stop();
                TrainViewModel.trainWait = true;
                TrainViewModel.queueTrainTo402Track.Add(trainNumber);
            }

            TrackSensorsViewModel.Track408(xPoint, yPoint);
            TrackSensorsViewModel.Track411(xPoint, yPoint);
            TrackSensorsViewModel.Track412(xPoint, yPoint);
            TrackSensorsViewModel.Track402a(xPoint, yPoint);
            TrackSensorsViewModel.Track402b(xPoint, yPoint);
            TrackSensorsViewModel.Track402c(xPoint, yPoint);
            TrackSensorsViewModel.Track402d(xPoint, yPoint);
            TrackSensorsViewModel.Track402e(xPoint, yPoint);
            TrackSensorsViewModel.Track440(xPoint, yPoint);
            TrackSensorsViewModel.Track441(xPoint, yPoint);
            TrackSensorsViewModel.Track444(xPoint, yPoint);
        }