ValveCategory.All removed, cleanup, SequenceBase improvement.

This commit is contained in:
Milan Hanajik
2020-12-03 13:51:43 +01:00
parent 6da5bd92ec
commit df1b4527ba
18 changed files with 60 additions and 70 deletions
+12 -9
View File
@@ -39,7 +39,8 @@ namespace TBF.BenchControl.Sequences
///------------------------------------------------------------
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
public static IList<IRegulValve> RegulValves; /// list of regulation valves
public static IList<IRegulValve> OutputRegulValves; /// list of regulation valves
public static IList<IRegulValve> FeedingRegulValves; /// list of feeding regulation valves
public static IList<IRegulValve> OutputRegulValves; /// list of output regulation valves
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
public static IList<IWaterMeter> WaterMeters; /// list of water meters
public static IList<ICamera> Cameras; /// list of cameras
@@ -608,9 +609,10 @@ namespace TBF.BenchControl.Sequences
log.Info(activity + " " +step.Message);
//------------------------------------------------
///
/// Prepare operation to switch valves
IOperation setValvesOp = StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step));
/// Fetch the condition operation, null value is allowed if there is no condition
///
IOperation conditionOperation = null;
if (step.EndCondition != "None")
{
@@ -658,7 +660,7 @@ namespace TBF.BenchControl.Sequences
.Create(string.Format("SequenceBase.Transition() : Step {0} start, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
.AddOperation(checkUiOp)
.AddOperation(conditionOperation)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
.AddOperation(setValvesOp);
for (int j = 0; j <= i; j++)
{
stepStrt.AddOperation(rvPosOps[j]);
@@ -678,7 +680,7 @@ namespace TBF.BenchControl.Sequences
.Create(string.Format("SequenceBase.Transition() : Step {0} delay {1}s, opening={2}, closing={3}", step.ItemNr + 1, delay, step.ValvesOpen, step.ValvesClose))
.AddOperation(checkUiOp)
.AddOperation(conditionOperation)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)))
.AddOperation(setValvesOp)
.AddOperation(new TimerOp(delay));
for (int j = 0; j <= lastStartedRV; j++)
{
@@ -723,7 +725,7 @@ namespace TBF.BenchControl.Sequences
.Create(string.Format("SequenceBase.Transition() : Step {0} stop, opening={1}, closing={2}", step.ItemNr + 1, step.ValvesOpen, step.ValvesClose))
.AddOperation(checkUiOp)
.AddOperation(conditionOperation)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(Utils.ValvesOpen(step), Utils.ValvesClose(step)));
.AddOperation(setValvesOp);
for (int j = first; j <= lastStartedRV; j++)
{
stepStop.AddOperation(rvPosOps[j]);
@@ -839,13 +841,14 @@ namespace TBF.BenchControl.Sequences
bool errorFlag = false;
IList<Event> e;
IOperation setValvesOp = StateMachine.ControlBoard.SetValvesOp(valvesToOpen, valvesToClose);
int lastStartedRV = -1;
for (int i = 0; i < rvPosOps.Count; i++)
{
State stepStrt = State.Create(stateTitle)
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesToOpen, valvesToClose));
.AddOperation(setValvesOp);
for (int j = 0; j <= i; j++) stepStrt.AddOperation(rvPosOps[j]);
lastStartedRV = i;
stepStrt.EnterState();
@@ -862,7 +865,7 @@ namespace TBF.BenchControl.Sequences
{
State stepRegul = State.Create(stateTitle)
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesToOpen, valvesToClose));
.AddOperation(setValvesOp);
for (int j = 0; j <= lastStartedRV; j++) stepRegul.AddOperation(rvPosOps[j]);
stepRegul.EnterState();
@@ -879,7 +882,7 @@ namespace TBF.BenchControl.Sequences
{
State stepStop = State.Create(stateTitle)
.AddOperation(checkUiOp)
.AddOperation(StateMachine.ControlBoard.SetValvesOp(valvesToOpen, valvesToClose));
.AddOperation(setValvesOp);
for (int j = first; j <= lastStartedRV; j++) stepStop.AddOperation(rvPosOps[j]);
stepStop.EnterState();