ReadDiverterTransitionOp implemented, ver. 2.17.704
This commit is contained in:
@@ -566,6 +566,26 @@ namespace TBF.BenchControl.Elde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the measurement.
|
||||||
|
/// Events: MeasurementStarted
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="flowMeter">Flow meter</param>
|
||||||
|
/// <param name="readers">An array of register readers</param>
|
||||||
|
/// <param name="refPulses">Number of reference pulses to complete the test</param>
|
||||||
|
/// <returns>Created operation</returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queries th econtrol board whether the measurement was completed.
|
/// Queries th econtrol board whether the measurement was completed.
|
||||||
/// Events: MeasurementCompleted or None
|
/// Events: MeasurementCompleted or None
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Starts the measurement.
|
||||||
|
/// Events: MeasurementStarted
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controlBoard">Control board component reference</param>
|
||||||
|
/// <param name="outputPath">Specifies used components</param>
|
||||||
|
/// <param name="method">Test method</param>
|
||||||
|
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||||
|
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Start this operation</summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
if (runsCountWhenSendingCmd == 0)
|
||||||
|
{
|
||||||
|
SendCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Run this operation</summary>
|
||||||
|
/// <returns>
|
||||||
|
/// Event.FlowInDone or Event.FlowOutDone
|
||||||
|
/// </returns>
|
||||||
|
public Event Run()
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
|
||||||
|
if (counter == runsCountWhenSendingCmd)
|
||||||
|
{
|
||||||
|
SendCommand();
|
||||||
|
}
|
||||||
|
else if (counter == runsCountWhenReadingDiv)
|
||||||
|
{
|
||||||
|
ReadDiverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Event.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Stop this operation</summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-5
@@ -35,8 +35,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
|||||||
Event retVal = Event.Done;
|
Event retVal = Event.Done;
|
||||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||||
|
|
||||||
float switchTimeStart = 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, original vale 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)
|
if (debugLevel == Config.Entities.DebugMode.Simulate)
|
||||||
{
|
{
|
||||||
@@ -620,6 +624,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
|||||||
.AddOperation((StateMachine.Ambient != null)
|
.AddOperation((StateMachine.Ambient != null)
|
||||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
|
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
|
||||||
: null)
|
: null)
|
||||||
|
.AddOperation(cBrd.ReadDiverterTransitionOp(2, 4, switchTimeStartLo, switchTimeStartHi))
|
||||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||||
.AddOperation(processDataLoggingOp)
|
.AddOperation(processDataLoggingOp)
|
||||||
.EnterState();
|
.EnterState();
|
||||||
@@ -708,6 +713,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
|||||||
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
|
||||||
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
.AddOperation(outPath.Scale.ReadMassOp(ref Mass))
|
||||||
.AddOperation(cBrd.UpdateTankWeightOp())
|
.AddOperation(cBrd.UpdateTankWeightOp())
|
||||||
|
.AddOperation(cBrd.ReadDiverterTransitionOp(1, 3, switchTimeEndLo, switchTimeEndHi))
|
||||||
.AddOperation(processDataLoggingOp)
|
.AddOperation(processDataLoggingOp)
|
||||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||||
.EnterState();
|
.EnterState();
|
||||||
@@ -799,10 +805,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
|||||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||||
|
|
||||||
tstRslt.DiverterStart = switchTimeStart;
|
tstRslt.DiverterStart = Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val);
|
||||||
tstRslt.DiverterEnd = switchTimeEnd;
|
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.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)
|
if (compoundTestParams != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.17.700.1")]
|
[assembly: AssemblyVersion("2.17.704.1")]
|
||||||
[assembly: AssemblyFileVersion("2.17.700.1")]
|
[assembly: AssemblyFileVersion("2.17.704.1")]
|
||||||
|
|||||||
@@ -468,6 +468,7 @@
|
|||||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterFactory.cs" />
|
<Compile Include="BenchControl\Elde\PressureMeterInternal\PressureMeterFactory.cs" />
|
||||||
<Compile Include="BenchControl\Elde\PressureMeterInternal\ReadPressureOp.cs" />
|
<Compile Include="BenchControl\Elde\PressureMeterInternal\ReadPressureOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\ExecuteCommandOp.cs" />
|
<Compile Include="BenchControl\Elde\ExecuteCommandOp.cs" />
|
||||||
|
<Compile Include="BenchControl\Elde\ReadDiverterTransitionOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\ChangeValvePositionOp.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\ChangeValvePositionOp.cs" />
|
||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValve.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValve.cs" />
|
||||||
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValveCfg.cs" />
|
<Compile Include="BenchControl\Elde\RegulValveCoax\RegulValveCfg.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user