diff --git a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs
index b68bcc715..fbe405aac 100644
--- a/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs
+++ b/TestBenchFramework/BenchControl/Elde/ControlBoardDev.cs
@@ -566,6 +566,26 @@ namespace TBF.BenchControl.Elde
}
}
+ ///
+ /// Starts the measurement.
+ /// Events: MeasurementStarted
+ ///
+ /// Flow meter
+ /// An array of register readers
+ /// Number of reference pulses to complete the test
+ /// Created operation
+ public IOperation ReadDiverterTransitionOp(int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, TBF.Boxes.FloatBox tStart, TBF.Boxes.FloatBox tEnd)
+ {
+ if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
+ {
+ return new Operations.ReturnGivenEventOp(Event.None);
+ }
+ else
+ {
+ return new ReadDiverterTransitionOp(this, runsCountWhenSendingCmd, runsCountWhenReadingDiv, tStart, tEnd);
+ }
+ }
+
///
/// Queries th econtrol board whether the measurement was completed.
/// Events: MeasurementCompleted or None
diff --git a/TestBenchFramework/BenchControl/Elde/ReadDiverterTransitionOp.cs b/TestBenchFramework/BenchControl/Elde/ReadDiverterTransitionOp.cs
new file mode 100644
index 000000000..e8d99011a
--- /dev/null
+++ b/TestBenchFramework/BenchControl/Elde/ReadDiverterTransitionOp.cs
@@ -0,0 +1,102 @@
+///
+/// Copyright (c) 2017 Sensus Metering Systems
+///
+using System;
+using log4net;
+using TBF.Boxes;
+
+namespace TBF.BenchControl.Elde
+{
+ public class ReadDiverterTransitionOp : IOperation
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ReadDiverterTransitionOp));
+ public override string ToString() { return string.Format("ReadDiverterTransitionOp()"); }
+
+ /// Set by the constructor
+ readonly ControlBoardDev controlBoard;
+ readonly int runsCountWhenSendingCmd;
+ readonly int runsCountWhenReadingDiv;
+ readonly FloatBox tStart;
+ readonly FloatBox tEnd;
+
+ int counter;
+ bool cmdSent = false;
+ bool divRead = false;
+
+
+ ///
+ /// Starts the measurement.
+ /// Events: MeasurementStarted
+ ///
+ /// Control board component reference
+ /// Specifies used components
+ /// Test method
+ /// Test duration in number of reference flowmeter pulses
+ /// Specifies filter for watermeter pulses
+ public ReadDiverterTransitionOp(ControlBoardDev controlBoard, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, FloatBox tStart, FloatBox tEnd)
+ {
+ if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
+ if (runsCountWhenSendingCmd < 0) throw new ArgumentNullException("runsCountWhenSendingCmd");
+ if (runsCountWhenReadingDiv <= runsCountWhenSendingCmd) throw new ArgumentNullException("runsCountWhenReadingDiv");
+ if (tStart == null) throw new ArgumentNullException("tStart");
+ if (tEnd == null) throw new ArgumentNullException("tEnd");
+
+ this.controlBoard = controlBoard;
+ this.runsCountWhenSendingCmd = runsCountWhenSendingCmd;
+ this.runsCountWhenReadingDiv = runsCountWhenReadingDiv;
+ this.tStart = tStart;
+ this.tEnd = tEnd;
+
+ log.Debug(this.ToString());
+ }
+
+ /// Start this operation
+ public void Start()
+ {
+ counter = 0;
+ if (runsCountWhenSendingCmd == 0)
+ {
+ SendCommand();
+ }
+ }
+
+ /// Run this operation
+ ///
+ /// Event.FlowInDone or Event.FlowOutDone
+ ///
+ public Event Run()
+ {
+ counter++;
+
+ if (counter == runsCountWhenSendingCmd)
+ {
+ SendCommand();
+ }
+ else if (counter == runsCountWhenReadingDiv)
+ {
+ ReadDiverter();
+ }
+
+ return Event.None;
+ }
+
+ /// Stop this operation
+ public void Stop()
+ {
+ }
+
+ void SendCommand()
+ {
+ controlBoard.SyncRoute();
+ controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, 0, 0, 0, StopDevs.None);
+ cmdSent = true;
+ }
+
+ void ReadDiverter()
+ {
+ tStart.Val = 0.001f * (float)controlBoard.DivTime(1);
+ tEnd.Val = 0.001F * (float)controlBoard.DivTime(2);
+ divRead = true;
+ }
+ }
+}
diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
index 3084b737a..1848e69b0 100644
--- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
+++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs
@@ -35,8 +35,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
- float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
- float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
+ float switchTimeStart = 0.001f; /// in seconds, initial value is 1 ms
+ float switchTimeEnd = 0.001f; /// in seconds, initial value is 1 ms
+ FloatBox switchTimeStartLo = new FloatBox(0.001f);
+ FloatBox switchTimeStartHi = new FloatBox(0.002f);
+ FloatBox switchTimeEndLo = new FloatBox(0.001f);
+ FloatBox switchTimeEndHi = new FloatBox(0.002f);
if (debugLevel == Config.Entities.DebugMode.Simulate)
{
@@ -620,6 +624,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
+ .AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeStartLo, switchTimeStartHi))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
.EnterState();
@@ -708,6 +713,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.UpdateTankWeightOp())
+ .AddOperation(cBrd.ReadDiverterTransitionOp(1, 3, switchTimeEndLo, switchTimeEndHi))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
@@ -799,10 +805,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
- tstRslt.DiverterStart = switchTimeStart;
- tstRslt.DiverterEnd = switchTimeEnd;
+ tstRslt.DiverterStart = Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val);
+ tstRslt.DiverterEnd = Math.Abs(switchTimeEndLo.Val - switchTimeEndHi.Val);
+ log.DebugFormat("switchTimeStartHi={0} switchTimeStartLo={1} switchTimeEndLo={2} switchTimeEndHi={3}",
+ switchTimeStartHi, switchTimeStartLo, switchTimeEndLo, switchTimeEndHi);
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
- tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, switchTimeStart, switchTimeEnd) : 0;
+ tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, tstRslt.DiverterStart, tstRslt.DiverterEnd) : 0;
if (compoundTestParams != null)
{
diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs
index cb2e36eac..de225f5ac 100644
--- a/TestBenchFramework/Properties/AssemblyInfo.cs
+++ b/TestBenchFramework/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.17.700.1")]
-[assembly: AssemblyFileVersion("2.17.700.1")]
+[assembly: AssemblyVersion("2.17.704.1")]
+[assembly: AssemblyFileVersion("2.17.704.1")]
diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj
index e312c1580..56297b71a 100644
--- a/TestBenchFramework/TBF.csproj
+++ b/TestBenchFramework/TBF.csproj
@@ -468,6 +468,7 @@
+