diff --git a/Config/Entities/Enums.cs b/Config/Entities/Enums.cs index a991968c1..fd0b00e4c 100644 --- a/Config/Entities/Enums.cs +++ b/Config/Entities/Enums.cs @@ -327,6 +327,27 @@ namespace Config.Entities Count } + /// + /// Three state test results and/or water meter result (Algeria PT25 requirement). + /// NearlyOK means error is within error limits not narrowed by uncertainty + /// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty + /// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi + /// Nok: otherwise + /// + public enum ThreeState + { +#if LANG_FR + [Description("NC")] Nok, /// Totally failed: not OK and not NearlyOK + [Description("2e/Ff")] NearlyOK, /// Nearly OK, not OK but not totally failed + [Description("***")] OK, /// OK +#else + [Description("NOK")] Nok, /// Totally failed: not OK and not NearlyOK + [Description("Nearly OK")] NearlyOK, /// Nearly OK, not OK but not totally failed + [Description("OK")] OK, /// OK +#endif + Count + } + public enum TestProfile { UserDefined, diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index 367f3170b..e55fb988a 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.25.1427.0")] -[assembly: AssemblyFileVersion("2.25.1427.0")] +[assembly: AssemblyVersion("2.25.1440.0")] +[assembly: AssemblyFileVersion("2.25.1440.0")] diff --git a/Config/Units.cs b/Config/Units.cs index bf286e395..ab0adffe5 100644 --- a/Config/Units.cs +++ b/Config/Units.cs @@ -202,6 +202,7 @@ namespace Config [Description("String")] String, [Description("Boolean")] Boolean, [Description("Date and time")] DateTime, + [Description("Enum")] Enum, #endif Count, } diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index 452af75d7..0437060b8 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -206,6 +206,38 @@ namespace Results.Entities return passed; } + /// + /// Three state test results and/or water meter result (Algeria PT25 requirement). + /// NearlyOK means error is within error limits not narrowed by uncertainty + /// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty + /// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi + /// Nok: otherwise + /// + public virtual ThreeState ThreeStateFromTests() + { + ThreeState result = ThreeState.OK; + if (ErrorFlagsFromTestsAndWM() != 0) result = ThreeState.Nok; + + foreach (var mtr in MeterTestRslts) + { + if (mtr.Evaluate()) + { + if(!mtr.TestDone || mtr.Error < mtr.ErrLimLo() || mtr.Error > mtr.ErrLimHi()) + { + /// Test was not done or completely failed (was outside broader error limits) + result = ThreeState.Nok; + } + else if (result == ThreeState.OK && (mtr.Error < mtr.ErrLimLo() + mtr.Uncertainty() || mtr.Error > mtr.ErrLimHi() - mtr.Uncertainty())) + { + /// So far the water meter was OK, but this test was outside narrow error limits (= limits shrinked by Uncertainty) + result = ThreeState.NearlyOK; + } + } + } + + return result; + } + public virtual bool CompletedFromTests() { bool completed = true; diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 149c1f463..7d0be2d38 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -318,6 +318,8 @@ namespace Results TimeBtwnMassMsrmnts, /// 270 TestTimeCorrection, /// 271 + ThreeState, /// 272 + Count, } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 475836578..80bcb247c 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.25.1434.0")] -[assembly: AssemblyFileVersion("2.25.1434.0")] +[assembly: AssemblyVersion("2.25.1440.0")] +[assembly: AssemblyFileVersion("2.25.1440.0")] diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 8d0c0d7e7..6035dc568 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -326,6 +326,8 @@ namespace Results AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f) : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f)))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests()))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty)); AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result @@ -601,6 +603,21 @@ namespace Results } } + public static string FormatThreeState(string format, ThreeState value) + { + if (string.IsNullOrEmpty(format)) + { + return value.ToDescription(); + } + else + { + string[] okNearlyokNok = format.Split(new char[] { '~' }); + return (value == ThreeState.OK) ? okNearlyokNok[0] + : (value == ThreeState.NearlyOK) ? ((okNearlyokNok.Length >= 2) ? okNearlyokNok[1] : ThreeState.NearlyOK.ToDescription()) + : ((okNearlyokNok.Length >= 3) ? okNearlyokNok[2] : ThreeState.Nok.ToDescription()); + } + } + public static string FormatEnum(string format, int value) { if (string.IsNullOrEmpty(format)) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 4e836e7ac..93e9717ef 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.25.1437.0")] -[assembly: AssemblyFileVersion("2.25.1437.0")] +[assembly: AssemblyVersion("2.25.1440.0")] +[assembly: AssemblyFileVersion("2.25.1440.0")]