diff --git a/TestBenchFramework/BenchControl/Cameras/IdcCamera/Idc100.cs b/TestBenchFramework/BenchControl/Cameras/IdcCamera/Idc100.cs index 96ef29f18..2e716f02b 100644 --- a/TestBenchFramework/BenchControl/Cameras/IdcCamera/Idc100.cs +++ b/TestBenchFramework/BenchControl/Cameras/IdcCamera/Idc100.cs @@ -1035,16 +1035,25 @@ namespace TBF.BenchControl.Cameras.IdcCamera { // do nothing } - else if (angle == (int)MARK.FALLING) - { - wm_nrBegin = measurements.Count; - wm_timestampBegin = time; - //m_pWnd->PostMessage(WM_USER, EVENT_DATA_READY+m_cameraNr, ID_BEGIN); <------- TODO + else if (angle == (int)MARK.FALLING) + { + if (wm_nrBegin == 0) + { + wm_nrBegin = measurements.Count; + wm_timestampBegin = time; + //m_pWnd->PostMessage(WM_USER, EVENT_DATA_READY+m_cameraNr, ID_BEGIN); <------- TODO + } + else + { + wm_nrEnd = measurements.Count; + wm_timestampEnd = time; + //m_pWnd->PostMessage(WM_USER, EVENT_DATA_READY+m_cameraNr, ID_END); <------- TODO + } } else if (angle == (int)MARK.RISING) { wm_nrEnd = measurements.Count; - wm_timestampEnd = time; + wm_timestampEnd = time; //m_pWnd->PostMessage(WM_USER, EVENT_DATA_READY+m_cameraNr, ID_END); <------- TODO } else diff --git a/TestBenchFramework/BenchControl/Events.cs b/TestBenchFramework/BenchControl/Events.cs index 5a118664f..98a66d28d 100644 --- a/TestBenchFramework/BenchControl/Events.cs +++ b/TestBenchFramework/BenchControl/Events.cs @@ -97,6 +97,7 @@ CameraBusy, CameraOpCompleted, CameraOpFailed, + DetectionFailed, /// Generic Error, /// Many ops.: Fatal error occurred diff --git a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs index c99cb2138..f7d924473 100644 --- a/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs +++ b/TestBenchFramework/BenchControl/Sequences/SequenceBase.cs @@ -599,27 +599,20 @@ namespace TBF.BenchControl.Sequences /// /// Current 'Test' entity /// Current 'TestResult' entity - /// Current number of reference pulses - /// Curent reference frequency in [Hz] + /// Control board component reference /// Current test time in [s] /// Current progress 0 .. 1.0f /// Data for the UI - protected TestProgressEventArgs GetTestProgressData(Entities.Test test, Entities.TestResult tstRslt, Elde.ControlBoardDev cBrd, float time, float progress) + protected TestProgressEventArgs GetTestProgressData(Entities.Test test, Entities.TestResult tstRslt, bool testRunning, Elde.ControlBoardDev cBrd, float time, float progress) { TestProgressEventArgs data = new TestProgressEventArgs(); data.TestResult = tstRslt; - //float ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse] - float refPulsesPerLtr = 1.0f / outPath.FlowMeter.LtrPerPulseCorrected(refFlow.Val); /// [pulse/ltr] - - data.RefPulses = cBrd.EtPulses(0); - refFreq.Val = cBrd.ReferenceFreq; data.FlowMtrFreq = refFreq; data.Flow = refFlow; - data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = Formulas.VolumeFromPulses(data.RefPulses, refPulsesPerLtr) }; data.Time = time; data.StartMass = startMass; data.Mass = mass; @@ -637,17 +630,29 @@ namespace TBF.BenchControl.Sequences data.AmbientTemp = airTemperature; data.AmbientPressure = airPressure; data.AmbientHumidity = airHumidity; - - for (int i = 0; i < Program.WMsCount; i++) - { - if (sensPath.RegisterReaders[i] != null) + + if (testRunning) + { + /// Only when test is running + data.RefPulses = cBrd.EtPulses(0); + float refPulsesPerLtr = 1.0f / outPath.FlowMeter.LtrPerPulseCorrected(refFlow.Val); /// [pulse/ltr] + data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = Formulas.VolumeFromPulses(data.RefPulses, refPulsesPerLtr) }; + + for (int i = 0; i < Program.WMsCount; i++) { - data.WmPulses[i] = WMPulses[i]; - data.WmRefPulses[i] = WMRefPulses[i]; - data.WmVolume[i] = Formulas.VolumeFromPulses(WMPulses[i], sensPath.RegisterReaders[i].PulsesPerLtr); - if (data.Volume.Valid) { data.WmErrPct[i] = Formulas.ErrorFromVolumes(data.WmVolume[i], data.Volume.Val); } - } - } + if (sensPath.RegisterReaders[i] != null) + { + data.WmPulses[i] = WMPulses[i]; + data.WmRefPulses[i] = WMRefPulses[i]; + data.WmVolume[i] = Formulas.VolumeFromPulses(WMPulses[i], sensPath.RegisterReaders[i].PulsesPerLtr); + data.WmErrPct[i] = Formulas.ErrorFromVolumes(data.WmVolume[i], data.Volume.Val); + } + } + } + else + { + data.Volume = new FloatBox() { Name = "Volume", Format = "F1", Val = 0 }; + } return data; } diff --git a/TestBenchFramework/BenchControl/State.cs b/TestBenchFramework/BenchControl/State.cs index 988276c8b..c286198a5 100644 --- a/TestBenchFramework/BenchControl/State.cs +++ b/TestBenchFramework/BenchControl/State.cs @@ -238,7 +238,7 @@ namespace TBF.BenchControl } } - log.WarnFormat("ChangeState( {0} -> {1} )", previousState.ToString(), newState.ToString()); + log.WarnFormat("---------------( {0} )---------------", newState.ToString()); /// Start() the operations that are in the current (new) state, but aren't in the previous state. foreach (IOperation operation in newState.Operations) diff --git a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs index 3ba1d79fb..4f5da542a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CameraRoiDetection/RoiDetectionSeq.cs @@ -93,7 +93,11 @@ namespace TBF.BenchControl.TestMethods.CameraRoiDetection 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 (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } while (e.Contains(Event.CameraBusy)); diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs index e20ec1dd1..ad73d26df 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedMeters/CombinedMetersSeq.cs @@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); ltrPerRefPulse = outPath.FlowMeter.NominalFlow / 7200.0f; /// [ltr/pulse] /// @@ -116,7 +116,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } @@ -133,7 +133,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } @@ -244,7 +244,7 @@ namespace TBF.BenchControl.TestMethods.CombinedMeters log.Info(logstr); float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress); + TestProgressEventArgs data = GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress); data.WmVolume[2] = data.WmVolume[0] + data.WmVolume[1]; if (data.Volume.Valid) { data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume.Val); } Bridge.OnTestProgress(this, data); diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 609b27602..d5de19e94 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -45,7 +45,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -128,7 +128,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) goto stop; } @@ -146,7 +146,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) goto stop; if (e.Contains(Event.RegulValveTimeOut)) goto error; @@ -198,7 +198,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) goto stop; } @@ -331,7 +331,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) goto stop; if (e.Contains(Event.RegulValveTimeOut)) goto error; @@ -353,7 +353,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) goto stop; //if (e.Contains(Event.FlowTimeOut)) goto do_detection; @@ -449,7 +449,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - TestProgressEventArgs data = GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress); + TestProgressEventArgs data = GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress); data.WmVolume[2] = data.WmVolume[0] + data.WmVolume[1]; if (data.Volume.Valid) { data.WmErrPct[2] = Formulas.ErrorFromVolumes(data.WmVolume[2], data.Volume.Val); } Bridge.OnTestProgress(this, data); diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index c60d4004d..c5703ee37 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -114,7 +114,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } @@ -131,7 +131,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } @@ -315,7 +315,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress)); } while (cBrd.EtPulses(0) < totalPulses); /// Measurement loop - end diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 4c0f14135..ae818b4ba 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -111,7 +111,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } @@ -128,7 +128,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } @@ -222,7 +222,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress)); } /// Measurement loop - end @@ -251,14 +251,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume / 1000.0f); /// Convert the flow to [m3/h] tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] /// Corrected master pulses per liter - if (tstRslt.VolumeCTV <= float.Epsilon) - { - tstRslt.ErrorMaster = 0.1f; - } - else - { - tstRslt.ErrorMaster = 100 * (tstRslt.VolumeMaster - tstRslt.VolumeCTV) / tstRslt.VolumeCTV; - } + tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement tstRslt.TimeDivStart0 = 0; tstRslt.TimeDivStart1 = 0; tstRslt.TimeDivStart2 = 0; diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index e375d04fd..8806d3a0f 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -111,7 +111,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } @@ -128,7 +128,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } @@ -253,7 +253,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress)); } /// Measurement loop - end @@ -314,7 +314,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod /// Corrected master pulses per liter if (tstRslt.VolumeCTV <= float.Epsilon) { - tstRslt.ErrorMaster = 0.1f; + tstRslt.ErrorMaster = 0.0f; } else { diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs index 7bd583a3b..7ef1a3f67 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs @@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration /// 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); + int totalPulses = (int)(test.Volume / ltrPerRefPulse + 0.5f); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this); @@ -111,7 +111,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } } @@ -128,7 +128,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration int flowSetTime = StateMachine.Time - flowSetTime0; float progress = Formulas.TestProgress(flowSetTime, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, flowSetTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, false, cBrd, flowSetTime, progress)); if (e.Contains(Event.OpArgumentError)) { retVal = Event.OpArgumentError; goto stopTest; } if (e.Contains(Event.UiCmdStop)) { retVal = Event.UiCmdStop; goto stopTest; } @@ -239,7 +239,7 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration float progress = Formulas.TestProgress(cBrd.EtPulses(0), totalPulses, estFlowSetTime, test.TstTime); - Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, cBrd, cBrd.TTime, progress)); + Bridge.OnTestProgress(this, GetTestProgressData(test, tstRslt, true, cBrd, cBrd.TTime, progress)); } /// Measurement loop - end diff --git a/TestBenchFramework/Program.cs b/TestBenchFramework/Program.cs index 10a87e172..28ac93143 100644 --- a/TestBenchFramework/Program.cs +++ b/TestBenchFramework/Program.cs @@ -63,7 +63,9 @@ namespace TBF [STAThread] static void Main() { - /// Local program configuration directory including the trailing backslash + log.Fatal("--------------------------------------------------------------------------------"); + + /// Local program configuration directory including the trailing backslash string locAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "TestBenchFramework" + Path.DirectorySeparatorChar; diff --git a/TestBenchFramework/Screens/ProcessTabPageCtrl.cs b/TestBenchFramework/Screens/ProcessTabPageCtrl.cs index ab0e25d57..629e2aa7a 100644 --- a/TestBenchFramework/Screens/ProcessTabPageCtrl.cs +++ b/TestBenchFramework/Screens/ProcessTabPageCtrl.cs @@ -2,6 +2,7 @@ using System.Windows.Forms; using log4net; using TBF.UiBridge; +using TBF.Resources; namespace TBF.Screens { @@ -314,6 +315,7 @@ namespace TBF.Screens refPulses1Label.Text = tRes.Meters[0].PulsesMaster.ToString("F0"); volume1Label.Text = tRes.Meters[0].VolumeMeter.ToString("F2"); error1Label.Text = tRes.Meters[0].VolumeErrorPct.ToString("F2"); + passed1Label.Text = tRes.Meters[0].Passed ? Strings.Passed : Strings.Failed; if (Program.WMsCount >= 2) { @@ -321,6 +323,7 @@ namespace TBF.Screens refPulses2Label.Text = tRes.Meters[1].PulsesMaster.ToString("F0"); volume2Label.Text = tRes.Meters[1].VolumeMeter.ToString("F2"); error2Label.Text = tRes.Meters[1].VolumeErrorPct.ToString("F2"); + passed2Label.Text = tRes.Meters[1].Passed ? Strings.Passed : Strings.Failed; } if (Program.WMsCount >= 3) @@ -329,6 +332,7 @@ namespace TBF.Screens refPulses3Label.Text = tRes.Meters[2].PulsesMaster.ToString("F0"); volume3Label.Text = tRes.Meters[2].VolumeMeter.ToString("F2"); error3Label.Text = tRes.Meters[2].VolumeErrorPct.ToString("F2"); + passed3Label.Text = tRes.Meters[2].Passed ? Strings.Passed : Strings.Failed; } if (Program.WMsCount >= 4) @@ -337,6 +341,7 @@ namespace TBF.Screens refPulses4Label.Text = tRes.Meters[3].PulsesMaster.ToString("F0"); volume4Label.Text = tRes.Meters[3].VolumeMeter.ToString("F2"); error4Label.Text = tRes.Meters[3].VolumeErrorPct.ToString("F2"); + passed4Label.Text = tRes.Meters[3].Passed ? Strings.Passed : Strings.Failed; } if (Program.WMsCount >= 5) @@ -345,6 +350,7 @@ namespace TBF.Screens refPulses5Label.Text = tRes.Meters[4].PulsesMaster.ToString("F0"); volume5Label.Text = tRes.Meters[4].VolumeMeter.ToString("F2"); error5Label.Text = tRes.Meters[4].VolumeErrorPct.ToString("F2"); + passed5Label.Text = tRes.Meters[4].Passed ? Strings.Passed : Strings.Failed; } if (Program.WMsCount >= 6) @@ -353,6 +359,7 @@ namespace TBF.Screens refPulses6Label.Text = tRes.Meters[5].PulsesMaster.ToString("F0"); volume6Label.Text = tRes.Meters[5].VolumeMeter.ToString("F2"); error6Label.Text = tRes.Meters[5].VolumeErrorPct.ToString("F2"); + passed6Label.Text = tRes.Meters[5].Passed ? Strings.Passed : Strings.Failed; } tInLabel.Text = tRes.TempInAvrg.ToString("F2"); @@ -372,7 +379,7 @@ namespace TBF.Screens //massLabel.Text = tstRslt. volumeCtvLabel.Text = args.TestResult.VolumeCTV.ToString("F1"); - refErrorLabel.Text = "---"; // TODO + refErrorLabel.Text = (tRes.ErrorMaster == 0) ? "---" : tRes.ErrorMaster.ToString("F2"); } else if (tRes.MetersKind == Entities.MetersKind.Combined) { @@ -390,6 +397,10 @@ namespace TBF.Screens error1Label.Text = tRes.Meters[0].VolumeErrorPct.ToString("F2"); error2Label.Text = tRes.Meters[1].VolumeErrorPct.ToString("F2"); error3Label.Text = tRes.CombinedMeters[0].VolumeErrorPct.ToString("F2"); + passed1Label.Text = tRes.Meters[0].Passed ? Strings.Passed : Strings.Failed; + passed2Label.Text = tRes.Meters[1].Passed ? Strings.Passed : Strings.Failed; + passed3Label.Text = tRes.CombinedMeters[0].Passed ? Strings.Passed : Strings.Failed; + tInLabel.Text = tRes.TempInAvrg.ToString("F2"); tOutLabel.Text = tRes.TempOutAvrg.ToString("F2"); tDivLabel.Text = tRes.TempDivAvrg.ToString("F2"); @@ -407,8 +418,8 @@ namespace TBF.Screens //massLabel.Text = tstRslt. volumeCtvLabel.Text = args.TestResult.VolumeCTV.ToString("F1"); - refErrorLabel.Text = "---"; // TODO - } + refErrorLabel.Text = (tRes.ErrorMaster == 0) ? "---" : tRes.ErrorMaster.ToString("F2"); + } } void OnProcedureCompleted(object sender, ProcedureCompletedEventArgs args)