diff --git a/Config/Entities/Test.cs b/Config/Entities/Test.cs index a5756c19b..0773879ab 100644 --- a/Config/Entities/Test.cs +++ b/Config/Entities/Test.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2021 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -19,14 +19,15 @@ namespace Config.Entities public virtual string Name { get; set; } public virtual int Part { get; set; } /// Part=0 ... test of all WM-s /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath - public virtual TestProfile Profile { get; set; } /// UserDefined, Protected, UserDefinedHeatMeter, ProtectedHeatMeter + public virtual TestProfile Profile { get; set; } /// UserDefined, UserDefinedCompound, UserDefinedHeatMeter, Protected, ProtectedCompound, ProtectedHeatMeter public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal public virtual bool DoEvaluate { get; set; } - public virtual double Qtg { get; set; } /// Target water flow [m3/h] - public virtual double Qfrom { get; set; } /// Water flow low limit in [m3/h] - public virtual double Qto { get; set; } /// Water flow high limit in [m3/h] + public virtual double Qtg { get; set; } /// When == -1 => Qtg is determined by the test method, otherwise Qtg is in [m3/h], + public virtual double Qfrom { get; set; } /// Water flow low limit in [m3/h] or in [%] of Qtg + public virtual double Qto { get; set; } /// Water flow high limit in [m3/h] or in [%] of Qtg + public virtual bool IsFromToInPct { get; set; } /// true: Qfrom and Qto are in % of Qtg, false: Qfrom and Qto are in [m3/h] public virtual double Volume { get; set; } /// Test volume (target) in [l] - public virtual double TestTime { get; set; } /// Test time (estimate) in [s] + public virtual double TestTime { get; set; } /// Test time (estimate) in [s] public virtual string Method { get; set; } public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3 public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h @@ -57,6 +58,11 @@ namespace Config.Entities public virtual string TransBetween { get; set; } public virtual string TransAfter { get; set; } + public virtual IList MoreParams { get; set; } + + public virtual Procedure Procedure { get; set; } + + /// Additional stuff not mapped into the database public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database @@ -73,11 +79,15 @@ namespace Config.Entities public virtual Unit PressUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab public virtual Unit LengthUnit { get; set; } /// Not mapped to database, used in ProcedureDlg / Metrology1Tab - public virtual IList MoreParams { get; set; } - - public virtual Procedure Procedure { get; set; } - - /// ------------- Additional stuff not mapped into the database ------------- + /// Wrappers + public virtual double QfromM3ph() + { + return !IsFromToInPct ? Qfrom : Qtg >= 0 ? Qtg * Qfrom / 100 : 0; + } + public virtual double QtoM3ph() + { + return !IsFromToInPct ? Qto : Qtg >= 0 ? Qtg * Qto / 100 : 0; + } public Test() { @@ -90,6 +100,7 @@ namespace Config.Entities Profile = TestProfile.UserDefined; Publish = (sbyte)Common.Publish.Always; DoEvaluate = true; + IsFromToInPct = false; ErrLimLo = -2.0f; /// [%] lower error limit ErrLimHi = 2.0f; /// [%] upper error limit Uncertainty = 0; @@ -159,7 +170,8 @@ namespace Config.Entities result.Qtg = Qtg; result.Qfrom = Qfrom; result.Qto = Qto; - result.Volume = Volume; + result.IsFromToInPct = IsFromToInPct; + result.Volume = Volume; result.TestTime = TestTime; result.Method = Method; result.ErrLimLo = ErrLimLo; @@ -192,6 +204,7 @@ namespace Config.Entities result.TransAfter = TransAfter; result.VolumeUnit = VolumeUnit; result.FlowUnit = FlowUnit; + result.FlowUnit = FlowUnit; result.MassUnit = MassUnit; result.TempUnit = TempUnit; result.PressUnit = PressUnit; @@ -212,6 +225,7 @@ namespace Config.Entities output.WriteLine(Qtg.ToString(ci)); output.WriteLine(Qfrom.ToString(ci)); output.WriteLine(Qto.ToString(ci)); + output.WriteLine(IsFromToInPct.ToString()); output.WriteLine(Volume.ToString(ci)); output.WriteLine(TestTime.ToString(ci)); output.WriteLine(Method); @@ -264,6 +278,7 @@ namespace Config.Entities tst.Qtg = double.Parse(input.ReadLine(), ci); tst.Qfrom = double.Parse(input.ReadLine(), ci); tst.Qto = double.Parse(input.ReadLine(), ci); + tst.IsFromToInPct = bool.Parse(input.ReadLine()); tst.Volume = double.Parse(input.ReadLine(), ci); tst.TestTime = double.Parse(input.ReadLine(), ci); tst.Method = input.ReadLine(); @@ -293,8 +308,11 @@ namespace Config.Entities tst.TransBetween = input.ReadLine(); string line = input.ReadLine(); tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter - : line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter - : line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default + : line.Equals(TestProfile.ProtectedCompound.ToString()) ? TestProfile.ProtectedCompound + : line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected + : line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter + : line.Equals(TestProfile.UserDefinedCompound.ToString()) ? TestProfile.UserDefinedCompound + : TestProfile.UserDefined; /// UserDefined is the default tst.TransAfter = input.ReadLine(); while (true) @@ -327,6 +345,7 @@ namespace Config.Entities ln = inp.ReadLine(); if (ln != Qtg.ToString(ci)) { diff.AppendFormat(fmt, "Qtg", Qtg.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); }; + ln = inp.ReadLine(); if (ln != IsFromToInPct.ToString()) { diff.AppendFormat(fmt, "IsFromToInPct", IsFromToInPct.ToString(), ln); }; ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != TestTime.ToString(ci)) { diff.AppendFormat(fmt, "TstTime", TestTime.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Method) { diff.AppendFormat(fmt, "Method", Method, ln); }; @@ -334,11 +353,11 @@ namespace Config.Entities ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); }; - ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "DoDraining", DoDraining.ToString(ci), ln); }; - ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "DoDrainingAfter", DoDrainingAfter.ToString(ci), ln); }; + ln = inp.ReadLine(); if (ln != DoDraining.ToString()) { diff.AppendFormat(fmt, "DoDraining", DoDraining.ToString(), ln); }; + ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString()) { diff.AppendFormat(fmt, "DoDrainingAfter", DoDrainingAfter.ToString(), ln); }; ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); }; - ln = inp.ReadLine(); if (ln != TempControl) { diff.AppendFormat(fmt, "TempController", TempControl, ln); }; + ln = inp.ReadLine(); if (ln != TempControl) { diff.AppendFormat(fmt, "TempController", TempControl, ln); }; ln = inp.ReadLine(); if (ln != PumpPower.ToString(ci)) { diff.AppendFormat(fmt, "PumpPower", PumpPower.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != MassRepeats.ToString(ci)) { diff.AppendFormat(fmt, "MassRepeats", MassRepeats.ToString(ci), ln); }; ln = inp.ReadLine(); if (ln != MassSpread.ToString(ci)) { diff.AppendFormat(fmt, "MassSpread", MassSpread.ToString(ci), ln); }; diff --git a/Config/Mappings/TestMap.cs b/Config/Mappings/TestMap.cs index ecbce94d4..ded0c669d 100644 --- a/Config/Mappings/TestMap.cs +++ b/Config/Mappings/TestMap.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2017 Sensus Metering Systems +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using FluentNHibernate.Mapping; using Config.Entities; @@ -20,7 +20,8 @@ namespace Config.Mappings Map(x => x.Qtg); Map(x => x.Qfrom); Map(x => x.Qto); - Map(x => x.Volume); + Map(x => x.IsFromToInPct); + Map(x => x.Volume); Map(x => x.TestTime); Map(x => x.Repeats); Map(x => x.DoDraining); diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 7e377d71e..a5af192ab 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("3.7.2095.0")] -[assembly: AssemblyFileVersion("3.7.2095.0")] +[assembly: AssemblyVersion("3.8.2097.0")] +[assembly: AssemblyFileVersion("3.8.2097.0")] diff --git a/TBF/Rig/DataContainer/BenchInfo/Component.cs b/TBF/Rig/DataContainer/BenchInfo/Component.cs index d25868c29..e6e9fc1ad 100644 --- a/TBF/Rig/DataContainer/BenchInfo/Component.cs +++ b/TBF/Rig/DataContainer/BenchInfo/Component.cs @@ -1,14 +1,10 @@ /// -/// Copyright (c) 2018-2021 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; -using System.Xml.Serialization; using log4net; using Common; -using Config.Entities; -using TBF.Rig; -using TBF.Rig.Generic; namespace TBF.Rig.DataContainer.BenchInfo { @@ -34,6 +30,7 @@ namespace TBF.Rig.DataContainer.BenchInfo public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } } public Unit VolumeUnit { get { return myCfg.VolumeUnit; } } public Unit FlowUnit { get { return myCfg.FlowUnit; } } + public bool IsFromToInPct { get { return myCfg.IsFromToInPct; } } public Unit MassUnit { get { return myCfg.MassUnit; } } public Unit TempUnit { get { return myCfg.TempUnit; } } public Unit PressUnit { get { return myCfg.PressUnit; } } diff --git a/TBF/Rig/DataContainer/BenchInfo/ComponentCfg.cs b/TBF/Rig/DataContainer/BenchInfo/ComponentCfg.cs index 4ba0f7cb4..ea00cdaa4 100644 --- a/TBF/Rig/DataContainer/BenchInfo/ComponentCfg.cs +++ b/TBF/Rig/DataContainer/BenchInfo/ComponentCfg.cs @@ -1,11 +1,11 @@ /// -/// Copyright (c) 2018-2021 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Xml.Serialization; using Common; -using Config.Entities; +using TBF.Resources; using TBF.Rig.Generic; namespace TBF.Rig.DataContainer.BenchInfo @@ -38,14 +38,15 @@ namespace TBF.Rig.DataContainer.BenchInfo public int CompoundMetersCount; /// 12 public Unit VolumeUnit; /// 13 public Unit FlowUnit; /// 14 - public Unit MassUnit; /// 15 - public Unit TempUnit; /// 16 - public Unit PressUnit; /// 17 - public Unit LenghtUnit; /// 18 - public ProcedureSelection Source1; /// 19 - public ProcedureSelection Source2; /// 20 - public ProcedureSelection Source3; /// 21 - public ProcedureSelection Source4; /// 22 + public bool IsFromToInPct; /// 15 + public Unit MassUnit; /// 16 + public Unit TempUnit; /// 17 + public Unit PressUnit; /// 18 + public Unit LenghtUnit; /// 19 + public ProcedureSelection Source1; /// 20 + public ProcedureSelection Source2; /// 21 + public ProcedureSelection Source3; /// 22 + public ProcedureSelection Source4; /// 23 /// Private parameterless constructor invoked by all other (public) constructors ComponentCfg() {} @@ -78,6 +79,7 @@ namespace TBF.Rig.DataContainer.BenchInfo CompoundMetersCount = 1; VolumeUnit = Unit.l; FlowUnit = Unit.m3ph; + IsFromToInPct = false; MassUnit = Unit.kg; TempUnit = Unit.C; PressUnit = Unit.bar; @@ -103,16 +105,17 @@ namespace TBF.Rig.DataContainer.BenchInfo "Water meters count", /// 10 "Lines count", /// 11 "Compound meters count", /// 12 - "Preffered volume unit", - "Preffered flow unit", - "Preffered mass unit", - "Preffered temperature unit", - "Preffered pressure unit", - "Preffered lenght unit", - "Procedure selection source 1", /// 13 - "Procedure selection source 2", /// 14 - "Procedure selection source 3", /// 15 - "Procedure selection source 4", /// 16 + "Preffered volume unit", /// 13 + "Preffered flow unit", /// 14 + "Qfrom and Qto preferably in %", /// 15 + "Preffered mass unit", /// 16 + "Preffered temperature unit", /// 17 + "Preffered pressure unit", /// 18 + "Preffered lenght unit", /// 19 + "Procedure selection source 1", /// 20 + "Procedure selection source 2", /// 21 + "Procedure selection source 3", /// 22 + "Procedure selection source 4", /// 23 }; public string ParamName(int i) { return paramNames[i]; } public int ParamsCount() { return paramNames.Length; } @@ -131,39 +134,47 @@ namespace TBF.Rig.DataContainer.BenchInfo return new string[] { "0", "1", "2", "3" }; case 13: + /// Volume unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Volume)) list.Add(unit.ToDescription()); return list; case 14: + /// Flow unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Flow)) list.Add(unit.ToDescription()); return list; case 15: + return new string[] { Strings.yes, Strings.no }; + case 16: + /// Mass unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Mass)) list.Add(unit.ToDescription()); return list; - case 16: + case 17: + /// Temperature unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Temperature)) list.Add(unit.ToDescription()); return list; - case 17: + case 18: + /// Pressure unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Pressure)) list.Add(unit.ToDescription()); return list; - case 18: + case 19: + /// Length unit for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Length)) list.Add(unit.ToDescription()); return list; - case 19: case 20: case 21: case 22: + case 23: for (ProcedureSelection src = 0; src < ProcedureSelection.Count; src++) list.Add(src.ToDescription()); return list; @@ -192,14 +203,15 @@ namespace TBF.Rig.DataContainer.BenchInfo case 12: return CompoundMetersCount.ToString(); case 13: return VolumeUnit.ToDescription(); case 14: return FlowUnit.ToDescription(); - case 15: return MassUnit.ToDescription(); - case 16: return TempUnit.ToDescription(); - case 17: return PressUnit.ToDescription(); - case 18: return LenghtUnit.ToDescription(); - case 19: return Source1.ToDescription(); - case 20: return Source2.ToDescription(); - case 21: return Source3.ToDescription(); - case 22: return Source4.ToDescription(); + case 15: return IsFromToInPct ? Strings.yes : Strings.no ; + case 16: return MassUnit.ToDescription(); + case 17: return TempUnit.ToDescription(); + case 18: return PressUnit.ToDescription(); + case 19: return LenghtUnit.ToDescription(); + case 20: return Source1.ToDescription(); + case 21: return Source2.ToDescription(); + case 22: return Source3.ToDescription(); + case 23: return Source4.ToDescription(); default: return string.Format("{0}: Bench={1}, ID={2}, Mtrs={3}, Lines={4}, Compund mtrs={5}, S1={6}, S2={7}, S3={8}, S4={9}", Name, TestBenchName, TestBenchId, WaterMetersCount, LinesCount, CompoundMetersCount, Source1, Source2, Source3, Source4); @@ -233,43 +245,47 @@ namespace TBF.Rig.DataContainer.BenchInfo return CfgUpdateFlags.RestartRqrd; case 15: - MassUnit = Units.FromDescription(str); + IsFromToInPct = (str == Strings.yes); return CfgUpdateFlags.RestartRqrd; case 16: - TempUnit = Units.FromDescription(str); + MassUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 17: - PressUnit = Units.FromDescription(str); + TempUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 18: - LenghtUnit = Units.FromDescription(str); + PressUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 19: + LenghtUnit = Units.FromDescription(str); + return CfgUpdateFlags.RestartRqrd; + + case 20: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source1 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 20: + case 21: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source2 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 21: + case 22: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source3 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 22: + case 23: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source4 = source; return CfgUpdateFlags.RestartRqrd; } @@ -316,12 +332,13 @@ namespace TBF.Rig.DataContainer.BenchInfo case 16: case 17: case 18: + case 19: if (ParamValues(i).Contains(str)) return true; break; - case 19: case 20: case 21: case 22: + case 23: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) return true; @@ -353,6 +370,7 @@ namespace TBF.Rig.DataContainer.BenchInfo prms.CompoundMetersCount = this.CompoundMetersCount; prms.VolumeUnit = this.VolumeUnit; prms.FlowUnit = this.FlowUnit; + prms.IsFromToInPct = this.IsFromToInPct; prms.MassUnit = this.MassUnit; prms.TempUnit = this.TempUnit; prms.PressUnit = this.PressUnit; diff --git a/TBF/Rig/DataContainer/iPerlBenchInfo/Component.cs b/TBF/Rig/DataContainer/iPerlBenchInfo/Component.cs index 392698f90..9d8bd6f74 100644 --- a/TBF/Rig/DataContainer/iPerlBenchInfo/Component.cs +++ b/TBF/Rig/DataContainer/iPerlBenchInfo/Component.cs @@ -1,14 +1,10 @@ /// -/// Copyright (c) 2018-2020 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; -using System.Xml.Serialization; using log4net; using Common; -using Config.Entities; -using TBF.Rig; -using TBF.Rig.Generic; using TBF.Resources; namespace TBF.Rig.DataContainer.iPerlBenchInfo @@ -35,6 +31,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } } public Unit VolumeUnit { get { return myCfg.VolumeUnit; } } public Unit FlowUnit { get { return myCfg.FlowUnit; } } + public bool IsFromToInPct { get { return myCfg.IsFromToInPct; } } public Unit MassUnit { get { return myCfg.MassUnit; } } public Unit TempUnit { get { return myCfg.TempUnit; } } public Unit PressUnit { get { return myCfg.PressUnit; } } diff --git a/TBF/Rig/DataContainer/iPerlBenchInfo/ComponentCfg.cs b/TBF/Rig/DataContainer/iPerlBenchInfo/ComponentCfg.cs index 976fea699..8192584ce 100644 --- a/TBF/Rig/DataContainer/iPerlBenchInfo/ComponentCfg.cs +++ b/TBF/Rig/DataContainer/iPerlBenchInfo/ComponentCfg.cs @@ -1,13 +1,12 @@ /// -/// Copyright (c) 2018-2021 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Xml.Serialization; using Common; -using Config.Entities; -using TBF.Rig.Generic; using TBF.Resources; +using TBF.Rig.Generic; namespace TBF.Rig.DataContainer.iPerlBenchInfo { @@ -37,18 +36,19 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo public int WaterMetersCount; /// 10 public int LinesCount; /// 11 public int CompoundMetersCount; /// 12 - public Unit VolumeUnit; - public Unit FlowUnit; - public Unit MassUnit; - public Unit TempUnit; - public Unit PressUnit; - public Unit LenghtUnit; - public Side Side; /// 19 - public int MaxTestIndex; /// 20 (MaxPruefindex % 100) value when to reject water meters completely if they are NOK - public ProcedureSelection Source1; /// 21 - public ProcedureSelection Source2; /// 22 - public ProcedureSelection Source3; /// 23 - public ProcedureSelection Source4; /// 24 + public Unit VolumeUnit; /// 13 + public Unit FlowUnit; /// 14 + public bool IsFromToInPct; /// 15 + public Unit MassUnit; /// 16 + public Unit TempUnit; /// 17 + public Unit PressUnit; /// 18 + public Unit LenghtUnit; /// 19 + public Side Side; /// 20 + public int MaxTestIndex; /// 21 (MaxPruefindex % 100) value when to reject water meters completely if they are NOK + public ProcedureSelection Source1; /// 22 + public ProcedureSelection Source2; /// 23 + public ProcedureSelection Source3; /// 24 + public ProcedureSelection Source4; /// 25 /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } @@ -87,6 +87,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo CompoundMetersCount = 1; VolumeUnit = Unit.l; FlowUnit = Unit.m3ph; + IsFromToInPct = false; MassUnit = Unit.kg; TempUnit = Unit.C; PressUnit = Unit.bar; @@ -118,18 +119,19 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo "Water meters count", /// 10 "Lines count", /// 11 "Compound meters count", /// 12 - "Preffered volume unit", - "Preffered flow unit", - "Preffered mass unit", - "Preffered temperature unit", - "Preffered pressure unit", - "Preffered lenght unit", - Strings.Side, /// 19 - "Max.test index", /// 20 - "Procedure selection source 1", /// 21 - "Procedure selection source 2", /// 22 - "Procedure selection source 3", /// 23 - "Procedure selection source 4", /// 24 + "Preffered volume unit", /// 13 + "Preffered flow unit", /// 14 + "Qfrom and Qto preferably in %", /// 15 + "Preffered mass unit", /// 16 + "Preffered temperature unit", /// 17 + "Preffered pressure unit", /// 18 + "Preffered lenght unit", /// 19 + Strings.Side, /// 20 + "Max.test index", /// 21 + "Procedure selection source 1", /// 22 + "Procedure selection source 2", /// 23 + "Procedure selection source 3", /// 24 + "Procedure selection source 4", /// 25 }; public string ParamName(int i) { return paramNames[i]; } public int ParamsCount() { return paramNames.Length; } @@ -157,34 +159,36 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo list.Add(unit.ToDescription()); return list; case 15: + return new string[] { Strings.yes, Strings.no }; + case 16: for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Mass)) list.Add(unit.ToDescription()); return list; - case 16: + case 17: for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Temperature)) list.Add(unit.ToDescription()); return list; - case 17: + case 18: for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Pressure)) list.Add(unit.ToDescription()); return list; - case 18: + case 19: for (Unit unit = 0; unit < Unit.Count; unit++) if (Units.IsQuantity(unit, Quantity.Length)) list.Add(unit.ToDescription()); return list; - case 19: + case 20: for (Side side = 0; side < Side.Count; side++) list.Add(side.ToDescription()); return list; - case 21: case 22: case 23: case 24: + case 25: for (ProcedureSelection src = 0; src < ProcedureSelection.Count; src++) list.Add(src.ToDescription()); return list; @@ -213,16 +217,17 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo case 12: return CompoundMetersCount.ToString(); case 13: return VolumeUnit.ToDescription(); case 14: return FlowUnit.ToDescription(); - case 15: return MassUnit.ToDescription(); - case 16: return TempUnit.ToDescription(); - case 17: return PressUnit.ToDescription(); - case 18: return LenghtUnit.ToDescription(); - case 19: return Side.ToDescription(); - case 20: return MaxTestIndex.ToString(); - case 21: return Source1.ToDescription(); - case 22: return Source2.ToDescription(); - case 23: return Source3.ToDescription(); - case 24: return Source4.ToDescription(); + case 15: return IsFromToInPct ? Strings.yes : Strings.no; + case 16: return MassUnit.ToDescription(); + case 17: return TempUnit.ToDescription(); + case 18: return PressUnit.ToDescription(); + case 19: return LenghtUnit.ToDescription(); + case 20: return Side.ToDescription(); + case 21: return MaxTestIndex.ToString(); + case 22: return Source1.ToDescription(); + case 23: return Source2.ToDescription(); + case 24: return Source3.ToDescription(); + case 25: return Source4.ToDescription(); default: return string.Format("{0}: Bench={1}, ID={2}, Mtrs={3}, Lines={4}, Compund mtrs={5}, S1={6}, S2={7}, S3={8}, S4={9}", Name, TestBenchName, TestBenchId, WaterMetersCount, LinesCount, CompoundMetersCount, Source1, Source2, Source3, Source4); @@ -256,22 +261,26 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo return CfgUpdateFlags.RestartRqrd; case 15: - MassUnit = Units.FromDescription(str); + IsFromToInPct = (str == Strings.yes); return CfgUpdateFlags.RestartRqrd; case 16: - TempUnit = Units.FromDescription(str); + MassUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 17: - PressUnit = Units.FromDescription(str); + TempUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 18: - LenghtUnit = Units.FromDescription(str); + PressUnit = Units.FromDescription(str); return CfgUpdateFlags.RestartRqrd; case 19: + LenghtUnit = Units.FromDescription(str); + return CfgUpdateFlags.RestartRqrd; + + case 20: for (Side side = 0; side < Side.Count; side++) { if (str == side.ToDescription()) @@ -289,30 +298,30 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo } return CfgUpdateFlags.Error; - case 20: MaxTestIndex = int.Parse(str); return CfgUpdateFlags.RestartRqrd; + case 21: MaxTestIndex = int.Parse(str); return CfgUpdateFlags.RestartRqrd; - case 21: + case 22: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source1 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 22: + case 23: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source2 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 23: + case 24: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source3 = source; return CfgUpdateFlags.RestartRqrd; } } break; - case 24: + case 25: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) { Source4 = source; return CfgUpdateFlags.RestartRqrd; } @@ -357,21 +366,22 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo case 16: case 17: case 18: + case 19: if (ParamValues(i).Contains(str)) return true; break; - case 19: + case 20: for (Side side = 0; side < Side.Count; side++) { if (str == side.ToDescription()) return true; } break; - case 20: + case 21: if (int.TryParse(str, out idummy) && (idummy >= 0)) return true; break; - case 21: case 22: case 23: case 24: + case 25: for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++) { if (str == source.ToDescription()) return true; @@ -403,6 +413,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo prms.CompoundMetersCount = this.CompoundMetersCount; prms.VolumeUnit = this.VolumeUnit; prms.FlowUnit = this.FlowUnit; + prms.IsFromToInPct = this.IsFromToInPct; prms.MassUnit = this.MassUnit; prms.TempUnit = this.TempUnit; prms.PressUnit = this.PressUnit; diff --git a/TBF/Rig/GenericDevices/IBenchInfo.cs b/TBF/Rig/GenericDevices/IBenchInfo.cs index 629fca203..db7bd8bdc 100644 --- a/TBF/Rig/GenericDevices/IBenchInfo.cs +++ b/TBF/Rig/GenericDevices/IBenchInfo.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2015-2021 Sensus Slovensko a.s. +/// Copyright (c) 2015-2023 Sensus Slovensko a.s. /// using System.Collections.Generic; using Common; @@ -24,6 +24,7 @@ namespace TBF.Rig.GenericDevices ICollection Sources { get; } Unit VolumeUnit { get; } Unit FlowUnit { get; } + bool IsFromToInPct { get; } Unit MassUnit { get; } Unit TempUnit { get; } Unit PressUnit { get; } diff --git a/TBF/Rig/Sequences/ProcessData.cs b/TBF/Rig/Sequences/ProcessData.cs index 46cacec46..b66bc9a8f 100644 --- a/TBF/Rig/Sequences/ProcessData.cs +++ b/TBF/Rig/Sequences/ProcessData.cs @@ -1,6 +1,8 @@ -using System; +/// +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. +/// +using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using log4net; using Common; @@ -36,6 +38,7 @@ namespace TBF.Rig.Sequences /// public static Unit VolumeUnit { get { return BenchInfo != null ? BenchInfo.VolumeUnit : Unit.l; } } public static Unit FlowUnit { get { return BenchInfo != null ? BenchInfo.FlowUnit : Unit.m3ph; } } + public static bool IsFromToInPct { get { return BenchInfo != null ? BenchInfo.IsFromToInPct : false; } } public static Unit MassUnit { get { return BenchInfo != null ? BenchInfo.MassUnit : Unit.kg; } } public static Unit TempUnit { get { return BenchInfo != null ? BenchInfo.TempUnit : Unit.C; } } public static Unit PressUnit { get { return BenchInfo != null ? BenchInfo.PressUnit : Unit.bar; } } @@ -55,11 +58,11 @@ namespace TBF.Rig.Sequences /// public static Rig.OutputPath Devices { get { return outPath; } } /// - protected static Rig.FeedingPath inPath; - protected static Rig.BenchPath benchPath; - protected static Rig.OutputPath outPath; - protected static Rig.MetersPath sensPath; - protected static Rig.HeatMetersPath heatMetersPath; + protected static TBF.Rig.FeedingPath inPath; + protected static TBF.Rig.BenchPath benchPath; + protected static TBF.Rig.OutputPath outPath; + protected static TBF.Rig.MetersPath sensPath; + protected static TBF.Rig.HeatMetersPath heatMetersPath; protected static TransitionSequence transitionBefore; protected static TransitionSequence transitionBetween; protected static TransitionSequence transitionAfter; @@ -67,11 +70,11 @@ namespace TBF.Rig.Sequences /// /// Advanced information about the next test /// - protected static Rig.FeedingPath nextInPath; - protected static Rig.BenchPath nextBenchPath; - protected static Rig.OutputPath nextOutPath; - protected static Rig.MetersPath nextSensPath; - protected static Rig.HeatMetersPath nextHeatMetersPath; + protected static TBF.Rig.FeedingPath nextInPath; + protected static TBF.Rig.BenchPath nextBenchPath; + protected static TBF.Rig.OutputPath nextOutPath; + protected static TBF.Rig.MetersPath nextSensPath; + protected static TBF.Rig.HeatMetersPath nextHeatMetersPath; protected static TransitionSequence nextTransitionBefore; protected static double nextQfrom; protected static double nextQto; diff --git a/TBF/Rig/TbfComponents.cs b/TBF/Rig/TbfComponents.cs index e786645a5..e95a690ff 100644 --- a/TBF/Rig/TbfComponents.cs +++ b/TBF/Rig/TbfComponents.cs @@ -1,7 +1,8 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System.Collections.Generic; +using System.Linq; using Common; using Config.Entities; using TBF.Rig.Generic; @@ -12,203 +13,203 @@ namespace TBF.Rig { public readonly static IList Factories; - static TbfComponents() - { - Factories = new List(); - - Factories.Add(new Ambient.Comet.Factory()); - Factories.Add(new Ambient.Greco.Factory()); - Factories.Add(new ControlBoard.Papouch.Factory()); - Factories.Add(new ControlBoard.Uni.Factory()); - Factories.Add(new DataContainer.BackupAndSecurityOptions.Factory()); - Factories.Add(new DataContainer.BenchInfo.Factory()); - Factories.Add(new DataContainer.Buoyancy.Factory()); - Factories.Add(new DataContainer.Density.Factory()); - Factories.Add(new DataContainer.Evaporation.Factory()); - Factories.Add(new DataContainer.iPerlBenchInfo.Factory()); - Factories.Add(new DataEntry.Combined.EntryFormFactory()); - Factories.Add(new DataEntry.HeatMeters6.Factory()); - Factories.Add(new DataEntry.HeatMeters12.Factory()); - Factories.Add(new DataEntry.iPerl.Factory()); - Factories.Add(new DataEntry.S620.Factory()); - Factories.Add(new DataEntry.Single.Factory()); - Factories.Add(new DataEntry.Single.FactoryNoStartEnd()); - Factories.Add(new DataEntry.Standard6.Factory()); - Factories.Add(new DataEntry.Standard6.FactoryNoStartEnd()); - Factories.Add(new DataEntry.Standard12.Factory()); - Factories.Add(new DataEntry.Standard12.FactoryNoStartEnd()); - Factories.Add(new DataEntry.Standard24.Factory()); - Factories.Add(new DataEntry.Standard24.FactoryNoStartEnd()); - Factories.Add(new DataEntry.Standard48.Factory()); - Factories.Add(new DataEntry.Standard48.FactoryNoStartEnd()); - Factories.Add(new DataEntry.StandardCamera.Factory()); - Factories.Add(new DataEntry.Uni.Factory()); - Factories.Add(new DataEntry.Uni.FactoryNoStartEnd()); - Factories.Add(new RegisterReaders.KPackE.DataEntryForRadio.Factory()); /// DataEntry for KPackE radio - Factories.Add(new Uni.Diverter.Factory()); - Factories.Add(new Dummy.Balance.Factory()); - Factories.Add(new Dummy.Diverter.Factory()); - Factories.Add(new Dummy.FlowMeter.Factory()); - Factories.Add(new Dummy.RegValve.Factory()); - Factories.Add(new Dummy.TempControl.Factory()); - Factories.Add(new Dummy.Valve.Factory()); - Factories.Add(new Uni.FlowMeter.Factory()); - Factories.Add(new Uni.FlowMetersInParallel.Factory()); - Factories.Add(new Hart.Common.Factory()); - Factories.Add(new Hart.Nivotrack.Factory()); - Factories.Add(new Keithley.Multimeter_2010_RS232.Factory()); /// Keithley.Multimeter_2010_RS232 - Factories.Add(new Keithley.TempMeter.Factory()); /// Keithley.TempMeter - Factories.Add(new Modbus.Common.Factory()); /// Modbus - Factories.Add(new Modbus.Ambient.Comet.Factory()); /// Comet Ambient temp./pressure/humidity measurement via a modbus on a PC - Factories.Add(new Modbus.PressureMeter.Meret.Factory()); /// Meret pressure meter connected via a modbus on a PC - Factories.Add(new Modbus.PumpFM.DanfossVLT.Factory()); /// Pump controlled by Danfoss VLT connected via Modbus - Factories.Add(new Modbus.QuidoRS.Factory()); /// Modbus.QuidoRS - Factories.Add(new Modbus.TankSelector.Factory()); /// Modbus.TankSelector - Factories.Add(new Modbus.TempControl.Easytherm.Factory()); - Factories.Add(new Modbus.TempControl.Novus.Factory()); - Factories.Add(new Modbus.TempMeter.Groch.Factory()); /// Groch temperature meter connected via a modbus on a PC - Factories.Add(new Modbus.TempMeter.Meret.Factory()); /// Meret temperature meter connected via a modbus on a PC - Factories.Add(new Modbus.UltrasoundLevelMeter.Factory()); - Factories.Add(new Modbus.WaterAnalyzer.Factory()); - Factories.Add(new Network.Adapter.Factory()); - Factories.Add(new Network.Camera.CLP1611.Factory()); - Factories.Add(new Network.Camera.Display.Factory()); - Factories.Add(new Network.Camera.Roi.Factory()); - Factories.Add(new Network.Camera.RoiForFixedStart.Factory()); - Factories.Add(new Network.Comet.Ambient.Factory()); - Factories.Add(new Output.DB.ProductionTracing.Factory()); - Factories.Add(new Output.DB.SaveDiverterCorrections.Factory()); - Factories.Add(new Output.DB.SaveFlowmeterCorrections.Factory()); - Factories.Add(new Output.DB.SensusOracle.Factory()); - Factories.Add(new Output.EventTriggers.Iperl.Factory()); - Factories.Add(new Output.EventTriggers.Standard.Factory()); - Factories.Add(new Output.FileWriters.Basic.FactorySingle()); - Factories.Add(new Output.FileWriters.Basic.FactoryCompound()); - Factories.Add(new Output.FileWriters.Basic.FactoryHeatMeters()); - Factories.Add(new Output.FileWriters.Elde.FactorySingle()); - Factories.Add(new Output.FileWriters.Enhanced.FactorySingle()); - Factories.Add(new Output.FileWriters.Enhanced.FactoryCompound()); - Factories.Add(new Output.FileWriters.Enhanced.FactoryHeatMeters()); - Factories.Add(new Output.FileWriters.ImageArchiver.Factory()); - Factories.Add(new Output.FileWriters.IperlLogger.Factory()); - Factories.Add(new Output.FileWriters.OneFilePerMeter.FactorySingle()); - Factories.Add(new Output.FileWriters.OneFilePerMeter.FactoryCompound()); - Factories.Add(new Output.FileWriters.OneFilePerMeter.FactoryHeatMeters()); - Factories.Add(new Output.FileWriters.Xml.FactorySingle()); - Factories.Add(new Output.FileWriters.Xml.FactoryCompound()); - Factories.Add(new Output.FileWriters.Xml.FactoryHeatMeters()); - Factories.Add(new Output.FileWriters.XmlBatch.FactorySingle()); - Factories.Add(new Output.Printers.Enhanced.FactorySingle()); - Factories.Add(new Output.Printers.Enhanced.FactoryCompound()); - Factories.Add(new Output.Printers.Enhanced.FactoryHeatMeters()); - Factories.Add(new Output.Printers.Label.Factory()); - Factories.Add(new Output.Printers.MultiLabel.Factory()); - Factories.Add(new Output.Printers.OnePerBatch.Factory()); - Factories.Add(new Output.Printers.OnePerMeter.FactorySingle()); - Factories.Add(new Output.Printers.OnePerMeter.FactoryCompound()); - Factories.Add(new Output.Printers.OnePerMeter.FactoryHeatMeters()); - Factories.Add(new Output.Printers.Zapiska.FactorySingle()); - Factories.Add(new Output.Printers.Zapiska.FactoryCompound()); - Factories.Add(new Output.Printers.Zapiska.FactoryHeatMeters()); - Factories.Add(new BuiltIn.Pump.PumpFactory()); - Factories.Add(new Danfoss.VLT2800.PumpFactory()); - Factories.Add(new BuiltIn.PumpTandem.PumpFactory()); - Factories.Add(new RegisterReaders.DataStream.MefImport.Factory()); /// 'Interface for data stream stream via MEF' - Factories.Add(new RegisterReaders.DataStream.Reader.Factory()); /// 'RegisterReader for data stream stream via MEF' - Factories.Add(new RegisterReaders.PulsesFromUniCB.Factory()); /// 'RegisterReader' - Factories.Add(new RegisterReaders.StandingStartStop.Factory()); /// 'RegisterReader for standing start/stop' - Factories.Add(new TestMethods.iPerlCommunication.iPerlHead.Factory()); /// 'RegisterReader for iPerl' - Factories.Add(new RegisterReaders.S640Stream.Factory()); /// 'RegisterReader for S640' - Factories.Add(new RegisterReaders.SerialStream.Factory()); /// 'RegisterReader for generic serial stream' - Factories.Add(new RegisterReaders.KPackE.RegisterReader.Factory()); /// KPackE register reader - Factories.Add(new RegisterReaders.KPackE.Radio.Factory()); /// Radio for KPackE register readers - Factories.Add(new Uni.RegValve.Factory()); - Factories.Add(new Uni.RegValveAnalog.Factory()); - Factories.Add(new Scales.MettlerToledo.Factory()); - Factories.Add(new TestMethods.Adjustment.Factory()); - Factories.Add(new TestMethods.ChangeFlowDirection.Factory()); - Factories.Add(new TestMethods.CombinedWithDetection.TestMethodFactory()); - Factories.Add(new TestMethods.Counter.Factory()); - Factories.Add(new TestMethods.DiverterTest.Factory()); - Factories.Add(new TestMethods.Dummy.Factory()); - Factories.Add(new TestMethods.Endurance.Factory()); - Factories.Add(new TestMethods.Evacuation.Factory()); - Factories.Add(new TestMethods.FixedStart.Single.Factory()); - Factories.Add(new TestMethods.FixedStart.Compound.Factory()); - Factories.Add(new TestMethods.FixedStart.HeatMeters.Factory()); - Factories.Add(new TestMethods.FixedStartAdvanced.Single.Factory()); - Factories.Add(new TestMethods.FixedStartDeferredEval.Single.Factory()); - Factories.Add(new TestMethods.FixedStartDeferredEval.Compound.Factory()); - Factories.Add(new TestMethods.FixedStartDeferredEval.HeatMeters.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollAdvanced.Single.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollAdvanced.Compound.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollAdvanced.HeatMeters.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.Single.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.Compound.Factory()); - Factories.Add(new TestMethods.FixedStartMassCollDeferredEval.HeatMeters.Factory()); - Factories.Add(new TestMethods.FixedStartTankCollection.Single.Factory()); - Factories.Add(new TestMethods.FixedStartTankCollection.Compound.Factory()); - Factories.Add(new TestMethods.FlowAdjustment.Factory()); - Factories.Add(new TestMethods.FlyingStart.Single.Factory()); - Factories.Add(new TestMethods.FlyingStart.Compound.Factory()); - Factories.Add(new TestMethods.FlyingStart.HeatMeters.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollection.Single.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollection.Compound.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollection.HeatMeters.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollComparative.Single.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollComparative.Compound.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollComparative.HeatMeters.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Single.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollProlonged.Compound.Factory()); - Factories.Add(new TestMethods.FlyingStartMassCollProlonged.HeatMeters.Factory()); - Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Single.Factory()); - Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.Compound.Factory()); - Factories.Add(new TestMethods.FlyingStartFirstRepetWithMassColl.HeatMeters.Factory()); - Factories.Add(new TestMethods.FlyingStartTankCollection.Single.Factory()); - Factories.Add(new TestMethods.FlyingStartTankCollection.Compound.Factory()); - Factories.Add(new TestMethods.GrabImage.Factory()); - Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication - Factories.Add(new TestMethods.LeakTest.Factory()); - Factories.Add(new TestMethods.LiveStream.Factory()); - Factories.Add(new TestMethods.ManualEntry.Factory()); - Factories.Add(new TestMethods.OuterLoop.Start.Factory()); - Factories.Add(new TestMethods.OuterLoop.End.Factory()); - Factories.Add(new TestMethods.PMaxTest.Factory()); - Factories.Add(new TestMethods.PulsesTest.Factory()); - Factories.Add(new TestMethods.PulsesTestManual.Factory()); - Factories.Add(new TestMethods.Q2CorrectionFromHistory.Factory()); - Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory()); - Factories.Add(new TestMethods.S640Communication.S640StartFactory()); - Factories.Add(new TestMethods.S640Communication.S640EndFactory()); - Factories.Add(new TestMethods.SensitivityTest.Factory()); - Factories.Add(new TestMethods.StandingStart.Single.Factory()); - Factories.Add(new TestMethods.StandingStart.Compound.Factory()); - Factories.Add(new TestMethods.StandingStart.HeatMeters.Factory()); - Factories.Add(new TestMethods.StandingStartMassCollection.Single.Factory()); - Factories.Add(new TestMethods.StandingStartMassCollection.Compound.Factory()); - Factories.Add(new TestMethods.StandingStartMassCollection.HeatMeters.Factory()); - Factories.Add(new TestMethods.StandingStartMassCollWODiv.Factory()); - Factories.Add(new BuiltIn.Valve.ValveFactory()); - Factories.Add(new BuiltIn.ValveEx.ValveFactory()); - Factories.Add(new Various.Clamping.Factory()); - Factories.Add(new Various.CoverTest.Factory()); - Factories.Add(new Various.Drawing.Junction.Factory()); - Factories.Add(new Various.Drawing.Knee.Factory()); - Factories.Add(new Various.Drawing.Pipes.Factory()); - Factories.Add(new Various.Drawing.Tank.Factory()); - Factories.Add(new Various.Drawing.Vacuum.Factory()); - Factories.Add(new Various.EmergencyStop.Factory()); - Factories.Add(new Various.ErrorFlags.Factory()); - Factories.Add(new Various.StatisticsMonitoring.Factory()); - Factories.Add(new Various.TankWithLevelMsrmnt.Factory()); - Factories.Add(new WaterMeters.WaterMeter.WaterMeterFactory()); /// 'WaterMeter' - + static TbfComponents() + { + Factories = new List() + { + new Ambient.Comet.Factory(), + new Ambient.Greco.Factory(), + new ControlBoard.Papouch.Factory(), + new ControlBoard.Uni.Factory(), + new DataContainer.BackupAndSecurityOptions.Factory(), + new DataContainer.BenchInfo.Factory(), + new DataContainer.Buoyancy.Factory(), + new DataContainer.Density.Factory(), + new DataContainer.Evaporation.Factory(), + new DataContainer.iPerlBenchInfo.Factory(), + new DataEntry.Combined.EntryFormFactory(), + new DataEntry.HeatMeters6.Factory(), + new DataEntry.HeatMeters12.Factory(), + new DataEntry.iPerl.Factory(), + new DataEntry.S620.Factory(), + new DataEntry.Single.Factory(), + new DataEntry.Single.FactoryNoStartEnd(), + new DataEntry.Standard6.Factory(), + new DataEntry.Standard6.FactoryNoStartEnd(), + new DataEntry.Standard12.Factory(), + new DataEntry.Standard12.FactoryNoStartEnd(), + new DataEntry.Standard24.Factory(), + new DataEntry.Standard24.FactoryNoStartEnd(), + new DataEntry.Standard48.Factory(), + new DataEntry.Standard48.FactoryNoStartEnd(), + new DataEntry.StandardCamera.Factory(), + new DataEntry.Uni.Factory(), + new DataEntry.Uni.FactoryNoStartEnd(), + new RegisterReaders.KPackE.DataEntryForRadio.Factory(), /// DataEntry for KPackE radio + new Uni.Diverter.Factory(), + new Dummy.Balance.Factory(), + new Dummy.Diverter.Factory(), + new Dummy.FlowMeter.Factory(), + new Dummy.RegValve.Factory(), + new Dummy.TempControl.Factory(), + new Dummy.Valve.Factory(), + new Uni.FlowMeter.Factory(), + new Uni.FlowMetersInParallel.Factory(), + new Hart.Common.Factory(), + new Hart.Nivotrack.Factory(), + new Keithley.Multimeter_2010_RS232.Factory(), /// Keithley.Multimeter_2010_RS232 + new Keithley.TempMeter.Factory(), /// Keithley.TempMeter + new Modbus.Common.Factory(), /// Modbus + new Modbus.Ambient.Comet.Factory(), /// Comet Ambient temp./pressure/humidity measurement via a modbus on a PC + new Modbus.PressureMeter.Meret.Factory(), /// Meret pressure meter connected via a modbus on a PC + new Modbus.PumpFM.DanfossVLT.Factory(), /// Pump controlled by Danfoss VLT connected via Modbus + new Modbus.QuidoRS.Factory(), /// Modbus.QuidoRS + new Modbus.TankSelector.Factory(), /// Modbus.TankSelector + new Modbus.TempControl.Easytherm.Factory(), + new Modbus.TempControl.Novus.Factory(), + new Modbus.TempMeter.Groch.Factory(), /// Groch temperature meter connected via a modbus on a PC + new Modbus.TempMeter.Meret.Factory(), /// Meret temperature meter connected via a modbus on a PC + new Modbus.UltrasoundLevelMeter.Factory(), + new Modbus.WaterAnalyzer.Factory(), + new Network.Adapter.Factory(), + new Network.Camera.CLP1611.Factory(), + new Network.Camera.Display.Factory(), + new Network.Camera.Roi.Factory(), + new Network.Camera.RoiForFixedStart.Factory(), + new Network.Comet.Ambient.Factory(), + new Output.DB.ProductionTracing.Factory(), + new Output.DB.SaveDiverterCorrections.Factory(), + new Output.DB.SaveFlowmeterCorrections.Factory(), + new Output.DB.SensusOracle.Factory(), + new Output.EventTriggers.Iperl.Factory(), + new Output.EventTriggers.Standard.Factory(), + new Output.FileWriters.Basic.FactorySingle(), + new Output.FileWriters.Basic.FactoryCompound(), + new Output.FileWriters.Basic.FactoryHeatMeters(), + new Output.FileWriters.Elde.FactorySingle(), + new Output.FileWriters.Enhanced.FactorySingle(), + new Output.FileWriters.Enhanced.FactoryCompound(), + new Output.FileWriters.Enhanced.FactoryHeatMeters(), + new Output.FileWriters.ImageArchiver.Factory(), + new Output.FileWriters.IperlLogger.Factory(), + new Output.FileWriters.OneFilePerMeter.FactorySingle(), + new Output.FileWriters.OneFilePerMeter.FactoryCompound(), + new Output.FileWriters.OneFilePerMeter.FactoryHeatMeters(), + new Output.FileWriters.Xml.FactorySingle(), + new Output.FileWriters.Xml.FactoryCompound(), + new Output.FileWriters.Xml.FactoryHeatMeters(), + new Output.FileWriters.XmlBatch.FactorySingle(), + new Output.Printers.Enhanced.FactorySingle(), + new Output.Printers.Enhanced.FactoryCompound(), + new Output.Printers.Enhanced.FactoryHeatMeters(), + new Output.Printers.Label.Factory(), + new Output.Printers.MultiLabel.Factory(), + new Output.Printers.OnePerBatch.Factory(), + new Output.Printers.OnePerMeter.FactorySingle(), + new Output.Printers.OnePerMeter.FactoryCompound(), + new Output.Printers.OnePerMeter.FactoryHeatMeters(), + new Output.Printers.Zapiska.FactorySingle(), + new Output.Printers.Zapiska.FactoryCompound(), + new Output.Printers.Zapiska.FactoryHeatMeters(), + new BuiltIn.Pump.PumpFactory(), + new Danfoss.VLT2800.PumpFactory(), + new BuiltIn.PumpTandem.PumpFactory(), + new RegisterReaders.DataStream.MefImport.Factory(), /// 'Interface for data stream stream via MEF' + new RegisterReaders.DataStream.Reader.Factory(), /// 'RegisterReader for data stream stream via MEF' + new RegisterReaders.PulsesFromUniCB.Factory(), /// 'RegisterReader' + new RegisterReaders.StandingStartStop.Factory(), /// 'RegisterReader for standing start/stop' + new TestMethods.iPerlCommunication.iPerlHead.Factory(), /// 'RegisterReader for iPerl' + new RegisterReaders.S640Stream.Factory(), /// 'RegisterReader for S640' + new RegisterReaders.SerialStream.Factory(), /// 'RegisterReader for generic serial stream' + new RegisterReaders.KPackE.RegisterReader.Factory(), /// KPackE register reader + new RegisterReaders.KPackE.Radio.Factory(), /// Radio for KPackE register readers + new Uni.RegValve.Factory(), + new Uni.RegValveAnalog.Factory(), + new Scales.MettlerToledo.Factory(), + new TestMethods.Adjustment.Factory(), + new TestMethods.ChangeFlowDirection.Factory(), + new TestMethods.CombinedWithDetection.TestMethodFactory(), + new TestMethods.Counter.Factory(), + new TestMethods.DiverterTest.Factory(), + new TestMethods.Dummy.Factory(), + new TestMethods.Endurance.Factory(), + new TestMethods.Evacuation.Factory(), + new TestMethods.FixedStart.Single.Factory(), + new TestMethods.FixedStart.Compound.Factory(), + new TestMethods.FixedStart.HeatMeters.Factory(), + new TestMethods.FixedStartAdvanced.Single.Factory(), + new TestMethods.FixedStartDeferredEval.Single.Factory(), + new TestMethods.FixedStartDeferredEval.Compound.Factory(), + new TestMethods.FixedStartDeferredEval.HeatMeters.Factory(), + new TestMethods.FixedStartMassCollAdvanced.Single.Factory(), + new TestMethods.FixedStartMassCollAdvanced.Compound.Factory(), + new TestMethods.FixedStartMassCollAdvanced.HeatMeters.Factory(), + new TestMethods.FixedStartMassCollDeferredEval.Single.Factory(), + new TestMethods.FixedStartMassCollDeferredEval.Compound.Factory(), + new TestMethods.FixedStartMassCollDeferredEval.HeatMeters.Factory(), + new TestMethods.FixedStartTankCollection.Single.Factory(), + new TestMethods.FixedStartTankCollection.Compound.Factory(), + new TestMethods.FlowAdjustment.Factory(), + new TestMethods.FlyingStart.Single.Factory(), + new TestMethods.FlyingStart.Compound.Factory(), + new TestMethods.FlyingStart.HeatMeters.Factory(), + new TestMethods.FlyingStartMassCollection.Single.Factory(), + new TestMethods.FlyingStartMassCollection.Compound.Factory(), + new TestMethods.FlyingStartMassCollection.HeatMeters.Factory(), + new TestMethods.FlyingStartMassCollComparative.Single.Factory(), + new TestMethods.FlyingStartMassCollComparative.Compound.Factory(), + new TestMethods.FlyingStartMassCollComparative.HeatMeters.Factory(), + new TestMethods.FlyingStartMassCollProlonged.Single.Factory(), + new TestMethods.FlyingStartMassCollProlonged.Compound.Factory(), + new TestMethods.FlyingStartMassCollProlonged.HeatMeters.Factory(), + new TestMethods.FlyingStartFirstRepetWithMassColl.Single.Factory(), + new TestMethods.FlyingStartFirstRepetWithMassColl.Compound.Factory(), + new TestMethods.FlyingStartFirstRepetWithMassColl.HeatMeters.Factory(), + new TestMethods.FlyingStartTankCollection.Single.Factory(), + new TestMethods.FlyingStartTankCollection.Compound.Factory(), + new TestMethods.GrabImage.Factory(), + new TestMethods.iPerlCommunication.TestMethodFactory(), /// iPerlCommunication + new TestMethods.LeakTest.Factory(), + new TestMethods.LiveStream.Factory(), + new TestMethods.ManualEntry.Factory(), + new TestMethods.OuterLoop.Start.Factory(), + new TestMethods.OuterLoop.End.Factory(), + new TestMethods.PMaxTest.Factory(), + new TestMethods.PulsesTest.Factory(), + new TestMethods.PulsesTestManual.Factory(), + new TestMethods.Q2CorrectionFromHistory.Factory(), + new TestMethods.RoiDetection.RoiDetectionFactory(), + new TestMethods.S640Communication.S640StartFactory(), + new TestMethods.S640Communication.S640EndFactory(), + new TestMethods.SensitivityTest.Factory(), + new TestMethods.StandingStart.Single.Factory(), + new TestMethods.StandingStart.Compound.Factory(), + new TestMethods.StandingStart.HeatMeters.Factory(), + new TestMethods.StandingStartMassCollection.Single.Factory(), + new TestMethods.StandingStartMassCollection.Compound.Factory(), + new TestMethods.StandingStartMassCollection.HeatMeters.Factory(), + new TestMethods.StandingStartMassCollWODiv.Factory(), + new BuiltIn.Valve.ValveFactory(), + new BuiltIn.ValveEx.ValveFactory(), + new Various.Clamping.Factory(), + new Various.CoverTest.Factory(), + new Various.Drawing.Junction.Factory(), + new Various.Drawing.Knee.Factory(), + new Various.Drawing.Pipes.Factory(), + new Various.Drawing.Tank.Factory(), + new Various.Drawing.Vacuum.Factory(), + new Various.EmergencyStop.Factory(), + new Various.ErrorFlags.Factory(), + new Various.StatisticsMonitoring.Factory(), + new Various.TankWithLevelMsrmnt.Factory(), + new WaterMeters.WaterMeter.WaterMeterFactory(), /// 'WaterMeter' #if OBSOLETE - /// Obsolete components - Factories.Add(new MettlerToledo.Standard.BalanceFactory()); /// MettlerToledo Balance - Factories.Add(new MettlerToledo.Standard.BalanceOldFactory()); /// MettlerToledoBalanceOld - Factories.Add(new MettlerToledo.Standard.BalanceNewFactory()); /// MettlerToledoBalanceSN + /// Obsolete components + new MettlerToledo.Standard.BalanceFactory(), /// MettlerToledo Balance + new MettlerToledo.Standard.BalanceOldFactory(), /// MettlerToledoBalanceOld + new MettlerToledo.Standard.BalanceNewFactory(), /// MettlerToledoBalanceSN #endif + }; } /// @@ -320,12 +321,9 @@ namespace TBF.Rig /// Matching component or null public static IComponent FindComponent(string name, IList components) { - if (string.IsNullOrEmpty(name)) return null; - foreach (var cmpnt in components) - { - if (cmpnt.Cfg.Name.Equals(name)) return cmpnt; - } - return null; + if (string.IsNullOrEmpty(name) || components == null) return null; + + return components.FirstOrDefault(x => x.Name == name); } public static IComponent FindComponent(string name) diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs index cac37cb3b..898cad9b7 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.Designer.cs @@ -37,6 +37,7 @@ this.upgradeDb_304_305_Button = new System.Windows.Forms.Button(); this.upgradeDb_305_306_Button = new System.Windows.Forms.Button(); this.upgradeDb_306_307_Button = new System.Windows.Forms.Button(); + this.upgradeDb_307_308_Button = new System.Windows.Forms.Button(); this.SuspendLayout(); // // upgradeConfigDBCheckBox @@ -130,11 +131,22 @@ this.upgradeDb_306_307_Button.UseVisualStyleBackColor = true; this.upgradeDb_306_307_Button.Click += new System.EventHandler(this.upgradeDb_306_307_Button_Click); // + // upgradeDb_307_308_Button + // + this.upgradeDb_307_308_Button.Location = new System.Drawing.Point(12, 214); + this.upgradeDb_307_308_Button.Name = "upgradeDb_307_308_Button"; + this.upgradeDb_307_308_Button.Size = new System.Drawing.Size(260, 22); + this.upgradeDb_307_308_Button.TabIndex = 29; + this.upgradeDb_307_308_Button.Text = "Upgrade DB from v.3.7 to v.3.8"; + this.upgradeDb_307_308_Button.UseVisualStyleBackColor = true; + this.upgradeDb_307_308_Button.Click += new System.EventHandler(this.upgradeDb_307_308_Button_Click); + // // UpgradeSelectionDlg // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(284, 597); + this.Controls.Add(this.upgradeDb_307_308_Button); this.Controls.Add(this.upgradeDb_306_307_Button); this.Controls.Add(this.upgradePipesButton); this.Controls.Add(this.upgradeDb_305_306_Button); @@ -162,5 +174,6 @@ private System.Windows.Forms.Button upgradeDb_304_305_Button; private System.Windows.Forms.Button upgradeDb_305_306_Button; private System.Windows.Forms.Button upgradeDb_306_307_Button; + private System.Windows.Forms.Button upgradeDb_307_308_Button; } } \ No newline at end of file diff --git a/TBF/UI/Settings/UpgradeSelectionDlg.cs b/TBF/UI/Settings/UpgradeSelectionDlg.cs index f64960177..4d5dbd574 100644 --- a/TBF/UI/Settings/UpgradeSelectionDlg.cs +++ b/TBF/UI/Settings/UpgradeSelectionDlg.cs @@ -414,5 +414,33 @@ namespace TBF.UI.Settings upgradeDb_306_307_Button.Enabled = false; } } + + private void upgradeDb_307_308_Button_Click(object sender, EventArgs e) + { + string[] configDbCommands = new string[] + { + "ALTER TABLE `test` ADD `IsFromToInPct` BOOLEAN NOT NULL DEFAULT FALSE AFTER `Qto`;", + }; + + string[] resultsDbCommands = new string[] { }; + + if (!upgradeConfigDBCheckBox.Checked && !upgradeResultsDBCheckBox.Checked) + { + MessageBox.Show("No database selected"); + return; + } + + ActivityStart(); + + if ((!upgradeConfigDBCheckBox.Checked || configDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(TBF.DB.CurrentBench.ProceduresDBSettings.ConnectionString), configDbCommands)) && + (!upgradeResultsDBCheckBox.Checked || resultsDbCommands.Length == 0 || + ExecuteCommands(new MySqlConnection(Results.DB.ConnectionString), resultsDbCommands))) + { + ActivityEnd(); + MessageBox.Show("DB succesfully upgraded", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); + upgradeDb_307_308_Button.Enabled = false; + } + } } }