From 2845cf20f5d74950b554f00a9e7be0e5fc28f245 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Thu, 10 Sep 2015 20:07:06 +0200 Subject: [PATCH] iPerlCommunication simultaneously with evacuation (SimultWithNext test parameter), version 1.5.108. --- TODO.txt | 13 ++- .../BenchControl/Sequences/MainSeq.cs | 109 +++++++++++++++--- TestBenchFramework/Properties/AssemblyInfo.cs | 4 +- 3 files changed, 108 insertions(+), 18 deletions(-) diff --git a/TODO.txt b/TODO.txt index f8bec535b..9a1ac8897 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,13 @@ iPerl: +- moznost iPerl komunikacie pri vypustani (do Active modu), pouzit 'Simultaneously with next...' +- 'Q2 corrected from ...' chyba sa nezmensi, ukaze sa povodna +- 'Q2 corrected from ...' Evaluate a Publish parametre +- Results: ukazovat aj Disabled vodomery +- STOP nefunguje vzdy (alebo pomaly) - zlepsit uzivatelsky dojem +- Oracle DB: Bauwjahr +- Oracle DB: UPDATE ... + - MeterType v iPerl.WaterMeter zmenit na test parameter -- STOP nefunguje pocas communikacie, rozne chyby v cykle !!! -- urobit purging sucasne s iPerlCommunication - v iPerlCommunication ponukat stringy v drop-down menu - na Process obrazovke posunut stupacku a rezervoar uplne doprava @@ -9,6 +15,9 @@ iPerl: - export the DB (=make a backup of configuration) from TBF program + + + - ak sa skusa s pevnym startom treba merat priemerny prietok az po uplynuti urcitej doby inak bude vzdy nizsi ako ma byt - rozbeh - bude potrebne doregulovavat pocas merania, Jano poslal moznosti - inak nam diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index dadb263bf..e929cf04c 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -74,8 +74,12 @@ namespace TBF.BenchControl.Sequences bool benchFilled = false; int simultWithPurgingCount = 0; - Generic.IComponentCfg simultWithPurgingCfg; - IList simultWithPurgingParams; + Generic.IComponentCfg simultWithPurgingCfg = null; + IList simultWithPurgingParams = new List(); + + int simultWithEvacuationCount = 0; + Generic.IComponentCfg simultWithEvacuationCfg = null; + IList simultWithEvacuationParams = new List(); StateMachine.LoadProcedure(true); // TODO: Implement as an operation so that the worker thread is not blocked @@ -250,11 +254,11 @@ namespace TBF.BenchControl.Sequences fill_the_bench: /// - /// Analyze whether there are steps (e.g. iPerl communication) to be done simultaneously with purging + /// Collect steps (e.g. iPerl communication) to be done simultaneously with purging /// simultWithPurgingCount = 0; simultWithPurgingCfg = null; - simultWithPurgingParams = new List(); + simultWithPurgingParams.Clear(); /// foreach (var test in StateMachine.Tests) { @@ -280,12 +284,48 @@ namespace TBF.BenchControl.Sequences simultWithPurgingParams.Add(testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams); simultWithPurgingCount++; } + /// - if (simultWithPurgingCount > 0) - { - /// Make sure the entry form is closed - if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop; + /// Collect steps (e.g. iPerl communication) to be done simultaneously with evacuation + /// + simultWithEvacuationCount = 0; + simultWithEvacuationCfg = null; + simultWithEvacuationParams.Clear(); + /// + for (int i = StateMachine.Tests.Count - 1; i >= simultWithPurgingCount; i--) + { + var test = StateMachine.Tests[i]; + Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method); + if (testMethodComp == null) break; + + testMethodComp.Cfg.UpdateTestParams(test); + + ISimultTestMethod simultTest = testMethodComp as ISimultTestMethod; + + if (simultTest == null || !simultTest.SimultWithNext) break; + + if (simultWithEvacuationCount == 0) + { + simultWithEvacuationCfg = simultTest.Cfg; + sensPath = StateMachine.GetMetersPath(test); + } + else if (simultTest.Cfg != simultWithEvacuationCfg) + { + break; + } + + simultWithEvacuationParams.Insert(0, testMethodComp.Cfg.GetTestParams().Clone() as Generic.ITestParams); + simultWithEvacuationCount++; + } + + /// + if (simultWithPurgingCount > 0) + { + /// Make sure the entry form is closed + if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stop; + + /// Open iPerlCommunicationForm Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithPurgingCfg, simultWithPurgingParams }); } @@ -352,7 +392,7 @@ namespace TBF.BenchControl.Sequences selection = MakeSelection(MKSelContext.InsideProcedure); /// if (selection == Selection.PurgeBegin) goto fill_the_bench; - if (selection == Selection.PurgeEnd) goto purge_end; + if (selection == Selection.PurgeEnd) goto evacuation; if (selection == Selection.Break) { Bridge.Bench2UI(ButtonsEtc.ShowBenchEmpty); @@ -371,7 +411,7 @@ namespace TBF.BenchControl.Sequences if (selection == Selection.Cycle) { TimeEstimateTotal = 0; - for (int i = simultWithPurgingCount; i < StateMachine.Tests.Count; i++) + for (int i = simultWithPurgingCount; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++) { Entities.Test test = StateMachine.Tests[i]; @@ -506,7 +546,7 @@ namespace TBF.BenchControl.Sequences goto select_cycle_or_test; - purge_end: + evacuation: save_results: UiBridge.Bridge.OnError(this, string.Empty); /// Clear an error message (if any) @@ -587,21 +627,62 @@ namespace TBF.BenchControl.Sequences } - //-------------------------------- Program.LocalSettings.BatchNr++; Program.LocalSettings.Save(); + if (simultWithEvacuationCount > 0) + { + /// Open iPerlCommunicationForm + Program.MainWnd.Invoke(new iPerlCommFormDlgt(OpenIPerlCommForm), new object[] { this, simultWithEvacuationCfg, simultWithEvacuationParams }); + } + //-------------------------------------------------------- switch (Transition(purgeEnd, TransitionContext.PurgeEnd)) { - case Event.Error: goto error; - case Event.UiCmdStop: goto stop; + case Event.Error: + if (simultWithEvacuationCount > 0) CloseIPerlCommForm(); + goto error; + case Event.UiCmdStop: + if (simultWithEvacuationCount > 0) CloseIPerlCommForm(); + goto stop; + default: + break; } + if (simultWithEvacuationCount > 0) + { + /// + /// Wait until iPerl communications are completed + /// + bool completed = !(modelessDlg is GenericDevices.IHasCompleted) + || (modelessDlg as GenericDevices.IHasCompleted).Completed; + if (!completed) + { + State.Create("MainSeq : Wait until the entry form is closed") + .AddOperation(checkUiOp) + .EnterState(); + do + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.UiCmdStop)) + { + CloseIPerlCommForm(); + goto stop; + } + + completed = (modelessDlg as GenericDevices.IHasCompleted).Completed; + } + while (!completed); + } + + modelessDlg = null; + } + benchFilled = false; Bridge.Bench2UI(ButtonsEtc.ShowBenchEmpty); + goto select_procedure; stop_within_cycle: diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index adbba61e5..07fc326af 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.5.107.1")] -[assembly: AssemblyFileVersion("1.5.107.1")] +[assembly: AssemblyVersion("1.5.108.1")] +[assembly: AssemblyFileVersion("1.5.108.1")]