(1) ProcessTabPageEx: TRefHi, TRefLo (2) Ambient vals. written directly to ProcessData (3) Sequences changed:'readTempPressOps', ver. 2.18.1171
This commit is contained in:
@@ -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,16 +77,45 @@ 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);
|
||||
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
/// Read pressure and temperature once before calling Bridge.OnTestSelected(...)
|
||||
State.Create(string.Format("{0}({1}) : Measuring process data", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
}
|
||||
while (e.Contains(Event.Busy));
|
||||
|
||||
/// Start the test, initialize test results
|
||||
Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, totalPulses));
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
TestStartTime = DateTime.Now;
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.FlowSetting));
|
||||
@@ -108,13 +126,13 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
//------------------------------------------------
|
||||
if (inPath.Pump is GenericDevices.IPumpFM) (inPath.Pump as GenericDevices.IPumpFM).TurnOn(test.PumpPower);
|
||||
///
|
||||
State.Create("Adjustment : Starting the pump")
|
||||
.AddOperation(checkUiOp)
|
||||
// .AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Starting the pump", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
//.AddOperation(new Operations.SetAllRegulValvesOp(inPath.RegulValves, inPath.RegulValvesPct, 60))
|
||||
.AddOperation(inPath.Pump != null ? cBrd.SetValvesOp(inPath.Pump, null) : null)
|
||||
.EnterState();
|
||||
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));
|
||||
@@ -129,11 +147,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
if (test.TimePump2StartV > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting after the pump started", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new Operations.TimerOp(test.TimePump2StartV))
|
||||
.EnterState();
|
||||
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));
|
||||
@@ -147,11 +165,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
if (benchPath.StopBFValve != null)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Opening the stop backflow valve", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(StateMachine.ControlBoard.SetValvesOp(benchPath.StopBFValve, null))
|
||||
.EnterState();
|
||||
do {
|
||||
e = StateMachine.WaitRunDevsRunOps();
|
||||
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; goto stopTest; }
|
||||
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
|
||||
@@ -163,11 +181,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
||||
if (test.TimeBeforeFlow > 0)
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Waiting before flow setting process starts", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeBeforeFlow))
|
||||
.EnterState();
|
||||
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")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(outPath.RegulValve.SetFlowOp(outPath.FlowMeter, test.Qfrom, test.Qto, outPath.PidCoef, RefFlow, FlowSettingTimeoutSec))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
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 {
|
||||
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")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(new Operations.TimerOp(5))
|
||||
.EnterState();
|
||||
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")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(cBrd.StartMeasurementOp(outPath, Elde.TestMethods.Synchro,
|
||||
test.Qfrom, test.Qto, totalPulses, filters))
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
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))
|
||||
.EnterState();
|
||||
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.")
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
do
|
||||
{
|
||||
State.Create(string.Format("{0}({1}) : Stopping diverter, gate, etc.", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperation(cBrd.StopPreviousOp())
|
||||
.EnterState();
|
||||
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 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user