コード例 #1
0
        private FiddleYardIOHandleVariables m_FYIOHandleVar; // connect variable to connect to FYIOH class for defined variables

        #endregion Fields

        #region Constructors

        /*#--------------------------------------------------------------------------#*/
        /*  Description: FiddleYardVariables constructor
         *
         *  Input(s)   :
         *
         *  Output(s)  :
         *
         *  Returns    :
         *
         *  Pre.Cond.  :
         *
         *  Post.Cond. :
         *
         *  Notes      :
         *
         */
        /*#--------------------------------------------------------------------------#*/
        public FiddleYardApplicationVariables(FiddleYardIOHandleVariables FYIOHandleVar)
        {
            m_FYIOHandleVar = FYIOHandleVar;

            // Instantiate Commands from FYFORM
            CmdFiddleOneLeft = new CommandUpdater();
            CmdFiddleOneRight = new CommandUpdater();
            CmdCouple = new CommandUpdater();
            CmdUncouple = new CommandUpdater();
            CmdFiddleGo1 = new CommandUpdater();
            CmdFiddleGo2 = new CommandUpdater();
            CmdFiddleGo3 = new CommandUpdater();
            CmdFiddleGo4 = new CommandUpdater();
            CmdFiddleGo5 = new CommandUpdater();
            CmdFiddleGo6 = new CommandUpdater();
            CmdFiddleGo7 = new CommandUpdater();
            CmdFiddleGo8 = new CommandUpdater();
            CmdFiddleGo9 = new CommandUpdater();
            CmdFiddleGo10 = new CommandUpdater();
            CmdFiddleGo11 = new CommandUpdater();
            CmdTrainDetect = new CommandUpdater();
            CmdFYStart = new CommandUpdater();
            CmdFYStop = new CommandUpdater();
            CmdReset = new CommandUpdater();
            CmdOcc5BOnTrue = new CommandUpdater();
            CmdOcc5BOnFalse = new CommandUpdater();
            CmdOcc6OnTrue = new CommandUpdater();
            CmdOcc6OnFalse = new CommandUpdater();
            CmdOcc7OnTrue = new CommandUpdater();
            CmdOcc7OnFalse = new CommandUpdater();
            CmdCollect = new CommandUpdater();
            CmdHomeFY = new CommandUpdater();

            // Instantiate actuators for sending command out to the target or simulator
            FiddleOneLeft = new ActuatorUpdater();
            FiddleOneRight = new ActuatorUpdater();
            Couple = new ActuatorUpdater();
            Uncouple = new ActuatorUpdater();
            //FiddleGo1 = new ActuatorUpdater();
            //FiddleGo2 = new ActuatorUpdater();
            //FiddleGo3 = new ActuatorUpdater();
            //FiddleGo4 = new ActuatorUpdater();
            //FiddleGo5 = new ActuatorUpdater();
            //FiddleGo6 = new ActuatorUpdater();
            //FiddleGo7 = new ActuatorUpdater();
            //FiddleGo8 = new ActuatorUpdater();
            //FiddleGo9 = new ActuatorUpdater();
            //FiddleGo10 = new ActuatorUpdater();
            //FiddleGo11 = new ActuatorUpdater();
            TrainDetect = new ActuatorUpdater();
            FYStart = new ActuatorUpdater();
            FYStop = new ActuatorUpdater();
            Reset = new ActuatorUpdater();
            Occ5BOnTrue = new ActuatorUpdater();
            Occ5BOnFalse = new ActuatorUpdater();
            Occ6OnTrue = new ActuatorUpdater();
            Occ6OnFalse = new ActuatorUpdater();
            Occ7OnTrue = new ActuatorUpdater();
            Occ7OnFalse = new ActuatorUpdater();
            HomeFY = new ActuatorUpdater();
            Collect = new ActuatorUpdater();

            CL10Heart = new SensorUpdater();
            F11 = new SensorUpdater();
            EOS10 = new SensorUpdater();
            EOS11 = new SensorUpdater();
            F13 = new SensorUpdater();
            F12 = new SensorUpdater();
            Block5B = new SensorUpdater();
            Block8A = new SensorUpdater();
            TrackPower = new SensorUpdater();
            Block5BIn = new SensorUpdater();
            Block6In = new SensorUpdater();
            Block7In = new SensorUpdater();
            Resistor = new SensorUpdater();
            // Trackx sensor is used internally in C#, not from target anymore
            Track1 = new SensorUpdater();
            Track2 = new SensorUpdater();
            Track3 = new SensorUpdater();
            Track4 = new SensorUpdater();
            Track5 = new SensorUpdater();
            Track6 = new SensorUpdater();
            Track7 = new SensorUpdater();
            Track8 = new SensorUpdater();
            Track9 = new SensorUpdater();
            Track10 = new SensorUpdater();
            Track11 = new SensorUpdater();
            Block6 = new SensorUpdater();
            Block7 = new SensorUpdater();
            F10 = new SensorUpdater();
            M10 = new SensorUpdater();
            TrackNo = new SensorUpdater();
            TrackPower15V = new SensorUpdater();
            CmdBusy = new SensorUpdater();
            TrainDriveOutPointer = new SensorUpdater();
            ReceivedDataFromMip50 = new SensorUpdater();

            FiddleYardStopped = new MessageUpdater();
            FiddleYardStart = new MessageUpdater();
            FiddleYardNotHomed = new MessageUpdater();
            FiddleYardTrainObstruction = new MessageUpdater();
            FiddleYardTrackAligned = new MessageUpdater();
            TrainHasLeftFiddleYardSuccessfully = new MessageUpdater();
            EMOPressed15VTrackPowerDown = new MessageUpdater();
            EMOPressed15VTrackPowerUp = new MessageUpdater();
            FiddleYardAutoModeStart = new MessageUpdater();
            FiddleYardInit = new MessageUpdater();
            FiddleYardAutoModeIsGoingToStop = new MessageUpdater();
            FiddleYardReset = new MessageUpdater();
            FiddleYardInitFinished = new MessageUpdater();
            FiddleYardApplicationRunning = new MessageUpdater();
            FiddleYardAutoModeIsStopped = new MessageUpdater();
            CollectingTrainsEnabled = new MessageUpdater();
            CollectingTrainsDisabled = new MessageUpdater();
            FYNotHomed = new MessageUpdater();
            TrainDetection = new MessageUpdater();
            FiddleYardHomingFinished = new MessageUpdater();
            TrainDetectionStarted = new MessageUpdater();

            FormCollect = new CommandUpdater();

            //Sensors
            Sensor Sns_CL_10_Heart = new Sensor("CL10Heart", " CL 10 Heart ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.CL10Heart.Attach(Sns_CL_10_Heart);
            Sensor Sns_F11 = new Sensor("F11", " F11 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.F11.Attach(Sns_F11);
            Sensor Sns_EOS10 = new Sensor("EOS10", " EOS 10 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.EOS10.Attach(Sns_EOS10);
            Sensor Sns_EOS11 = new Sensor("EOS11", " EOS 11 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.EOS11.Attach(Sns_EOS11);
            Sensor Sns_F13 = new Sensor("F13", " F13 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.F13.Attach(Sns_F13);
            Sensor Sns_F12 = new Sensor("F12", " F12 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.F12.Attach(Sns_F12);
            Sensor Sns_Block5B = new Sensor("Block5B", " Occupied from 5B ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block5B.Attach(Sns_Block5B);
            Sensor Sns_Block8A = new Sensor("Block8A", " Occupied from 8A ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block8A.Attach(Sns_Block8A);
            Sensor Sns_TrackPower = new Sensor("TrackPower", " Enable Track ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.TrackPower.Attach(Sns_TrackPower);
            Sensor Sns_Block5BIn = new Sensor("Block5BIn", " Occupied to 5B ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block5BIn.Attach(Sns_Block5BIn);
            Sensor Sns_Block6In = new Sensor("Block6In", " Occupied to 6 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block6In.Attach(Sns_Block6In);
            Sensor Sns_Block7In = new Sensor("Block7In", " Occupied to 7 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block7In.Attach(Sns_Block7In);
            Sensor Sns_Resistor = new Sensor("Resistor", " Occupied Resistor ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Resistor.Attach(Sns_Resistor);
            //Sensor Sns_Track1 = new Sensor("Track1", " Train On Fiddle Yard Track1 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track1.Attach(Sns_Track1);
            //Sensor Sns_Track2 = new Sensor("Track2", " Train On Fiddle Yard Track2 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track2.Attach(Sns_Track2);
            //Sensor Sns_Track3 = new Sensor("Track3", " Train On Fiddle Yard Track3 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track3.Attach(Sns_Track3);
            //Sensor Sns_Track4 = new Sensor("Track4", " Train On Fiddle Yard Track4 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track4.Attach(Sns_Track4);
            //Sensor Sns_Track5 = new Sensor("Track5", " Train On Fiddle Yard Track5 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track5.Attach(Sns_Track5);
            //Sensor Sns_Track6 = new Sensor("Track6", " Train On Fiddle Yard Track6 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track6.Attach(Sns_Track6);
            //Sensor Sns_Track7 = new Sensor("Track7", " Train On Fiddle Yard Track7 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track7.Attach(Sns_Track7);
            //Sensor Sns_Track8 = new Sensor("Track8", " Train On Fiddle Yard Track8 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track8.Attach(Sns_Track8);
            //Sensor Sns_Track9 = new Sensor("Track9", " Train On Fiddle Yard Track9 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track9.Attach(Sns_Track9);
            //Sensor Sns_Track10 = new Sensor("Track10", " Train On Fiddle Yard Track10 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track10.Attach(Sns_Track10);
            //Sensor Sns_Track11 = new Sensor("Track11", " Train On Fiddle Yard Track11 ", 0, (name, val, log) => UpdateTrainsOnFY(name, val, log)); // initialize and subscribe sensors
            //m_FYIOHandleVar.Track11.Attach(Sns_Track11);
            Sensor Sns_Block6 = new Sensor("Block6", " Occupied from 6 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block6.Attach(Sns_Block6);
            Sensor Sns_Block7 = new Sensor("Block7", " Occupied from 7 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.Block7.Attach(Sns_Block7);
            Sensor Sns_F10 = new Sensor("F10", " F10 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.F10.Attach(Sns_F10);
            Sensor Sns_M10 = new Sensor("M10", " M10 ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.M10.Attach(Sns_M10);
            Sensor Sns_TrackNo = new Sensor("Track_No", " Track Nr ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.TrackNo.Attach(Sns_TrackNo);
            Sensor Sns_CmdBusy = new Sensor("CmdBusy", " uController busy ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.CmdBusy.Attach(Sns_CmdBusy);
            Sensor Sns_TrackPower15V = new Sensor("TrackPower15V", " 15V Track Power ", 0, (name, val, log) => SetLedIndicator(name, val, log)); // initialize and subscribe sensors
            m_FYIOHandleVar.TrackPower15V.Attach(Sns_TrackPower15V);

            Command Act_Collect = new Command(" Collect ", (name) => FormCmd(name)); // Catch Form command pass to subscribers
            CmdCollect.Attach(Act_Collect);

            Colorc Clr_FYTrackOccupiedColorSetting = new Colorc(Color.Transparent, "Clr_FYTrackOccupiedColorSetting", (NewColor, log) => SetColorIndicator(NewColor, log));
            Siebwalde_Application.Properties.Settings.Default.SWSetColorTrainOccupied.Attach(Clr_FYTrackOccupiedColorSetting);

            Colorc Clr_FYTrackNotInitializedColorSetting = new Colorc(Color.Transparent, "Clr_FYTrackNotInitializedColorSetting", (NewColor, log) => SetColorIndicator(NewColor, log));
            Siebwalde_Application.Properties.Settings.Default.SWSetColorTrackNotInitialized.Attach(Clr_FYTrackNotInitializedColorSetting);

            Colorc Clr_FYTrackNotActiveColorSetting = new Colorc(Color.Transparent, "Clr_FYTrackNotActiveColorSetting", (NewColor, log) => SetColorIndicator(NewColor, log));
            Siebwalde_Application.Properties.Settings.Default.SWSetColorTrackNotActive.Attach(Clr_FYTrackNotActiveColorSetting);

            Colorc Clr_FYTrackDisabledColorSetting = new Colorc(Color.Transparent, "Clr_FYTrackDisabledColorSetting", (NewColor, log) => SetColorIndicator(NewColor, log));
            Siebwalde_Application.Properties.Settings.Default.SWSetColorTrackDisabled.Attach(Clr_FYTrackDisabledColorSetting);

            Colorc Clr_FYTrackDisabledNotOccupiedColorSetting = new Colorc(Color.Transparent, "Clr_FYTrackDisabledNotOccupiedColorSetting", (NewColor, log) => SetColorIndicator(NewColor, log));
            Siebwalde_Application.Properties.Settings.Default.SWSetColorTrackDisabledNotOccupied.Attach(Clr_FYTrackDisabledNotOccupiedColorSetting);

            for (int i = 1; i < 12; i++)
            {
                icheckBoxTrack[i] = 1;      // Init all tracks disabled
            }

            FYHomed.BoolVariable = false;   // Init variable
        }
コード例 #2
0
        /*#--------------------------------------------------------------------------#*/
        /*  Description: FiddleYardApplication constructor
         *
         *  Input(s)   :
         *
         *  Output(s)  :
         *
         *  Returns    :
         *
         *  Pre.Cond.  :
         *
         *  Post.Cond. :
         *
         *  Notes      :
         *
         */
        /*#--------------------------------------------------------------------------#*/
        public FiddleYardApplication(string Instance, iFiddleYardController iFYCtrl)
        {
            m_instance = Instance;
            m_iFYCtrl = iFYCtrl;

            // Sub programs
            FYAppInit = new FiddleYardAppInit(this);//, iFYCtrl.GetFYFormTop);

            // Instantiate actuators for sending command out to the target or simulator
            FiddleOneLeft = new ActuatorUpdater();
            FiddleOneRight = new ActuatorUpdater();
            Couple = new ActuatorUpdater();
            Uncouple = new ActuatorUpdater();
            FiddleGo1 = new ActuatorUpdater();
            FiddleGo2 = new ActuatorUpdater();
            FiddleGo3 = new ActuatorUpdater();
            FiddleGo4 = new ActuatorUpdater();
            FiddleGo5 = new ActuatorUpdater();
            FiddleGo6 = new ActuatorUpdater();
            FiddleGo7 = new ActuatorUpdater();
            FiddleGo8 = new ActuatorUpdater();
            FiddleGo9 = new ActuatorUpdater();
            FiddleGo10 = new ActuatorUpdater();
            FiddleGo11 = new ActuatorUpdater();
            TrainDetect = new ActuatorUpdater();
            FYStart = new ActuatorUpdater();
            FYStop = new ActuatorUpdater();
            Reset = new ActuatorUpdater();
            Occ5BOnTrue = new ActuatorUpdater();
            Occ5BOnFalse = new ActuatorUpdater();
            Occ6OnTrue = new ActuatorUpdater();
            Occ6OnFalse = new ActuatorUpdater();
            Occ7OnTrue = new ActuatorUpdater();
            Occ7OnFalse = new ActuatorUpdater();
            Recoverd = new ActuatorUpdater();
            Collect = new ActuatorUpdater();

            Track1 = new SensorUpdater();
            Track2 = new SensorUpdater();
            Track3 = new SensorUpdater();
            Track4 = new SensorUpdater();
            Track5 = new SensorUpdater();
            Track6 = new SensorUpdater();
            Track7 = new SensorUpdater();
            Track8 = new SensorUpdater();
            Track9 = new SensorUpdater();
            Track10 = new SensorUpdater();
            Track11 = new SensorUpdater();

            FiddleYardStopped = new MessageUpdater();
            FiddleYardStart = new MessageUpdater();
        }