Uni.XyzStartStopTest[WithDiv]Op, etc., AdjustmentSeq and all FlyingStartXyzSeq completed, ver. 3.1.1630
This commit is contained in:
@@ -12,7 +12,7 @@ namespace TBF.Rig.BuiltIn.PumpTandem
|
||||
public class Pump : ComponentBase, GenericDevices.IPumpFM, GenericDevices.IValve, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Pump));
|
||||
public override string ToString() { return string.Format("PumpTandem({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("PumpTandem({0})", Cfg.ToString(-1)); }
|
||||
|
||||
readonly PumpCfg pumpCfg;
|
||||
|
||||
@@ -63,14 +63,14 @@ namespace TBF.Rig.BuiltIn.PumpTandem
|
||||
pumpFm2 = pump2 as GenericDevices.IPumpFM;
|
||||
|
||||
if (pump1 is BuiltIn.Pump.Pump) { mask1 = (pump1 as BuiltIn.Pump.Pump).Mask; }
|
||||
else if (pump1 is Elde.PumpWithFM.Pump) { mask1 = (pump1 as Elde.PumpWithFM.Pump).Mask; }
|
||||
else if (pump1 is Danfoss.VLT2800.Pump) { mask1 = (pump1 as Danfoss.VLT2800.Pump).Mask; }
|
||||
else { mask1 = 0; }
|
||||
else if (pump1 is Modbus.PumpFM.DanfossVLT.Pump) { mask1 = (pump1 as Modbus.PumpFM.DanfossVLT.Pump).Mask; }
|
||||
else { mask1 = 0; }
|
||||
|
||||
if (pump2 is BuiltIn.Pump.Pump) { mask2 = (pump2 as BuiltIn.Pump.Pump).Mask; }
|
||||
else if (pump2 is Elde.PumpWithFM.Pump) { mask2 = (pump2 as Elde.PumpWithFM.Pump).Mask; }
|
||||
else if (pump2 is Danfoss.VLT2800.Pump) { mask2 = (pump2 as Danfoss.VLT2800.Pump).Mask; }
|
||||
else { mask2 = 0; }
|
||||
else if (pump2 is Danfoss.VLT2800.Pump) { mask2 = (pump2 as Danfoss.VLT2800.Pump).Mask; }
|
||||
else if (pump2 is Modbus.PumpFM.DanfossVLT.Pump) { mask2 = (pump2 as Modbus.PumpFM.DanfossVLT.Pump).Mask; }
|
||||
else { mask2 = 0; }
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace TBF.Rig.BuiltIn.PumpTandem
|
||||
foreach (var cmpnt in parentDlg.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.Pump.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.PumpWithFM.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Danfoss.VLT2800.PumpFactory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Modbus.PumpFM.DanfossVLT.Factory ||
|
||||
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is BuiltIn.PumpTandem.PumpFactory)
|
||||
{
|
||||
pump1ComboBox.Items.Add(cmpnt.Name);
|
||||
|
||||
@@ -45,8 +45,7 @@ namespace TBF.Rig.BuiltIn
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.PumpFM.DanfossVLT.Pump && ((vlv as Modbus.PumpFM.DanfossVLT.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -56,8 +55,7 @@ namespace TBF.Rig.BuiltIn
|
||||
/// Skip the delay evaluation and update in case the valve/pump have not changed
|
||||
if (vlv is Valve.Valve && ((vlv as Valve.Valve).Mask & changed) == 0) continue;
|
||||
if (vlv is Pump.Pump && ((vlv as Pump.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Elde.PumpWithFM.Pump && ((vlv as Elde.PumpWithFM.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Danfoss.VLT2800.Pump && ((vlv as Danfoss.VLT2800.Pump).Mask & changed) == 0) continue;
|
||||
if (vlv is Modbus.PumpFM.DanfossVLT.Pump && ((vlv as Modbus.PumpFM.DanfossVLT.Pump).Mask & changed) == 0) continue;
|
||||
|
||||
if ((vlv != null) && (vlv.Delay > max)) max = vlv.Delay;
|
||||
@@ -157,20 +155,18 @@ namespace TBF.Rig.BuiltIn
|
||||
{
|
||||
if (valve is Valve.Valve) point.MasksOpen |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksOpen |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksOpen |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksOpen |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksOpen |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksOpen |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksOpen |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
}
|
||||
point.MasksClose = 0;
|
||||
foreach (var valve in point.VClose)
|
||||
{
|
||||
if (valve is Valve.Valve) point.MasksClose |= (valve as Valve.Valve).Mask;
|
||||
if (valve is Pump.Pump) point.MasksClose |= (valve as Pump.Pump).Mask;
|
||||
if (valve is Elde.PumpWithFM.Pump) point.MasksClose |= (valve as Elde.PumpWithFM.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksClose |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
if (valve is PumpTandem.Pump) point.MasksClose |= (valve as PumpTandem.Pump).Mask;
|
||||
if (valve is Danfoss.VLT2800.Pump) point.MasksClose |= (valve as Danfoss.VLT2800.Pump).Mask;
|
||||
if (valve is Modbus.PumpFM.DanfossVLT.Pump) point.MasksClose |= (valve as Modbus.PumpFM.DanfossVLT.Pump).Mask;
|
||||
}
|
||||
point.TimeSec += timeShift;
|
||||
}
|
||||
|
||||
@@ -51,23 +51,50 @@ namespace TBF.Rig.ControlBoard
|
||||
/// <summary>
|
||||
/// Returns operation which sets the flow. Events:
|
||||
/// </summary>
|
||||
/// <param name="flowLimLo">Lower flow limit</param>
|
||||
/// <param name="flowLimHi">Upper flow limit</param>
|
||||
/// <param name="qFrom">Lower limit for the water flow</param>
|
||||
/// <param name="qTo">Upper limit for the water flow</param>
|
||||
/// <param name="measuredFlow">Reference to calss keeping current flow value</param>
|
||||
/// <param name="timeout">Timeout in seconds</param>
|
||||
/// <returns>Operation</returns>
|
||||
IOperation SetFlowOp(double flowLimLo, double flowLimHi, TBF.Boxes.DoubleBox measuredFlow, int timeout);
|
||||
IOperation SetFlowOp(double qFrom, double qTo, TBF.Boxes.DoubleBox measuredFlow, int timeout);
|
||||
|
||||
IOperation StopFlowRegulationOp();
|
||||
|
||||
/// <summary>
|
||||
/// Start a test, Events: MeasurementStarted
|
||||
/// Get operation for a Standing start-stop test
|
||||
/// 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="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>
|
||||
IOperation StartTestOp(Test test, int iParam = 0, double dParam1 = 0, double dParam2 = 0);
|
||||
/// <returns>Operation running a test</returns>
|
||||
IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount);
|
||||
|
||||
/// <summary>
|
||||
/// Get operation for a Flying start-stop test
|
||||
/// 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>
|
||||
/// <returns>Operation running a test</returns>
|
||||
IOperation FlyingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount);
|
||||
|
||||
/// <summary>
|
||||
/// Get operation for a Flying start-stop test with a diverter
|
||||
/// 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>
|
||||
/// <returns>Operation running a test</returns>
|
||||
IOperation FlyingStartStopTestWithDivOp(Test test, double qFrom, double qTo, int pulsesCount, int massPulsesCount, bool readDivTransition);
|
||||
|
||||
|
||||
IOperation ReadDiverterTransitionOp(bool isStart, Sequences.Statistics plotter, int batchNr, string testName, int repetition);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
public class CBoard : ComponentBase, IControlBoard
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CBoard));
|
||||
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(-1)); }
|
||||
|
||||
const int FiltersCount = 8;
|
||||
|
||||
@@ -406,14 +406,14 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
/// <summary>Initialize this device</summary>
|
||||
public void Initialize()
|
||||
{
|
||||
int divertersCount = Rig.Elde.Diverter.Diverter.DivertersCount;
|
||||
int divertersCount = Rig.Uni.Diverter.Diverter.DivertersCount;
|
||||
|
||||
DiverterEdge = new uint[divertersCount];
|
||||
for (int i = 0; i < divertersCount; i++)
|
||||
{
|
||||
DiverterEdge[i] = (uint)Rig.Elde.Diverter.Diverter.Diverters[i].ThresholdGate;
|
||||
controlCom.SetDivLimit(i, (uint)Rig.Elde.Diverter.Diverter.Diverters[i].ThresholdLo,
|
||||
(uint)Rig.Elde.Diverter.Diverter.Diverters[i].ThresholdHi);
|
||||
DiverterEdge[i] = (uint)Rig.Uni.Diverter.Diverter.Diverters[i].ThresholdGate;
|
||||
controlCom.SetDivLimit(i, (uint)Rig.Uni.Diverter.Diverter.Diverters[i].ThresholdLo,
|
||||
(uint)Rig.Uni.Diverter.Diverter.Diverters[i].ThresholdHi);
|
||||
}
|
||||
|
||||
controlCom.SendCalibData(RegValveCalib,
|
||||
@@ -675,17 +675,41 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
|
||||
|
||||
/// <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 StartTestOp(test, false, false, true, qFrom, qTo, pulsesCount, 0);
|
||||
}
|
||||
|
||||
/// <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 StartTestOp(test, true, false, false, qFrom, qTo, pulsesCount, 0);
|
||||
}
|
||||
|
||||
/// <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, bool readDivTransition)
|
||||
{
|
||||
return StartTestOp(test, true, true, false, qFrom, qTo, pulsesCount, massPulsesCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a test
|
||||
/// </summary>
|
||||
/// <returns>Operation running a test</returns>
|
||||
public IOperation StartTestOp(Test test, bool isSyncMethod, bool isDivUsed, bool isStartStop, double qFrom, double qTo, int pulsesCount, int massPulsesCount)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
|
||||
return new Operations.ReturnGivenEventOp(Event.TestInProgress);
|
||||
}
|
||||
|
||||
/// Get total number of pulses
|
||||
@@ -701,12 +725,11 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.CombinedWithDetection."))
|
||||
{
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), dParam1, dParam2, totalPulses);
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, 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);
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass == "TestMethods.Dummy")
|
||||
{
|
||||
@@ -745,8 +768,7 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
}
|
||||
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);
|
||||
return new StartMeasurementOp(this, devices, TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartMassCollComparative."))
|
||||
{
|
||||
@@ -758,8 +780,7 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
}
|
||||
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);
|
||||
return new StartMeasurementOp(this, devices, (TestMethods.Diverter | TestMethods.Synchro), test.Qfrom, test.Qto, totalPulses, massPulsesCount);
|
||||
}
|
||||
if (methodClass.Contains("TestMethods.FlyingStartTankCollection."))
|
||||
{
|
||||
@@ -791,7 +812,7 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
{
|
||||
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
|
||||
return new Operations.ReturnGivenEventOp(Event.TestInProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
if (done) return Event.MeasurementCompleted;
|
||||
if (done) return Event.TestCompleted;
|
||||
|
||||
if (0 != (controlBoard.StatusP & StatusP.TestCompleted))
|
||||
{
|
||||
done = true;
|
||||
return Event.MeasurementCompleted;
|
||||
return Event.TestCompleted;
|
||||
}
|
||||
|
||||
return Event.None;
|
||||
|
||||
@@ -79,26 +79,10 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
flowMeterNr = outputPath.FlowMeter.Idx1;
|
||||
|
||||
this.regulValve = outputPath.RegValve;
|
||||
if (regulValve is Elde.RegulValve.RegulValve)
|
||||
{
|
||||
Elde.RegulValve.RegulValve rv = outputPath.RegValve as Elde.RegulValve.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (regulValve is Elde.RegulValveCoax.RegulValve)
|
||||
{
|
||||
Elde.RegulValveCoax.RegulValve rv = outputPath.RegValve as Elde.RegulValveCoax.RegulValve;
|
||||
regulValveNr = rv.Idx1;
|
||||
regulValveStableTime = rv.StableTime;
|
||||
}
|
||||
else if (!(regulValve is Dummy.RegulValve.RegulValve))
|
||||
{
|
||||
throw new ArgumentNullException("Regulation valve is not compatible with Elde Control Board");
|
||||
}
|
||||
|
||||
if (outputPath.Diverter is Elde.Diverter.Diverter)
|
||||
if (outputPath.Diverter is TBF.Rig.Uni.Diverter.Diverter)
|
||||
{
|
||||
diverterNr = (outputPath.Diverter as Elde.Diverter.Diverter).DiverterNr;
|
||||
diverterNr = (outputPath.Diverter as TBF.Rig.Uni.Diverter.Diverter).DiverterNr;
|
||||
}
|
||||
|
||||
nominalFlow = outputPath.FlowMeter.NominalFlow;
|
||||
@@ -223,7 +207,7 @@ namespace TBF.Rig.ControlBoard.Legacy
|
||||
}
|
||||
else if (opState == OpState.OpCompleted)
|
||||
{
|
||||
return Event.MeasurementStarted;
|
||||
return Event.TestInProgress;
|
||||
}
|
||||
|
||||
return Event.None;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace TBF.Rig.ControlBoard.Papouch
|
||||
public class PapouchCB : ComponentBase, IControlBoard, IOperation
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(PapouchCB));
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||
|
||||
readonly PapouchCBCfg cbCfg;
|
||||
readonly GenericDevices.IModbus modbus;
|
||||
@@ -370,16 +370,31 @@ namespace TBF.Rig.ControlBoard.Papouch
|
||||
}
|
||||
|
||||
/// <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)
|
||||
public IOperation StandingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount)
|
||||
{
|
||||
currentTest = test;
|
||||
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
|
||||
return new Operations.ReturnGivenEventOp(Event.TestInProgress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a flying start-stop test ... not supported by Papouch control board
|
||||
/// </summary>
|
||||
/// <returns>null</returns>
|
||||
public IOperation FlyingStartStopTestOp(Test test, double qFrom, double qTo, int pulsesCount)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start a flying start-stop test with diverter ... not supported by Papouch control board
|
||||
/// </summary>
|
||||
/// <returns>null</returns>
|
||||
public IOperation FlyingStartStopTestWithDivOp(Test test, double qFrom, double qTo, int pulsesCount, int massPulsesCount = 0, bool readDivTransition = true)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public IOperation QueryMeasurementEndOp()
|
||||
@@ -454,14 +469,14 @@ namespace TBF.Rig.ControlBoard.Papouch
|
||||
}
|
||||
else if (runningOp == SelectedOp.QueryMeasurementEnd)
|
||||
{
|
||||
if (opCompleted) return Event.MeasurementCompleted;
|
||||
if (opCompleted) return Event.TestCompleted;
|
||||
|
||||
double currentMass = TBF.Rig.Sequences.ProcessData.Mass.Val;
|
||||
|
||||
if (currentMass - TBF.Rig.Sequences.ProcessData.StartMass.Val >= currentTest.Volume)
|
||||
{
|
||||
opCompleted = true;
|
||||
return Event.MeasurementCompleted;
|
||||
return Event.TestCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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() { }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -139,9 +139,13 @@ namespace TBF.Rig
|
||||
PreviousStopped,
|
||||
Wait,
|
||||
ProcedureLoaded,
|
||||
MeasurementStarted,
|
||||
StartingTest,
|
||||
TestInProgress,
|
||||
TestPart1InProgress,
|
||||
TestPart2InProgress,
|
||||
TestCompleted,
|
||||
ReadingDivTransition,
|
||||
ReadAllRegistersDone,
|
||||
MeasurementCompleted,
|
||||
CommandCompleted,
|
||||
|
||||
/// At the beginning of cycle when reading info from DB
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TBF.Rig.Output.DB.SaveDiverterCorrections
|
||||
public class SaveDiverterCorr : ComponentBase, IOperation, GenericDevices.IResultsWriter
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(SaveDiverterCorr));
|
||||
public override string ToString() { return string.Format("SaveDiverterCorr({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("SaveDiverterCorr({0})", Cfg.ToString(-1)); }
|
||||
|
||||
SaveDiverterCorrCfg myCfg;
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace TBF.Rig.Output.DB.SaveDiverterCorrections
|
||||
for (int div = 1; div <= myCfg.DivertersCount(); div++)
|
||||
{
|
||||
string diverterName = myCfg.GetDiverterName(div);
|
||||
Elde.Diverter.Diverter diverter = TbfComponents.FindComponent(diverterName) as Elde.Diverter.Diverter;
|
||||
Uni.Diverter.Diverter diverter = TbfComponents.FindComponent(diverterName) as Uni.Diverter.Diverter;
|
||||
|
||||
if (diverter != null)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace TBF.Rig.Output.DB.SaveDiverterCorrections
|
||||
///
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Elde.Diverter.DiverterFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Uni.Diverter.Factory)
|
||||
{
|
||||
diverter1ComboBox.Items.Add(cmpnt.Name);
|
||||
diverter2ComboBox.Items.Add(cmpnt.Name);
|
||||
|
||||
@@ -804,10 +804,10 @@ namespace TBF.Rig.Sequences
|
||||
|
||||
|
||||
/// Set PID coefficient, etc.
|
||||
if (StateMachine.ControlBoard is ControlBoard.Legacy.CBoard)
|
||||
if (StateMachine.ControlBoard is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
(StateMachine.ControlBoard as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, nextPidCoef, (nextShortPulses == 0) ? 0 : 1);
|
||||
(StateMachine.ControlBoard as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, nextPidCoef, (nextShortPulses == 0) ? 0 : 1);
|
||||
}
|
||||
|
||||
/// Set pump power
|
||||
@@ -1092,7 +1092,7 @@ namespace TBF.Rig.Sequences
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) return Event.Error;
|
||||
if (TestAndLogUiCmdStop(e)) return Event.UiCmdStop;
|
||||
if (e.Contains(Event.MeasurementCompleted) || e.Contains(Event.Next)) return Event.MeasurementCompleted;
|
||||
if (e.Contains(Event.TestCompleted) || e.Contains(Event.Next)) return Event.TestCompleted;
|
||||
}
|
||||
while ( (realTest && (outPath.Scale is IScale) && !e.Contains(Event.BalanceDone)) ||
|
||||
!e.Contains(Event.ReadAllRegistersDone));
|
||||
|
||||
@@ -255,7 +255,10 @@ namespace TBF.Rig
|
||||
ProcessData.OracleDB = cmpnt as Output.DB.SensusOracle.Database;
|
||||
}
|
||||
|
||||
if (cmpnt is ITestMethod) TestMethod2Class.Add(cmpnt.Name, cmpnt.ClassName);
|
||||
if (cmpnt is ITestMethod)
|
||||
{
|
||||
TestMethod2Class.Add(cmpnt.Name, cmpnt.ClassName);
|
||||
}
|
||||
|
||||
if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
@@ -263,7 +266,7 @@ namespace TBF.Rig
|
||||
}
|
||||
|
||||
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
|
||||
if ((cmpnt is IRegValve) && !(cmpnt is Rig.Elde.RegulValveTandem.RegulValveTandem))
|
||||
if ((cmpnt is IRegValve) && !(cmpnt is Rig.Uni.RegValveTandem.RegValveTandem))
|
||||
{
|
||||
SequenceBase.RegulValves.Add(cmpnt as IRegValve);
|
||||
}
|
||||
|
||||
@@ -124,22 +124,21 @@ namespace TBF.Rig.TestMethods.Adjustment
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -347,8 +346,8 @@ namespace TBF.Rig.TestMethods.Adjustment
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
|
||||
@@ -375,44 +374,35 @@ namespace TBF.Rig.TestMethods.Adjustment
|
||||
}
|
||||
else
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
/// Measurement loop preparation
|
||||
int totalPulses = Convert.ToInt32(Math.Round(test.Volume / outPath.FlowMeter.LtrPerPulse));
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
while (true)
|
||||
{
|
||||
//--------------------------------
|
||||
switch (ReadRegistersTempPressAmbient(measureOperations, true))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
case Event.MeasurementCompleted: goto one_test_completed;
|
||||
}
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
/// Measurement loop - end
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
/// Measurement loop - end
|
||||
StopRecordingStatistics();
|
||||
|
||||
one_test_completed:
|
||||
|
||||
|
||||
@@ -117,23 +117,21 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -570,14 +568,14 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test, 0, qfrom_detected, qto_detected))
|
||||
.AddOperation(cBrd.StartTestOp(test, true, true, false, qfrom_detected, qto_detected, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) goto error;
|
||||
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
///
|
||||
/// Measurement loop - preparation
|
||||
@@ -603,7 +601,7 @@ namespace TBF.Rig.TestMethods.CombinedWithDetection
|
||||
{
|
||||
case Event.Error: goto error;
|
||||
case Event.UiCmdStop: goto stopTest;
|
||||
case Event.MeasurementCompleted: goto measurement_completed;
|
||||
case Event.TestCompleted: goto measurement_completed;
|
||||
}
|
||||
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
|
||||
@@ -115,23 +115,21 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -164,6 +162,17 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -491,9 +500,14 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
///
|
||||
/// Diverter test loop
|
||||
///
|
||||
int remainingPulses = totalPulses;
|
||||
for (int divRepetNr = 1; divRepetNr <= testParams.DivRepetitions; divRepetNr++)
|
||||
{
|
||||
LogProcessDataHeader(processDataLogger, string.Format("Measurement {0}", divRepetNr + 1));
|
||||
LogProcessDataHeader(processDataLogger, string.Format("Measurement {0}", divRepetNr));
|
||||
|
||||
int remainingRepetitions = testParams.DivRepetitions - divRepetNr + 1;
|
||||
int pulsesNow = (remainingPulses + remainingRepetitions - 1) / remainingRepetitions;
|
||||
remainingPulses -= pulsesNow;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
@@ -503,26 +517,14 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test, testParams.DivRepetitions))
|
||||
.AddOperation(cBrd.StartTestOp(test, true, true, false, test.Qfrom, test.Qto, pulsesNow, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
@@ -566,7 +568,7 @@ namespace TBF.Rig.TestMethods.DiverterTest
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
|
||||
if (e.Contains(Event.MeasurementCompleted)) break;
|
||||
if (e.Contains(Event.TestCompleted)) break;
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
|
||||
|
||||
@@ -93,23 +93,21 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -163,6 +161,17 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
@@ -297,7 +306,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(enduranceDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, true, false, false, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -305,19 +314,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
@@ -341,7 +338,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
if (e.Contains(Event.TestCompleted)) goto test_completed;
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
|
||||
@@ -91,23 +91,21 @@ namespace TBF.Rig.TestMethods.FixedStart
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -535,14 +533,14 @@ namespace TBF.Rig.TestMethods.FixedStart
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.OpenStartValveOp())
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted) || !e.Contains(Event.ValvesSet));
|
||||
while (!e.Contains(Event.TestInProgress) || !e.Contains(Event.ValvesSet));
|
||||
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
@@ -568,7 +566,7 @@ namespace TBF.Rig.TestMethods.FixedStart
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,23 +99,21 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -402,14 +400,14 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
|
||||
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
|
||||
@@ -445,7 +443,7 @@ namespace TBF.Rig.TestMethods.FixedStartAdvanced
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,23 +109,21 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -560,14 +558,14 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
StartTime = (double)StateMachine.Time;
|
||||
|
||||
@@ -606,7 +604,7 @@ namespace TBF.Rig.TestMethods.FixedStartDeferredEval
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,23 +109,21 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -498,7 +496,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.AddOperation(cBrd.OpenStartValveOp())
|
||||
.EnterState();
|
||||
do {
|
||||
@@ -506,7 +504,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.TestInProgress));
|
||||
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
@@ -532,7 +530,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
+8
-10
@@ -133,23 +133,21 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if (eldeRR != null && eldeRR.Position >= 1 && eldeRR.Position <= 8)
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -671,14 +669,14 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
StartTime = (double)StateMachine.Time;
|
||||
|
||||
@@ -717,7 +715,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollDeferredEval
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,23 +109,21 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -661,14 +659,14 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.OpenStartValveOp())
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.ValvesSet) || !e.Contains(Event.TestInProgress));
|
||||
|
||||
switchTimeStart = 0.001f * cBrd.ValveOpenCloseTime;
|
||||
log.WarnFormat("Start valve switch time on test start = {0} ms", cBrd.ValveOpenCloseTime);
|
||||
@@ -694,7 +692,7 @@ namespace TBF.Rig.TestMethods.FixedStartMassCollection
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,23 +114,21 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if (eldeRR != null && eldeRR.Position >= 1 && eldeRR.Position <= 8)
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -486,14 +484,14 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, false, true, true, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
StartTime = (double)StateMachine.Time;
|
||||
|
||||
@@ -532,7 +530,7 @@ namespace TBF.Rig.TestMethods.FixedStartTankCollection
|
||||
retVal = Event.UiCmdStop;
|
||||
goto stopTest;
|
||||
|
||||
case Event.MeasurementCompleted:
|
||||
case Event.TestCompleted:
|
||||
goto test_completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +97,7 @@ namespace TBF.Rig.TestMethods.FlowAdjustment
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
@@ -106,15 +105,14 @@ namespace TBF.Rig.TestMethods.FlowAdjustment
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
|
||||
@@ -98,22 +98,22 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
//cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
@@ -148,6 +148,17 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Optionally display prompt to emerge temperature meters to appropriate baths for heat meters test
|
||||
///
|
||||
@@ -342,7 +353,6 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
|
||||
temperature_set:
|
||||
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
@@ -373,82 +383,49 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Read water meters", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
/// Update heatmeter volume and energy values
|
||||
if (lastEnergyUpdateTime == 0)
|
||||
{
|
||||
lastEnergyUpdateTime = StateMachine.Time;
|
||||
@@ -456,8 +433,8 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
else
|
||||
{
|
||||
//double deltaTime = (double)(StateMachine.Time - lastEnergyUpdateTime);
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
|
||||
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
|
||||
Energy.Update(deltaEnergy);
|
||||
@@ -466,15 +443,15 @@ namespace TBF.Rig.TestMethods.FlyingStart
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (true);
|
||||
/// Measurement loop - end
|
||||
#endregion
|
||||
|
||||
test_completed:
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
StopRecordingStatistics();
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_completed);
|
||||
|
||||
+46
-84
@@ -24,8 +24,7 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
/// <returns>true when capabilities of devices are OK</returns>
|
||||
public static bool CheckDeviceCaps(Config.Entities.Test test, OutputPath devices, out string message)
|
||||
{
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Legacy.CBoard) &&
|
||||
!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
|
||||
if (!(StateMachine.ControlBoard is ControlBoard.Uni.UniCB))
|
||||
{
|
||||
/// Control board does not support this method
|
||||
message = string.Format("{0}: {1}", test.Name, Strings.Test_bench_does_not_suport_selected_test_method);
|
||||
@@ -92,6 +91,7 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
return Simulate(test, repetitionNr, isLastRepetition, singleTestParams, compoundTestParams, heatMetersTestParams);
|
||||
}
|
||||
|
||||
TBF.Rig.ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as TBF.Rig.ControlBoard.Uni.UniCB;
|
||||
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
if (scale == null)
|
||||
@@ -124,29 +124,26 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true);
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -189,6 +186,17 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
bool drainTheTank = (repetitionNr == 1) ? test.DoDraining : false;
|
||||
|
||||
if (repetitionNr == 1)
|
||||
@@ -475,8 +483,8 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
if (repetitionNr == 1)
|
||||
@@ -541,7 +549,7 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
@@ -571,76 +579,43 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test, repetitionNr))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp(); /// ???
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)((repetitionNr == 1) ? test.TestTime : (test.TestTime * nextTestVolume / test.Volume));
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)((repetitionNr == 1) ? test.TestTime : (test.TestTime * nextTestVolume / test.Volume));
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTest[WithDiv]Op", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.FlyingStartStopTestWithDivOp(test, test.Qfrom, test.Qto, totalPulses)
|
||||
: cBrd.FlyingStartStopTestOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
/// Update heatmeter volume and energy values
|
||||
if (lastEnergyUpdateTime == 0)
|
||||
{
|
||||
lastEnergyUpdateTime = StateMachine.Time;
|
||||
@@ -658,29 +633,16 @@ namespace TBF.Rig.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.FlowRegulationStopped));
|
||||
|
||||
if (repetitionNr == 1)
|
||||
{
|
||||
///
|
||||
|
||||
+50
-88
@@ -94,6 +94,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
return new List<Event> { Event.ConfigurationError };
|
||||
}
|
||||
|
||||
TBF.Rig.ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as TBF.Rig.ControlBoard.Uni.UniCB;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
if (outPath.FlowMeter is Uni.FlowMeter.FlowMeter)
|
||||
{
|
||||
@@ -144,29 +146,26 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
int tMass1 = 0;
|
||||
int tMass2 = 0;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -203,6 +202,17 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -457,7 +467,6 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
|
||||
temperature_set:
|
||||
|
||||
|
||||
///
|
||||
/// Prepare cameras, ROI-s and measurementOperations
|
||||
///
|
||||
@@ -488,8 +497,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
if (drainTheTank)
|
||||
@@ -571,7 +580,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
State.Create(string.Format("{0}({1}) : Measuring the reference mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(scale.ReadStableMassOp(ref measuredRefMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
@@ -639,7 +648,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
@@ -679,72 +688,38 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestWithDivOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestWithDivOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
@@ -765,28 +740,15 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollComparative
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
#endregion
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.FlowRegulationStopped));
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
///
|
||||
/// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
|
||||
|
||||
+69
-85
@@ -83,7 +83,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
return Simulate(test, repetitionNr, isLastRepetition, singleTestParams, compoundTestParams, heatMetersTestParams);
|
||||
}
|
||||
|
||||
ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
|
||||
IScale scale = outPath.Scale as IScale;
|
||||
|
||||
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
|
||||
@@ -127,23 +127,21 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -183,6 +181,17 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -467,9 +476,9 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
/// Register ROI-parameters to cameras
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> cameraMeasurementOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOperations.Add(camera.MeasurementOp());
|
||||
/// Prepare camera measurement operations
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
if (drainTheTank)
|
||||
@@ -532,7 +541,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(cameraMeasurementOperations)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
|
||||
@@ -562,93 +571,68 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(cameraMeasurementOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test, targetMassPulses, test.Qfrom, test.Qto))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Measurement loop - preparation
|
||||
///
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
bool isMeasurementCompleted = false;
|
||||
|
||||
IList<IOperation> measurementCompletedOperations = new List<IOperation>();
|
||||
measurementCompletedOperations.Add(checkUiOp);
|
||||
foreach (var op in readTempPressOps) measurementCompletedOperations.Add(op);
|
||||
measurementCompletedOperations.Add(processDataLoggingOp);
|
||||
bool isTestPart2Completed = false;
|
||||
///
|
||||
var prolongedTest = cBrd.FlyingStartStopTestWithDivOp(test, test.Qfrom, test.Qto, targetTotalPulses, targetMassPulses);
|
||||
|
||||
IList<IOperation> measurementLoopOperations = new List<IOperation>();
|
||||
foreach (var op in measurementCompletedOperations) measurementLoopOperations.Add(op);
|
||||
foreach (var op in cameraMeasurementOperations) measurementLoopOperations.Add(op);
|
||||
measurementLoopOperations.Add(new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders));
|
||||
measurementLoopOperations.Add(cBrd.QueryMeasurementEndOp()); /// Event.MeasurementCompleted
|
||||
IList<IOperation> testInProgressOps = new List<IOperation>();
|
||||
testInProgressOps.Add(checkUiOp);
|
||||
foreach (var op in readTempPressOps)
|
||||
testInProgressOps.Add(op);
|
||||
foreach (var op in cameraMeasurementOps)
|
||||
testInProgressOps.Add(op);
|
||||
testInProgressOps.Add(prolongedTest); /// Event.MeasurementCompleted
|
||||
testInProgressOps.Add(processDataLoggingOp);
|
||||
|
||||
IOperation readMassOp = scale.ReadMassOp(ref Mass);
|
||||
IList<IOperation> testCompletedOps = new List<IOperation>();
|
||||
testCompletedOps.Add(checkUiOp);
|
||||
foreach (var op in readTempPressOps)
|
||||
testCompletedOps.Add(op);
|
||||
testCompletedOps.Add(processDataLoggingOp);
|
||||
|
||||
/// Measurement loop - 1st part
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
.AddOperations(measurementLoopOperations)
|
||||
.AddOperation(readMassOp)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(new TBF.Rig.Elde.Diverter.ReadDiverterStateOp(cBrd.Devices.Diverter))
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperations(testInProgressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) { retVal = Event.Error; goto stopTest; }
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
DoInsideMeasurementLoop(cBrd, heatMetersTestParams, test, repetitionNr, estimtdEndTime);
|
||||
}
|
||||
while (!e.Contains(Event.ToSink) && !e.Contains(Event.Next)); /// Proceed to 2nd part of the measurement loop when diverter turns back to sink
|
||||
/// 'Next' button can be used in Debug version
|
||||
/// Proceed to 2nd part of test when diverter turns back to sink, 'Next' button can be used in Debug version
|
||||
while (!e.Contains(Event.TestPart2InProgress) || !e.Contains(Event.TestCompleted) && !e.Contains(Event.Next));
|
||||
|
||||
///
|
||||
/// Waiting before the 2nd mass measurement
|
||||
///
|
||||
bool waitingBeforeEndMassMeasurementCompleted = false;
|
||||
IOperation readDiverterTransitionOp = cBrd.ReadDiverterTransitionOp(false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr);
|
||||
IOperation stop2MassTimerOp = new Operations.TimerOp(test.TimeStop2Mass);
|
||||
do {
|
||||
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
|
||||
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
|
||||
.AddOperation(readMassOp)
|
||||
.AddOperation(readDiverterTransitionOp)
|
||||
.AddOperations(isTestPart2Completed ? testCompletedOps : testInProgressOps)
|
||||
.AddOperation(stop2MassTimerOp)
|
||||
.EnterState();
|
||||
|
||||
if (!isMeasurementCompleted)
|
||||
if (!isTestPart2Completed)
|
||||
{
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) isMeasurementCompleted = true;
|
||||
if (e.Contains(Event.TestCompleted)) isTestPart2Completed = true;
|
||||
waitingBeforeEndMassMeasurementCompleted = (e.Contains(Event.TimerExpired) && e.Contains(Event.BalanceDone));
|
||||
DoInsideMeasurementLoop(cBrd, heatMetersTestParams, test, repetitionNr, estimtdEndTime);
|
||||
}
|
||||
while (!isMeasurementCompleted && !waitingBeforeEndMassMeasurementCompleted);
|
||||
while (!isTestPart2Completed && !waitingBeforeEndMassMeasurementCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -663,8 +647,10 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
}
|
||||
while (!waitingBeforeEndMassMeasurementCompleted);
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "End mass");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
|
||||
if (heatMetersPath == null)
|
||||
LogProcessDataHeader(processDataLogger, "End mass");
|
||||
else
|
||||
LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
|
||||
|
||||
///
|
||||
/// Measuring the end mass
|
||||
@@ -676,12 +662,12 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
do
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
|
||||
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
|
||||
.AddOperations(isTestPart2Completed ? testCompletedOps : testInProgressOps)
|
||||
.AddOperation(readStableMassOp)
|
||||
.AddOperation(massMsrmntTimerOp)
|
||||
.EnterState();
|
||||
|
||||
if (!isMeasurementCompleted)
|
||||
if (!isTestPart2Completed)
|
||||
{
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -693,11 +679,11 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
retVal = Event.RecoverableError;
|
||||
goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.MeasurementCompleted)) isMeasurementCompleted = true;
|
||||
if (e.Contains(Event.TestCompleted)) isTestPart2Completed = true;
|
||||
measuringEndMassCompleted = e.Contains(Event.BalanceDone);
|
||||
DoInsideMeasurementLoop(cBrd, heatMetersTestParams, test, repetitionNr, estimtdEndTime, false);
|
||||
}
|
||||
while (!isMeasurementCompleted && !measuringEndMassCompleted);
|
||||
while (!isTestPart2Completed && !measuringEndMassCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -731,22 +717,21 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
bool openingDrainValveCompleted = false;
|
||||
do {
|
||||
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
|
||||
.AddOperations(isMeasurementCompleted ? measurementCompletedOperations : measurementLoopOperations)
|
||||
.AddOperations(isTestPart2Completed ? testCompletedOps : testInProgressOps)
|
||||
.AddOperation(setValvesOp)
|
||||
.AddOperation(readMassOp)
|
||||
.EnterState();
|
||||
|
||||
if (!isMeasurementCompleted)
|
||||
if (!isTestPart2Completed)
|
||||
{
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) isMeasurementCompleted = true;
|
||||
if (e.Contains(Event.TestCompleted)) isTestPart2Completed = true;
|
||||
openingDrainValveCompleted = !e.Contains(Event.ValvesBusy);
|
||||
DoInsideMeasurementLoop(cBrd, heatMetersTestParams, test, repetitionNr, estimtdEndTime);
|
||||
}
|
||||
while (!isMeasurementCompleted && !openingDrainValveCompleted);
|
||||
while (!isTestPart2Completed && !openingDrainValveCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -762,14 +747,13 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
while (!openingDrainValveCompleted);
|
||||
}
|
||||
|
||||
if (!isMeasurementCompleted)
|
||||
if (!isTestPart2Completed)
|
||||
{
|
||||
///
|
||||
/// Measurement loop - 2nd part, diverter is in state 'To sink'
|
||||
///
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
.AddOperations(measurementLoopOperations)
|
||||
.AddOperation(readMassOp)
|
||||
.AddOperations(testInProgressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
@@ -777,7 +761,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollProlonged
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
DoInsideMeasurementLoop(cBrd, heatMetersTestParams, test, repetitionNr, estimtdEndTime);
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementCompleted) && !e.Contains(Event.Next)); /// Quit the measurement loop when there is Event.MeasurementCompleted
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// Quit the measurement loop when there is Event.MeasurementCompleted
|
||||
/// 'Next' button can be used in Debug version
|
||||
}
|
||||
|
||||
|
||||
@@ -125,21 +125,22 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
|
||||
|
||||
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
IRegReaderPulses uniRR = rr as IRegReaderPulses;
|
||||
if ((uniRR != null) && (uniRR.Position >= 1) && (uniRR.Position <= 8))
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
filters[uniRR.Position - 1] = uniRR.Filter;
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
//cBrd.SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
|
||||
@@ -158,6 +159,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
@@ -175,6 +177,17 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
@@ -460,8 +473,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
if (drainTheTank)
|
||||
@@ -524,7 +537,7 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
|
||||
.AddOperations(readTempPressOps)
|
||||
@@ -548,81 +561,50 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
log.WarnFormat("Start mass = {0}kg", StartMass);
|
||||
|
||||
|
||||
if (heatMetersPath == null) LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
if (heatMetersPath == null)
|
||||
LogProcessDataHeader(processDataLogger, "Measurement");
|
||||
else
|
||||
LogProcessDataHeaderHeatMeters(processDataLogger, "Measurement");
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestWithDivOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestWithDivOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
#region Heat meters
|
||||
|
||||
if (heatMetersTestParams != null)
|
||||
{
|
||||
/// Update heatmeter volume and energy values
|
||||
if (lastEnergyUpdateTime == 0)
|
||||
{
|
||||
lastEnergyUpdateTime = StateMachine.Time;
|
||||
@@ -630,8 +612,8 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
else
|
||||
{
|
||||
//double deltaTime = (double)(StateMachine.Time - lastEnergyUpdateTime);
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C]
|
||||
double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C]
|
||||
double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l]
|
||||
double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)]
|
||||
Energy.Update(deltaEnergy);
|
||||
@@ -640,19 +622,16 @@ namespace TBF.Rig.TestMethods.FlyingStartMassCollection
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
#endregion
|
||||
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
cBrd.Stop(false);
|
||||
|
||||
///
|
||||
/// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
|
||||
/// - no 'transition sequence after test' is used
|
||||
|
||||
@@ -88,7 +88,8 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
{
|
||||
return Simulate(test, repetitionNr, isLastRepetition, singleTestParams, compoundTestParams);
|
||||
}
|
||||
|
||||
|
||||
ControlBoard.Uni.UniCB cBrd = StateMachine.ControlBoard as ControlBoard.Uni.UniCB;
|
||||
|
||||
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
|
||||
{
|
||||
@@ -129,27 +130,24 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
|
||||
IList<Event> e; /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
TBF.Rig.ControlBoard.IControlBoard cBrd = StateMachine.ControlBoard;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -188,6 +186,17 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Optionally drain the water tank
|
||||
@@ -368,8 +377,8 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
foreach (var roi in rois) roi.RegisterRoiToCamera();
|
||||
|
||||
/// Prepare measurementOperations
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
|
||||
IList<IOperation> cameraMeasurementOps = new List<IOperation>();
|
||||
foreach (var camera in cameras) cameraMeasurementOps.Add(camera.MeasurementOp());
|
||||
|
||||
|
||||
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
|
||||
@@ -378,94 +387,44 @@ namespace TBF.Rig.TestMethods.FlyingStartTankCollection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Test_in_progress);
|
||||
//------------------------------------------------
|
||||
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
|
||||
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
GenericDevices.IHasTestName readerWithTstName = rr as GenericDevices.IHasTestName;
|
||||
if (readerWithTstName != null)
|
||||
{
|
||||
readerWithTstName.TestName = test.Name;
|
||||
readerWithTstName.TestRepeats = test.Repeats;
|
||||
readerWithTstName.RepetitionNr = repetitionNr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
/// Measurement loop preparation
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TestTime;
|
||||
int remainingTime;
|
||||
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
|
||||
|
||||
/// Measurement loop - begin
|
||||
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
|
||||
/// Measurement loop
|
||||
State.Create(string.Format("{0}({1}) : FlyingStartStopTestWithDivOp is running", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperations(cameraMeasurementOps)
|
||||
.AddOperation(cBrd.FlyingStartStopTestWithDivOp(test, test.Qfrom, test.Qto, totalPulses))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.MeasurementCompleted)) goto test_completed;
|
||||
|
||||
//------------------------------------------------
|
||||
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
||||
if (remainingTime > 60)
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
}
|
||||
else
|
||||
{
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
}
|
||||
//------------------------------------------------
|
||||
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.Next)); /// 'Next' button can be used in Debug version
|
||||
|
||||
/// Measurement loop - end
|
||||
|
||||
test_completed:
|
||||
|
||||
StopRecordingStatistics();
|
||||
|
||||
State.Create(string.Format("{0}({1}) : Stopping flow regulation", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.StopFlowRegulationOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
|
||||
/// Show remaining time
|
||||
if ((remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0)) > 60)
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
||||
else
|
||||
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
||||
|
||||
/// Update statistics
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
RefFlow.Val = outPath.FlowMeter.ReadFlow();
|
||||
UpdateAllStatistics(StateMachine.Time);
|
||||
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
|
||||
}
|
||||
while (!e.Contains(Event.FlowRegulationStopped));
|
||||
while (!e.Contains(Event.TestCompleted) && !e.Contains(Event.Next)); /// 'Next' button is enabled in Debug version only
|
||||
|
||||
/// Measurement loop end
|
||||
StopRecordingStatistics();
|
||||
|
||||
///
|
||||
/// (Berlin:) Water is stopped immediately after the test and before the 2nd mass measurement in case:
|
||||
|
||||
@@ -85,23 +85,21 @@ namespace TBF.Rig.TestMethods.PulsesTest
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -341,14 +339,14 @@ namespace TBF.Rig.TestMethods.PulsesTest
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, true, false, false, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
@@ -364,7 +362,7 @@ namespace TBF.Rig.TestMethods.PulsesTest
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
case Event.MeasurementCompleted: goto one_test_completed;
|
||||
case Event.TestCompleted: goto one_test_completed;
|
||||
}
|
||||
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
|
||||
@@ -86,23 +86,21 @@ namespace TBF.Rig.TestMethods.PulsesTestManual
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
@@ -343,14 +341,14 @@ namespace TBF.Rig.TestMethods.PulsesTestManual
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartTestOp(test))
|
||||
.AddOperation(cBrd.StartTestOp(test, true, false, false, test.Qfrom, test.Qto, totalPulses, 0))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.MeasurementStarted));
|
||||
while (!e.Contains(Event.TestInProgress));
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
@@ -366,7 +364,7 @@ namespace TBF.Rig.TestMethods.PulsesTestManual
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
case Event.MeasurementCompleted: goto one_test_completed;
|
||||
case Event.TestCompleted: goto one_test_completed;
|
||||
}
|
||||
|
||||
RefFrequency.Val = cBrd.RefFrequency;
|
||||
|
||||
@@ -26,23 +26,21 @@ namespace TBF.Rig.TestMethods.RoiDetection
|
||||
checkUiOp = new Operations.CheckUIOp(true);
|
||||
processDataLoggingOp = null;
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
|
||||
@@ -65,23 +65,21 @@ namespace TBF.Rig.TestMethods.SensitivityTest
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
processDataLoggingOp = new TBF.Rig.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
|
||||
|
||||
|
||||
if (cBrd is ControlBoard.Legacy.CBoard)
|
||||
if (cBrd is ControlBoard.Uni.UniCB)
|
||||
{
|
||||
int[] filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (sensPath != null && sensPath.RegisterReaders != null)
|
||||
{
|
||||
foreach (var rr in sensPath.RegisterReaders)
|
||||
{
|
||||
IRegReaderPulses eldeRR = rr as IRegReaderPulses;
|
||||
if ((eldeRR != null) && (eldeRR.Position >= 1) && (eldeRR.Position <= 8))
|
||||
IRegReaderPulses rrPls = rr as IRegReaderPulses;
|
||||
if (rrPls != null && rrPls.Position >= 1 && rrPls.Position <= 8)
|
||||
{
|
||||
filters[eldeRR.Position - 1] = eldeRR.Filter;
|
||||
filters[rrPls.Position - 1] = rrPls.Filter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(cBrd as ControlBoard.Legacy.CBoard).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
(cBrd as ControlBoard.Uni.UniCB).SetFiltersPidShortPulses(filters, outPath.PidCoef, test.ShortPulses);
|
||||
}
|
||||
|
||||
IList<IOperation> readTempPressOps = new List<IOperation>();
|
||||
|
||||
@@ -6,12 +6,11 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.ControlBoard.Uni;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.Uni.RegValve
|
||||
{
|
||||
public class RegValve : ComponentBase, IDevice, GenericDevices.IRegValve, IDrawingItCmpntWithSetpoint
|
||||
public class RegValve : ComponentBase, Generic.IDevice, GenericDevices.IRegValve, IDrawingItCmpntWithSetpoint
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegValve));
|
||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(-1)); }
|
||||
@@ -23,7 +22,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
IDictionary<double, double> dict;
|
||||
public IDictionary<double, double> Dict { get { return dict; } }
|
||||
|
||||
readonly UniCB uniCB;
|
||||
public readonly UniCB UniCB;
|
||||
readonly int adcChannel;
|
||||
|
||||
public ValveCategory Category { get { return regValveCfg.Category; } }
|
||||
@@ -43,7 +42,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
{
|
||||
int denominator = DacValueOpen - DacValueClosed;
|
||||
if (denominator == 0) denominator = 1;
|
||||
return 100.0 * Convert.ToDouble(uniCB.AnalogInput(adcChannel) - DacValueClosed) / Convert.ToDouble(denominator);
|
||||
return 100.0 * Convert.ToDouble(UniCB.AnalogInput(adcChannel) - DacValueClosed) / Convert.ToDouble(denominator);
|
||||
}
|
||||
}
|
||||
///
|
||||
@@ -73,7 +72,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="time">Time in seconds, positive value opens the reg. valve</param>
|
||||
public void IncrementalMovement(bool isFromUI, double time)
|
||||
{
|
||||
uniCB.RegVlvIncrMove(isFromUI, Idx1, time);
|
||||
UniCB.RegVlvIncrMove(isFromUI, Idx1, time);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,7 +82,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="position">Reg. valve position (0 .. 1.0)</param>
|
||||
public void MoveToPosition(bool isFromUI, double positionLo, double positionHi = -1)
|
||||
{
|
||||
uniCB.RegVlvMoveToPos(isFromUI, Idx1, positionLo, positionHi);
|
||||
UniCB.RegVlvMoveToPos(isFromUI, Idx1, positionLo, positionHi);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +119,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
}
|
||||
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
||||
{
|
||||
short adcValue = uniCB.AnalogInput(adcChannel);
|
||||
short adcValue = UniCB.AnalogInput(adcChannel);
|
||||
RegValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
||||
}
|
||||
}
|
||||
@@ -140,8 +139,8 @@ namespace TBF.Rig.Uni.RegValve
|
||||
regValveCfg = cfg as RegValveCfg;
|
||||
adcChannel = regValveCfg.Idx1 - 1;
|
||||
|
||||
this.uniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
|
||||
if (this.uniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
|
||||
this.UniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
|
||||
if (this.UniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
|
||||
|
||||
this.dict = new Dictionary<double, double>();
|
||||
|
||||
@@ -155,7 +154,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
public void Initialize() { }
|
||||
public void RunDeviceBefore()
|
||||
{
|
||||
Int16 adcValue = uniCB.AnalogInput(adcChannel);
|
||||
Int16 adcValue = UniCB.AnalogInput(adcChannel);
|
||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
|
||||
}
|
||||
public void RunDeviceAfter() { }
|
||||
@@ -176,7 +175,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -192,7 +191,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -204,12 +203,12 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <returns>SetPositionOp instance</returns>
|
||||
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||
{
|
||||
return new SetRegValvePositionOp(uniCB, this, pctLo, pctHi, timeoutMs);
|
||||
return new SetRegValvePositionOp(UniCB, this, pctLo, pctHi, timeoutMs);
|
||||
}
|
||||
|
||||
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||
{
|
||||
return new ChangeRegulValvePositionOp(uniCB, this, timePulseSec);
|
||||
return new ChangeRegulValvePositionOp(UniCB, this, timePulseSec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace TBF.Rig.Uni.RegValve
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
|
||||
readonly double nominalFlow;
|
||||
readonly double maximalFlow;
|
||||
|
||||
///
|
||||
@@ -66,14 +65,14 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="uniCB">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="flowMeter">Flowmeter component</param>
|
||||
/// <param name="targetFlowLo">Lower limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="targetFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="qFrom">Lower limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="qTo">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||
DoubleBox flowBox, int timeout, bool leaveMeasurementRunning)
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowBox,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
this.uniCB = uniCB;
|
||||
if (this.uniCB == null) throw new ArgumentNullException("cBoard is null or not Uni");
|
||||
@@ -84,12 +83,11 @@ namespace TBF.Rig.Uni.RegValve
|
||||
this.flowMeter = flowMeter;
|
||||
if (this.flowMeter == null) throw new ArgumentNullException("flowMeter");
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
maximalFlow = nominalFlow * 1.25;
|
||||
maximalFlow = flowMeter.NominalFlow * 1.25;
|
||||
|
||||
this.targetFlowAve = (targetFlowLo + targetFlowHi) / 2;
|
||||
this.shrinkedTgtFlowLo = (0.7 * targetFlowLo) + (0.3 * this.targetFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.shrinkedTgtFlowHi = (0.7 * targetFlowHi) + (0.3 * this.targetFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.targetFlowAve = (qFrom + qTo) / 2;
|
||||
this.shrinkedTgtFlowLo = (0.7 * qFrom) + (0.3 * this.targetFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.shrinkedTgtFlowHi = (0.7 * qTo) + (0.3 * this.targetFlowAve); /// Move the upper limit 15% of the range down
|
||||
|
||||
this.flowBox = flowBox;
|
||||
if (this.flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
@@ -105,9 +103,8 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||
DoubleBox flowbox, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, timeout, false)
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -115,9 +112,8 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||
DoubleBox flowbox)
|
||||
: this(uniCB, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, int.MaxValue, false)
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, int.MaxValue, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -203,7 +199,8 @@ namespace TBF.Rig.Uni.RegValve
|
||||
return Event.OpArgumentError;
|
||||
}
|
||||
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / nominalFlow, 2000 * currentReqFlowHi / nominalFlow);
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / flowMeter.NominalFlow,
|
||||
2000 * currentReqFlowHi / flowMeter.NominalFlow);
|
||||
|
||||
log.InfoFormat("Run(): rv#={0} TARGET: flowLo={1} flowHi={2}", regV.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Rig.ControlBoard.Legacy;
|
||||
using TBF.Rig.ControlBoard.Uni;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -13,14 +13,14 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
public class RegValveTandem : ComponentBase, GenericDevices.IRegValve
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegValveTandem));
|
||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||
public override string ToString() { return string.Format("RegValveTandem({0})", Cfg.ToString(-1)); }
|
||||
|
||||
public readonly RegValveTandemCfg RegulValveTandemCfg;
|
||||
|
||||
IDictionary<double, double> dict;
|
||||
public IDictionary<double, double> Dict { get { return dict; } }
|
||||
|
||||
CBoard controlBoard { get { return regValve.ControlBoard; } }
|
||||
UniCB uniCB { get { return regValve.UniCB; } }
|
||||
public ValveCategory Category { get { return RegulValveTandemCfg.Category; } }
|
||||
|
||||
readonly TBF.Rig.Uni.RegValve.RegValve regValve;
|
||||
@@ -75,7 +75,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
{
|
||||
return new SetFlowOp(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
{
|
||||
foreach (var cmpnt in parent.CmpntEntities)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.RegulValve.RegulValveFactory)
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Uni.RegValve.Factory)
|
||||
{
|
||||
regulValveNameComboBox.Items.Add(cmpnt.Name);
|
||||
fixedRVNameComboBox.Items.Add(cmpnt.Name);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using TBF.Rig.ControlBoard.Legacy;
|
||||
using TBF.Rig.ControlBoard.Uni;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
@@ -19,9 +19,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
}
|
||||
|
||||
/// Set by the constructor
|
||||
readonly CBoard controlBoard;
|
||||
readonly TBF.Rig.Uni.RegValve.RegValve regValve;
|
||||
readonly TBF.Rig.Uni.RegValve.RegValve fixedRV;
|
||||
readonly UniCB uniCB;
|
||||
readonly RegValve.RegValve regValve;
|
||||
readonly RegValve.RegValve fixedRV;
|
||||
readonly double fixedPctLo;
|
||||
readonly double fixedPctHi;
|
||||
readonly int flowMeterNr;
|
||||
@@ -74,18 +74,18 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(CBoard controlBoard, IRegValve regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
public SetFlowOp(TBF.Rig.ControlBoard.IControlBoard cb, IRegValve regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
this.uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard is not Uni");
|
||||
|
||||
regValve = regV as TBF.Rig.Uni.RegValve.RegValve;
|
||||
if (regValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
if (regValve == null) throw new ArgumentNullException("regValve is null or not Uni");
|
||||
|
||||
fixedRV = fxdRV as TBF.Rig.Uni.RegValve.RegValve;
|
||||
if (fixedRV == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
if (fixedRV == null) throw new ArgumentNullException("regValve is null or not Uni");
|
||||
|
||||
this.fixedPctLo = fxdPctLo;
|
||||
this.fixedPctHi = fxdPctHi;
|
||||
@@ -93,18 +93,20 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
if (flowMeter is Uni.FlowMeter.FlowMeter)
|
||||
{
|
||||
this.flowMeterNr = (flowMeter as Uni.FlowMeter.FlowMeter).Idx1;
|
||||
this.nominalFlow = flowMeter.NominalFlow;
|
||||
}
|
||||
else if (flowMeter is Elde.FlowMeterTwins.FlowMeter)
|
||||
{
|
||||
this.flowMeterNr = 0;
|
||||
this.nominalFlow = flowMeter.NominalFlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("flowMeter is null or not Elde");
|
||||
throw new ArgumentNullException("flowMeter is null or not Uni");
|
||||
}
|
||||
|
||||
nominalFlow = flowMeter.NominalFlow;
|
||||
maximalFlow = nominalFlow * 1.25;
|
||||
maximalFlow = flowMeter.NominalFlow * 1.25;
|
||||
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7 * requiredFlowLo) + (0.3 * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
@@ -122,9 +124,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -132,9 +134,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -174,7 +176,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
double flowMtrFreq = uniCB.RefFrequency;
|
||||
currentReqFlowLo = reqFlowAve;
|
||||
currentReqFlowHi = reqFlowAve;
|
||||
///
|
||||
@@ -211,10 +213,8 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
|
||||
/// Start flow measurement
|
||||
uniCB.MeasureFlow(false, flowMeterNr);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
@@ -223,9 +223,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
float rvPosition = controlBoard.RValvePosition(regValve.Idx1);
|
||||
float fixedRVPosition = controlBoard.RValvePosition(fixedRV.Idx1);
|
||||
double flowMtrFreq = controlBoard.RefFrequency;
|
||||
double rvPosition = regValve.Position;
|
||||
double fixedRVPosition = fixedRV.Position;
|
||||
double flowMtrFreq = uniCB.RefFrequency;
|
||||
double flow = flowMtrFreq * nominalFlow / 2000.0;
|
||||
|
||||
if (flowMtrFreq != 0)
|
||||
@@ -243,9 +243,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
///
|
||||
controlBoard.ValveMove(regValve.Idx1, RegulValveMode.TargetPosition,
|
||||
new double[2] { targetPositionLo, targetPositionHi },
|
||||
regValve.StableTime);
|
||||
uniCB.RegVlvMoveToPos(false, regValve.Idx1, targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.SettingPosition;
|
||||
return Event.None;
|
||||
@@ -266,9 +264,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
///
|
||||
controlBoard.ValveMove(fixedRV.Idx1, RegulValveMode.TargetPosition,
|
||||
new double[2] { fixedPctLo, fixedPctHi },
|
||||
regValve.StableTime);
|
||||
uniCB.RegVlvMoveToPos(false, fixedRV.Idx1, fixedPctLo, fixedPctHi);
|
||||
|
||||
opState = OpState.SettingPosition_FixedRV;
|
||||
return Event.None;
|
||||
@@ -299,9 +295,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
|
||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||
controlBoard.ValveMove(regValve.Idx1, RegulValveMode.TargetFrequency,
|
||||
new double[2] { freqLo, freqHi },
|
||||
regValve.StableTime);
|
||||
uniCB.SetFlow(false, regValve.Idx1, freqLo, freqHi);
|
||||
|
||||
opState = OpState.SettingFlow;
|
||||
return Event.None;
|
||||
@@ -359,15 +353,12 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
opState = OpState.Idle;
|
||||
{
|
||||
opState = OpState.Idle;
|
||||
|
||||
if (leaveMeasurementRunning) return;
|
||||
|
||||
/// Stop measurement
|
||||
ControlBoard.Legacy.TestMethods tm = 0;
|
||||
StopDevs sd = StopDevs.RegValveRegulation;
|
||||
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
|
||||
|
||||
uniCB.Stop(false); /// Stop measurement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user