diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index 1f29e60db..bd8617296 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -417,9 +417,25 @@ namespace TBF.BenchControl.Sequences if (selection != Selection.Cycle) { + //-------------------------------- + State.Create("MainSeq : Continue in the cycle?") + .AddOperation(new Operations.AskYesNoOp(Strings.Continue_in_the_cycle)) + .AddOperation(checkUiOp) + .EnterState(); + while (true) + { + e = StateMachine.WaitRunDevsRunOps(); + if (e.Contains(Event.Yes)) + { + selection = Selection.RestOfCycle; + break; + } + if (e.Contains(Event.No)) break; + if (e.Contains(Event.UiCmdStop)) goto select_procedure; + } } - if (selection == Selection.Cycle) + if (selection == Selection.Cycle) { float TimeEstimateTotal; /// Time estimate of the selected cycle or test float TimeEstimateBeginRpts; /// Time estimate at the beginning of all repetitions of the current tests @@ -498,7 +514,101 @@ namespace TBF.BenchControl.Sequences TimeEstimateBeginRpts += (test.Repeats * TimeEstimateOneTest); } } - else + else if (selection == Selection.RestOfCycle) + { + Test slctdTest = TBF.BenchControl.StateMachine.GetTest(selection); + if (slctdTest == null) + { + UiBridge.Bridge.OnError(this, string.Format("No test specified")); + goto select_cycle_or_test; + } + + int selsctedTestIx = -1; + for (int i = simultWithPurgingCount; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++) + { + if (slctdTest == StateMachine.Tests[i]) selsctedTestIx = i; + } + if (selsctedTestIx == -1) goto select_cycle_or_test; + + + float TimeEstimateTotal; /// Time estimate of the selected cycle or test + float TimeEstimateBeginRpts; /// Time estimate at the beginning of all repetitions of the current tests + float TimeEstimateOneTest; /// Time estimate of the current test (one repetition) + + TimeEstimateTotal = 0; + for (int i = selsctedTestIx; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++) + { + Test test = StateMachine.Tests[i]; + + TimeEstimateTotal += (test.Repeats * (test.TstTime + 10.0f)); + + /// Try to fetch all test paths and transitions + /// to detect configuration errors as early as possible. + string errorMsg; + if (!StateMachine.GetPaths(test, out inPath, out benchPath, + out outPath, out sensPath, + out transitionBefore, out transitionAfter, + out errorMsg)) + { + UiBridge.Bridge.OnError(this, errorMsg); + goto select_cycle_or_test; + } + } + + TimeEstimateBeginRpts = 0; + for (int i = selsctedTestIx; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++) + { + Test test = StateMachine.Tests[i]; + + /// Fetch the test paths and transitions + string errorMsg; + if (!StateMachine.GetPaths(test, out inPath, out benchPath, + out outPath, out sensPath, + out transitionBefore, out transitionAfter, + out errorMsg)) + { + UiBridge.Bridge.OnError(this, errorMsg); + goto select_cycle_or_test; + } + + /// Update format for the water mass + Mass.Format = outPath.Balance.Format; + StartMass.Format = outPath.Balance.Format; + EndMass.Format = outPath.Balance.Format; + + TimeEstimateOneTest = test.TstTime + 10.0f; + //-------------------------------------------------------------- + ITestMethod testMethodSequence = TbfComponents.FindComponent(test.Method) as ITestMethod; + if (testMethodSequence != null && testMethodSequence.CanTest(StateMachine.Procedure.MetersKind)) + { + StateMachine.LoadTestParams(test); + ProcessData.RegisterReaders = sensPath.RegisterReaders; + + foreach (var rr in sensPath.RegisterReaders) + { + if ((rr is WaterMeters.iPerl.WaterMeter) && (BenchInfo != null)) + { + (rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchName; + } + } + + e = testMethodSequence.Execute(test); + + if (e.Contains(Event.ConfigurationError)) goto select_cycle_or_test; + if (e.Contains(Event.Error)) goto error; + if (e.Contains(Event.OpArgumentError)) goto config_error; + if (e.Contains(Event.UiCmdStop)) goto stop_within_cycle; + } + else + { + UiBridge.Bridge.OnError(this, string.Format("{0} cannot be used", test.Method)); + goto select_cycle_or_test; + } + + TimeEstimateBeginRpts += (test.Repeats * TimeEstimateOneTest); + } + } + else /// if (selection == Selection.Test) { Test test = TBF.BenchControl.StateMachine.GetTest(selection); if (test == null) @@ -807,6 +917,7 @@ namespace TBF.BenchControl.Sequences /// Used as return values Cycle, + RestOfCycle, Test, Q1, Q2, diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index efe465020..d82fe0cd9 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.5.258.1")] -[assembly: AssemblyFileVersion("2.5.258.1")] +[assembly: AssemblyVersion("2.5.259.1")] +[assembly: AssemblyFileVersion("2.5.259.1")] diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index cb0d48f7e..d32484e96 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -582,6 +582,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Continue in the cycle after this test?. + /// + internal static string Continue_in_the_cycle { + get { + return ResourceManager.GetString("Continue_in_the_cycle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Copy. /// diff --git a/TestBenchFramework/Resources/Strings.cs.resx b/TestBenchFramework/Resources/Strings.cs.resx index 36f5cd00c..7d3cf7423 100644 --- a/TestBenchFramework/Resources/Strings.cs.resx +++ b/TestBenchFramework/Resources/Strings.cs.resx @@ -1158,4 +1158,7 @@ Nulování + + Pokračovat v cyklu po tomto testu? + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 2b390fb3d..ea22860f5 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1213,4 +1213,7 @@ Stop backflow valve + + Continue in the cycle after this test? + \ No newline at end of file