diff --git a/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs b/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
index 31565057a..52f6521eb 100644
--- a/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
+++ b/TBF/BenchControl/ControlBoard/Legacy/ControlBoardDev.cs
@@ -116,11 +116,11 @@ namespace TBF.BenchControl.ControlBoard.Legacy
public byte MeretProtocol = 0;
// Array length is the reference flowmeters count plus one
-#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SLM_150 || SENTEC || CEVAK_200
+#if DN100 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || SENTEC || CEVAK_200
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[6] { 1, 1, 1, 1, 1, 1 };
-#elif PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || PETERSBURG_200 || RUM_MOB
+#elif PUCHONG_200 || GENESIS || BERLIN || GELSENWASSER || PETERSBURG_200 || RUM_MOB || SLM_150
public uint[,] RegValveCalib = new uint[16, 2] { {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500},
{100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500}, {100,500} };
public byte[] MeretRS485Address = new byte[4];
@@ -716,27 +716,27 @@ namespace TBF.BenchControl.ControlBoard.Legacy
}
if (methodClass.Contains("TestMethods.FixedStart."))
{
- return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
+ return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
}
if (methodClass.Contains("TestMethods.FixedStartAdvanced."))
{
- return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
+ return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
}
if (methodClass.Contains("TestMethods.FixedStartDefferedEval."))
{
- return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses);
+ return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, 10);
}
if (methodClass.Contains("TestMethods.FixedStartMassCollDeferredEval."))
{
- return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses);
+ return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses, 10);
}
if (methodClass.Contains("TestMethods.FixedStartMassCollection."))
{
- return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.FixedStart), test.Qfrom, test.Qto, 2 * totalPulses);
+ return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.FixedStart), test.Qfrom, test.Qto, 2 * totalPulses, 10);
}
if (methodClass.Contains("TestMethods.FixedStartTankCollection."))
{
- return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4));
+ return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4), 10);
}
if (methodClass.Contains("TestMethods.FlyingStart."))
{
@@ -786,7 +786,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
/// Created operation
public IOperation StartProlongedMeasurementOp(OutputPath outputPath,
double requiredFlowLo, double requiredFlowHi,
- int totalRefPulses, int massRefPulses)
+ int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
{
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
{
@@ -795,7 +795,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
else
{
return new StartMeasurementOp(this, outputPath, TestMethods.Diverter | TestMethods.Synchro | TestMethods.MassAndContinue,
- requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses);
+ requiredFlowLo, requiredFlowHi, totalRefPulses, massRefPulses, delayBeforeFlowRegulation);
}
}
diff --git a/TBF/BenchControl/ControlBoard/Legacy/StartMeasurementOp.cs b/TBF/BenchControl/ControlBoard/Legacy/StartMeasurementOp.cs
index 643871325..67e823e68 100644
--- a/TBF/BenchControl/ControlBoard/Legacy/StartMeasurementOp.cs
+++ b/TBF/BenchControl/ControlBoard/Legacy/StartMeasurementOp.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
+/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using log4net;
@@ -22,8 +22,9 @@ namespace TBF.BenchControl.ControlBoard.Legacy
readonly double maximalFlow;
readonly double reqFlowLo;
readonly double reqFlowHi;
- readonly int totalRefPulses; /// Number of reference pulses for a complete test
- readonly int massRefPulses; /// Number of reference pulses for mass collection
+ readonly int totalRefPulses; /// Number of reference pulses for a complete test
+ readonly int massRefPulses; /// Number of reference pulses for mass collection
+ readonly int delayBeforeFlowRegulation; /// Delay before flow control starts in seconds
readonly TestMethods testMethod;
readonly int diverterNr;
@@ -34,13 +35,16 @@ namespace TBF.BenchControl.ControlBoard.Legacy
{
StartingTest,
ResendCommand,
- TestStarted,
- ValveMoveToFlow,
+ WaitingBeforeValveMove,
+ StartingFlowRegulation,
OpCompleted,
}
OpState opState;
+ int delayStartTime; /// StateMachine.Time snapshot when delay before flow regulation starts
+
+
///
/// Starts the measurement.
/// Events: MeasurementStarted
@@ -51,8 +55,8 @@ namespace TBF.BenchControl.ControlBoard.Legacy
/// Test duration in number of reference flowmeter pulses
/// Specifies filter for watermeter pulses
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
- double requiredFlowLo, double requiredFlowHi, int refPulses)
- : this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses)
+ double requiredFlowLo, double requiredFlowHi, int refPulses, int delayBeforeFlowRegulation = 0)
+ : this(controlBoard, outputPath, method, requiredFlowLo, requiredFlowHi, refPulses, refPulses, delayBeforeFlowRegulation)
{
}
@@ -66,7 +70,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
/// Test duration in number of reference flowmeter pulses
/// Specifies filter for watermeter pulses
public StartMeasurementOp(ControlBoardDev controlBoard, OutputPath outputPath, TestMethods method,
- double requiredFlowLo, double requiredFlowHi, int totalRefPulses, int massRefPulses)
+ double requiredFlowLo, double requiredFlowHi, int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
{
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
this.controlBoard = controlBoard;
@@ -100,12 +104,12 @@ namespace TBF.BenchControl.ControlBoard.Legacy
nominalFlow = outputPath.FlowMeter.NominalFlow;
maximalFlow = 1.25 * nominalFlow;
- this.reqFlowLo = requiredFlowLo;
+ this.testMethod = method;
+ this.reqFlowLo = requiredFlowLo;
this.reqFlowHi = requiredFlowHi;
-
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
- this.testMethod = method;
+ this.delayBeforeFlowRegulation = delayBeforeFlowRegulation;
log.Debug(this.ToString());
}
@@ -155,7 +159,15 @@ namespace TBF.BenchControl.ControlBoard.Legacy
if ((statusP & StatusP.TestInProgress) != 0)
{
log.Info("Test started");
- opState = OpState.TestStarted;
+ if (delayBeforeFlowRegulation > 0)
+ {
+ delayStartTime = StateMachine.Time;
+ opState = OpState.WaitingBeforeValveMove;
+ }
+ else
+ {
+ opState = OpState.StartingFlowRegulation;
+ }
}
else
{
@@ -170,7 +182,15 @@ namespace TBF.BenchControl.ControlBoard.Legacy
opState = OpState.StartingTest;
return Event.None;
}
- else if (opState == OpState.TestStarted)
+ else if (opState == OpState.WaitingBeforeValveMove)
+ {
+ if (StateMachine.Time - delayStartTime >= delayBeforeFlowRegulation)
+ {
+ opState = OpState.StartingFlowRegulation;
+ }
+ return Event.None;
+ }
+ else if (opState == OpState.StartingFlowRegulation)
{
///
/// Done once, issues an appropriate ValveMove(...) command
@@ -185,18 +205,18 @@ namespace TBF.BenchControl.ControlBoard.Legacy
double freqLo = 2000.0 * reqFlowLo / nominalFlow;
double freqHi = 2000.0 * reqFlowHi / nominalFlow;
- if (regulValve.IsCoax)
- {
- controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
+ if (regulValve.IsCoax)
+ {
+ controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
new float[2] { (float)((freqLo + freqHi) / 2), (float)((freqLo + freqHi) / 2) },
- regulValveStableTime);
- }
- else
- {
- controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
- new float[2] { (float)freqLo, (float)freqHi },
- regulValveStableTime);
- }
+ regulValveStableTime);
+ }
+ else
+ {
+ controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
+ new float[2] { (float)freqLo, (float)freqHi },
+ regulValveStableTime);
+ }
opState = OpState.OpCompleted;
return Event.None;
diff --git a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
index 20a463700..79b57b8c5 100644
--- a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
+++ b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs
@@ -530,9 +530,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------
+ StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
+ .AddOperation(cBrd.OpenStartValveOp())
.AddOperation(cBrd.StartTestOp(test))
.EnterState();
do {
@@ -540,20 +542,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
- while (!e.Contains(Event.MeasurementStarted));
-
- StartTime = (double)StateMachine.Time;
-
- State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
- .AddOperation(checkUiOp)
- .AddOperations(readTempPressOps)
- .AddOperation(cBrd.OpenStartValveOp())
- .EnterState();
- do {
- e = StateMachine.WaitRunDevsRunOps();
- if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
- }
- while (!e.Contains(Event.ValvesSet));
+ while (!e.Contains(Event.MeasurementStarted) || !e.Contains(Event.ValvesSet));
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
index c75ad3867..6fce4b0a7 100644
--- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
+++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs
@@ -660,11 +660,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
- .AddOperation(cBrd.StartTestOp(test))
.AddOperation(cBrd.OpenStartValveOp())
+ .AddOperation(cBrd.StartTestOp(test))
.EnterState();
- do
- {
+ do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }