diff --git a/TestBenchFramework/BenchControl/Events.cs b/TestBenchFramework/BenchControl/Events.cs index 689d08f9a..da1c1576f 100644 --- a/TestBenchFramework/BenchControl/Events.cs +++ b/TestBenchFramework/BenchControl/Events.cs @@ -60,7 +60,8 @@ UiCmdPurgeEnd, UiCmdEmptyTank1, UiCmdEmptyTank2, - UiCmdTestOpticalHeads, + UiCmdEmptyTank3, + UiCmdTestOpticalHeads, UiCmdResetResults, UiCmdAcceptResults, UiCmdCalibration, diff --git a/TestBenchFramework/BenchControl/Operations/CheckUIOp.cs b/TestBenchFramework/BenchControl/Operations/CheckUIOp.cs index 2ec7528d5..9b44302a9 100644 --- a/TestBenchFramework/BenchControl/Operations/CheckUIOp.cs +++ b/TestBenchFramework/BenchControl/Operations/CheckUIOp.cs @@ -74,29 +74,30 @@ namespace TBF.BenchControl.Operations switch (cmd) { /// Bench Control Panel buttons - case UI2BenchCmd.StartTest: return Event.UiCmdStartTest; - case UI2BenchCmd.StartQ1: return Event.UiCmdStartQ1; - case UI2BenchCmd.StartQ2: return Event.UiCmdStartQ2; - case UI2BenchCmd.StartQ3: return Event.UiCmdStartQ3; - case UI2BenchCmd.StartCycle: return Event.UiCmdStartCycle; - case UI2BenchCmd.Stop: return Event.UiCmdStop; - case UI2BenchCmd.PurgeBegin: return Event.UiCmdPurgeBegin; - case UI2BenchCmd.PurgeEnd: return Event.UiCmdPurgeEnd; - case UI2BenchCmd.EmptyTank1: return Event.UiCmdEmptyTank1; - case UI2BenchCmd.EmptyTank2: return Event.UiCmdEmptyTank2; - case UI2BenchCmd.TryOpticalHeads: return Event.UiCmdTestOpticalHeads; - case UI2BenchCmd.ResetResults: return Event.UiCmdResetResults; - case UI2BenchCmd.AcceptResults: return Event.UiCmdAcceptResults; - case UI2BenchCmd.Calibration: return Event.UiCmdCalibration; - case UI2BenchCmd.CameraTest: return Event.UiCmdCameraTest; - case UI2BenchCmd.SensitivityTest: return Event.UiCmdSensitivityTest; + case UI2BenchCmd.StartTest: return Event.UiCmdStartTest; + case UI2BenchCmd.StartQ1: return Event.UiCmdStartQ1; + case UI2BenchCmd.StartQ2: return Event.UiCmdStartQ2; + case UI2BenchCmd.StartQ3: return Event.UiCmdStartQ3; + case UI2BenchCmd.StartCycle: return Event.UiCmdStartCycle; + case UI2BenchCmd.Stop: return Event.UiCmdStop; + case UI2BenchCmd.PurgeBegin: return Event.UiCmdPurgeBegin; + case UI2BenchCmd.PurgeEnd: return Event.UiCmdPurgeEnd; + case UI2BenchCmd.EmptyTank1: return Event.UiCmdEmptyTank1; + case UI2BenchCmd.EmptyTank2: return Event.UiCmdEmptyTank2; + case UI2BenchCmd.EmptyTank3: return Event.UiCmdEmptyTank3; + case UI2BenchCmd.TryOpticalHeads: return Event.UiCmdTestOpticalHeads; + case UI2BenchCmd.ResetResults: return Event.UiCmdResetResults; + case UI2BenchCmd.AcceptResults: return Event.UiCmdAcceptResults; + case UI2BenchCmd.Calibration: return Event.UiCmdCalibration; + case UI2BenchCmd.CameraTest: return Event.UiCmdCameraTest; + case UI2BenchCmd.SensitivityTest: return Event.UiCmdSensitivityTest; - case UI2BenchCmd.Next: return Event.Next; + case UI2BenchCmd.Next: return Event.Next; /// Test buttons - case UI2BenchCmd.B1: return Event.UiCmdB1; - case UI2BenchCmd.B2: return Event.UiCmdB2; - case UI2BenchCmd.B3: return Event.UiCmdB3; + case UI2BenchCmd.B1: return Event.UiCmdB1; + case UI2BenchCmd.B2: return Event.UiCmdB2; + case UI2BenchCmd.B3: return Event.UiCmdB3; default: return Event.None; } diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 84f06ed1f..52f6124a7 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -33,8 +33,10 @@ namespace TBF.BenchControl.Sequences PurgeEnd, EmptyTank1, EmptyTank2, + EmptyTank3, CloseTank1, CloseTank2, + CloseTank3, } public MainSeq() @@ -52,9 +54,6 @@ namespace TBF.BenchControl.Sequences Selection selection; bool benchFilled = false; - Entities.TransitionSequence purgeBegin; - Entities.TransitionSequence purgeEnd; - StateMachine.LoadProcedure(true); // TODO: Implement as an operation so that the worker thread is not blocked Bridge.Bench2UI(ButtonsEtc.StopBtnEn); @@ -102,14 +101,16 @@ namespace TBF.BenchControl.Sequences bool emptying1 = false; bool emptying2 = false; + bool emptying3 = false; do { /// Used for emptying FloatBox mass1 = new FloatBox(); FloatBox mass2 = new FloatBox(); + FloatBox mass3 = new FloatBox(); //--------------------------------------------------------- - if (emptying1 || emptying2) + if (emptying1 || emptying2 || emptying3) Bridge.OnActivity(this, Strings.Emptying_tank); else Bridge.OnActivity(this, Strings.Please_select_a_procedure); @@ -117,59 +118,59 @@ namespace TBF.BenchControl.Sequences /// Start something buttons are hidden when emptyign is in progress Bridge.Bench2UI(ButtonsEtc.ProcedureCmbBoxEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | - ((emptying1 || emptying2) ? 0 : (ButtonsEtc.StartCycleBtnEn | ButtonsEtc.StartTestBtnsEn | - ButtonsEtc.PurgeBeginBtnEn | ButtonsEtc.SensitivityTestBtnEn | - ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | - ButtonsEtc.TryOpticalHeadsBtnEn)) | + ((emptying1 || emptying2 || emptying3) ? 0 : + (ButtonsEtc.StartCycleBtnEn | ButtonsEtc.StartTestBtnsEn | + ButtonsEtc.PurgeBeginBtnEn | ButtonsEtc.SensitivityTestBtnEn | + ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | + ButtonsEtc.TryOpticalHeadsBtnEn)) | (((StateMachine.Balance1 != null) && !emptying1) ? ButtonsEtc.EmptyTankBtn1En : 0) | - (((StateMachine.Balance2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0)); + (((StateMachine.Balance2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0) | + (((StateMachine.Balance3 != null) && !emptying3) ? ButtonsEtc.EmptyTankBtn3En : 0)); selection = Selection.None; State.Create("MainSeq : Select a procedure") .AddOperation(checkUiOp) .AddOperation((StateMachine.Balance1 != null) ? StateMachine.Balance1.ReadMassOp(ref mass1) : null) .AddOperation((StateMachine.Balance2 != null) ? StateMachine.Balance2.ReadMassOp(ref mass2) : null) + .AddOperation((StateMachine.Balance3 != null) ? StateMachine.Balance3.ReadMassOp(ref mass3) : null) .AddOperation(cBrd.UpdateTankWeightOp()) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdPurgeBegin)) selection = Selection.PurgeBegin; - if (e.Contains(Event.UiCmdStartTest)) selection = Selection.Test; - if (e.Contains(Event.UiCmdStartQ1)) selection = Selection.Q1; - if (e.Contains(Event.UiCmdStartQ2)) selection = Selection.Q2; - if (e.Contains(Event.UiCmdStartQ3)) selection = Selection.Q3; - if (e.Contains(Event.UiCmdStartCycle)) selection = Selection.Cycle; - if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop; - if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1; - if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2; - if (e.Contains(Event.UiCmdCameraTest)) goto camera_test; - if ((emptying1 == true) && (mass1.Val < (StateMachine.Balance1.Capacity / 100.0f + 20.0f))) - { - selection = Selection.CloseTank1; - } - if ((emptying2 == true) && (mass2.Val < (StateMachine.Balance2.Capacity / 100.0f + 20.0f))) - { - selection = Selection.CloseTank2; - } + if (e.Contains(Event.Error)) goto error; + else if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop; + else if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1; + else if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2; + else if (e.Contains(Event.UiCmdEmptyTank3)) selection = Selection.EmptyTank3; + else if (emptying1 && (mass1.Val < (StateMachine.Balance1.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank1; + else if (emptying2 && (mass2.Val < (StateMachine.Balance2.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank2; + else if (emptying3 && (mass3.Val < (StateMachine.Balance3.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank3; + else if (e.Contains(Event.UiCmdPurgeBegin)) selection = Selection.PurgeBegin; + else if (e.Contains(Event.UiCmdStartTest)) selection = Selection.Test; + else if (e.Contains(Event.UiCmdStartQ1)) selection = Selection.Q1; + else if (e.Contains(Event.UiCmdStartQ2)) selection = Selection.Q2; + else if (e.Contains(Event.UiCmdStartQ3)) selection = Selection.Q3; + else if (e.Contains(Event.UiCmdStartCycle)) selection = Selection.Cycle; + else if (e.Contains(Event.UiCmdCameraTest)) goto camera_test; } while (selection == Selection.None); if (selection == Selection.Stop) { - if (emptying1 || emptying2) + if (emptying1 || emptying2 || emptying3) { IList valvesClose = new List(); if (emptying1) valvesClose.Add(StateMachine.EmptyTankValve1); if (emptying2) valvesClose.Add(StateMachine.EmptyTankValve2); + if (emptying3) valvesClose.Add(StateMachine.EmptyTankValve3); State.Create("MainSeq : Close emptying valve(s)") .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, valvesClose)) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); } while (!e.Contains(Event.ValvesSet)); - emptying1 = emptying2 = false; + emptying1 = emptying2 = emptying3 = false; } selection = Selection.None; } @@ -197,6 +198,18 @@ namespace TBF.BenchControl.Sequences do { e = StateMachine.WaitRunDevsRunOps(); } while (!e.Contains(Event.ValvesSet)); } + else if ((selection == Selection.EmptyTank3) && (emptying3 == false)) + { + emptying3 = true; + Bridge.Bench2UI(ButtonsEtc.ProcedureCmbBoxEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | + (emptying1 ? 0 : ButtonsEtc.EmptyTankBtn1En)); + Bridge.OnActivity(this, Strings.Emptying_tank); + State.Create("MainSeq : Open tank 3") + .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.EmptyTankValve3, null)) + .EnterState(); + do { e = StateMachine.WaitRunDevsRunOps(); } + while (!e.Contains(Event.ValvesSet)); + } else if (selection == Selection.CloseTank1) { State.Create("MainSeq : Close tank 1") @@ -215,10 +228,19 @@ namespace TBF.BenchControl.Sequences while (!e.Contains(Event.ValvesSet)); emptying2 = false; } + else if (selection == Selection.CloseTank3) + { + State.Create("MainSeq : Close tank 3") + .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, StateMachine.EmptyTankValve3)) + .EnterState(); + do { e = StateMachine.WaitRunDevsRunOps(); } + while (!e.Contains(Event.ValvesSet)); + emptying3 = false; + } } while ((selection != Selection.Cycle) && (selection != Selection.Test) && (selection != Selection.Q1) && (selection != Selection.Q2) && (selection != Selection.Q3) - || emptying1 || emptying2); + || emptying1 || emptying2 || emptying3); //-------------------------------- Bridge.Bench2UI(ButtonsEtc.StopBtnEn); @@ -232,9 +254,10 @@ namespace TBF.BenchControl.Sequences Bridge.OnProcedureSelected(this, new ProcedureSelectedEventArgs(StateMachine.Procedure)); - purgeBegin = null; - purgeEnd = null; - foreach (var transition in StateMachine.TransitionSequences) + Entities.TransitionSequence purgeBegin = null; + Entities.TransitionSequence purgeEnd = null; + /// + foreach (var transition in StateMachine.TransitionSequences) { if (transition.Name == StateMachine.Procedure.TransitionStart) purgeBegin = transition; if (transition.Name == StateMachine.Procedure.TransitionEnd) purgeEnd = transition; @@ -290,83 +313,89 @@ namespace TBF.BenchControl.Sequences benchFilled = true; Bridge.Bench2UI(ButtonsEtc.ShowBenchFilled); - if (selection != Selection.PurgeBegin) goto cycle_or_test; + if (selection != Selection.PurgeBegin) + { + goto cycle_or_test; + } ready: + emptying1 = false; emptying2 = false; + emptying3 = false; do { /// Used for emptying FloatBox mass1 = new FloatBox(); FloatBox mass2 = new FloatBox(); + FloatBox mass3 = new FloatBox(); //------------------------------------------------ - if (emptying1 || emptying2) + if (emptying1 || emptying2 || emptying3) Bridge.OnActivity(this, Strings.Emptying_tank); else Bridge.OnActivity(this, Strings.Please_select_a_cycle_a_test_or_empty); //------------------------------------------------ Bridge.Bench2UI(ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | - ((emptying1 || emptying2) ? 0 : (ButtonsEtc.StartCycleBtnEn | ButtonsEtc.StartTestBtnsEn | - ButtonsEtc.PurgeBeginBtnEn | ButtonsEtc.SensitivityTestBtnEn | - ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | - ButtonsEtc.TryOpticalHeadsBtnEn)) | + ((emptying1 || emptying2 || emptying3) ? 0 : + (ButtonsEtc.StartCycleBtnEn | ButtonsEtc.StartTestBtnsEn | + ButtonsEtc.PurgeBeginBtnEn | ButtonsEtc.SensitivityTestBtnEn | + ((Cameras.Count > 0) ? ButtonsEtc.CalibrationBtnEn : 0) | + ButtonsEtc.TryOpticalHeadsBtnEn)) | (((StateMachine.Balance1 != null) && !emptying1) ? ButtonsEtc.EmptyTankBtn1En : 0) | - (((StateMachine.Balance2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0)); + (((StateMachine.Balance2 != null) && !emptying2) ? ButtonsEtc.EmptyTankBtn2En : 0) | + (((StateMachine.Balance3 != null) && !emptying3) ? ButtonsEtc.EmptyTankBtn3En : 0)); selection = Selection.None; State.Create("MainSeq : Select an activity for the selected procedure") .AddOperation(checkUiOp) .AddOperation((StateMachine.Balance1 != null) ? StateMachine.Balance1.ReadMassOp(ref mass1) : null) .AddOperation((StateMachine.Balance2 != null) ? StateMachine.Balance2.ReadMassOp(ref mass2) : null) - .AddOperation(cBrd.UpdateTankWeightOp()) + .AddOperation((StateMachine.Balance3 != null) ? StateMachine.Balance3.ReadMassOp(ref mass3) : null) + .AddOperation(cBrd.UpdateTankWeightOp()) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop; - if (e.Contains(Event.UiCmdStartTest)) selection = Selection.Test; - if (e.Contains(Event.UiCmdStartQ1)) selection = Selection.Q1; - if (e.Contains(Event.UiCmdStartQ2)) selection = Selection.Q2; - if (e.Contains(Event.UiCmdStartQ3)) selection = Selection.Q3; - if (e.Contains(Event.UiCmdStartCycle)) selection = Selection.Cycle; - if (e.Contains(Event.UiCmdPurgeBegin)) - { - selection = Selection.PurgeBegin; - goto fill_the_bench; - } - if (e.Contains(Event.UiCmdPurgeEnd)) goto purge_end; - if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1; - if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2; - if ((emptying1 == true) && (mass1.Val < (StateMachine.Balance1.Capacity / 100.0f + 20.0f))) + else if (e.Contains(Event.UiCmdStop)) selection = Selection.Stop; + else if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1; + else if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2; + else if (e.Contains(Event.UiCmdEmptyTank3)) selection = Selection.EmptyTank3; + else if (emptying1 && (mass1.Val < (StateMachine.Balance1.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank1; + else if (emptying2 && (mass2.Val < (StateMachine.Balance2.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank2; + else if (emptying3 && (mass3.Val < (StateMachine.Balance3.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank3; + else if (e.Contains(Event.UiCmdPurgeBegin)) { - selection = Selection.CloseTank1; + selection = Selection.PurgeBegin; /// Value used to branch the code later on + goto fill_the_bench; } - if ((emptying2 == true) && (mass2.Val < (StateMachine.Balance2.Capacity / 100.0f + 20.0f))) - { - selection = Selection.CloseTank2; - } - if (e.Contains(Event.UiCmdAcceptResults)) goto save_results; + else if (e.Contains(Event.UiCmdPurgeEnd)) goto purge_end; + else if (e.Contains(Event.UiCmdStartTest)) selection = Selection.Test; + else if (e.Contains(Event.UiCmdStartQ1)) selection = Selection.Q1; + else if (e.Contains(Event.UiCmdStartQ2)) selection = Selection.Q2; + else if (e.Contains(Event.UiCmdStartQ3)) selection = Selection.Q3; + else if (e.Contains(Event.UiCmdStartCycle)) selection = Selection.Cycle; + else if (e.Contains(Event.UiCmdAcceptResults)) goto save_results; } while (selection == Selection.None); if (selection == Selection.Stop) { - if (emptying1 || emptying2) + if (emptying1 || emptying2 || emptying3) { IList valvesClose = new List(); if (emptying1) valvesClose.Add(StateMachine.EmptyTankValve1); if (emptying2) valvesClose.Add(StateMachine.EmptyTankValve2); + if (emptying3) valvesClose.Add(StateMachine.EmptyTankValve3); State.Create("MainSeq : Close emptying valve(s)") .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, valvesClose)) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); } while (!e.Contains(Event.ValvesSet)); - emptying1 = emptying2 = false; + emptying1 = emptying2 = emptying3 = false; } selection = Selection.None; } @@ -394,6 +423,18 @@ namespace TBF.BenchControl.Sequences do { e = StateMachine.WaitRunDevsRunOps(); } while (!e.Contains(Event.ValvesSet)); } + else if ((selection == Selection.EmptyTank3) && (emptying3 == false)) + { + emptying3 = true; + Bridge.OnActivity(this, Strings.Emptying_tank); + Bridge.Bench2UI(ButtonsEtc.ProcedureCmbBoxEn | ButtonsEtc.TestCmbBoxEn | ButtonsEtc.StopBtnEn | + (emptying1 ? 0 : ButtonsEtc.EmptyTankBtn1En)); + State.Create("MainSeq : Open emptying valve 3") + .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.EmptyTankValve3, null)) + .EnterState(); + do { e = StateMachine.WaitRunDevsRunOps(); } + while (!e.Contains(Event.ValvesSet)); + } else if (selection == Selection.CloseTank1) { State.Create("MainSeq : Close tank 1") @@ -412,10 +453,19 @@ namespace TBF.BenchControl.Sequences while (!e.Contains(Event.ValvesSet)); emptying2 = false; } + else if (selection == Selection.CloseTank3) + { + State.Create("MainSeq : Close tank 3") + .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, StateMachine.EmptyTankValve3)) + .EnterState(); + do { e = StateMachine.WaitRunDevsRunOps(); } + while (!e.Contains(Event.ValvesSet)); + emptying3 = false; + } } while ((selection != Selection.Cycle) && (selection != Selection.Test) && (selection != Selection.Q1) && (selection != Selection.Q2) && (selection != Selection.Q3) - || emptying1 || emptying2); + || emptying1 || emptying2 || emptying3); cycle_or_test: @@ -443,10 +493,10 @@ namespace TBF.BenchControl.Sequences if (testMethodSequence != null) { //-------------------------------------------------------------- - var events = testMethodSequence.Execute(test); + e = testMethodSequence.Execute(test); - if (events.Contains(Event.Error)) goto error; - if (events.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.Error)) goto error; + if (e.Contains(Event.UiCmdStop)) goto stop; } TimeEstimateBeginRpts += (test.Repeats * TimeEstimateOneTest); diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index e1cdce5f7..d26d24956 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -42,9 +42,11 @@ namespace TBF.BenchControl public static GenericDevices.IAmbient Ambient; public static GenericDevices.IBalance Balance1; public static GenericDevices.IBalance Balance2; - public static GenericDevices.IValve EmptyTankValve1; + public static GenericDevices.IBalance Balance3; + public static GenericDevices.IValve EmptyTankValve1; public static GenericDevices.IValve EmptyTankValve2; - public static IList MasterValves; /// list of directly controlled valves + public static GenericDevices.IValve EmptyTankValve3; + public static IList MasterValves; /// list of directly controlled valves public static IList CoupledValves; /// list of coupled valves @@ -208,9 +210,10 @@ namespace TBF.BenchControl IBalance balance = cmpnt as IBalance; balances.Add(balance); - if (balance.BalanceNr == 0) Balance1 = balance; - else if (balance.BalanceNr == 1) Balance2 = balance; - } + if (balance.BalanceNr == 0) Balance1 = balance; + else if (balance.BalanceNr == 1) Balance2 = balance; + else if (balance.BalanceNr == 2) Balance3 = balance; + } } /// Create an array with tank capacities @@ -275,21 +278,23 @@ namespace TBF.BenchControl // Automatic detection of empty tank valves foreach (var opath in outputPaths) { - if (opath.Balance == Balance1.Cfg.Name) + if ((Balance1 != null) && (opath.Balance == Balance1.Cfg.Name)) { EmptyTankValve1 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; break; } - } - foreach (var opath in outputPaths) - { - if (opath.Balance == Balance2.Cfg.Name) - { - EmptyTankValve2 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; - break; - } - } - + if ((Balance2 != null) && (opath.Balance == Balance2.Cfg.Name)) + { + EmptyTankValve2 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; + break; + } + if ((Balance3 != null) && (opath.Balance == Balance3.Cfg.Name)) + { + EmptyTankValve3 = TbfComponents.FindComponent(opath.EmptyTankValve) as IValve; + break; + } + } + if (loadPathsOnly) return; IList selectedProcs = session diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index 5354dc798..d84edc872 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -31,7 +31,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.PreviousStopped)); @@ -58,7 +58,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod switch (Transition(transitionStart, "FlyingStartCollectionMethod : " + Strings.Test_start_sequence_i_n)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stop; + case Event.UiCmdStop: goto stopTest; } } else @@ -72,7 +72,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.ValvesSet)); } @@ -95,7 +95,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.BalanceDone)); @@ -110,7 +110,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stop; + case Event.UiCmdStop: goto stopTest; } set_flow: @@ -134,7 +134,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.ValvesSet)); @@ -151,7 +151,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; if (e.Contains(Event.OpArgumentError)) if (e.Contains(Event.RegulValveTimeOut)) goto error; if (e.Contains(Event.Next)) goto flow_set; @@ -182,7 +182,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.BalanceDone)); @@ -202,7 +202,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.MeasurementStarted)); @@ -222,7 +222,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod switch (ReadRegistersTempPressAmbient(measureOperations, true)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stop; + case Event.UiCmdStop: goto stopTest; case Event.MeasurementCompleted: goto measurement_completed; } @@ -278,7 +278,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.BalanceDone)); /// @@ -298,7 +298,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.ValvesSet)); @@ -311,7 +311,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stop; + if (e.Contains(Event.UiCmdStop)) goto stopTest; } while (!e.Contains(Event.PreviousStopped)); @@ -418,7 +418,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod switch (Transition(transitionStop, "FlyingStartCollectionMethod : " + Strings.Test_stop_sequence_i_n)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stop; + case Event.UiCmdStop: goto stopTest; } } else @@ -440,7 +440,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod return retval; //==================================== - stop: + stopTest: State.Create("FlyingStartCollectionMethod : User selected STOP -> Closing the valves") .AddOperation(checkUiOp) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) diff --git a/TestBenchFramework/UiBridge/Enums.cs b/TestBenchFramework/UiBridge/Enums.cs index f9d86e7b1..359cb82fd 100644 --- a/TestBenchFramework/UiBridge/Enums.cs +++ b/TestBenchFramework/UiBridge/Enums.cs @@ -15,7 +15,8 @@ namespace TBF.UiBridge PurgeEnd, EmptyTank1, EmptyTank2, - TryOpticalHeads, + EmptyTank3, + TryOpticalHeads, ResetResults, AcceptResults, Calibration, @@ -39,11 +40,12 @@ namespace TBF.UiBridge PurgeEndBtnEn = 0x40, EmptyTankBtn1En = 0x80, EmptyTankBtn2En = 0x100, - TryOpticalHeadsBtnEn = 0x200, - ResetResultsBtnEn = 0x400, - AcceptResultsBtnEn = 0x800, - CalibrationBtnEn = 0x1000, - SensitivityTestBtnEn = 0x2000, + EmptyTankBtn3En = 0x200, + TryOpticalHeadsBtnEn = 0x400, + ResetResultsBtnEn = 0x800, + AcceptResultsBtnEn = 0x1000, + CalibrationBtnEn = 0x2000, + SensitivityTestBtnEn = 0x4000, /// If one of the following flags is set, flags 0x1 through 0x2000 are ignored ///