(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];
pressure = (float)value / 10000.0f;
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);
@@ -185,6 +186,14 @@ namespace TBF.BenchControl.Ambient.Comet
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
///
+9 -1
View File
@@ -133,9 +133,10 @@ namespace TBF.BenchControl.Ambient.Greco
temperature = t;
humidity = h;
pressure = p / 1000.0F;
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);
}
else
@@ -170,6 +171,13 @@ namespace TBF.BenchControl.Ambient.Greco
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
///
@@ -887,9 +887,6 @@ namespace TBF.BenchControl.Sequences
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath == null ? null : heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.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 ? queryEnd1 : 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.Collections.Generic;
@@ -57,19 +57,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
float simulatedError = 4.5f; /// %
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
IList<Event> e; /// 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)
@@ -88,15 +77,44 @@ namespace TBF.BenchControl.TestMethods.Adjustment
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
return new List<Event> { Event.ConfigurationError };
}
}
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);
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);
/// 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, totalPulses));
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;
@@ -108,13 +126,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//------------------------------------------------
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(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -130,10 +148,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -148,10 +166,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -164,10 +182,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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);
//------------------------------------------------
State.Create("Adjustment : Setting the flow")
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -296,12 +312,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test")
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +326,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment
}
else
{
State.Create("Adjustment : Starting the test")
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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
|| 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(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -491,10 +505,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
/// 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);
TestStartTime = DateTime.Now;
@@ -106,18 +106,10 @@ namespace TBF.BenchControl.TestMethods.ChangeFlowDirection
break;
}
/// 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;
return new List<Event> { Event.Done };
stopTest:
/// 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;
return new List<Event> { Event.UiCmdStop };
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -50,6 +50,18 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
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 switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
@@ -61,8 +73,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
}
@@ -105,8 +116,20 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//====================================
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)) { 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, (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);
TestStartTime = DateTime.Now;
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -119,10 +142,10 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//--------------------------------
State.Create(string.Format("{0}({1}) : Mesuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -137,7 +160,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
/// Empty the water tank
switch (DrainTheTank(scale))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: goto error;
case Event.UiCmdStop: goto stopTest;
@@ -196,12 +219,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Start the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -212,11 +235,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
State.Create(string.Format("{0}({1}) : Set the initial flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -417,11 +440,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//--------------------------------
State.Create(string.Format("{0}({1}) : Switching flow detected, going back", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, qfrom_detected, qto_detected, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
//.AddOp(pOut.RegulValve.SetPositionOp(35.0f, 38.0f, uint.MaxValue))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -463,12 +486,12 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------
State.Create(Strings.Measure_the_mass)
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -487,12 +510,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------
State.Create(Strings.Start_the_test)
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
qfrom_detected, qto_detected, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro), qfrom_detected, qto_detected, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -557,13 +579,13 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------
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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
@@ -586,11 +608,11 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
//------------------------------------------------
State.Create(Strings.Stop_the_pump)
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
}
@@ -754,18 +776,14 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
}
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
IList<Event> retval1 = new List<Event>(1);
retval1.Add(Event.Done);
return retval1;
return new List<Event> { Event.Done };
//====================================
stopTest:
@@ -782,9 +800,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
while (!e.Contains(Event.ValvesSet));
IList<Event> retval2 = new List<Event>(1);
retval2.Add(Event.UiCmdStop);
return retval2;
return new List<Event> { Event.UiCmdStop };
//====================================
error:
@@ -800,9 +816,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
while (!e.Contains(Event.ValvesSet));
IList<Event> retval3 = new List<Event>(1);
retval3.Add(Event.Error);
return retval3;
return new List<Event> { Event.Error };
}
@@ -836,10 +850,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
.EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
}
}
}
@@ -30,13 +30,43 @@ namespace TBF.BenchControl.TestMethods.Endurance
string enduranceCycleStr,
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
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
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;
checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state
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 enduranceLogName = string.Format("{0}{1:HHmm}.txt", enduranceLogDir, BatchRslts.Batch.StartTime);
@@ -54,41 +84,28 @@ namespace TBF.BenchControl.TestMethods.Endurance
enduranceDataLoggingOp = 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)
{
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;
}
}
Event retVal = Event.Done;
IList<Event> e; /// Events from currently running operations
//====================================
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
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);
TestStartTime = DateTime.Now;
@@ -100,11 +117,11 @@ namespace TBF.BenchControl.TestMethods.Endurance
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -121,10 +138,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
int flowSetTime0 = StateMachine.Time;
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -232,26 +247,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(enduranceDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -281,27 +283,14 @@ namespace TBF.BenchControl.TestMethods.Endurance
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(queryEnd1)
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -496,10 +485,10 @@ namespace TBF.BenchControl.TestMethods.Endurance
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
@@ -536,19 +525,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
///
State.Create(string.Format("{0}({1}) : Uploading cycle parameters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleParamsUpload, Elde.Command.None, 0))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -565,20 +547,13 @@ namespace TBF.BenchControl.TestMethods.Endurance
///
State.Create(string.Format("{0}({1}) : Executing the cycle", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp((int)test.TstTime, Event.TimerExpired))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null) ? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.AddOperation(processDataLoggingOp)
.AddOperation(enduranceDataLoggingOp)
.AddOperation(cBrd.ExecuteCommandOp(Elde.Command.EnduranceCycleStart, Elde.Command.EnduranceCycleStop, 0))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e))
@@ -615,19 +590,12 @@ namespace TBF.BenchControl.TestMethods.Endurance
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Delay to make sure the last endu.cycle completed", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp((int)(duration / 1000) + 1, Event.TimerExpired))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e))
@@ -668,8 +636,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
@@ -678,10 +645,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -67,6 +67,19 @@ namespace TBF.BenchControl.TestMethods.FixedStart
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;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
@@ -83,8 +96,20 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//====================================
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
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);
///
@@ -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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -166,12 +191,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -187,11 +212,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -206,11 +231,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -223,11 +248,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -250,11 +275,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -265,11 +290,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -282,11 +307,11 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -319,14 +344,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
@@ -388,14 +407,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.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))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -414,14 +429,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
{
State.Create(string.Format("{0}({1}) : Waiting before 1st measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -448,7 +459,8 @@ namespace TBF.BenchControl.TestMethods.FixedStart
string[] startImages = new string[sensPath.RegisterReaders.Length];
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++)
{
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);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.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(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -551,21 +559,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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, }))
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -576,20 +573,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -687,20 +674,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -711,24 +688,12 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State.Create(string.Format("{0}({1}) : Waiting before 2nd measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -742,10 +707,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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];
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++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -783,8 +750,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -801,8 +767,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
State state = State.Create(string.Format("{0}({1}) : Entering the end-state", test.Method, test.Name));
if (heatMetersTestParams != null && dataEntryCmpnt is GenericDevices.IHasHeatMtrStatesForm)
{
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).
ShowTestEndFormOp(sensPath.RegisterReaders,
state.AddOperation((dataEntryCmpnt as GenericDevices.IHasHeatMtrStatesForm).ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty,
refEnergy, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
}
@@ -811,10 +776,10 @@ namespace TBF.BenchControl.TestMethods.FixedStart
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
}
state.AddOperation(checkUiOp);
state.EnterState();
do
{
state.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -1132,10 +1097,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -64,6 +64,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
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);
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
@@ -77,12 +91,22 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
/// int refPulses = (int)(timeSec * (2000.0f * targetFlow / pOut.FlowMeter.NominalFlow));
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
processDataLoggingOp = new TBF.BenchControl.Operations.ProcessDataLoggingOp(processDataLogger, this, false);
//====================================
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
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);
TestStartTime = DateTime.Now;
@@ -94,10 +118,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
///
State.Create("FixedStartAdvanced : Measuring mass of water in the tank")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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
///
switch (DrainTheTank(scale))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -134,10 +158,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Waiting 5 sec")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -149,10 +173,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Starting the pump")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -170,10 +194,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
State.Create("FixedStartAdvanced : Starting the pump")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -185,10 +209,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//--------------------------------
State.Create("FixedStartAdvanced : Setting the flow")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -213,10 +237,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------
State.Create("FixedStartAdvanced : Closing the start/stop valve before the fixed start test")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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);
State.Create("FixedStartAdvanced : Enter begin-state")
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -303,21 +327,13 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------
State.Create("FixedStartAdvanced : Measuring the start mass")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -338,12 +354,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------
State.Create("FixedStartAdvanced : Starting the test")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
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();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -353,10 +368,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Opening the start/stop valve at the beginning of the fixed start test")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -415,10 +430,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Closing the start/stop valve at the end of the fixed start test")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -427,20 +442,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Waiting before 2nd mass measurement")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -453,20 +460,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
//------------------------------------------------
State.Create("FixedStartAdvanced : Measuring the end mass")
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -484,10 +483,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
State.Create("FixedStartAdvanced : Stopping diverter, gate, etc.")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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);
State.Create("FixedStartAdvanced : Enter end-state")
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV,
test.ErrLimLo + test.Uncertainty,
test.ErrLimHi - test.Uncertainty))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -656,18 +652,14 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
}
}
}
@@ -94,6 +94,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
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;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
@@ -110,8 +123,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//====================================
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
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);
///
@@ -127,7 +152,6 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
}
if (!test.DoDraining)
{
///
@@ -135,11 +159,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -156,7 +180,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
///
/// 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.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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -194,12 +220,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -215,11 +241,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -234,11 +260,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -251,11 +277,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -278,11 +304,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -293,11 +319,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -310,11 +336,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -347,14 +373,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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 Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold)
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{
goto temperature_set;
}
@@ -383,7 +405,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
}
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);
@@ -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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -416,14 +436,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.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))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -442,14 +458,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
{
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -466,24 +478,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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))
.AddOperation(checkUiOp)
.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));
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -525,8 +523,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -615,21 +612,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro),
test.Qfrom, test.Qto, (2 * totalPulses), new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -638,22 +625,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -751,20 +728,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -775,24 +742,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -808,24 +763,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -843,10 +786,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -877,10 +820,8 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
State state2 = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
.AddOperation(checkUiOp)
.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));
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -893,8 +834,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
@@ -1029,8 +969,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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:
/// 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;
return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
}
@@ -1051,15 +987,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
/// Fixed start mass collection method with deferred evaluation of images
/// </summary>
/// <param name="test">Test entity</param>
/// <returns>
/// Event.Done . . . . . . . OK
/// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP
/// Event.Error . . . . . . Unspecified error
/// </returns>
/// <returns>Always Event.Done</returns>
public IList<Event> Execute2ndPass(Config.Entities.Test test, int repetNr, IntermediateData data)
{
IList<Event> e = new List<Event>(1); /// Events from currently running operations
Event retVal = Event.Done;
IList<Event> e; /// Events from currently running operations
///
/// Populate TestResult data entity with data
@@ -1075,13 +1006,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
Bridge.OnActivity(this, Strings.Enter_water_meter_data);
State.Create(string.Format("{0}({1}) : Entering water meter states", test.Method, test.Name))
.AddOperation(de4Cam.ShowDeferredTestEvalFormOp(sensPath.RegisterReaders,
tstRslt.VolumeCTV,
.AddOperation(de4Cam.ShowDeferredTestEvalFormOp(sensPath.RegisterReaders, tstRslt.VolumeCTV,
test.ErrLimLo + test.Uncertainty,
test.ErrLimHi - test.Uncertainty))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
}
while (e.Contains(Event.ModelessFormIsOpen));
@@ -1203,14 +1132,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEvaluation
allResults.Info(TestResult2CsvLine(data.TestName, data.TestPart));
}
/// 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();
do { e = StateMachine.WaitRunDevsRunOps(); } while (false);
StateMachine.WaitRunDevsRunOps();
e.Add(retVal);
return e;
return new List<Event> { Event.Done }; ;
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -74,6 +74,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
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;
float switchTimeStart = 0.001f; /// in seconds, original vale is 1 ms
@@ -90,8 +103,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//====================================
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
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);
///
@@ -115,11 +140,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
State.Create(string.Format("{0}({1}) : Measuring mass of water in the tank", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -136,7 +161,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
/// 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.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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(heatMetersPromptOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.JustStarted));
@@ -174,12 +201,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -195,11 +222,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -214,11 +241,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -231,11 +258,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -258,11 +285,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -273,11 +300,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -290,11 +317,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -327,14 +354,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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 Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold)
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
@@ -396,14 +417,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.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))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -422,14 +439,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
{
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -446,24 +459,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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];
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++)
{
GenericDevices.IRoiForFixedStart roi = sensPath.RegisterReaders[i] as GenericDevices.IRoiForFixedStart;
@@ -506,8 +509,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
}
}
state2.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.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(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -603,21 +601,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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.Diverter | Elde.TestMethods.FixedStart,
test.Qfrom, test.Qto, 2 * totalPulses, new int[] { (int)test.TolerRed, }))
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.FixedStart),
test.Qfrom, test.Qto, (2 * totalPulses), new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -628,20 +616,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -739,20 +717,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -763,24 +731,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -796,24 +752,12 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -831,10 +775,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -906,10 +850,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
state.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders,
volumeCTV, test.ErrLimLo + test.Uncertainty, test.ErrLimHi - test.Uncertainty));
}
state.AddOperation(checkUiOp);
state.EnterState();
do
{
state.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -1225,8 +1169,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -1235,10 +1178,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
stopTestWOTransitionAfter:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -77,6 +77,19 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
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);
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
@@ -94,8 +107,20 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//====================================
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
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);
@@ -123,11 +148,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -143,10 +168,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -161,10 +186,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -177,10 +202,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -203,10 +228,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
///
State.Create(string.Format("{0}({1}) : Pump on", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(inPath.Pump, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -217,10 +242,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
///
State.Create(string.Format("{0}({1}) : Start valve open", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -233,10 +258,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -290,10 +313,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//-----------------------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the start/stop valve before the fixed start test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -318,7 +341,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
string[] startImages = new string[sensPath.RegisterReaders.Length];
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++)
{
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.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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);
State.Create(string.Format("{0}({1}) : Entering begin-state", test.Method, test.Name))
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((dataEntryCmpnt as GenericDevices.IHasWMStatesForm).ShowTestStartFormOp(sensPath.RegisterReaders))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -405,17 +430,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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, }))
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StartMeasurementOp(outPath, (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro), test.Qfrom, test.Qto, (totalPulses * 5 / 4), new int[] { (int)test.TolerRed, }))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -426,16 +444,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, false, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -514,16 +526,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
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(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
}
@@ -534,19 +540,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
State.Create(string.Format("{0}({1}) : Waiting before 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperation(processDataLoggingOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -561,19 +559,11 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -586,10 +576,10 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -610,7 +600,9 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
string[] endImages = new string[sensPath.RegisterReaders.Length];
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++)
{
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.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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);
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)
.AddOperations(readTempPressOps)
.AddOperation(dataEntryCmpnt.ShowTestEndFormOp(sensPath.RegisterReaders, volumeCTV, (test.ErrLimLo + test.Uncertainty), (test.ErrLimHi - test.Uncertainty)))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -878,10 +869,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -31,63 +31,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
HeatMeters.TestParams heatMetersTestParams,
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)
{
///
/// 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();
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;
return Simulate(test, repetitionNr, isLastRepetition, compoundTestParams, heatMetersTestParams, debugLevel);
}
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);
IList<Event> e; /// Events from currently running operations
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
@@ -106,15 +55,48 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
}
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:
/// 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, totalPulses));
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;
@@ -137,12 +119,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -157,11 +139,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -176,11 +158,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -193,11 +175,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -216,11 +198,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
int flowSetTime0 = StateMachine.Time;
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -254,14 +236,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
State.Create(string.Format("{0}({1}) : Checking if the temperature is stable", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -366,25 +342,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(processDataLoggingOp)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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);
/// Measurement loop - begin
State.Create("Read water meters")
State.Create(string.Format("{0}({1}) : Read water meters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(queryEnd1)
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -788,8 +738,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
@@ -798,10 +747,48 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
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,6 +82,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true);
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;
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
@@ -94,11 +107,24 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//====================================
loop:
/// 'totalPulses' calculation has to be inside test repetition loop for this method !!!
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
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
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);
TestStartTime = DateTime.Now;
@@ -117,10 +143,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -147,10 +173,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
#else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -184,12 +210,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -204,11 +230,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -223,11 +249,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -240,11 +266,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -262,11 +288,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -300,14 +326,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -416,15 +436,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
///
/// Make sure tank draining completed
///
IList<IOperation> extraOps = new List<IOperation>();
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))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -437,10 +449,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -456,14 +468,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
{
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -478,25 +486,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -522,25 +518,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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,
.AddOperation(cBrd.StartMeasurementOp(outPath,
(repetitionNr == 1) ? (Elde.TestMethods.Diverter | Elde.TestMethods.Synchro) : Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -570,28 +555,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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((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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -675,25 +646,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -706,24 +665,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1090,18 +1037,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { if (retVal == Event.Done) retVal = Event.UiCmdStop; break; }
}
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
@@ -1147,10 +1090,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
.EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
}
}
}
@@ -96,6 +96,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
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;
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -106,8 +119,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
//====================================
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
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);
TestStartTime = DateTime.Now;
@@ -124,10 +149,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -144,7 +169,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
if (drainTheTank)
{
#if BERLIN || SENTEC
switch (DrainTheTank(outPath.Scale))
switch (DrainTheTank(outPath.Scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -154,10 +179,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
#else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -191,12 +216,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -211,11 +236,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -230,11 +255,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -247,11 +272,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -269,11 +294,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -307,14 +332,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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 Tc = (TempRefLo1.Val + TempRefLo2.Val) / 2;
if (heatMetersTestParams.TempWarmLo <= Tw && Tw <= heatMetersTestParams.TempWarmHi &&
heatMetersTestParams.TempColdLo <= Tc && Tc <= heatMetersTestParams.TempColdHi &&
Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm &&
Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold &&
Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm &&
Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold)
if ((heatMetersTestParams.TempWarmLo <= Tw) && (Tw <= heatMetersTestParams.TempWarmHi) &&
(heatMetersTestParams.TempColdLo <= Tc) && (Tc <= heatMetersTestParams.TempColdHi) &&
(Math.Abs(Tw - Tw_last) <= heatMetersTestParams.ChangeInTimeWarm) &&
(Math.Abs(Tc - Tc_last) <= heatMetersTestParams.ChangeInTimeCold) &&
(Math.Abs(TempRefHi1.Val - TempRefHi2.Val) <= heatMetersTestParams.DeltaTempWarm) &&
(Math.Abs(TempRefLo1.Val - TempRefLo2.Val) <= heatMetersTestParams.DeltaTempCold))
{
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -422,15 +441,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
/// Make sure tank draining completed
///
IList<IOperation> extraOps = new List<IOperation>();
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))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -443,10 +454,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(compareValve, null))
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -480,15 +491,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
State.Create(string.Format("{0}({1}) : Waiting before the reference mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(new Operations.TimerOp(stabTime))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -503,25 +510,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
State.Create(string.Format("{0}({1}) : Measuring the reference mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(scale.ReadStableMassOp(ref measuredRefMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, compareValve))
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -562,15 +557,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
///
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.AddOperation(new Operations.TimerOp(stabTime))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -587,25 +578,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -641,25 +620,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -688,28 +654,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -791,25 +743,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.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))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -822,24 +762,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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));
}
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -91,6 +91,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
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;
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -103,8 +116,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
//====================================
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
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, targetTotalPulses));
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, targetTotalPulses));
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
TestStartTime = DateTime.Now;
@@ -121,10 +146,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -151,10 +176,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
#else
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -189,11 +214,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -209,10 +234,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -228,10 +253,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -245,10 +270,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -267,10 +292,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -304,14 +329,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -419,15 +438,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
///
/// Make sure tank draining completed
///
IList<IOperation> extraOps = new List<IOperation>();
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))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -440,10 +451,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -460,14 +471,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
{
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -483,24 +490,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -525,25 +520,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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.StartProlongedMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro | Elde.TestMethods.MassAndContinue,
.AddOperation(cBrd.StartProlongedMeasurementOp(outPath,
Elde.TestMethods.Diverter | Elde.TestMethods.Synchro | Elde.TestMethods.MassAndContinue,
test.Qfrom, test.Qto, targetTotalPulses, targetMassPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -572,28 +556,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -675,25 +645,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -706,24 +664,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1067,10 +1013,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
@@ -1116,10 +1059,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
.EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
}
}
}
@@ -41,15 +41,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
return Simulate2(test, repetitionNr, isLastRepetition, compoundTestParams, heatMetersTestParams);
}
IList<Event> e = new List<Event>(); /// Events from currently running operations
IScale scale = outPath.Scale as IScale;
if (scale == null)
{
Bridge.OnError(this, Strings.Missing_a_scale);
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
return e;
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
int rangeIx = 0; /// Default range, used for non-Elde flowmeters
@@ -69,23 +65,35 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
e.Add(Event.ConfigurationError); /// or Event.UiCmdStop
return e;
return new List<Event> { Event.ConfigurationError }; /// or Event.UiCmdStop ???
}
}
if (test.Volume > scale.Capacity * Constants.TankFullFactor)
{
Bridge.OnError(this, Strings.Test_volume_exceeds_the_scale_capacity);
e.Add(Event.UiCmdStop);
return e;
return new List<Event> { Event.UiCmdStop };
}
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, 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 switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
@@ -95,8 +103,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
//====================================
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
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);
TestStartTime = DateTime.Now;
@@ -113,10 +133,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
///
State.Create(string.Format("{0}({1}) : Checking available tank capacity", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadMassOp(ref Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -133,7 +153,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
if (drainTheTank)
{
#if BERLIN || SENTEC
switch (DrainTheTank(outPath.Scale))
switch (DrainTheTank(outPath.Scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -144,9 +164,9 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Open the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(scale.DrainValve, null))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -181,11 +201,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -201,10 +221,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -220,10 +240,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -237,10 +257,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -259,10 +279,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -296,14 +316,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Check temperature stabilized.", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(heatMetersPath.TMeterRefWarm1.ReadTempOp(ref TempRefHi1))
.AddOperation(heatMetersPath.TMeterRefWarm2.ReadTempOp(ref TempRefHi2))
.AddOperation(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1))
.AddOperation(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2))
.AddOperations(readTempPressOps)
.AddOperation(heatMetersPromptOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
@@ -340,17 +356,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -411,15 +425,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
///
/// Make sure tank draining completed
///
IList<IOperation> extraOps = new List<IOperation>();
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))
switch (DrainTheTank(scale, readTempPressOps))
{
case Event.Error: { retVal = Event.Error; goto stopTest; }
case Event.UiCmdStop: { retVal = Event.UiCmdStop; goto stopTest; }
@@ -432,10 +438,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Close the drain valve anyway
State.Create(string.Format("{0}({1}) : Close the drain valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(null, scale.DrainValve))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -452,14 +458,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
{
State.Create(string.Format("{0}({1}) : Waiting before 1st mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.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))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeFlow2Mass))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -475,23 +477,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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) ? 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)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -516,25 +507,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Diverter | Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -563,28 +541,15 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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(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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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")
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new MettlerToledo.KeepReadingMassesOp())
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -668,25 +632,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the 2nd mass measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -699,24 +651,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.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)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.MassRepeats, test.MassSpread, test.MassMethod))
.AddOperation(new Operations.TimerOp(StableMassMsrmntTimeoutSec))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -1106,10 +1046,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
@@ -1154,10 +1091,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
.EnterState();
IList<Event> e = StateMachine.WaitRunDevsRunOps();
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done);
return retListSim;
return new List<Event> { TestAndLogUiCmdStop(test, e) ? Event.UiCmdStop : Event.Done };
}
@@ -1224,10 +1158,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
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
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(retVal);
return retListSim;
return new List<Event> { retVal }; /// default 'retVal' value is Event.Done
}
}
}
@@ -80,6 +80,19 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
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);
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
@@ -92,8 +105,20 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
//====================================
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
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);
TestStartTime = DateTime.Now;
@@ -122,11 +147,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
///
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -141,10 +166,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -159,10 +184,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -175,10 +200,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -196,10 +221,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -298,21 +321,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -341,23 +356,14 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
/// Measurement loop - begin
State.Create(string.Format("{0}({1}) : Reading watermeters", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(readRegistersOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.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
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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")
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen,
StateMachine.DefaultValvesClose))
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -421,20 +426,12 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Waiting before the water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
.AddOperation(processDataLoggingOp)
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -447,19 +444,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
State.Create(string.Format("{0}({1}) : Water level measurement", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp == null ? null : benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown == null ? null : benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(outPath.TempDiv == null ? null : outPath.TempDiv.ReadTempOp(ref TempDiv))
.AddOperation(benchPath.PressMtrUp == null ? null : benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown == null ? null : benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperation((StateMachine.Ambient != null)
? StateMachine.Ambient.ReadAmbientOp(AmbTemp, AmbPress, AmbHumi) : null)
.AddOperations(readTempPressOps)
.AddOperation(manualLevelMsrmnt ? tank.ManualReadVolumeOp(ref volumeBox) : tank.ReadStableVolumeOp(ref volumeBox, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -767,10 +756,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
@@ -784,11 +770,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
if ((outPath.Scale == null) || !(outPath.Scale is IVolumeMeter))
{
Bridge.OnError(this, Strings.Missing_a_tank_with_volume_measurement);
/// 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;
return new List<Event> { Event.ConfigurationError };
}
IVolumeMeter tank = outPath.Scale as IVolumeMeter;
@@ -846,10 +828,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
stopSimulation:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -56,11 +56,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
while (e.Contains(Event.CameraBusy));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
return new List<Event> { retVal };
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -29,16 +29,38 @@ namespace TBF.BenchControl.TestMethods.LeakTest
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, LeakTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
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);
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
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);
//------------------------------------------------
@@ -48,16 +70,11 @@ namespace TBF.BenchControl.TestMethods.LeakTest
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -79,15 +96,10 @@ namespace TBF.BenchControl.TestMethods.LeakTest
State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -133,15 +145,10 @@ namespace TBF.BenchControl.TestMethods.LeakTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Maximum water pressure set", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -168,15 +175,10 @@ namespace TBF.BenchControl.TestMethods.LeakTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new TBF.BenchControl.Elde.SetValvesOp(cBrd, true, outPath))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -192,15 +194,10 @@ namespace TBF.BenchControl.TestMethods.LeakTest
State.Create(string.Format("{0}({1}) : Closing the valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -223,15 +220,10 @@ namespace TBF.BenchControl.TestMethods.LeakTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationLeak))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -382,18 +374,14 @@ namespace TBF.BenchControl.TestMethods.LeakTest
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -57,11 +57,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
while (!e.Contains(Event.OK));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
/// Create a list with one item 'retVal' (default is Event.Done) and return it
IList<Event> retList = new List<Event>(1);
retList.Add(retVal);
return retList;
return new List<Event> { retVal };
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -29,16 +29,38 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
/// </returns>
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, PMaxTestParams testParams)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
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);
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
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);
TestStartTime = DateTime.Now;
@@ -49,16 +71,11 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -80,15 +97,10 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
State.Create(string.Format("{0}({1}) : Setting the water pressure", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -134,15 +146,10 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperation(benchPath.PressMtrUp.ReadPressureOp(ref PressUp))
.AddOperation(benchPath.PressMtrDown.ReadPressureOp(ref PressDown))
.AddOperation(benchPath.PressMtrDelta == null ? null : benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta))
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -293,18 +300,14 @@ namespace TBF.BenchControl.TestMethods.PMaxTest
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -57,20 +57,6 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
{
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
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
@@ -88,15 +74,45 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
return new List<Event> { Event.ConfigurationError };
}
}
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);
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);
/// 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, totalPulses));
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;
@@ -108,13 +124,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
//------------------------------------------------
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(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -130,10 +146,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -148,10 +164,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -164,10 +180,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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);
//------------------------------------------------
State.Create("Adjustment : Setting the flow")
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -296,12 +310,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
//tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test")
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +324,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
}
else
{
State.Create("Adjustment : Starting the test")
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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
|| 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(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -492,10 +504,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTest
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -57,20 +57,6 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
{
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
if (outPath.FlowMeter is Elde.FlowMeter.FlowMeter)
{
@@ -88,15 +74,47 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
if (rangeIx == -1)
{
Bridge.OnError(this, Strings.Flow_meter_temperature_range_does_not_fit_this_test_conditions);
retVal = Event.UiCmdStop;
goto stopTestWOStoppingDivGateEtc;
return new List<Event> { Event.ConfigurationError };
}
}
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);
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);
/// 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, totalPulses));
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;
@@ -108,13 +126,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
//------------------------------------------------
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(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperations(readTempPressOps)
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -130,10 +148,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -148,10 +166,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -164,10 +182,10 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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);
//------------------------------------------------
State.Create("Adjustment : Setting the flow")
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(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.PulsesTestManual
State.Create(string.Format("{0}({1}) : Wait until the water temperature is within limits", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperation(benchPath.TempMtrUp.ReadTempOp(ref TempUp))
.AddOperation(benchPath.TempMtrDown.ReadTempOp(ref TempDown))
.AddOperations(readTempPressOps)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Next)) goto temperature_set;
if (TempUp.Val >= test.TempLimLo && TempUp.Val <= test.TempLimHi &&
TempDown.Val >= test.TempLimLo && TempDown.Val <= test.TempLimHi)
if ((test.TempLimLo <= TempUp.Val) && (TempUp.Val <= test.TempLimHi) &&
(test.TempLimLo <= TempDown.Val) && (TempDown.Val <= test.TempLimHi))
{
goto temperature_set;
}
@@ -296,12 +312,12 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
//tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f;
State.Create("Adjustment : Simulating the test")
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(5))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
@@ -310,14 +326,13 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
}
else
{
State.Create("Adjustment : Starting the test")
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
test.Qfrom, test.Qto, totalPulses, filters))
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro, test.Qfrom, test.Qto, totalPulses, filters))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; 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
|| 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(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
@@ -488,10 +502,7 @@ namespace TBF.BenchControl.TestMethods.PulsesTestManual
stopTestWOStoppingDivGateEtc:
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
///
using System;
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)
{
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
IList<Event> e = new List<Event>(); /// Events from currently running operations
IList<Event> e; /// Events from currently running operations
Event retVal = Event.Done;
/// Operations
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
checkUiOp = new Operations.CheckUIOp(true);
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 = 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);
//====================
// 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);
TestStartTime = DateTime.Now;
@@ -51,10 +56,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -68,10 +73,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
{
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -86,10 +91,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
{
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
@@ -102,10 +107,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
{
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
@@ -123,10 +128,10 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Setting the flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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))
.AddOperation(checkUiOp);
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps);
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
{
GenericDevices.IRoi roi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
@@ -179,23 +186,15 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
imageNames[i] = roi.ImageFileNamePrefix + "detected.jpg";
}
}
detection.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
if (e.Contains(Event.Error))
{
retVal = Event.Error;
goto stopTest;
}
if (TestAndLogUiCmdStop(test,e))
{
retVal = Event.UiCmdStop;
goto stopTest;
}
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
}
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;
State.Create(string.Format("{0}({1}) : Select images and press Retry to retry RoI detection", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((display == null) ? null : display.ShowStaticImageOp(imageNames, title))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e))
@@ -264,18 +263,14 @@ namespace TBF.BenchControl.TestMethods.RoiDetection
.AddOperation(checkUiOp)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e)) goto stopTest;
}
while (!e.Contains(Event.PreviousStopped));
}
/// 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;
return new List<Event> { retVal };
}
}
}
@@ -34,19 +34,28 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
if (debugLevel == Config.Entities.DebugMode.Simulate)
{
/// TODO: Test method simulation
IList<Event> retListSim = new List<Event>(1);
retListSim.Add(Event.Done);
return retListSim;
return new List<Event> { Event.Done };
}
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
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 switchTimeEnd = 0.001f; /// in seconds, original vale is 1 ms
Elde.ControlBoardDev cBrd = StateMachine.ControlBoard;
/// Specific for combined meters
int[] lastWMPulses = new int[Config.Data.WMsCount];
@@ -54,10 +63,10 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//--------------------------------
State.Create(string.Format("{0}({1}) : stopTest diverter gate etc", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
}
@@ -80,7 +89,7 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//====================================
loop:
/// 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);
TestStartTime = DateTime.Now;
@@ -127,7 +136,6 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
foreach (var camera in cameras) measureOperations.Add(camera.MeasurementOp());
int flowDetectTime0 = StateMachine.Time;
int flowDetectTime = 0;
float estFlowSetTime = 100.0f;
@@ -137,12 +145,12 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation((inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOnOp(test.PumpPower) : null)
.AddOperation(cBrd.SetValvesOp(inPath.Pump, null))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -153,11 +161,11 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//--------------------------------
State.Create(string.Format("{0}({1}) : Setting the initial flow", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.SetFlowAndMeasureOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec, (float)test.TolerRed))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -213,11 +221,11 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//--------------------------------
State.Create(string.Format("{0}({1}) : Changing the RV position", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperations(measureOperations)
.AddOperation(outPath.RegulValve.ChangeRegulValvePositionOp(rvPulse))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.SwitchingFlowDetection));
@@ -335,11 +343,11 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
//------------------------------------------------
State.Create(string.Format("{0}({1}) : {2}", test.Method, test.Name, Strings.Stop_the_pump))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
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))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(cBrd.StopPreviousOp())
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test,e)) goto stopTest;
}
@@ -467,18 +475,14 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
.AddOperation(cBrd.SetValvesOp(null, inPath.Pump))
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
}
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
IList<Event> retval1 = new List<Event>(1);
retval1.Add(Event.Done);
return retval1;
return new List<Event> { Event.Done };
//====================================
stopTest:
@@ -488,16 +492,13 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) goto error;
}
while (!e.Contains(Event.ValvesSet));
IList<Event> retval2 = new List<Event>(1);
retval2.Add(Event.UiCmdStop);
return retval2;
return new List<Event> { Event.UiCmdStop };
//====================================
error:
@@ -506,16 +507,13 @@ namespace TBF.BenchControl.TestMethods.SensitivityTest
.AddOperation((inPath != null && inPath.Pump is GenericDevices.IPumpFM) ? (inPath.Pump as GenericDevices.IPumpFM).TurnOffOp() : null)
.AddOperation(cBrd.SetValvesOp(StateMachine.DefaultValvesOpen, StateMachine.DefaultValvesClose))
.EnterState();
do
{
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) break;
}
while (!e.Contains(Event.ValvesSet));
IList<Event> retval3 = new List<Event>(1);
retval3.Add(Event.Error);
return retval3;
return new List<Event> { Event.Error };
}
}
}
@@ -291,7 +291,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
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 };
}
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1168.0")]
[assembly: AssemblyFileVersion("2.18.1168.0")]
[assembly: AssemblyVersion("2.18.1171.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));
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.pictureBox1 = new System.Windows.Forms.PictureBox();
this.flowMeterPictureBox = new System.Windows.Forms.PictureBox();
@@ -118,6 +124,12 @@ namespace TBF.Screens
//
// 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.pictureBox1);
this.splitContainer1.Panel1.Controls.Add(this.flowMeterPictureBox);
@@ -187,6 +199,66 @@ namespace TBF.Screens
this.splitContainer1.SplitterWidth = 1;
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
//
this.pumpPctTextBox.Location = new System.Drawing.Point(797, 372);
@@ -613,7 +685,7 @@ namespace TBF.Screens
// prInCmpntLabel
//
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.Size = new System.Drawing.Size(55, 13);
this.prInCmpntLabel.TabIndex = 194;
@@ -622,7 +694,7 @@ namespace TBF.Screens
// prOutCmpntLabel
//
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.Size = new System.Drawing.Size(63, 13);
this.prOutCmpntLabel.TabIndex = 193;
@@ -631,7 +703,7 @@ namespace TBF.Screens
// tOutCmpntLabel
//
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.Size = new System.Drawing.Size(57, 13);
this.tOutCmpntLabel.TabIndex = 192;
@@ -640,7 +712,7 @@ namespace TBF.Screens
// tInCmpntLabel
//
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.Size = new System.Drawing.Size(49, 13);
this.tInCmpntLabel.TabIndex = 191;
@@ -658,7 +730,7 @@ namespace TBF.Screens
// prOutLabel
//
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.Size = new System.Drawing.Size(33, 13);
this.prOutLabel.TabIndex = 189;
@@ -667,7 +739,7 @@ namespace TBF.Screens
// tOutLabel
//
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.Size = new System.Drawing.Size(27, 13);
this.tOutLabel.TabIndex = 188;
@@ -676,7 +748,7 @@ namespace TBF.Screens
// label17
//
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.Size = new System.Drawing.Size(73, 13);
this.label17.TabIndex = 187;
@@ -685,7 +757,7 @@ namespace TBF.Screens
// label18
//
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.Size = new System.Drawing.Size(66, 13);
this.label18.TabIndex = 186;
@@ -694,7 +766,7 @@ namespace TBF.Screens
// prInLabel
//
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.Size = new System.Drawing.Size(25, 13);
this.prInLabel.TabIndex = 185;
@@ -703,7 +775,7 @@ namespace TBF.Screens
// tInLabel
//
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.Size = new System.Drawing.Size(19, 13);
this.tInLabel.TabIndex = 184;
@@ -712,7 +784,7 @@ namespace TBF.Screens
// label14
//
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.Size = new System.Drawing.Size(59, 13);
this.label14.TabIndex = 183;
@@ -721,7 +793,7 @@ namespace TBF.Screens
// label13
//
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.Size = new System.Drawing.Size(52, 13);
this.label13.TabIndex = 182;
@@ -737,14 +809,14 @@ namespace TBF.Screens
this.metersListView.UseCompatibleStateImageBehavior = false;
this.metersListView.View = System.Windows.Forms.View.Details;
//
// ProcessTabPageHeatMetersCtrl
// ProcessTabPageExCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
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.Name = "ProcessTabPageHeatMetersCtrl";
this.Name = "ProcessTabPageExCtrl";
this.Size = new System.Drawing.Size(1100, 800);
this.Load += new System.EventHandler(this.ProcessTabPageCtrl_Load);
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 label13;
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;
+71 -40
View File
@@ -46,6 +46,15 @@ namespace TBF.Screens
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)
{
try
@@ -95,14 +104,20 @@ namespace TBF.Screens
}
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)
{
Once();
ResetLabelsAndTargetVals();
ResetReadings();
ResetReadings(); /// Erase all results
OnTimerTick(); /// Redraw measurements that are always available
ProcessTabPageCtrl_Paint(this, null);
}
void Once()
@@ -124,19 +139,19 @@ namespace TBF.Screens
metersListView.Items.Clear();
metersListView.Columns.Clear();
metersListView.Columns.Add(Strings.Meter, 100);
metersListView.Columns.Add(Strings.Sensor, 100);
metersListView.Columns.Add(Strings.Pulses_count, 120);
metersListView.Columns.Add(Strings.Meter, 60);
metersListView.Columns.Add(Strings.Sensor, 80);
metersListView.Columns.Add(Strings.Pulses_count, 100);
metersListView.Columns.Add(Strings.Ref_pulses_count, 120);
metersListView.Columns.Add(Strings.Volume, 100);
metersListView.Columns.Add(Strings.Error, 100);
metersListView.Columns.Add(Strings.Result, 100);
metersListView.Columns.Add(Strings.Volume, 80);
metersListView.Columns.Add(Strings.Error, 80);
metersListView.Columns.Add(Strings.Result, 80);
///
if (metersKind == MetersKind.HeatMeter)
{
metersListView.Columns.Add(Strings.Energy, 100);
metersListView.Columns.Add(Strings.Error, 100);
metersListView.Columns.Add(Strings.Result, 100);
metersListView.Columns.Add(Strings.Energy, 80);
metersListView.Columns.Add(Strings.Error, 80);
metersListView.Columns.Add(Strings.Result, 80);
}
if ((metersKind == MetersKind.Single) || (metersKind == MetersKind.HeatMeter))
@@ -213,6 +228,8 @@ namespace TBF.Screens
tInCmpntLabel.Text = "---";
tOutCmpntLabel.Text = "---";
tDivCmpntLabel.Text = "---";
tHiCmpntLabel.Text = "---";
tLoCmpntLabel.Text = "---";
scaleCmpntLabel.Text = "---";
@@ -240,10 +257,6 @@ namespace TBF.Screens
void ResetReadings()
{
/// Top part
airTempLabel.Text = "---";
airPressLabel.Text = "---";
airHumiLabel.Text = "---";
refPulsesLabel.Text = "---";
refFreqLabel.Text = "---";
refFlowLabel.Text = "---";
@@ -253,8 +266,12 @@ namespace TBF.Screens
tDivLabel.Text = "---";
tInLabel.Text = "---";
tOutLabel.Text = "---";
prInLabel.Text = "---";
tHiDataLabel.Text = "---";
tLoDataLabel.Text = "---";
tOutLabel.Text = "---";
prOutLabel.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)
{
UpdateCurrentMetersKind(args.Procedure.MetersKind);
ResetLabelsAndTargetVals();
ResetReadings();
OnTimerTick(); /// Redraw measurements that are always available
Invalidate();
}
@@ -330,14 +372,20 @@ namespace TBF.Screens
estmtdTimeLabel.Text = args.Test.TstTime.ToString("F1");
/// Names of virtual bench components
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.TempMtrUp != null) tInCmpntLabel.Text = args.BenchPath.TempMtrUp.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.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 HEAT_METERS
if (args.HeatMetersPath != null && args.HeatMetersPath.TMeterRefWarm1 != null) tHiCmpntLabel.Text = args.HeatMetersPath.TMeterRefWarm1.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))
{
@@ -377,17 +425,7 @@ namespace TBF.Screens
void OnProcessDataChanged(object sender, ProcessDataEventArgs args)
{
///
/// 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();
/// Pressure may change faster then temperature, therefore it is updated also here
prInLabel.Text = ProcessData.PressUp.ToString();
prOutLabel.Text = ProcessData.PressDown.ToString();
@@ -490,16 +528,9 @@ namespace TBF.Screens
Results.Entities.TestRslt tRes = args.TestRslt;
if (tRes == null) return;
airTempLabel.Text = tRes.AmbTempMean.ToString("F1");
airPressLabel.Text = Config.Units.ConvertTo(Config.Unit.mbar, tRes.AmbPressMean).ToString("F0");
airHumiLabel.Text = tRes.AmbHumiMean.ToString("F1");
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");
/// Pressure may change faster then temperature, therefore it is updated also here
prInLabel.Text = ProcessData.PressUp.ToString();
prOutLabel.Text = ProcessData.PressDown.ToString();
massLabel.Text = ProcessData.Mass.ToString();
massDiffLabel.Text = (tRes.MassEnd - tRes.MassStart).ToString("F3");
+3 -1
View File
@@ -14,9 +14,10 @@ namespace TBF.UiBridge
public BenchPath BenchPath;
public OutputPath OutputPath;
public MetersPath MetersPath;
public HeatMetersPath HeatMetersPath;
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;
RepetitionNr = repetitionNr;
@@ -24,6 +25,7 @@ namespace TBF.UiBridge
BenchPath = b;
OutputPath = o;
MetersPath = m;
HeatMetersPath = h;
TotalPulses = tp;
}
}