Process data display : many changes, TODO: Meter data and the end of test.

This commit is contained in:
Milan Hanajik
2016-02-10 19:24:10 +01:00
parent 3775913a33
commit 2c1e4e7d26
18 changed files with 254 additions and 223 deletions
@@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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]
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);
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
@@ -80,6 +80,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -94,6 +95,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -113,6 +115,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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.Error)) { retVal = Event.Error; goto stopTest; }
@@ -148,6 +151,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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; }
@@ -212,7 +216,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
.AddOperations(measureOperations)
.AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5))
.AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, 5))
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
@@ -226,9 +230,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
LogProcessHeader(processDataLogger, "Measurement");
StartMassRaw = startMass.Val;
log.WarnFormat("Start mass = {0}kg", startMass);
Mass.Val = startMass.Val;
log.WarnFormat("Start mass = {0}kg", StartMass);
Mass.Val = StartMass.Val;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
@@ -308,8 +311,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
//------------------------------------------------
UpdateAllStatistics();
CurrentMassRaw = Mass.Val;
RefFreq.Val = cBrd.ReferenceFreq;
RefFreq.Val = cBrd.ReferenceFreq;
RefFlow.Val = cBrd.ReferenceFlow;
string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq,
@@ -320,6 +322,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
}
log.Debug(logstr);
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
}
while (true);
@@ -364,7 +367,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.AddOperation(readRegistersOp)
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null)
.AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5))
.AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, 5))
.AddOperation(cBrd.UpdateTankWeightOp())
.AddOperation(processDataLoggingOp)
.EnterState();
@@ -376,9 +379,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
}
while (!e.Contains(Event.BalanceDone));
///
log.WarnFormat("End mass = {0}kg", endMass);
EndMassRaw = endMass.Val;
TestEndTime = DateTime.Now;
log.WarnFormat("End mass = {0}kg", EndMass);
TestEndTime = DateTime.Now;
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_completed);
@@ -433,15 +435,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = startMass.Val;
tstRslt.MassStartRaw = StartMass.Val;
tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Balance.Corrections);
tstRslt.MassEndRaw = endMass.Val;
tstRslt.MassEndRaw = EndMass.Val;
tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Balance.Corrections);
tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h]
tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.VolumeCTV = 1001.03 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityOut; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)