From bd9785c1955652fd6156cc0cf6e9228f1857a681 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Fri, 13 Jul 2018 13:00:03 +0200 Subject: [PATCH] TestRslt.ConstMasterCorr and Results.ItemID.Reference_error_corr introduced and calculated in all test methods. --- Results/Entities/TestRslt.cs | 10 ++-- Results/ItemID.cs | 1 + Results/Mappings/TestRsltMap.cs | 2 +- Results/WMeterRsltItemSpec.cs | 1 + .../TestMethods/Adjustment/AdjustmentSeq.cs | 11 ++-- .../CombinedWithDetectionSeq.cs | 52 +++++++++++++------ .../TestMethods/Endurance/EnduranceSeq.cs | 13 ++--- .../TestMethods/FixedStart/FixedStartSeq.cs | 9 ++-- .../FixedStartAdvancedSeq.cs | 31 +++++++++-- .../FixedStartDeferredEvaluationSeq.cs | 29 +++++++++-- .../FixedStartMassCollectionSeq.cs | 29 +++++++++-- .../TestMethods/FlyingStart/FlyingStartSeq.cs | 7 +-- .../FlyingStartFirstRepetWithMassCollSeq.cs | 32 ++++++++++-- .../FlyingStartMassCollProlongedSeq.cs | 27 +++++++++- .../FlyingStartMassCollectionSeq.cs | 25 ++++++++- 15 files changed, 224 insertions(+), 55 deletions(-) diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 416d1995f..7b7ce36e8 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -26,8 +26,10 @@ namespace Results.Entities public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds public virtual double TestTime { get; set; } /// [s] Measurement time in seconds public virtual double PulsesMaster { get; set; } - public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected - public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter + public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected. + public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table. + public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement. + /// When mass measurement is not available, corrected by a correction table. public virtual double MassStartRaw { get; set; } /// [kg] public virtual double MassStart { get; set; } /// [kg] public virtual double MassEndRaw { get; set; } /// [kg] @@ -40,7 +42,7 @@ namespace Results.Entities public virtual double FlowVolume { get; set; } /// [m3/h] public virtual double VolumeCTV { get; set; } /// [l] Volume conventional true value public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter - public virtual double ErrorMaster { get; set; } /// [%] + public virtual double ErrorMaster { get; set; } /// [%] Error of the master flow meter public virtual float DiverterStart { get; set; } /// [s] Diverter switch time when test starts public virtual float DivStart10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB) @@ -107,7 +109,7 @@ namespace Results.Entities public virtual float FlowMean { get; set; } /// [m3/h] mean flow from the reference flowmeter public virtual float FlowStart { get; set; } /// [m3/h] flow at the start of test from the reference flowmeter public virtual float FlowEnd { get; set; } /// [m3/h] flow at the end of test from the reference flowmeter - public virtual float FlowMin { get; set; } /// [m3/h] not mapped to DB + public virtual float FlowMin { get; set; } /// [m3/h] public virtual float FlowMax { get; set; } /// [m3/h] public virtual float Custom1 { get; set; } /// [°C] T ref hi mean diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 5186b1cc3..37f086d60 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -251,6 +251,7 @@ namespace Results Flow_ctv_start, /// 217 Flow_ctv_end, /// 218 ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected + Reference_error_corr, /// 220 Reference flow meter error after correction using correction curve Count, } diff --git a/Results/Mappings/TestRsltMap.cs b/Results/Mappings/TestRsltMap.cs index 47713db28..b3f5fd23f 100644 --- a/Results/Mappings/TestRsltMap.cs +++ b/Results/Mappings/TestRsltMap.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2015-2017 Sensus Metering Systems +/// Copyright (c) 2015-2018 Sensus Slovensko a.s. /// using FluentNHibernate.Mapping; using Results.Entities; diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 2481cd7f5..015dc48aa 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -307,6 +307,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_limit_Hi, Strings.ErrLimHi + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrLimHi()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Uncertainty, Strings.Uncertainty + "()", Quantity.Error, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).Uncertainty()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error, string.Format("{0} rel.ref. ()", Strings.VName_Error), Strings.Tooltip_E_rel_ref, Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).ErrorMaster))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_error_corr, string.Format("{0} ref.corr. ()", Strings.VName_Error), "Relative error of the reference flow meter after correction using correction curve", Quantity.Error, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", Config.Formulas.ErrorFromVolumes(w.GetTestRslt(t).ConstMasterCorr, w.GetTestRslt(t).ConstMaster)))); #if TURA_IPERL || TURA_SPECIAL AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error))); #else diff --git a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 7d4ef346c..4f470e6ac 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -380,11 +380,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// 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 + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter + 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 tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; diff --git a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 6f1370221..5cdf4e7eb 100644 --- a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Metering Systems +/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -73,7 +73,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection Bridge.OnActivity(this, string.Format("Simulating {0}", test.Name)); //------------------------------------------------ - State.Create(string.Format("CombinedWithDetection : Simulating {0}", test.Name)) + State.Create(string.Format("{0}({1}) : Simulating {1}", test.Method, test.Name)) .AddOperation(checkUiOp) .EnterState(); e = StateMachine.WaitRunDevsRunOps(); @@ -91,7 +91,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection int[] lastWMPulses = new int[2 * Config.Data.CompoundWMsCount]; //-------------------------------- - State.Create("CombinedWithDetection : stopTest diverter gate etc") + State.Create(string.Format("{0}({1}) : stopTest diverter gate etc", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(cBrd.StopPreviousOp()) .EnterState(); @@ -109,7 +109,28 @@ 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 + 0.5f); + int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + goto stopTest; + } + } processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); @@ -130,7 +151,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection if (!test.DoDraining) /// Do not skip emptying if test.Emptying==true { //-------------------------------- - State.Create("CombinedWithDetection : Mesuring mass of water in the tank") + State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(outPath.Scale.ReadMassOp(ref Mass)) .EnterState(); @@ -201,7 +222,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection //------------------------------------------------ Bridge.OnActivity(this, Strings.Switching_flow_detection); //------------------------------------------------ - State.Create("CombinedWithDetection : Start the pump") + State.Create(string.Format("{0}({1}) : Start the pump", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(measureOperations) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null) @@ -217,7 +238,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection while (!e.Contains(Event.ValvesSet)); //-------------------------------- - State.Create("CombinedWithDetection : Set the initial flow") + State.Create(string.Format("{0}({1}) : Set the initial flow", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(measureOperations) .AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600, (float)test.TolerRed)) /// timeout = 10 min. @@ -271,7 +292,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection do { //-------------------------------- - State.Create("CombinedWithDetection : Change the RV position") + State.Create(string.Format("{0}({1}) : Change the RV position", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(measureOperations) .AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse)) @@ -403,7 +424,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection if (goBackToInitFlow) { //-------------------------------- - State.Create("CombinedWithDetection : Switching flow detected, going back") + State.Create(string.Format("{0}({1}) : Switching flow detected, going back", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperations(measureOperations) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, 600)) /// timeout = 10 min. @@ -425,7 +446,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection } //-------------------------------- - State.Create("CombinedWithDetection : Going to the test flow") + State.Create(string.Format("{0}({1}) : Going to the test flow", test.Method, test.Name)) //State.Create("set_RV_position", .AddOperation(checkUiOp) .AddOperations(measureOperations) @@ -616,9 +637,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection double density = Config.Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter - tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -726,7 +748,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection if (isLastRepetition) { /// Stop the pump - State.Create("CombinedWithDetection : Test(s) completed -> Stopping the pump") + State.Create(string.Format("{0}({1}) : Test(s) completed -> Stopping the pump", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) @@ -747,7 +769,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection //==================================== stopTest: - State.Create("CombinedWithDetection : User selected STOP -> Closing the valves") + State.Create(string.Format("{0}({1}) : User selected STOP -> Closing the valves", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) diff --git a/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs b/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs index 096753303..5913e9704 100644 --- a/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs +++ b/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs @@ -361,14 +361,15 @@ namespace TBF.BenchControl.TestMethods.Endurance tstRslt.MassStart = 0; tstRslt.MassEndRaw = 0; tstRslt.MassEnd = 0; - tstRslt.FlowMass = 0; /// [kg/h] - tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] + tstRslt.FlowMass = 0; /// [kg/h] + tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// 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 + tstRslt.ErrorMaster = 0.0; /// Cannot be determined without a mass measurement tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; diff --git a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs index 587b28d63..618809bdc 100644 --- a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs @@ -754,8 +754,8 @@ namespace TBF.BenchControl.TestMethods.FixedStart double flowVolume = 3.6 * LtrPerRefPulse * Convert.ToDouble(endPulses - startPulses) / cBrd.TTime; - double constMaster = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx); - double volumeCTV = constMaster * Convert.ToDouble(endPulses - startPulses); + double constMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(flowVolume, rangeIx); + double volumeCTV = constMasterCorr * Convert.ToDouble(endPulses - startPulses); double refEnergy = Energy.Sum * volumeCTV / VolumeForEnergy.Sum; /// [J]=[J]*[l]/[l] @@ -907,8 +907,9 @@ namespace TBF.BenchControl.TestMethods.FixedStart tstRslt.FlowVolume = flowVolume; /// [m3/h] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.Buoyancy = Config.Formulas.Buoyancy(); - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = constMaster; /// Corrected master pulses per liter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = constMasterCorr; /// Corrected master pulses per liter + tstRslt.ConstMaster = constMasterCorr; /// Corrected master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ErrorMaster = 0; diff --git a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index d9b95db06..db2b18c49 100644 --- a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -45,6 +45,28 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTest; + } + } + processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); //==================================== @@ -514,10 +536,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; tstRslt.Buoyancy = buoyancy; - tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + tstRslt.VolumeCTV = volumeCTV; /// [kg] calculated before displaying 'End state' dialog + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs index 94cef07a1..efa97df42 100644 --- a/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs @@ -68,6 +68,28 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTestWOTransitionAfter; + } + } + processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); @@ -945,9 +967,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.Buoyancy = buoyancy; - tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 6b3f98013..249927c92 100644 --- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -47,6 +47,28 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTestWOTransitionAfter; + } + } + processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); @@ -973,9 +995,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.Buoyancy = buoyancy; - tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + tstRslt.VolumeCTV = volumeCTV; /// [l] 1000.0f is because density is in [kg/m3] + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; diff --git a/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 903a8a885..d27ec4f80 100644 --- a/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -530,9 +530,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = tstRslt.ConstMasterCorr; 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/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs index de186e731..f8a692f2d 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs @@ -113,6 +113,28 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl goto stopTestWOStoppingDivGateEtc; } + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTestWOStoppingDivGateEtc; + } + } + //==================================== loop: @@ -793,9 +815,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl double density = Config.Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter - tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.DiverterStart = switchTimeStart.Val; tstRslt.DivStart10 = 0; @@ -821,7 +844,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl tstRslt.MassEndRaw = 0; tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter tstRslt.ConstMaster = tstResRepet1.ConstMaster; /// Master constant ( pulses per liter) from the first repetition (=against the scale) tstRslt.VolumeMaster = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.VolumeCTV = tstRslt.VolumeMaster; /// [l] 1000.0f is because density is in [kg/m3] diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs index 644a8a5a7..1d91b44dd 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs @@ -125,6 +125,28 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged int targetTotalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); int targetMassPulses = (int)(volumeToTank / LtrPerRefPulse + 0.5f); + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTestWOStoppingDivGateEtc; + } + } + //==================================== loop: /// Start the test, initialize test results @@ -792,8 +814,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged tstRslt.Buoyancy = Formulas.Buoyancy(); double density = Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); double collectedVoluemCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3] - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = collectedVoluemCTV / massPulses; /// Corrected master pulses per liter + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = collectedVoluemCTV / massPulses; /// Calculated master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * totalPulses; tstRslt.VolumeMaster = LtrPerRefPulse * totalPulses; /// [l] volume from the master flow meter tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index bd7864fff..2714b69b9 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -168,6 +168,28 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); + int rangeIx = 0; /// Default range, used for non-Elde flowmeters + if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) + { + Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; + rangeIx = -1; /// Indicates invalid range + for (int r = 0; r <= 5; r++) + { + if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo + && eldeFM.GetTempHi(r) >= test.TempLimHi) + { + rangeIx = r; + } + } + + if (rangeIx == -1) + { + Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); + retVal = Event.UiCmdStop; + goto stopTestWOStoppingDivGateEtc; + } + } + if (test.Volume > outPath.Scale.Capacity * Constants.TankFullFactor) { Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity); @@ -841,7 +863,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection tstRslt.VolumeCTV = 1000.0 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / density; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient - tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter + tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter + tstRslt.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Calculated master pulses per liter tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average;