diff --git a/Config/Config.csproj b/Config/Config.csproj index 96a973b16..b1193fc17 100644 --- a/Config/Config.csproj +++ b/Config/Config.csproj @@ -91,6 +91,7 @@ + diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index 79fc63a7a..0a3448b89 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -156,6 +156,17 @@ namespace Config.Entities Count } + /// Register reader type + public enum RegisterReaderType + { + Unknown, + Pulses, /// Sick, optical and similar + Camera, /// CLP1611 + DataStream, /// iPerl + Manual, /// Entered by human via form (also from camera images) + Count + } + /// Transition step is finished when this condition is fulfilled public enum StepCondition { diff --git a/TBF/BenchControl/Formulas.cs b/Config/Formulas.cs similarity index 96% rename from TBF/BenchControl/Formulas.cs rename to Config/Formulas.cs index 64dca5875..5730085a5 100644 --- a/TBF/BenchControl/Formulas.cs +++ b/Config/Formulas.cs @@ -1,11 +1,11 @@ /// -/// Copyright (c) 2013-2015 Sensus Metering Systems +/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using log4net; -namespace TBF.BenchControl +namespace Config { public static class Formulas { @@ -153,10 +153,9 @@ namespace TBF.BenchControl /// /// Temperature in [°C] /// Density in [kg/m3] - public static double WaterDensityFromTemp(double t) + public static double WaterDensityFromTemp(double t, double realDensity, double atTemperature) { - return DistilledWaterDensityFromTemp(t) + - DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); + return DistilledWaterDensityFromTemp(t) + DensityCorrection(realDensity, atTemperature); } /// @@ -164,7 +163,7 @@ namespace TBF.BenchControl /// /// Temperature in [°C] /// Density in [kg/m3] - public static double WaterDensityFromTempPress(double temp, double pressure) + public static double WaterDensityFromTempPress(double temp, double pressure, double realDensity, double atTemperature) { double x0 = 5.08821E-10; double x1 = 1.2639418; @@ -174,7 +173,7 @@ namespace TBF.BenchControl double theta = temp / 100.0; double B = x0 * (((x3 * theta + x2) * theta + x1) * theta + 1) / (1 + x4 * theta); - return WaterDensityFromTemp(temp) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure)); + return WaterDensityFromTemp(temp, realDensity, atTemperature) * (1 + B * Config.Units.ConvertTo(Config.Unit.Pa, pressure)); } diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index 50faf4cbb..0e09aa7d8 100644 --- a/Config/Properties/AssemblyInfo.cs +++ b/Config/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.867.0")] -[assembly: AssemblyFileVersion("2.18.867.0")] +[assembly: AssemblyVersion("2.18.870.0")] +[assembly: AssemblyFileVersion("2.18.870.0")] diff --git a/Config/Units.cs b/Config/Units.cs index 298bf0c1e..39e27cd7c 100644 --- a/Config/Units.cs +++ b/Config/Units.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2016-2017 Sensus Slovensko a.s. +/// Copyright (c) 2016-2018 Sensus Slovensko a.s. /// using System; using System.Reflection; @@ -11,6 +11,12 @@ namespace Config { [Description("---")] None, + [Description("imp.")] pulse, +#if LANG_PL + [Description("stopień")] degree, +#else + [Description("degree")] degree, +#endif [Description("l")] l, /// * 1 liter [Description("dm3")] dm3, /// 1 dm3 = 1 liter [Description("m3")] m3, /// 1000 l @@ -62,8 +68,17 @@ namespace Config [Description("kWh")] kWh, /// 1 kWh = 3600000 J [Description("MWh")] MWh, /// 1 MWh = 3600000000 J +#if LANG_PL + [Description("imp/l")] ppl, /// * 1 pulse/l + [Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3 + [Description("stopień/l")] degpl, /// * 1 degree/l + [Description("stopień/dm3")] degpdm3, /// * 1 degree/dm3 +#else [Description("pulse/l")] ppl, /// * 1 pulse/l - [Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3 + [Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3 + [Description("degree/l")] degpl, /// * 1 degree/l + [Description("degree/dm3")] degpdm3, /// * 1 degree/dm3 +#endif /// [Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh @@ -85,6 +100,7 @@ namespace Config [Description("Länge")] Length, [Description("Dichte")] Density, [Description("Energie")] Energy, + [Description("Impulse")] Pulses, [Description("Impulse/l")] PulsePerLtr, [Description("Impulse/kWh")] PulsePerKWh, @@ -94,7 +110,7 @@ namespace Config [Description("Boolean")] Boolean, [Description("Datum und Uhrzeit")] DateTime, #elif LANG_PL - [Description("Objętość")] Volume, + [Description("Objętość")] Volume, [Description("Przepływ")] Flow, [Description("Masa")] Mass, [Description("Czas")] Time, @@ -105,6 +121,7 @@ namespace Config [Description("Długość")] Length, [Description("Gęstość")] Density, [Description("Energia")] Energy, + [Description("Impulsy")] Pulses, [Description("Impulsy/litr")] PulsePerLtr, [Description("Impulsy/kWh")] PulsePerKWh, @@ -125,6 +142,7 @@ namespace Config [Description("Délka")] Length, [Description("Hustota")] Density, [Description("Energie")] Energy, + [Description("Pulzy")] Pulses, [Description("Pulzy/litr")] PulsePerLtr, [Description("Pulzy/kWh")] PulsePerKWh, @@ -145,6 +163,7 @@ namespace Config [Description("Length")] Length, [Description("Density")] Density, [Description("Energy")] Energy, + [Description("Pulses")] Pulses, [Description("Pulses/liter")] PulsePerLtr, [Description("Pulses/kWh")] PulsePerKWh, @@ -154,7 +173,7 @@ namespace Config [Description("Boolean")] Boolean, [Description("Date and time")] DateTime, #endif - Count, + Count, } public static class Units @@ -179,6 +198,10 @@ namespace Config { switch (units) { + case Unit.pulse: + case Unit.degree: + return Config.Quantity.Pulses; + case Unit.l: case Unit.dm3: case Unit.m3: @@ -243,6 +266,8 @@ namespace Config case Unit.ppl: case Unit.ppdm3: + case Unit.degpl: + case Unit.degpdm3: return Config.Quantity.PulsePerLtr; case Unit.ppkWh: @@ -264,6 +289,7 @@ namespace Config public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); } public static bool IsDensity(Unit units) { return IsQuantity(units, Config.Quantity.Density); } public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); } + public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); } public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); } public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); } @@ -331,7 +357,7 @@ namespace Config case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J - default: return v; + default: return v; } } @@ -398,7 +424,7 @@ namespace Config case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J - default: return v; + default: return v; } } } diff --git a/Results/Entities/MeterTestRslt.cs b/Results/Entities/MeterTestRslt.cs index 71cbfc096..a4d702e7b 100644 --- a/Results/Entities/MeterTestRslt.cs +++ b/Results/Entities/MeterTestRslt.cs @@ -10,7 +10,7 @@ namespace Results.Entities public virtual int Id { get; protected set; } public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy - public virtual string RegReaderClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer + public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses) @@ -75,6 +75,11 @@ namespace Results.Entities (CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy); } + public virtual bool IsPulses() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Pulses || RegReaderType == (int)Config.Entities.RegisterReaderType.Unknown); } + public virtual bool IsCamera() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Camera); } + public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); } + public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); } + public virtual string PassedColorStr() { return Utils.PassedColorStr(Passed, Evaluate()); @@ -99,7 +104,7 @@ namespace Results.Entities if (src == null) return; CompoundMeterId = src.CompoundMeterId; - RegReaderClass = src.RegReaderClass; + RegReaderType = src.RegReaderType; PulsesMeter = src.PulsesMeter; PulsesMaster = src.PulsesMaster; PulsesPerLiter = src.PulsesPerLiter; diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 7d8bbf044..00d053af4 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -128,6 +128,9 @@ namespace Results.Entities public virtual double TargetVolume() { return TestData.TargetVolume; } public virtual double TargetTime() { return TestData.TargetTime; } public virtual string Method() { return TestData.Method; } + public virtual bool IsPMaxTest() { return (MethodClass != null) && (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")); } + public virtual bool IsStartStop() { return (MethodClass != null) && MethodClass.Contains("FixedStart"); } + public virtual bool IsDiverter() { return (MethodClass != null) && MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl"); } public virtual double ErrLimLo() { diff --git a/Results/ItemID.cs b/Results/ItemID.cs index b8e4a17ea..db8f3c8d9 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -56,7 +56,7 @@ namespace Results Flow_profile_sensitivity_class, /// 46 Approval_info, /// 47 Certificate, /// 48 - Pulses_per_liter, /// 49 + Pulses_per_liter, /// 49 Water meter constant (water meter data, not used in calculations) Text1, /// 50 Text2, /// 51 Text3, /// 52 @@ -68,7 +68,7 @@ namespace Results WM_Position, /// 58 End_state, /// 59 Pulses, /// 60 - Pulses__liter, /// 61 + Pulses__liter, /// 61 Water meter constant (pulses per liter) specific for one test Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method) Reference_energy, /// 63 Test_bench_ID, /// 64 @@ -224,9 +224,21 @@ namespace Results RhoDistilledWtrAtMeLineTemp, /// 193 ConstMaster, /// 194 Reference_pulses, /// 195 Reference pulses not gated - Test_time_ni, /// 196 Test time for a specific meter (gated in case of a synchro method OR a difference of 2 time stamps) - + spare, Separator, /// 197 + Test_time_ni, /// 198 Test time for a specific meter (gated in case of a synchro method OR a difference of 2 time stamps) + PMax_test_time, /// 199 Pressure test time + Start_valve_open_time, /// 200 + Start_valve_close_time, /// 201 + Qc, /// 202 Flow for a water meter + Degree__liter, /// 203 Water meter constant (degree per liter) specific for one test with camera + Camera_angle, /// 204 + Camera_angle_start, /// 205 + Camera_angle_end, /// 206 + + P_delta_mean_per_mtr, /// 207 + P_delta_mean_from_up_down, /// 208 + P_delta_mean_from_up_down_per_mtr, /// 209 Count, } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 60cc3b456..0a1f33ff0 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.869.0")] -[assembly: AssemblyFileVersion("2.18.869.0")] +[assembly: AssemblyVersion("2.18.870.0")] +[assembly: AssemblyFileVersion("2.18.870.0")] diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 14af6c58e..f29aada47 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.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; @@ -176,7 +176,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Density, Strings.Density + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).DensityLine))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Density_correction, Strings.Density_correction + " ()", Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", (w.Batch.DensityCorr)))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Rho_Wa_calc, string.Format("{0} of sample", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", RealDensity))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : DistilledWaterDensityFromTemp(w.GetTestRslt(t).AmbTempMean)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.RhoDistilledWtrAtMeLineTemp, string.Format("{0} of distilled water at T line", Strings.Density), Quantity.Density, ItemCategory.TestResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", (w.GetTestRslt(t) == null) ? 0 : Config.Formulas.DistilledWaterDensityFromTemp(w.GetTestRslt(t).AmbTempMean)))); /// /// Date and time @@ -187,10 +187,13 @@ namespace Results /// /// Time (duration) /// - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).TestTime))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time_ni, Strings.T_s + "_ni()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetMeterTestRslt(t).TestTime))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_start_time, "Diverter start time ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterStart))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_end_time, "Diverter end time ()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).DiverterEnd))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time, Strings.T_s + "()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).IsPMaxTest() ? 0 : w.GetTestRslt(t).TestTime))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_time_ni, Strings.T_s + "_ni()", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).IsPMaxTest() ? 0 : w.GetMeterTestRslt(t).TestTime))); + 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) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).IsPMaxTest() ? w.GetTestRslt(t).TestTime : 0))); + 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) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsDiverter() ? w.GetTestRslt(t).DiverterStart : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Diverter_end_time, "Diverter end time ()", "Diverter end time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsDiverter() ? w.GetTestRslt(t).DiverterEnd : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_open_time, "Start valve open time ()", "Start valve open time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsStartStop() ? w.GetTestRslt(t).DiverterStart : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_valve_close_time, "Start valve close time ()", "Start valve close time", Quantity.Time, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F3", w.GetTestRslt(t).IsStartStop() ? w.GetTestRslt(t).DiverterEnd : 0))); /// /// Flow @@ -198,6 +201,7 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_from, string.Format("{0} {1}", Strings.VName_Flow, Strings.from), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qfrom()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_to, string.Format("{0} {1}", Strings.VName_Flow, Strings.to), Quantity.Flow, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).Qto()))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Flow, string.Format("{0} v r", Strings.VName_Flow), Strings.Tooltip_Q_v_r, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowVolume))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Qc, string.Format("Qc"), "Calculated water meter flow", Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).VolumeCTV / w.GetMeterTestRslt(t).TestTime * 3.6 * w.GetMeterTestRslt(t).PulsesMaster / w.GetTestRslt(t).PulsesMaster))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_mean, string.Format("{0} rim ()", Strings.VName_Flow), Strings.Tooltip_Q_rim, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMean))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_min, string.Format("{0} ref min ()", Strings.VName_Flow), Strings.Tooltip_Q_min, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMin))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Q_ref_max, string.Format("{0} ref max ()", Strings.VName_Flow), Strings.Tooltip_Q_max, Quantity.Flow, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).FlowMax))); @@ -269,6 +273,9 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_avg, string.Format("{0} DE avg ()", Strings.VName_Press), Strings.Tooltip_P_de_avg, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", (w.GetTestRslt(t).PressDeltaStart + w.GetTestRslt(t).PressDeltaEnd) / 2))); AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_min, string.Format("{0} DE min ()", Strings.VName_Press), Strings.Tooltip_P_de_min, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMin))); AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_max, string.Format("{0} DE max ()", Strings.VName_Press), Strings.Tooltip_P_de_max, Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMax))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_per_mtr, string.Format("{0} DE ME per mtr.()", Strings.VName_Press), "P delta mean per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressDeltaMean / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down, string.Format("{0} UP-DW ME ()", Strings.VName_Press), "P delta mean from UP/DW", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.P_delta_mean_from_up_down_per_mtr, string.Format("{0} UP-DW ME per mtr ()", Strings.VName_Press), "P delta mean from UP/DW per one meter", Quantity.Pressure, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V3", w.GetTestRslt(t).PressUpMean - w.GetTestRslt(t).PressDownMean / Math.Max(1, w.GetTestRslt(t).Batch.WaterMeters.Count)))); /// /// Ambient temperature/pressure/humidity/Buoyancy @@ -319,8 +326,6 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Approval_info, Strings.Approval, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.ApprovalInfo))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Certificate, "Certificate", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Certificate))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Text1, "Text1", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text1))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Text2, "Text2", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text2))); AllItems.Add(new WMeterRsltItemSpec(ItemID.Text3, "Text3", Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Text3))); @@ -335,11 +340,17 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Formatted_WM_ID, "Formatted WM ID", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? string.Format("{0}-{1}", w.BatchNr(), w.WMPosition) : string.Format(f, w.StartTime(), w.EndTime(), w.BatchNr(), w.WMPosition, w.SerialNr))); /// Water meters results (single) - AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMeter))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses_ni,Strings.RefPulses + "_ni()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMaster))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Number, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).PulsesMaster))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).PulsesPerLiter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state, Strings.End_state, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses, Strings.Pulses + "()", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsPulses() ? w.GetMeterTestRslt(t).PulsesMeter : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses_ni, Strings.RefPulses + "_ni()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).PulsesMaster))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_pulses, Strings.RefPulses + "()", Quantity.Pulses, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetTestRslt(t).PulsesMaster))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle, "Angle ()", "Angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesMeter : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_start, "Start angle ()", "Start angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeStart * w.GetMeterTestRslt(t).PulsesPerLiter : 0))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Camera_angle_end, "End angle ()", "End angle measured by a camera", Quantity.Pulses, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "F0", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).VolumeEnd * w.GetMeterTestRslt(t).PulsesPerLiter : 0))); + + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses_per_liter, Strings.PulsesLiter, Quantity.PulsePerLtr, ItemCategory.MeterData, (w, t, u, f, p) => FormatDbl(u, f, p, "V4", w.WaterMeterData.PulsesPerLtr))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Pulses__liter, Strings.PulsesLiter + "()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? 0 : w.GetMeterTestRslt(t).PulsesPerLiter))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Degree__liter, "Degree per liter ()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesPerLiter : 0))); /// Water meters results (combined) AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error))); @@ -647,37 +658,5 @@ namespace Results else return ((ItemID)Uid).ToString(); } - - /// - /// Calculate density of distilled water from temperature - /// - /// ITS-90 temperature in [°C] - /// Density in [kg/m3] - public static double DistilledWaterDensityFromTemp(double t) - { - if (t <= 40) - { - const double c0 = 999.839564; - const double c1 = 0.067998613; - const double c2 = -0.0091101468; - const double c3 = 0.00010058299; - const double c4 = -0.0000011275659; - const double c5 = 6.5985371e-09; - - return ((((c5 * t + c4) * t + c3) * t + c2) * t + c1) * t + c0; - } - else - { - const double a0 = 9.9983952E2; - const double a1 = 1.6952577E1; - const double a2 = -7.9905127E-3; - const double a3 = -4.6241757E-5; - const double a4 = 1.0584601E-7; - const double a5 = -2.8103006E-10; - const double b = 1.6887236E-2; - - return (((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t + a0) / (1.0 + b * t); - } - } } } diff --git a/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs b/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs index c30f5917a..95419c1e9 100644 --- a/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs +++ b/TBF/BenchControl/Elde/FixedStartRegisterReader/RegisterReader.cs @@ -17,7 +17,8 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader readonly ControlBoardDev controlBoard; - public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } } + public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } } + public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } } public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } } diff --git a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs index 2ad34ac79..5a644db60 100644 --- a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs +++ b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs @@ -30,7 +30,7 @@ namespace TBF.BenchControl.Elde.FlowMeter { if (corr.RangeIx == rangeIx) rangeCorrections.Add(corr); } - double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, rangeCorrections); + double correctedFlow = Config.Formulas.CorrectedValue(flow, rangeCorrections); return (float)(LtrPerPulse * correctedFlow / flow); } diff --git a/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs index dfca8345e..dc2a9df27 100644 --- a/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs +++ b/TBF/BenchControl/Elde/FlowMeterTriplet/FlowMeter.cs @@ -25,7 +25,7 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow /// Apply correction - double correctedFlow = BenchControl.Formulas.CorrectedValue(flow, Corrections); + double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections); return (float)(LtrPerPulse * correctedFlow / flow); } diff --git a/TBF/BenchControl/Elde/RegisterReader/RegisterReader.cs b/TBF/BenchControl/Elde/RegisterReader/RegisterReader.cs index 6cc289cbb..482888453 100644 --- a/TBF/BenchControl/Elde/RegisterReader/RegisterReader.cs +++ b/TBF/BenchControl/Elde/RegisterReader/RegisterReader.cs @@ -17,7 +17,8 @@ namespace TBF.BenchControl.Elde.RegisterReader public int Position { get { return registerReaderCfg.Position; } } /// 1 .. inf /// - public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } } + public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Pulses; } } + public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } } public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } } public int WMPulses { get { return wmPulses; } } diff --git a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs index 1739a8a66..6a1616a30 100644 --- a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs +++ b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs @@ -51,7 +51,7 @@ namespace TBF.BenchControl.Elde.TempMeter { if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal) { - return BenchControl.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); + return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); } else if (Cfg.DebugLevel == Config.Entities.DebugMode.Simulate) { diff --git a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs index 14eb622dc..e16224e22 100644 --- a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs +++ b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs @@ -44,7 +44,7 @@ namespace TBF.BenchControl.Elde.TempMeterInternal public double ReadTemperature() { - return BenchControl.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); + return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); } /// diff --git a/TBF/BenchControl/GenericDevices/IRegisterReader.cs b/TBF/BenchControl/GenericDevices/IRegisterReader.cs index 66b45245f..c1c4c807d 100644 --- a/TBF/BenchControl/GenericDevices/IRegisterReader.cs +++ b/TBF/BenchControl/GenericDevices/IRegisterReader.cs @@ -8,6 +8,8 @@ namespace TBF.BenchControl.GenericDevices { public interface IRegisterReader : IComponent { + Config.Entities.RegisterReaderType RegisterReaderType { get; } + double PulsesPerLtr { get; } /// [l^-1] ... water meter or volume measurement part of a heat meter double LtrsPerPulse { get; } /// [l] diff --git a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs index ed5a76eeb..0fc76f67e 100644 --- a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs +++ b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs @@ -3,6 +3,7 @@ /// using System; using System.Collections.Generic; +using Config; using log4net; using TBF.Boxes; using TBF.BenchControl.Keithley.Multimeter_2010_RS232; diff --git a/TBF/BenchControl/Network/Camera/Roi/Roi.cs b/TBF/BenchControl/Network/Camera/Roi/Roi.cs index 6cdf68e35..c3466184d 100644 --- a/TBF/BenchControl/Network/Camera/Roi/Roi.cs +++ b/TBF/BenchControl/Network/Camera/Roi/Roi.cs @@ -33,7 +33,8 @@ namespace TBF.BenchControl.Network.Camera.Roi /// public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } } - public double PulsesPerLtr { get { return RoiCfg.ProcParams.PulsesPerLtr; } } + public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Camera; } } + public double PulsesPerLtr { get { return RoiCfg.ProcParams.PulsesPerLtr; } } public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } } int cameraPulses; diff --git a/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs b/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs index f0aab3d26..6038ae5fc 100644 --- a/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs +++ b/TBF/BenchControl/Network/Camera/RoiForFixedStart/Roi.cs @@ -30,7 +30,8 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart public readonly CLP1611.Camera NetCamera; public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } } - public double PulsesPerLtr { get { return roiCfg.ProcParams.PulsesPerLtr; } } + public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } } + public double PulsesPerLtr { get { return roiCfg.ProcParams.PulsesPerLtr; } } public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } } diff --git a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs index 706b334e5..0ac3734fd 100644 --- a/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs +++ b/TBF/BenchControl/Output/DB/SaveFlowmeterCorrections/SaveFlowmeterCorr.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using log4net; using NHibernate; using NHibernate.Criterion; +using Config; using Config.Entities; using MonitoringDB.Entities; @@ -107,7 +108,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections errorMaster /= count; } - double correction = BenchControl.Formulas.CorrectionFromError(flow, errorMaster); + double correction = Formulas.CorrectionFromError(flow, errorMaster); rslt.Add(new MeasurementCorrection { RangeIx = rngIx, Measurement = (float)flow, Correction = (float)correction }); } } diff --git a/TBF/BenchControl/Sequences/MainSeq.cs b/TBF/BenchControl/Sequences/MainSeq.cs index 5ab34a861..e67b4da7c 100644 --- a/TBF/BenchControl/Sequences/MainSeq.cs +++ b/TBF/BenchControl/Sequences/MainSeq.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using log4net; +using Config; using Config.Entities; using Results.Entities; using TBF.UiBridge; @@ -1411,7 +1412,8 @@ namespace TBF.BenchControl.Sequences StateMachine.Procedure, waterMeterData, waterMeterParts, - Formulas.DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature)); + Formulas.DensityCorrection(Program.LocalSettings.RealDensity, + Program.LocalSettings.AtTemperature)); } diff --git a/TBF/BenchControl/Sequences/SequenceBase.cs b/TBF/BenchControl/Sequences/SequenceBase.cs index 0ab3f58ac..7bb5472a1 100644 --- a/TBF/BenchControl/Sequences/SequenceBase.cs +++ b/TBF/BenchControl/Sequences/SequenceBase.cs @@ -819,10 +819,17 @@ namespace TBF.BenchControl.Sequences tstRslt.TempDivEnd = (float)TempDivStat.Last; tstRslt.TempDivMin = (float)TempDivStat.Min; tstRslt.TempDivMax = (float)TempDivStat.Max; - tstRslt.DensityIn = Formulas.WaterDensityFromTempPress(tstRslt.TempUpMean, tstRslt.PressUpMean); /// [kg/m3] - tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivMean); /// [kg/m3] + tstRslt.DensityIn = Formulas.WaterDensityFromTempPress(tstRslt.TempUpMean, + tstRslt.PressUpMean, + Program.LocalSettings.RealDensity, + Program.LocalSettings.AtTemperature); /// [kg/m3] + tstRslt.DensityDiv = Formulas.WaterDensityFromTemp(tstRslt.TempDivMean, + Program.LocalSettings.RealDensity, + Program.LocalSettings.AtTemperature); /// [kg/m3] tstRslt.DensityLine = Formulas.WaterDensityFromTempPress((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2, - (tstRslt.PressUpMean + tstRslt.PressDownMean) / 2); /// [kg/m3] + (tstRslt.PressUpMean + tstRslt.PressDownMean) / 2, + Program.LocalSettings.RealDensity, + Program.LocalSettings.AtTemperature); /// [kg/m3] } @@ -836,9 +843,9 @@ namespace TBF.BenchControl.Sequences protected string TestResult2CsvLine(Results.Entities.TestRslt tstRslt) { - bool isPressureTest = (tstRslt.MethodClass != null) && (tstRslt.MethodClass.Contains("PMaxTest") || tstRslt.MethodClass.Contains("LeakTest")); - bool isStartStop = (tstRslt.MethodClass != null) && tstRslt.MethodClass.Contains("FixedStart"); - bool isDiverter = (tstRslt.MethodClass != null) && tstRslt.MethodClass.Contains("FlyingStart") && tstRslt.MethodClass.Contains("MassColl"); + bool isPMaxTest = tstRslt.IsPMaxTest(); + bool isStartStop = tstRslt.IsStartStop(); + bool isDiverter = tstRslt.IsDiverter(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); @@ -933,7 +940,7 @@ namespace TBF.BenchControl.Sequences sb.Append(";"); sb.Append(tstRslt.TempDownMax); /// BV [°C] sb.Append(";"); sb.Append(tstRslt.TempUpMin); /// BW [°C] sb.Append(";"); sb.Append(tstRslt.TempDownMin); /// BX [°C] - sb.Append(";"); sb.Append(isPressureTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test + sb.Append(";"); sb.Append(isPMaxTest ? tstRslt.TestTime : 0); /// BY [s] Duration of the pressure test sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.C, tstRslt.AmbTempEnd)); /// BZ [°C] sb.Append(";"); sb.AppendFormat("{0:F0}", Units.ConvertTo(Unit.mbar, tstRslt.AmbPressEnd)); /// CA [mbar] sb.Append(";"); sb.AppendFormat("{0:F1}", Units.ConvertTo(Unit.RPct, tstRslt.AmbHumiEnd)); /// CB [R%] @@ -946,11 +953,13 @@ namespace TBF.BenchControl.Sequences { if (!ProcessData.BatchRslts.WaterMeters[i].Compound() && !ProcessData.BatchRslts.WaterMeters[i].HeatMeter()) { + /// If this is a single meter + Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single); if (mtrRslt != null) { - bool isCamera = (mtrRslt.RegReaderClass != null) && mtrRslt.RegReaderClass.Equals("Network.Camera.Roi"); + bool isCamera = (mtrRslt.RegReaderType == (int)RegisterReaderType.Camera); sb.Append(";"); sb.Append(ProcessData.BatchRslts.WaterMeters[i].SerialNr); /// CE WM Ser.No. sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame @@ -986,14 +995,14 @@ namespace TBF.BenchControl.Sequences } else if (ProcessData.BatchRslts.WaterMeters[i].Compound()) { - for (byte b = (byte)CompoundMeterId.CompoundMain; b <= (byte)CompoundMeterId.Compound; b++) + /// Else if this is a compound meter + + for (byte b = (byte)CompoundMeterId.CompoundMain; b <= (byte)CompoundMeterId.Compound; b++) { Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, (CompoundMeterId)b); if (mtrRslt != null) - { - bool isCamera = (mtrRslt.RegReaderClass != null) && mtrRslt.RegReaderClass.Equals("Network.Camera.Roi"); - + { sb.Append(";"); switch ((CompoundMeterId)b) { @@ -1019,6 +1028,7 @@ namespace TBF.BenchControl.Sequences sb.Append(";"); sb.Append(mtrRslt.Passed ? "OK" : "NOK"); /// CO WM Vysledok (t.j. ci je v hraniciach chyb) - OK/NOK sb.Append(";"); sb.Append(" "); /// CP WM AN value - hodnota z analogoveho prevodnika (teraz nic) + bool isCamera = mtrRslt.IsCamera(); sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter : 0); /// CQ WM Phi_start - pri hodnotach z kamery sb.Append(";"); sb.Append(isCamera ? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter : 0); /// CR WM Phi_end - ' ' - sb.Append(";"); sb.Append(isCamera ? mtrRslt.TimestampStart : 0); /// CS WM Time_start - ' ' - @@ -1034,6 +1044,8 @@ namespace TBF.BenchControl.Sequences } else /// if (ProcessData.BatchRslts.WaterMeters[i].HeatMeter()) { + /// Else this is a heat meter + Results.Entities.MeterTestRslt volumeMtr = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.HeatMeterVolume); Results.Entities.MeterTestRslt energyMtr = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.HeatMeterEnergy); @@ -1129,7 +1141,7 @@ namespace TBF.BenchControl.Sequences tstRslt.DensityIn = Program.LocalSettings.RealDensity; tstRslt.DensityLine = Program.LocalSettings.RealDensity; tstRslt.DensityDiv = Program.LocalSettings.RealDensity; - tstRslt.Buoyancy = TBF.BenchControl.Formulas.Buoyancy(); + tstRslt.Buoyancy = Formulas.Buoyancy(); tstRslt.FlowMass = 3600.0 * tstRslt.MassEnd / tstRslt.TargetTime(); tstRslt.FlowVolume = 3.6 * tstRslt.TargetVolume() / tstRslt.TargetTime(); tstRslt.VolumeCTV = tstRslt.TargetVolume(); @@ -1238,7 +1250,7 @@ namespace TBF.BenchControl.Sequences tstRslt.DensityIn = Program.LocalSettings.RealDensity; tstRslt.DensityLine = Program.LocalSettings.RealDensity; tstRslt.DensityDiv = Program.LocalSettings.RealDensity; - tstRslt.Buoyancy = TBF.BenchControl.Formulas.Buoyancy(); + tstRslt.Buoyancy = Formulas.Buoyancy(); tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime(); tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime(); tstRslt.VolumeCTV = tstRslt.TargetVolume(); @@ -1309,7 +1321,7 @@ namespace TBF.BenchControl.Sequences meterRslt.TimestampStart = 0; meterRslt.TimestampEnd = tstRslt.TargetTime(); meterRslt.TestTime = tstRslt.TargetTime(); - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); + meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty()) && (errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty()); meterRslt.TestDone = true; @@ -1321,7 +1333,7 @@ namespace TBF.BenchControl.Sequences compoundRslt.PulsesMaster = tstRslt.PulsesMaster; compoundRslt.TestTime = tstRslt.TargetTime(); - compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV); + compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV); compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.Uncertainty()) && (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.Uncertainty()); compoundRslt.TestDone = true; @@ -1366,7 +1378,7 @@ namespace TBF.BenchControl.Sequences tstRslt.DensityIn = Program.LocalSettings.RealDensity; tstRslt.DensityLine = Program.LocalSettings.RealDensity; tstRslt.DensityDiv = Program.LocalSettings.RealDensity; - tstRslt.Buoyancy = TBF.BenchControl.Formulas.Buoyancy(); + tstRslt.Buoyancy = Formulas.Buoyancy(); tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime(); tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime(); tstRslt.VolumeCTV = tstRslt.TargetVolume(); diff --git a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 1c4508a58..5d01a573b 100644 --- a/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TBF/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -379,7 +379,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * cBrd.EtPulses(0) / tstRslt.TestTime; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter 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] @@ -405,7 +405,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -414,7 +414,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter meterRslt.TestTime = cBrd.ImpulseTime(i + 1); - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty); meterRslt.TestDone = true; diff --git a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index fb629494a..7614850a7 100644 --- a/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TBF/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -610,17 +610,17 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection 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.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); + tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassEndRaw = EndMass.Val; - tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); + tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.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.Buoyancy = Formulas.Buoyancy(); - double density = Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); + 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.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter - tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -647,7 +647,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; /// Optionally supress pulses from the large water meter @@ -665,7 +665,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection meterRslt.VolumeMeter *= (tstRslt.PulsesMaster / meterRslt.PulsesMaster); } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation } } @@ -677,7 +677,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs b/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs index 510505a7f..fa1d9d049 100644 --- a/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs +++ b/TBF/BenchControl/TestMethods/Endurance/EnduranceSeq.cs @@ -360,7 +360,7 @@ namespace TBF.BenchControl.TestMethods.Endurance tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] @@ -390,7 +390,7 @@ namespace TBF.BenchControl.TestMethods.Endurance if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -420,7 +420,7 @@ namespace TBF.BenchControl.TestMethods.Endurance meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs index 0129ef424..19ee1d062 100644 --- a/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStart/FixedStartSeq.cs @@ -639,7 +639,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -895,7 +895,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart tstRslt.FlowMass = 0; tstRslt.FlowVolume = flowVolume; /// [m3/h] tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.ConstMaster = constMaster; /// Corrected master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ErrorMaster = 0; @@ -930,7 +930,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; /// [l] meterRslt.VolumeEnd = regReader.EndWMState; /// [l] @@ -939,7 +939,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation } } @@ -951,7 +951,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1003,7 +1003,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart volumeRslt.PulsesMaster = tstRslt.PulsesMaster; /// <----------------- ??? volumeRslt.TestTime = tstRslt.TestTime; - volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); + volumeRslt.Error = Config.Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume || ((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && @@ -1022,7 +1022,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart energyRslt.PulsesMeter = energyRslt.VolumeMeter; energyRslt.PulsesMaster = tstRslt.PulsesMaster; /// <----------------- ??? - energyRslt.Error = Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); + energyRslt.Error = Config.Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); energyRslt.Passed = (energyRslt.Error >= heatMetersTestParams.ErrorLimitLo) && (energyRslt.Error <= heatMetersTestParams.ErrorLimitHi) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1045,7 +1045,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; meterRslt.VolumeEnd = regReader.EndWMState; @@ -1054,7 +1054,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index c2088bbd2..0c57adf4e 100644 --- a/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -447,10 +447,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); - double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); - double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); - double buoyancy = Formulas.Buoyancy(); + double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); + double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); + double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); + double buoyancy = Config.Formulas.Buoyancy(); double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut; /// @@ -517,7 +517,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced 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.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -539,7 +539,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = 1.0f; meterRslt.VolumeStart = regReader.BeginWMState; meterRslt.VolumeEnd = regReader.EndWMState; @@ -548,7 +548,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs b/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs index 29028dad7..f593007f8 100644 --- a/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartDeferredEvaluation/FixedStartDeferredEvaluationSeq.cs @@ -676,7 +676,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -810,10 +810,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); - double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); - double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); /// [kg/m3] - double buoyancy = Formulas.Buoyancy(); + double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); + double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); + double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); /// [kg/m3] + double buoyancy = Config.Formulas.Buoyancy(); double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut; if (debugLevel == Config.Entities.DebugMode.Simulate) volumeCTV = test.Volume; @@ -936,7 +936,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation tstRslt.Buoyancy = buoyancy; 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.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -1071,7 +1071,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; /// [l] From forms/images meterRslt.VolumeEnd = regReader.EndWMState; /// [l] From forms/images @@ -1080,7 +1080,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation meterRslt.PulsesMeter = meterRslt.VolumeMeter * regReader.PulsesPerLtr; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation } } @@ -1092,7 +1092,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1116,7 +1116,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; /// From forms/images meterRslt.VolumeEnd = regReader.EndWMState; /// From forms/images @@ -1125,7 +1125,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation meterRslt.PulsesMeter = meterRslt.VolumeMeter * regReader.PulsesPerLtr; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 135ef330e..5f22d67be 100644 --- a/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -666,7 +666,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -800,10 +800,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection while (!e.Contains(Event.PreviousStopped)); - double massStart = Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); - double massEnd = Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); - double densityOut = Formulas.WaterDensityFromTemp(TempDownStat.Average); /// [kg/m3] - double buoyancy = Formulas.Buoyancy(); + double massStart = Config.Formulas.CorrectedValue(StartMass.Val, outPath.Scale.Corrections); + double massEnd = Config.Formulas.CorrectedValue(EndMass.Val, outPath.Scale.Corrections); + double densityOut = Config.Formulas.WaterDensityFromTemp(TempDownStat.Average, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); /// [kg/m3] + double buoyancy = Config.Formulas.Buoyancy(); double volumeCTV = 1000.0 * buoyancy * (massEnd - massStart) / densityOut; if (debugLevel == Config.Entities.DebugMode.Simulate) volumeCTV = test.Volume; @@ -967,7 +967,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.Buoyancy = buoyancy; 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.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -999,7 +999,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; /// [l] meterRslt.VolumeEnd = regReader.EndWMState; /// [l] @@ -1008,7 +1008,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); /// Not used for evaluation } } @@ -1020,7 +1020,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1072,7 +1072,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection volumeRslt.PulsesMaster = tstRslt.PulsesMaster; /// <----------------- ??? volumeRslt.TestTime = tstRslt.TestTime; - volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); + volumeRslt.Error = Config.Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume || ((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && @@ -1091,7 +1091,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection energyRslt.PulsesMeter = energyRslt.VolumeMeter; energyRslt.PulsesMaster = tstRslt.PulsesMaster; /// <----------------- ??? - energyRslt.Error = Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); + energyRslt.Error = Config.Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); energyRslt.Passed = (energyRslt.Error >= heatMetersTestParams.ErrorLimitLo) && (energyRslt.Error <= heatMetersTestParams.ErrorLimitHi) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1114,7 +1114,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.VolumeStart = regReader.BeginWMState; meterRslt.VolumeEnd = regReader.EndWMState; @@ -1123,7 +1123,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection meterRslt.PulsesMeter = meterRslt.VolumeMeter; meterRslt.PulsesMaster = tstRslt.PulsesMaster; meterRslt.TestTime = tstRslt.TestTime; - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 43b165039..450007855 100644 --- a/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -475,7 +475,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -526,7 +526,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter tstRslt.ConstMaster = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3] @@ -592,7 +592,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart volumeRslt.VolumeRef = volumeRslt.PulsesMaster * tstRslt.ConstMaster; /// [l] volumeRslt.TestTime = tstRslt.TestTime; /// [s] - volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); + volumeRslt.Error = Config.Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume || ((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && @@ -612,7 +612,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart energyRslt.VolumeMeter = energyRslt.PulsesMeter * Config.Units.ConvertFrom(Config.Unit.kWh, energyRegReader.LtrsPerPulse); /// [J] energyRslt.TestTime = tstRslt.TestTime; /// [s] - energyRslt.Error = Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); + energyRslt.Error = Config.Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); energyRslt.Passed = (energyRslt.Error >= heatMetersTestParams.ErrorLimitLo) && (energyRslt.Error <= heatMetersTestParams.ErrorLimitHi) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -637,7 +637,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -688,7 +688,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); #if TEST_MODE if (!BatchRslts.IsProduction() && diff --git a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs index 8fbe10643..82d54ab2d 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartFirstRepetWithMassColl/FlyingStartFirstRepetWithMassCollSeq.cs @@ -651,7 +651,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -794,19 +794,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total) tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] /// - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); if (repetitionNr == 1) { tstRslt.MassStartRaw = StartMass.Val; - tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); + tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassEndRaw = EndMass.Val; - tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); + tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.TestTime; /// [kg/h] - double density = Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0); + 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.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter - tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.DiverterStart = switchTimeStart; /// Math.Abs(switchTimeStartHi.Val - switchTimeStartLo.Val); tstRslt.DivStart10 = switchTimeStartLo.Val; @@ -876,7 +876,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; /// Optionally supress pulses from the large water meter @@ -894,7 +894,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl meterRslt.VolumeMeter *= (tstRslt.PulsesMaster / meterRslt.PulsesMaster); } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation } } @@ -906,7 +906,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -958,7 +958,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl volumeRslt.VolumeRef = volumeRslt.PulsesMaster * tstRslt.ConstMaster; /// [l] volumeRslt.TestTime = cBrd.ImpulseTime(i + 1); ; /// [s] - volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); + volumeRslt.Error = Config.Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume || ((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && @@ -978,7 +978,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl energyRslt.VolumeMeter = energyRslt.PulsesMeter * Config.Units.ConvertFrom(Config.Unit.kWh, energyRegReader.LtrsPerPulse); /// [J] energyRslt.TestTime = cBrd.ImpulseTime(i + 1); /// [s] - energyRslt.Error = Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); + energyRslt.Error = Config.Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); energyRslt.Passed = (energyRslt.Error >= heatMetersTestParams.ErrorLimitLo) && (energyRslt.Error <= heatMetersTestParams.ErrorLimitHi) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1003,7 +1003,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -1054,7 +1054,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs index 3cdc9edac..d99ce4cf3 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollProlonged/FlyingStartMassCollProlongedSeq.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Text; using log4net; +using Config; using TBF.BenchControl; using TBF.Boxes; using TBF.Resources; @@ -792,18 +793,18 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged tstRslt.TestTime = cBrd.TTime; /// [s] measurement time tstRslt.PulsesMaster = totalPulses; /// Pulses of the master flow meter (test total) tstRslt.MassStartRaw = StartMass.Val; - tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); + tstRslt.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassEndRaw = EndMass.Val; - tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); + tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); tstRslt.FlowMass = 3600.0 * (tstRslt.MassEnd - tstRslt.MassStart) * totalPulses / (tstRslt.TestTime * massPulses); /// [kg/h] tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); - double density = Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0); + 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.ConstMaster = collectedVoluemCTV / massPulses; /// Corrected 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); + tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -845,7 +846,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; /// Optionally supress pulses from the large water meter @@ -863,7 +864,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged meterRslt.VolumeMeter *= (tstRslt.PulsesMaster / meterRslt.PulsesMaster); } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation + meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation } } @@ -875,7 +876,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -973,7 +974,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -1024,7 +1025,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (meterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index 47f4f84a0..98b5feb09 100644 --- a/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TBF/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -702,7 +702,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection double T_in = (TempRefHi1.Val + TempRefHi2.Val) / 2; /// [°C] double T_out = (TempRefLo1.Val + TempRefLo2.Val) / 2; /// [°C] double deltaVolume = LtrPerRefPulse * RefPulsesDelta; /// [l] - double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] + double deltaEnergy = (0.001 * deltaVolume) * (T_in - T_out) * Config.Formulas.HeatCoefficientWater(16, T_in, T_out, heatMetersTestParams.FlowMeasuredAtHiTempPipe); /// [J] = [m3] * [K] * [J/(m3 K)] Energy.Update(deltaEnergy); VolumeForEnergy.Update(deltaVolume); lastEnergyUpdateTime = StateMachine.Time; @@ -840,17 +840,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection 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.MassStart = Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); + tstRslt.MassStart = Config.Formulas.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections); tstRslt.MassEndRaw = EndMass.Val; - tstRslt.MassEnd = Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections); + tstRslt.MassEnd = Config.Formulas.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.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.Buoyancy = Formulas.Buoyancy(); - double density = Formulas.WaterDensityFromTemp((tstRslt.TempUpMean + tstRslt.TempDownMean) / 2.0); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); + 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.ConstMaster = LtrPerRefPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster; /// Corrected master pulses per liter - tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); + tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV); tstRslt.FlowMean = (float)RefFlowStat.Average; tstRslt.FlowStart = (float)RefFlowStat.First; @@ -892,7 +892,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; /// Optionally supress pulses from the large water meter @@ -910,7 +910,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection meterRslt.VolumeMeter *= (tstRslt.PulsesMaster / meterRslt.PulsesMaster); } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV); /// Main/Aux meter error is not usedfor evaluation } } @@ -922,7 +922,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection compoundMeterRslt.VolumeMeter = mainMeterRslt.VolumeMeter + auxMeterRslt.VolumeMeter; compoundMeterRslt.PulsesMaster = tstRslt.PulsesMaster; compoundMeterRslt.TestTime = tstRslt.TestTime; - compoundMeterRslt.Error = Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); + compoundMeterRslt.Error = Config.Formulas.ErrorFromVolumes(compoundMeterRslt.VolumeMeter, compoundMeterRslt.VolumeRef); compoundMeterRslt.Passed = (compoundMeterRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (compoundMeterRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -974,7 +974,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection volumeRslt.VolumeRef = volumeRslt.PulsesMaster * tstRslt.ConstMaster; /// [l] volumeRslt.TestTime = cBrd.ImpulseTime(i + 1); /// [s] - volumeRslt.Error = Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); + volumeRslt.Error = Config.Formulas.ErrorFromVolumes(volumeRslt.VolumeMeter, volumeRslt.VolumeRef); volumeRslt.Passed = !heatMetersTestParams.EvaluateVolume || ((volumeRslt.Error >= test.GetErrLimLo(tstRslt.FlowMean) + test.Uncertainty) && (volumeRslt.Error <= test.GetErrLimHi(tstRslt.FlowMean) - test.Uncertainty) && @@ -994,7 +994,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection energyRslt.VolumeMeter = energyRslt.PulsesMeter * Config.Units.ConvertFrom(Config.Unit.kWh, energyRegReader.LtrsPerPulse); /// [J] energyRslt.TestTime = cBrd.ImpulseTime(i + 1); /// [s] - energyRslt.Error = Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); + energyRslt.Error = Config.Formulas.ErrorFromVolumes(energyRslt.VolumeMeter, energyRslt.VolumeRef); energyRslt.Passed = (energyRslt.Error >= heatMetersTestParams.ErrorLimitLo) && (energyRslt.Error <= heatMetersTestParams.ErrorLimitHi) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); @@ -1020,8 +1020,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; - meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; + meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses); meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses); @@ -1071,7 +1071,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter } - meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); + meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef); #if TEST_MODE if (!BatchRslts.IsProduction() && diff --git a/TBF/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs b/TBF/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs index 6f8257124..93fa08b10 100644 --- a/TBF/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs +++ b/TBF/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs @@ -289,7 +289,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 0; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h] diff --git a/TBF/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TBF/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs index ddf8b90aa..c6a02fceb 100644 --- a/TBF/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs +++ b/TBF/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs @@ -200,7 +200,7 @@ namespace TBF.BenchControl.TestMethods.PMaxTest tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; /// [kg/h] tstRslt.FlowVolume = 0; /// [m3/h] - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3] tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h] diff --git a/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs b/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs index 9ad7ee884..99145608b 100644 --- a/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs +++ b/TBF/BenchControl/TestMethods/SensitivityTest/SensitivityTestSeq.cs @@ -452,7 +452,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest tstRslt.MassEnd = 0; tstRslt.FlowMass = 0; tstRslt.FlowVolume = 0; - tstRslt.Buoyancy = Formulas.Buoyancy(); + tstRslt.Buoyancy = Config.Formulas.Buoyancy(); tstRslt.VolumeCTV = 0; tstRslt.VolumeMaster = 0; tstRslt.ConstMaster = 0; @@ -477,7 +477,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest if (meterRslt != null && regReader != null) { - meterRslt.RegReaderClass = regReader.ClassName; + meterRslt.RegReaderType = (int)regReader.RegisterReaderType; meterRslt.PulsesPerLiter = regReader.PulsesPerLtr; meterRslt.Passed = (Qrise <= test.Qto) && (tstRslt.ErrorFlags == 0 || tstRslt.ErrorFlagsMode() != Config.Entities.ErrorFlagsMode.On); diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index b7e174712..a2bd78bbf 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -13,6 +13,7 @@ using System.Text; using System.Threading; using System.Windows.Forms; using log4net; +using Config; using Config.Entities; using TBF.Resources; using TBF.BenchControl.Sequences; @@ -1443,7 +1444,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication q2adjResult.VolumeMeter *= ((double)wm.CalibFactor / (double)wm.OrigCalibFactor); } #endif - q2adjResult.Error = Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, q2adjResult.VolumeRef); + q2adjResult.Error = Config.Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, q2adjResult.VolumeRef); } } /// diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index c5847cf12..31aeb45f6 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -30,7 +30,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead public int MuxBoardNrOrGroup14 { get { return iperlHeadCfg.MuxBoardNr; } } public int Group { get { return iperlHeadCfg.Group; } } - public double PulsesPerLtr { get { return 1000.0; } } + public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.DataStream; } } + public double PulsesPerLtr { get { return 1000.0; } } public double LtrsPerPulse { get { return 1 / PulsesPerLtr; } } #if ORACLE_DB @@ -214,7 +215,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead double errLimitHi = q2adjTestData.ErrLimHi - q2adjTestData.Uncertainty; double volumeRefShiftedToTarget = q2adjResult.VolumeRef * (1.0f + CalibTarget / 100.0f); - double q2adjErrorShiftedToTarget = Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, volumeRefShiftedToTarget); + double q2adjErrorShiftedToTarget = Config.Formulas.ErrorFromVolumes(q2adjResult.VolumeMeter, volumeRefShiftedToTarget); if ((q2adjErrorShiftedToTarget < errLimitLo) || (q2adjErrorShiftedToTarget > errLimitHi)) { diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 49426dece..95e209935 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.869.0")] -[assembly: AssemblyFileVersion("2.18.869.0")] +[assembly: AssemblyVersion("2.18.870.0")] +[assembly: AssemblyFileVersion("2.18.870.0")] diff --git a/TBF/Screens/ProcessTabPageCtrl24.cs b/TBF/Screens/ProcessTabPageCtrl24.cs index 504e7ed25..a60a34dd4 100644 --- a/TBF/Screens/ProcessTabPageCtrl24.cs +++ b/TBF/Screens/ProcessTabPageCtrl24.cs @@ -453,9 +453,9 @@ namespace TBF.Screens double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val; massDiffLabel.Text = massDiff.ToString("F3"); - double volumeCtv = 1000.0 * TBF.BenchControl.Formulas.Buoyancy() * massDiff / TBF.BenchControl.Formulas.WaterDensityFromTemp(ProcessData.TempDown.Val); + double volumeCtv = 1000.0 * Config.Formulas.Buoyancy() * massDiff / Config.Formulas.WaterDensityFromTemp((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); volumeCtvLabel.Text = volumeCtv.ToString("F2"); - double refError = TBF.BenchControl.Formulas.ErrorFromVolumes(refVolume, volumeCtv); + double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv); refErrorLabel.Text = refError.ToString("F3"); if (currentMetersKind == MetersKind.Single || currentMetersKind == MetersKind.HeatMeter) @@ -468,7 +468,7 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); } } } @@ -487,13 +487,13 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); compoundVolume += rr.WMVolume; } } cmpndVolume[compMtr].Text = compoundVolume.ToString("F1"); - cmpndError[compMtr].Text = BenchControl.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); + cmpndError[compMtr].Text = Config.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); } } } diff --git a/TBF/Screens/ProcessTabPageCtrl48.cs b/TBF/Screens/ProcessTabPageCtrl48.cs index ba6963884..b46e7043c 100644 --- a/TBF/Screens/ProcessTabPageCtrl48.cs +++ b/TBF/Screens/ProcessTabPageCtrl48.cs @@ -482,9 +482,9 @@ namespace TBF.Screens double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val; massDiffLabel.Text = massDiff.ToString("F3"); - double volumeCtv = 1000.0 * TBF.BenchControl.Formulas.Buoyancy() * massDiff / (float)TBF.BenchControl.Formulas.WaterDensityFromTemp(ProcessData.TempDown.Val); + double volumeCtv = 1000.0 * Config.Formulas.Buoyancy() * massDiff / (float)Config.Formulas.WaterDensityFromTemp((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); volumeCtvLabel.Text = volumeCtv.ToString("F2"); - double refError = TBF.BenchControl.Formulas.ErrorFromVolumes(refVolume, volumeCtv); + double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv); refErrorLabel.Text = refError.ToString("F3"); if (currentMetersKind == MetersKind.Single) @@ -497,7 +497,7 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); } } } @@ -516,13 +516,13 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); compoundVolume += rr.WMVolume; } } cmpndVolume[compMtr].Text = compoundVolume.ToString("F1"); - cmpndError[compMtr].Text = BenchControl.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); + cmpndError[compMtr].Text = Config.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); } } } diff --git a/TBF/Screens/ProcessTabPageCtrl6.cs b/TBF/Screens/ProcessTabPageCtrl6.cs index afbeb81e1..123ca4919 100644 --- a/TBF/Screens/ProcessTabPageCtrl6.cs +++ b/TBF/Screens/ProcessTabPageCtrl6.cs @@ -486,9 +486,9 @@ namespace TBF.Screens double massDiff = ProcessData.Mass.Val - ProcessData.StartMass.Val; massDiffLabel.Text = massDiff.ToString("F3"); - double volumeCtv = 1000.0 * TBF.BenchControl.Formulas.Buoyancy() * massDiff / (float)TBF.BenchControl.Formulas.WaterDensityFromTemp(ProcessData.TempDown.Val); + double volumeCtv = 1000.0 * Config.Formulas.Buoyancy() * massDiff / (float)Config.Formulas.WaterDensityFromTemp((ProcessData.TempUp.Val + ProcessData.TempDown.Val) / 2, Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature); volumeCtvLabel.Text = volumeCtv.ToString("F2"); - double refError = TBF.BenchControl.Formulas.ErrorFromVolumes(refVolume, volumeCtv); + double refError = Config.Formulas.ErrorFromVolumes(refVolume, volumeCtv); refErrorLabel.Text = refError.ToString("F3"); if (currentMetersKind == MetersKind.Single) @@ -501,7 +501,7 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); } } } @@ -520,13 +520,13 @@ namespace TBF.Screens pulses[i].Text = rr.WMPulses.ToString(); refPulses[i].Text = rr.WMRefPulses.ToString(); volume[i].Text = rr.WMVolume.ToString("F1"); - error[i].Text = BenchControl.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); + error[i].Text = Config.Formulas.ErrorFromVolumes(rr.WMVolume, rr.WMRefPulses * ProcessData.LtrPerRefPulse).ToString("F1"); compoundVolume += rr.WMVolume; } } cmpndVolume[compMtr].Text = compoundVolume.ToString("F1"); - cmpndError[compMtr].Text = BenchControl.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); + cmpndError[compMtr].Text = Config.Formulas.ErrorFromVolumes(compoundVolume, refVolume).ToString("F1"); } } } diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index 2a68e237e..0dcc819fa 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -1392,7 +1392,6 @@ - diff --git a/TBF/UiControls/MetrologyDlgBalanceTab.cs b/TBF/UiControls/MetrologyDlgBalanceTab.cs index a870c9b12..b9d3f3014 100644 --- a/TBF/UiControls/MetrologyDlgBalanceTab.cs +++ b/TBF/UiControls/MetrologyDlgBalanceTab.cs @@ -342,7 +342,7 @@ namespace TBF.UiControls CultureInfo.InvariantCulture, out measured)) { - double corrected = BenchControl.Formulas.CorrectedValue(measured, meterEntity.Corrections); + double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } } diff --git a/TBF/UiControls/MetrologyDlgDensityTab.cs b/TBF/UiControls/MetrologyDlgDensityTab.cs index 12be337fe..789d4eda7 100644 --- a/TBF/UiControls/MetrologyDlgDensityTab.cs +++ b/TBF/UiControls/MetrologyDlgDensityTab.cs @@ -63,7 +63,7 @@ namespace TBF.UiControls { densityTextBox.Text = Program.LocalSettings.RealDensity.ToString(); temperatureTextBox.Text = Program.LocalSettings.AtTemperature.ToString(); - densityCorrTextBox.Text = TBF.BenchControl.Formulas.DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature).ToString(); + densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Program.LocalSettings.RealDensity, Program.LocalSettings.AtTemperature).ToString(); } public void Unlock() @@ -134,7 +134,7 @@ namespace TBF.UiControls if (Utils.TryParseUDouble(densityTextBox.Text, out density) && Utils.TryParseUDouble(temperatureTextBox.Text, out temp)) { - densityCorrTextBox.Text = TBF.BenchControl.Formulas.DensityCorrection(density, temp).ToString(); + densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString(); } } } diff --git a/TBF/UiControls/MetrologyDlgFlowMeterTab.cs b/TBF/UiControls/MetrologyDlgFlowMeterTab.cs index 9002aa9e2..4f0d2d587 100644 --- a/TBF/UiControls/MetrologyDlgFlowMeterTab.cs +++ b/TBF/UiControls/MetrologyDlgFlowMeterTab.cs @@ -339,7 +339,7 @@ namespace TBF.UiControls CultureInfo.InvariantCulture, out measured)) { - double corrected = BenchControl.Formulas.CorrectedValue(measured, meterEntity.Corrections); + double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } } diff --git a/TBF/UiControls/MetrologyDlgPlatinumResistanceTMeterTab.cs b/TBF/UiControls/MetrologyDlgPlatinumResistanceTMeterTab.cs index 40866aad1..1fccacd98 100644 --- a/TBF/UiControls/MetrologyDlgPlatinumResistanceTMeterTab.cs +++ b/TBF/UiControls/MetrologyDlgPlatinumResistanceTMeterTab.cs @@ -178,14 +178,14 @@ namespace TBF.UiControls double a7 = Utils.ParseEDouble(a7TextBox.Text); double b7 = Utils.ParseEDouble(b7TextBox.Text); double c7 = Utils.ParseEDouble(c7TextBox.Text); - temperature = BenchControl.Formulas.PlatinumResistanceTM_ITS90_R2T(resistance, R001C, a7, b7, c7); + temperature = Config.Formulas.PlatinumResistanceTM_ITS90_R2T(resistance, R001C, a7, b7, c7); } else { double R0 = Utils.ParseUDouble(r0TextBox.Text); double a = Utils.ParseEDouble(aTextBox.Text); double b = Utils.ParseEDouble(bTextBox.Text); - temperature = BenchControl.Formulas.PlatinumResistanceTM_ITS27_R2T(resistance, R0, a, b); + temperature = Config.Formulas.PlatinumResistanceTM_ITS27_R2T(resistance, R0, a, b); } temperatureTextBox.Text = temperature.ToString(); } diff --git a/TBF/UiControls/MetrologyDlgPressMeterTab.cs b/TBF/UiControls/MetrologyDlgPressMeterTab.cs index 806babf23..d37f8aac7 100644 --- a/TBF/UiControls/MetrologyDlgPressMeterTab.cs +++ b/TBF/UiControls/MetrologyDlgPressMeterTab.cs @@ -273,7 +273,7 @@ namespace TBF.UiControls CultureInfo.InvariantCulture, out measured)) { - double corrected = BenchControl.Formulas.CorrectedValue(measured, meterEntity.Corrections); + double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } } diff --git a/TBF/UiControls/MetrologyDlgTempMeterTab.cs b/TBF/UiControls/MetrologyDlgTempMeterTab.cs index a31e5ad73..12e3375a6 100644 --- a/TBF/UiControls/MetrologyDlgTempMeterTab.cs +++ b/TBF/UiControls/MetrologyDlgTempMeterTab.cs @@ -273,7 +273,7 @@ namespace TBF.UiControls CultureInfo.InvariantCulture, out measured)) { - double corrected = BenchControl.Formulas.CorrectedValue(measured, meterEntity.Corrections); + double corrected = Config.Formulas.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } }