(1) ProcessTabPageEx: TRefHi, TRefLo (2) Ambient vals. written directly to ProcessData (3) Sequences changed:'readTempPressOps', ver. 2.18.1171

This commit is contained in:
Milan Hanajik
2019-03-20 08:25:01 +01:00
parent 0041ec9616
commit 9fecf05b3f
31 changed files with 2443 additions and 2835 deletions
@@ -107,6 +107,7 @@ namespace TBF.BenchControl.Ambient.Comet
value = (int)byteArr[9] * 256 + (int)byteArr[10]; value = (int)byteArr[9] * 256 + (int)byteArr[10];
pressure = (float)value / 10000.0f; pressure = (float)value / 10000.0f;
UpdateProcessData(temperature, pressure, humidity);
msrmntTimeStamp = StateMachine.Time; msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid; msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure); log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
@@ -185,6 +186,14 @@ namespace TBF.BenchControl.Ambient.Comet
public void StopDevice2() { } public void StopDevice2() { }
void UpdateProcessData(float temperature, float pressure, float humidity)
{
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
}
/// ///
/// Boxes for the operation result /// Boxes for the operation result
/// ///
+10 -2
View File
@@ -133,9 +133,10 @@ namespace TBF.BenchControl.Ambient.Greco
temperature = t; temperature = t;
humidity = h; humidity = h;
pressure = p / 1000.0F; pressure = p / 1000.0F;
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
UpdateProcessData(temperature, pressure, humidity);
msrmntTimeStamp = StateMachine.Time;
msrmntState = MsrmntState.Valid;
log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure); log.InfoFormat("Ambient: temperature = {0:F1} C, humidity = {1:F1} %, pressure = {2:F0} mbar", temperature, humidity, 1000 * pressure);
} }
else else
@@ -170,6 +171,13 @@ namespace TBF.BenchControl.Ambient.Greco
public void StopDevice2() { } public void StopDevice2() { }
void UpdateProcessData(float temperature, float pressure, float humidity)
{
TBF.BenchControl.Sequences.ProcessData.AmbTemp.Val = temperature;
TBF.BenchControl.Sequences.ProcessData.AmbPress.Val = pressure;
TBF.BenchControl.Sequences.ProcessData.AmbHumi.Val = humidity;
}
/// ///
/// Boxes for the operation result /// Boxes for the operation result
/// ///
@@ -887,9 +887,6 @@ namespace TBF.BenchControl.Sequences
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((realTest && (outPath.Scale is IScale)) ? (outPath.Scale as IScale).ReadMassOp(ref Mass) : null) .AddOperation((realTest && (outPath.Scale is IScale)) ? (outPath.Scale as IScale).ReadMassOp(ref Mass) : null)
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
//.AddOperation(realTest ? (ticTac ? queryEnd1 : queryEnd2) : null) //.AddOperation(realTest ? (ticTac ? queryEnd1 : queryEnd2) : null)
.AddOperation(realTest ? queryEnd1 : null) .AddOperation(realTest ? queryEnd1 : null)
.AddOperation(realTest ? processDataLoggingOp : null) .AddOperation(realTest ? processDataLoggingOp : null)
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -57,19 +57,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{ {
float simulatedError = 4.5f; /// % float simulatedError = 4.5f; /// %
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; IList<Event> e; /// Events from currently running operations
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done; Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
@@ -88,16 +77,45 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (rangeIx == -1) if (rangeIx == -1)
{ {
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop; return new List<Event> { Event.ConfigurationError };
goto stopTestWOStoppingDivGateEtc;
} }
} }
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -108,13 +126,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create("Adjustment : Starting the pump") State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -129,11 +147,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -147,11 +165,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -163,11 +181,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -183,12 +201,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create("Adjustment : Setting the flow") State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -217,17 +235,15 @@ namespace TBF.BenchControl.TestMethods.Adjustment
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -296,12 +312,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//tstRslt = MakeSimulated(test, 1, simulatedError); //tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f; simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test") State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(5)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(5))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +326,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment
} }
else else
{ {
State.Create("Adjustment : Starting the test") State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, .AddOperations(measureOperations)
test.Qfrom, test.Qto, totalPulses, filters)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -477,12 +492,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create("Adjustment : Stopping diverter, gate, etc.") State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -491,10 +505,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, 0)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -106,18 +106,10 @@ namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
break; break;
} }
return new List<Event> { Event.Done };
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(Event.Done);
return retList;
stopTest: stopTest:
return new List<Event> { Event.UiCmdStop };
/// Create a list with one item 'retVal' (default is Event.Done) and return it }
IList<Event> retList2 = new List<Event>(1);
retList2.Add(Event.UiCmdStop);
return retList2;
}
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s. /// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -50,6 +50,18 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -58,11 +70,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Stop diverter gate etc", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stop diverter gate etc", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -105,8 +116,20 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, (int)totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -118,11 +141,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -137,7 +160,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
} }
/// Empty the water tank /// Empty the water tank
switch (DrainTheTank(scale)) switch (DrainTheTank(scale, readTempPressOps))
{ {
case Event.Error: goto error; case Event.Error: goto error;
case Event.UiCmdStop: goto stopTest; case Event.UiCmdStop: goto stopTest;
@@ -195,13 +218,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Bridge.OnActivity(this, Strings.Switching_flow_detection); Bridge.OnActivity(this, Strings.Switching_flow_detection);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Start the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Start the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null) .AddOperations(measureOperations)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null)
.EnterState(); .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -211,12 +234,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create(string.Format("{0}({1}) : Set the initial flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Set the initial flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed)) .AddOperations(measureOperations)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -269,11 +292,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
State.Create(string.Format("{0}({1}) : Change the RV position", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Change the RV position", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse)) .AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -416,12 +439,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
{ {
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Switching flow detected, going back", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Switching flow detected, going back", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(measureOperations)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -439,12 +462,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Going to the test flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Going to the test flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue)) //.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -462,13 +485,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Measure_the_mass) State.Create(Strings.Measure_the_mass)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperations(measureOperations)
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.EnterState(); .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -486,13 +509,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Start_the_test) State.Create(Strings.Start_the_test)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, .AddOperations(measureOperations)
qfrom_detected, qto_detected, totalPulses, filters)) .AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro), qfrom_detected, qto_detected, totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -557,13 +579,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Measure_the_mass) State.Create(string.Format("{0}({1}) : Measuring the mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod)) .AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.EnterState(); .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -585,12 +607,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Bridge.OnActivity(this, Strings.Test_completed); Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------ //------------------------------------------------
State.Create(Strings.Stop_the_pump) State.Create(Strings.Stop_the_pump)
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperations(readTempPressOps)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -598,12 +620,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//-------------------------------- //--------------------------------
State.Create("stop_diverter_gate_etc") State.Create(string.Format("{0}({1}) : Stop_diverter_gate_etc", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -754,18 +776,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
} }
while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone))); while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
} }
/// Create the return value - a list with one event Event.Done - and return return new List<Event> { Event.Done };
IList<Event> retval1 = new List<Event>(1);
retval1.Add(Event.Done);
return retval1;
//==================================== //====================================
stopTest: stopTest:
@@ -782,9 +800,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
IList<Event> retval2 = new List<Event>(1); return new List<Event> { Event.UiCmdStop };
retval2.Add(Event.UiCmdStop);
return retval2;
//==================================== //====================================
error: error:
@@ -800,9 +816,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
IList<Event> retval3 = new List<Event>(1); return new List<Event> { Event.Error };
retval3.Add(Event.Error);
return retval3;
} }
@@ -836,10 +850,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
.EnterState(); .EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps(); IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
} }
} }
} }
@@ -30,13 +30,43 @@ namespace TBF.BenchControl.TestMethods.Endurance
string enduranceCycleStr, string enduranceCycleStr,
Config.Entities.DebugMode debugLevel) Config.Entities.DebugMode debugLevel)
{ {
IList<Event> e = new List<Event>(); /// Events from currently running operations int rangeIx = 0; /// Default range, used for non-Elde flowmeters
Event retVal = Event.Done; if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state {
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
return new List<Event> { Event.ConfigurationError };
}
}
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
string enduranceLogDir = string.Format("C:\\TBF\\Results\\{0:yyyy}\\{0:MM}\\{0:dd}\\", BatchRslts.Batch.StartTime); string enduranceLogDir = string.Format("C:\\TBF\\Results\\{0:yyyy}\\{0:MM}\\{0:dd}\\", BatchRslts.Batch.StartTime);
string enduranceLogName = string.Format("{0}{1:HHmm}.txt", enduranceLogDir, BatchRslts.Batch.StartTime); string enduranceLogName = string.Format("{0}{1:HHmm}.txt", enduranceLogDir, BatchRslts.Batch.StartTime);
@@ -54,41 +84,28 @@ namespace TBF.BenchControl.TestMethods.Endurance
enduranceDataLoggingOp = null; enduranceDataLoggingOp = null;
} }
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters Event retVal = Event.Done;
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) IList<Event> e; /// Events from currently running operations
{
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
rangeIx = -1; /// Indicates invalid range
for (int r = 0; r <= 5; r++)
{
if (eldeFM.RangeEnabled(r) && eldeFM.GetTempLo(r) <= test.TempLimLo
&& eldeFM.GetTempHi(r) >= test.TempLimHi)
{
rangeIx = r;
}
}
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
}
}
//==================================== //====================================
loop: loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -99,12 +116,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -120,11 +137,11 @@ namespace TBF.BenchControl.TestMethods.Endurance
//------------------------------------------------ //------------------------------------------------
int flowSetTime0 = StateMachine.Time; int flowSetTime0 = StateMachine.Time;
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -155,17 +172,15 @@ namespace TBF.BenchControl.TestMethods.Endurance
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -231,27 +246,14 @@ namespace TBF.BenchControl.TestMethods.Endurance
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(enduranceDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -280,28 +282,15 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(queryEnd1)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(enduranceDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(queryEnd1)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -495,11 +484,11 @@ namespace TBF.BenchControl.TestMethods.Endurance
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
@@ -535,20 +524,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
cBrd.CyclePar = cyclePar; cBrd.CyclePar = cyclePar;
/// ///
State.Create(string.Format("{0}({1}) : Uploading cycle parameters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Uploading cycle parameters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(enduranceDataLoggingOp)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -564,21 +546,14 @@ namespace TBF.BenchControl.TestMethods.Endurance
bool stopInProgress = false; bool stopInProgress = false;
/// ///
State.Create(string.Format("{0}({1}) : Executing the cycle", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Executing the cycle", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp((int)test.TstTime, Event.TimerExpired)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(new Operations.TimerOp((int)test.TstTime, Event.TimerExpired))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(enduranceDataLoggingOp)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) if (TestAndLogUiCmdStop(test, e))
@@ -614,20 +589,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
Bridge.OnActivity(this, Strings.Last_cycle_wait_please); Bridge.OnActivity(this, Strings.Last_cycle_wait_please);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Delay to make sure the last endu.cycle completed", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Delay to make sure the last endu.cycle completed", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp((int)(duration / 1000) + 1, Event.TimerExpired)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(new Operations.TimerOp((int)(duration / 1000) + 1, Event.TimerExpired))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(enduranceDataLoggingOp)
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) if (TestAndLogUiCmdStop(test, e))
@@ -665,11 +633,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
@@ -678,10 +645,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -67,7 +67,20 @@ namespace TBF.BenchControl.TestMethods.FixedStart
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -83,8 +96,20 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//==================================== //====================================
loop: loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
/// ///
@@ -107,11 +132,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
/// ///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp) .AddOperation(heatMetersPromptOp)
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -139,12 +164,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
/// ///
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp) .AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -165,13 +190,13 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -186,12 +211,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -205,12 +230,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -222,12 +247,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -249,12 +274,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
} }
/// ///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -264,12 +289,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
while (e.Contains(Event.ValvesBusy)); while (e.Contains(Event.ValvesBusy));
/// ///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -281,12 +306,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -318,15 +343,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -363,11 +384,9 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -387,15 +406,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//----------------------------------------------------------------- //-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -413,15 +428,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -447,8 +458,9 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{ {
string[] startImages = new string[sensPath.RegisterReaders.Length]; string[] startImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -477,15 +489,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders)) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -550,22 +558,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -575,21 +572,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
StartTime = (double)StateMachine.Time; StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -686,21 +673,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
EndTime = (double)StateMachine.Time; EndTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -710,25 +687,13 @@ namespace TBF.BenchControl.TestMethods.FixedStart
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Waiting before 2nd measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 2nd measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -741,11 +706,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -770,7 +735,9 @@ namespace TBF.BenchControl.TestMethods.FixedStart
string[] endImages = new string[sensPath.RegisterReaders.Length]; string[] endImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -783,8 +750,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -801,20 +767,19 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name)); State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name));
if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm) if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
{ {
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm). state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).ShowTestEndFormOp(sensPath.RegisterReaders,
ShowTestEndFormOp(sensPath.RegisterReaders, volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty, refEnergy, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
refEnergy, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
} }
else else
{ {
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty)); volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
} }
state.AddOperation(checkUiOp); state.AddOperation(checkUiOp)
state.EnterState(); .AddOperations(readTempPressOps)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -1132,10 +1097,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -64,7 +64,21 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
Event retVal = Event.Done; processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -77,12 +91,22 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow)); /// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -93,11 +117,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// Measure the weight in case there is no unconditional draining /// Measure the weight in case there is no unconditional draining
/// ///
State.Create("FixedStartAdvanced : Measuring mass of water in the tank") State.Create("FixedStartAdvanced : Measuring mass of water in the tank")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -115,7 +139,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// ///
/// Drain the water tank /// Drain the water tank
/// ///
switch (DrainTheTank(scale)) switch (DrainTheTank(scale, readTempPressOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -133,11 +157,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartAdvanced : Waiting 5 sec") State.Create("FixedStartAdvanced : Waiting 5 sec")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(5)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(5))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -148,11 +172,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Starting the pump") State.Create("FixedStartAdvanced : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -169,11 +193,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartAdvanced : Starting the pump") State.Create("FixedStartAdvanced : Starting the pump")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -184,11 +208,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//-------------------------------- //--------------------------------
State.Create("FixedStartAdvanced : Setting the flow") State.Create("FixedStartAdvanced : Setting the flow")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -212,11 +236,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test") State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -278,11 +302,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
{ {
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create("FixedStartAdvanced : Enter begin-state") State.Create("FixedStartAdvanced : Enter begin-state")
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders)) .AddOperation(checkUiOp)
.AddOperation(checkUiOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -302,22 +326,14 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Measuring the start mass") State.Create("FixedStartAdvanced : Measuring the start mass")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -337,13 +353,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Starting the test") State.Create("FixedStartAdvanced : Starting the test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, .AddOperations(measureOperations)
test.Qfrom, test.Qto, 2 * totalPulses, filters)) .AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro), test.Qfrom, test.Qto, 2 * totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -352,11 +367,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test") State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -414,11 +429,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
StopRecordingStatistics(); StopRecordingStatistics();
State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test") State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -426,21 +441,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Waiting before 2nd mass measurement") State.Create("FixedStartAdvanced : Waiting before 2nd mass measurement")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -452,21 +459,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create("FixedStartAdvanced : Measuring the end mass") State.Create("FixedStartAdvanced : Measuring the end mass")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -483,11 +482,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.") State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -510,14 +509,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
{ {
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create("FixedStartAdvanced : Enter end-state") State.Create("FixedStartAdvanced : Enter end-state")
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, .AddOperation(checkUiOp)
volumeCTV, .AddOperations(readTempPressOps)
test.ErrLimLo + test.Uncertainty, .AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty))
test.ErrLimHi - test.Uncertainty)) .EnterState();
.AddOperation(checkUiOp) do {
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -653,21 +649,17 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.") State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -94,7 +94,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -110,8 +123,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//==================================== //====================================
loop: loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
/// ///
@@ -127,19 +152,18 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
} }
if (!test.DoDraining) if (!test.DoDraining)
{ {
/// ///
/// Measure the weight in case there is no unconditional draining /// Measure the weight in case there is no unconditional draining
/// ///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(scale.ReadMassOp(ref Mass))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -156,7 +180,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// ///
/// Drain the water tank /// Drain the water tank
/// ///
switch (DrainTheTank(scale, heatMetersPromptOp)) IList<IOperation> ops = new List<IOperation>(readTempPressOps);
ops.Add(heatMetersPromptOp);
switch (DrainTheTank(scale, ops))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -167,12 +193,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// ///
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp) .AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -193,13 +219,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -214,12 +240,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -233,12 +259,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -250,12 +276,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -277,12 +303,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
} }
/// ///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -292,12 +318,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
while (e.Contains(Event.ValvesBusy)); while (e.Contains(Event.ValvesBusy));
/// ///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -309,12 +335,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -346,15 +372,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -365,12 +387,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{ {
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2; double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2; double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && (heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && (Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && (Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm && (Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold) (Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -383,7 +405,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
} }
while (true); while (true);
} }
else if (test.DoControlWaterTemp && benchPath.TempMtrUp != null && benchPath.TempMtrDown != null) else if (test.DoControlWaterTemp && (benchPath.TempMtrUp != null) && (benchPath.TempMtrDown != null))
{ {
//--------------------------------------------------- //---------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_temperature); Bridge.OnActivity(this, Strings.Setting_temperature);
@@ -391,17 +413,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -415,15 +435,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//----------------------------------------------------------------- //-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -441,15 +457,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -465,25 +477,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -509,10 +509,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{ {
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps);
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -525,8 +523,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -614,22 +611,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro),
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) test.Qfrom, test.Qto, (2 * totalPulses), new int[] { (int)test.TolerRed, }))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -638,22 +625,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
StartTime = (double)StateMachine.Time; StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -750,21 +727,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
EndTime = (double)StateMachine.Time; EndTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -774,25 +741,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -807,25 +762,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -842,11 +785,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -875,12 +818,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
if (debugLevel != Config.Entities.DebugMode.Simulate) if (debugLevel != Config.Entities.DebugMode.Simulate)
{ {
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps);
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -893,8 +834,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -1029,8 +969,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } /// TODO: this is an endless loop !!! if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } /// TODO: this is an endless loop !!!
} }
@@ -1039,10 +978,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
stopTestWOTransitionAfter: stopTestWOTransitionAfter:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
@@ -1051,15 +987,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// Fixed start mass collection method with deferred evaluation of images /// Fixed start mass collection method with deferred evaluation of images
/// </summary> /// </summary>
/// <param name="test">Test entity</param> /// <param name="test">Test entity</param>
/// <returns> /// <returns>Always Event.Done</returns>
/// Event.Done . . . . . . . OK
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
/// Event.Error . . . . . . Unspecified error
/// </returns>
public IList<Event> Execute2ndPass(Config.Entities.Test test, int repetNr, IntermediateData data) public IList<Event> Execute2ndPass(Config.Entities.Test test, int repetNr, IntermediateData data)
{ {
IList<Event> e = new List<Event>(1); /// Events from currently running operations IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
/// ///
/// Populate TestResult data entity with data /// Populate TestResult data entity with data
@@ -1075,13 +1006,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering water meter states", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Entering water meter states", test.Method, test.Name))
.AddOperation(de4Cam.ShowDeferredTestEvalFormOp(sensPath.RegisterReaders, .AddOperation(de4Cam.ShowDeferredTestEvalFormOp(sensPath.RegisterReaders, tstRslt.VolumeCTV,
tstRslt.VolumeCTV, test.ErrLimLo + test.Uncertainty,
test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty))
test.ErrLimHi - test.Uncertainty))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
} }
while (e.Contains(Event.ModelessFormIsOpen)); while (e.Contains(Event.ModelessFormIsOpen));
@@ -1203,14 +1132,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
allResults.Info(TestResult2CsvLine(data.TestName, data.TestPart)); allResults.Info(TestResult2CsvLine(data.TestName, data.TestPart));
} }
/// No operation for 1 period so that Stop() function of Data entry component is called /// No operation for 1 period so that Stop() function of Data entry component is called
State.Create(string.Format("{0}({1}) : No Op.", test.Method, test.Name)).EnterState(); State.Create(string.Format("{0}({1}) : No Op.", test.Method, test.Name)).EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); } while (false); StateMachine.WaitRunDevsRunOps();
return new List<Event> { Event.Done }; ;
e.Add(retVal);
return e;
} }
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2017 Sensus Metering Systems /// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -74,7 +74,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -90,8 +103,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//==================================== //====================================
loop: loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
/// ///
@@ -114,12 +139,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// Measure the weight in case there is no unconditional draining /// Measure the weight in case there is no unconditional draining
/// ///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(scale.ReadMassOp(ref Mass))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -136,7 +161,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// ///
/// Drain the water tank /// Drain the water tank
/// ///
switch (DrainTheTank(scale, heatMetersPromptOp)) IList<IOperation> ops = new List<IOperation>(readTempPressOps);
ops.Add(heatMetersPromptOp);
switch (DrainTheTank(scale, ops))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -147,12 +174,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
/// ///
State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Make sure the drain valve is closed", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp) .AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -173,13 +200,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -194,12 +221,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -213,12 +240,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -230,12 +257,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -257,12 +284,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
} }
/// ///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -272,12 +299,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
while (e.Contains(Event.ValvesBusy)); while (e.Contains(Event.ValvesBusy));
/// ///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -289,12 +316,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -326,15 +353,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -345,12 +368,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{ {
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2; double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2; double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && (heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && (Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && (Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm && (Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold) (Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -371,11 +394,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -395,15 +416,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//----------------------------------------------------------------- //-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -421,15 +438,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -445,25 +458,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -493,7 +494,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
string[] startImages = new string[sensPath.RegisterReaders.Length]; string[] startImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -506,8 +509,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -522,15 +524,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders)) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(checkUiOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -602,22 +600,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.FixedStart),
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) test.Qfrom, test.Qto, (2 * totalPulses), new int[] { (int)test.TolerRed, }))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.FixedStart,
test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -627,21 +615,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
StartTime = (double)StateMachine.Time; StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -738,21 +716,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
EndTime = (double)StateMachine.Time; EndTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -762,25 +730,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -795,25 +751,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -830,11 +774,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -906,10 +850,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty)); volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
} }
state.AddOperation(checkUiOp); state.AddOperation(checkUiOp)
state.EnterState(); .AddOperations(readTempPressOps)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -1225,8 +1169,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -1235,10 +1178,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
stopTestWOTransitionAfter: stopTestWOTransitionAfter:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -77,7 +77,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -94,8 +107,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//==================================== //====================================
loop: loop:
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
@@ -122,12 +147,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -142,11 +167,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -160,11 +185,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -176,11 +201,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -202,11 +227,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
} }
/// ///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -216,11 +241,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
while (e.Contains(Event.ValvesBusy)); while (e.Contains(Event.ValvesBusy));
/// ///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -232,11 +257,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -265,17 +290,15 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -289,11 +312,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start); Bridge.OnActivity(this, Strings.Stopping_flow_for_the_fixed_start);
//----------------------------------------------------------------- //-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -317,8 +340,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
{ {
string[] startImages = new string[sensPath.RegisterReaders.Length]; string[] startImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -330,9 +355,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
state2.AddOperation(roi.GrabImageOp(startImages[i])); state2.AddOperation(roi.GrabImageOp(startImages[i]));
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -347,11 +372,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders)) .AddOperation(checkUiOp)
.AddOperation(checkUiOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -404,18 +429,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4), new int[] { (int)test.TolerRed, }))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, (totalPulses * 5 / 4), new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -425,17 +443,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
StartTime = (double)StateMachine.Time; StartTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the start/stop valve at the beginning of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -513,17 +525,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
EndTime = (double)StateMachine.Time; EndTime = (double)StateMachine.Time;
State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the start/stop valve at the end of the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .EnterState();
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
} }
@@ -533,20 +539,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime); log.WarnFormat("Start valve switch time on test end = {0} ms", cBrd.ValveOpenCloseTime);
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -560,20 +558,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -585,11 +575,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -609,8 +599,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
{ {
string[] endImages = new string[sensPath.RegisterReaders.Length]; string[] endImages = new string[sensPath.RegisterReaders.Length];
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name)) State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart; GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -622,9 +614,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
state2.AddOperation(roi.GrabImageOp(endImages[i])); state2.AddOperation(roi.GrabImageOp(endImages[i]));
} }
} }
state2.EnterState(); state2.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -639,12 +631,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
Bridge.OnActivity(this, Strings.Enter_water_meter_data); Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name))
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, volumeCTV, (test.ErrLimLo + test.Uncertainty), (test.ErrLimHi - test.Uncertainty)))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -878,10 +869,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -31,65 +31,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
HeatMeters.TestParams heatMetersTestParams, HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel) Config.Entities.DebugMode debugLevel)
{ {
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
if (debugLevel == Config.Entities.DebugMode.Simulate) if (debugLevel == Config.Entities.DebugMode.Simulate)
{ {
/// return Simulate(test, repetitionNr, isLastRepetition, compoundTestParams, heatMetersTestParams, debugLevel);
/// Test method simulation }
///
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (compoundTestParams != null) IList<Event> e; /// Events from currently running operations
{
if (test.Name.ToLower().Contains("nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
else MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
}
else if (heatMetersTestParams != null)
{
MakeSimulatedHeatMeters(test, 1, 0, 1.5f, 1000000, heatMetersTestParams.ErrorLimitLo, heatMetersTestParams.ErrorLimitHi, heatMetersTestParams.EvaluateVolume);
}
else if (test.Name.ToLower().Contains("q3")) MakeSimulated(test, 1, 0, -0.5f);
else if (test.Name.ToLower().Contains("q2")) MakeSimulated(test, 1, 0, 0.5f);
else if (test.Name.ToLower().Contains("q1")) MakeSimulated(test, 1, 0, -5.1f);
else MakeSimulated(test, 1, 0, 0.9f);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed)); int rangeIx = 0; /// Default range, used for non-Elde flowmeters
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
//------------------------------------------------------------------
Bridge.OnActivity(this, string.Format("{0} simulation", test.Name));
//------------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Simulating {0}", test.Method, test.Name))
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) retVal = Event.UiCmdStop;
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(retVal);
return retListSim;
}
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{ {
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
@@ -106,15 +55,48 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (rangeIx == -1) if (rangeIx == -1)
{ {
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop; return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
goto stopTestWOStoppingDivGateEtc;
} }
} }
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -136,13 +118,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -156,12 +138,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -175,12 +157,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -192,12 +174,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -215,12 +197,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
//------------------------------------------------ //------------------------------------------------
int flowSetTime0 = StateMachine.Time; int flowSetTime0 = StateMachine.Time;
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -253,15 +235,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -298,17 +276,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -365,26 +341,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -412,28 +375,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0); StartNewStatistics(StateMachine.Time, BatchRslts.Batch.BatchNr, test.Name, repetitionNr, 0);
/// Measurement loop - begin /// Measurement loop - begin
State.Create("Read water meters") State.Create(string.Format("{0}({1}) : Read water meters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(queryEnd1)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(queryEnd1)
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -785,11 +735,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
@@ -798,10 +747,48 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
Compound.TestParams compoundTestParams,
HeatMeters.TestParams heatMetersTestParams,
Config.Entities.DebugMode debugLevel)
{
///
/// Test method simulation
///
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
if (compoundTestParams != null)
{
if (test.Name.ToLower().Contains("nok")) MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
else MakeSimulatedCompound(test, 1, 0, 0.7f, 1.0f);
}
else if (heatMetersTestParams != null)
{
MakeSimulatedHeatMeters(test, 1, 0, 1.5f, 1000000, heatMetersTestParams.ErrorLimitLo, heatMetersTestParams.ErrorLimitHi, heatMetersTestParams.EvaluateVolume);
}
else if (test.Name.ToLower().Contains("q3")) MakeSimulated(test, 1, 0, -0.5f);
else if (test.Name.ToLower().Contains("q2")) MakeSimulated(test, 1, 0, 0.5f);
else if (test.Name.ToLower().Contains("q1")) MakeSimulated(test, 1, 0, -5.1f);
else MakeSimulated(test, 1, 0, 0.9f);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, BatchRslts.GetTestRslt(Results.Utils.GetTestName(test.Name, 1, 1), 0)));
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
//------------------------------------------------------------------
Bridge.OnActivity(this, string.Format("{0} simulation", test.Name));
//------------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Simulating {0}", test.Method, test.Name))
.AddOperation(checkUiOp)
.EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps();
return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
}
} }
} }
@@ -82,7 +82,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); checkUiOp = new Operations.CheckUIOp(true);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
: ((compoundTestParams != null) ? compoundTestParams.NextTestVolume : ((compoundTestParams != null) ? compoundTestParams.NextTestVolume
@@ -94,11 +107,24 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//==================================== //====================================
loop: loop:
/// 'totalPulses' calculation has to be inside test repetition loop for this method !!!
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
int totalPulses = (int)((repetitionNr == 1 ? test.Volume : nextTestVolume) / LtrPerRefPulse + 0.5f); int totalPulses = (int)((repetitionNr == 1 ? test.Volume : nextTestVolume) / LtrPerRefPulse + 0.5f);
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -116,11 +142,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -146,11 +172,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
drainTheTank = false; drainTheTank = false;
#else #else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -183,13 +209,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -203,12 +229,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -222,12 +248,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -239,12 +265,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -261,12 +287,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -299,15 +325,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -344,17 +366,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -416,15 +436,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// ///
/// Make sure tank draining completed /// Make sure tank draining completed
/// ///
IList<IOperation> extraOps = new List<IOperation>(); switch (DrainTheTank(scale, readTempPressOps))
if (heatMetersPath != null)
{
extraOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
extraOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
}
switch (DrainTheTank(scale, extraOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -437,10 +449,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// Close the drain valve anyway /// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -455,15 +467,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -477,26 +485,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -521,26 +517,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartMeasurementOp(outPath,
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) (repetitionNr == 1) ? (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro) : Elde.TestMethods.Synchro,
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, (repetitionNr == 1) ? Elde.TestMethods.Diverter | Elde.TestMethods.Synchro : Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters)) test.Qfrom, test.Qto, totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -569,29 +554,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(queryEnd1)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(queryEnd1)
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -657,12 +629,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
State.Create("SequenceBase : Transition : TestEnd - Default action") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new MettlerToledo.KeepReadingMassesOp()) .AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, .AddOperation(new MettlerToledo.KeepReadingMassesOp())
StateMachine.DefaultValvesClose)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -674,26 +645,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -705,25 +664,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1087,21 +1034,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; } if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
@@ -1143,14 +1086,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//------------------------------------------------------------------- //-------------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Simulation", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Simulation", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.EnterState(); .EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps(); IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
} }
} }
} }
@@ -96,7 +96,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -106,8 +119,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -123,11 +148,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -144,7 +169,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (drainTheTank) if (drainTheTank)
{ {
#if BERLIN || SENTEC #if BERLIN || SENTEC
switch (DrainTheTank(outPath.Scale)) switch (DrainTheTank(outPath.Scale, readTempPressOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -152,12 +177,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
drainTheTank = false; drainTheTank = false;
#else #else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -190,13 +215,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -210,12 +235,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -229,12 +254,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -246,12 +271,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -268,12 +293,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -306,15 +331,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -325,12 +346,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
{ {
double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2; double Tw = (TempRefHi1.Val + TempRefHi2.Val) / 2;
double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2; double Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi && if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi && (heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm && (Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold && (Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm && (Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold) (Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -351,17 +372,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -422,15 +441,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// ///
/// Make sure tank draining completed /// Make sure tank draining completed
/// ///
IList<IOperation> extraOps = new List<IOperation>(); switch (DrainTheTank(scale, readTempPressOps))
if (heatMetersPath != null)
{
extraOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
extraOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
}
switch (DrainTheTank(scale, extraOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -443,10 +454,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Close the drain valve anyway /// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -464,11 +475,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// ///
State.Create(string.Format("{0}({1}) : Activate ref. mass valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Activate ref. mass valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(compareValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(compareValve, null))
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperation(scale.ReadMassOp(ref Mass))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -479,16 +490,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Delay /// Delay
/// ///
State.Create(string.Format("{0}({1}) : Waiting before the reference mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the reference mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .AddOperation(new Operations.TimerOp(stabTime))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .EnterState();
.AddOperation(scale.ReadMassOp(ref Mass)) do {
.AddOperation(new Operations.TimerOp(stabTime))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -502,26 +509,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
else LogProcessDataHeaderHeatMeters(processDataLogger, "Reference mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Reference mass");
/// ///
State.Create(string.Format("{0}({1}) : Measuring the reference mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the reference mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref measuredRefMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref measuredRefMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -546,11 +541,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// ///
State.Create(string.Format("{0}({1}) : Deactivate ref. mass valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Deactivate ref. mass valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, compareValve)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, compareValve))
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperation(scale.ReadMassOp(ref Mass))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -561,16 +556,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Delay /// Delay
/// ///
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .AddOperation(new Operations.TimerOp(stabTime))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) .EnterState();
.AddOperation(scale.ReadMassOp(ref Mass)) do {
.AddOperation(new Operations.TimerOp(stabTime))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -586,26 +577,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -640,26 +619,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -687,29 +653,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -773,12 +726,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
State.Create("SequenceBase : Transition : TestEnd - Default action") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp()) .AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -790,26 +742,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -821,25 +761,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1227,10 +1155,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1); }
retList.Add(retVal);
return retList;
}
} }
} }
@@ -91,6 +91,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done; Event retVal = Event.Done;
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -103,8 +116,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, targetTotalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, targetTotalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -120,11 +145,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -150,11 +175,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
drainTheTank = false; drainTheTank = false;
#else #else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -187,13 +212,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) // .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -207,12 +232,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -226,12 +251,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -243,12 +268,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -265,12 +290,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -303,15 +328,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -348,17 +369,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -419,15 +438,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// ///
/// Make sure tank draining completed /// Make sure tank draining completed
/// ///
IList<IOperation> extraOps = new List<IOperation>(); switch (DrainTheTank(scale, readTempPressOps))
if (heatMetersPath != null)
{
extraOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
extraOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
}
switch (DrainTheTank(scale, extraOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -440,10 +451,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// Close the drain valve anyway /// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -459,15 +470,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -481,26 +488,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -524,26 +519,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartProlongedMeasurementOp(outPath,
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) Elde.TestMethods.Diverter | Elde.TestMethods.Synchro | Elde.TestMethods.MassAndContinue,
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) test.Qfrom, test.Qto, targetTotalPulses, targetMassPulses, filters))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartProlongedMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro | Elde.TestMethods.MassAndContinue,
test.Qfrom, test.Qto, targetTotalPulses, targetMassPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -571,29 +555,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -657,12 +628,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create("SequenceBase : Transition : TestEnd - Default action") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp()) .AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -674,26 +644,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -705,25 +663,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1067,11 +1013,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1); }
retList.Add(retVal);
return retList;
}
IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
@@ -1116,10 +1059,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
.EnterState(); .EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps(); IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
IList<Event> retListSim = new List<Event>(1); }
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
}
} }
} }
@@ -41,16 +41,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
return Simulate2(test, repetitionNr, isLastRepetition, compoundTestParams, heatMetersTestParams); return Simulate2(test, repetitionNr, isLastRepetition, compoundTestParams, heatMetersTestParams);
} }
IList<Event> e = new List<Event>(); /// Events from currently running operations
IScale scale = outPath.Scale as IScale; IScale scale = outPath.Scale as IScale;
if (scale == null) if (scale == null)
{ {
Bridge.OnError(this, Strings.Missing_a_scale); Bridge.OnError(this, Strings.Missing_a_scale);
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
return e; }
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
@@ -69,23 +65,35 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (rangeIx == -1) if (rangeIx == -1)
{ {
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
return e; }
}
} }
if (test.Volume > scale.Capacity * Constants.TankFullFactor) if (test.Volume > scale.Capacity * Constants.TankFullFactor)
{ {
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity); Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
e.Add(Event.UiCmdStop); return new List<Event> { Event.UiCmdStop };
return e;
} }
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, heatMetersTestParams != null);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if(benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if(benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if(outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if(benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -95,8 +103,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -112,11 +132,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Measure the weight and skip emptying if there is enough room in the tank /// Measure the weight and skip emptying if there is enough room in the tank
/// ///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(scale.ReadMassOp(ref Mass)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(scale.ReadMassOp(ref Mass))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -133,7 +153,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (drainTheTank) if (drainTheTank)
{ {
#if BERLIN || SENTEC #if BERLIN || SENTEC
switch (DrainTheTank(outPath.Scale)) switch (DrainTheTank(outPath.Scale, readTempPressOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -141,12 +161,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
drainTheTank = false; drainTheTank = false;
#else #else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.EnterState(); .AddOperations(readTempPressOps)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -179,13 +199,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) // .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperation(heatMetersPromptOp)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -199,12 +219,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -218,12 +238,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -235,12 +255,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -257,12 +277,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(heatMetersPromptOp)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -295,15 +315,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
double Tc_last = 0; double Tc_last = 0;
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(heatMetersPromptOp)
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
@@ -340,18 +356,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .EnterState();
.EnterState(); do {
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
} }
@@ -411,15 +425,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// ///
/// Make sure tank draining completed /// Make sure tank draining completed
/// ///
IList<IOperation> extraOps = new List<IOperation>(); switch (DrainTheTank(scale, readTempPressOps))
if (heatMetersPath != null)
{
extraOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
extraOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
extraOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
extraOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
}
switch (DrainTheTank(scale, extraOps))
{ {
case Event.Error: { retVal = Event.Error; goto stopTest; } case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; } case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -432,10 +438,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Close the drain valve anyway /// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -451,15 +457,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (test.TimeFlow2Mass > 0) if (test.TimeFlow2Mass > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) .AddOperations(readTempPressOps)
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2)) .AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2)) do {
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -473,25 +475,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "Start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient == null) ? null : StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi))
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -515,26 +506,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -562,29 +540,16 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -650,12 +615,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create("SequenceBase : Transition : TestEnd - Default action") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp()) .AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -667,26 +631,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
Bridge.OnActivity(this, Strings.Measuring_the_weight); Bridge.OnActivity(this, Strings.Measuring_the_weight);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) .EnterState();
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -698,25 +650,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass"); else LogProcessDataHeaderHeatMeters(processDataLogger, "End mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1093,9 +1033,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do
{ {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
@@ -1106,10 +1046,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
@@ -1154,10 +1091,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.EnterState(); .EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps(); IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
} }
@@ -1224,10 +1158,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
IList<Event> retListSim = new List<Event>(1); }
retListSim.Add(retVal);
return retListSim;
}
} }
} }
@@ -80,7 +80,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
Event retVal = Event.Done;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
Event retVal = Event.Done;
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -92,8 +105,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -121,12 +146,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -140,11 +165,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -158,11 +183,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -174,11 +199,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -195,11 +220,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -229,17 +254,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .EnterState();
.EnterState(); do {
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -297,22 +320,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(processDataLoggingOp)
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -340,24 +355,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
/// Measurement loop - begin /// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(readRegistersOp) .AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi)
: null)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(cBrd.QueryMeasurementEndOp())
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -404,11 +410,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
State.Create("SequenceBase : Transition : TestEnd - Default action") State.Create("SequenceBase : Transition : TestEnd - Default action")
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, .AddOperations(readTempPressOps)
StateMachine.DefaultValvesClose)) .AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -420,21 +425,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
Bridge.OnActivity(this, Strings.Wait_please); Bridge.OnActivity(this, Strings.Wait_please);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the water level measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before the water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -446,20 +443,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv)) .AddOperation(processDataLoggingOp)
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -767,11 +756,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1); }
retList.Add(retVal);
return retList;
}
public IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, public IList<Event> Simulate(Config.Entities.Test test, int repetitionNr, bool isLastRepetition,
@@ -784,11 +770,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter)) if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
{ {
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement); Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
return new List<Event> { Event.ConfigurationError };
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim1 = new List<Event>(1);
retListSim1.Add(Event.ConfigurationError);
return retListSim1;
} }
IVolumeMeter tank = outPath.Scale as IVolumeMeter; IVolumeMeter tank = outPath.Scale as IVolumeMeter;
@@ -846,10 +828,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
stopSimulation: stopSimulation:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(retVal);
return retListSim;
} }
} }
} }
@@ -56,11 +56,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
while (e.Contains(Event.CameraBusy)); while (e.Contains(Event.CameraBusy));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
return new List<Event> { retVal };
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2016 Sensus Metering Systems /// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -29,16 +29,38 @@ namespace TBF.BenchControl.TestMethods.LeakTest
/// </returns> /// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, LeakTestParams testParams) public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, LeakTestParams testParams)
{ {
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; IList<Event> e ; /// Events from currently running operations
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done; Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
//------------------------------------------------ //------------------------------------------------
@@ -47,17 +69,12 @@ namespace TBF.BenchControl.TestMethods.LeakTest
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -78,16 +95,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower);
State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(5))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -132,16 +144,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Maximum water pressure set", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Maximum water pressure set", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -167,16 +174,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
Bridge.OnActivity(this, Strings.Closing_valve_Pump_off); Bridge.OnActivity(this, Strings.Closing_valve_Pump_off);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .EnterState();
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -191,16 +193,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff(); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOff();
State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .EnterState();
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) do {
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -222,16 +219,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
Bridge.OnActivity(this, Strings.Test_in_progress); Bridge.OnActivity(this, Strings.Test_in_progress);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(testParams.DurationLeak))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new Operations.TimerOp(testParams.DurationLeak))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -379,21 +371,17 @@ namespace TBF.BenchControl.TestMethods.LeakTest
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -57,11 +57,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
while (!e.Contains(Event.OK)); while (!e.Contains(Event.OK));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
return new List<Event> { retVal };
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015-2016 Sensus Metering Systems /// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -29,16 +29,38 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// </returns> /// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, PMaxTestParams testParams) public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, PMaxTestParams testParams)
{ {
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; IList<Event> e; /// Events from currently running operations
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done; Event retVal = Event.Done;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
/// Start the test, initialize test results IList<IOperation> readTempPressOps = new List<IOperation>();
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, 0)); if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, 1, inPath, benchPath, outPath, sensPath, heatMetersPath, 0));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, 1);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -48,17 +70,12 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) .EnterState();
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta)) do {
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -79,16 +96,11 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(pumpPower);
State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(5))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -133,16 +145,11 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown)) .AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp)) .EnterState();
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown)) do {
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.EnterState();
do
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -290,21 +297,17 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1); }
retList.Add(retVal);
return retList;
}
} }
} }
@@ -55,23 +55,9 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
/// </returns> /// </returns>
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, TestParams testParams, DebugMode mode) public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition, TestParams testParams, DebugMode mode)
{ {
float simulatedError = 4.5f; /// % float simulatedError = 4.5f; /// %
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; int rangeIx = 0; /// Default range, used for non-Elde flowmeters
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
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{ {
Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter; Elde.FlowMeter.FlowMeter eldeFM = outPath.FlowMeter as Elde.FlowMeter.FlowMeter;
@@ -88,15 +74,45 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (rangeIx == -1) if (rangeIx == -1)
{ {
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop; return new List<Event> { Event.ConfigurationError };
goto stopTestWOStoppingDivGateEtc;
} }
} }
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
/// Start the test, initialize test results IList<IOperation> readTempPressOps = new List<IOperation>();
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -108,13 +124,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create("Adjustment : Starting the pump") State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -129,11 +145,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -147,11 +163,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -163,11 +179,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -183,12 +199,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create("Adjustment : Setting the flow") State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -217,17 +233,15 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
@@ -296,12 +310,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
//tstRslt = MakeSimulated(test, 1, simulatedError); //tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f; simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test") State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(5)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(5))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +324,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
} }
else else
{ {
State.Create("Adjustment : Starting the test") State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, .AddOperations(measureOperations)
test.Qfrom, test.Qto, totalPulses, filters)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -478,12 +491,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create("Adjustment : Stopping diverter, gate, etc.") State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -492,10 +504,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -57,20 +57,6 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
{ {
float simulatedError = 4.5f; /// % float simulatedError = 4.5f; /// %
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
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
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
int rangeIx = 0; /// Default range, used for non-Elde flowmeters int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter) if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{ {
@@ -88,15 +74,47 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (rangeIx == -1) if (rangeIx == -1)
{ {
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions); Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop; return new List<Event> { Event.ConfigurationError };
goto stopTestWOStoppingDivGateEtc;
} }
} }
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false); processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
/// Start the test, initialize test results IList<IOperation> readTempPressOps = new List<IOperation>();
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (e.Contains(Event.Busy));
/// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -108,13 +126,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
//------------------------------------------------ //------------------------------------------------
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
/// ///
State.Create("Adjustment : Starting the pump") State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60)) .AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) //.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -129,11 +147,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -147,11 +165,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -163,11 +181,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -183,12 +201,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
//------------------------------------------------ //------------------------------------------------
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create("Adjustment : Setting the flow") State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -217,18 +235,16 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp)) .AddOperations(readTempPressOps)
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set; if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi && if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi) (test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{ {
goto temperature_set; goto temperature_set;
} }
} }
@@ -296,12 +312,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
//tstRslt = MakeSimulated(test, 1, simulatedError); //tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f; simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test") State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(5)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(5))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +326,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
} }
else else
{ {
State.Create("Adjustment : Starting the test") State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, .AddOperations(measureOperations)
test.Qfrom, test.Qto, totalPulses, filters)) .AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -474,12 +489,11 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError if (isLastRepetition || retVal == Event.UiCmdStop || retVal == Event.OpArgumentError
|| retVal == Event.Error || retVal == Event.ConfigurationError) || retVal == Event.Error || retVal == Event.ConfigurationError)
{ {
State.Create("Adjustment : Stopping diverter, gate, etc.") State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
} }
@@ -488,10 +502,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
stopTestWOStoppingDivGateEtc: stopTestWOStoppingDivGateEtc:
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2017 Sensus Metering Systems /// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -19,28 +19,33 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
public IList<Event> Execute(Test test, GenericDevices.ICameraDisplay display, int repetitionNr, bool isLastRepetition) public IList<Event> Execute(Test test, GenericDevices.ICameraDisplay display, int repetitionNr, bool isLastRepetition)
{ {
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; IList<Event> e; /// Events from currently running operations
IList<Event> e = new List<Event>(); /// Events from currently running operations
Event retVal = Event.Done; Event retVal = Event.Done;
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
/// Operations
checkUiOp = new Operations.CheckUIOp(true); checkUiOp = new Operations.CheckUIOp(true);
processDataLoggingOp = null; processDataLoggingOp = null;
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
/// LtrPerRefPulse and totalPulses are only to make time estimates /// LtrPerRefPulse and totalPulses are only to make time estimates
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h] LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse; /// [ltr/pulse], nominal flow in [m3/h]
/// Notes:
/// float timeHr = volumeLtr / (1000.0f * targetFlow);
/// float timeSec = 3600.0f * timeHr;
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f); int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
//==================== //====================
// Start the test // Start the test
//==================== //====================
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -50,11 +55,11 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
/// ///
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower); if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -67,11 +72,11 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
if (test.TimePump2StartV > 0) if (test.TimePump2StartV > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimePump2StartV))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -85,11 +90,11 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
if (benchPath.StopBFValve != null) if (benchPath.StopBFValve != null)
{ {
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; } if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; } if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -101,11 +106,11 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
if (test.TimeBeforeFlow > 0) if (test.TimeBeforeFlow > 0)
{ {
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -122,11 +127,11 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
Bridge.OnActivity(this, Strings.Setting_the_flow); Bridge.OnActivity(this, Strings.Setting_the_flow);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec)) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -169,7 +174,9 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
//--------------------------------------------------------- //---------------------------------------------------------
State detection = State.Create(string.Format("{0}({1}) : Detection of ROI-s", test.Method, test.Name)) State detection = State.Create(string.Format("{0}({1}) : Detection of ROI-s", test.Method, test.Name))
.AddOperation(checkUiOp); .AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++) for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{ {
GenericDevices.IRoi roi = sensPath.RegisterReaders[i] as GenericDevices.IRoi; GenericDevices.IRoi roi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
@@ -179,23 +186,15 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
imageNames[i] = roi.ImageFileNamePrefix + "detected.jpg"; imageNames[i] = roi.ImageFileNamePrefix + "detected.jpg";
} }
} }
detection.EnterState(); detection.EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
if (e.Contains(Event.Error)) if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
{ if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
retVal = Event.Error;
goto stopTest;
}
if (TestAndLogUiCmdStop(test,e))
{
retVal = Event.UiCmdStop;
goto stopTest;
}
} }
while (e.Contains(Event.CameraBusy)); while (e.Contains(Event.CameraBusy));
@@ -215,10 +214,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
string title = Strings.Select_images_and_press_Retry_to_retry_RoI_detection; string title = Strings.Select_images_and_press_Retry_to_retry_RoI_detection;
State.Create(string.Format("{0}({1}) : Select images and press Retry to retry RoI detection", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Select images and press Retry to retry RoI detection", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((display == null) ? null : display.ShowStaticImageOp(imageNames, title)) .AddOperations(readTempPressOps)
.AddOperation((display == null) ? null : display.ShowStaticImageOp(imageNames, title))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) if (TestAndLogUiCmdStop(test, e))
@@ -264,18 +263,14 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) goto stopTest; if (TestAndLogUiCmdStop(test, e)) goto stopTest;
} }
while (!e.Contains(Event.PreviousStopped)); while (!e.Contains(Event.PreviousStopped));
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it return new List<Event> { retVal };
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
} }
} }
} }
@@ -34,30 +34,39 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
if (debugLevel == Config.Entities.DebugMode.Simulate) if (debugLevel == Config.Entities.DebugMode.Simulate)
{ {
/// TODO: Test method simulation /// TODO: Test method simulation
IList<Event> retListSim = new List<Event>(1); return new List<Event> { Event.Done };
retListSim.Add(Event.Done);
return retListSim;
} }
IList<Event> e = new List<Event>(); /// Events from currently running operations IList<Event> e; /// Events from currently running operations
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
IList<IOperation> readTempPressOps = new List<IOperation>();
if (benchPath.TempMtrUp != null) readTempPressOps.Add(benchPath.TempMtrUp.ReadTempOp(ref TempUp));
if (benchPath.TempMtrDown != null) readTempPressOps.Add(benchPath.TempMtrDown.ReadTempOp(ref TempDown));
if (outPath.TempDiv != null) readTempPressOps.Add(outPath.TempDiv.ReadTempOp(ref TempDiv));
if (benchPath.PressMtrUp != null) readTempPressOps.Add(benchPath.PressMtrUp.ReadPressureOp(ref PressUp));
if (benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
if (benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms float switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
/// Specific for combined meters /// Specific for combined meters
int[] lastWMPulses = new int[Config.Data.WMsCount]; int[] lastWMPulses = new int[Config.Data.WMsCount];
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : stopTest diverter gate etc", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : stopTest diverter gate etc", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.EnterState(); .AddOperation(cBrd.StopPreviousOp())
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -80,7 +89,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//==================================== //====================================
loop: loop:
/// Start the test, initialize test results /// Start the test, initialize test results
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, (int)totalPulses)); Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now; TestStartTime = DateTime.Now;
@@ -127,7 +136,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp()); foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
int flowDetectTime0 = StateMachine.Time; int flowDetectTime0 = StateMachine.Time;
int flowDetectTime = 0; int flowDetectTime = 0;
float estFlowSetTime = 100.0f; float estFlowSetTime = 100.0f;
@@ -136,13 +144,13 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
Bridge.OnActivity(this, Strings.Switching_flow_detection); Bridge.OnActivity(this, Strings.Switching_flow_detection);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null) .AddOperations(measureOperations)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null)) .AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null)
.EnterState(); .AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -152,12 +160,12 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Setting the initial flow", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Setting the initial flow", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed)) .AddOperations(measureOperations)
.EnterState(); .AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -212,12 +220,12 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
{ {
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Changing the RV position", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Changing the RV position", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperations(measureOperations) .AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse)) .AddOperations(measureOperations)
.EnterState(); .AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -334,12 +342,12 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
Bridge.OnActivity(this, Strings.Test_completed); Bridge.OnActivity(this, Strings.Test_completed);
//------------------------------------------------ //------------------------------------------------
State.Create(string.Format("{0}({1}) : {2}", test.Method, test.Name, Strings.Stop_the_pump)) State.Create(string.Format("{0}({1}) : {2}", test.Method, test.Name, Strings.Stop_the_pump))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperations(readTempPressOps)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
do .EnterState();
{ do {
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -349,10 +357,10 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//-------------------------------- //--------------------------------
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp()) .AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest; if (TestAndLogUiCmdStop(test,e)) goto stopTest;
} }
@@ -463,59 +471,49 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
{ {
/// Stop the pump /// Stop the pump
State.Create(string.Format("{0}({1}) : Test(s) completed -> Stopping the pump", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : Test(s) completed -> Stopping the pump", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump)) .AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
} }
while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone))); while (!e.Contains(Event.ValvesSet) || ((inPath.Pump is GenericDevices.IPumpFM) && !e.Contains(Event.TurnPumpOnOffDone)));
} }
/// Create the return value - a list with one event Event.Done - and return return new List<Event> { Event.Done };
IList<Event> retval1 = new List<Event>(1);
retval1.Add(Event.Done);
return retval1;
//==================================== //====================================
stopTest: stopTest:
State.Create(string.Format("{0}({1}) : User selected STOP -> Closing the valves", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : User selected STOP -> Closing the valves", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error; if (e.Contains(Event.Error)) goto error;
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
IList<Event> retval2 = new List<Event>(1); return new List<Event> { Event.UiCmdStop };
retval2.Add(Event.UiCmdStop);
return retval2;
//==================================== //====================================
error: error:
State.Create(string.Format("{0}({1}) : close_before_error", test.Method, test.Name)) State.Create(string.Format("{0}({1}) : close_before_error", test.Method, test.Name))
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null) .AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose)) .AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState(); .EnterState();
do do {
{
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) break; if (e.Contains(Event.Error)) break;
} }
while (!e.Contains(Event.ValvesSet)); while (!e.Contains(Event.ValvesSet));
IList<Event> retval3 = new List<Event>(1); return new List<Event> { Event.Error };
retval3.Add(Event.Error); }
return retval3;
}
} }
} }
@@ -291,7 +291,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
modelessDlg = null; /// Modeless dialog is closed now modelessDlg = null; /// Modeless dialog is closed now
} }
/// Create a list with one item 'retVal' (default is Event.Done) and return it
return new List<Event> { Event.Done }; return new List<Event> { Event.Done };
} }
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.1168.0")] [assembly: AssemblyVersion("2.18.1171.0")]
[assembly: AssemblyFileVersion("2.18.1168.0")] [assembly: AssemblyFileVersion("2.18.1171.0")]
+92 -14
View File
@@ -33,6 +33,12 @@ namespace TBF.Screens
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProcessTabPageExCtrl)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProcessTabPageExCtrl));
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tLoCmpntLabel = new System.Windows.Forms.Label();
this.tLoDataLabel = new System.Windows.Forms.Label();
this.tLoLabel = new System.Windows.Forms.Label();
this.tHiCmpntLabel = new System.Windows.Forms.Label();
this.tHiDataLabel = new System.Windows.Forms.Label();
this.tHiLabel = new System.Windows.Forms.Label();
this.pumpPctTextBox = new System.Windows.Forms.TextBox(); this.pumpPctTextBox = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.flowMeterPictureBox = new System.Windows.Forms.PictureBox(); this.flowMeterPictureBox = new System.Windows.Forms.PictureBox();
@@ -118,6 +124,12 @@ namespace TBF.Screens
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.tLoCmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.tLoDataLabel);
this.splitContainer1.Panel1.Controls.Add(this.tLoLabel);
this.splitContainer1.Panel1.Controls.Add(this.tHiCmpntLabel);
this.splitContainer1.Panel1.Controls.Add(this.tHiDataLabel);
this.splitContainer1.Panel1.Controls.Add(this.tHiLabel);
this.splitContainer1.Panel1.Controls.Add(this.pumpPctTextBox); this.splitContainer1.Panel1.Controls.Add(this.pumpPctTextBox);
this.splitContainer1.Panel1.Controls.Add(this.pictureBox1); this.splitContainer1.Panel1.Controls.Add(this.pictureBox1);
this.splitContainer1.Panel1.Controls.Add(this.flowMeterPictureBox); this.splitContainer1.Panel1.Controls.Add(this.flowMeterPictureBox);
@@ -187,6 +199,66 @@ namespace TBF.Screens
this.splitContainer1.SplitterWidth = 1; this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 182; this.splitContainer1.TabIndex = 182;
// //
// tLoCmpntLabel
//
this.tLoCmpntLabel.AutoSize = true;
this.tLoCmpntLabel.Location = new System.Drawing.Point(367, 218);
this.tLoCmpntLabel.Name = "tLoCmpntLabel";
this.tLoCmpntLabel.Size = new System.Drawing.Size(52, 13);
this.tLoCmpntLabel.TabIndex = 250;
this.tLoCmpntLabel.Text = "tLoCmpnt";
this.tLoCmpntLabel.Visible = false;
//
// tLoDataLabel
//
this.tLoDataLabel.AutoSize = true;
this.tLoDataLabel.Location = new System.Drawing.Point(367, 234);
this.tLoDataLabel.Name = "tLoDataLabel";
this.tLoDataLabel.Size = new System.Drawing.Size(45, 13);
this.tLoDataLabel.TabIndex = 249;
this.tLoDataLabel.Text = "tLoData";
this.tLoDataLabel.Visible = false;
//
// tLoLabel
//
this.tLoLabel.AutoSize = true;
this.tLoLabel.Location = new System.Drawing.Point(306, 234);
this.tLoLabel.Name = "tLoLabel";
this.tLoLabel.Size = new System.Drawing.Size(48, 13);
this.tLoLabel.TabIndex = 248;
this.tLoLabel.Text = "T lo [°C]:";
this.tLoLabel.Visible = false;
//
// tHiCmpntLabel
//
this.tHiCmpntLabel.AutoSize = true;
this.tHiCmpntLabel.Location = new System.Drawing.Point(367, 178);
this.tHiCmpntLabel.Name = "tHiCmpntLabel";
this.tHiCmpntLabel.Size = new System.Drawing.Size(50, 13);
this.tHiCmpntLabel.TabIndex = 247;
this.tHiCmpntLabel.Text = "tHiCmpnt";
this.tHiCmpntLabel.Visible = false;
//
// tHiDataLabel
//
this.tHiDataLabel.AutoSize = true;
this.tHiDataLabel.Location = new System.Drawing.Point(367, 194);
this.tHiDataLabel.Name = "tHiDataLabel";
this.tHiDataLabel.Size = new System.Drawing.Size(43, 13);
this.tHiDataLabel.TabIndex = 246;
this.tHiDataLabel.Text = "tHiData";
this.tHiDataLabel.Visible = false;
//
// tHiLabel
//
this.tHiLabel.AutoSize = true;
this.tHiLabel.Location = new System.Drawing.Point(306, 194);
this.tHiLabel.Name = "tHiLabel";
this.tHiLabel.Size = new System.Drawing.Size(48, 13);
this.tHiLabel.TabIndex = 245;
this.tHiLabel.Text = "T hi [°C]:";
this.tHiLabel.Visible = false;
//
// pumpPctTextBox // pumpPctTextBox
// //
this.pumpPctTextBox.Location = new System.Drawing.Point(797, 372); this.pumpPctTextBox.Location = new System.Drawing.Point(797, 372);
@@ -613,7 +685,7 @@ namespace TBF.Screens
// prInCmpntLabel // prInCmpntLabel
// //
this.prInCmpntLabel.AutoSize = true; this.prInCmpntLabel.AutoSize = true;
this.prInCmpntLabel.Location = new System.Drawing.Point(141, 124); this.prInCmpntLabel.Location = new System.Drawing.Point(141, 178);
this.prInCmpntLabel.Name = "prInCmpntLabel"; this.prInCmpntLabel.Name = "prInCmpntLabel";
this.prInCmpntLabel.Size = new System.Drawing.Size(55, 13); this.prInCmpntLabel.Size = new System.Drawing.Size(55, 13);
this.prInCmpntLabel.TabIndex = 194; this.prInCmpntLabel.TabIndex = 194;
@@ -622,7 +694,7 @@ namespace TBF.Screens
// prOutCmpntLabel // prOutCmpntLabel
// //
this.prOutCmpntLabel.AutoSize = true; this.prOutCmpntLabel.AutoSize = true;
this.prOutCmpntLabel.Location = new System.Drawing.Point(598, 124); this.prOutCmpntLabel.Location = new System.Drawing.Point(598, 178);
this.prOutCmpntLabel.Name = "prOutCmpntLabel"; this.prOutCmpntLabel.Name = "prOutCmpntLabel";
this.prOutCmpntLabel.Size = new System.Drawing.Size(63, 13); this.prOutCmpntLabel.Size = new System.Drawing.Size(63, 13);
this.prOutCmpntLabel.TabIndex = 193; this.prOutCmpntLabel.TabIndex = 193;
@@ -631,7 +703,7 @@ namespace TBF.Screens
// tOutCmpntLabel // tOutCmpntLabel
// //
this.tOutCmpntLabel.AutoSize = true; this.tOutCmpntLabel.AutoSize = true;
this.tOutCmpntLabel.Location = new System.Drawing.Point(598, 162); this.tOutCmpntLabel.Location = new System.Drawing.Point(598, 218);
this.tOutCmpntLabel.Name = "tOutCmpntLabel"; this.tOutCmpntLabel.Name = "tOutCmpntLabel";
this.tOutCmpntLabel.Size = new System.Drawing.Size(57, 13); this.tOutCmpntLabel.Size = new System.Drawing.Size(57, 13);
this.tOutCmpntLabel.TabIndex = 192; this.tOutCmpntLabel.TabIndex = 192;
@@ -640,7 +712,7 @@ namespace TBF.Screens
// tInCmpntLabel // tInCmpntLabel
// //
this.tInCmpntLabel.AutoSize = true; this.tInCmpntLabel.AutoSize = true;
this.tInCmpntLabel.Location = new System.Drawing.Point(141, 162); this.tInCmpntLabel.Location = new System.Drawing.Point(141, 218);
this.tInCmpntLabel.Name = "tInCmpntLabel"; this.tInCmpntLabel.Name = "tInCmpntLabel";
this.tInCmpntLabel.Size = new System.Drawing.Size(49, 13); this.tInCmpntLabel.Size = new System.Drawing.Size(49, 13);
this.tInCmpntLabel.TabIndex = 191; this.tInCmpntLabel.TabIndex = 191;
@@ -658,7 +730,7 @@ namespace TBF.Screens
// prOutLabel // prOutLabel
// //
this.prOutLabel.AutoSize = true; this.prOutLabel.AutoSize = true;
this.prOutLabel.Location = new System.Drawing.Point(598, 140); this.prOutLabel.Location = new System.Drawing.Point(598, 194);
this.prOutLabel.Name = "prOutLabel"; this.prOutLabel.Name = "prOutLabel";
this.prOutLabel.Size = new System.Drawing.Size(33, 13); this.prOutLabel.Size = new System.Drawing.Size(33, 13);
this.prOutLabel.TabIndex = 189; this.prOutLabel.TabIndex = 189;
@@ -667,7 +739,7 @@ namespace TBF.Screens
// tOutLabel // tOutLabel
// //
this.tOutLabel.AutoSize = true; this.tOutLabel.AutoSize = true;
this.tOutLabel.Location = new System.Drawing.Point(598, 178); this.tOutLabel.Location = new System.Drawing.Point(598, 234);
this.tOutLabel.Name = "tOutLabel"; this.tOutLabel.Name = "tOutLabel";
this.tOutLabel.Size = new System.Drawing.Size(27, 13); this.tOutLabel.Size = new System.Drawing.Size(27, 13);
this.tOutLabel.TabIndex = 188; this.tOutLabel.TabIndex = 188;
@@ -676,7 +748,7 @@ namespace TBF.Screens
// label17 // label17
// //
this.label17.AutoSize = true; this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(517, 140); this.label17.Location = new System.Drawing.Point(517, 194);
this.label17.Name = "label17"; this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(73, 13); this.label17.Size = new System.Drawing.Size(73, 13);
this.label17.TabIndex = 187; this.label17.TabIndex = 187;
@@ -685,7 +757,7 @@ namespace TBF.Screens
// label18 // label18
// //
this.label18.AutoSize = true; this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(524, 178); this.label18.Location = new System.Drawing.Point(524, 234);
this.label18.Name = "label18"; this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(66, 13); this.label18.Size = new System.Drawing.Size(66, 13);
this.label18.TabIndex = 186; this.label18.TabIndex = 186;
@@ -694,7 +766,7 @@ namespace TBF.Screens
// prInLabel // prInLabel
// //
this.prInLabel.AutoSize = true; this.prInLabel.AutoSize = true;
this.prInLabel.Location = new System.Drawing.Point(141, 140); this.prInLabel.Location = new System.Drawing.Point(141, 194);
this.prInLabel.Name = "prInLabel"; this.prInLabel.Name = "prInLabel";
this.prInLabel.Size = new System.Drawing.Size(25, 13); this.prInLabel.Size = new System.Drawing.Size(25, 13);
this.prInLabel.TabIndex = 185; this.prInLabel.TabIndex = 185;
@@ -703,7 +775,7 @@ namespace TBF.Screens
// tInLabel // tInLabel
// //
this.tInLabel.AutoSize = true; this.tInLabel.AutoSize = true;
this.tInLabel.Location = new System.Drawing.Point(141, 178); this.tInLabel.Location = new System.Drawing.Point(141, 234);
this.tInLabel.Name = "tInLabel"; this.tInLabel.Name = "tInLabel";
this.tInLabel.Size = new System.Drawing.Size(19, 13); this.tInLabel.Size = new System.Drawing.Size(19, 13);
this.tInLabel.TabIndex = 184; this.tInLabel.TabIndex = 184;
@@ -712,7 +784,7 @@ namespace TBF.Screens
// label14 // label14
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(73, 140); this.label14.Location = new System.Drawing.Point(73, 194);
this.label14.Name = "label14"; this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(59, 13); this.label14.Size = new System.Drawing.Size(59, 13);
this.label14.TabIndex = 183; this.label14.TabIndex = 183;
@@ -721,7 +793,7 @@ namespace TBF.Screens
// label13 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(80, 178); this.label13.Location = new System.Drawing.Point(80, 234);
this.label13.Name = "label13"; this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(52, 13); this.label13.Size = new System.Drawing.Size(52, 13);
this.label13.TabIndex = 182; this.label13.TabIndex = 182;
@@ -737,14 +809,14 @@ namespace TBF.Screens
this.metersListView.UseCompatibleStateImageBehavior = false; this.metersListView.UseCompatibleStateImageBehavior = false;
this.metersListView.View = System.Windows.Forms.View.Details; this.metersListView.View = System.Windows.Forms.View.Details;
// //
// ProcessTabPageHeatMetersCtrl // ProcessTabPageExCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control; this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.Name = "ProcessTabPageHeatMetersCtrl"; this.Name = "ProcessTabPageExCtrl";
this.Size = new System.Drawing.Size(1100, 800); this.Size = new System.Drawing.Size(1100, 800);
this.Load += new System.EventHandler(this.ProcessTabPageCtrl_Load); this.Load += new System.EventHandler(this.ProcessTabPageCtrl_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ProcessTabPageCtrl_Paint); this.Paint += new System.Windows.Forms.PaintEventHandler(this.ProcessTabPageCtrl_Paint);
@@ -828,6 +900,12 @@ namespace TBF.Screens
private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.ListView metersListView; private System.Windows.Forms.ListView metersListView;
private System.Windows.Forms.Label tLoCmpntLabel;
private System.Windows.Forms.Label tLoDataLabel;
private System.Windows.Forms.Label tLoLabel;
private System.Windows.Forms.Label tHiCmpntLabel;
private System.Windows.Forms.Label tHiDataLabel;
private System.Windows.Forms.Label tHiLabel;
+72 -41
View File
@@ -46,6 +46,15 @@ namespace TBF.Screens
InitializeComponent(); InitializeComponent();
#if HEAT_METERS
tLoLabel.Visible = true;
tLoCmpntLabel.Visible = true;
tLoDataLabel.Visible = true;
tHiLabel.Visible = true;
tHiCmpntLabel.Visible = true;
tHiDataLabel.Visible = true;
#endif
Bridge.ProcedureSelectedHandler += delegate(object sndr, ProcedureSelectedEventArgs args) Bridge.ProcedureSelectedHandler += delegate(object sndr, ProcedureSelectedEventArgs args)
{ {
try try
@@ -95,14 +104,20 @@ namespace TBF.Screens
} }
catch (Exception e) { log.ErrorFormat("ProcessTabPage24.OnProcedureCompleted() failed: {0}", e.Message); } catch (Exception e) { log.ErrorFormat("ProcessTabPage24.OnProcedureCompleted() failed: {0}", e.Message); }
}; };
Timer timer = new Timer();
timer.Tick += (s, e) => { OnTimerTick(); };
timer.Interval = 5000;
timer.Start();
} }
private void ProcessTabPageCtrl_Load(object sender, EventArgs e) private void ProcessTabPageCtrl_Load(object sender, EventArgs e)
{ {
Once(); Once();
ResetLabelsAndTargetVals(); ResetLabelsAndTargetVals();
ResetReadings(); ResetReadings(); /// Erase all results
OnTimerTick(); /// Redraw measurements that are always available
ProcessTabPageCtrl_Paint(this, null);
} }
void Once() void Once()
@@ -124,19 +139,19 @@ namespace TBF.Screens
metersListView.Items.Clear(); metersListView.Items.Clear();
metersListView.Columns.Clear(); metersListView.Columns.Clear();
metersListView.Columns.Add(Strings.Meter, 100); metersListView.Columns.Add(Strings.Meter, 60);
metersListView.Columns.Add(Strings.Sensor, 100); metersListView.Columns.Add(Strings.Sensor, 80);
metersListView.Columns.Add(Strings.Pulses_count, 120); metersListView.Columns.Add(Strings.Pulses_count, 100);
metersListView.Columns.Add(Strings.Ref_pulses_count, 120); metersListView.Columns.Add(Strings.Ref_pulses_count, 120);
metersListView.Columns.Add(Strings.Volume, 100); metersListView.Columns.Add(Strings.Volume, 80);
metersListView.Columns.Add(Strings.Error, 100); metersListView.Columns.Add(Strings.Error, 80);
metersListView.Columns.Add(Strings.Result, 100); metersListView.Columns.Add(Strings.Result, 80);
/// ///
if (metersKind == MetersKind.HeatMeter) if (metersKind == MetersKind.HeatMeter)
{ {
metersListView.Columns.Add(Strings.Energy, 100); metersListView.Columns.Add(Strings.Energy, 80);
metersListView.Columns.Add(Strings.Error, 100); metersListView.Columns.Add(Strings.Error, 80);
metersListView.Columns.Add(Strings.Result, 100); metersListView.Columns.Add(Strings.Result, 80);
} }
if ((metersKind == MetersKind.Single) || (metersKind == MetersKind.HeatMeter)) if ((metersKind == MetersKind.Single) || (metersKind == MetersKind.HeatMeter))
@@ -213,6 +228,8 @@ namespace TBF.Screens
tInCmpntLabel.Text = "---"; tInCmpntLabel.Text = "---";
tOutCmpntLabel.Text = "---"; tOutCmpntLabel.Text = "---";
tDivCmpntLabel.Text = "---"; tDivCmpntLabel.Text = "---";
tHiCmpntLabel.Text = "---";
tLoCmpntLabel.Text = "---";
scaleCmpntLabel.Text = "---"; scaleCmpntLabel.Text = "---";
@@ -240,10 +257,6 @@ namespace TBF.Screens
void ResetReadings() void ResetReadings()
{ {
/// Top part /// Top part
airTempLabel.Text = "---";
airPressLabel.Text = "---";
airHumiLabel.Text = "---";
refPulsesLabel.Text = "---"; refPulsesLabel.Text = "---";
refFreqLabel.Text = "---"; refFreqLabel.Text = "---";
refFlowLabel.Text = "---"; refFlowLabel.Text = "---";
@@ -253,8 +266,12 @@ namespace TBF.Screens
tDivLabel.Text = "---"; tDivLabel.Text = "---";
tInLabel.Text = "---"; tInLabel.Text = "---";
tOutLabel.Text = "---";
prInLabel.Text = "---"; prInLabel.Text = "---";
tHiDataLabel.Text = "---";
tLoDataLabel.Text = "---";
tOutLabel.Text = "---";
prOutLabel.Text = "---"; prOutLabel.Text = "---";
massLabel.Text = "---"; massLabel.Text = "---";
@@ -309,11 +326,36 @@ namespace TBF.Screens
} }
} }
void OnTimerTick()
{
///
/// Always available
///
airTempLabel.Text = ProcessData.AmbTemp.ToString();
airPressLabel.Text = Config.Units.ConvertTo(Config.Unit.mbar, ProcessData.AmbPress.Val).ToString("F0");
airHumiLabel.Text = ProcessData.AmbHumi.ToString();
tInLabel.Text = ProcessData.TempUp.ToString();
tOutLabel.Text = ProcessData.TempDown.ToString();
tDivLabel.Text = ProcessData.TempDiv.ToString();
prInLabel.Text = ProcessData.PressUp.ToString();
prOutLabel.Text = ProcessData.PressDown.ToString();
massLabel.Text = ProcessData.Mass.ToString();
#if HEAT_METERS
tHiDataLabel.Text = (ProcessData.TempRefHi1.Valid && ProcessData.TempRefHi2.Valid) ? ((ProcessData.TempRefHi1.Val + ProcessData.TempRefHi2.Val) / 2).ToString("F2") : "---";
tLoDataLabel.Text = (ProcessData.TempRefLo1.Valid && ProcessData.TempRefLo2.Valid) ? ((ProcessData.TempRefLo1.Val + ProcessData.TempRefLo2.Val) / 2).ToString("F2") : "---";
#endif
}
void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args) void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args)
{ {
UpdateCurrentMetersKind(args.Procedure.MetersKind); UpdateCurrentMetersKind(args.Procedure.MetersKind);
ResetLabelsAndTargetVals(); ResetLabelsAndTargetVals();
ResetReadings(); ResetReadings();
OnTimerTick(); /// Redraw measurements that are always available
Invalidate(); Invalidate();
} }
@@ -330,15 +372,21 @@ namespace TBF.Screens
estmtdTimeLabel.Text = args.Test.TstTime.ToString("F1"); estmtdTimeLabel.Text = args.Test.TstTime.ToString("F1");
/// Names of virtual bench components /// Names of virtual bench components
if (args.BenchPath.PressMtrUp != null) prInCmpntLabel.Text = args.BenchPath.PressMtrUp.Name; if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name;
if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name;
if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name;
if (args.BenchPath.PressMtrUp != null) prInCmpntLabel.Text = args.BenchPath.PressMtrUp.Name;
if (args.BenchPath.PressMtrDown != null) prOutCmpntLabel.Text = args.BenchPath.PressMtrDown.Name; if (args.BenchPath.PressMtrDown != null) prOutCmpntLabel.Text = args.BenchPath.PressMtrDown.Name;
if (args.BenchPath.TempMtrUp != null) tInCmpntLabel.Text = args.BenchPath.TempMtrUp.Name; if (args.BenchPath.TempMtrUp != null) tInCmpntLabel.Text = args.BenchPath.TempMtrUp.Name;
if (args.BenchPath.TempMtrDown != null) tOutCmpntLabel.Text = args.BenchPath.TempMtrDown.Name; if (args.BenchPath.TempMtrDown != null) tOutCmpntLabel.Text = args.BenchPath.TempMtrDown.Name;
if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name; if (args.OutputPath.TempDiv != null) tDivCmpntLabel.Text = args.OutputPath.TempDiv.Name;
if (args.OutputPath.FlowMeter != null) refFlowCmpntLabel.Text = args.OutputPath.FlowMeter.Name; #if HEAT_METERS
if (args.OutputPath.RegulValve != null) regValveCmpntLabel.Text = args.OutputPath.RegulValve.Name; if (args.HeatMetersPath != null && args.HeatMetersPath.TMeterRefWarm1 != null) tHiCmpntLabel.Text = args.HeatMetersPath.TMeterRefWarm1.Name;
if (args.OutputPath.Scale != null) scaleCmpntLabel.Text = args.OutputPath.Scale.Name; if (args.HeatMetersPath != null && args.HeatMetersPath.TMeterRefCold1 != null) tLoCmpntLabel.Text = args.HeatMetersPath.TMeterRefCold1.Name;
#endif
OnTimerTick(); /// Redraw measurements that are always available
if ((currentMetersKind == MetersKind.Single) || (currentMetersKind == MetersKind.HeatMeter)) if ((currentMetersKind == MetersKind.Single) || (currentMetersKind == MetersKind.HeatMeter))
{ {
for (int i = 0; i < metersListView.Items.Count; i++) for (int i = 0; i < metersListView.Items.Count; i++)
@@ -377,17 +425,7 @@ namespace TBF.Screens
void OnProcessDataChanged(object sender, ProcessDataEventArgs args) void OnProcessDataChanged(object sender, ProcessDataEventArgs args)
{ {
/// /// Pressure may change faster then temperature, therefore it is updated also here
/// Always available
///
airTempLabel.Text = ProcessData.AmbTemp.ToString();
airPressLabel.Text = Config.Units.ConvertTo(Config.Unit.mbar, ProcessData.AmbPress.Val).ToString("F0");
airHumiLabel.Text = ProcessData.AmbHumi.ToString();
tInLabel.Text = ProcessData.TempUp.ToString();
tOutLabel.Text = ProcessData.TempDown.ToString();
tDivLabel.Text = ProcessData.TempDiv.ToString();
prInLabel.Text = ProcessData.PressUp.ToString(); prInLabel.Text = ProcessData.PressUp.ToString();
prOutLabel.Text = ProcessData.PressDown.ToString(); prOutLabel.Text = ProcessData.PressDown.ToString();
@@ -490,16 +528,9 @@ namespace TBF.Screens
Results.Entities.TestRslt tRes = args.TestRslt; Results.Entities.TestRslt tRes = args.TestRslt;
if (tRes == null) return; if (tRes == null) return;
airTempLabel.Text = tRes.AmbTempMean.ToString("F1"); /// Pressure may change faster then temperature, therefore it is updated also here
airPressLabel.Text = Config.Units.ConvertTo(Config.Unit.mbar, tRes.AmbPressMean).ToString("F0"); prInLabel.Text = ProcessData.PressUp.ToString();
airHumiLabel.Text = tRes.AmbHumiMean.ToString("F1"); prOutLabel.Text = ProcessData.PressDown.ToString();
tInLabel.Text = tRes.TempUpMean.ToString("F2");
tOutLabel.Text = tRes.TempDownMean.ToString("F2");
tDivLabel.Text = tRes.TempDivMean.ToString("F2");
prInLabel.Text = tRes.PressUpMean.ToString("F2");
prOutLabel.Text = tRes.PressDownMean.ToString("F2");
massLabel.Text = ProcessData.Mass.ToString(); massLabel.Text = ProcessData.Mass.ToString();
massDiffLabel.Text = (tRes.MassEnd - tRes.MassStart).ToString("F3"); massDiffLabel.Text = (tRes.MassEnd - tRes.MassStart).ToString("F3");
+3 -1
View File
@@ -14,9 +14,10 @@ namespace TBF.UiBridge
public BenchPath BenchPath; public BenchPath BenchPath;
public OutputPath OutputPath; public OutputPath OutputPath;
public MetersPath MetersPath; public MetersPath MetersPath;
public HeatMetersPath HeatMetersPath;
public int TotalPulses; public int TotalPulses;
public TestSelectedEventArgs(Config.Entities.Test test, int repetitionNr, FeedingPath f, BenchPath b, OutputPath o, MetersPath m, int tp) public TestSelectedEventArgs(Config.Entities.Test test, int repetitionNr, FeedingPath f, BenchPath b, OutputPath o, MetersPath m, HeatMetersPath h, int tp)
{ {
Test = test; Test = test;
RepetitionNr = repetitionNr; RepetitionNr = repetitionNr;
@@ -24,6 +25,7 @@ namespace TBF.UiBridge
BenchPath = b; BenchPath = b;
OutputPath = o; OutputPath = o;
MetersPath = m; MetersPath = m;
HeatMetersPath = h;
TotalPulses = tp; TotalPulses = tp;
} }
} }