diff --git a/Config/Properties/AssemblyInfo.cs b/Config/Properties/AssemblyInfo.cs index 0eadeb5a0..9d98801b4 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.16.642.0")] -[assembly: AssemblyFileVersion("2.16.642.0")] +[assembly: AssemblyVersion("2.17.674.0")] +[assembly: AssemblyFileVersion("2.17.674.0")] diff --git a/Results/Entities/TestRslt.cs b/Results/Entities/TestRslt.cs index 0af8dab95..1c40d85ed 100644 --- a/Results/Entities/TestRslt.cs +++ b/Results/Entities/TestRslt.cs @@ -39,7 +39,9 @@ namespace Results.Entities public virtual double VolumeCTV { get; set; } /// [l] Volume conventional true value public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter public virtual double ErrorMaster { get; set; } /// [%] - public virtual int ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc. + public virtual int DiverterStart { get; set; } /// [ms] Diverter switch time on test start + public virtual int DiverterEnd { get; set; } /// [ms] Diverter switch time on test end + public virtual int ErrorFlags { get; set; } /// bitfield : bit0=E1, bit1=E2, bit2=E3, etc. public virtual sbyte ErrorFlagsMd { get; set; } /// 0=off, 1=info, 2=on (evaluated in MeterTestRslt.Passed) /// Main results of heat meters diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index b662772bf..d4a2da483 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -50,8 +50,7 @@ namespace Results.Entities public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter public virtual double QRise { get; set; } /// [m3/h] detected Q_rise of a composed meter public virtual double QFall { get; set; } /// [m3/h] detected Q_fall of a composed meter - //public virtual int ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16 - //public virtual sbyte ErrorFlagsMd { get; set; } /// 0=off, 1=info, 2=on (evaluated in MeterTestRslt.Passed) + public virtual int ErrorFlags { get; set; } /// bitfield : bit14=E15, bit15=E16 public virtual bool Passed { get; set; } public virtual int ResultCode { get; set; } public virtual string ArchivePath { get; set; } @@ -111,24 +110,39 @@ namespace Results.Entities public virtual MeterTestRslt LastMeterTestRslts() { return lastMeterTestRslts; } - public virtual int ErrorFlagsFromTests() + public virtual int ErrorFlagsFromTests(out ErrorFlagsMode errorFlagsMode) { int errorFlags = 0; + ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off; foreach (var mtr in MeterTestRslts) { if (mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags; + if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode(); } + errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On) return errorFlags; } + public virtual int ErrorFlagsFromTestsAndWM(out ErrorFlagsMode errorFlagsMode) + { + int eFlagsFromTests = ErrorFlagsFromTests(out errorFlagsMode) | ErrorFlags; + return (errorFlagsMode != ErrorFlagsMode.Off) ? (eFlagsFromTests | ErrorFlags) : 0; + } + public virtual string ErrorFlagstStr() { - return Utils.ErrorFlagsStr(ErrorFlagsFromTests()); + ErrorFlagsMode errorFlagsMode; + return Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode)); } public virtual bool PassedFromTests() { + ErrorFlagsMode eFlagsMode; + int eFlags = ErrorFlagsFromTestsAndWM(out eFlagsMode); + bool passed = true; + if (eFlagsMode == ErrorFlagsMode.On && eFlags != 0) passed = false; + foreach (var mtr in MeterTestRslts) { if (mtr.Evaluate() && (!mtr.Passed || !mtr.TestDone)) @@ -137,6 +151,7 @@ namespace Results.Entities break; } } + return passed; } diff --git a/Results/Mappings/TestRsltMap.cs b/Results/Mappings/TestRsltMap.cs index af765ff7b..e5821887b 100644 --- a/Results/Mappings/TestRsltMap.cs +++ b/Results/Mappings/TestRsltMap.cs @@ -40,7 +40,9 @@ namespace Results.Mappings Map(x => x.VolumeCTV); Map(x => x.VolumeMaster); Map(x => x.ErrorMaster); - Map(x => x.ErrorFlags); + Map(x => x.DiverterStart); + Map(x => x.DiverterEnd); + Map(x => x.ErrorFlags); Map(x => x.ErrorFlagsMd); #if HEAT_METERS Map(x => x.RefEnergy); diff --git a/Results/Mappings/WaterMeterMap.cs b/Results/Mappings/WaterMeterMap.cs index b810b1b43..d13b5d792 100644 --- a/Results/Mappings/WaterMeterMap.cs +++ b/Results/Mappings/WaterMeterMap.cs @@ -20,6 +20,7 @@ namespace Results.Mappings Map(x => x.EndStateAux); Map(x => x.QRise); Map(x => x.QFall); + Map(x => x.ErrorFlags); Map(x => x.Passed); Map(x => x.ResultCode); Map(x => x.ArchivePath); diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index c1ae7d027..bd8cd28ed 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.16.673.0")] -[assembly: AssemblyFileVersion("2.16.673.0")] +[assembly: AssemblyVersion("2.17.674.0")] +[assembly: AssemblyFileVersion("2.17.674.0")] diff --git a/TestBenchFramework/BenchControl/GenericDevices/IErrorFlags.cs b/TestBenchFramework/BenchControl/GenericDevices/IErrorFlags.cs index b304de1ea..ea449590d 100644 --- a/TestBenchFramework/BenchControl/GenericDevices/IErrorFlags.cs +++ b/TestBenchFramework/BenchControl/GenericDevices/IErrorFlags.cs @@ -2,6 +2,7 @@ /// Copyright (c) 2017 Sensus Metering Systems /// using System; +using System.Collections.Generic; using TBF.BenchControl.Generic; using Results.Entities; @@ -11,10 +12,22 @@ namespace TBF.BenchControl.GenericDevices { Config.Entities.ErrorFlagsMode Mode { get; } - int GetErrorFlags(TestRslt testRslt, bool getE9E10, bool getE11E12, int switchTimeStart, int switchTimeEnd); + /// + /// Ger error flags for a test + /// + /// A valid test result + /// true = diverter was used (times apply) + /// true = start/stop valve was used (times apply) + /// Test start switch time in ms + /// Test end switch time in ms + /// Error flags + int GetErrorFlags(TestRslt testRslt, bool diverter, bool startStopValve, int switchTimeStart, int switchTimeEnd); - int GetE15(MeterTestRslt mtrQ3, MeterTestRslt mtrQ2, MeterTestRslt mtrQ1); /// Return value is either 0 (=OK) or 0x4000 (=E15), it should be OR-ed with error flags - - int GetE16(MeterTestRslt mtrQ3, MeterTestRslt mtrQ2, MeterTestRslt mtrQ1); /// Return value is either 0 (=OK) or 0x8000 (=E16), it should be OR-ed with error flags + /// + /// Get water meter error flags (evaluated from all meter test results) + /// + /// Meter test results + /// Error flags + int GetWMtrErrorFlags(IList meterTestRslts); } } diff --git a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs index 88d0bc22f..f8ef7cc77 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Adjustment/AdjustmentSeq.cs @@ -343,7 +343,9 @@ namespace TBF.BenchControl.TestMethods.Adjustment tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = 0; + tstRslt.DiverterEnd = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0; for (int i = 0; i < BatchRslts.WMPositionsCount; i++) @@ -381,6 +383,15 @@ namespace TBF.BenchControl.TestMethods.Adjustment outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs index fda89f2b4..ff240a2fd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/CombinedWithDetection/CombinedWithDetectionSeq.cs @@ -638,7 +638,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = switchTimeStart; + tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, switchTimeStart, switchTimeEnd) : 0; for (int i = 0; i < BatchRslts.WMPositionsCount; i++) @@ -707,7 +709,16 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); - /// Update results + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs index 7670547b4..5dd379cde 100644 --- a/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/Endurance/EnduranceSeq.cs @@ -360,7 +360,9 @@ namespace TBF.BenchControl.TestMethods.Endurance tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = 0; + tstRslt.DiverterEnd = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0; /// @@ -437,6 +439,15 @@ namespace TBF.BenchControl.TestMethods.Endurance outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs index 94417085e..268df1ba1 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartAdvanced/FixedStartAdvancedSeq.cs @@ -533,7 +533,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = switchTimeStart; + tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd) : 0; for (int i = 0; i < BatchRslts.WMPositionsCount; i++) @@ -572,7 +574,16 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); - /// Update results + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index b228bd549..b813fa3d8 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -886,7 +886,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = switchTimeStart; + tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, true, switchTimeStart, switchTimeEnd) : 0; if (compound) @@ -1050,6 +1052,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 89a90c522..c40405db2 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -468,7 +468,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStart tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = 0; + tstRslt.DiverterEnd = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0; if (compoundTestParams != null) @@ -635,7 +637,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStart outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); - /// Update results + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index b87e77d18..4b30b46aa 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -799,7 +799,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = switchTimeStart; + tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, switchTimeStart, switchTimeEnd) : 0; if (compoundTestParams != null) @@ -1017,6 +1019,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs index 566045fd3..105763dad 100644 --- a/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/LeakTest/LeakTestSeq.cs @@ -304,6 +304,9 @@ namespace TBF.BenchControl.TestMethods.LeakTest tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h] tstRslt.ErrorMaster = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.ErrorFlags = 0; + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) { if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue; @@ -361,7 +364,7 @@ namespace TBF.BenchControl.TestMethods.LeakTest outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); - /// Update results + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs index ba1658284..c9efaf86c 100644 --- a/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/PMaxTest/PMaxTestSeq.cs @@ -215,6 +215,9 @@ namespace TBF.BenchControl.TestMethods.PMaxTest tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h] tstRslt.ErrorMaster = 0; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.ErrorFlags = 0; + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) { if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue; diff --git a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs index 5b36d57c7..b77b0a979 100644 --- a/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/ReferenceFlowmeterCalibration/ReferenceFlowmeterCalibrationSeq.cs @@ -340,7 +340,9 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration tstRslt.FlowMin = (float)RefFlowStat.Min; tstRslt.FlowMax = (float)RefFlowStat.Max; - tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; + tstRslt.DiverterStart = switchTimeStart; + tstRslt.DiverterEnd = switchTimeEnd; + tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0; tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, true, false, switchTimeStart, switchTimeEnd) : 0; /// Update flowmeter constant with the measured one @@ -360,7 +362,16 @@ namespace TBF.BenchControl.TestMethods.ReferenceFlowmeterCalibration outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty, outPath.Diverter != null ? outPath.Diverter.Name : string.Empty)); - /// Update results + /// Update water meter error flags + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + { + if (BatchRslts.WaterMeters[i] != null) + { + BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts); + } + } + + /// Update results Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt)); } diff --git a/TestBenchFramework/BenchControl/Various/ErrorFlags/Errors.cs b/TestBenchFramework/BenchControl/Various/ErrorFlags/Errors.cs index a96bc6ded..98366b0a0 100644 --- a/TestBenchFramework/BenchControl/Various/ErrorFlags/Errors.cs +++ b/TestBenchFramework/BenchControl/Various/ErrorFlags/Errors.cs @@ -24,8 +24,16 @@ namespace TBF.BenchControl.Various.ErrorFlags readonly ErrorsCfg errorsCfg; public Config.Entities.ErrorFlagsMode Mode { get { return errorsCfg.TestParams.Mode; } } - - public int GetErrorFlags(TestRslt testRslt, bool getE9E10, bool getE11E12, int switchTimeStart, int switchTimeEnd) + /// + /// Ger error flags for a test + /// + /// A valid test result + /// true = diverter was used (times apply) + /// true = start/stop valve was used (times apply) + /// Test start switch time in ms + /// Test end switch time in ms + /// Error flags + public int GetErrorFlags(TestRslt testRslt, bool diverter, bool startStopValve, int switchTimeStart, int switchTimeEnd) { if (Mode == Config.Entities.ErrorFlagsMode.Off) { @@ -67,7 +75,7 @@ namespace TBF.BenchControl.Various.ErrorFlags bool E9 = false; bool E10 = false; - if (getE9E10) + if (diverter) { E9 = ((double)Math.Abs(switchTimeStart - switchTimeEnd) > errorsCfg.TestParams.Coef_E9 * (switchTimeStart + switchTimeEnd)); E10 = ((double)(switchTimeStart + switchTimeEnd) > errorsCfg.TestParams.Coef_E10 * 1000.0 * testRslt.TestTime); @@ -75,7 +83,7 @@ namespace TBF.BenchControl.Various.ErrorFlags bool E11 = false; bool E12 = false; - if (getE11E12) + if (startStopValve) { E11 = ((double)(switchTimeStart + switchTimeEnd) > errorsCfg.TestParams.Coef_E11 * 1000.0 * testRslt.TestTime); E12 = ((double)Math.Abs(switchTimeStart - switchTimeEnd) > errorsCfg.TestParams.Coef_E12 * (switchTimeStart + switchTimeEnd)); @@ -91,9 +99,6 @@ namespace TBF.BenchControl.Various.ErrorFlags || ProcessData.PressDownStat.Min < errorsCfg.TestParams.Pressure_min || ProcessData.PressDownStat.Max > errorsCfg.TestParams.Pressure_max; - bool E15 = false; - bool E16 = false; - int ErrorFlags = 0; if (errorsCfg.TestParams.E1 && E1) ErrorFlags |= 0x0001; if (errorsCfg.TestParams.E2 && E2) ErrorFlags |= 0x0002; @@ -109,8 +114,6 @@ namespace TBF.BenchControl.Various.ErrorFlags if (errorsCfg.TestParams.E12 && E12) ErrorFlags |= 0x0800; if (errorsCfg.TestParams.E13 && E13) ErrorFlags |= 0x1000; if (errorsCfg.TestParams.E14 && E14) ErrorFlags |= 0x2000; - if (errorsCfg.TestParams.E15 && E15) ErrorFlags |= 0x4000; - if (errorsCfg.TestParams.E16 && E16) ErrorFlags |= 0x8000; return ErrorFlags; } @@ -130,41 +133,29 @@ namespace TBF.BenchControl.Various.ErrorFlags } /// - /// Returns 'true' when all three test were found and all three are 'TestDone' + /// Get water meter error flags E15 and E16 (evaluated from three meter test results) /// - /// - /// mtrQ3 or null - /// mtrQ2 or null - /// mtrQ1 or null - /// - public bool GetSelectedMtrs(IList meterTestRslts, out MeterTestRslt mtrQ3, out MeterTestRslt mtrQ2, out MeterTestRslt mtrQ1) + /// Meter test results + /// Error flags + public int GetWMtrErrorFlags(IList meterTestRslts) { - mtrQ3 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q3Names); - mtrQ2 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q2Names); - mtrQ1 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q1Names); + MeterTestRslt mtrQ3 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q3Names); + MeterTestRslt mtrQ2 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q2Names); + MeterTestRslt mtrQ1 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q1Names); - return (mtrQ3 != null && mtrQ3.TestDone && mtrQ2 != null && mtrQ2.TestDone && mtrQ1 != null && mtrQ1.TestDone); - } - - public int GetE15(MeterTestRslt mtrQ3, MeterTestRslt mtrQ2, MeterTestRslt mtrQ1) - { - if ((mtrQ3.Error > mtrQ3.ErrLimHi() / 2) && - (mtrQ2.Error > mtrQ2.ErrLimHi() / 2) && - (mtrQ1.Error > mtrQ1.ErrLimHi() / 2)) - { - return 0x4000; - } - else + if (mtrQ3 == null || !mtrQ3.TestDone || mtrQ2 == null || !mtrQ2.TestDone || mtrQ1 == null || !mtrQ1.TestDone) { return 0; } - } - - public int GetE16(MeterTestRslt mtrQ3, MeterTestRslt mtrQ2, MeterTestRslt mtrQ1) - { - if ((mtrQ3.Error < mtrQ3.ErrLimLo() / 2) && - (mtrQ2.Error < mtrQ2.ErrLimLo() / 2) && - (mtrQ1.Error < mtrQ1.ErrLimLo() / 2)) + else if ((mtrQ3.Error > mtrQ3.ErrLimHi() / 2) && + (mtrQ2.Error > mtrQ2.ErrLimHi() / 2) && + (mtrQ1.Error > mtrQ1.ErrLimHi() / 2)) + { + return 0x4000; + } + else if ((mtrQ3.Error < mtrQ3.ErrLimLo() / 2) && + (mtrQ2.Error < mtrQ2.ErrLimLo() / 2) && + (mtrQ1.Error < mtrQ1.ErrLimLo() / 2)) { return 0x8000; } @@ -174,20 +165,6 @@ namespace TBF.BenchControl.Various.ErrorFlags } } - public int GetErrorFlags(IList meterTestRslts) - { - MeterTestRslt mtrQ3, mtrQ2, mtrQ1; - int errorFlags = 0; - - if (GetSelectedMtrs(meterTestRslts, out mtrQ3, out mtrQ2, out mtrQ1)) - { - errorFlags |= GetE15(mtrQ3, mtrQ1, mtrQ1); - errorFlags |= GetE16(mtrQ3, mtrQ1, mtrQ1); - } - - return errorFlags; - } - public Errors() { diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index b0fd7e374..6e6d03508 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.16.673.1")] -[assembly: AssemblyFileVersion("2.16.673.1")] +[assembly: AssemblyVersion("2.17.674.1")] +[assembly: AssemblyFileVersion("2.17.674.1")]