HeatMetersPath, UI, etc., HEAT_METERS_SUPPORT symbol introduced
ProcedureDlg modifications: (1) localization by TBF.Resources.Strings, (2) Heat meters support FlyingStartMassCollection and CombinedMeters methods with similar sequences
This commit is contained in:
+269
-211
@@ -33,17 +33,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||
Event retVal = Event.Done;
|
||||
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
|
||||
|
||||
/// Notes:
|
||||
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
|
||||
/// float timeSec = 3600.0f * timeHr;
|
||||
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
int repetitionNr = 1; /// First test: repetitionNr = 1
|
||||
|
||||
//====================================
|
||||
@@ -55,8 +49,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
/// Start the test, initialize test results
|
||||
@@ -65,126 +57,131 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
TestStartTime = DateTime.Now;
|
||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
int flowSetTime0 = StateMachine.Time;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
//------------------------------------------------
|
||||
bool tankEmptyingInProgress = test.Emptying;
|
||||
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Checking_tank_capacity);
|
||||
//------------------------------------------------
|
||||
bool tankEmptyingInProgress = test.Emptying;
|
||||
|
||||
if (!tankEmptyingInProgress) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create("FlyingStartMassCollection : Checking available tank capacity")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
||||
.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 (!tankEmptyingInProgress) /// If condition met => skip measuring and force emptying
|
||||
{
|
||||
///
|
||||
/// Measure the weight and skip emptying if there is enough room in the tank
|
||||
///
|
||||
State.Create("FlyingStartMassCollection : Checking available tank capacity")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.Balance.ReadMassOp(ref Mass))
|
||||
.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.BalanceDone));
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
|
||||
float estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass >= outPath.Balance.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
tankEmptyingInProgress = true;
|
||||
}
|
||||
}
|
||||
///
|
||||
if (tankEmptyingInProgress)
|
||||
{
|
||||
State.Create("SequenceBase : Opening the emptying valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.EmptyTankValve, null))
|
||||
.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));
|
||||
}
|
||||
float estimatedEndMass = Mass.Val + test.Volume;
|
||||
if (estimatedEndMass >= outPath.Balance.Capacity * Constants.TankFullFactor)
|
||||
{
|
||||
tankEmptyingInProgress = true;
|
||||
}
|
||||
}
|
||||
///
|
||||
if (tankEmptyingInProgress)
|
||||
{
|
||||
State.Create("SequenceBase : Opening the emptying valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(outPath.EmptyTankValve, null))
|
||||
.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));
|
||||
}
|
||||
|
||||
|
||||
if (inPath.Pump != null)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create("FlyingStartMassCollection : Starting the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
if (inPath.Pump != null)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create("FlyingStartMassCollection : Starting the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
|
||||
if (test.TimePump2StartV > 0)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Waiting after the pump started")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
if (test.TimePump2StartV > 0)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Waiting after the pump started")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
if (benchPath.StopBFValve != null)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Opening the stop backflow valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
if (benchPath.StopBFValve != null)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Opening the stop backflow valve")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.ValvesSet));
|
||||
}
|
||||
|
||||
|
||||
if (test.TimeBeforeFlow > 0)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Waiting before flow setting process starts")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
if (test.TimeBeforeFlow > 0)
|
||||
{
|
||||
State.Create("FlyingStartMassCollection : Waiting before flow setting process starts")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
}
|
||||
|
||||
|
||||
setting_flow:
|
||||
@@ -192,62 +189,61 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Setting_the_flow);
|
||||
//------------------------------------------------
|
||||
State.Create("FlyingStartMassCollection : Setting the flow")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 990)) /// timeout = 16.5 min.
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
State.Create("FlyingStartMassCollection : Setting the flow")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.UpdateTankWeightOp())
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 990)) /// timeout = 16.5 min.
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.RegulValveTimeOut))
|
||||
{
|
||||
Bridge.OnError(this, Strings.Timeout);
|
||||
retVal = Event.Done;
|
||||
goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
{
|
||||
Bridge.OnError(this, Strings.Timeout);
|
||||
retVal = Event.Done;
|
||||
goto stopTest;
|
||||
}
|
||||
if (e.Contains(Event.Next)) goto flow_set;
|
||||
}
|
||||
while (!e.Contains(Event.FlowReached));
|
||||
|
||||
|
||||
flow_set:
|
||||
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float currentFlow = RefFlow.Val;
|
||||
int flowSetTime = StateMachine.Time - flowSetTime0;
|
||||
float currentFlow = RefFlow.Val;
|
||||
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.ICameraRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.ICameraRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasureOp());
|
||||
}
|
||||
/// Extract cameras from the current sensors path, add operations to the detection state
|
||||
IList<IOperation> measureOperations = new List<IOperation>();
|
||||
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||
{
|
||||
GenericDevices.ICameraRoi cameraRoi = sensPath.RegisterReaders[i] as GenericDevices.ICameraRoi;
|
||||
if (cameraRoi != null) measureOperations.Add(cameraRoi.MeasureOp());
|
||||
}
|
||||
|
||||
|
||||
if (tankEmptyingInProgress)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Closing_the_tank);
|
||||
//------------------------------------------------
|
||||
if (tankEmptyingInProgress)
|
||||
{
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Closing_the_tank);
|
||||
//------------------------------------------------
|
||||
|
||||
///
|
||||
/// Make sure tank emptying completed
|
||||
///
|
||||
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
tankEmptyingInProgress = false;
|
||||
}
|
||||
///
|
||||
/// Make sure tank emptying completed
|
||||
///
|
||||
switch (EmptyTheTank(outPath.EmptyTankValve, outPath.Balance))
|
||||
{
|
||||
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
||||
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
|
||||
tankEmptyingInProgress = false;
|
||||
}
|
||||
|
||||
if (test.TimeFlow2Mass > 0)
|
||||
{
|
||||
@@ -258,7 +254,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.EnterState();
|
||||
do{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
@@ -333,7 +329,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
|
||||
/// Measurement loop - preparation
|
||||
readRegistersOp = new Operations.ReadMoreRegistersOp(sensPath.RegisterReaders);
|
||||
queryEnd1 = cBrd.QueryMeasurementEndOp();
|
||||
|
||||
int estimtdEndTime = StateMachine.Time + (int)test.TstTime;
|
||||
ClearAllStatistics();
|
||||
@@ -353,7 +348,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperation((StateMachine.Ambient != null)
|
||||
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity)
|
||||
: null)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
do
|
||||
@@ -389,7 +384,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
//------------------------------------------------
|
||||
Bridge.OnActivity(this, Strings.Measuring_the_weight);
|
||||
//------------------------------------------------
|
||||
State.Create("FlyingStartMassCollection : Waiting before 2nd mass measurement")
|
||||
State.Create("FlyingStartMassCollection : Waiting before the 2nd mass measurement")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
||||
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
||||
@@ -407,14 +402,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
do
|
||||
{
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (!e.Contains(Event.TimerExpired));
|
||||
|
||||
LogProcessHeader(processDataLogger, "End mass");
|
||||
|
||||
State.Create("FlyingStartMassCollection : Measuring the end mass")
|
||||
State.Create("FlyingStartMassCollection : Measuring the end mass")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
||||
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
||||
@@ -507,59 +502,122 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
{
|
||||
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
|
||||
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
|
||||
WaterMeters.iPerl.WaterMeter iPerl = regReader as WaterMeters.iPerl.WaterMeter;
|
||||
if (BatchRslts.Batch.Compound)
|
||||
{
|
||||
///
|
||||
/// Compound meters
|
||||
///
|
||||
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
|
||||
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
|
||||
{
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[2 * i + isAux];
|
||||
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainMeterRslt : auxMeterRslt;
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.NoSamples ? (iPerl.TimestampSecStart + tstRslt.TestTime) : iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = iPerl.NoSamples ? tstRslt.TestTime : (meterRslt.TimestampEnd - meterRslt.TimestampStart);
|
||||
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
||||
meterRslt.VolumeEnd = iPerl.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(iPerl.VolumeLtrEnd - iPerl.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
iPerl.VolumeLtrRef = meterRslt.VolumeRef;
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
|
||||
/// Optionally supress pulses from the large water meter
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
|
||||
meterRslt.TestTime = tstRslt.TestTime;
|
||||
meterRslt.VolumeStart = 0;
|
||||
meterRslt.VolumeEnd = 0;
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV;
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
|
||||
if (meterRslt.PulsesMaster != 0)
|
||||
{
|
||||
meterRslt.VolumeMeter *= (tstRslt.PulsesMaster / meterRslt.PulsesMaster);
|
||||
}
|
||||
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation
|
||||
}
|
||||
}
|
||||
|
||||
Results.Entities.MeterTestRslt compoundMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Compound);
|
||||
|
||||
if (compoundMeterRslt != null && mainMeterRslt != null && auxMeterRslt != null)
|
||||
{
|
||||
compoundMeterRslt.VolumeRef = tstRslt.VolumeCTV;
|
||||
compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter;
|
||||
compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster;
|
||||
compoundMeterRslt.TestTime = tstRslt.TestTime;
|
||||
compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef);
|
||||
compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.ErrLimLo + test.Uncertainty)
|
||||
&& (compoundMeterRslt.Error <= test.ErrLimHi - test.Uncertainty);
|
||||
mainMeterRslt.Passed = auxMeterRslt.Passed = compoundMeterRslt.Passed;
|
||||
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
#if HEAT_METERS_SUPPORT
|
||||
else if (BatchRslts.Batch.HeatMeter)
|
||||
{
|
||||
///
|
||||
/// Heat meters
|
||||
///
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/// MetersKind.Single meters
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
|
||||
WaterMeters.iPerl.WaterMeter iPerl = regReader as WaterMeters.iPerl.WaterMeter;
|
||||
|
||||
if (meterRslt != null && regReader != null)
|
||||
{
|
||||
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
|
||||
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
|
||||
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
|
||||
|
||||
if (iPerl != null)
|
||||
{
|
||||
meterRslt.TimestampStart = iPerl.TimestampSecStart;
|
||||
meterRslt.TimestampEnd = iPerl.NoSamples ? (iPerl.TimestampSecStart + tstRslt.TestTime) : iPerl.TimestampSecEnd;
|
||||
meterRslt.TestTime = iPerl.NoSamples ? tstRslt.TestTime : (meterRslt.TimestampEnd - meterRslt.TimestampStart);
|
||||
meterRslt.VolumeStart = iPerl.VolumeLtrStart; /// liter
|
||||
meterRslt.VolumeEnd = iPerl.VolumeLtrEnd; /// liter
|
||||
meterRslt.VolumeMeter = Math.Abs(iPerl.VolumeLtrEnd - iPerl.VolumeLtrStart);
|
||||
meterRslt.VolumeRef = tstRslt.VolumeCTV * meterRslt.TestTime / tstRslt.TestTime;
|
||||
iPerl.VolumeLtrRef = meterRslt.VolumeRef;
|
||||
#if IPERLST || IPERLST_SPECIAL
|
||||
meterRslt.WaterMeter.CalibFactor = (iPerl.CalibrationStruct != null) ? iPerl.CalibrationStruct.Calibration : 0;
|
||||
meterRslt.WaterMeter.Q2Correction = iPerl.Q2CorrectionFactor;
|
||||
#endif
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
iPerl.NominalTestFlow = 500.0 * (test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.TestTime = tstRslt.TestTime; /// TODO: Malo by sa citat z dosky
|
||||
meterRslt.VolumeStart = 0; /// liter
|
||||
meterRslt.VolumeEnd = 0; /// liter
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
||||
}
|
||||
iPerl.LastTestResult2 = iPerl.LastTestResult; /// Save shift previous test result
|
||||
iPerl.LastTestResult = meterRslt; /// Save this test result
|
||||
iPerl.NominalTestFlow = 500.0 * (test.Qfrom + test.Qto); /// Ave. + convert to liter/hour
|
||||
}
|
||||
else
|
||||
{
|
||||
meterRslt.TestTime = tstRslt.TestTime; /// TODO: Malo by sa citat z dosky
|
||||
meterRslt.VolumeStart = 0; /// liter
|
||||
meterRslt.VolumeEnd = 0; /// liter
|
||||
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
|
||||
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
|
||||
}
|
||||
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty);
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
|
||||
meterRslt.Passed = (meterRslt.Error >= test.ErrLimLo + test.Uncertainty)
|
||||
&& (meterRslt.Error <= test.ErrLimHi - test.Uncertainty);
|
||||
meterRslt.TestDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
tstRslt.Components = Results.Entities.Components
|
||||
.UpdateList(BatchRslts.ComponentsList,
|
||||
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
||||
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
||||
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
||||
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
||||
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
||||
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
||||
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
||||
}
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
|
||||
public bool Evaluate(Test test) { return true; }
|
||||
public bool Publish(Test test) { return true; }
|
||||
public bool CanTest(MetersKind meters) { return meters == MetersKind.Single; }
|
||||
public bool CanTest(MetersKind meters) { return true; }
|
||||
|
||||
public TestMethod()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user