MainSeq, ITestMethod and all test methods changed, transitions are done in MainSeq (DoTransitions()), no outerLoopCounter, ver. 2.17.757

This commit is contained in:
Milan Hanajik
2017-12-03 18:44:57 +03:00
parent b9b7fc95b4
commit c5453fff5b
46 changed files with 410 additions and 654 deletions
@@ -16,13 +16,19 @@ namespace TBF.BenchControl.GenericDevices
/// <returns>true when the watermeters can be tested by this method</returns>
bool CanTest(MetersKind meters);
/// <summary>
/// Return true when test method requires start/end test transition execution
/// </summary>
/// <returns>true when transitions shold be executed</returns>
bool DoTransitions();
/// <summary>
/// Execute the test method
/// </summary>
/// <param name="test"></param>
/// <param name="outerLoopMode">false = normal eecution, true = Run the test only once and use 'outerLoopCounter'</param>
/// <param name="outerLoopCounter">External test repeats counter</param>
/// <param name="test">Test entity</param>
/// <param name="repetitionNr">Test repetition number (1 .. test.Repeats)</param>
/// <param name="isLastRepetition">true when this is the last repetition count, or a single test is run, or ourterLoop Mode is active</param>
/// <returns>Event(s) indicating the result of execution</returns>
IList<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter);
IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition);
}
}
@@ -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
{
@@ -302,6 +302,20 @@ namespace TBF.BenchControl.Sequences
Stop,
}
/// <summary>
/// Calculates the estimate of transition sequence execution time
/// </summary>
/// <param name="transitionSequence">TransitionSequence entity</param>
/// <returns>Time in seconds</returns>
protected int GetTransitionTimeEst(TransitionSequence transitionSequence)
{
if (transitionSequence == null) return 1;
return 30; /// TODO: Implement time estimte calculation
}
/// <summary>
/// Executes steps of a transition sequence
/// </summary>
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter, DebugMode mode)
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new AdjustmentSeq()).Execute(test, outerLoopMode, outerLoopCounter, DebugLevel);
return (new AdjustmentSeq()).Execute(test, repetNr, DebugLevel);
}
}
}
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
const int DetectionBufferSize = 9;
const int DetectionKernelSize = 5;
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retval1 = new List<Event>(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<Event> retval2 = new List<Event>(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<Event> retval3 = new List<Event>(1);
retval3.Add(Event.Error);
return retval3;
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartAdvancedSeq()).Execute(test, outerLoopMode, outerLoopCounter);
return (new FixedStartAdvancedSeq()).Execute(test, repetNr);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> Execute2ndPass(Test test, int repetNr, object data)
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retList = new List<Event>(1);
retList.Add(retVal);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> Execute2ndPass(Test test, int repetNr, object data)
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> Execute2ndPass(Test test, int repetNr, object data)
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retList = new List<Event>(1);
retList.Add(retVal);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retList = new List<Event>(1);
retList.Add(retVal);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool bdummy, int idummy)
public IList<Event> Execute(Test test, int idummy, bool bdummy)
{
return (new GrabImageSeq()).Execute(test, cfg);
}
@@ -25,9 +25,6 @@ namespace TBF.BenchControl.TestMethods.GrabImage
IList<GenericDevices.ICamera> cameras = new List<GenericDevices.ICamera>();
IList<IOperation> grabImagesOp = new List<IOperation>();
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);
//------------------------------------------------
@@ -27,7 +27,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, LeakTestParams testParams)
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new LeakTestSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams);
return (new LeakTestSeq()).Execute(test, repetNr, testMethodCfg.TestParams);
}
}
}
@@ -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<Event> Execute(Test test, bool bdummy, int idummy)
public IList<Event> Execute(Test test, int idummy, bool bdummy)
{
return (new LiveStreamSeq()).Execute(test, cfg.HiResolution);
}
@@ -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);
//------------------------------------------------
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
IList<Event> events = new List<Event>();
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;
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
IList<Event> events = new List<Event>();
if (outerLoopMode)
if (isLastRepetition)
{
events.Add(Event.Error); /// Outer loops cannot be nested
events.Add(Event.Error); /// Most likely a nested outer loop
}
else
{
@@ -27,7 +27,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, PMaxTestParams testParams)
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new PMaxTestSeq()).Execute(test, outerLoopMode, outerLoopCounter, testMethodCfg.TestParams);
return (new PMaxTestSeq()).Execute(test, repetNr, testMethodCfg.TestParams);
}
}
}
@@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> retList = new List<Event>(1);
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new ReferenceFlowmeterCalibrationSeq()).Execute(test, outerLoopMode, outerLoopCounter);
return (new ReferenceFlowmeterCalibrationSeq()).Execute(test, repetNr);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
private static readonly ILog log = LogManager.GetLogger(typeof(RoiDetectionSeq));
public IList<Event> Execute(Test test, GenericDevices.ICameraDisplay display, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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<Event> retList = new List<Event>(1);
retList.Add(retVal);
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
const int DetectionBufferSize = 9;
const int DetectionKernelSize = 5;
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter,
public IList<Event> 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<Event> retval1 = new List<Event>(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<Event> retval2 = new List<Event>(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<Event> retval3 = new List<Event>(1);
retval3.Add(Event.Error);
return retval3;
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -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<Event> Execute(Test test, bool outerLoopMode, int outerLoopCounter)
public IList<Event> 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);
}
}
}
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
/// Event.OpArgumentError . Target flow is out of range
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, bool outerLoopMode, int outerLoopCounter, TestMethodCfg cfg, iPerlCommunicationParams testParams)
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, TestMethodCfg cfg, iPerlCommunicationParams testParams)
{
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done;
@@ -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")]