ControlBoard.Uni.StandingStartStopTestOp and TestMethods.StandingStartMassCollection changes, ver. 3.1.1734

This commit is contained in:
Milan Hanajik
2021-09-07 16:38:46 +02:00
parent c74047c292
commit 273f2b73d4
6 changed files with 37 additions and 54 deletions
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.1.1709.0")]
[assembly: AssemblyFileVersion("3.1.1709.0")]
[assembly: AssemblyVersion("3.1.1734.0")]
[assembly: AssemblyFileVersion("3.1.1734.0")]
+1 -1
View File
@@ -66,7 +66,7 @@ namespace TBF.Rig.ControlBoard
/// Error .............. unspecified error while running a test
/// </summary>
/// <returns>Operation running a test</returns>
IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter);
IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter);
/// <summary>
+1 -1
View File
@@ -441,7 +441,7 @@ namespace TBF.Rig.ControlBoard.Papouch
/// Start a standing start-stop test
/// </summary>
/// <returns>Operation</returns>
public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter)
public IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter)
{
currentTest = test;
return new Operations.ReturnGivenEventOp(Event.TestInProgress);
@@ -12,15 +12,26 @@ namespace TBF.Rig.ControlBoard.Uni
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;
///
/// Set by the constructor
///
readonly UniCB uniCB;
readonly TBF.Rig.Uni.FlowMeter.FlowMeter flowMeter;
readonly TBF.Rig.Uni.Diverter.Diverter diverter;
readonly double qFrom;
readonly double qTo;
readonly int pulsesCount; /// Number of reference pulses for a complete test
readonly bool withDiverter; /// Test with diverter (and scale)
readonly int pulsesCount; /// Number of reference pulses for a complete test
readonly bool withDiverter; /// Test with diverter (and scale)
///
/// Internal state of this operation
///
enum OpState
{
StartingTest,
TestInProgress,
TestCompleted,
}
OpState opState;
/// <summary>
/// Operation for a Standing start-stop test (constructor)
@@ -36,18 +47,13 @@ namespace TBF.Rig.ControlBoard.Uni
/// <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, bool withDiverter)
public StandingStartStopTestOp(UniCB cb, OutputPath devices, int pulsesCount, bool withDiverter)
{
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;
this.withDiverter = withDiverter;
@@ -60,22 +66,12 @@ namespace TBF.Rig.ControlBoard.Uni
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);
log.InfoFormat("Start() Et#={0} pulses={1} withDiverter={2}", flowMeter.Idx1, pulsesCount, withDiverter);
/// Start the test (and the flow measurement)
uniCB.StartTest(false, flowMeter.Idx1, (withDiverter ? diverter.DiverterNr : 0), 0,
@@ -96,30 +92,12 @@ namespace TBF.Rig.ControlBoard.Uni
/// </returns>
public Event Run()
{
log.DebugFormat("Op.Run() opState={0}", opState);
log.DebugFormat("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 || 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;
@@ -143,7 +121,7 @@ namespace TBF.Rig.ControlBoard.Uni
/// </summary>
public void Stop()
{
log.Info("Op.Stop()");
log.Info("Stop()");
uniCB.StopAll(false);
}
}
+2 -2
View File
@@ -652,9 +652,9 @@ namespace TBF.Rig.ControlBoard.Uni
/// Start a standing start-stop test
/// </summary>
/// <returns>Operation running a test</returns>
public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount, bool withDiverter)
public IOperation StandingStartStopTestOp(Test test, int pulsesCount, bool withDiverter)
{
return new StandingStartStopTestOp(this, devices, qFrom, qTo, pulsesCount, withDiverter);
return new StandingStartStopTestOp(this, devices, pulsesCount, withDiverter);
}
/// <summary>
@@ -105,6 +105,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
}
IList<Event> e; /// Events from currently running operations
int waterMetersCount = Math.Min(BenchInfo.WaterMetersCount, sensPath.RegisterReaders.Length);
DateTimeBox timeStampStart = new DateTimeBox();
DateTimeBox timeStampEnd = new DateTimeBox();
int tMass1 = 0;
@@ -448,8 +449,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
/// Temperature is withing required range at this point
///
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, test.Qfrom, test.Qto, 2 * totalPulses, true);
//-----------------------------------------------------------------
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//-----------------------------------------------------------------
@@ -461,6 +460,10 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
IOperation testInProgress = cBrd.StandingStartStopTestOp(test, 2 * totalPulses, true);
IOperation controlFlowOp = cBrd.SetFlowOp(test.Qfrom, test.Qto, RefFlow, int.MaxValue);
State.Create(string.Format("{0}({1}) : Start the standing start/stop test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
@@ -580,7 +583,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
}
else
{
for (int i = 0; i < Common.Data.WMsCount; i++)
for (int i = 0; i < waterMetersCount; i++)
{
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];
@@ -667,6 +670,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
.AddOperations(readTempPressOps)
.AddOperation(cBrd.OpenStartValveOp(timeStampStart))
.AddOperation(testInProgress)
.AddOperation(controlFlowOp)
.AddOperation(processDataLoggingOp)
.EnterState();
do {
@@ -749,6 +753,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(testInProgress)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
@@ -875,7 +880,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
}
else
{
for (int i = 0; i < Common.Data.WMsCount; i++)
for (int i = 0; i < waterMetersCount; i++)
{
GenericDevices.IRegReader rr = sensPath.RegisterReaders[i];