diff --git a/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs b/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs
index b17a189bf..e99556bf9 100644
--- a/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs
+++ b/TestBenchFramework/BenchControl/GenericDevices/ITestMethod.cs
@@ -16,13 +16,19 @@ namespace TBF.BenchControl.GenericDevices
/// true when the watermeters can be tested by this method
bool CanTest(MetersKind meters);
+ ///
+ /// Return true when test method requires start/end test transition execution
+ ///
+ /// true when transitions shold be executed
+ bool DoTransitions();
+
///
/// Execute the test method
///
- ///
- /// false = normal eecution, true = Run the test only once and use 'outerLoopCounter'
- /// External test repeats counter
+ /// Test entity
+ /// Test repetition number (1 .. test.Repeats)
+ /// true when this is the last repetition count, or a single test is run, or ourterLoop Mode is active
/// Event(s) indicating the result of execution
- IList Execute(Test test, bool outerLoopMode, int outerLoopCounter);
+ IList Execute(Test test, int repetitionNr, bool isLastRepetition);
}
}
diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
index 83f099ba5..de847007a 100644
--- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
+++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs
@@ -621,8 +621,7 @@ namespace TBF.BenchControl.Sequences
int currentTestIx = selsctedTestIx;
int outerLoopStartIx = currentTestIx;
- bool outerLoopMode = false;
- int outerLoopCounter = 0;
+ bool isOuterLoopMode = false;
while (currentTestIx < StateMachine.Tests.Count - simultWithEvacuationCount)
{
Test test = StateMachine.Tests[currentTestIx];
@@ -662,53 +661,98 @@ namespace TBF.BenchControl.Sequences
}
}
- e = testMethod.Execute(test, outerLoopMode, (outerLoopMode ? outerLoopCounter: repetNr));
+ ///
+ /// Execute one test (single repetition of a repeated test)
+ /// Previously:
+ /// e = testMethod.Execute(test, outerLoopMode, (outerLoopMode ? outerLoopCounter: repetNr));
+ ///
+ Event rsltTransBefore = Event.Done;
+ Event rsltTransAfter = Event.Done;
+ {
+ int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
+ int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
- if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
+ TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
+ /// start, transition, flow detection, flow setting, aborted, test, transition, end
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
+
+ if (testMethod.DoTransitions())
+ {
+ rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
+ log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
+ }
+
+ bool lastTestFinished = true;
+ if (rsltTransBefore == Event.Done)
+ {
+ do
+ {
+ log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
+ e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
+
+ if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
+ {
+ deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
+ }
+
+ lastTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
+ && !e.Contains(Event.ConfigurationError)
+ && !e.Contains(Event.OpArgumentError)
+ && !e.Contains(Event.UiCmdStop));
+
+ if (lastTestFinished && !isOuterLoopMode) repetNr++;
+ }
+ while (lastTestFinished && !isOuterLoopMode && repetNr <= test.Repeats);
+
+ if (lastTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
+ }
+
+ if (testMethod.DoTransitions())
+ {
+ TransitionContext endContext = lastTestFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
+ rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
+ log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", test.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
+ }
+
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, lastTestFinished ? Config.Entities.Progress.Completed
+ : Config.Entities.Progress.Aborted));
+ }
+
+ if (rsltTransBefore == Event.Error || e.Contains(Event.Error))
+ {
+ isOuterLoopMode = false;
+ goto error;
+ }
+ else if (e.Contains(Event.ConfigurationError))
{
- deferredData.Add(new DeferredTestEvaluationData(test,
- (outerLoopMode ? outerLoopCounter: repetNr),
- (testMethod as ITestMethodWith2ndPass).IntermediateData));
- }
- else if (e.Contains(Event.ConfigurationError))
- {
- outerLoopMode = false;
- outerLoopCounter = 0;
- goto select_cycle_or_test;
- }
- else if (e.Contains(Event.Error))
- {
- outerLoopMode = false;
- outerLoopCounter = 0;
- goto error;
+ isOuterLoopMode = false;
+ goto select_cycle_or_test; /// OR goto config_error; ???
}
else if (e.Contains(Event.OpArgumentError))
{
- outerLoopMode = false;
- outerLoopCounter = 0;
+ isOuterLoopMode = false;
goto config_error;
}
- else if (e.Contains(Event.UiCmdStop))
+ else if (rsltTransBefore == Event.UiCmdStop || e.Contains(Event.UiCmdStop))
{
- outerLoopMode = false;
- outerLoopCounter = 0;
+ isOuterLoopMode = false;
goto stop_within_cycle;
}
else if (e.Contains(Event.OuterLoopStart))
{
- outerLoopMode = true;
- outerLoopCounter = 1;
+ isOuterLoopMode = true;
+ repetNr = 1;
outerLoopStartIx = currentTestIx;
}
else if (e.Contains(Event.OuterLoopNext))
{
- outerLoopCounter++;
+ repetNr++;
currentTestIx = outerLoopStartIx;
}
else if (e.Contains(Event.OuterLoopEnd))
{
- outerLoopMode = false;
- outerLoopCounter = 0;
+ isOuterLoopMode = false;
+ repetNr = 1; /// Reset repetNr
}
}
else
@@ -802,18 +846,49 @@ namespace TBF.BenchControl.Sequences
}
}
- e = testMethod.Execute(test, false, repetNr);
+ Event rsltTransBefore = Event.Done;
+ Event rsltTransAfter = Event.Done;
+ {
+ int timeEstTransBefore = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBefore) : 1;
+ int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
- if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
- {
- ITestMethodWith2ndPass tm2 = testMethod as ITestMethodWith2ndPass;
- e = tm2.Execute2ndPass(test, repetNr, tm2.IntermediateData);
- }
+ TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
+ /// start, transition, flow detection, flow setting, aborted, test, transition, end
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
- if (e.Contains(Event.Error)) goto error;
- if (e.Contains(Event.ConfigurationError)) goto config_error;
- if (e.Contains(Event.OpArgumentError)) goto config_error;
- if (e.Contains(Event.UiCmdStop)) goto stop_within_cycle;
+ if (testMethod.DoTransitions())
+ {
+ rsltTransBefore = Transition(transitionBefore, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
+ }
+
+ if (rsltTransBefore == Event.Done)
+ {
+ e = testMethod.Execute(test, repetNr, true);
+
+ if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
+ {
+ ITestMethodWith2ndPass tm2 = testMethod as ITestMethodWith2ndPass;
+ e = tm2.Execute2ndPass(test, repetNr, tm2.IntermediateData);
+ }
+ }
+
+ bool testFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error) && !e.Contains(Event.ConfigurationError)
+ && !e.Contains(Event.OpArgumentError) && !e.Contains(Event.UiCmdStop));
+
+ if (testMethod.DoTransitions())
+ {
+ TransitionContext endContext = testFinished ? TransitionContext.AfterTest : TransitionContext.Stop;
+ rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
+ }
+
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, testFinished ? Config.Entities.Progress.Completed
+ : Config.Entities.Progress.Aborted));
+ }
+
+ if (rsltTransBefore == Event.Error || e.Contains(Event.Error)) goto error;
+ if (e.Contains(Event.ConfigurationError)) goto config_error;
+ if (e.Contains(Event.OpArgumentError)) goto config_error;
+ if (rsltTransBefore == Event.UiCmdStop || e.Contains(Event.UiCmdStop)) goto stop_within_cycle;
}
else
{
diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
index 402839031..6f59a88fd 100644
--- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
+++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs
@@ -302,6 +302,20 @@ namespace TBF.BenchControl.Sequences
Stop,
}
+
+ ///
+ /// Calculates the estimate of transition sequence execution time
+ ///
+ /// TransitionSequence entity
+ /// Time in seconds
+ protected int GetTransitionTimeEst(TransitionSequence transitionSequence)
+ {
+ if (transitionSequence == null) return 1;
+
+ return 30; /// TODO: Implement time estimte calculation
+ }
+
+
///
/// Executes steps of a transition sequence
///
diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
index 55839fdb7..81dec7e6a 100644
--- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter, DebugMode mode)
+ public IList Execute(Test test, int repetitionNr, DebugMode mode)
{
float simulatedError = 4.5f; /// %
@@ -73,23 +73,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
@@ -459,27 +446,19 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// Quit this sequence ///
///----------------------///
- State.Create("Adjustment : Stopping diverter, gate, etc.")
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create("Adjustment : Stopping diverter, gate, etc.")
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs
index 9ca385721..bc50749de 100644
--- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/TestMethod.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public override string ToString() { return string.Format("TestMethods.Adjustment({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public TestMethod()
{
@@ -26,9 +27,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new AdjustmentSeq()).Execute(test, outerLoopMode, outerLoopCounter, DebugLevel);
+ return (new AdjustmentSeq()).Execute(test, repetNr, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
index 25327b241..a9a5b9e5a 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
const int DetectionBufferSize = 9;
const int DetectionKernelSize = 5;
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
CombinedWithDetTestParams testParams,
Config.Entities.DebugMode debugLevel)
{
@@ -41,8 +41,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
///
/// Test method simulation
///
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
@@ -121,25 +119,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
/// Meters path is required for the following:
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: goto error;
- case Event.UiCmdStop: goto stopTest;
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, (int)totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 120, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
+ Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Qrise = 0;
Qfall = 0;
@@ -733,36 +719,26 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
///----------------------///
/// Quit this sequence ///
///----------------------///
- /// Stop the pump
- State.Create("CombinedWithDetection : Test(s) completed -> Stopping the pump")
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
- .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
- .EnterState();
- do {
- e = StateMachine.WaitRunDevsRunOps();
- if (e.Contains(Event.Error)) goto error;
- }
- while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
-
- /// Transition or SetRoute - End
- switch (Transition(transitionAfter, TransitionContext.AfterTest))
+ if (isLastRepetition)
{
- case Event.Error: goto error;
- case Event.UiCmdStop: goto stopTest;
+ /// Stop the pump
+ State.Create("CombinedWithDetection : Test(s) completed -> Stopping the pump")
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
+ .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (e.Contains(Event.Error)) goto error;
+ }
+ while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
}
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
-
/// Create the return value - a list with one event Event.Done - and return
IList retval1 = new List(1);
retval1.Add(Event.Done);
@@ -783,8 +759,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
while (!e.Contains(Event.ValvesSet));
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Aborted));
-
IList retval2 = new List(1);
retval2.Add(Event.UiCmdStop);
return retval2;
@@ -799,12 +773,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
do
{
e = StateMachine.WaitRunDevsRunOps();
- if (e.Contains(Event.Error)) goto error;
+ if (e.Contains(Event.Error)) break;
}
while (!e.Contains(Event.ValvesSet));
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Aborted));
-
IList retval3 = new List(1);
retval3.Add(Event.Error);
return retval3;
diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
index 5968c3fc8..dbe09be67 100644
--- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/TestMethod.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
+ public bool DoTransitions() { return true; }
public TestMethod()
{
@@ -29,9 +30,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new CombinedWithDetectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams, DebugLevel);
+ return (new CombinedWithDetectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/Endurance/Component.cs b/TestBenchFramework/BenchControl/TestMethods/Endurance/Component.cs
index 8532375ec..b93be3bf4 100644
--- a/TestBenchFramework/BenchControl/TestMethods/Endurance/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/Endurance/Component.cs
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -31,9 +32,9 @@ namespace TBF.BenchControl.TestMethods.Endurance
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new EnduranceSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.Cycle, DebugLevel);
+ return (new EnduranceSeq()).Execute(test, repetNr, testMethodCfg.Cycle, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs
index f8a339dfa..457ffb9dc 100644
--- a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr,
string enduranceCycleStr,
Config.Entities.DebugMode debugLevel)
{
@@ -63,25 +63,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// Initialize repetitionNr (First test =1 )
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
//------------------------------------------------
@@ -631,39 +618,25 @@ namespace TBF.BenchControl.TestMethods.Endurance
}
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
-
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
{
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
}
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
index 65aba63e3..e16e3e6c0 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Config.Entities.Test test, int repetitionNr)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
@@ -47,25 +47,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
if (!test.DoDraining)
@@ -598,39 +585,25 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
-
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
- State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
index 83a4fe563..d325880ae 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/Single/Component.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced.Single
public override string ToString() { return string.Format("TestMethods.FixedStartAdvanced({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -26,9 +27,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced.Single
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartAdvancedSeq()).Execute(test, outerLoopMode, outerLoopCounter);
+ return (new FixedStartAdvancedSeq()).Execute(test, repetNr);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Compound/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Compound/Component.cs
index dc53dc439..95e2c33d5 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Compound/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Compound/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Compound
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -32,9 +33,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Compound
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartDeferredEvaluationSeq()).Execute(test, outerLoopMode, outerLoopCounter, true, null, DebugLevel, out intermediateData);
+ return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, true, null, DebugLevel, out intermediateData);
}
public IList Execute2ndPass(Test test, int repetNr, object data)
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs
index acb07414c..8f5d7ed0b 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr,
bool compound,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel,
@@ -41,8 +41,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
- int repetitionNr = Math.Max(1, outerLoopCounter); /// First test: repetitionNr = 1
-
intermediateData = new IntermediateData
{
Compound = compound,
@@ -80,24 +78,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
return e;
}
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
-
///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
@@ -946,42 +931,28 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
-
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
{
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } /// TODO: this is an endless loop !!!
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done || retVal == Event.MakeSecondPass) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done || retVal == Event.MakeSecondPass) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done || retVal == Event.MakeSecondPass) retVal = Event.UiCmdStop; break; }
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } /// TODO: this is an endless loop !!!
+ }
+ while (!e.Contains(Event.PreviousStopped));
}
stopTestWOTransitionAfter:
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done || retVal == Event.MakeSecondPass) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
-
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/HeatMeters/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/HeatMeters/Component.cs
index 5a56199eb..d587f820c 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/HeatMeters/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/HeatMeters/Component.cs
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -35,9 +36,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.HeatMeters
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartDeferredEvaluationSeq()).Execute(test, outerLoopMode, outerLoopCounter, false, testMethodCfg.TestParams, DebugLevel, out intermediateData);
+ return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, false, testMethodCfg.TestParams, DebugLevel, out intermediateData);
}
public IList Execute2ndPass(Test test, int repetNr, object data)
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Single/Component.cs
index 1ace719ca..3a8c0a02c 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Single/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartDeferredEvaluation/Single/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Single
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -32,9 +33,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation.Single
private IntermediateData intermediateData;
public object IntermediateData { get { return intermediateData; } }
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartDeferredEvaluationSeq()).Execute(test, outerLoopMode, outerLoopCounter, false, null, DebugLevel, out intermediateData);
+ return (new FixedStartDeferredEvaluationSeq()).Execute(test, repetNr, false, null, DebugLevel, out intermediateData);
}
public IList Execute2ndPass(Test test, int repetNr, object data)
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
index a877c969d..297e3d365 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Compound/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Compound
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -28,9 +29,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Compound
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, true, null, DebugLevel);
+ return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, true, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
index de3eddc22..81b3a228f 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr,
bool compound,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
@@ -52,8 +52,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
- int repetitionNr = Math.Max(1, outerLoopCounter); /// First test: repetitionNr = 1
-
if (test.Volume >= outPath.Scale.Capacity * Constants.TankFullFactor)
{
@@ -62,24 +60,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
goto stopTestWOTransitionAfter;
}
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
-
///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
@@ -1160,11 +1145,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
stopTest:
@@ -1172,30 +1152,22 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Quit this sequence ///
///----------------------///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
{
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
}
stopTestWOTransitionAfter:
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
-
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
index 92e599f62..0fc43f7b3 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/HeatMeters/Component.cs
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -31,9 +32,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.HeatMeters
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, false, testMethodCfg.TestParams, DebugLevel);
+ return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, false, testMethodCfg.TestParams, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
index d07744cb7..e78def546 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/Single/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Single
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -28,9 +29,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection.Single
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FixedStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, false, null, DebugLevel);
+ return (new FixedStartMassCollectionSeq()).Execute(test, repetNr, false, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Compound/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
index 73eb87ab5..b41ad49e2 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Compound/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -31,9 +32,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Compound
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams, null, DebugLevel);
+ return (new FlyingStartSeq()).Execute(test, repetNr, testMethodCfg.TestParams, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
index e01cbab8e..5a9aa0eaa 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr,
Compound.TestParams compoundTestParams,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
@@ -40,8 +40,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
///
/// Test method simulation
///
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
if (compoundTestParams != null)
@@ -104,26 +102,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
- int repetitionNr = Math.Max(1, outerLoopCounter); /// First test: repetitionNr = 1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
-
///
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
@@ -745,11 +729,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
stopTest:
@@ -757,27 +736,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// Quit this sequence ///
///----------------------///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
index 0e9edc2bb..f41dd1042 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/HeatMeters/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -31,9 +32,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.HeatMeters
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartSeq()).Execute(test, outerLoopMode, outerLoopCounter, null, testMethodCfg.TestParams, DebugLevel);
+ return (new FlyingStartSeq()).Execute(test, repetNr, null, testMethodCfg.TestParams, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Single/Component.cs
index 56a2a90a5..6c8379261 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Single/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/Single/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Single
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -28,9 +29,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart.Single
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartSeq()).Execute(test, outerLoopMode, outerLoopCounter, null, null, DebugLevel);
+ return (new FlyingStartSeq()).Execute(test, repetNr, null, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
index cfe5e7847..baf473efa 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Compound/Component.cs
@@ -18,6 +18,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Combined; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -32,9 +33,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Compound
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams, null, DebugLevel);
+ return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, testMethodCfg.TestParams, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
index 85556ff2e..3fa9f5372 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Compound.CombinedTestParams compoundTestParams,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
@@ -47,8 +47,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
///
/// Test method simulation
///
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 } );
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
if (compoundTestParams != null)
@@ -67,14 +65,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
else if (test.Name.ToLower().Contains("q2")) errorPctBase = 0.5f;
else if (test.Name.ToLower().Contains("q1")) errorPctBase = -5.1f;
- if (outerLoopMode)
- {
- MakeSimulated(test.Name, test.Repeats, outerLoopCounter, 0, errorPctBase + outerLoopCounter * 0.1f);
- }
- else
- {
- for (int i = 1; i <= test.Repeats; i++) MakeSimulated(test.Name, test.Repeats, i, 0, i * 0.1f);
- }
+ MakeSimulated(test.Name, test.Repeats, repetitionNr, 0, errorPctBase + repetitionNr * 0.1f);
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed));
@@ -94,9 +85,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
}
}
- //------------------------------------------------
+ //-------------------------------------------------------------------
Bridge.OnActivity(this, string.Format("{0} Simulation", test.Name));
- //------------------------------------------------
+ //-------------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Simulation", test.Method, test.Name))
.AddOperation(checkUiOp)
@@ -118,9 +109,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
- int repetitionNr = Math.Max(1, outerLoopCounter); /// First test: repetitionNr = 1
-
-
if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor)
{
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
@@ -128,24 +116,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
goto stopTestWOTransitionAfter;
}
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 }); /// start, transition, flow detection, flow setting, aborted, test, transition, end
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
//------------------------------------------------
@@ -679,19 +655,30 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
test_completed:
- ///
- /// Water is stopped immediately after the test and before the 2nd mass measurement in case;
- /// - no 'transition sequence after test' is used
- /// - this is the last (or the only) test repetition or test is a part of an 'outer loop'
- ///
- if (transitionAfter == null && (outerLoopMode || repetitionNr == test.Repeats))
- {
- switch (Transition(transitionAfter, TransitionContext.AfterTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
- }
+ ///
+ /// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
+ /// - no 'transition sequence after test' is used
+ /// - this is the last (or the only) test repetition or test is a part of an 'outer loop'
+ ///
+ if (isLastRepetition && transitionAfter == null)
+ {
+ if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
+
+ State.Create("SequenceBase : Transition : TestEnd - Default action")
+ .AddOperation(checkUiOp)
+ .AddOperation(new MettlerToledo.KeepReadingMassesOp())
+ .AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
+ .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
+ StateMachine.DefaultValvesClose))
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
+ if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.ValvesSet));
+ }
//------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
@@ -1082,41 +1069,27 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
-
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) goto stopTest;
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
stopTestWOTransitionAfter:
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
-
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
index 8e1351bfc..72828b5d8 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/HeatMeters/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -31,9 +32,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.HeatMeters
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, null, testMethodCfg.TestParams, DebugLevel);
+ return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, testMethodCfg.TestParams, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
index fdf49bcd2..e4840c674 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/Single/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
}
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public Component()
{
@@ -28,9 +29,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection.Single
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new FlyingStartMassCollectionSeq()).Execute(test, outerLoopMode, outerLoopCounter, null, null, DebugLevel);
+ return (new FlyingStartMassCollectionSeq()).Execute(test, repetNr, isLastRepetition, null, null, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/GrabImage/Component.cs b/TestBenchFramework/BenchControl/TestMethods/GrabImage/Component.cs
index ae4c77a8d..4b7ae9b88 100644
--- a/TestBenchFramework/BenchControl/TestMethods/GrabImage/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/GrabImage/Component.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
public override string ToString() { return string.Format("TestMethods.LiveStream({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return false; }
readonly GrabImageCfg cfg;
@@ -62,7 +63,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool bdummy, int idummy)
+ public IList Execute(Test test, int idummy, bool bdummy)
{
return (new GrabImageSeq()).Execute(test, cfg);
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/GrabImage/GrabImageSeq.cs b/TestBenchFramework/BenchControl/TestMethods/GrabImage/GrabImageSeq.cs
index 356f1c1ed..df06275de 100644
--- a/TestBenchFramework/BenchControl/TestMethods/GrabImage/GrabImageSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/GrabImage/GrabImageSeq.cs
@@ -25,9 +25,6 @@ namespace TBF.BenchControl.TestMethods.GrabImage
IList cameras = new List();
IList grabImagesOp = new List();
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 60, 0, 0, 0, 0, 0, 60, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.JustStarted));
-
//------------------------------------------------
Bridge.OnActivity(this, test.Method);
//------------------------------------------------
diff --git a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
index 105763dad..16cf05098 100644
--- a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs
@@ -27,7 +27,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, LeakTestParams testParams)
+ public IList Execute(Config.Entities.Test test, int repetitionNr, LeakTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
@@ -37,18 +37,6 @@ namespace TBF.BenchControl.TestMethods.LeakTest
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.JustStarted));
-
- // Transition or SetRoute - Start
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionBefore));
-
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
@@ -381,27 +369,19 @@ namespace TBF.BenchControl.TestMethods.LeakTest
///
/// Quit this sequence
///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/LeakTest/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/LeakTest/TestMethod.cs
index 6a23b58ac..7dba0e19b 100644
--- a/TestBenchFramework/BenchControl/TestMethods/LeakTest/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/LeakTest/TestMethod.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
public override string ToString() { return string.Format("TestMethods.LeakTest({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -29,9 +30,9 @@ namespace TBF.BenchControl.TestMethods.LeakTest
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new LeakTestSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams);
+ return (new LeakTestSeq()).Execute(test, repetNr, testMethodCfg.TestParams);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/LiveStream/Component.cs b/TestBenchFramework/BenchControl/TestMethods/LiveStream/Component.cs
index 88da25bc4..be35884ad 100644
--- a/TestBenchFramework/BenchControl/TestMethods/LiveStream/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/LiveStream/Component.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
public override string ToString() { return string.Format("TestMethods.LiveStream({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return false; }
readonly LiveStreamCfg cfg;
@@ -29,7 +30,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
this.cfg = cfg as LiveStreamCfg;
}
- public IList Execute(Test test, bool bdummy, int idummy)
+ public IList Execute(Test test, int idummy, bool bdummy)
{
return (new LiveStreamSeq()).Execute(test, cfg.HiResolution);
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/LiveStream/LiveStreamSeq.cs b/TestBenchFramework/BenchControl/TestMethods/LiveStream/LiveStreamSeq.cs
index 2920c2ea6..df5e50a6f 100644
--- a/TestBenchFramework/BenchControl/TestMethods/LiveStream/LiveStreamSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/LiveStream/LiveStreamSeq.cs
@@ -37,9 +37,6 @@ namespace TBF.BenchControl.TestMethods.LiveStream
}
}
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 60, 0, 0, 0, 0, 0, 60, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.JustStarted));
-
//------------------------------------------------
Bridge.OnActivity(this, test.Method);
//------------------------------------------------
diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs
index 8b204db7a..11bf47f3e 100644
--- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/End/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End
}
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return false; }
public Component()
{
@@ -28,23 +29,10 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.End
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
IList events = new List();
-
- if (!outerLoopMode)
- {
- events.Add(Event.Error); /// Outer loops mode expected
- }
- else if (outerLoopCounter < test.Repeats)
- {
- events.Add(Event.OuterLoopNext);
- }
- else
- {
- events.Add(Event.OuterLoopEnd);
- }
-
+ events.Add((repetNr < test.Repeats) ? Event.OuterLoopNext : Event.OuterLoopEnd);
return events;
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/Start/Component.cs b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/Start/Component.cs
index 817d75327..55909dc69 100644
--- a/TestBenchFramework/BenchControl/TestMethods/OuterLoop/Start/Component.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/OuterLoop/Start/Component.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.Start
}
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return false; }
public Component()
{
@@ -28,13 +29,13 @@ namespace TBF.BenchControl.TestMethods.OuterLoop.Start
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
IList events = new List();
- if (outerLoopMode)
+ if (isLastRepetition)
{
- events.Add(Event.Error); /// Outer loops cannot be nested
+ events.Add(Event.Error); /// Most likely a nested outer loop
}
else
{
diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
index c9efaf86c..742a8a505 100644
--- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs
@@ -27,7 +27,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, PMaxTestParams testParams)
+ public IList Execute(Config.Entities.Test test, int repetitionNr, PMaxTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
@@ -37,18 +37,6 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.JustStarted));
-
- // Transition or SetRoute - Start
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionBefore));
-
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
@@ -292,27 +280,19 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
///
/// Quit this sequence
///
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/TestMethod.cs
index 38188a162..f2cd80846 100644
--- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/TestMethod.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
public override string ToString() { return string.Format("TestMethods.PMaxTest({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
+ public bool DoTransitions() { return true; }
readonly TestMethodCfg testMethodCfg;
@@ -29,9 +30,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new PMaxTestSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams);
+ return (new PMaxTestSeq()).Execute(test, repetNr, testMethodCfg.TestParams);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
index d23fb35ff..785b1eb09 100644
--- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Config.Entities.Test test, int repetitionNr)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
@@ -47,26 +47,12 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
-
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
int flowSetTime0 = StateMachine.Time;
@@ -389,38 +375,25 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
(retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
stopTest:
///----------------------///
/// Quit this sequence ///
///----------------------///
- State.Create("ReferenceFlowmeterCalibration : Stopping diverter, gate, etc.")
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
- {
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
+ {
+ State.Create("ReferenceFlowmeterCalibration : Stopping diverter, gate, etc.")
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
+ }
+ while (!e.Contains(Event.PreviousStopped));
+ }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs
index 63a7b0803..13a53eaba 100644
--- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/TestMethod.cs
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
public override string ToString() { return string.Format("TestMethods.ReferenceFlowmeterCalibration({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters != MetersKind.HeatMeter; }
+ public bool DoTransitions() { return true; }
public TestMethod()
{
@@ -26,9 +27,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new ReferenceFlowmeterCalibrationSeq()).Execute(test, outerLoopMode, outerLoopCounter);
+ return (new ReferenceFlowmeterCalibrationSeq()).Execute(test, repetNr);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetection.cs b/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
index a9dd29b8a..b3319e857 100644
--- a/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetection.cs
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
public override string ToString() { return string.Format("TestMethods.RoiDetection({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return true; }
-
+ public bool DoTransitions() { return true; }
public RoiDetection()
{
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
GenericDevices.ICameraDisplay display = null;
@@ -41,7 +41,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
}
}
- return (new RoiDetectionSeq()).Execute(test, display, outerLoopMode, outerLoopCounter);
+ return (new RoiDetectionSeq()).Execute(test, display, repetNr);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetectionSeq.cs
index b64d0dac8..f61236593 100644
--- a/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/RoiDetection/RoiDetectionSeq.cs
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetectionSeq));
- public IList Execute(Test test, GenericDevices.ICameraDisplay display, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, GenericDevices.ICameraDisplay display, int repetitionNr)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
@@ -37,27 +37,12 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
-
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: { retVal = Event.Error; goto stopTest; }
- case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
- }
-
//====================
// Start the test
//====================
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
//-------------------------------------------------
Bridge.OnActivity(this, Strings.Starting_the_pump);
@@ -264,36 +249,22 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
Bridge.OnActivity(this, Strings.Detection_completed);
//---------------------------------------------------
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
-
stopTest:
- ///----------------------///
- /// Quit this sequence ///
- ///----------------------///
-
- State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperation(cBrd.StopPreviousOp())
- .EnterState();
- do
+ if (retVal == Event.UiCmdStop || retVal == Event.Error || retVal == Event.OpArgumentError || retVal == Event.ConfigurationError)
{
- e = StateMachine.WaitRunDevsRunOps();
- if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
- }
- while (!e.Contains(Event.PreviousStopped));
-
- /// Transition sequence at the end of test
- /// Prevent overwriting 'retVal' in case it was set to non-default value earlier
- switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
- {
- case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
- case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
+ State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
+ .AddOperation(checkUiOp)
+ .AddOperation(cBrd.StopPreviousOp())
+ .EnterState();
+ do
+ {
+ e = StateMachine.WaitRunDevsRunOps();
+ if (TestAndLogUiCmdStop(test, e)) goto stopTest;
+ }
+ while (!e.Contains(Event.PreviousStopped));
}
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr,
- (retVal == Event.Done) ? Config.Entities.Progress.Completed : Config.Entities.Progress.Aborted));
-
+
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList retList = new List(1);
retList.Add(retVal);
diff --git a/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs
index 1fa9ba4f2..1431f5e8f 100644
--- a/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
const int DetectionBufferSize = 9;
const int DetectionKernelSize = 5;
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
+ public IList Execute(Config.Entities.Test test, int repetitionNr,
SensitivityTestParams testParams,
Config.Entities.DebugMode debugLevel)
{
@@ -41,8 +41,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
///
/// Test method simulation
///
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
if (test.Name.ToLower().Contains("rise") || test.Name.ToLower().Contains("steig"))
@@ -121,25 +119,12 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
/// Meters path is required for the following:
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
- int repetitionNr = outerLoopMode ? outerLoopCounter : 1; /// First test: repetitionNr=1
-
- //====================================
- // Transition or SetRoute - Start
- //====================================
- switch (Transition(transitionBefore, TransitionContext.BeforeTest))
- {
- case Event.Error: goto error;
- case Event.UiCmdStop: goto stopTest;
- }
-
//====================================
loop:
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, (int)totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
- TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 120, 30, 0, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
Qrise = 0;
@@ -528,11 +513,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
/// Append the results to the CSV-file
allResults.Info(TestResult2CsvLine(testName, test.Part));
- if (!outerLoopMode && (++repetitionNr <= test.Repeats))
- {
- goto loop;
- }
-
///----------------------///
/// Quit this sequence ///
///----------------------///
@@ -549,15 +529,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
}
while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
- /// Transition or SetRoute - End
- switch (Transition(transitionAfter, TransitionContext.AfterTest))
- {
- case Event.Error: goto error;
- case Event.UiCmdStop: goto stopTest;
- }
-
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
-
/// Create the return value - a list with one event Event.Done - and return
IList retval1 = new List(1);
retval1.Add(Event.Done);
@@ -578,8 +549,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
}
while (!e.Contains(Event.ValvesSet));
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Aborted));
-
IList retval2 = new List(1);
retval2.Add(Event.UiCmdStop);
return retval2;
@@ -594,12 +563,10 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
do
{
e = StateMachine.WaitRunDevsRunOps();
- if (e.Contains(Event.Error)) goto error;
+ if (e.Contains(Event.Error)) break;
}
while (!e.Contains(Event.ValvesSet));
- Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Aborted));
-
IList retval3 = new List(1);
retval3.Add(Event.Error);
return retval3;
diff --git a/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
index 84f6bbf4b..9264aab5a 100644
--- a/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/SensitivityTest/TestMethod.cs
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
readonly TestMethodCfg testMethodCfg;
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return true; }
public TestMethod()
{
@@ -29,9 +30,9 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
log.Debug(this.ToString());
}
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new SensitivityTestSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams, DebugLevel);
+ return (new SensitivityTestSeq()).Execute(test, repetNr, testMethodCfg.TestParams, DebugLevel);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
index 10bfe6695..11ddfe3f8 100644
--- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/TestMethod.cs
@@ -19,6 +19,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public override string ToString() { return string.Format("TestMethods.Adjustment({0})", Cfg.ToString(1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
+ public bool DoTransitions() { return false; }
readonly TestMethodCfg testMethodCfg;
@@ -79,9 +80,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public void RunDeviceAfter() { }
public void StopDevice() { }
- public IList Execute(Test test, bool outerLoopMode, int outerLoopCounter)
+ public IList Execute(Test test, int repetNr, bool isLastRepetition)
{
- return (new iPerlCommunicationSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg, testMethodCfg.TestParams);
+ return (new iPerlCommunicationSeq()).Execute(test, repetNr, testMethodCfg, testMethodCfg.TestParams);
}
}
}
diff --git a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
index 59860f008..67a8e6317 100644
--- a/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
///
- public IList Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, TestMethodCfg cfg, iPerlCommunicationParams testParams)
+ public IList Execute(Config.Entities.Test test, int repetitionNr, TestMethodCfg cfg, iPerlCommunicationParams testParams)
{
IList e = new List(); /// Events from currently running operations
Event retVal = Event.Done;
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index 7dcc71e22..6dbc51ac3 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.17.755.0")]
-[assembly: AssemblyFileVersion("2.17.755.0")]
+[assembly: AssemblyVersion("2.17.757.0")]
+[assembly: AssemblyFileVersion("2.17.757.0")]