2014-07-28 07:54:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using log4net;
|
|
|
|
|
|
using TBF.BenchControl;
|
|
|
|
|
|
using TBF.Resources;
|
2014-07-31 15:04:09 +00:00
|
|
|
|
using TBF.UiBridge;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
|
|
|
|
|
{
|
|
|
|
|
|
public class CombinedWithDetectionSeq : Sequences.SequenceBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(CombinedWithDetectionSeq));
|
|
|
|
|
|
|
|
|
|
|
|
const int DetectionBufferSize = 9;
|
|
|
|
|
|
const int DetectionKernelSize = 5;
|
|
|
|
|
|
|
|
|
|
|
|
public IList<Event> Execute(Entities.Test test, CombinedWithDetTestParams testParams)
|
|
|
|
|
|
{
|
|
|
|
|
|
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
|
|
|
|
|
|
|
|
|
|
|
/// Specific for combined meters
|
|
|
|
|
|
int[] lastWMPulses = new int[Program.WMsCount];
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : stop diverter gate etc")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.StopPreviousOp())
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.PreviousStopped));
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-12 05:17:30 +00:00
|
|
|
|
ltrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
|
|
|
|
|
|
|
|
|
|
|
|
/// Notes:
|
|
|
|
|
|
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
|
|
|
|
|
|
/// float timeSec = 3600.0f * timeHr;
|
|
|
|
|
|
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
|
|
|
|
|
int totalPulses = (int)(test.Volume / ltrPerRefPulse);
|
|
|
|
|
|
|
2014-09-09 14:18:23 +00:00
|
|
|
|
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
|
|
|
|
|
|
|
|
|
|
|
/// Meters path is required for the following:
|
2014-07-28 07:54:35 +00:00
|
|
|
|
readRegisters1 = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders, ref WMPulses, ref WMRefPulses);
|
|
|
|
|
|
readRegisters2 = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders, ref WMPulses, ref WMRefPulses);
|
|
|
|
|
|
|
|
|
|
|
|
int repetitionNr = 1; /// First test: repetitionNr=1
|
|
|
|
|
|
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
// Transition or SetRoute - Start
|
|
|
|
|
|
//====================================
|
2014-08-14 07:05:40 +00:00
|
|
|
|
switch (Transition(transitionStart, TransitionContext.TestStart))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-08-14 07:05:40 +00:00
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
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, (int)totalPulses));
|
|
|
|
|
|
Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Combined);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!test.Emptying) /// Do not skip emptying if test.Emptying==true
|
|
|
|
|
|
{
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Get the mass of water in the tank")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(outPath.Balance.ReadMassOp(ref mass))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
|
2014-07-31 15:04:09 +00:00
|
|
|
|
float estimatedEndMass = mass.Val + test.Volume;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (estimatedEndMass < outPath.Balance.Capacity * Constants.TankFullFactor)
|
|
|
|
|
|
{
|
|
|
|
|
|
goto switching_flow_detection; /// Enough room in the tank -> skip emptying
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Empty the water tank
|
|
|
|
|
|
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance))
|
|
|
|
|
|
{
|
|
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switching_flow_detection:
|
|
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
int flowSetTime0 = StateMachine.Time;
|
|
|
|
|
|
float estFlowSetTime = 100.0f;
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Switching_flow_detection);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Start the pump")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
2014-09-08 11:16:31 +00:00
|
|
|
|
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnDfltPowerOp() : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-01 06:36:17 +00:00
|
|
|
|
|
|
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
|
|
|
|
|
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.ValvesSet));
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Set the initial flow")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
2014-07-31 20:17:38 +00:00
|
|
|
|
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600, (float)test.TolerRed)) /// timeout = 10 min.
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-01 06:36:17 +00:00
|
|
|
|
|
|
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
|
|
|
|
|
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
if (e.Contains(Event.RegulValveTimeOut)) goto error;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.FlowReached));
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
|
|
|
|
|
{
|
|
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
// Find the switching flow
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
|
|
|
|
|
|
/// Allocate detection buffers
|
|
|
|
|
|
float[] flowsForDetection = new float[DetectionBufferSize];
|
|
|
|
|
|
float[] pulseFreqsForDetection = new float[DetectionBufferSize];
|
|
|
|
|
|
|
|
|
|
|
|
/// Current values
|
2014-07-31 20:17:38 +00:00
|
|
|
|
flowsForDetection[0] = refFlow.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
pulseFreqsForDetection[0] = 0.0f;
|
2014-08-01 06:36:17 +00:00
|
|
|
|
int startTime = StateMachine.Time;
|
|
|
|
|
|
int lastTime = StateMachine.Time;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
/// Detection parameters
|
|
|
|
|
|
float rvPulse = (testParams.TargetQ > (test.Qfrom + test.Qto) / 2.0f) ? 0.05f : -0.05f; // rise or fall?
|
|
|
|
|
|
rvPulse *= (100.0f * testParams.RateOfChange);
|
|
|
|
|
|
|
|
|
|
|
|
bool detected = false;
|
|
|
|
|
|
bool targetReached = false;
|
|
|
|
|
|
float detectedFlow = 0;
|
|
|
|
|
|
|
2014-08-01 08:54:38 +00:00
|
|
|
|
int detectionStartTime = StateMachine.Time;
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Change the RV position")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
|
|
|
|
|
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-01 06:36:17 +00:00
|
|
|
|
|
|
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
|
|
|
|
|
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.PositionReached));
|
|
|
|
|
|
|
|
|
|
|
|
// Last pulses are kept to calculate differences
|
|
|
|
|
|
for (int i = 0; i < Program.WMsCount; i++) lastWMPulses[i] = WMPulses[i];
|
|
|
|
|
|
|
|
|
|
|
|
// Shift data in the detection buffers
|
|
|
|
|
|
for (int i = DetectionBufferSize - 2; i >= 0; i--)
|
|
|
|
|
|
{
|
|
|
|
|
|
flowsForDetection[i+1] = flowsForDetection[i];
|
|
|
|
|
|
pulseFreqsForDetection[i+1] = pulseFreqsForDetection[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (ReadRegistersTempPressAmbient(measureOperations, false))
|
|
|
|
|
|
{
|
|
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
int time = StateMachine.Time;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
int diff = WMPulses[1] - lastWMPulses[1];
|
|
|
|
|
|
flowsForDetection[0] = cBrd.ReferenceFreq * outPath.FlowMeter.NominalFlow / 2000.0f;
|
|
|
|
|
|
pulseFreqsForDetection[0] = (float)diff / (float)(time - lastTime);
|
2014-08-01 06:36:17 +00:00
|
|
|
|
lastTime = StateMachine.Time;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2014-08-01 08:54:38 +00:00
|
|
|
|
if (StateMachine.Time - detectionStartTime > 15)
|
|
|
|
|
|
{
|
|
|
|
|
|
if ((flowsForDetection[0] > 0) && (flowsForDetection[DetectionBufferSize - 1] > 0))
|
|
|
|
|
|
{
|
|
|
|
|
|
float[] flowBefore = new float[DetectionKernelSize];
|
|
|
|
|
|
float[] flowAfter = new float[DetectionKernelSize];
|
|
|
|
|
|
float[] freqBefore = new float[DetectionKernelSize];
|
|
|
|
|
|
float[] freqAfter = new float[DetectionKernelSize];
|
|
|
|
|
|
for (int i = 0; i < DetectionKernelSize; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
flowBefore[i] = flowsForDetection[DetectionBufferSize - DetectionKernelSize + i];
|
|
|
|
|
|
freqBefore[i] = pulseFreqsForDetection[DetectionBufferSize - DetectionKernelSize + i];
|
|
|
|
|
|
flowAfter[i] = flowsForDetection[i];
|
|
|
|
|
|
freqAfter[i] = pulseFreqsForDetection[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
Array.Sort(flowBefore);
|
|
|
|
|
|
Array.Sort(flowAfter);
|
|
|
|
|
|
Array.Sort(freqBefore);
|
|
|
|
|
|
Array.Sort(freqAfter);
|
|
|
|
|
|
flowBefore[0] = 0;
|
|
|
|
|
|
flowAfter[0] = 0;
|
|
|
|
|
|
//freqBefore[0] = 0;
|
|
|
|
|
|
//freqAfter[0] = 0;
|
|
|
|
|
|
flowBefore[DetectionKernelSize - 1] = 0;
|
|
|
|
|
|
flowAfter[DetectionKernelSize - 1] = 0;
|
|
|
|
|
|
//freqBefore[DetectionKernelSize - 1] = 0;
|
|
|
|
|
|
//freqAfter[DetectionKernelSize - 1] = 0;
|
|
|
|
|
|
float aveFlowBefore = 0;
|
|
|
|
|
|
float aveFlowAfter = 0;
|
|
|
|
|
|
float aveFreqBefore = 0;
|
|
|
|
|
|
float aveFreqAfter = 0;
|
|
|
|
|
|
foreach (var f in flowBefore) aveFlowBefore += f;
|
|
|
|
|
|
foreach (var f in flowAfter) aveFlowAfter += f;
|
|
|
|
|
|
foreach (var f in freqBefore) aveFreqBefore += f;
|
|
|
|
|
|
foreach (var f in freqAfter) aveFreqAfter += f;
|
|
|
|
|
|
aveFlowBefore /= (float)(DetectionKernelSize - 2);
|
|
|
|
|
|
aveFlowAfter /= (float)(DetectionKernelSize - 2);
|
|
|
|
|
|
aveFreqBefore /= (float)(DetectionKernelSize);
|
|
|
|
|
|
aveFreqAfter /= (float)(DetectionKernelSize);
|
|
|
|
|
|
|
|
|
|
|
|
UiBridge.Bridge.OnLog(this, string.Format("time={0}, flow{1}, aveFlowB={2}, aveFlowA={3}, pulseFreq={4}, aveFreqB={5}, aveFreqA={6}\r\n",
|
|
|
|
|
|
time - startTime,
|
|
|
|
|
|
flowsForDetection[0].ToString("F2"),
|
|
|
|
|
|
aveFlowBefore.ToString("F2"),
|
|
|
|
|
|
aveFlowAfter.ToString("F2"),
|
|
|
|
|
|
pulseFreqsForDetection[0].ToString("F2"),
|
|
|
|
|
|
aveFreqBefore.ToString("F2"),
|
|
|
|
|
|
aveFreqAfter.ToString("F2")));
|
|
|
|
|
|
|
|
|
|
|
|
//detectedFlow = (aveFlowBefore + aveFlowAfter) / 2.0f;
|
|
|
|
|
|
detectedFlow = aveFlowBefore;
|
|
|
|
|
|
|
|
|
|
|
|
if (rvPulse > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
detected = (aveFreqAfter < aveFreqBefore * (1.0f - testParams.DetectionThreshold));
|
|
|
|
|
|
targetReached = ((aveFlowAfter + aveFlowBefore) / 2.0f) > testParams.TargetQ;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
detected = (aveFreqAfter > aveFreqBefore * (1.0f + testParams.DetectionThreshold));
|
|
|
|
|
|
targetReached = ((aveFlowAfter + aveFlowBefore) / 2.0f) < testParams.TargetQ;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!detected && !targetReached);
|
|
|
|
|
|
|
|
|
|
|
|
if (rvPulse > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Qrise = detectedFlow;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Qfall = detectedFlow;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UiBridge.Bridge.OnLog(this, string.Format("detected flow={0}\r\n", detectedFlow.ToString("F2")));
|
|
|
|
|
|
|
|
|
|
|
|
float qfrom_test = detectedFlow + testParams.RelativeQfrom;
|
|
|
|
|
|
float qto_test = detectedFlow + testParams.RelativeQto;
|
|
|
|
|
|
|
|
|
|
|
|
/// Update test results with the test flow determined from the detected switching flow
|
|
|
|
|
|
tstRslt.Qfrom = qfrom_test;
|
|
|
|
|
|
tstRslt.Qto = qto_test;
|
|
|
|
|
|
float Qave_lps = (qfrom_test + qto_test) / 7.2f;
|
|
|
|
|
|
tstRslt.TstTime = tstRslt.Volume / Qave_lps;
|
|
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
float relativeQave = (testParams.RelativeQfrom + testParams.RelativeQto) / 2.0f;
|
|
|
|
|
|
bool goBackToInitFlow = ((rvPulse > 0) && (relativeQave < 0)) ||
|
|
|
|
|
|
((rvPulse < 0) && (relativeQave > 0));
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
if (goBackToInitFlow)
|
|
|
|
|
|
{
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Switching flow detected, going back")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
|
|
|
|
|
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, refFlow, 600)) /// timeout = 10 min.
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
|
|
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
|
|
|
|
|
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
if (e.Contains(Event.RegulValveTimeOut)) goto error;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.FlowReached));
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("CombinedWithDetection : Going to the test flow")
|
|
|
|
|
|
//State.Create("set_RV_position",
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
2014-07-31 20:17:38 +00:00
|
|
|
|
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_test, qto_test, refFlow, 600)) /// timeout = 10 sec.
|
2014-07-28 07:54:35 +00:00
|
|
|
|
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2014-08-01 06:36:17 +00:00
|
|
|
|
|
|
|
|
|
|
int flowSetTime = StateMachine.Time - flowSetTime0;
|
|
|
|
|
|
float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress));
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
//if (e.Contains(Event.FlowTimeOut)) goto do_detection;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.FlowReached));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_measurement:
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create(Strings.Measure_the_mass)
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
2014-07-31 20:17:38 +00:00
|
|
|
|
.AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.TimeStart = DateTime.Now;
|
2014-07-31 20:17:38 +00:00
|
|
|
|
tstRslt.MassStartRaw = startMass.Val;
|
|
|
|
|
|
mass.Val = startMass.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_in_progress);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create(Strings.Start_the_test)
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperations(measureOperations)
|
2014-07-30 22:50:42 +00:00
|
|
|
|
.AddOperation(cBrd.StartMeasurementOp(outPath.FlowMeter, totalPulses, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, (float)test.TolerRed))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.MeasurementStarted));
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Measurement loop - preparation
|
|
|
|
|
|
///
|
|
|
|
|
|
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
|
|
|
|
|
queryEnd2 = cBrd.QueryMeasurementEndOp();
|
|
|
|
|
|
|
|
|
|
|
|
bool firstTime = true; /// Used to reset sums for averaging
|
|
|
|
|
|
ResetAveragedData();
|
|
|
|
|
|
|
|
|
|
|
|
/// Measurement loop - begin
|
|
|
|
|
|
while (true)
|
|
|
|
|
|
{
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
switch (ReadRegistersTempPressAmbient(measureOperations, true))
|
|
|
|
|
|
{
|
|
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
|
|
|
|
|
case Event.MeasurementCompleted: goto measurement_completed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (firstTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
firstTime = false; /// Do the following only once
|
2014-07-31 15:04:09 +00:00
|
|
|
|
tstRslt.TempInStart = tempIn.Val;
|
|
|
|
|
|
tstRslt.TempOutStart = tempOut.Val;
|
|
|
|
|
|
tstRslt.TempDivStart = tempDiv.Val;
|
|
|
|
|
|
tstRslt.PressInStart = pressIn.Val;
|
|
|
|
|
|
tstRslt.PressOutStart = pressOut.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-31 15:04:09 +00:00
|
|
|
|
tstRslt.TempInEnd = tempIn.Val;
|
|
|
|
|
|
tstRslt.TempOutEnd = tempOut.Val;
|
|
|
|
|
|
tstRslt.TempDivEnd = tempDiv.Val;
|
|
|
|
|
|
tstRslt.PressInEnd = pressIn.Val;
|
|
|
|
|
|
tstRslt.PressOutEnd = pressOut.Val;
|
|
|
|
|
|
tstRslt.MassEndRaw = mass.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
AccumulateAveragedData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq,
|
|
|
|
|
|
cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow);
|
|
|
|
|
|
for (int i = 0; i < Program.WMsCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
logstr += string.Format(" M{0}=({1},{2})", i + 1, WMRefPulses[i], WMPulses[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
log.Info(logstr);
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime);
|
|
|
|
|
|
TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
data.WmVolume[2] = data.WmVolume[0] + data.WmVolume[1];
|
2014-08-01 06:36:17 +00:00
|
|
|
|
if (data.Volume.Valid) { data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume.Val); }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
Bridge.OnTestProgress(this, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// Measurement loop - end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
measurement_completed:
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create(Strings.Measure_the_mass)
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2014-07-31 20:17:38 +00:00
|
|
|
|
.AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.BalanceDone));
|
|
|
|
|
|
///
|
2014-07-31 20:17:38 +00:00
|
|
|
|
tstRslt.MassEndRaw = endMass.Val;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
tstRslt.TimeEnd = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_completed);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create(Strings.Stop_the_pump)
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2014-09-08 11:16:31 +00:00
|
|
|
|
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
|
|
|
|
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.ValvesSet));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------
|
|
|
|
|
|
State.Create("stop_diverter_gate_etc")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.StopPreviousOp())
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.PreviousStopped));
|
|
|
|
|
|
|
2014-08-01 06:36:17 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Optionally supress pulses from the large water meter
|
|
|
|
|
|
///
|
|
|
|
|
|
if (testParams.SupressTrills > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
WMPulses[0] = 0;
|
|
|
|
|
|
tstRslt.Meters[0].PulsesMeter = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Populate TestRasult data entity with data
|
|
|
|
|
|
///
|
|
|
|
|
|
tstRslt.TimeEnd = DateTime.Now;
|
|
|
|
|
|
UpdateTestRsltWithAveragedData(tstRslt);
|
|
|
|
|
|
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
|
|
|
|
|
|
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
|
|
|
|
|
|
tstRslt.MassDiff = tstRslt.MassEnd - tstRslt.MassStart;
|
|
|
|
|
|
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.Time = cBrd.TTime; /// [s] measurement time
|
|
|
|
|
|
tstRslt.FlowMass = 3600.0f * tstRslt.MassDiff / tstRslt.Time; /// [kg/h]
|
|
|
|
|
|
tstRslt.FlowVolume = 3600.0f * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.Time; /// [l/h]
|
|
|
|
|
|
tstRslt.VolumeCTV = 1.00103f * 1000.0f * tstRslt.MassDiff / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
|
|
|
|
|
|
tstRslt.VolumeMaster = ltrPerRefPulse * cBrd.EtPulses(0); /// [l] volume from the master flow meter
|
|
|
|
|
|
tstRslt.PulsesMaster = cBrd.EtPulses(0); /// Pulses of the master flow meter (test total)
|
|
|
|
|
|
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster;
|
|
|
|
|
|
/// Corrected master pulses per liter
|
|
|
|
|
|
if (tstRslt.VolumeCTV <= float.Epsilon)
|
|
|
|
|
|
{
|
|
|
|
|
|
tstRslt.ErrorMaster = 0.1f;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV;
|
|
|
|
|
|
}
|
|
|
|
|
|
tstRslt.TimeDivStart0 = 0;
|
|
|
|
|
|
tstRslt.TimeDivStart1 = 0;
|
|
|
|
|
|
tstRslt.TimeDivStart2 = 0;
|
|
|
|
|
|
tstRslt.TimeDivStart3 = 0;
|
|
|
|
|
|
tstRslt.TimeDivStart4 = 0;
|
|
|
|
|
|
tstRslt.TimeDivStart5 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd0 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd1 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd2 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd3 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd4 = 0;
|
|
|
|
|
|
tstRslt.TimeDivEnd5 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (int iCmbnd = 0; iCmbnd < Program.WMsCount / 2; iCmbnd++)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 2 * iCmbnd; i < 2 * iCmbnd + 2; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (sensPath.RegisterReaders[i] == null || sensPath.RegisterReaders[i].PulsesPerLtr <= float.Epsilon)
|
|
|
|
|
|
{
|
|
|
|
|
|
tstRslt.Meters[i].VolumeMeter = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
tstRslt.Meters[i].VolumeMeter = Convert.ToSingle(WMPulses[i]) / sensPath.RegisterReaders[i].PulsesPerLtr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.Meters[i].SerialNr = "wm" + (i + 1).ToString();
|
|
|
|
|
|
tstRslt.Meters[i].VolumeStart = 0; /// liter
|
|
|
|
|
|
tstRslt.Meters[i].VolumeEnd = 0; /// liter
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.Meters[i].VolumeRef = tstRslt.VolumeCTV; /// liter
|
|
|
|
|
|
if (WMRefPulses[i] != 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
tstRslt.Meters[i].VolumeMeter *= ((float)cBrd.EtPulses(0) / (float)WMRefPulses[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.Meters[i].PulsesMeter = WMPulses[i];
|
|
|
|
|
|
tstRslt.Meters[i].PulsesMaster = WMRefPulses[i];
|
|
|
|
|
|
tstRslt.Meters[i].Time = cBrd.TTime;
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.Meters[i].VolumeErrorPct = 0; /// Not used
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].VolumeRef = tstRslt.VolumeCTV; /// liter
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].VolumeMeter = tstRslt.Meters[2 * iCmbnd].VolumeMeter + tstRslt.Meters[2 * iCmbnd + 1].VolumeMeter;
|
|
|
|
|
|
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].PulsesMaster = cBrd.EtPulses(0);
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].Time = cBrd.TTime;
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].VolumeErrorPct = Formulas.ErrorFromVolumes(tstRslt.CombinedMeters[iCmbnd].VolumeMeter, tstRslt.CombinedMeters[iCmbnd].VolumeRef);
|
|
|
|
|
|
tstRslt.CombinedMeters[iCmbnd].Passed = (tstRslt.ErrLimLo <= tstRslt.CombinedMeters[iCmbnd].VolumeErrorPct) && (tstRslt.CombinedMeters[iCmbnd].VolumeErrorPct <= tstRslt.ErrLimHi);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// Add data - end
|
|
|
|
|
|
|
|
|
|
|
|
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(tstRslt));
|
|
|
|
|
|
|
|
|
|
|
|
AddOrOverwriteResult(tstRslt);
|
|
|
|
|
|
|
|
|
|
|
|
/// Append the results to the CSV-file
|
|
|
|
|
|
allResults.Info(TestResult2CsvLine(tstRslt, cBrd.EtPulses(0)));
|
|
|
|
|
|
|
|
|
|
|
|
FluentCommon.SaveToDb(StateMachine.WtSession, tstRslt);
|
|
|
|
|
|
|
|
|
|
|
|
if (++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))
|
2014-09-08 11:16:31 +00:00
|
|
|
|
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.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
|
2014-08-14 07:05:40 +00:00
|
|
|
|
switch (Transition(transitionStop, TransitionContext.TestEnd))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-08-14 07:05:40 +00:00
|
|
|
|
case Event.Error: goto error;
|
|
|
|
|
|
case Event.UiCmdStop: goto stop;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Create the return value - a list with one event Event.Done - and return
|
|
|
|
|
|
IList<Event> retval = new List<Event>();
|
|
|
|
|
|
retval.Add(Event.Done);
|
|
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
stop:
|
|
|
|
|
|
|
|
|
|
|
|
State.Create("CombinedWithDetection : User selected STOP -> Closing the valves")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2014-09-08 11:16:31 +00:00
|
|
|
|
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.ValvesSet));
|
|
|
|
|
|
|
|
|
|
|
|
IList<Event> retval2 = new List<Event>();
|
|
|
|
|
|
retval2.Add(Event.UiCmdStop);
|
|
|
|
|
|
return retval2;
|
|
|
|
|
|
|
|
|
|
|
|
//====================================
|
|
|
|
|
|
error:
|
|
|
|
|
|
State.Create("close_before_error")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2014-09-08 11:16:31 +00:00
|
|
|
|
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
if (e.Contains(Event.Error)) goto error;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.ValvesSet));
|
|
|
|
|
|
|
|
|
|
|
|
IList<Event> retval3 = new List<Event>();
|
|
|
|
|
|
retval3.Add(Event.Error);
|
|
|
|
|
|
return retval3;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|