Uni.XyzStartStopTest[WithDiv]Op, etc., AdjustmentSeq and all FlyingStartXyzSeq completed, ver. 3.1.1630

This commit is contained in:
Milan Hanajik
2021-03-14 21:28:41 +01:00
parent 6e1b02ebd5
commit 7af4e9465c
49 changed files with 1201 additions and 1164 deletions
@@ -0,0 +1,142 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.ControlBoard.Uni
{
public class FlyingStartStopTestOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlyingStartStopTestOp));
public override string ToString() { return string.Format("FlyingStartStopTestOp()"); }
/// Arguments of the constructor
readonly UniCB uniCB;
readonly TBF.Rig.Uni.RegValve.RegValve regV;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly double qFrom;
readonly double qTo;
readonly int pulsesCount; /// Number of reference pulses for a complete test
/// <summary>
/// Operation for a Flying start-stop test (constructor)
///
/// Events: OpArgumentError .... invalid arguments, test cannot be started
/// StartingTest ....... starting a test
/// TestInProgress ..... test was successfully started, test is running
/// TestCompleted ...... test was successfully completed
/// Error .............. unspecified error while running a test
/// </summary>
/// <param name="cb">Control board component</param>
/// <param name="devices">Components used by the test</param>
/// <param name="qFrom">Flow lower limit</param>
/// <param name="qTo">Flow upper limit</param>
/// <param name="pulsesCount">Test duration - number of reference flow meter pulses</param>
public FlyingStartStopTestOp(UniCB cb, OutputPath devices, double qFrom, double qTo, int pulsesCount)
{
this.uniCB = cb;
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
regV = devices.RegValve as TBF.Rig.Uni.RegValve.RegValve;
if (regV == null) throw new ArgumentNullException("Invalid regulation valve");
this.qFrom = qFrom;
this.qTo = qTo;
this.pulsesCount = pulsesCount;
log.Debug(this.ToString());
}
/// Internal state of this operation
enum OpState
{
StartingTest,
TestInProgress,
TestCompleted,
}
OpState opState;
/// <summary>
/// Start this operation
/// </summary>
public void Start()
{
log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, true, false, false, pulsesCount, 0);
opState = OpState.StartingTest;
}
/// <summary>
/// Run this operation
/// </summary>
/// <returns>
/// Event.OpArgumentError .... invalid arguments, test cannot be started
/// Event.StartingTest ....... starting a test
/// Event.TestInProgress ..... test was successfully started, test is running
/// Event.TestCompleted ...... test was successfully completed
/// Event.Error .............. unspecified error while running a test
/// </returns>
public Event Run()
{
log.DebugFormat("Op.Run() opState={0}", opState);
switch (opState)
{
case OpState.StartingTest:
if (qFrom < 0 || qFrom >= qTo || qTo > 1.25 * flowMeter.NominalFlow)
{
return Event.OpArgumentError; /// Invalid qFrom, qTo
}
if (!flowMeter.MsrmntAvailable || /// Flow measurement not started yet
(uniCB.State & (ulong)StatusP.TestInProgress) == 0 || /// Test was not started yet
(flowMeter.ReadFlow()) == 0) /// Measured flow is 0
{
return Event.StartingTest; /// Flow regulation cannot be started
}
/// Start flow regulation
double reqFlowAve = (qFrom + qTo) / 2;
double reqFlowLo = (0.7 * qFrom) + (0.3 * reqFlowAve); /// Move the lower limit 15% of the range up
double reqFlowHi = (0.7 * qTo) + (0.3 * reqFlowAve); /// Move the upper limit 15% of the range down
///
uniCB.SetFlow(false, regV.Idx1, 2000 * reqFlowLo / flowMeter.NominalFlow,
2000 * reqFlowHi / flowMeter.NominalFlow);
opState = OpState.TestInProgress;
return Event.TestInProgress;
case OpState.TestInProgress:
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
{
return Event.TestInProgress; /// Test was not completed yet
}
opState = OpState.TestCompleted;
return Event.TestCompleted;
case OpState.TestCompleted:
default:
return Event.TestCompleted;
}
}
/// <summary>
/// Stop this operation
/// </summary>
public void Stop()
{
log.Info("Op.Stop()");
uniCB.Stop(false);
}
}
}
@@ -0,0 +1,189 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.ControlBoard.Uni
{
public class FlyingStartStopTestWithDivOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(FlyingStartStopTestWithDivOp));
public override string ToString() { return string.Format("FlyingStartStopTestWithDivOp()"); }
/// Arguments of the constructor
readonly UniCB uniCB;
readonly TBF.Rig.Uni.RegValve.RegValve regV;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly TBF.Rig.Uni.Diverter.Diverter div;
readonly double qFrom;
readonly double qTo;
readonly int pulsesCount; /// Number of reference pulses for a complete test
readonly int massPulsesCount; /// Number of reference pulses for mass collection
readonly bool readDivTransition;
readonly bool isProlongedTest;
/// <summary>
/// Operation for a Flying start-stop test with a diverter (constructor)
///
/// Events: OpArgumentError ...... invalid arguments, test cannot be started
/// StartingTest ......... starting a test
/// TestInProgress ....... test was successfully started, test is running
/// TestPart2InProgress .. first part when water is diverted to a tank was successfully completed, part2 in progress,
/// prolonged method only: (massPulsesCount GT 0) and (massPulsesCount LT pulsesCount)
/// TestCompleted ........ test was successfully completed
/// Error ................ unspecified error while running a test
/// </summary>
/// <param name="cb">Control board component</param>
/// <param name="devices">Components used by the test</param>
/// <param name="qFrom">Flow lower limit</param>
/// <param name="qTo">Flow upper limit</param>
/// <param name="pulsesCount">Test duration - number of reference flow meter pulses</param>
/// <param name="massPulsesCount">Test part 1 duration - number of reference flow meter pulses<</param>
public FlyingStartStopTestWithDivOp(UniCB cb, OutputPath devices, double qFrom, double qTo,
int pulsesCount, int massPulsesCount, bool readDivTransition)
{
this.uniCB = cb;
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
regV = devices.RegValve as TBF.Rig.Uni.RegValve.RegValve;
if (regV == null) throw new ArgumentNullException("Invalid regulation valve");
div = devices.Diverter as TBF.Rig.Uni.Diverter.Diverter;
if (div == null) throw new ArgumentNullException("Invalid diverter");
this.qFrom = qFrom;
this.qTo = qTo;
this.pulsesCount = pulsesCount;
this.massPulsesCount = massPulsesCount;
this.readDivTransition = readDivTransition;
this.isProlongedTest = (0 < massPulsesCount) && (massPulsesCount < pulsesCount);
log.Debug(this.ToString());
}
/// Internal states of this operation
enum OpState
{
StartingTest,
ReadingDivTransition,
TestInProgress,
TestPart1InProgress, /// prolonged test only
TestPart2InProgress, /// prolonged test only
TestCompleted,
}
OpState opState;
/// <summary>
/// Start this operation
/// </summary>
public void Start()
{
log.InfoFormat("Op.Start() RV#={0} Et#={1} Div#={2} Qfrom={3} Qto={4}", regV.Idx1, flowMeter.Idx1, div.DiverterNr, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, div.DiverterNr, 40, true, true, false, pulsesCount, massPulsesCount);
opState = OpState.StartingTest;
}
/// <summary>
/// Run this operation
/// </summary>
/// <returns>
/// Event.OpArgumentError ...... invalid arguments, test cannot be started
/// Event.StartingTest ......... starting a test
/// Event.TestInProgress ....... test was successfully started, test is running
/// Event.TestPart1InProgress .. first part when water is diverted to a tank was successfully completed, part2 in progress,
/// Event.TestPart2InProgress .. first part when water is diverted to a tank was successfully completed, part2 in progress,
/// prolonged method only: (massPulsesCount GT 0) and (massPulsesCount LT pulsesCount)
/// Event.TestCompleted ........ test was successfully completed
/// Event.Error ................ unspecified error while running a test
/// </returns>
public Event Run()
{
log.DebugFormat("Op.Run() opState={0}", opState);
switch (opState)
{
case OpState.StartingTest:
if (qFrom < 0 || qFrom >= qTo || qTo > 1.25 * flowMeter.NominalFlow)
{
return Event.OpArgumentError; /// Invalid qFrom, qTo
}
if (!flowMeter.MsrmntAvailable || /// Flow measurement not started yet
(uniCB.State & (ulong)StatusP.TestInProgress) == 0 || /// Test was not started yet
(flowMeter.ReadFlow()) == 0) /// Measured flow is 0
{
return Event.StartingTest; /// Flow regulation cannot be started
}
/// Start flow regulation
double reqFlowAve = (qFrom + qTo) / 2;
double reqFlowLo = (0.7 * qFrom) + (0.3 * reqFlowAve); /// Move the lower limit 15% of the range up
double reqFlowHi = (0.7 * qTo) + (0.3 * reqFlowAve); /// Move the upper limit 15% of the range down
///
uniCB.SetFlow(false, regV.Idx1, 2000 * reqFlowLo / flowMeter.NominalFlow,
2000 * reqFlowHi / flowMeter.NominalFlow);
opState = readDivTransition ? OpState.ReadingDivTransition
: (isProlongedTest ? OpState.TestPart1InProgress : OpState.TestInProgress);
return isProlongedTest ? Event.TestPart1InProgress : Event.TestInProgress;
case OpState.ReadingDivTransition:
/// Read diverter transition data
uniCB.ReadDiverterTransition(false, div.DiverterNr);
opState = isProlongedTest ? OpState.TestPart1InProgress : OpState.TestInProgress;
return isProlongedTest ? Event.TestPart1InProgress : Event.TestInProgress;
case OpState.TestInProgress:
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
{
return Event.TestInProgress; /// Test was not completed yet
}
opState = OpState.TestCompleted;
return Event.TestCompleted;
case OpState.TestPart1InProgress:
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
{
return Event.TestPart1InProgress; /// Test was not completed yet
}
opState = OpState.TestPart2InProgress;
return Event.TestPart2InProgress;
case OpState.TestPart2InProgress:
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
{
/// Test was not completed yet
return Event.TestPart2InProgress;
}
opState = OpState.TestCompleted;
return Event.TestCompleted;
case OpState.TestCompleted:
default:
return Event.TestCompleted;
}
}
/// <summary>
/// Stop this operation
/// </summary>
public void Stop()
{
log.Info("Op.Stop()");
uniCB.Stop(false);
}
}
}
@@ -0,0 +1,142 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.ControlBoard.Uni
{
public class StandingStartStopTestOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(StandingStartStopTestOp));
public override string ToString() { return string.Format("StandingStartStopTestOp()"); }
/// Arguments of the constructor
readonly UniCB uniCB;
readonly TBF.Rig.Uni.RegValve.RegValve regV;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly double qFrom;
readonly double qTo;
readonly int pulsesCount; /// Number of reference pulses for a complete test
/// <summary>
/// Operation for a Standing start-stop test (constructor)
///
/// Events: OpArgumentError .... invalid arguments, test cannot be started
/// StartingTest ....... starting a test
/// TestInProgress ..... test was successfully started, test is running
/// TestCompleted ...... test was successfully completed
/// Error .............. unspecified error while running a test
/// </summary>
/// <param name="cb">Control board component</param>
/// <param name="devices">Components used by the test</param>
/// <param name="qFrom">Flow lower limit</param>
/// <param name="qTo">Flow upper limit</param>
/// <param name="pulsesCount">Test duration - number of reference flow meter pulses</param>
public StandingStartStopTestOp(UniCB cb, OutputPath devices, double qFrom, double qTo, int pulsesCount)
{
this.uniCB = cb;
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
regV = devices.RegValve as TBF.Rig.Uni.RegValve.RegValve;
if (regV == null) throw new ArgumentNullException("Invalid regulation valve");
this.qFrom = qFrom;
this.qTo = qTo;
this.pulsesCount = pulsesCount;
log.Debug(this.ToString());
}
/// Internal states of this operation
enum OpState
{
StartingTest,
TestInProgress,
TestCompleted,
}
OpState opState;
/// <summary>
/// Start this operation
/// </summary>
public void Start()
{
log.InfoFormat("Op.Start() RV#={0} Et#={1} Qfrom={2} Qto={3}", regV.Idx1, flowMeter.Idx1, qFrom, qTo);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, 0, 40, false, false, true, pulsesCount, 0);
opState = OpState.StartingTest;
}
/// <summary>
/// Run this operation
/// </summary>
/// <returns>
/// Event.OpArgumentError .... invalid arguments, test cannot be started
/// Event.StartingTest ....... starting a test
/// Event.TestInProgress ..... test was successfully started, test is running
/// Event.TestCompleted ...... test was successfully completed
/// Event.Error .............. unspecified error while running a test
/// </returns>
public Event Run()
{
log.DebugFormat("Op.Run() opState={0}", opState);
switch (opState)
{
case OpState.StartingTest:
if (qFrom < 0 || qFrom >= qTo || qTo > 1.25 * flowMeter.NominalFlow)
{
return Event.OpArgumentError; /// Invalid qFrom, qTo
}
if (!flowMeter.MsrmntAvailable || /// Flow measurement not started yet
(uniCB.State & (ulong)StatusP.TestInProgress) == 0 || /// Test was not started yet
(flowMeter.ReadFlow()) == 0) /// Measured flow is 0
{
return Event.StartingTest; /// Flow regulation cannot be started
}
/// Start flow regulation
double reqFlowAve = (qFrom + qTo) / 2;
double reqFlowLo = (0.7 * qFrom) + (0.3 * reqFlowAve); /// Move the lower limit 15% of the range up
double reqFlowHi = (0.7 * qTo) + (0.3 * reqFlowAve); /// Move the upper limit 15% of the range down
///
uniCB.SetFlow(false, regV.Idx1, 2000 * reqFlowLo / flowMeter.NominalFlow,
2000 * reqFlowHi / flowMeter.NominalFlow);
opState = OpState.TestInProgress;
return Event.TestInProgress;
case OpState.TestInProgress:
if ((uniCB.State & (ulong)StatusP.TestCompleted) == 0)
{
return Event.TestInProgress; /// Test was not completed yet
}
opState = OpState.TestCompleted;
return Event.TestCompleted;
case OpState.TestCompleted:
default:
return Event.TestCompleted;
}
}
/// <summary>
/// Stop this operation
/// </summary>
public void Stop()
{
log.Info("Op.Stop()");
uniCB.Stop(false);
}
}
}
@@ -1,192 +0,0 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using log4net;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.ControlBoard.Uni
{
public class StartMeasurementOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(StartMeasurementOp));
public override string ToString() { return string.Format("StartMeasurementOp()"); }
/// Set by the constructor
readonly UniCB uniCB;
readonly TBF.Rig.Uni.RegValve.RegValve regValve;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly TBF.Rig.Uni.Diverter.Diverter diverter;
readonly int regulValveStableTime;
readonly double maximalFlow;
readonly double qFrom;
readonly double qTo;
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;
///
/// Internal states of this operation
///
enum OpState
{
StartingTest,
ResendCommand,
WaitingBeforeValveMove,
StartingFlowRegulation,
OpCompleted,
}
OpState opState;
int delayStartTime; /// StateMachine.Time snapshot when delay before flow regulation starts
/// <summary>
/// Starts the measurement.
/// Events: MeasurementStarted
/// </summary>
/// <param name="cb">Control board component reference</param>
/// <param name="devices">Specifies used components</param>
/// <param name="method">Test method</param>
/// <param name="totalRefPulses">Test duration in number of reference flowmeter pulses</param>
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
public StartMeasurementOp(IControlBoard cb, OutputPath devices, TestMethods method, double qFrom, double qTo,
int refPulses, int delayBeforeFlowRegulation = 0)
: this(cb, devices, method, qFrom, qTo, refPulses, refPulses, delayBeforeFlowRegulation)
{
}
/// <summary>
/// Starts the measurement.
/// Events: MeasurementStarted
/// </summary>
/// <param name="cb">Control board component reference</param>
/// <param name="devices">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 StartMeasurementOp(IControlBoard cb, OutputPath devices, TestMethods method, double qFrom, double qTo,
int totalRefPulses, int massRefPulses, int delayBeforeFlowRegulation = 0)
{
this.uniCB = cb as UniCB;
if (uniCB == null) throw new ArgumentNullException("Invalid control board");
flowMeter = devices.FlowMeter as TBF.Rig.Uni.FlowMeter.FlowMeter;
if (flowMeter == null) throw new ArgumentNullException("Invalid flow meter");
regValve = devices.RegValve as TBF.Rig.Uni.RegValve.RegValve;
if (regValve == null) throw new ArgumentNullException("Invalid regulation");
diverter = devices.Diverter as TBF.Rig.Uni.Diverter.Diverter;
if (diverter == null) throw new ArgumentNullException("Invalid diverter");
this.testMethod = method;
this.qFrom = qFrom;
this.qTo = qTo;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.delayBeforeFlowRegulation = delayBeforeFlowRegulation;
maximalFlow = 1.25 * flowMeter.NominalFlow;
log.Debug(this.ToString());
}
void SendStartCommand()
{
//uniCB.SyncRoute();
uniCB.StartTest(false, flowMeter.Idx1, diverter.DiverterNr, 20,
testMethod == TestMethods.Diverter || testMethod == TestMethods.MassAndContinue || testMethod == TestMethods.Synchro,
testMethod == TestMethods.Diverter || testMethod == TestMethods.MassAndContinue,
testMethod == TestMethods.FixedStart,
totalRefPulses, massRefPulses);
}
/// <summary>Start this operation</summary>
public void Start()
{
SendStartCommand();
opState = OpState.StartingTest;
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.FlowInDone or Event.FlowOutDone
/// </returns>
public Event Run()
{
if (opState == OpState.StartingTest)
{
ulong state = uniCB.State;
log.DebugFormat("state = {0} {1} {2} {3}",
(((ulong)state >> 48) & 0xFFFF).ToString("X4"),
(((ulong)state >> 32) & 0xFFFF).ToString("X4"),
(((ulong)state >> 16) & 0xFFFF).ToString("X4"),
((ulong)state & 0xFFFF).ToString("X4"));
if ((state & (ulong)StatusP.TestInProgress) != 0)
{
log.Info("Test started");
if (delayBeforeFlowRegulation > 0)
{
delayStartTime = StateMachine.Time;
opState = OpState.WaitingBeforeValveMove;
}
else
{
opState = OpState.StartingFlowRegulation;
}
}
else
{
//opState = OpState.ResendCommand;
}
return Event.None;
}
else if (opState == OpState.ResendCommand)
{
SendStartCommand();
opState = OpState.StartingTest;
return Event.None;
}
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
///
if ((qFrom >= qTo) || (qFrom > maximalFlow) || (qTo <= 0))
{
return Event.OpArgumentError;
}
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
regValve.Idx1, flowMeter.Idx1, qFrom, qTo);
double freqLo = 2000 * qFrom / flowMeter.NominalFlow;
double freqHi = 2000 * qTo / flowMeter.NominalFlow;
uniCB.SetFlow(false, regValve.Idx1, 2000 * qFrom / flowMeter.NominalFlow, 2000 * qTo / flowMeter.NominalFlow);
opState = OpState.OpCompleted;
return Event.None;
}
else if (opState == OpState.OpCompleted)
{
return Event.MeasurementStarted;
}
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop() { }
}
}
+27 -93
View File
@@ -38,7 +38,7 @@ namespace TBF.Rig.ControlBoard.Uni
{
get {
altString.Clear();
altString.AppendFormat("Stat: {0}.{1}.{2}.{3}\n", (State >> 48) & 0xFF, (State >> 40) & 0xFF, (State >> 32) & 0xFF, Convert.ToUInt32(State & 0xFFFFFFFF).ToString("X6"));
altString.AppendFormat("State: {0}.{1}.{2}.{3}\n", (State >> 48) & 0xFF, (State >> 40) & 0xFF, (State >> 32) & 0xFF, Convert.ToUInt32(State & 0xFFFFFFFF).ToString("X6"));
altString.AppendFormat("DI: {0}\n", ToBin40(DigitalInputs));
altString.AppendFormat("DO: {0}\n", ToBin40(((UInt64)Route) >> 8));
altString.AppendFormat("AI0: {0:D3} AI1: {1:D3} AI2: {2:D3} AI3: {3:D3} AI4: {4:D3} AI5: {5:D3}\n",
@@ -483,102 +483,31 @@ namespace TBF.Rig.ControlBoard.Uni
}
/// <summary>
/// Start a test, Events: MeasurementStarted
/// Start a standing start-stop test
/// </summary>
/// <param name="iParam">Int32 parameter 1</param>
/// <param name="dParam1">Double parameter 1 (alternative lower flow limit)</param>
/// <param name="dParam2">Double parameter 2 (alternative upper flow limit)</param>
/// <returns>Operation</returns>
public IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0)
/// <returns>Operation running a test</returns>
public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount)
{
return new StandingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount);
}
/// Get total number of pulses
int totalPulses = Convert.ToInt32(Math.Round(test.Volume / devices.FlowMeter.LtrPerPulse));
/// <summary>
/// Start a flying start-stop test
/// </summary>
/// <returns>Operation running a test</returns>
public IOperation FlyingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount)
{
return new FlyingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount);
}
/// Get method class string
string methodClass;
if (!StateMachine.TestMethod2Class.TryGetValue(test.Name, out methodClass)) return null;
if (methodClass.Contains("TestMethods.Adjustment."))
{
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.CombinedWithDetection."))
{
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), dParam1, dParam2, totalPulses);
}
if (methodClass == "TestMethods.DiverterTest")
{
if (iParam == 0) return null;
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses / iParam);
}
if (methodClass == "TestMethods.Dummy")
{
}
if (methodClass == "TestMethods.Endurance")
{
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.FixedStart."))
{
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, 10);
}
if (methodClass.Contains("TestMethods.FixedStartDefferedEval."))
{
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, 10);
}
if (methodClass.Contains("TestMethods.FixedStartMassCollection."))
{
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), 10);
}
if (methodClass.Contains("TestMethods.FlyingStart."))
{
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.FlyingStartFirstRepetWithMassColl."))
{
TestMethods tm = (iParam == 1) ? (TestMethods.Diverter | TestMethods.Synchro) : TestMethods.Synchro;
return new StartMeasurementOp(this, devices, tm, test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.FlyingStartMassCollComparative."))
{
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.FlyingStartMassCollection."))
{
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
}
if (methodClass.Contains("TestMethods.FlyingStartMassCollProlonged."))
{
if (iParam == 0) return null;
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses, iParam);
}
if (methodClass.Contains("TestMethods.FlyingStartTankCollection."))
{
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
}
if (methodClass == "TestMethods.PulsesTest")
{
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
}
if (methodClass == "TestMethods.PulsesTestManual")
{
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
}
return null;
/// <summary>
/// Start a flying start-stop test with diverter
/// </summary>
/// <returns>Operation running a test</returns>
public IOperation FlyingStartStopTestWithDivOp(Test test, double qFrom, double qTo, int pulsesCount,
int massPulsesCount = 0, bool readDivTransition = true)
{
return new FlyingStartStopTestWithDivOp(this, devices, qFrom, qTo, pulsesCount, massPulsesCount, readDivTransition);
}
public IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
@@ -756,5 +685,10 @@ namespace TBF.Rig.ControlBoard.Uni
/// TODO
}
public void SetFiltersPidShortPulses(int[] filters, float pidCoef, int shortPulses)
{
/// TODO
}
}
}