diff --git a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs index a1baf4d0e..20b9bb94e 100644 --- a/TestBenchFramework/BenchControl/Sequences/MainSeq.cs +++ b/TestBenchFramework/BenchControl/Sequences/MainSeq.cs @@ -504,8 +504,8 @@ namespace TBF.BenchControl.Sequences /// Update format for the water mass Mass.Format = outPath.Balance.Format; - startMass.Format = outPath.Balance.Format; - endMass.Format = outPath.Balance.Format; + StartMass.Format = outPath.Balance.Format; + EndMass.Format = outPath.Balance.Format; TimeEstimateOneTest = test.TstTime + 10.0f; //-------------------------------------------------------------- @@ -559,8 +559,8 @@ namespace TBF.BenchControl.Sequences /// Update format for the water mass Mass.Format = outPath.Balance.Format; - startMass.Format = outPath.Balance.Format; - endMass.Format = outPath.Balance.Format; + StartMass.Format = outPath.Balance.Format; + EndMass.Format = outPath.Balance.Format; TimeEstimateTotal = test.Repeats * (test.TstTime + 10.0f); TimeEstimateOneTest = test.TstTime + 10.0f; diff --git a/TestBenchFramework/BenchControl/Sequences/ProcessData.cs b/TestBenchFramework/BenchControl/Sequences/ProcessData.cs index cc7589f49..e82011cc5 100644 --- a/TestBenchFramework/BenchControl/Sequences/ProcessData.cs +++ b/TestBenchFramework/BenchControl/Sequences/ProcessData.cs @@ -19,16 +19,16 @@ namespace TBF.BenchControl.Sequences public static IntBox RefCount = new IntBox() { Name = "RefCount" }; public static FloatBox RefFreq = new FloatBox() { Name = "RefFreq", Format = "F2" }; - public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h] - public static FloatBox Mass = new FloatBox() { Name = "Mass", Format = "F3" }; /// [kg] + public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h] + public static float LtrPerRefPulse; /// to calculate ref. volume + + public static FloatBox Mass = new FloatBox() { Name = "Mass", Format = "F3" }; /// [kg] + public static FloatBox StartMass = new FloatBox() { Name = "Start Mass", Format = "F3" }; /// [kg] + public static FloatBox EndMass = new FloatBox() { Name = "End Mass", Format = "F3" }; /// [kg] public static DateTime TestStartTime; public static DateTime TestEndTime; - public static double StartMassRaw; /// [kg] - public static double CurrentMassRaw; /// [kg] - public static double EndMassRaw; /// [kg] - public static Results.BatchResults BatchRslts; diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs index 660d3f966..396a87e81 100644 --- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs +++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs @@ -39,7 +39,7 @@ namespace TBF.BenchControl.Sequences /// They are re-initialized when LoadProcedure() is called ///------------------------------------------------------------ public static int ReferenceFlowmetersCount; - public static float[] LtrPerRefPulse; /// Reference flowmeter coefficients + public static float[] CalibratedLtrPerRefPulse; /// Reference flowmeter coefficients public static double Qrise; public static double Qfall; @@ -72,8 +72,6 @@ namespace TBF.BenchControl.Sequences protected static TransitionSequence transitionAfter; - protected float ltrPerRefPulse; - protected IOperation readRegistersOp; protected IOperation queryEnd1; protected IOperation queryEnd2; @@ -88,9 +86,6 @@ namespace TBF.BenchControl.Sequences protected static FloatBox[] WMVolumes; protected static FloatBox[] WMErrors; - protected static FloatBox startMass = new FloatBox() { Name = "Start Mass", Format = "F3" }; - protected static FloatBox endMass = new FloatBox() { Name = "End Mass", Format = "F3" }; - /// /// To clear process values at the beginning of each test /// @@ -111,8 +106,8 @@ namespace TBF.BenchControl.Sequences RefFreq.Clear(); RefFlow.Clear(); Mass.Clear(); - startMass.Clear(); - endMass.Clear(); + StartMass.Clear(); + EndMass.Clear(); } @@ -139,7 +134,7 @@ namespace TBF.BenchControl.Sequences Utils.FloatToStr(RefFlow.Val, 4), StateMachine.ControlBoard.TTime.ToString("F3"), StateMachine.ControlBoard.EtPulses(0), - Formulas.VolumeFromPulses(StateMachine.ControlBoard.EtPulses(0), 1.0f / ltrPerRefPulse).ToString("F3"), + Formulas.VolumeFromPulses(StateMachine.ControlBoard.EtPulses(0), 1.0f / LtrPerRefPulse).ToString("F3"), TempIn, TempOut, TempDiv, @@ -837,8 +832,8 @@ namespace TBF.BenchControl.Sequences tstRslt.FlowSetTime = 10; tstRslt.TestTime = tstRslt.TargetTime(); /// TODO: Verify whether 'ltrPerRefPulse' is up to date - tstRslt.PulsesMaster = (ltrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / ltrPerRefPulse) : 1; - tstRslt.ConstMaster = ltrPerRefPulse; + tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1; + tstRslt.ConstMaster = LtrPerRefPulse; tstRslt.MassStartRaw = 0; tstRslt.MassStart = 0; tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f; @@ -941,8 +936,8 @@ namespace TBF.BenchControl.Sequences tstRslt.FlowSetTime = 10; tstRslt.TestTime = tstRslt.TargetTime(); /// TODO: Verify whether 'ltrPerRefPulse' is up to date - tstRslt.PulsesMaster = (ltrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / ltrPerRefPulse) : 1; - tstRslt.ConstMaster = ltrPerRefPulse; + tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1; + tstRslt.ConstMaster = LtrPerRefPulse; tstRslt.MassStartRaw = 0; tstRslt.MassStart = 0; tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f; diff --git a/TestBenchFramework/BenchControl/StateMachine.cs b/TestBenchFramework/BenchControl/StateMachine.cs index 38430daf6..94df1ccf7 100644 --- a/TestBenchFramework/BenchControl/StateMachine.cs +++ b/TestBenchFramework/BenchControl/StateMachine.cs @@ -570,13 +570,13 @@ namespace TBF.BenchControl try { SequenceBase.ReferenceFlowmetersCount = SequenceBase.FlowMeters.Count; - SequenceBase.LtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount]; + SequenceBase.CalibratedLtrPerRefPulse = new float[SequenceBase.ReferenceFlowmetersCount]; foreach (var flowmtr in SequenceBase.FlowMeters) { int ix = flowmtr.Idx1; if (ix > 0 && ix <= SequenceBase.ReferenceFlowmetersCount) { - SequenceBase.LtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f; + SequenceBase.CalibratedLtrPerRefPulse[ix - 1] = flowmtr.NominalFlow / 7200.0f; } } diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 1dc59e305..fea48effa 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -63,13 +63,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment 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); @@ -106,6 +106,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment 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; } @@ -120,6 +121,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment 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; } @@ -134,6 +136,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment 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; } @@ -221,7 +224,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment } UpdateAllStatistics(); - CurrentMassRaw = Mass.Val; RefFreq.Val = cBrd.ReferenceFreq; RefFlow.Val = cBrd.ReferenceFlow; @@ -233,6 +235,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment } 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)); } /// Measurement loop - end @@ -297,8 +300,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment tstRslt.MassStart = 0; tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] - tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] - tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume); /// Calculate master flowmeter coefficient tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs index a6e94bf55..040f1d2d3 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs @@ -34,15 +34,15 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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); - ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse] + LtrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse] /// processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -82,6 +82,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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; } } @@ -95,6 +96,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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; } @@ -114,6 +116,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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; } @@ -149,6 +152,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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; } @@ -206,7 +210,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters State.Create("CombinedMeters : Measuring the start mass") .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5)) + .AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, 5)) .EnterState(); do { @@ -216,8 +220,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters } while (!e.Contains(Event.BalanceDone)); - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -266,7 +269,6 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters } UpdateAllStatistics(); - CurrentMassRaw = Mass.Val; RefFreq.Val = cBrd.ReferenceFreq; RefFlow.Val = cBrd.ReferenceFlow; @@ -289,6 +291,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters // Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val); // } //} + 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 @@ -322,7 +325,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters //------------------------------------------------ State.Create("CombinedMeters : Measuring the end mass") .AddOperation(checkUiOp) - .AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5)) + .AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, 5)) .AddOperation(cBrd.UpdateTankWeightOp()) .EnterState(); do @@ -333,7 +336,6 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; //------------------------------------------------ @@ -389,15 +391,15 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters 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] 1001.03f 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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 7412314e8..2697e0451 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -50,13 +50,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection while (!e.Contains(Event.PreviousStopped)); - 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); @@ -327,6 +327,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection bool goBackToInitFlow = ((rvPulse > 0) && (relativeQave < 0)) || ((rvPulse < 0) && (relativeQave > 0)); + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); int flowSetTime0 = StateMachine.Time; @@ -341,6 +342,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection 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)) goto stopTest; @@ -364,6 +366,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection 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)) goto stopTest; @@ -381,7 +384,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection State.Create(Strings.Measure_the_mass) .AddOperation(checkUiOp) .AddOperations(measureOperations) - .AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5)) + .AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, 5)) .EnterState(); do { @@ -391,8 +394,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection } while (!e.Contains(Event.BalanceDone)); - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -442,7 +444,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection } UpdateAllStatistics(); - CurrentMassRaw = Mass.Val; string logstr = string.Format("E={0} f={1} q={2}", cBrd.EtPulses(0), cBrd.ReferenceFreq, cBrd.ReferenceFlow * outPath.FlowMeter.NominalFlow); @@ -464,6 +465,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection // Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val); // } //} + 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 @@ -476,7 +478,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection //------------------------------------------------ State.Create(Strings.Measure_the_mass) .AddOperation(checkUiOp) - .AddOperation(outPath.Balance.ReadStableMassOp(ref endMass, 5)) + .AddOperation(outPath.Balance.ReadStableMassOp(ref EndMass, 5)) .EnterState(); do { @@ -486,7 +488,6 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; //------------------------------------------------ @@ -567,15 +568,15 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection 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 * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / 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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index c6624d695..0995ec80b 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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); @@ -83,6 +83,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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; } @@ -97,6 +98,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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; } @@ -116,6 +118,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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; } @@ -152,6 +155,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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; } @@ -166,6 +170,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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; } @@ -254,7 +259,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced .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(); @@ -267,8 +272,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced while (!e.Contains(Event.BalanceDone)); TestStartTime = DateTime.Now; - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -331,8 +335,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced } 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, @@ -343,6 +346,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced } 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 (cBrd.EtPulses(0) < totalPulses); @@ -398,7 +402,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced .AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown)) .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(); @@ -410,7 +414,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; @@ -426,8 +429,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(startMass.Val, outPath.Balance.Corrections); - double massEnd = Formulas.CorrectedValue(endMass.Val, outPath.Balance.Corrections); + double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Balance.Corrections); + double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Balance.Corrections); double densityOut = Formulas.WaterDensityFromTemp(TempOutStat.Average); double volumeCTV = 1.00103f * 1000.0f * (massEnd - massStart) / densityOut; @@ -513,15 +516,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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 = massStart; /// [kg] calculated before displaying 'End state' dialog - tstRslt.MassEndRaw = endMass.Val; + tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEnd = massEnd; /// [kg] calculated before displaying 'End state' dialog tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] - tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog - 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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs index b2d1fbc3a..eb37ef77a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartCombinedMeters/FixedStartCombinedMetersSeq.cs @@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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); @@ -83,6 +83,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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; } @@ -97,6 +98,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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; } @@ -116,6 +118,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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; } @@ -152,6 +155,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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; } @@ -166,6 +170,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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; } @@ -254,7 +259,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters .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(); @@ -266,8 +271,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters } while (!e.Contains(Event.BalanceDone)); - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -330,7 +334,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters } UpdateAllStatistics(); - CurrentMassRaw = Mass.Val; RefFreq.Val = cBrd.ReferenceFreq; RefFlow.Val = cBrd.ReferenceFlow; @@ -353,6 +356,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters // Formulas.ErrorFromVolumes(data.TestResult.CombinedMeters[i].VolumeMeter, data.Volume.Val); // } //} + Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); } while (cBrd.EtPulses(0) < totalPulses); @@ -408,7 +412,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters .AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown)) .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(); @@ -420,7 +424,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; @@ -436,8 +439,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(startMass.Val, outPath.Balance.Corrections); - double massEnd = Formulas.CorrectedValue(endMass.Val, outPath.Balance.Corrections); + double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Balance.Corrections); + double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Balance.Corrections); double densityOut = Formulas.WaterDensityFromTemp(TempOutStat.Average); /// [kg/m3] double volumeCTV = 1.00103f * 1000.0f * (massEnd - massStart) / densityOut; @@ -523,15 +526,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartCombinedMeters 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 = massStart; - tstRslt.MassEndRaw = endMass.Val; + tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEnd = massEnd; tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] - tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [l/h] - tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [l/h] + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + 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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 6ccf9f1d2..af84bb42a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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); @@ -83,6 +83,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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; } @@ -97,6 +98,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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; } @@ -116,6 +118,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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; } @@ -152,6 +155,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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; } @@ -166,6 +170,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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; } @@ -254,7 +259,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection .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(); @@ -266,8 +271,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } while (!e.Contains(Event.BalanceDone)); - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -330,8 +334,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } 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, @@ -342,6 +345,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } 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 (cBrd.EtPulses(0) < totalPulses); @@ -397,7 +401,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection .AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown)) .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(); @@ -409,7 +413,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; @@ -425,8 +428,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(startMass.Val, outPath.Balance.Corrections); - double massEnd = Formulas.CorrectedValue(endMass.Val, outPath.Balance.Corrections); + double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Balance.Corrections); + double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Balance.Corrections); double densityOut = Formulas.WaterDensityFromTemp(TempOutStat.Average); /// [kg/m3] double volumeCTV = 1001.03 * (massEnd - massStart) / densityOut; @@ -512,15 +515,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection 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 = massStart; - tstRslt.MassEndRaw = endMass.Val; + tstRslt.MassEndRaw = EndMass.Val; tstRslt.MassEnd = massEnd; tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] - tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [l/h] - tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [l/h] + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.ConstMaster = ltrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + 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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 94943a034..9b28039b2 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart 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); @@ -79,6 +79,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart 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; } @@ -93,6 +94,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart 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; } @@ -173,8 +175,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart } 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, @@ -185,6 +186,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart } 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)); } /// Measurement loop - end @@ -251,8 +253,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStart tstRslt.MassEndRaw = 0; tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] - tstRslt.FlowVolume = 3.6 * ltrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] - tstRslt.VolumeMaster = ltrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume); /// Corrected master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 6be1001e3..c517663ea 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -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++) diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs index 9daec886e..70c4516a4 100644 --- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs @@ -145,8 +145,6 @@ namespace TBF.BenchControl.TestMethods.PMaxTest { e = StateMachine.WaitRunDevsRunOps(); - CurrentMassRaw = Mass.Val; - if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs index c95cac436..1b676cccd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs @@ -34,13 +34,13 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration 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.ReferenceFlowmeterCalibration 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.ReferenceFlowmeterCalibration 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.ReferenceFlowmeterCalibration 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; } @@ -146,6 +149,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration 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; } @@ -177,7 +181,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration .AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown)) .AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbientTemp, AmbientPressure, AmbientHumidity) : null) - .AddOperation(outPath.Balance.ReadStableMassOp(ref startMass, 5)) + .AddOperation(outPath.Balance.ReadStableMassOp(ref StartMass, 5)) .AddOperation(cBrd.UpdateTankWeightOp()) .AddOperation(processDataLoggingOp) .EnterState(); @@ -189,8 +193,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration } while (!e.Contains(Event.BalanceDone)); - StartMassRaw = startMass.Val; - Mass.Val = startMass.Val; + Mass.Val = StartMass.Val; //------------------------------------------------ Bridge.OnActivity(this, Strings.Test_in_progress); @@ -227,7 +230,6 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration } UpdateAllStatistics(); - CurrentMassRaw = Mass.Val; RefFreq.Val = cBrd.ReferenceFreq; RefFlow.Val = cBrd.ReferenceFlow; @@ -239,6 +241,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration } 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)); } /// Measurement loop - end @@ -279,7 +282,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration .AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown)) .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(); @@ -291,7 +294,6 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration } while (!e.Contains(Event.BalanceDone)); /// - EndMassRaw = endMass.Val; TestEndTime = DateTime.Now; //------------------------------------------------ @@ -347,21 +349,21 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration 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); /// Update flowmeter constant with the measured one if (outPath.FlowMeter.Idx1 > 0 && outPath.FlowMeter.Idx1 <= ReferenceFlowmetersCount) { - LtrPerRefPulse[outPath.FlowMeter.Idx1 - 1] = Convert.ToSingle(tstRslt.ConstMaster); + CalibratedLtrPerRefPulse[outPath.FlowMeter.Idx1 - 1] = Convert.ToSingle(tstRslt.ConstMaster); log.InfoFormat("Updating LtrPerRefPulse[{0}] = {1}", outPath.FlowMeter.Idx1 - 1, tstRslt.ConstMaster); } diff --git a/TestBenchFramework/Screens/ProcessTabPageCtrl24.cs b/TestBenchFramework/Screens/ProcessTabPageCtrl24.cs index 4407bce0b..461a58d34 100644 --- a/TestBenchFramework/Screens/ProcessTabPageCtrl24.cs +++ b/TestBenchFramework/Screens/ProcessTabPageCtrl24.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Windows.Forms; using log4net; using Config.Entities; +using TBF.BenchControl.Sequences; using TBF.UiBridge; using TBF.Resources; @@ -383,20 +384,42 @@ namespace TBF.Screens void OnProcessDataChanged(object sender, ProcessDataEventArgs args) { - /// Top part - //airTempLabel.Text = args.AmbientTemp.ToString(); - //airPressLabel.Text = args.AmbientPressure.ToString(); - //airHumiLabel.Text = args.AmbientHumidity.ToString(); + /// + /// Always available + /// + airTempLabel.Text = ProcessData.AmbientTemp.ToString(); + airPressLabel.Text = ProcessData.AmbientPressure.ToString(); + airHumiLabel.Text = ProcessData.AmbientHumidity.ToString(); - //refPulsesLabel.Text = args.RefPulses.ToString(); - //refFreqLabel.Text = args.FlowMtrFreq.ToString(); - //refFlowLabel.Text = Utils.FloatToStr(args.Flow.Val, 4); - //refVolumeLabel.Text = args.Volume.ToString(); + tInLabel.Text = ProcessData.TempIn.ToString(); + tOutLabel.Text = ProcessData.TempOut.ToString(); + tDivLabel.Text = ProcessData.TempDiv.ToString(); - //regValvePosLabel.Text = args.RegValvePos.ToString(); - //tDivLabel.Text = args.Tdiv.ToString(); + prInLabel.Text = ProcessData.PressureUp.ToString(); + prOutLabel.Text = ProcessData.PressureDown.ToString(); + + massLabel.Text = ProcessData.Mass.ToString(); + + /// + /// Available when setting the flow + /// + refFreqLabel.Text = ProcessData.RefFreq.ToString(); + refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4); + + + /// + /// Available during a test + /// + refPulsesLabel.Text = ProcessData.RefCount.ToString(); + double refVolume = ProcessData.LtrPerRefPulse * (double)ProcessData.RefCount.Val; + + float massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val; + massDiffLabel.Text = massDiff.ToString("F3"); + float volumeCtv = 1001.03f * massDiff / (float)TBF.BenchControl.Formulas.WaterDensityFromTemp(ProcessData.TempOut.Val); + volumeCtvLabel.Text = volumeCtv.ToString("F2"); + double refError = TBF.BenchControl.Formulas.ErrorFromVolumes(refVolume, volumeCtv); + refErrorLabel.Text = refError.ToString("F3"); - /// Bottom part if (currentMetersKind == MetersKind.Single) { for (int i = 0; i < textBoxesCount; i++) @@ -423,18 +446,6 @@ namespace TBF.Screens //error1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeErrorPct.ToString("F2"); } - //tInLabel.Text = args.Tin.ToString(); - //tOutLabel.Text = args.Tout.ToString(); - //prInLabel.Text = args.Pin.ToString(); - //prOutLabel.Text = args.Pout.ToString(); - - //massLabel.Text = args.Mass.ToString(); - - //if (args.Mass.Valid && args.StartMass.Valid) - //{ - // massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format); - //} - //if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank) //{ // //if (pumpOn != args.PumpOn) diff --git a/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs b/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs index f98cab570..0537a5ba6 100644 --- a/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs +++ b/TestBenchFramework/Screens/ProcessTabPageCtrl48.cs @@ -413,33 +413,51 @@ namespace TBF.Screens void OnProcessDataChanged(object sender, ProcessDataEventArgs args) { - airTempLabel.Text = ProcessData.AmbientTemp.ToString(); + /// + /// Always available + /// + airTempLabel.Text = ProcessData.AmbientTemp.ToString(); airPressLabel.Text = ProcessData.AmbientPressure.ToString(); airHumiLabel.Text = ProcessData.AmbientHumidity.ToString(); tInLabel.Text = ProcessData.TempIn.ToString(); tOutLabel.Text = ProcessData.TempOut.ToString(); - prInLabel.Text = ProcessData.PressureUp.ToString(); + tDivLabel.Text = ProcessData.TempDiv.ToString(); + + prInLabel.Text = ProcessData.PressureUp.ToString(); prOutLabel.Text = ProcessData.PressureDown.ToString(); + + massLabel.Text = ProcessData.Mass.ToString(); - refPulsesLabel.Text = ProcessData.RefCount.ToString(); - refFreqLabel.Text = ProcessData.RefFreq.ToString(); - refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4); + if (args.TestPhase == Config.Entities.Progress.FlowSetting) + { + /// + /// Available when setting the flow + /// + refFreqLabel.Text = ProcessData.RefFreq.ToString(); + refFlowLabel.Text = Utils.FloatToStr(ProcessData.RefFlow.Val, 4); + } - //if (args.Phase == Config.Entities.Progress.Test) - { - /// Top part - refVolumeLabel.Text = args.Volume.ToString(); + if (args.TestPhase == Config.Entities.Progress.FlowSetting || + args.TestPhase == Config.Entities.Progress.Test) + { + /// + /// Available during a test + /// + refPulsesLabel.Text = ProcessData.RefCount.ToString(); + double refVolume = ProcessData.LtrPerRefPulse * (double)ProcessData.RefCount.Val; - //regValvePosLabel.Text = args.RegValvePos.ToString(); - tDivLabel.Text = args.Tdiv.ToString(); + float massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val; + massDiffLabel.Text = massDiff.ToString("F3"); + float volumeCtv = 1001.03f * massDiff / (float)TBF.BenchControl.Formulas.WaterDensityFromTemp(ProcessData.TempOut.Val); + volumeCtvLabel.Text = volumeCtv.ToString("F2"); + double refError = TBF.BenchControl.Formulas.ErrorFromVolumes(refVolume, volumeCtv); + refErrorLabel.Text = refError.ToString("F3"); - /// Bottom part if (currentMetersKind == MetersKind.Single) { for (int i = 0; i < textBoxesCount; i++) { - /// TODO: Reimplement //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString(); //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString(); //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString(); @@ -450,36 +468,28 @@ namespace TBF.Screens { for (int i = 0; i < 2; i++) { - /// TODO: Reimplement //pulses[i].Text = args.TestResult.Meters[i].PulsesMeter.ToString(); //refPulses[i].Text = args.TestResult.Meters[i].PulsesMaster.ToString(); //volume[i].Text = args.TestResult.Meters[i].VolumeMeter.ToString(); //error[i].Text = args.TestResult.Meters[i].VolumeErrorPct.ToString("F2"); } - /// TODO: Reimplement + //volume1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeMeter.ToString(); //error1zLabel.Text = args.TestResult.CombinedMeters[0].VolumeErrorPct.ToString("F2"); } + } - massLabel.Text = args.Mass.ToString(); - - if (args.Mass.Valid && args.StartMass.Valid) - { - massDiffLabel.Text = (args.Mass.Val - args.StartMass.Val).ToString(args.Mass.Format); - } - - if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank) - { - //if (pumpOn != args.PumpOn) - //{ - // if (pumpOn) pumpPictureBox.Image = System.Resources. - // else pumpPictureBox.Image = System.Resources. - //} - pumpOn = args.PumpOn; - diverterToTank = args.DivToTank; - Invalidate(); - } - } + //if (pumpOn != args.PumpOn || diverterToTank != args.DivToTank) + //{ + // //if (pumpOn != args.PumpOn) + // //{ + // // if (pumpOn) pumpPictureBox.Image = System.Resources. + // // else pumpPictureBox.Image = System.Resources. + // //} + // pumpOn = args.PumpOn; + // diverterToTank = args.DivToTank; + // Invalidate(); + //} } void OnTestCompleted(object sender, TestCompletedEventArgs args) diff --git a/TestBenchFramework/Screens/ProcessTabPageCtrl6.cs b/TestBenchFramework/Screens/ProcessTabPageCtrl6.cs index 066bbb6a7..6814cbea1 100644 --- a/TestBenchFramework/Screens/ProcessTabPageCtrl6.cs +++ b/TestBenchFramework/Screens/ProcessTabPageCtrl6.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Windows.Forms; using log4net; using Config.Entities; +using TBF.BenchControl.Sequences; using TBF.UiBridge; using TBF.Resources; diff --git a/TestBenchFramework/UiBridge/ProcessDataEventArgs.cs b/TestBenchFramework/UiBridge/ProcessDataEventArgs.cs index 2927f75d6..1f7bbbd7c 100644 --- a/TestBenchFramework/UiBridge/ProcessDataEventArgs.cs +++ b/TestBenchFramework/UiBridge/ProcessDataEventArgs.cs @@ -2,7 +2,7 @@ /// Copyright (c) 2016 Sensus Metering Systems /// using System; -using TBF.Boxes; +using Config.Entities; namespace TBF.UiBridge { @@ -12,30 +12,25 @@ namespace TBF.UiBridge public int Part; public int Repeats; public int RepetitionNr; + public Progress TestPhase; - public int RefPulses; /// Reference pulses count since the test start - public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0) - public FloatBox FlowMtrFreq; /// Current reference flowmeter frequency in [Hz] (0 .. 2000.0 in case within range) - public FloatBox Flow; /// Current flow in [m3/h] - public FloatBox Volume; /// - public float Time; - public FloatBox Mass; - public FloatBox StartMass; - public bool PumpOn; - public bool DivToTank; - - public FloatBox Tin; - public FloatBox Tout; - public FloatBox Tdiv; - public FloatBox Pin; - public FloatBox Pout; - public FloatBox AmbientTemp; - public FloatBox AmbientPressure; - public FloatBox AmbientHumidity; + //public FloatBox RegValvePos; /// Current regulation valve position in [%] (0 .. 100.0) + //public bool PumpOn; + //public bool DivToTank; - public ProcessDataEventArgs() - { - } + public ProcessDataEventArgs(Test test, int repetitionNr, Progress testPhase) + { + TestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); + Part = test.Part; + Repeats = test.Repeats; + RepetitionNr = repetitionNr; + TestPhase = testPhase; + } + + public ProcessDataEventArgs(Test test, Progress testPhase) + : this(test, 1, testPhase) + { + } } }