RegulValveTandem op SetFlowOp should be functional, to be tested
This commit is contained in:
@@ -24,19 +24,19 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="posLoPct">Lower limit of the position to be achieved</param>
|
||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public ChangeRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve regulValve, float timePulseSec)
|
||||
public ChangeRegulValvePositionOp(ControlBoardDev controlBoard, RegulValve _regulValve, float timePulseSec)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
this.regulValve = regulValve as RegulValve;
|
||||
regulValve = _regulValve as RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValveNr = this.regulValve.Idx1;
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
this.timePulseSec = timePulseSec;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="flowMeter">Flowmeter component</param>
|
||||
/// <param name="requiredFlowLo">Lower limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
@@ -61,16 +61,16 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regulValve, IFlowMeter flowMeter,
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
this.regulValve = regulValve as Elde.RegulValve.RegulValve;
|
||||
regulValve = _regulValve as Elde.RegulValve.RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValveNr = this.regulValve.Idx1;
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
if (flowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// 'regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="controlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="posLoPct">Lower limit of the position to be achieved</param>
|
||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly RegulValveTandem regulValve;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float timePulseSec;
|
||||
|
||||
@@ -24,19 +24,19 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="ControlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="posLoPct">Lower limit of the position to be achieved</param>
|
||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public ChangeRegulValvePositionOp(ControlBoardDev controlBoard, RegulValveTandem regulValve, float timePulseSec)
|
||||
public ChangeRegulValvePositionOp(ControlBoardDev controlBoard, IRegulValve _regulValve, float timePulseSec)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
this.regulValve = regulValve as RegulValveTandem;
|
||||
regulValve = _regulValve as Elde.RegulValve.RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValveNr = this.regulValve.Idx1;
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
this.timePulseSec = timePulseSec;
|
||||
|
||||
|
||||
@@ -21,16 +21,14 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
readonly RegulValve.RegulValve regulValve;
|
||||
readonly RegulValve.RegulValve fixedRV;
|
||||
|
||||
public int Idx1 { get { return regulValve.Idx1; } } /// 1..7
|
||||
public int DacValueClosed { get { return regulValve.DacValueClosed; } } /// 0..1023
|
||||
public int DacValueOpen { get { return regulValve.DacValueOpen; } } /// 0..1023
|
||||
///
|
||||
public int StableTime { get { return RegulValveTandemCfg.StableTime; } } /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
||||
readonly float fixedPctLo; /// [%]
|
||||
readonly float fixedPctHi; /// [%]
|
||||
|
||||
public int FlowStableSec { get { return RegulValveTandemCfg.FlowStableSec; } } /// 0..60 sec
|
||||
///
|
||||
public float Position
|
||||
{
|
||||
get { return controlBoard.RValvePosition(Idx1); }
|
||||
get { return regulValve.Position; }
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +43,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
fixedRV = (RegulValve.RegulValve)TbfComponents.FindComponent(RegulValveTandemCfg.ParentName, components);
|
||||
if (fixedRV == null) throw new Exception("Cannot find fixed RV");
|
||||
|
||||
fixedPctLo = Math.Max(0.0f, RegulValveTandemCfg.FixedRVPosition - 3.0f);
|
||||
fixedPctHi = Math.Min(100.0f, RegulValveTandemCfg.FixedRVPosition + 3.0f);
|
||||
|
||||
this.dict = new Dictionary<float, float>();
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -61,9 +62,11 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
|
||||
float pidCoef, FloatBox measuredFlow, int timeout)
|
||||
{
|
||||
return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout);
|
||||
return new SetFlowOp(controlBoard, regulValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -76,9 +79,11 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout, float filterConstant)
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi,
|
||||
float pidCoef, FloatBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(controlBoard, this, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true);
|
||||
return new SetFlowOp(controlBoard, regulValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -90,12 +95,12 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <returns>SetPositionOp instance</returns>
|
||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
||||
{
|
||||
return new SetRegulValvePositionOp(controlBoard, this, pctLo, pctHi, timeoutMs);
|
||||
return null;
|
||||
}
|
||||
|
||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
||||
{
|
||||
return new ChangeRegulValvePositionOp(controlBoard, this, timePulseSec);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,15 +16,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
///
|
||||
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 int StableTimeMs; /// 200..1500 ms
|
||||
public float FixedRVPosition; /// Fixed RV position 0 .. 100 in [%]
|
||||
public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions
|
||||
public int FlowStableSec; /// 0..60 sec
|
||||
|
||||
/// <summary>
|
||||
/// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.
|
||||
/// </summary>
|
||||
public int StableTime { get { return (StableTimeMs - 200) / 50; } }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
RegulValveTandemCfg()
|
||||
{
|
||||
@@ -34,7 +29,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
RegulValveName = "RV1";
|
||||
FixedRVName = "RV2";
|
||||
|
||||
StableTimeMs = 500;
|
||||
FixedRVPosition = 50.0f;
|
||||
StoredPositionReuse = false;
|
||||
FlowStableSec = 5;
|
||||
}
|
||||
@@ -47,11 +42,11 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, ControlledRVName={1}, ADC-FixedRVName={2}, StabTm={3}ms, PosReuse={4}, FlowStable={5}s",
|
||||
return string.Format("Name={0}, RegulVName={1}, FixedRVName={2}, FixedRVPos={3}%, PosReuse={4}, FlowStable={5}s",
|
||||
Name,
|
||||
RegulValveName,
|
||||
FixedRVName,
|
||||
StableTimeMs,
|
||||
FixedRVPosition.ToString("F0"),
|
||||
StoredPositionReuse,
|
||||
FlowStableSec);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
nameTextBox.Text = config.Name;
|
||||
regulValveNameComboBox.Text = string.IsNullOrEmpty(config.RegulValveName) ? "---" : config.RegulValveName;
|
||||
fixedRVNameComboBox.Text = string.IsNullOrEmpty(config.FixedRVName) ? "---" : config.FixedRVName;
|
||||
stableTimeTextBox.Text = config.StableTimeMs.ToString();
|
||||
fixedRVPositionTextBox.Text = config.FixedRVPosition.ToString("F0");
|
||||
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
|
||||
flowStableSecTextBox.Text = config.FlowStableSec.ToString();
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
nameTextBox.Enabled = true;
|
||||
regulValveNameComboBox.Enabled = true;
|
||||
fixedRVNameComboBox.Enabled = true;
|
||||
stableTimeTextBox.Enabled = true;
|
||||
fixedRVPositionTextBox.Enabled = true;
|
||||
storedPosReuseCheckBox.Enabled = true;
|
||||
flowStableSecTextBox.Enabled = true;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
}
|
||||
|
||||
int dummy;
|
||||
if (!int.TryParse(stableTimeTextBox.Text, out dummy) || dummy < 200 || dummy > 1500 || (dummy % 50) != 0)
|
||||
if (!int.TryParse(fixedRVPositionTextBox.Text, out dummy) || dummy < 0 || dummy > 100)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Stable time' should be between 200 and 1500 ms in 50 ms steps";
|
||||
@@ -134,10 +134,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
int tmp = int.Parse(stableTimeTextBox.Text);
|
||||
if (config.StableTimeMs != tmp)
|
||||
int tmp = int.Parse(fixedRVPositionTextBox.Text);
|
||||
if (config.FixedRVPosition != (float)tmp)
|
||||
{
|
||||
config.StableTimeMs = tmp;
|
||||
config.FixedRVPosition = (float)tmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
|
||||
+27
-27
@@ -34,18 +34,18 @@
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.regulValveNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.storedPosReuseCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.stableTimeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.stableTimeLabel = new System.Windows.Forms.Label();
|
||||
this.flowStableSecTextBox = new System.Windows.Forms.TextBox();
|
||||
this.flowStableSecLabel = new System.Windows.Forms.Label();
|
||||
this.fixedRVNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.fixedRVNameLabel = new System.Windows.Forms.Label();
|
||||
this.fixedRVPositionTextBox = new System.Windows.Forms.TextBox();
|
||||
this.fixedRVPositionLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// regulValveNameLabel
|
||||
//
|
||||
this.regulValveNameLabel.AutoSize = true;
|
||||
this.regulValveNameLabel.Location = new System.Drawing.Point(28, 69);
|
||||
this.regulValveNameLabel.Location = new System.Drawing.Point(28, 68);
|
||||
this.regulValveNameLabel.Name = "regulValveNameLabel";
|
||||
this.regulValveNameLabel.Size = new System.Drawing.Size(87, 13);
|
||||
this.regulValveNameLabel.TabIndex = 3;
|
||||
@@ -81,7 +81,7 @@
|
||||
//
|
||||
this.regulValveNameComboBox.Enabled = false;
|
||||
this.regulValveNameComboBox.FormattingEnabled = true;
|
||||
this.regulValveNameComboBox.Location = new System.Drawing.Point(138, 66);
|
||||
this.regulValveNameComboBox.Location = new System.Drawing.Point(138, 65);
|
||||
this.regulValveNameComboBox.Name = "regulValveNameComboBox";
|
||||
this.regulValveNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.regulValveNameComboBox.TabIndex = 4;
|
||||
@@ -97,23 +97,6 @@
|
||||
this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
|
||||
this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// stableTimeTextBox
|
||||
//
|
||||
this.stableTimeTextBox.Enabled = false;
|
||||
this.stableTimeTextBox.Location = new System.Drawing.Point(138, 144);
|
||||
this.stableTimeTextBox.Name = "stableTimeTextBox";
|
||||
this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.stableTimeTextBox.TabIndex = 15;
|
||||
//
|
||||
// stableTimeLabel
|
||||
//
|
||||
this.stableTimeLabel.AutoSize = true;
|
||||
this.stableTimeLabel.Location = new System.Drawing.Point(28, 147);
|
||||
this.stableTimeLabel.Name = "stableTimeLabel";
|
||||
this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
|
||||
this.stableTimeLabel.TabIndex = 14;
|
||||
this.stableTimeLabel.Text = "Stable time [ms]";
|
||||
//
|
||||
// flowStableSecTextBox
|
||||
//
|
||||
this.flowStableSecTextBox.Enabled = false;
|
||||
@@ -135,7 +118,7 @@
|
||||
//
|
||||
this.fixedRVNameComboBox.Enabled = false;
|
||||
this.fixedRVNameComboBox.FormattingEnabled = true;
|
||||
this.fixedRVNameComboBox.Location = new System.Drawing.Point(138, 93);
|
||||
this.fixedRVNameComboBox.Location = new System.Drawing.Point(138, 91);
|
||||
this.fixedRVNameComboBox.Name = "fixedRVNameComboBox";
|
||||
this.fixedRVNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.fixedRVNameComboBox.TabIndex = 22;
|
||||
@@ -143,22 +126,39 @@
|
||||
// fixedRVNameLabel
|
||||
//
|
||||
this.fixedRVNameLabel.AutoSize = true;
|
||||
this.fixedRVNameLabel.Location = new System.Drawing.Point(28, 96);
|
||||
this.fixedRVNameLabel.Location = new System.Drawing.Point(28, 94);
|
||||
this.fixedRVNameLabel.Name = "fixedRVNameLabel";
|
||||
this.fixedRVNameLabel.Size = new System.Drawing.Size(82, 13);
|
||||
this.fixedRVNameLabel.TabIndex = 21;
|
||||
this.fixedRVNameLabel.Text = "Fixed reg. valve";
|
||||
//
|
||||
// fixedRVPositionTextBox
|
||||
//
|
||||
this.fixedRVPositionTextBox.Enabled = false;
|
||||
this.fixedRVPositionTextBox.Location = new System.Drawing.Point(138, 117);
|
||||
this.fixedRVPositionTextBox.Name = "fixedRVPositionTextBox";
|
||||
this.fixedRVPositionTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.fixedRVPositionTextBox.TabIndex = 24;
|
||||
//
|
||||
// fixedRVPositionLabel
|
||||
//
|
||||
this.fixedRVPositionLabel.AutoSize = true;
|
||||
this.fixedRVPositionLabel.Location = new System.Drawing.Point(28, 120);
|
||||
this.fixedRVPositionLabel.Name = "fixedRVPositionLabel";
|
||||
this.fixedRVPositionLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.fixedRVPositionLabel.TabIndex = 23;
|
||||
this.fixedRVPositionLabel.Text = "Fixed RV position";
|
||||
//
|
||||
// RegulValveTandemCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.fixedRVPositionTextBox);
|
||||
this.Controls.Add(this.fixedRVPositionLabel);
|
||||
this.Controls.Add(this.fixedRVNameComboBox);
|
||||
this.Controls.Add(this.fixedRVNameLabel);
|
||||
this.Controls.Add(this.flowStableSecTextBox);
|
||||
this.Controls.Add(this.flowStableSecLabel);
|
||||
this.Controls.Add(this.stableTimeTextBox);
|
||||
this.Controls.Add(this.stableTimeLabel);
|
||||
this.Controls.Add(this.storedPosReuseCheckBox);
|
||||
this.Controls.Add(this.regulValveNameComboBox);
|
||||
this.Controls.Add(this.regulValveNameLabel);
|
||||
@@ -181,11 +181,11 @@
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox regulValveNameComboBox;
|
||||
private System.Windows.Forms.CheckBox storedPosReuseCheckBox;
|
||||
private System.Windows.Forms.TextBox stableTimeTextBox;
|
||||
private System.Windows.Forms.Label stableTimeLabel;
|
||||
private System.Windows.Forms.TextBox flowStableSecTextBox;
|
||||
private System.Windows.Forms.Label flowStableSecLabel;
|
||||
private System.Windows.Forms.ComboBox fixedRVNameComboBox;
|
||||
private System.Windows.Forms.Label fixedRVNameLabel;
|
||||
private System.Windows.Forms.TextBox fixedRVPositionTextBox;
|
||||
private System.Windows.Forms.Label fixedRVPositionLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly Elde.RegulValve.RegulValve fixedRV;
|
||||
readonly int fixedRVNr;
|
||||
readonly float fixedPctLo;
|
||||
readonly float fixedPctHi;
|
||||
readonly int flowMeterNr;
|
||||
readonly float reqFlowLo;
|
||||
readonly float reqFlowHi;
|
||||
@@ -32,9 +36,11 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
enum OpState
|
||||
{
|
||||
Idle = 0,
|
||||
ValveMoveToPosition,
|
||||
IssueSetPositionCommand,
|
||||
SettingPosition,
|
||||
ValveMoveToFlow,
|
||||
IssueSetPositionCommand_FixedRV,
|
||||
SettingPosition_FixedRV,
|
||||
IssueSetFlowCommand,
|
||||
SettingFlow,
|
||||
FlowReached,
|
||||
}
|
||||
@@ -53,7 +59,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="ControlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="fxdRV">Regulation valve set to a fixed position</param>
|
||||
/// <param name="fixedPctLo">Lower limit of the fixed position of the fixed reg.v.</param>
|
||||
/// <param name="fixedPctHi">Upper limit of the fixed position of the fixed reg.v.</param>
|
||||
/// <param name="flowMeter">Flowmeter component</param>
|
||||
/// <param name="requiredFlowLo">Lower limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
@@ -61,16 +70,23 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regulValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow,
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regV, IRegulValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
this.regulValve = regulValve as Elde.RegulValve.RegulValve;
|
||||
regulValve = regV as Elde.RegulValve.RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValveNr = this.regulValve.Idx1;
|
||||
regulValveNr = regulValve.Idx1;
|
||||
|
||||
fixedRV = fxdRV as Elde.RegulValve.RegulValve;
|
||||
if (fixedRV == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
fixedRVNr = fixedRV.Idx1;
|
||||
|
||||
this.fixedPctLo = fxdPctLo;
|
||||
this.fixedPctHi = fxdPctHi;
|
||||
|
||||
if (flowMeter is Elde.FlowMeter.FlowMeter)
|
||||
{
|
||||
@@ -104,9 +120,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false)
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow, int timeout)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, pidCoef, measuredFlow, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -114,9 +130,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IFlowMeter flowMeter,
|
||||
float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow)
|
||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
public SetFlowOp(ControlBoardDev controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, float requiredFlowLo, float requiredFlowHi, float pidCoef, FloatBox measuredFlow)
|
||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, pidCoef, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -163,14 +179,14 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
log.InfoFormat("Start(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
|
||||
regulValveNr, flowMeterNr, reqFlowLo, reqFlowHi, targetPositionLo, targetPositionHi);
|
||||
|
||||
opState = OpState.ValveMoveToPosition;
|
||||
opState = OpState.IssueSetPositionCommand;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat("Start(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regulValveNr, flowMeterNr, reqFlowLo, reqFlowHi);
|
||||
|
||||
opState = OpState.ValveMoveToFlow;
|
||||
opState = OpState.IssueSetPositionCommand_FixedRV;
|
||||
}
|
||||
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
@@ -178,7 +194,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
TestMethods tm = 0;
|
||||
StopDevs sd = 0;
|
||||
// 'regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
|
||||
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route, int.MaxValue, tm,
|
||||
0.0f, (int)pidCoef, 0, sd);
|
||||
}
|
||||
@@ -190,6 +206,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
public Event Run()
|
||||
{
|
||||
float rvPosition = controlBoard.RValvePosition(regulValveNr);
|
||||
float fixedRVPosition = controlBoard.RValvePosition(fixedRVNr);
|
||||
float flowMtrFreq = controlBoard.ReferenceFreq;
|
||||
float flow = flowMtrFreq * nominalFlow / 2000.0f;
|
||||
|
||||
@@ -198,7 +215,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
log.InfoFormat("Run(): rv#={0} pos={1}% freq={2} flow={3} opState={4}",
|
||||
regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState);
|
||||
|
||||
if (opState == OpState.ValveMoveToPosition)
|
||||
if (opState == OpState.IssueSetPositionCommand)
|
||||
{
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
@@ -217,11 +234,34 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
///
|
||||
if ((targetPositionLo <= rvPosition) && (rvPosition <= targetPositionHi))
|
||||
{
|
||||
opState = OpState.ValveMoveToFlow;
|
||||
opState = OpState.IssueSetPositionCommand_FixedRV;
|
||||
}
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.ValveMoveToFlow)
|
||||
else if (opState == OpState.IssueSetPositionCommand_FixedRV)
|
||||
{
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
///
|
||||
controlBoard.ValveMove(fixedRVNr, RegulValveMode.TargetPosition,
|
||||
new float[2] { fixedPctLo, fixedPctHi },
|
||||
regulValve.StableTime);
|
||||
|
||||
opState = OpState.SettingPosition_FixedRV;
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.SettingPosition_FixedRV)
|
||||
{
|
||||
///
|
||||
/// Repeated untill position is reached
|
||||
///
|
||||
if ((fixedPctLo <= fixedRVPosition) && (fixedRVPosition <= fixedPctHi))
|
||||
{
|
||||
opState = OpState.IssueSetFlowCommand;
|
||||
}
|
||||
return Event.None;
|
||||
}
|
||||
else if (opState == OpState.IssueSetFlowCommand)
|
||||
{
|
||||
///
|
||||
/// Done once, issues an appropriate ValveMove(...) command
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly RegulValveTandem regulValve;
|
||||
readonly Elde.RegulValve.RegulValve regulValve;
|
||||
readonly int regulValveNr;
|
||||
readonly float posLoPct;
|
||||
readonly float posHiPct;
|
||||
@@ -31,19 +31,19 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||
/// Events: FlowSet, FlowTimeOut
|
||||
/// </summary>
|
||||
/// <param name="ControlBoard">Control board device</param>
|
||||
/// <param name="regulValve">Regulation valve component</param>
|
||||
/// <param name="_regulValve">Regulation valve component</param>
|
||||
/// <param name="posLoPct">Lower limit of the position to be achieved</param>
|
||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetRegulValvePositionOp(ControlBoardDev controlBoard, RegulValveTandem regulValve, float posLoPct, float posHiPct, int timeout)
|
||||
public SetRegulValvePositionOp(ControlBoardDev controlBoard, IRegulValve regV, float posLoPct, float posHiPct, int timeout)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||
this.controlBoard = controlBoard;
|
||||
|
||||
this.regulValve = regulValve as RegulValveTandem;
|
||||
regulValve = regV as Elde.RegulValve.RegulValve;
|
||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||
this.regulValveNr = this.regulValve.Idx1;
|
||||
regulValveNr = this.regulValve.Idx1;
|
||||
|
||||
this.posLoPct = posLoPct;
|
||||
this.posHiPct = posHiPct;
|
||||
|
||||
Reference in New Issue
Block a user