2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using log4net;
|
2014-08-15 12:31:45 +00:00
|
|
|
|
using TBF.BenchControl;
|
|
|
|
|
|
using TBF.Boxes;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using TBF.Resources;
|
|
|
|
|
|
using TBF.UiBridge;
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class FlyingStartCollectionMethodSeq : Sequences.SequenceBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(FlyingStartCollectionMethodSeq));
|
|
|
|
|
|
|
2014-08-15 12:31:45 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Flying start mass collection method sequence
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="test">Test entity</param>
|
|
|
|
|
|
/// <returns>
|
|
|
|
|
|
/// Event.Done . . . . . . . OK
|
|
|
|
|
|
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
|
|
|
|
|
/// Event.OpArgumentError . Target flow is out of range
|
|
|
|
|
|
/// Event.Error . . . . . . Unspecified error
|
|
|
|
|
|
/// </returns>
|
2015-12-04 16:17:20 +00:00
|
|
|
|
public IList<Event> Execute(Config.Entities.Test test, TestParams testParams)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
|
|
|
|
|
|
2014-09-26 15:48:55 +00:00
|
|
|
|
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
|
|
|
|
|
Event retVal = Event.Done;
|
|
|
|
|
|
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-02-10 18:24:10 +00:00
|
|
|
|
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
|
2014-09-10 11:43:33 +00:00
|
|
|
|
|
|
|
|
|
|
/// Notes:
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
|
|
|
|
|
|
/// float timeSec = 3600.0f * timeHr;
|
|
|
|
|
|
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
2016-02-10 18:24:10 +00:00
|
|
|
|
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
2014-09-24 17:58:05 +00:00
|
|
|
|
|
2014-09-09 14:18:23 +00:00
|
|
|
|
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-08-25 15:02:58 +00:00
|
|
|
|
int repetitionNr = 1; /// First test: repetitionNr = 1
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
// Transition or SetRoute - Start
|
|
|
|
|
|
//====================================
|
2015-05-22 08:29:56 +00:00
|
|
|
|
switch (Transition(transitionBefore, TransitionContext.BeforeTest))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-08-15 12:31:45 +00:00
|
|
|
|
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-08 18:18:45 +00:00
|
|
|
|
int flowSetTime0 = StateMachine.Time;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
//====================================
|
|
|
|
|
|
loop:
|
|
|
|
|
|
/// Start the test, initialize test results
|
|
|
|
|
|
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
2016-01-03 01:05:35 +00:00
|
|
|
|
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
|
|
|
|
|
TestStartTime = DateTime.Now;
|
2016-01-08 18:18:45 +00:00
|
|
|
|
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
|
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2015-02-01 16:42:14 +00:00
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
2015-05-19 13:38:58 +00:00
|
|
|
|
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
2015-02-01 16:42:14 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Starting the pump")
|
2015-02-01 16:42:14 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(new Operations.TimerOp(5))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-02-10 18:24:10 +00:00
|
|
|
|
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2015-02-01 16:42:14 +00:00
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.TimerExpired));
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Starting the pump")
|
2015-02-01 16:42:14 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-02-10 18:24:10 +00:00
|
|
|
|
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2015-02-01 16:42:14 +00:00
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.ValvesSet));
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (!test.Emptying) /// If condition met => skip measuring and force emptying
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-08-13 14:20:00 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Measure the weight and skip emptying if there is enough room in the tank
|
|
|
|
|
|
///
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Measuring the mass of water in the tank")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-02-10 18:24:10 +00:00
|
|
|
|
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
|
2015-12-20 19:48:50 +00:00
|
|
|
|
float estimatedEndMass = Mass.Val + test.Volume;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor)
|
|
|
|
|
|
{
|
|
|
|
|
|
goto set_flow; /// Enough room in the tank -> skip emptying
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-13 14:20:00 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Empty the water tank
|
|
|
|
|
|
///
|
2014-07-28 07:54:35 +00:00
|
|
|
|
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance))
|
|
|
|
|
|
{
|
2014-08-15 12:31:45 +00:00
|
|
|
|
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set_flow:
|
|
|
|
|
|
|
2015-05-19 13:38:58 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
|
|
|
|
|
//------------------------------------------------
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Setting the flow")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2016-01-10 11:39:20 +00:00
|
|
|
|
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 990)) /// timeout = 16.5 min.
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-02-10 18:24:10 +00:00
|
|
|
|
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
2014-08-01 06:36:17 +00:00
|
|
|
|
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-01-12 04:56:19 +00:00
|
|
|
|
if (e.Contains(Event.RegulValveTimeOut))
|
|
|
|
|
|
{
|
|
|
|
|
|
Bridge.OnError(this, Strings.Timeout);
|
|
|
|
|
|
retVal = Event.Done;
|
|
|
|
|
|
goto stopTest;
|
|
|
|
|
|
}
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.Next)) goto flow_set;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.FlowReached));
|
|
|
|
|
|
|
|
|
|
|
|
flow_set:
|
2016-01-08 18:18:45 +00:00
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
2015-12-20 19:48:50 +00:00
|
|
|
|
float currentFlow = RefFlow.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Extract cameras from the current sensors path, add operations to the detection state
|
|
|
|
|
|
IList<IOperation> measureOperations = new List<IOperation>();
|
|
|
|
|
|
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
GenericDevices.ICameraRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.ICameraRoi;
|
|
|
|
|
|
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasureOp());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Waiting before 1st mass measurement")
|
2015-04-19 11:07:49 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-04-19 11:07:49 +00:00
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
|
|
|
|
|
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
2015-04-19 11:07:49 +00:00
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
|
|
|
|
|
.AddOperation(processDataLoggingOp)
|
2015-05-19 13:38:58 +00:00
|
|
|
|
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
|
2015-04-19 11:07:49 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.TimerExpired));
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-09 14:18:23 +00:00
|
|
|
|
LogProcessHeader(processDataLogger, "Start mass");
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
|
|
|
|
|
//------------------------------------------------
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Measuring the start mass")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2014-09-10 10:05:49 +00:00
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperations(measureOperations)
|
2016-02-10 18:24:10 +00:00
|
|
|
|
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, 5))
|
2014-09-10 10:05:49 +00:00
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
|
|
|
|
|
.AddOperation(processDataLoggingOp)
|
|
|
|
|
|
.EnterState();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
|
2014-09-09 14:18:23 +00:00
|
|
|
|
LogProcessHeader(processDataLogger, "Measurement");
|
|
|
|
|
|
|
2016-02-10 18:24:10 +00:00
|
|
|
|
log.WarnFormat("Start mass = {0}kg", StartMass);
|
|
|
|
|
|
Mass.Val = StartMass.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_in_progress);
|
|
|
|
|
|
//------------------------------------------------
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Starting the test")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-09-22 18:37:32 +00:00
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
2015-09-22 18:37:32 +00:00
|
|
|
|
.AddOperations(measureOperations)
|
|
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
|
|
|
|
|
.AddOperation(processDataLoggingOp)
|
|
|
|
|
|
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
|
2015-09-22 16:39:00 +00:00
|
|
|
|
test.Qfrom, test.Qto, totalPulses, (float)test.TolerRed))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.MeasurementStarted));
|
|
|
|
|
|
|
2015-08-19 11:04:47 +00:00
|
|
|
|
|
2015-08-22 11:34:10 +00:00
|
|
|
|
foreach (var rr in sensPath.RegisterReaders)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rr is WaterMeters.iPerl.WaterMeter) (rr as WaterMeters.iPerl.WaterMeter).TestName = test.Name;
|
|
|
|
|
|
}
|
2015-08-19 11:04:47 +00:00
|
|
|
|
|
2015-08-16 20:00:02 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Measurement loop - preparation
|
2016-02-13 15:47:15 +00:00
|
|
|
|
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
2015-08-19 11:04:47 +00:00
|
|
|
|
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
|
|
|
|
|
ClearAllStatistics();
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Measurement loop - begin
|
2015-08-19 11:04:47 +00:00
|
|
|
|
State.Create("Read water meters")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
|
|
|
|
|
.AddOperation(readRegistersOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
|
|
|
|
|
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
2015-08-19 11:04:47 +00:00
|
|
|
|
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
|
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity)
|
2015-08-19 11:04:47 +00:00
|
|
|
|
: null)
|
|
|
|
|
|
.AddOperation(queryEnd1)
|
|
|
|
|
|
.AddOperation(processDataLoggingOp)
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto stopTest;
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stopTest;
|
|
|
|
|
|
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-05-19 13:38:58 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
2015-09-22 09:29:20 +00:00
|
|
|
|
if (remainingTime > 60)
|
|
|
|
|
|
{
|
2015-10-14 13:45:51 +00:00
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
2015-09-22 09:29:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
|
|
|
|
|
}
|
2015-05-19 13:38:58 +00:00
|
|
|
|
//------------------------------------------------
|
2015-02-20 12:38:07 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
UpdateAllStatistics();
|
2016-02-10 18:24:10 +00:00
|
|
|
|
RefFreq.Val = cBrd.ReferenceFreq;
|
2015-12-20 19:48:50 +00:00
|
|
|
|
RefFlow.Val = cBrd.ReferenceFlow;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-02-10 18:24:10 +00:00
|
|
|
|
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
|
|
|
|
|
}
|
2015-08-19 11:04:47 +00:00
|
|
|
|
while (true);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// Measurement loop - end
|
|
|
|
|
|
|
2014-08-13 14:20:00 +00:00
|
|
|
|
test_completed:
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Waiting before 2nd mass measurement")
|
2014-12-11 07:49:07 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-08-19 11:04:47 +00:00
|
|
|
|
.AddOperation(readRegistersOp)
|
2014-12-11 07:49:07 +00:00
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
|
|
|
|
|
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
2014-12-11 07:49:07 +00:00
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
|
|
|
|
|
.AddOperation(processDataLoggingOp)
|
2015-05-19 13:38:58 +00:00
|
|
|
|
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
2014-12-11 07:49:07 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.TimerExpired));
|
2015-03-24 09:11:20 +00:00
|
|
|
|
|
2014-09-09 14:18:23 +00:00
|
|
|
|
LogProcessHeader(processDataLogger, "End mass");
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
|
|
|
|
|
//------------------------------------------------
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Measuring the end mass")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-08-19 11:04:47 +00:00
|
|
|
|
.AddOperation(readRegistersOp)
|
2014-09-10 10:05:49 +00:00
|
|
|
|
.AddOperation((StateMachine.Ambient != null)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
|
2016-02-10 18:24:10 +00:00
|
|
|
|
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, 5))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
2014-09-10 10:05:49 +00:00
|
|
|
|
.AddOperation(processDataLoggingOp)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
///
|
2016-02-10 18:24:10 +00:00
|
|
|
|
log.WarnFormat("End mass = {0}kg", EndMass);
|
|
|
|
|
|
TestEndTime = DateTime.Now;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2014-08-13 14:20:00 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_completed);
|
|
|
|
|
|
//------------------------------------------------
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-01-15 05:34:36 +00:00
|
|
|
|
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
2015-06-25 02:45:04 +00:00
|
|
|
|
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
2015-01-15 05:34:36 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
///
|
2014-08-13 14:20:00 +00:00
|
|
|
|
/// Populate TestResult data entity with data
|
2014-07-28 07:54:35 +00:00
|
|
|
|
///
|
2016-01-03 01:05:35 +00:00
|
|
|
|
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
2015-08-22 04:32:55 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
if (tstRslt != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Auxiliary results
|
|
|
|
|
|
tstRslt.AmbientTempAve = AmbientTempStat.Average;
|
|
|
|
|
|
tstRslt.AmbientPressAve = AmbientPressureStat.Average;
|
|
|
|
|
|
tstRslt.AmbientHumiAve = AmbientHumidityStat.Average;
|
|
|
|
|
|
tstRslt.PressUpAvrg = PressureUpStat.Average;
|
|
|
|
|
|
tstRslt.PressUpStart = PressureUpStat.First;
|
|
|
|
|
|
tstRslt.PressUpEnd = PressureUpStat.Last;
|
|
|
|
|
|
tstRslt.PressUpMin = PressureUpStat.Min;
|
|
|
|
|
|
tstRslt.PressUpMax = PressureUpStat.Max;
|
|
|
|
|
|
tstRslt.PressDownAvrg = PressureDownStat.Average;
|
|
|
|
|
|
tstRslt.PressDownStart = PressureDownStat.First;
|
|
|
|
|
|
tstRslt.PressDownEnd = PressureDownStat.Last;
|
|
|
|
|
|
tstRslt.PressDownMin = PressureDownStat.Min;
|
|
|
|
|
|
tstRslt.PressDownMax = PressureDownStat.Max;
|
|
|
|
|
|
tstRslt.TempInAvrg = TempInStat.Average;
|
|
|
|
|
|
tstRslt.TempInStart = TempInStat.First;
|
|
|
|
|
|
tstRslt.TempInEnd = TempInStat.Last;
|
|
|
|
|
|
tstRslt.TempInMin = TempInStat.Min;
|
|
|
|
|
|
tstRslt.TempInMax = TempInStat.Max;
|
|
|
|
|
|
tstRslt.TempOutAvrg = TempOutStat.Average;
|
|
|
|
|
|
tstRslt.TempOutStart = TempOutStat.First;
|
|
|
|
|
|
tstRslt.TempOutEnd = TempOutStat.Last;
|
|
|
|
|
|
tstRslt.TempOutMin = TempOutStat.Min;
|
|
|
|
|
|
tstRslt.TempOutMax = TempOutStat.Max;
|
|
|
|
|
|
tstRslt.TempDivAvrg = TempDivStat.Average;
|
|
|
|
|
|
tstRslt.TempDivStart = TempDivStat.First;
|
|
|
|
|
|
tstRslt.TempDivEnd = TempDivStat.Last;
|
|
|
|
|
|
tstRslt.TempDivMin = TempDivStat.Min;
|
|
|
|
|
|
tstRslt.TempDivMax = TempDivStat.Max;
|
|
|
|
|
|
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
|
|
|
|
|
|
|
|
|
|
|
/// Main results
|
|
|
|
|
|
tstRslt.StartTime = TestStartTime;
|
|
|
|
|
|
tstRslt.EndTime = TestEndTime;
|
|
|
|
|
|
tstRslt.FlowSetTime = flowSetTime;
|
|
|
|
|
|
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
|
|
|
|
|
|
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
|
2016-02-10 18:24:10 +00:00
|
|
|
|
tstRslt.MassStartRaw = StartMass.Val;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
2016-02-10 18:24:10 +00:00
|
|
|
|
tstRslt.MassEndRaw = EndMass.Val;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
|
|
|
|
|
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
|
2016-02-10 18:24:10 +00:00
|
|
|
|
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
2016-02-10 18:24:10 +00:00
|
|
|
|
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
|
|
|
|
|
|
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
2014-08-13 14:20:00 +00:00
|
|
|
|
{
|
2016-01-03 01:05:35 +00:00
|
|
|
|
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
2016-02-13 15:47:15 +00:00
|
|
|
|
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
|
2016-01-03 01:05:35 +00:00
|
|
|
|
WaterMeters.iPerl.WaterMeter iPerl = regReader as WaterMeters.iPerl.WaterMeter;
|
2015-08-22 04:32:55 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
if (meterRslt != null && regReader != null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2016-01-03 01:05:35 +00:00
|
|
|
|
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
2016-02-13 15:47:15 +00:00
|
|
|
|
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
|
|
|
|
|
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
if (iPerl != null)
|
|
|
|
|
|
{
|
2016-01-08 18:18:45 +00:00
|
|
|
|
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
|
|
|
|
|
meterRslt.TimestampEnd = iPerl.NoSamples ? (iPerl.TimestampSecStart + tstRslt.TestTime) : iPerl.TimestampSecEnd;
|
|
|
|
|
|
meterRslt.TestTime = iPerl.NoSamples ? tstRslt.TestTime : (meterRslt.TimestampEnd - meterRslt.TimestampStart);
|
|
|
|
|
|
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
2016-01-03 01:05:35 +00:00
|
|
|
|
meterRslt.VolumeEnd = iPerl.VolumeLtrEnd; /// liter
|
|
|
|
|
|
meterRslt.VolumeMeter = Math.Abs(iPerl.VolumeLtrEnd - iPerl.VolumeLtrStart);
|
|
|
|
|
|
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
|
|
|
|
|
iPerl.VolumeLtrRef = meterRslt.VolumeRef;
|
|
|
|
|
|
#if IPERLST
|
2016-01-08 15:57:37 +00:00
|
|
|
|
meterRslt.WaterMeter.CalibFactor = (iPerl.CalibrationStruct != null) ? iPerl.CalibrationStruct.Calibration : 0;
|
|
|
|
|
|
meterRslt.WaterMeter.Q2Correction = iPerl.CurrentQ2Correction;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
iPerl.LastTestResult = meterRslt; /// Save this water meter test result to iPerl WM
|
|
|
|
|
|
iPerl.NominalTestFlow = 500.0 * (double)(test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2016-01-08 18:18:45 +00:00
|
|
|
|
meterRslt.TestTime = tstRslt.TestTime; /// TODO: Malo by sa citat z dosky
|
2016-02-13 07:18:49 +00:00
|
|
|
|
meterRslt.VolumeStart = 0; /// liter
|
|
|
|
|
|
meterRslt.VolumeEnd = 0; /// liter
|
|
|
|
|
|
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
|
|
|
|
|
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
2016-01-03 01:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
|
|
|
|
|
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
|
|
|
|
|
|
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty);
|
|
|
|
|
|
meterRslt.TestDone = true;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2015-08-22 04:32:55 +00:00
|
|
|
|
}
|
2016-01-08 18:18:45 +00:00
|
|
|
|
|
|
|
|
|
|
tstRslt.Components = Results.Entities.Components
|
|
|
|
|
|
.UpdateList(BatchRslts.ComponentsList,
|
|
|
|
|
|
new Results.Entities.Components(BenchInfo.TestBenchId,
|
|
|
|
|
|
BenchInfo.TestBenchName,
|
|
|
|
|
|
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
|
|
|
|
|
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
|
|
|
|
|
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
|
|
|
|
|
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
|
|
|
|
|
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2014-08-13 14:20:00 +00:00
|
|
|
|
/// Add data - end
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2016-01-08 18:18:45 +00:00
|
|
|
|
|
|
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.TransitionAfter));
|
2016-01-04 15:03:17 +00:00
|
|
|
|
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, test.Part));
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Append the results to the CSV-file
|
2016-01-03 01:05:35 +00:00
|
|
|
|
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
2014-08-13 14:20:00 +00:00
|
|
|
|
if (++repetitionNr <= test.Repeats)
|
|
|
|
|
|
{
|
|
|
|
|
|
goto loop;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-15 12:31:45 +00:00
|
|
|
|
stopTest:
|
|
|
|
|
|
|
2014-08-13 14:20:00 +00:00
|
|
|
|
///----------------------///
|
|
|
|
|
|
/// Quit this sequence ///
|
|
|
|
|
|
///----------------------///
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
State.Create("FlyingStartMassCollection : Stopping diverter, gate, etc.")
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2014-08-13 14:20:00 +00:00
|
|
|
|
.AddOperation(cBrd.StopPreviousOp())
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
2014-08-13 14:20:00 +00:00
|
|
|
|
do
|
|
|
|
|
|
{
|
2014-07-28 07:54:35 +00:00
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-15 12:31:45 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
2014-08-13 14:20:00 +00:00
|
|
|
|
while (!e.Contains(Event.PreviousStopped));
|
|
|
|
|
|
|
2014-08-14 07:05:40 +00:00
|
|
|
|
/// Transition sequence at the end of test
|
2014-08-15 12:31:45 +00:00
|
|
|
|
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier
|
2016-02-07 21:27:32 +00:00
|
|
|
|
switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-08-15 12:31:45 +00:00
|
|
|
|
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
|
|
|
|
|
|
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
|
|
|
|
|
|
|
2014-08-15 12:31:45 +00:00
|
|
|
|
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
2015-02-02 22:18:28 +00:00
|
|
|
|
IList<Event> retList = new List<Event>(1);
|
2014-08-15 12:31:45 +00:00
|
|
|
|
retList.Add(retVal);
|
|
|
|
|
|
return retList;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|