ThreeState water meter result printing (Algeria PT25), ver. 2.25.1440
This commit is contained in:
parent
dffaa1d3a8
commit
e071ae3cc0
@ -327,6 +327,27 @@ namespace Config.Entities
|
||||
Count
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
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,
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -202,6 +202,7 @@ namespace Config
|
||||
[Description("String")] String,
|
||||
[Description("Boolean")] Boolean,
|
||||
[Description("Date and time")] DateTime,
|
||||
[Description("Enum")] Enum,
|
||||
#endif
|
||||
Count,
|
||||
}
|
||||
|
||||
@ -206,6 +206,38 @@ namespace Results.Entities
|
||||
return passed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
@ -318,6 +318,8 @@ namespace Results
|
||||
TimeBtwnMassMsrmnts, /// 270
|
||||
TestTimeCorrection, /// 271
|
||||
|
||||
ThreeState, /// 272
|
||||
|
||||
Count,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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")]
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user