Waiting loop for temperature stability check in heat meters tests.

This commit is contained in:
Milan Hanajik 2016-08-17 18:11:34 +02:00
parent 7d8c23d014
commit 83ddb7c8bf
6 changed files with 175 additions and 8 deletions

View File

@ -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);

View File

@ -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<IOperation> measureOperations = new List<IOperation>();
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)

View File

@ -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<IOperation> measureOperations = new List<IOperation>();
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)

View File

@ -3229,7 +3229,16 @@ namespace TBF.Resources {
}
/// <summary>
/// Looks up a localized string similar to Setting the flow.
/// Looks up a localized string similar to Setting temperature.
/// </summary>
internal static string Setting_temperature {
get {
return ResourceManager.GetString("Setting_temperature", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Setting flow.
/// </summary>
internal static string Setting_the_flow {
get {
@ -3238,7 +3247,7 @@ namespace TBF.Resources {
}
/// <summary>
/// Looks up a localized string similar to Setting the water pressure.
/// Looks up a localized string similar to Setting water pressure.
/// </summary>
internal static string Setting_the_water_pressure {
get {

View File

@ -1350,4 +1350,7 @@
<data name="Header" xml:space="preserve">
<value>Kopfzeile</value>
</data>
<data name="Setting_temperature" xml:space="preserve">
<value>Temperatur einstellen</value>
</data>
</root>

View File

@ -635,7 +635,7 @@
<value>Measuring the weight</value>
</data>
<data name="Setting_the_flow" xml:space="preserve">
<value>Setting the flow</value>
<value>Setting flow</value>
</data>
<data name="Test_completed" xml:space="preserve">
<value>Test completed</value>
@ -953,7 +953,7 @@
<value>Starting the pump</value>
</data>
<data name="Setting_the_water_pressure" xml:space="preserve">
<value>Setting the water pressure</value>
<value>Setting water pressure</value>
</data>
<data name="Pressure_hi_bar" xml:space="preserve">
<value>Pressure Hi [bar]</value>
@ -1543,4 +1543,7 @@
<data name="T_work_warm" xml:space="preserve">
<value>T v warm</value>
</data>
<data name="Setting_temperature" xml:space="preserve">
<value>Setting temperature</value>
</data>
</root>