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
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
///
/// Serialized parameters
///
public ValveCategory Category; /// Feeding, Output or All
public ValveCategory Category; /// Feeding or Output
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveCfg()
@@ -32,7 +32,6 @@ namespace TBF.BenchControl.Dummy.RegulValve
private void RegulationValveCfgCtrl_Load(object sender, EventArgs e)
{
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
@@ -62,8 +61,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
if (!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
{
flags |= CfgUpdateFlags.Error;
@@ -86,11 +84,10 @@ namespace TBF.BenchControl.Dummy.RegulValve
}
ValveCategory newCategory;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) newCategory = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (newCategory != config.Category)
{
config.Category = newCategory;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Serialized parameters
///
public int Idx1; /// 1..8
public ValveCategory Category; /// Feeding, Output or All
public ValveCategory Category; /// Feeding or Output
public int AdcValueClosed; /// 0..1023
public int AdcValueOpen; /// 0..1023
public int StableTimeMs; /// 200..1500 ms, step is 50 ms
@@ -49,7 +49,6 @@ namespace TBF.BenchControl.Elde.RegulValve
}
}
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
@@ -117,8 +116,7 @@ namespace TBF.BenchControl.Elde.RegulValve
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
if (!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
{
flags |= CfgUpdateFlags.Error;
@@ -178,11 +176,10 @@ namespace TBF.BenchControl.Elde.RegulValve
}
ValveCategory newCategory;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) newCategory = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (newCategory != config.Category)
{
config.Category = newCategory;
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Serialized parameters
///
public int Idx1; /// 1..8
public ValveCategory Category; /// Feeding, Output or All
public ValveCategory Category; /// Feeding or Output
public int StableTimeMs; /// 200..1500 ms
public int FlowStableSec; /// 0..60 sec
public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions
@@ -46,7 +46,6 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
}
}
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
@@ -95,8 +94,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
if (!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
{
flags |= CfgUpdateFlags.Error;
@@ -144,11 +142,10 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
}
ValveCategory newCategory;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) newCategory = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (newCategory != config.Category)
{
config.Category = newCategory;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
///
/// Serialized parameters
///
public ValveCategory Category; /// Feeding, Output or All
public ValveCategory Category; /// Feeding, Output or None
public string RegulValveName; /// Name of the regulation valve used to control the flow
public string FixedRVName; /// Name of the regulation valve with a fixed position
public float FixedRVPosition; /// Fixed RV position 0 .. 100 in [%]
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
}
}
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
categoryComboBox.Items.Add(ValveCategory.None.ToString());
Redraw();
}
@@ -87,9 +87,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
if (!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.None.ToString()))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Category'";
@@ -136,11 +136,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
}
ValveCategory newCategory;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) newCategory = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
if (newCategory != config.Category)
{
config.Category = newCategory;
+1 -1
View File
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.Valve
/// Serialized parameters
///
public int BitPosition; /// Bit-position
public ValveCategory Category; /// None, Feeding, Bench or Output
public ValveCategory Category; /// Feeding, Bench, Output or None
public int OpenCloseTime; /// Delay for SetValvesOp operations
public bool Inverted; /// The valve is inverted: 0=open, 1=closed
///
+3 -5
View File
@@ -35,7 +35,6 @@ namespace TBF.BenchControl.Elde.Valve
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Bench.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
@@ -111,11 +110,10 @@ namespace TBF.BenchControl.Elde.Valve
int newOpenCloseTime = int.Parse(openCloseTimeTextBox.Text);
ValveCategory newCategory;
if (categoryComboBox.Text.Equals(ValveCategory.All.ToString())) newCategory = ValveCategory.All;
else if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
if (categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString())) newCategory = ValveCategory.Feeding;
else if (categoryComboBox.Text.Equals(ValveCategory.Bench.ToString())) newCategory = ValveCategory.Bench;
else if (categoryComboBox.Text.Equals(ValveCategory.Output.ToString())) newCategory = ValveCategory.Output;
else newCategory = ValveCategory.None;
else newCategory = ValveCategory.None;
if (config.Name != nameTextBox.Text ||
config.ParentName != newParentName ||
+1 -2
View File
@@ -35,11 +35,10 @@ namespace TBF.BenchControl
public enum ValveCategory
{
All = 0, /// Valve will be shown in all paths
Feeding, /// Valve will be shown in Feeding paths
Bench, /// Valve will be shown in Bench paths
Output, /// Valve will be shown in Output paths
None, /// Valve will not be shown in the paths
None, /// Valve will not be shown in any path
}
public enum ValveExOperation
+1 -1
View File
@@ -43,7 +43,7 @@ namespace TBF.BenchControl
foreach (var cmpnt in components)
{
IRegulValve regValve = cmpnt as IRegulValve;
if (regValve != null && (regValve.Category == TBF.BenchControl.ValveCategory.Feeding || regValve.Category == TBF.BenchControl.ValveCategory.All))
if (regValve != null && regValve.Category == TBF.BenchControl.ValveCategory.Feeding)
{
RegulValves.Add(regValve);
}
+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();
+3 -1
View File
@@ -223,6 +223,7 @@ namespace TBF.BenchControl
ProcessData.IperlHeads = new List<TestMethods.iPerlCommunication.iPerlHead.IperlHead>();
SequenceBase.FlowMeters = new List<IFlowMeter>();
SequenceBase.RegulValves = new List<IRegulValve>();
SequenceBase.FeedingRegulValves = new List<IRegulValve>();
SequenceBase.OutputRegulValves = new List<IRegulValve>();
SequenceBase.PumpsWithFM = new List<IPumpFM>();
SequenceBase.WaterMeters = new List<IWaterMeter>();
@@ -248,7 +249,8 @@ namespace TBF.BenchControl
{
IRegulValve rv = cmpnt as IRegulValve;
SequenceBase.RegulValves.Add(rv);
if (rv.Category == ValveCategory.Output || rv.Category == ValveCategory.All) SequenceBase.OutputRegulValves.Add(rv);
if (rv.Category == ValveCategory.Feeding) SequenceBase.FeedingRegulValves.Add(rv);
if (rv.Category == ValveCategory.Output) SequenceBase.OutputRegulValves.Add(rv);
}
if (cmpnt is IPumpFM && !(cmpnt is Elde.PumpTandem.Pump))
{
+3 -3
View File
@@ -78,7 +78,7 @@ namespace TBF.UI.Bench.Paths
int clmn = (int)Column.FixedColumnsCount;
foreach (var vlv in parent.Valves)
{
if (vlv.Category == ValveCategory.All || vlv.Category == ValveCategory.Bench)
if (vlv.Category == ValveCategory.Bench)
{
Columns.Add(vlv.Cfg.Name, (ls.BenchColumnCount > clmn) ? ls.BenchColumnWidths[clmn] : 50 * parent.Dpi / Constants.Dpi100pct);
clmn++;
@@ -207,7 +207,7 @@ namespace TBF.UI.Bench.Paths
foreach (var valve in parent.Valves)
{
if (valve.Category == ValveCategory.All || valve.Category == ValveCategory.Bench)
if (valve.Category == ValveCategory.Bench)
{
if (path.ValvesOpen != null && path.ValvesOpen.Contains(valve))
{
@@ -258,7 +258,7 @@ namespace TBF.UI.Bench.Paths
int k = 0;
for (int j = 0; j < parent.Valves.Count; j++)
{
if (parent.Valves[j].Category == ValveCategory.All || parent.Valves[j].Category == ValveCategory.Bench)
if (parent.Valves[j].Category == ValveCategory.Bench)
{
string text = lvi.SubItems[fixedColumnsCount + k].Text;
if (text.Equals(Strings.open))
+4 -6
View File
@@ -9,6 +9,7 @@ using NHibernate;
using log4net;
using Config.Entities;
using Results.Forms;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
using TBF.UI.Shared;
@@ -83,17 +84,14 @@ namespace TBF.UI.Bench.Paths
foreach (var cmpnt in TbfComponents)
{
IRegulValve regValve = cmpnt as IRegulValve;
if (regValve != null)
if (regValve != null && !(cmpnt is TBF.BenchControl.Elde.RegulValveTandem.RegulValveTandem))
{
switch (regValve.Category)
{
case TBF.BenchControl.ValveCategory.Feeding:
case ValveCategory.Feeding:
FeedingRegulValves.Add(regValve);
break;
case TBF.BenchControl.ValveCategory.Output:
OutputRegulValves.Add(regValve);
break;
case TBF.BenchControl.ValveCategory.All:
case ValveCategory.Output:
OutputRegulValves.Add(regValve);
break;
}
+3 -3
View File
@@ -77,7 +77,7 @@ namespace TBF.UI.Bench.Paths
foreach (var vlv in parent.Valves)
{
if (vlv.Category == TBF.BenchControl.ValveCategory.All || vlv.Category == TBF.BenchControl.ValveCategory.Feeding)
if (vlv.Category == TBF.BenchControl.ValveCategory.Feeding)
{
Columns.Add(vlv.Cfg.Name, (ls.FeedingColumnCount > clmn) ? ls.FeedingColumnWidths[clmn] : 50 * parent.Dpi / Constants.Dpi100pct);
clmn++;
@@ -197,7 +197,7 @@ namespace TBF.UI.Bench.Paths
foreach (var valve in parent.Valves)
{
if (valve.Category == TBF.BenchControl.ValveCategory.All || valve.Category == TBF.BenchControl.ValveCategory.Feeding)
if (valve.Category == TBF.BenchControl.ValveCategory.Feeding)
{
if (path.ValvesOpen != null && path.ValvesOpen.Contains(valve))
{
@@ -266,7 +266,7 @@ namespace TBF.UI.Bench.Paths
int k = 0;
for (int j = 0; j < parent.Valves.Count; j++)
{
if (parent.Valves[j].Category == TBF.BenchControl.ValveCategory.All || parent.Valves[j].Category == TBF.BenchControl.ValveCategory.Feeding)
if (parent.Valves[j].Category == TBF.BenchControl.ValveCategory.Feeding)
{
string text = lvi.SubItems[fixedColumnsCount + regvCount + k].Text;
if (text.Equals(Strings.open))
+3 -3
View File
@@ -101,7 +101,7 @@ namespace TBF.UI.Bench.Paths
///
foreach (var vlv in parent.Valves)
{
if (vlv.Category == ValveCategory.All || vlv.Category == ValveCategory.Output)
if (vlv.Category == ValveCategory.Output)
{
Columns.Add(vlv.Cfg.Name, (ls.OutputColumnCount > clmn) ? ls.OutputColumnWidths[clmn] : 50 * parent.Dpi / Constants.Dpi100pct);
clmn++;
@@ -288,7 +288,7 @@ namespace TBF.UI.Bench.Paths
foreach (var valve in parent.Valves)
{
int subItemNr = lvi.SubItems.Count;
if (valve.Category == ValveCategory.All || valve.Category == ValveCategory.Output)
if (valve.Category == ValveCategory.Output)
{
if (path.ValvesOpen != null && path.ValvesOpen.Contains(valve))
{
@@ -372,7 +372,7 @@ namespace TBF.UI.Bench.Paths
int k = 0;
foreach (var valve in parent.Valves)
{
if (valve.Category == ValveCategory.All || valve.Category == ValveCategory.Output)
if (valve.Category == ValveCategory.Output)
{
string text = lvi.SubItems[fixedColumnsCount + k].Text;
if (text.Equals(Strings.open))