2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2015-02-19 07:37:37 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using log4net;
|
2015-12-04 16:17:20 +00:00
|
|
|
|
using Config.Entities;
|
2015-02-19 07:37:37 +00:00
|
|
|
|
using TBF.BenchControl;
|
|
|
|
|
|
using TBF.Boxes;
|
|
|
|
|
|
using TBF.Resources;
|
|
|
|
|
|
using TBF.UiBridge;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.TestMethods.LeakTest
|
|
|
|
|
|
{
|
|
|
|
|
|
public class LeakTestSeq : Sequences.SequenceBase
|
|
|
|
|
|
{
|
|
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(LeakTestSeq));
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Flying start mass collection method sequence
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="test">Test entity</param>
|
|
|
|
|
|
/// <returns>
|
|
|
|
|
|
/// Event.Done . . . . . . . OK
|
|
|
|
|
|
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
|
|
|
|
|
|
/// Event.OpArgumentError . Target flow is out of range
|
|
|
|
|
|
/// Event.Error . . . . . . Unspecified error
|
|
|
|
|
|
/// </returns>
|
2015-12-04 16:17:20 +00:00
|
|
|
|
public IList<Event> Execute(Config.Entities.Test test, LeakTestParams testParams)
|
2015-02-19 07:37:37 +00:00
|
|
|
|
{
|
|
|
|
|
|
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
|
|
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
|
|
|
|
|
Event retVal = Event.Done;
|
|
|
|
|
|
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this);
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-05-19 10:43:45 +00:00
|
|
|
|
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, 1, 1, 30, Convert.ToInt32(test.TstTime) + 15, 0, 0 });
|
|
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.JustStarted));
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-05-19 10:43:45 +00:00
|
|
|
|
// Transition or SetRoute - Start
|
2015-05-22 08:29:56 +00:00
|
|
|
|
switch (Transition(transitionBefore, TransitionContext.BeforeTest))
|
2015-02-19 07:37:37 +00:00
|
|
|
|
{
|
2015-02-20 10:37:09 +00:00
|
|
|
|
case Event.Error: { retVal = Event.Error; goto stopTest; }
|
|
|
|
|
|
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-19 07:37:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-19 10:43:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionBefore));
|
|
|
|
|
|
|
|
|
|
|
|
/// Start the test, initialize test results
|
2015-02-20 10:37:09 +00:00
|
|
|
|
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0));
|
2016-01-03 01:05:35 +00:00
|
|
|
|
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Starting_the_pump);
|
|
|
|
|
|
//------------------------------------------------
|
2015-02-19 07:37:37 +00:00
|
|
|
|
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
|
|
|
|
|
|
|
|
|
|
|
State.Create("LeakTest : Starting the pump")
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.AddOperation(checkUiOp)
|
2015-02-19 07:37:37 +00:00
|
|
|
|
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-20 10:37:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (e.Contains(Event.ValvesBusy));
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Setting_the_water_pressure);
|
2016-05-19 10:43:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.FlowSetting));
|
|
|
|
|
|
//------------------------------------------------
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
float pumpPower = test.PumpPower;
|
|
|
|
|
|
int startTime = StateMachine.Time;
|
2015-02-20 10:37:09 +00:00
|
|
|
|
|
|
|
|
|
|
while (true)
|
2015-02-19 07:37:37 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower);
|
|
|
|
|
|
|
|
|
|
|
|
State.Create("LeakTest : Setting the water pressure")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-19 07:37:37 +00:00
|
|
|
|
.AddOperation(new Operations.TimerOp(5))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-19 07:37:37 +00:00
|
|
|
|
if (e.Contains(Event.Next)) goto pressure_set;
|
|
|
|
|
|
}
|
|
|
|
|
|
while (e.Contains(Event.TimerBusy));
|
|
|
|
|
|
|
2016-08-02 08:47:51 +00:00
|
|
|
|
UiBridge.Bridge.OnLog(this, string.Format("time = {0}, pump_power = {1}%, pressure_up = {2}bar, pressure_down = {3}bar\r\n",
|
2015-02-19 07:37:37 +00:00
|
|
|
|
StateMachine.Time - startTime,
|
|
|
|
|
|
pumpPower.ToString("F0"),
|
2016-08-02 08:47:51 +00:00
|
|
|
|
PressureUp.ToString(),
|
|
|
|
|
|
PressureDown.ToString()));
|
2015-02-20 10:37:09 +00:00
|
|
|
|
|
|
|
|
|
|
float step = (pumpPower < 40.0f) ? 5.0f : ((pumpPower < 60.0f) ? 3.0f : ((pumpPower < 80.0f) ? 2.0f : 1.0f));
|
|
|
|
|
|
|
2015-12-20 19:48:50 +00:00
|
|
|
|
if (PressureDown.Val < testParams.PressureLo)
|
2015-02-20 10:37:09 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (pumpPower == 100.0f) break; /// Already at max. pump power -> Quit loop
|
|
|
|
|
|
pumpPower = Math.Min(pumpPower + step, 100.0f); /// Limit max. power to 100%
|
|
|
|
|
|
}
|
2015-12-20 19:48:50 +00:00
|
|
|
|
else if (PressureDown.Val > testParams.PressureHi)
|
2015-02-20 10:37:09 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (pumpPower == 0) break; /// Already at min. pump power -> Quit loop
|
|
|
|
|
|
pumpPower = Math.Max(pumpPower - step, 0); /// Limit min. power to 0%
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
break; /// Pressure is in the range -> Quit loop
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pressure_set:
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
ClearAllStatistics();
|
|
|
|
|
|
UpdateAllStatistics();
|
|
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
startTime = StateMachine.Time;
|
|
|
|
|
|
int estimtdEndTime = startTime + testParams.DurationPMax;
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_in_progress);
|
2016-05-19 10:43:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
|
|
|
|
|
|
//------------------------------------------------
|
2015-02-20 10:37:09 +00:00
|
|
|
|
State.Create("LeakTest : Maximum water pressure set")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-20 10:37:09 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
UpdateAllStatistics();
|
|
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
2015-09-22 09:29:20 +00:00
|
|
|
|
if (remainingTime > 60)
|
|
|
|
|
|
{
|
2015-10-14 13:45:51 +00:00
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
2015-09-22 09:29:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
|
|
|
|
|
}
|
2015-02-20 10:37:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (e.Contains(Event.TimerBusy));
|
|
|
|
|
|
|
|
|
|
|
|
closing_valve:
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Closing_valve_Pump_off);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
State.Create("LeakTest : Closing the valve")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.SetValvesOp(null, outPath.StartValve))
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
UpdateAllStatistics();
|
2015-02-20 10:37:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (e.Contains(Event.ValvesBusy));
|
|
|
|
|
|
|
|
|
|
|
|
valve_closed:
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
State.Create("LeakTest : Closing the valve")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
UpdateAllStatistics();
|
2015-02-19 07:37:37 +00:00
|
|
|
|
}
|
2015-02-20 10:37:09 +00:00
|
|
|
|
while (e.Contains(Event.ValvesBusy));
|
|
|
|
|
|
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
pump_is_off:
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
TestStartTime = DateTime.Now;
|
2015-02-20 10:37:09 +00:00
|
|
|
|
startTime = StateMachine.Time;
|
|
|
|
|
|
estimtdEndTime = startTime + testParams.DurationLeak;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
ClearAllStatistics();
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_in_progress);
|
|
|
|
|
|
//------------------------------------------------
|
2015-02-19 07:37:37 +00:00
|
|
|
|
State.Create("LeakTest : Starting the test")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
2015-12-20 19:48:50 +00:00
|
|
|
|
.AddOperation(benchPath.TempIn.ReadTempOp(ref TempIn))
|
|
|
|
|
|
.AddOperation(benchPath.TempOut.ReadTempOp(ref TempOut))
|
|
|
|
|
|
.AddOperation(benchPath.PressIn.ReadPressureOp(ref PressureUp))
|
|
|
|
|
|
.AddOperation(benchPath.PressOut.ReadPressureOp(ref PressureDown))
|
2015-02-20 10:37:09 +00:00
|
|
|
|
.AddOperation(new Operations.TimerOp(testParams.DurationLeak))
|
2015-02-19 07:37:37 +00:00
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-01-03 01:05:35 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
UpdateAllStatistics();
|
|
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
int remainingTime = Math.Max(estimtdEndTime - StateMachine.Time, 0);
|
2015-09-22 09:29:20 +00:00
|
|
|
|
if (remainingTime > 60)
|
|
|
|
|
|
{
|
2015-10-14 13:45:51 +00:00
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} {2} {3} {4}", Strings.Test_in_progress, remainingTime / 60, "min", remainingTime % 60, Strings.sec));
|
2015-09-22 09:29:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
|
|
|
|
|
|
}
|
2015-02-19 07:37:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (e.Contains(Event.TimerBusy));
|
|
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
/// Measurement loop - end
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2015-02-20 10:37:09 +00:00
|
|
|
|
test_completed:
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
Bridge.OnActivity(this, Strings.Test_completed);
|
|
|
|
|
|
//------------------------------------------------
|
|
|
|
|
|
|
2016-01-03 01:05:35 +00:00
|
|
|
|
TestEndTime = DateTime.Now;
|
|
|
|
|
|
|
2015-04-28 13:27:47 +00:00
|
|
|
|
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
|
2015-06-25 02:45:04 +00:00
|
|
|
|
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Populate TestResult data entity with data
|
|
|
|
|
|
///
|
2016-01-03 01:05:35 +00:00
|
|
|
|
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
|
|
|
|
|
|
|
|
|
|
|
if (tstRslt != null)
|
2015-02-19 07:37:37 +00:00
|
|
|
|
{
|
2016-01-03 01:05:35 +00:00
|
|
|
|
/// Auxiliary results
|
|
|
|
|
|
tstRslt.AmbientTempAve = AmbientTempStat.Average;
|
2016-08-19 12:30:40 +00:00
|
|
|
|
tstRslt.AmbTempStart = AmbientTempStat.First;
|
|
|
|
|
|
tstRslt.AmbTempEnd = AmbientTempStat.Last;
|
|
|
|
|
|
tstRslt.AmbTempMin = AmbientTempStat.Min;
|
|
|
|
|
|
tstRslt.AmbTempMax = AmbientTempStat.Max;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.AmbientPressAve = AmbientPressureStat.Average;
|
2016-08-19 12:30:40 +00:00
|
|
|
|
tstRslt.AmbPressStart = AmbientPressureStat.First;
|
|
|
|
|
|
tstRslt.AmbPressEnd = AmbientPressureStat.Last;
|
|
|
|
|
|
tstRslt.AmbPressMin = AmbientPressureStat.Min;
|
|
|
|
|
|
tstRslt.AmbPressMax = AmbientPressureStat.Max;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.AmbientHumiAve = AmbientHumidityStat.Average;
|
2016-08-19 12:30:40 +00:00
|
|
|
|
tstRslt.AmbHumiStart = AmbientHumidityStat.First;
|
|
|
|
|
|
tstRslt.AmbHumiEnd = AmbientHumidityStat.Last;
|
|
|
|
|
|
tstRslt.AmbHumiMin = AmbientHumidityStat.Min;
|
|
|
|
|
|
tstRslt.AmbHumiMax = AmbientHumidityStat.Max;
|
2016-01-03 01:05:35 +00:00
|
|
|
|
tstRslt.PressUpAvrg = PressureUpStat.Average;
|
|
|
|
|
|
tstRslt.PressUpStart = PressureUpStat.First;
|
|
|
|
|
|
tstRslt.PressUpEnd = PressureUpStat.Last;
|
|
|
|
|
|
tstRslt.PressUpMin = PressureUpStat.Min;
|
|
|
|
|
|
tstRslt.PressUpMax = PressureUpStat.Max;
|
|
|
|
|
|
tstRslt.PressDownAvrg = PressureDownStat.Average;
|
|
|
|
|
|
tstRslt.PressDownStart = PressureDownStat.First;
|
|
|
|
|
|
tstRslt.PressDownEnd = PressureDownStat.Last;
|
|
|
|
|
|
tstRslt.PressDownMin = PressureDownStat.Min;
|
|
|
|
|
|
tstRslt.PressDownMax = PressureDownStat.Max;
|
|
|
|
|
|
tstRslt.TempInAvrg = TempInStat.Average;
|
|
|
|
|
|
tstRslt.TempInStart = TempInStat.First;
|
|
|
|
|
|
tstRslt.TempInEnd = TempInStat.Last;
|
|
|
|
|
|
tstRslt.TempInMin = TempInStat.Min;
|
|
|
|
|
|
tstRslt.TempInMax = TempInStat.Max;
|
|
|
|
|
|
tstRslt.TempOutAvrg = TempOutStat.Average;
|
|
|
|
|
|
tstRslt.TempOutStart = TempOutStat.First;
|
|
|
|
|
|
tstRslt.TempOutEnd = TempOutStat.Last;
|
|
|
|
|
|
tstRslt.TempOutMin = TempOutStat.Min;
|
|
|
|
|
|
tstRslt.TempOutMax = TempOutStat.Max;
|
|
|
|
|
|
tstRslt.TempDivAvrg = TempDivStat.Average;
|
|
|
|
|
|
tstRslt.TempDivStart = TempDivStat.First;
|
|
|
|
|
|
tstRslt.TempDivEnd = TempDivStat.Last;
|
|
|
|
|
|
tstRslt.TempDivMin = TempDivStat.Min;
|
|
|
|
|
|
tstRslt.TempDivMax = TempDivStat.Max;
|
|
|
|
|
|
tstRslt.DensityIn = Formulas.WaterDensityFromTemp(tstRslt.TempInAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityOut = Formulas.WaterDensityFromTemp(tstRslt.TempOutAvrg); /// [kg/m3]
|
|
|
|
|
|
tstRslt.DensityDiv = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/// Main results
|
|
|
|
|
|
tstRslt.StartTime = TestStartTime;
|
|
|
|
|
|
tstRslt.EndTime = TestEndTime;
|
|
|
|
|
|
tstRslt.FlowSetTime = 0;
|
|
|
|
|
|
tstRslt.TestTime = Convert.ToDouble(testParams.DurationPMax); /// [s] measurement time
|
|
|
|
|
|
tstRslt.PulsesMaster = 0; /// Pulses of the master flow meter (test total)
|
|
|
|
|
|
tstRslt.MassStartRaw = 0;
|
|
|
|
|
|
tstRslt.MassStart = 0;
|
|
|
|
|
|
tstRslt.MassEndRaw = 0;
|
|
|
|
|
|
tstRslt.MassEnd = 0;
|
|
|
|
|
|
tstRslt.FlowMass = 0; /// [kg/h]
|
|
|
|
|
|
tstRslt.FlowVolume = 0; /// [m3/h]
|
|
|
|
|
|
tstRslt.VolumeMaster = 0; /// [l] volume from the master flow meter
|
|
|
|
|
|
tstRslt.VolumeCTV = 0; /// [l] 1000.0f is because density is in [kg/m3]
|
|
|
|
|
|
tstRslt.ConstMaster = 0; /// Convert the flow to [m3/h]
|
|
|
|
|
|
tstRslt.ErrorMaster = 0;
|
|
|
|
|
|
|
2016-06-30 12:02:25 +00:00
|
|
|
|
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (test.Part != 0 && test.Part != Utils.PartNr(i + 1, BatchRslts.Batch.Compound)) continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (StateMachine.Procedure.MetersKind == MetersKind.Single)
|
2016-01-03 01:05:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
|
|
|
|
|
|
|
|
|
|
|
if (meterRslt != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
meterRslt.TestTime = tstRslt.TestTime;
|
|
|
|
|
|
meterRslt.Error = 0;
|
|
|
|
|
|
meterRslt.Passed = true;
|
|
|
|
|
|
meterRslt.TestDone = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Results.Entities.MeterTestRslt mainMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundMain);
|
|
|
|
|
|
Results.Entities.MeterTestRslt auxMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.CompoundAux);
|
|
|
|
|
|
|
|
|
|
|
|
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
|
|
|
|
|
|
{
|
|
|
|
|
|
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainMeterRslt : auxMeterRslt;
|
|
|
|
|
|
|
|
|
|
|
|
if (meterRslt != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
meterRslt.TestTime = tstRslt.TestTime;
|
|
|
|
|
|
meterRslt.Error = 0;
|
|
|
|
|
|
meterRslt.Passed = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Results.Entities.MeterTestRslt compoundMeterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Compound);
|
|
|
|
|
|
|
|
|
|
|
|
if (compoundMeterRslt != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
compoundMeterRslt.TestTime = tstRslt.TestTime;
|
|
|
|
|
|
compoundMeterRslt.Error = 0;
|
|
|
|
|
|
compoundMeterRslt.Passed = true;
|
|
|
|
|
|
mainMeterRslt.TestDone = auxMeterRslt.TestDone = compoundMeterRslt.TestDone = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2015-02-19 07:37:37 +00:00
|
|
|
|
}
|
2016-01-08 18:18:45 +00:00
|
|
|
|
|
|
|
|
|
|
tstRslt.Components = Results.Entities.Components
|
|
|
|
|
|
.UpdateList(BatchRslts.ComponentsList,
|
2016-02-15 21:48:44 +00:00
|
|
|
|
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
|
|
|
|
|
|
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
|
2016-01-08 18:18:45 +00:00
|
|
|
|
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
|
|
|
|
|
|
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
|
|
|
|
|
|
outPath.Balance != null ? outPath.Balance.Name : string.Empty,
|
|
|
|
|
|
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
|
|
|
|
|
|
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-02-13 18:25:43 +00:00
|
|
|
|
/// Update results
|
|
|
|
|
|
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
|
|
|
|
|
|
}
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
2016-01-08 18:18:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionAfter));
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
/// Append the results to the CSV-file
|
2016-01-03 01:05:35 +00:00
|
|
|
|
allResults.Info(TestResult2CsvLine(testName, test.Part));
|
2015-02-19 07:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stopTest:
|
|
|
|
|
|
|
2016-05-19 10:43:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.TransitionAfter));
|
|
|
|
|
|
|
|
|
|
|
|
///
|
2015-02-20 10:37:09 +00:00
|
|
|
|
/// Quit this sequence
|
|
|
|
|
|
///
|
2015-02-19 07:37:37 +00:00
|
|
|
|
State.Create("LeakTest : Stopping diverter, gate, etc.")
|
|
|
|
|
|
.AddOperation(checkUiOp)
|
|
|
|
|
|
.AddOperation(cBrd.StopPreviousOp())
|
|
|
|
|
|
.EnterState();
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
|
|
|
|
|
e = StateMachine.WaitRunDevsRunOps();
|
2016-04-14 07:16:20 +00:00
|
|
|
|
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
2015-02-19 07:37:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
while (!e.Contains(Event.PreviousStopped));
|
|
|
|
|
|
|
|
|
|
|
|
/// Transition sequence at the end of test
|
|
|
|
|
|
/// Prevent overwriting 'retVal' in case it was set to non-default value earlier
|
2016-02-07 21:27:32 +00:00
|
|
|
|
switch (Transition(transitionAfter, (retVal == Event.Done) ? TransitionContext.AfterTest : TransitionContext.Stop))
|
2015-02-19 07:37:37 +00:00
|
|
|
|
{
|
2016-02-07 21:27:32 +00:00
|
|
|
|
case Event.Error: { if (retVal == Event.Done) retVal = Event.Error; break; }
|
2015-02-19 07:37:37 +00:00
|
|
|
|
case Event.UiCmdStop: { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-05-19 10:43:45 +00:00
|
|
|
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
|
|
|
|
|
|
|
|
|
|
|
/// Create a list with one item 'retVal' (default is Event.Done) and return it
|
2015-02-19 07:37:37 +00:00
|
|
|
|
IList<Event> retList = new List<Event>(1);
|
|
|
|
|
|
retList.Add(retVal);
|
|
|
|
|
|
return retList;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|