diff --git a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs index 1ac14e461..c6e44ab5a 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FixedStartMassCollection/FixedStartMassCollectionSeq.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Sensus Metering Systems +/// Copyright (c) 2013-2016 Sensus Metering Systems /// using System; using System.Collections.Generic; @@ -186,7 +186,58 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection while (!e.Contains(Event.FlowReached)); flow_set: - int flowSetTime = StateMachine.Time - flowSetTime0; + + int flowSetTime = StateMachine.Time - flowSetTime0; + + if (heatMetersTestParams != null && heatMetersPath != null) + { + //--------------------------------------------------- + Bridge.OnActivity(this, Strings.Setting_temperature); + //--------------------------------------------------- + + int lastTimeSec = StateMachine.Time; + float Tw_last = 0; + float Tc_last = 0; + FloatBox Tw1 = new FloatBox(); + FloatBox Tw2 = new FloatBox(); + FloatBox Tc1 = new FloatBox(); + FloatBox Tc2 = new FloatBox(); + + State.Create("FixedStartMassCollection : Check temperature stabilized.") + .AddOperation(checkUiOp) + .AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref Tw1)) + .AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref Tw2)) + .AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref Tc1)) + .AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref Tc2)) + .EnterState(); + do + { + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Next)) goto temperature_set; + + if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0) + { + float Tw = (Tw1.Val + Tw2.Val) / 2.0f; + float Tc = (Tc1.Val + Tc2.Val) / 2.0f; + if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && + heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && + Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && + Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && + Math.Abs(Tw1.Val - Tw2.Val) <= heatMetersTestParams.DeltaTempWarm && + Math.Abs(Tc1.Val - Tc2.Val) <= heatMetersTestParams.DeltaTempCold) + { + goto temperature_set; + } + + lastTimeSec = StateMachine.Time; + Tw_last = Tw; + Tc_last = Tc; + } + } + while (true); + } + + temperature_set: //------------------------------------------------ Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs index 032c4f812..9b6cfa67d 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStart/FlyingStartSeq.cs @@ -112,9 +112,61 @@ namespace TBF.BenchControl.TestMethods.FlyingStart while (!e.Contains(Event.FlowReached)); flow_set: - int flowSetTime = StateMachine.Time - flowSetTime0; + + int flowSetTime = StateMachine.Time - flowSetTime0; float currentFlow = RefFlow.Val; + + if (heatMetersTestParams != null && heatMetersPath != null) + { + //--------------------------------------------------- + Bridge.OnActivity(this, Strings.Setting_temperature); + //--------------------------------------------------- + + int lastTimeSec = StateMachine.Time; + float Tw_last = 0; + float Tc_last = 0; + FloatBox Tw1 = new FloatBox(); + FloatBox Tw2 = new FloatBox(); + FloatBox Tc1 = new FloatBox(); + FloatBox Tc2 = new FloatBox(); + + State.Create("FixedStartMassCollection : Check temperature stabilized.") + .AddOperation(checkUiOp) + .AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref Tw1)) + .AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref Tw2)) + .AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref Tc1)) + .AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref Tc2)) + .EnterState(); + do + { + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Next)) goto temperature_set; + + if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0) + { + float Tw = (Tw1.Val + Tw2.Val) / 2.0f; + float Tc = (Tc1.Val + Tc2.Val) / 2.0f; + if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && + heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && + Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && + Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && + Math.Abs(Tw1.Val - Tw2.Val) <= heatMetersTestParams.DeltaTempWarm && + Math.Abs(Tc1.Val - Tc2.Val) <= heatMetersTestParams.DeltaTempCold) + { + goto temperature_set; + } + + lastTimeSec = StateMachine.Time; + Tw_last = Tw; + Tc_last = Tc; + } + } + while (true); + } + + temperature_set: + /// Extract cameras from the current sensors path, add operations to the detection state IList measureOperations = new List(); for (int i = 0; i < sensPath.RegisterReaders.Length; i++) diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs index f9e43dc5a..26cf45236 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartMassCollection/FlyingStartMassCollectionSeq.cs @@ -214,12 +214,61 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection } while (!e.Contains(Event.FlowReached)); - flow_set: int flowSetTime = StateMachine.Time - flowSetTime0; float currentFlow = RefFlow.Val; + if (heatMetersTestParams != null && heatMetersPath != null) + { + //--------------------------------------------------- + Bridge.OnActivity(this, Strings.Setting_temperature); + //--------------------------------------------------- + + int lastTimeSec = StateMachine.Time; + float Tw_last = 0; + float Tc_last = 0; + FloatBox Tw1 = new FloatBox(); + FloatBox Tw2 = new FloatBox(); + FloatBox Tc1 = new FloatBox(); + FloatBox Tc2 = new FloatBox(); + + State.Create("FixedStartMassCollection : Check temperature stabilized.") + .AddOperation(checkUiOp) + .AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref Tw1)) + .AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref Tw2)) + .AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref Tc1)) + .AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref Tc2)) + .EnterState(); + do + { + if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } + if (e.Contains(Event.Next)) goto temperature_set; + + if (StateMachine.Time - lastTimeSec > 10 || StateMachine.Time - lastTimeSec < 0) + { + float Tw = (Tw1.Val + Tw2.Val) / 2.0f; + float Tc = (Tc1.Val + Tc2.Val) / 2.0f; + if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && + heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && + Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && + Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && + Math.Abs(Tw1.Val - Tw2.Val) <= heatMetersTestParams.DeltaTempWarm && + Math.Abs(Tc1.Val - Tc2.Val) <= heatMetersTestParams.DeltaTempCold) + { + goto temperature_set; + } + + lastTimeSec = StateMachine.Time; + Tw_last = Tw; + Tc_last = Tc; + } + } + while (true); + } + + temperature_set: + /// Extract cameras from the current sensors path, add operations to the detection state IList measureOperations = new List(); for (int i = 0; i < sensPath.RegisterReaders.Length; i++) diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index 54a89c38a..2a44e5ec1 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -3229,7 +3229,16 @@ namespace TBF.Resources { } /// - /// Looks up a localized string similar to Setting the flow. + /// Looks up a localized string similar to Setting temperature. + /// + internal static string Setting_temperature { + get { + return ResourceManager.GetString("Setting_temperature", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Setting flow. /// internal static string Setting_the_flow { get { @@ -3238,7 +3247,7 @@ namespace TBF.Resources { } /// - /// Looks up a localized string similar to Setting the water pressure. + /// Looks up a localized string similar to Setting water pressure. /// internal static string Setting_the_water_pressure { get { diff --git a/TestBenchFramework/Resources/Strings.de.resx b/TestBenchFramework/Resources/Strings.de.resx index a300bbcc7..78f2f3e57 100644 --- a/TestBenchFramework/Resources/Strings.de.resx +++ b/TestBenchFramework/Resources/Strings.de.resx @@ -1350,4 +1350,7 @@ Kopfzeile + + Temperatur einstellen + \ No newline at end of file diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 52ba38527..5c6a6aa50 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -635,7 +635,7 @@ Measuring the weight - Setting the flow + Setting flow Test completed @@ -953,7 +953,7 @@ Starting the pump - Setting the water pressure + Setting water pressure Pressure Hi [bar] @@ -1543,4 +1543,7 @@ T v warm + + Setting temperature + \ No newline at end of file