public FiddleYardForm() { InitializeComponent(); #region Indicator init // size of window resolution on Modeltrain PC is 1920; 1200 // Size of window on Modeltrain PC is 960; 1085 // Placed on 0; 85 GWinX = 5; // The X location of Gwin border line. GWinY = 32; // The X location of Gwin border line. GWinHalf = 740 / 2 + GWinY; // The Height of GWin devided by 2 plus the offset in Y is the center line of GWin Track6LocY = GWinHalf - 8; Track6LocX = GWinX + 170; GWin.Size = new Size (940,740); GWin.Location = new System.Drawing.Point(GWinX, GWinY); // was 5, 32 LLed_F10.Size = new Size (30, 16); LLed_F10.Location = new System.Drawing.Point(GWinX + 10, GWinHalf - 8); LLed_F10_2_TOP.Size = new Size(30, 16); LLed_F10_2_TOP.Location = new System.Drawing.Point(GWinX + 900, GWinHalf - 8); LLed_Block6.Size = new Size(100, 16); LLed_Block6.Location = new System.Drawing.Point(GWinX + 50, GWinHalf - 8); LLed_Block6In.Size = new Size(26, 14); LLed_Block6In.Location = new System.Drawing.Point(GWinX + 50 + (100 / 2 - 26 / 2), GWinHalf -7); LLed_Block5B.Size = new Size(16, 250); LLed_Block5B.Location = new System.Drawing.Point(GWinX + 50, GWinHalf - 18 - 250); LLed_Block5BIn.Size = new Size(14, 26); LLed_Block5BIn.Location = new System.Drawing.Point(GWinX + 50 + 1, GWinHalf - 18 - (250/2 + 26/2)); LLed_FYPLATE_TOP.Size = new Size(620, 368); LLed_FYPLATE_TOP.Location = new System.Drawing.Point(GWinX + 160, GWinHalf - 368 / 2); LLed_F13.Size = new Size(30, 14); LLed_F13.Location = new System.Drawing.Point(GWinX + 180, GWinHalf - 7); LLed_F11.Size = new Size(30, 14); LLed_F11.Location = new System.Drawing.Point(GWinX + 580, GWinHalf - 7); LLed_TrackPower.Size = new Size(100, 14); LLed_TrackPower.Location = new System.Drawing.Point(GWinX + 620, GWinHalf - 7); LLed_F12.Size = new Size(30, 14); LLed_F12.Location = new System.Drawing.Point(GWinX + 730, GWinHalf - 7); LLed_Block7.Size = new Size(100,16); LLed_Block7.Location = new System.Drawing.Point(GWinX + 790, GWinHalf - 8); LLed_Block7In.Size = new Size(26, 14); LLed_Block7In.Location = new System.Drawing.Point(GWinX + 790 + (100 / 2 - 26 / 2), GWinHalf - 7); LLed_Block8A.Size = new Size(16, 250); LLed_Block8A.Location = new System.Drawing.Point(GWinX + 790 + (100 - 16), GWinHalf - 250 - 18); LLed_Track1.Size = new Size(600, 16); LLed_Track1.Location = new System.Drawing.Point(Track6LocX, Track6LocY - 160); LLed_Track2.Size = new Size(600, 16); LLed_Track2.Location = new System.Drawing.Point(Track6LocX, Track6LocY - 128); LLed_Track3.Size = new Size(600, 16); LLed_Track3.Location = new System.Drawing.Point(Track6LocX, Track6LocY - 96); LLed_Track4.Size = new Size(600, 16); LLed_Track4.Location = new System.Drawing.Point(Track6LocX, Track6LocY - 64); LLed_Track5.Size = new Size(600, 16); LLed_Track5.Location = new System.Drawing.Point(Track6LocX, Track6LocY - 32); LLed_Track6.Size = new Size(600, 16); LLed_Track6.Location = new System.Drawing.Point(Track6LocX, Track6LocY); LLed_Track7.Size = new Size(600, 16); LLed_Track7.Location = new System.Drawing.Point(Track6LocX, Track6LocY + 32); LLed_Track8.Size = new Size(600, 16); LLed_Track8.Location = new System.Drawing.Point(Track6LocX, Track6LocY + 64); LLed_Track9.Size = new Size(600, 16); LLed_Track9.Location = new System.Drawing.Point(Track6LocX, Track6LocY + 96); LLed_Track10.Size = new Size(600, 16); LLed_Track10.Location = new System.Drawing.Point(Track6LocX, Track6LocY + 128); LLed_Track11.Size = new Size(600, 16); LLed_Track11.Location = new System.Drawing.Point(Track6LocX, Track6LocY + 160); LLed_EOS11.Size = new Size(50, 16); LLed_EOS11.Location = new System.Drawing.Point(GWinX + 180, GWinHalf - 360); LLed_EOS10.Size = new Size(50, 16); LLed_EOS10.Location = new System.Drawing.Point(GWinX + 180, GWinHalf + 360 - 16); Btn_Bezet5BOn_TOP.Size = new Size(32, 24); Btn_Bezet5BOn_TOP.Location = new System.Drawing.Point(GWinX + 50 + 16 + 10, GWinHalf - 18 - (250/2) - (23/2) ); Btn_Bezet6On_TOP.Size = new Size(32, 24); Btn_Bezet6On_TOP.Location = new System.Drawing.Point(GWinX + 100 - (32/2), GWinHalf + 8 + 10); Btn_Bezet7On_TOP.Size = new Size(32, 24); Btn_Bezet7On_TOP.Location = new System.Drawing.Point(GWinX + 840 - (32/2), GWinHalf + 8 + 10); LabelBlock6.Size = new Size(44, 13); LabelBlock6.Location = new System.Drawing.Point(GWinX + 100 - (44 / 2), GWinHalf - 8 - 10 - 13); LabelBlock7.Size = new Size(44, 13); LabelBlock7.Location = new System.Drawing.Point(GWinX + 840 - (44 / 2), GWinHalf - 8 - 10 - 13); LabelBlock5B.Size = new Size(44, 13); LabelBlock5B.Location = new System.Drawing.Point(GWinX + 60 + 8, GWinHalf - 18 - 250); LabelBlock8A.Size = new Size(44, 13); LabelBlock8A.Location = new System.Drawing.Point(GWinX + 790 + (100 - 16) - 10 - 50, GWinHalf - 18 - 250); LLed_15VTrackPower.Size = new Size(88, 16); LLed_15VTrackPower.Location = new System.Drawing.Point(GWinX + 835, GWinHalf - 360); LLed_Heart.Size = new Size(60, 16); LLed_Heart.Location = new System.Drawing.Point(GWinX + 15, GWinHalf + 360 - 16); LLed_M10.Size = new Size(50, 16); LLed_M10.Location = new System.Drawing.Point(GWinX + 270, GWinHalf + 360 - 16); LLed_Resistor.Size = new Size(100, 16); LLed_Resistor.Location = new System.Drawing.Point(GWinX + 620, GWinHalf + 360 - 16); Btn_Reset_TOP.Size = new Size(80, 32); Btn_Reset_TOP.Location = new System.Drawing.Point(GWinX + 10, GWinHalf - 360); //LLed_Alive.Size = new Size(16, 16); //LLed_Alive.Location = new System.Drawing.Point(GWinX + 880, GWinHalf + 360 - 16); SimulationMode.Visible = false; alwaysOnTopToolStripMenuItem.Checked = true; this.TopMost = true; #endregion Indicator init // Instantiate actuators FiddleOneLeft = new CommandUpdater(); FiddleOneRight = new CommandUpdater(); Couple = new CommandUpdater(); Uncouple = new CommandUpdater(); FiddleGo1 = new CommandUpdater(); FiddleGo2 = new CommandUpdater(); FiddleGo3 = new CommandUpdater(); FiddleGo4 = new CommandUpdater(); FiddleGo5 = new CommandUpdater(); FiddleGo6 = new CommandUpdater(); FiddleGo7 = new CommandUpdater(); FiddleGo8 = new CommandUpdater(); FiddleGo9 = new CommandUpdater(); FiddleGo10 = new CommandUpdater(); FiddleGo11 = new CommandUpdater(); TrainDetect = new CommandUpdater(); FYStart = new CommandUpdater(); FYStop = new CommandUpdater(); Reset = new CommandUpdater(); Occ5BOnTrue = new CommandUpdater(); Occ5BOnFalse = new CommandUpdater(); Occ6OnTrue = new CommandUpdater(); Occ6OnFalse = new CommandUpdater(); Occ7OnTrue = new CommandUpdater(); Occ7OnFalse = new CommandUpdater(); Recoverd = new CommandUpdater(); Collect = new CommandUpdater(); Btn_Stop_Fiddle_TOP.Enabled = false; }
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 }