diff --git a/Doc/FlyingStartMassCollectionTest.uxf b/Doc/FlyingStartMassCollectionTest.uxf new file mode 100644 index 000000000..ab365fdad --- /dev/null +++ b/Doc/FlyingStartMassCollectionTest.uxf @@ -0,0 +1,525 @@ + + + 8 + + com.umlet.element.Relation + + 400 + 0 + 40 + 64 + + lt=<- + 24;48;24;24 + + + com.umlet.element.custom.InitialState + + 416 + 8 + 16 + 16 + + i + + + + com.umlet.element.custom.State + + 328 + 48 + 192 + 32 + + 'Test Start' transition sequence + + + + com.umlet.element.Relation + + 400 + 56 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.RegionEndState + + 416 + 96 + 16 + 16 + + + + + + com.umlet.element.Relation + + 400 + 88 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.State + + 344 + 128 + 160 + 32 + + Initialize (single) test results + + + + com.umlet.element.Relation + + 400 + 136 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.Decision + + 408 + 176 + 32 + 32 + + + + + + com.umlet.element.Relation + + 400 + 184 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.Decision + + 408 + 224 + 32 + 32 + + + + + + com.umlet.element.custom.RegionEndState + + 416 + 272 + 16 + 16 + + + + + + com.umlet.element.Relation + + 400 + 232 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.Relation + + 400 + 264 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.State + + 344 + 304 + 160 + 32 + + Make the water tank empty + + + + com.umlet.element.Relation + + 400 + 312 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.RegionEndState + + 416 + 352 + 16 + 16 + + + + + + com.umlet.element.Relation + + 400 + 344 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.Relation + + 272 + 168 + 160 + 128 + + lt=<- +m2=[Emptying always] + 144;112;24;112;24;24;136;24 + + + com.umlet.element.Relation + + 408 + 216 + 176 + 160 + + lt=<- +m2=[Enough room in tank] + 24;144;160;144;160;24;32;24 + + + com.umlet.element.custom.State + + 344 + 384 + 160 + 32 + + Set the required water flow + + + + com.umlet.element.Relation + + 400 + 392 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.State + + 328 + 432 + 192 + 32 + + Measure the 'start' mass of water + + + + com.umlet.element.Relation + + 400 + 440 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.State + + 344 + 480 + 160 + 32 + + Start the test (diverter, etc.) + + + + com.umlet.element.Relation + + 400 + 488 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.RegionEndState + + 416 + 528 + 16 + 16 + + + + + + com.umlet.element.custom.State + + 344 + 560 + 160 + 32 + + Read intermediate results + + + + com.umlet.element.Relation + + 400 + 520 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.Relation + + 400 + 568 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.Decision + + 408 + 608 + 32 + 32 + + + + + + com.umlet.element.Relation + + 272 + 512 + 160 + 128 + + lt=<- +m2=[Test in progress] + 144;24;24;24;24;112;136;112 + + + com.umlet.element.Relation + + 400 + 616 + 40 + 64 + + lt=<- + 24;48;24;24 + + + com.umlet.element.custom.Text + + 424 + 640 + 104 + 24 + + [Test completed] + + + + com.umlet.element.custom.State + + 328 + 664 + 192 + 32 + + Measure the 'end' mass of water + + + + com.umlet.element.custom.State + + 328 + 712 + 192 + 32 + + Calculate and save this test results + + + + com.umlet.element.Relation + + 400 + 672 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.Relation + + 400 + 720 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.custom.Decision + + 408 + 760 + 32 + 32 + + + + + + com.umlet.element.Relation + + 400 + 768 + 40 + 64 + + lt=<- + 24;48;24;24 + + + com.umlet.element.Relation + + 408 + 80 + 216 + 712 + + lt=<- +m2=[More repetitions to be done] + 24;24;200;24;200;696;32;696 + + + com.umlet.element.custom.Text + + 264 + 792 + 160 + 24 + + [All test repetitions completed] + + + + com.umlet.element.custom.State + + 328 + 816 + 192 + 32 + + Stop any running tests, etc. (?) + + + + com.umlet.element.custom.State + + 328 + 864 + 192 + 32 + + 'Test End' transition sequence + + + + com.umlet.element.Relation + + 400 + 824 + 40 + 56 + + lt=<- + 24;40;24;24 + + + com.umlet.element.Relation + + 400 + 872 + 40 + 64 + + lt=<- + 24;48;24;24 + + + com.umlet.element.custom.FinalState + + 416 + 920 + 16 + 16 + + + + + diff --git a/Doc/MainSeq.uxf b/Doc/MainSeq.uxf new file mode 100644 index 000000000..5738f7ba4 --- /dev/null +++ b/Doc/MainSeq.uxf @@ -0,0 +1,261 @@ + + + 10 + + com.umlet.element.custom.State + + 400 + 120 + 120 + 40 + + Load the default +procedure + + + + + com.umlet.element.Relation + + 430 + 40 + 50 + 100 + + lt=<- + 30;80;30;30 + + + com.umlet.element.custom.InitialState + + 450 + 60 + 20 + 20 + + i + + + + com.umlet.element.custom.State + + 400 + 190 + 120 + 40 + + Reset valves, +pumps, etc. + + + + + com.umlet.element.Relation + + 430 + 130 + 50 + 80 + + lt=<- + 30;60;30;30 + + + com.umlet.element.custom.State + + 400 + 260 + 120 + 40 + + Detect cameras + + + + com.umlet.element.Relation + + 430 + 200 + 50 + 80 + + lt=<- + 30;60;30;30 + + + com.umlet.element.custom.State + + 370 + 550 + 180 + 110 + + complex +state +-- +some more... + + +-. + + + + com.umlet.element.custom.State + + 370 + 390 + 180 + 60 + + Display prompt, enable +'Cycle' and 'Test' buttons +and wait for a selection + + + + com.umlet.element.Relation + + 430 + 320 + 50 + 90 + + lt=<- + 30;70;30;30 + + + com.umlet.element.custom.RegionEndState + + 450 + 330 + 20 + 20 + + + + + + com.umlet.element.Relation + + 430 + 270 + 50 + 80 + + lt=<- + 30;60;30;30 + + + com.umlet.element.custom.Decision + + 440 + 480 + 40 + 40 + + + + + + com.umlet.element.Relation + + 430 + 420 + 50 + 80 + + lt=<- + 30;60;30;30 + + + com.umlet.element.Relation + + 430 + 490 + 50 + 80 + + lt=<- + 30;60;30;30 + + + com.umlet.element.custom.State + + 620 + 430 + 160 + 40 + + Disable 'Cycle' +and 'Test' buttons + + + + com.umlet.element.custom.State + + 620 + 360 + 160 + 40 + + Empty the tank + + + + com.umlet.element.Relation + + 450 + 440 + 270 + 80 + + lt=<- + 250;30;250;60;30;60 + + + com.umlet.element.Relation + + 670 + 370 + 50 + 80 + + lt=<- + 30;30;30;60 + + + com.umlet.element.Relation + + 440 + 310 + 280 + 70 + + lt=<- + 30;30;260;30;260;50 + + + com.umlet.element.custom.Text + + 490 + 480 + 180 + 20 + + 'Empty a tank' selected + + + + + com.umlet.element.custom.Text + + 290 + 520 + 160 + 20 + + 'Cycle' or 'Test' selected + + + + diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 884e130c4..90902e5dc 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -82,8 +82,8 @@ namespace TBF.BenchControl.Sequences if (e.Contains(Event.CameraOpFailed)) goto error; /// TODO: resolve in some other way + //-------------------------------------------------------------------------------------------- select_procedure: - //---------------------------------------------------------- selection = MakeSelection(MKSelContext.ProcedureNotSelected); //-------------------------------- @@ -96,9 +96,9 @@ namespace TBF.BenchControl.Sequences Bridge.OnProcedureSelected(this, new ProcedureSelectedEventArgs(StateMachine.Procedure)); + /// Find purge suquences Entities.TransitionSequence purgeBegin = null; Entities.TransitionSequence purgeEnd = null; - /// foreach (var transition in StateMachine.TransitionSequences) { if (transition.Name == StateMachine.Procedure.TransitionStart) purgeBegin = transition; diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index c206b2683..71af0bd23 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -23,19 +23,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod IList e; /// Events from currently running operations - //-------------------------------- - State.Create("FlyingStartCollectionMethod : Stopping diverter, gate, etc.") - .AddOperation(checkUiOp) - .AddOperation(cBrd.StopPreviousOp()) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stopTest; - } - while (!e.Contains(Event.PreviousStopped)); - - /// Notes: /// float timeHr = volumeLtr / (1000.0f * targetFlow); /// float timeSec = 3600.0f * timeHr; @@ -54,7 +41,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 stopTest; + case Event.UiCmdStop: goto stopTestAndRunningWater; } } else @@ -68,7 +55,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod do { e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.ValvesSet)); } @@ -80,9 +67,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Single); - if (!test.Emptying) /// Do not skip emptying if test.Emptying==true + if (!test.Emptying) /// If condition met skip measuring and force emptying { - //-------------------------------- + /// + /// Measure the weight and skip emptying if there is enough room in the tank + /// State.Create("FlyingStartCollectionMethod : Measuring the mass of water in the tank") .AddOperation(checkUiOp) .AddOperation(outPath.Balance.ReadMassOp(ref mass)) @@ -91,7 +80,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.BalanceDone)); @@ -102,11 +91,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod } } - // Empty the water tank + /// + /// Empty the water tank + /// switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stopTest; + case Event.UiCmdStop: goto stopTestAndRunningWater; } set_flow: @@ -130,7 +121,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 stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.ValvesSet)); @@ -147,7 +138,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 stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; if (e.Contains(Event.OpArgumentError)) if (e.Contains(Event.RegulValveTimeOut)) goto error; if (e.Contains(Event.Next)) goto flow_set; @@ -178,7 +169,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.BalanceDone)); @@ -198,7 +189,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.MeasurementStarted)); @@ -218,8 +209,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod switch (ReadRegistersTempPressAmbient(measureOperations, true)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stopTest; - case Event.MeasurementCompleted: goto measurement_completed; + case Event.UiCmdStop: goto stopTestAndRunningWater; + case Event.MeasurementCompleted: goto test_completed; } if (firstTime) @@ -260,7 +251,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod } /// Measurement loop - end - measurement_completed: + test_completed: //------------------------------------------------ Bridge.OnActivity(this, Strings.Measuring_the_weight); @@ -274,86 +265,60 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; - if (e.Contains(Event.UiCmdStop)) goto stopTest; + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; } while (!e.Contains(Event.BalanceDone)); /// tstRslt.MassEndRaw = endMass.Val; tstRslt.TimeEnd = DateTime.Now; - //------------------------------------------------ - Bridge.OnActivity(this, Strings.Test_completed); - //------------------------------------------------ - cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps - State.Create("FlyingStartCollectionMethod : Stopping the pump") - .AddOperation(checkUiOp) - .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) - .AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) - .AddOperation(cBrd.UpdateTankWeightOp()) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stopTest; - } - while (!e.Contains(Event.ValvesSet)); - - - //-------------------------------- - State.Create("FlyingStartCollectionMethod : Stopping diverter, gate, etc.") - .AddOperation(checkUiOp) - .AddOperation(cBrd.StopPreviousOp()) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.UiCmdStop)) goto stopTest; - } - while (!e.Contains(Event.PreviousStopped)); + //------------------------------------------------ + Bridge.OnActivity(this, Strings.Test_completed); + //------------------------------------------------ /// - /// Populate TestResult data entity with data + /// Populate TestResult data entity with data /// - tstRslt.TimeEnd = DateTime.Now; + tstRslt.TimeEnd = DateTime.Now; UpdateTestRsltWithAveragedData(tstRslt); - tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections); - tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections); - tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart; - tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3] - tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3] - tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3] - tstRslt.Time = cBrd.TTime; /// [s] measurement time - tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h] - tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h] - tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter - tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total) - tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; - /// Corrected master pulses per liter - if (tstRslt.VolumeCTV <= float.Epsilon) - { - tstRslt.ErrorMaster = 0.1f; - } - else - { - tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV; - } - tstRslt.TimeDivStart0 = 0; - tstRslt.TimeDivStart1 = 0; - tstRslt.TimeDivStart2 = 0; - tstRslt.TimeDivStart3 = 0; - tstRslt.TimeDivStart4 = 0; - tstRslt.TimeDivStart5 = 0; - tstRslt.TimeDivEnd0 = 0; - tstRslt.TimeDivEnd1 = 0; - tstRslt.TimeDivEnd2 = 0; - tstRslt.TimeDivEnd3 = 0; - tstRslt.TimeDivEnd4 = 0; - tstRslt.TimeDivEnd5 = 0; - for (int i = 0; i < Program.WMsCount; i++) - { - if (sensPath.RegisterReaders[i] != null) - { + tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections); + tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections); + tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart; + tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3] + tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3] + tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3] + tstRslt.Time = cBrd.TTime; /// [s] measurement time + tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h] + tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h] + tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3] + tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter + tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total) + tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; + /// Corrected master pulses per liter + if (tstRslt.VolumeCTV <= float.Epsilon) + { + tstRslt.ErrorMaster = 0.1f; + } + else + { + tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV; + } + tstRslt.TimeDivStart0 = 0; + tstRslt.TimeDivStart1 = 0; + tstRslt.TimeDivStart2 = 0; + tstRslt.TimeDivStart3 = 0; + tstRslt.TimeDivStart4 = 0; + tstRslt.TimeDivStart5 = 0; + tstRslt.TimeDivEnd0 = 0; + tstRslt.TimeDivEnd1 = 0; + tstRslt.TimeDivEnd2 = 0; + tstRslt.TimeDivEnd3 = 0; + tstRslt.TimeDivEnd4 = 0; + tstRslt.TimeDivEnd5 = 0; + for (int i = 0; i < Program.WMsCount; i++) + { + if (sensPath.RegisterReaders[i] != null) + { tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString(); tstRslt.Meters[i].VolumeStart = 0; /// liter tstRslt.Meters[i].VolumeEnd = 0; /// liter @@ -376,7 +341,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod tstRslt.Meters[i].Passed = (tstRslt.ErrLimLo <= tstRslt.Meters[i].VolumeErrorPct) && (tstRslt.Meters[i].VolumeErrorPct <= tstRslt.ErrLimHi); } } - /// Add data - end + /// Add data - end AddOrOverwriteResult(tstRslt); @@ -385,36 +350,40 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod /// Append the results to the CSV-file allResults.Info(TestResult2CsvLine(tstRslt, cBrd.EtPulses(0))); - FluentCommon.SaveToDb(StateMachine.WtSession, tstRslt); + FluentCommon.SaveToDb(StateMachine.WtSession, tstRslt); - if (++repetitionNr <= test.Repeats) - { - goto loop; - } - - ///----------------------/// - /// Quit this sequence /// - ///----------------------/// - /// Stop the pump - State.Create("FlyingStartCollectionMethod : Test(s) completed -> Stopping the pump") - .AddOperation(checkUiOp) - .AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) - .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) - .EnterState(); - do { - e = StateMachine.WaitRunDevsRunOps(); - if (e.Contains(Event.Error)) goto error; + if (++repetitionNr <= test.Repeats) + { + goto loop; } - while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone))); - + + ///----------------------/// + /// Quit this sequence /// + ///----------------------/// + + //-------------------------------- + State.Create("FlyingStartCollectionMethod : Stopping diverter, gate, etc.") + .AddOperation(checkUiOp) + .AddOperation(cBrd.StopPreviousOp()) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) goto stopTestAndRunningWater; + } + while (!e.Contains(Event.PreviousStopped)); + + + stopTestAndRunningWater: + ///-------------------------------- /// Transition or SetRoute - End if (transitionStop != null) { switch (Transition(transitionStop, "FlyingStartCollectionMethod : " + Strings.Test_stop_sequence_i_n)) { case Event.Error: goto error; - case Event.UiCmdStop: goto stopTest; + case Event.UiCmdStop: goto stopTestAndRunningWater; } } else @@ -423,35 +392,34 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod .AddOperation(checkUiOp) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .EnterState(); - do { + do + { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; } while (!e.Contains(Event.ValvesSet)); } - /// Create the return value - a list with one event Event.Done - and return - IList retval = new List(); - retval.Add(Event.Done); - return retval; - - //==================================== - stopTest: - State.Create("FlyingStartCollectionMethod : User selected STOP -> Closing the valves") + ///-------------------------------- + /// Stop the pump + cBrd.SetFMFreq(0, 0); /// Stop FM controlled pumps + State.Create("FlyingStartCollectionMethod : Test(s) completed -> Stopping the pump") .AddOperation(checkUiOp) - .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) - .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) + .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOff() : null) + .AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) + .AddOperation(cBrd.UpdateTankWeightOp()) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); if (e.Contains(Event.Error)) goto error; } - while (!e.Contains(Event.ValvesSet)); + while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone))); - IList retval2 = new List(); - retval2.Add(Event.UiCmdStop); - return retval2; + /// Create the return value - a list with one event Event.Done - and return + IList retval = new List(); + retval.Add(Event.Done); + return retval; //==================================== error: diff --git a/TestBenchFramework/SampleConfig/SQLite.db b/TestBenchFramework/SampleConfig/SQLite.db index e7adb8d1b..c1c9d34b0 100644 Binary files a/TestBenchFramework/SampleConfig/SQLite.db and b/TestBenchFramework/SampleConfig/SQLite.db differ