From 59087474d916184fec3295698a64b49a1b953189 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 15 May 2019 10:31:52 +0200 Subject: [PATCH] Results.Entities.TestRslt.TestTimeCorrection added and used in test methods with diverter. --- Results/Entities/TestRslt.cs | 23 ++++++++++--------- Results/ItemID.cs | 1 + Results/WMeterRsltItemSpec.cs | 1 + .../CombinedWithDetectionSeq.cs | 6 +++++ .../FlyingStartFirstRepetWithMassCollSeq.cs | 6 +++++ .../FlyingStartMassCollComparativeSeq.cs | 8 ++++++- .../FlyingStartMassCollProlongedSeq.cs | 8 ++++++- .../FlyingStartMassCollectionSeq.cs | 6 +++++ .../FlyingStartTankCollectionSeq.cs | 8 ++++++- 9 files changed, 53 insertions(+), 14 deletions(-) diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 6cfe9e1ae..35bc26268 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -21,17 +21,18 @@ namespace Results.Entities /// Main results public virtual bool TestDone { get; set; } public virtual string Remark { get; set; } - public virtual DateTime StartTime { get; set; } /// Date and time of the test start - public virtual DateTime EndTime { get; set; } /// Date and time of the test end - public virtual int FlowSetTime { get; set; } /// [s] Flow set time in seconds - public virtual int TimeBtwnMassMsrmnts { get; set; }/// [s] Time between two mass measurements in seconds (if applicable) - public virtual double TestTime { get; set; } /// [s] Measurement time in seconds - public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank - public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB) - 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 DateTime StartTime { get; set; } /// Date and time of the test start + public virtual DateTime EndTime { get; set; } /// Date and time of the test end + public virtual int FlowSetTime { get; set; } /// [s] Flow set time in seconds + public virtual int TimeBtwnMassMsrmnts { get; set; } /// [s] Time between two mass measurements in seconds (if applicable) + public virtual double TestTime { get; set; } /// [s] Test time in seconds + public virtual double TestTimeCorrection { get; set; } /// [s] Correction of the test time due to diverter (0 for methods w/o diverter or when there is no correction table) + public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank + public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB) + 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] diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 1344a2def..149c1f463 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -316,6 +316,7 @@ namespace Results ConstMasterCorr, /// 269 TimeBtwnMassMsrmnts, /// 270 + TestTimeCorrection, /// 271 Count, } diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index a340da2b6..08e853e9e 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -197,6 +197,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Timestamp_end, "Timestamp end ()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).TimestampEnd))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time_ni, Strings.T_s + "_ni()", Quantity.Time, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "V3", w.GetMeterTestRslt(t).TestTime))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "F1", w.GetTestRslt(t).TestTime))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.TestTimeCorrection, "Test time correction ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).TestTimeCorrection))); AllItems.Add(new WMeterRsltItemSpec(ItemID.TimeBtwnMassMsrmnts, "Time between mass measurements ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsRelErrTest()) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).TimeBtwnMassMsrmnts))); AllItems.Add(new WMeterRsltItemSpec(ItemID.PMax_test_time, "Pressure test time ()", "Pressure test time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsPMaxTest()) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).TestTime))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_start_time, "Diverter start time ()", "Diverter start time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null || !w.GetTestRslt(t).IsDiverter()) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterStart))); diff --git a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index 909756d30..2bf94e1a0 100644 --- a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -667,6 +667,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } 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 diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs index 0b7dc67fa..4a3adb1aa 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs @@ -734,6 +734,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, scale.Corrections); tstRslt.FlowMass = 3600 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } 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 diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/FlyingStartMassCollComparativeSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/FlyingStartMassCollComparativeSeq.cs index 186b0cd68..3d575a5a4 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/FlyingStartMassCollComparativeSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollComparative/FlyingStartMassCollComparativeSeq.cs @@ -825,7 +825,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } + 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.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster); diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs index 6d77d326a..abc699441 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs @@ -744,7 +744,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * totalPulses / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Formulas.Buoyancy(); tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume of collected water - tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } + tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter tstRslt.ConstMaster = (massPulses == 0) ? tstRslt.ConstMasterCorr : (tstRslt.VolumeCTV / massPulses); tstRslt.VolumeMaster = LtrPerRefPulse * massPulses; /// [l] volume from the master flow meter diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 215459c7d..11c57b7aa 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -732,6 +732,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeCTV = 1000 * tstRslt.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } 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 diff --git a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/FlyingStartTankCollectionSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/FlyingStartTankCollectionSeq.cs index 45a8ae9f8..2931628c9 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartTankCollection/FlyingStartTankCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartTankCollection/FlyingStartTankCollectionSeq.cs @@ -494,7 +494,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] tstRslt.Buoyancy = 0; tstRslt.VolumeCTV = volumeBox.Val; /// [l] - tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter + if ((outPath.Diverter != null) && (tstRslt.TestTime > float.Epsilon)) + { + tstRslt.TestTimeCorrection = outPath.Diverter.TestTimeCorrection(tstRslt.FlowVolume); + tstRslt.VolumeCTV *= tstRslt.TestTime + tstRslt.TestTimeCorrection; + tstRslt.VolumeCTV /= tstRslt.TestTime; + } + 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.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);