Possibility to continue in the cycle when selecting a test, ver.2.4.259.

This commit is contained in:
Milan Hanajik 2016-04-07 14:53:34 +02:00
parent 2d20ea1196
commit e94443ad8a
5 changed files with 130 additions and 4 deletions

View File

@ -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,

View File

@ -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")]

View File

@ -582,6 +582,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Continue in the cycle after this test?.
/// </summary>
internal static string Continue_in_the_cycle {
get {
return ResourceManager.GetString("Continue_in_the_cycle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy.
/// </summary>

View File

@ -1158,4 +1158,7 @@
<data name="Zeroing_chdr" xml:space="preserve">
<value>Nulování</value>
</data>
<data name="Continue_in_the_cycle" xml:space="preserve">
<value>Pokračovat v cyklu po tomto testu?</value>
</data>
</root>

View File

@ -1213,4 +1213,7 @@
<data name="StopBFValve_chdr" xml:space="preserve">
<value>Stop backflow valve</value>
</data>
<data name="Continue_in_the_cycle" xml:space="preserve">
<value>Continue in the cycle after this test?</value>
</data>
</root>