IRegulValve change, regulation valves support Category, Category saved in settings, used in Feeding Paths UI, not used in tests yet, ver. 2.11.364

This commit is contained in:
Milan Hanajik
2016-10-12 15:47:45 +02:00
parent 1388f459fe
commit caf43fedb3
19 changed files with 294 additions and 92 deletions
@@ -25,6 +25,7 @@ namespace TBF.BenchControl.Elde.RegulValve
public readonly ControlBoardDev ControlBoard;
public ValveCategory Category { get { return RegulValveCfg.Category; } }
public int Idx1 { get { return RegulValveCfg.Idx1; } } /// 1..7
public int DacValueClosed { get { return RegulValveCfg.AdcValueClosed; } } /// 0..1023
public int DacValueOpen { get { return RegulValveCfg.AdcValueOpen; } } /// 0..1023
@@ -17,7 +17,8 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Serialized parameters
///
public int Idx1; /// 1..8
public int AdcValueClosed; /// 0..1023
public ValveCategory Category; /// Feeding, Output or All
public int AdcValueClosed; /// 0..1023
public int AdcValueOpen; /// 0..1023
public int StableTimeMs; /// 200..1500 ms
public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions
@@ -31,8 +32,15 @@ namespace TBF.BenchControl.Elde.RegulValve
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveCfg()
{
Name = "VR";
}
public RegulValveCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = "CB";
Category = ValveCategory.Output;
Idx1 = 1;
AdcValueClosed = 100;
AdcValueOpen = 500;
@@ -41,12 +49,6 @@ namespace TBF.BenchControl.Elde.RegulValve
FlowStableSec = 5;
}
public RegulValveCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public string ToString(int i)
{
return string.Format("Name={0}, Parent={1}, Idx1={2}, ADC-Closed={3}, ADC-Open={4}, StabTm={5}ms, PosReuse={6}, FlowStable={7}s",
@@ -67,6 +67,8 @@ namespace TBF.BenchControl.Elde.RegulValve
this.adcTextBox = new System.Windows.Forms.TextBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.categoryComboBox = new System.Windows.Forms.ComboBox();
this.categoryLabel = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -76,18 +78,18 @@ namespace TBF.BenchControl.Elde.RegulValve
// positionTextBox
//
this.positionTextBox.Enabled = false;
this.positionTextBox.Location = new System.Drawing.Point(138, 89);
this.positionTextBox.Location = new System.Drawing.Point(138, 114);
this.positionTextBox.Name = "positionTextBox";
this.positionTextBox.Size = new System.Drawing.Size(46, 20);
this.positionTextBox.TabIndex = 6;
this.positionTextBox.TabIndex = 7;
//
// positionLabel
//
this.positionLabel.AutoSize = true;
this.positionLabel.Location = new System.Drawing.Point(28, 92);
this.positionLabel.Location = new System.Drawing.Point(28, 117);
this.positionLabel.Name = "positionLabel";
this.positionLabel.Size = new System.Drawing.Size(18, 13);
this.positionLabel.TabIndex = 5;
this.positionLabel.TabIndex = 6;
this.positionLabel.Text = "ID";
//
// parentNameLabel
@@ -128,35 +130,35 @@ namespace TBF.BenchControl.Elde.RegulValve
// adcClosedLabel
//
this.adcClosedLabel.AutoSize = true;
this.adcClosedLabel.Location = new System.Drawing.Point(28, 115);
this.adcClosedLabel.Location = new System.Drawing.Point(28, 141);
this.adcClosedLabel.Name = "adcClosedLabel";
this.adcClosedLabel.Size = new System.Drawing.Size(93, 13);
this.adcClosedLabel.TabIndex = 7;
this.adcClosedLabel.TabIndex = 8;
this.adcClosedLabel.Text = "ADC when Closed";
//
// adcClosedTextBox
//
this.adcClosedTextBox.Enabled = false;
this.adcClosedTextBox.Location = new System.Drawing.Point(138, 112);
this.adcClosedTextBox.Location = new System.Drawing.Point(138, 138);
this.adcClosedTextBox.Name = "adcClosedTextBox";
this.adcClosedTextBox.Size = new System.Drawing.Size(46, 20);
this.adcClosedTextBox.TabIndex = 8;
this.adcClosedTextBox.TabIndex = 9;
//
// adcOpenTextBox
//
this.adcOpenTextBox.Enabled = false;
this.adcOpenTextBox.Location = new System.Drawing.Point(138, 135);
this.adcOpenTextBox.Location = new System.Drawing.Point(138, 162);
this.adcOpenTextBox.Name = "adcOpenTextBox";
this.adcOpenTextBox.Size = new System.Drawing.Size(46, 20);
this.adcOpenTextBox.TabIndex = 10;
this.adcOpenTextBox.TabIndex = 11;
//
// adcOpenLabel
//
this.adcOpenLabel.AutoSize = true;
this.adcOpenLabel.Location = new System.Drawing.Point(28, 138);
this.adcOpenLabel.Location = new System.Drawing.Point(28, 165);
this.adcOpenLabel.Name = "adcOpenLabel";
this.adcOpenLabel.Size = new System.Drawing.Size(87, 13);
this.adcOpenLabel.TabIndex = 9;
this.adcOpenLabel.TabIndex = 10;
this.adcOpenLabel.Text = "ADC when Open";
//
// parentNameComboBox
@@ -172,45 +174,45 @@ namespace TBF.BenchControl.Elde.RegulValve
//
this.storedPosReuseCheckBox.AutoSize = true;
this.storedPosReuseCheckBox.Enabled = false;
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 184);
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 213);
this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
this.storedPosReuseCheckBox.TabIndex = 13;
this.storedPosReuseCheckBox.TabIndex = 14;
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, 158);
this.stableTimeTextBox.Location = new System.Drawing.Point(138, 186);
this.stableTimeTextBox.Name = "stableTimeTextBox";
this.stableTimeTextBox.Size = new System.Drawing.Size(46, 20);
this.stableTimeTextBox.TabIndex = 15;
this.stableTimeTextBox.TabIndex = 13;
//
// stableTimeLabel
//
this.stableTimeLabel.AutoSize = true;
this.stableTimeLabel.Location = new System.Drawing.Point(28, 161);
this.stableTimeLabel.Location = new System.Drawing.Point(28, 189);
this.stableTimeLabel.Name = "stableTimeLabel";
this.stableTimeLabel.Size = new System.Drawing.Size(81, 13);
this.stableTimeLabel.TabIndex = 14;
this.stableTimeLabel.TabIndex = 12;
this.stableTimeLabel.Text = "Stable time [ms]";
//
// flowStableSecTextBox
//
this.flowStableSecTextBox.Enabled = false;
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 207);
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 237);
this.flowStableSecTextBox.Name = "flowStableSecTextBox";
this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
this.flowStableSecTextBox.TabIndex = 17;
this.flowStableSecTextBox.TabIndex = 16;
//
// flowStableSecLabel
//
this.flowStableSecLabel.AutoSize = true;
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 210);
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 240);
this.flowStableSecLabel.Name = "flowStableSecLabel";
this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
this.flowStableSecLabel.TabIndex = 16;
this.flowStableSecLabel.TabIndex = 15;
this.flowStableSecLabel.Text = "Flow stable [s]";
//
// groupBox1
@@ -404,10 +406,30 @@ namespace TBF.BenchControl.Elde.RegulValve
this.label4.TabIndex = 22;
this.label4.Text = "ADC:";
//
// categoryComboBox
//
this.categoryComboBox.Enabled = false;
this.categoryComboBox.FormattingEnabled = true;
this.categoryComboBox.Location = new System.Drawing.Point(138, 90);
this.categoryComboBox.Name = "categoryComboBox";
this.categoryComboBox.Size = new System.Drawing.Size(81, 21);
this.categoryComboBox.TabIndex = 5;
//
// categoryLabel
//
this.categoryLabel.AutoSize = true;
this.categoryLabel.Location = new System.Drawing.Point(28, 93);
this.categoryLabel.Name = "categoryLabel";
this.categoryLabel.Size = new System.Drawing.Size(49, 13);
this.categoryLabel.TabIndex = 4;
this.categoryLabel.Text = "Category";
//
// RegulValveCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.categoryComboBox);
this.Controls.Add(this.categoryLabel);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
@@ -481,5 +503,7 @@ namespace TBF.BenchControl.Elde.RegulValve
private System.Windows.Forms.TextBox adcTextBox;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox categoryComboBox;
private System.Windows.Forms.Label categoryLabel;
}
}
@@ -48,6 +48,10 @@ namespace TBF.BenchControl.Elde.RegulValve
}
}
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
if (config != null)
{
adc1 = config.AdcValueClosed;
@@ -72,7 +76,8 @@ namespace TBF.BenchControl.Elde.RegulValve
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
positionTextBox.Text = config.Idx1.ToString();
categoryComboBox.Text = config.Category.ToString();
positionTextBox.Text = config.Idx1.ToString();
adcClosedTextBox.Text = config.AdcValueClosed.ToString();
adcOpenTextBox.Text = config.AdcValueOpen.ToString();
stableTimeTextBox.Text = config.StableTimeMs.ToString();
@@ -89,7 +94,8 @@ namespace TBF.BenchControl.Elde.RegulValve
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
positionTextBox.Enabled = true;
categoryComboBox.Enabled = true;
positionTextBox.Enabled = true;
adcClosedTextBox.Enabled = true;
adcOpenTextBox.Enabled = true;
stableTimeTextBox.Enabled = true;
@@ -108,6 +114,14 @@ namespace TBF.BenchControl.Elde.RegulValve
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!categoryComboBox.Text.Equals(ValveCategory.All.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Feeding.ToString()) &&
!categoryComboBox.Text.Equals(ValveCategory.Output.ToString()))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Category'";
}
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 1 || dummy > 8)
{
flags |= CfgUpdateFlags.Error;
@@ -160,6 +174,18 @@ namespace TBF.BenchControl.Elde.RegulValve
flags |= CfgUpdateFlags.RestartRqrd;
}
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 (newCategory != config.Category)
{
config.Category = newCategory;
flags |= CfgUpdateFlags.RestartRqrd;
}
int tmp = int.Parse(positionTextBox.Text);
if (config.Idx1 != tmp)
{
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.RegulValve
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new RegulValve(cfg, components); }
public IComponentCfg DefaultConfig() { return new RegulValveCfg(this); }
public IComponentCfg DefaultConfig() { return new RegulValveCfg("RV", this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
@@ -20,6 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
public IDictionary<float, float> Dict { get { return dict; } }
ControlBoardDev controlBoard { get { return regulValve.ControlBoard; } }
public ValveCategory Category { get { return RegulValveTandemCfg.Category; } }
readonly RegulValve.RegulValve regulValve;
readonly RegulValve.RegulValve fixedRV;
@@ -16,7 +16,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
///
/// Serialized parameters
///
public string RegulValveName; /// Name of the regulation valve used to control the flow
public ValveCategory Category; /// Feeding, Output or All
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 [%]
public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions
@@ -25,21 +26,20 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Private parameterless constructor invoked by all other (public) constructors
RegulValveTandemCfg()
{
Name = "RegulationValve";
ParentName = string.Empty;
RegulValveName = "RV1";
FixedRVName = "RV2";
FixedRVPosition = 50.0f;
StoredPositionReuse = false;
FlowStableSec = 5;
}
public RegulValveTandemCfg(IComponentFactory factory)
public RegulValveTandemCfg(string name, IComponentFactory factory)
: this()
{
this.Factory = factory;
Name = name;
Factory = factory;
ParentName = string.Empty;
Category = ValveCategory.Output;
RegulValveName = "RV1";
FixedRVName = "RV2";
FixedRVPosition = 50.0f;
StoredPositionReuse = false;
FlowStableSec = 5;
}
public string ToString(int i)
@@ -49,6 +49,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
}
}
categoryComboBox.Items.Add(ValveCategory.All.ToString());
categoryComboBox.Items.Add(ValveCategory.Feeding.ToString());
categoryComboBox.Items.Add(ValveCategory.Output.ToString());
Redraw();
}
@@ -62,7 +66,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
regulValveNameComboBox.Text = string.IsNullOrEmpty(config.RegulValveName) ? "---" : config.RegulValveName;
categoryComboBox.Text = config.Category.ToString();
regulValveNameComboBox.Text = string.IsNullOrEmpty(config.RegulValveName) ? "---" : config.RegulValveName;
fixedRVNameComboBox.Text = string.IsNullOrEmpty(config.FixedRVName) ? "---" : config.FixedRVName;
fixedRVPositionTextBox.Text = config.FixedRVPosition.ToString("F0");
storedPosReuseCheckBox.Checked = config.StoredPositionReuse;
@@ -72,7 +77,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
public void Unlock()
{
nameTextBox.Enabled = true;
regulValveNameComboBox.Enabled = true;
categoryComboBox.Enabled = true;
regulValveNameComboBox.Enabled = true;
fixedRVNameComboBox.Enabled = true;
fixedRVPositionTextBox.Enabled = true;
storedPosReuseCheckBox.Enabled = true;
@@ -83,6 +89,14 @@ 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()))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Category'";
}
if (!regulValveNameComboBox.Items.Contains(regulValveNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
@@ -123,6 +137,18 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
flags |= CfgUpdateFlags.RestartRqrd;
}
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 (newCategory != config.Category)
{
config.Category = newCategory;
flags |= CfgUpdateFlags.RestartRqrd;
}
string str = regulValveNameComboBox.Text.Equals("---") ? string.Empty : regulValveNameComboBox.Text;
if (!config.RegulValveName.Equals(str))
{
@@ -43,15 +43,17 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
this.fixedRVNameLabel = new System.Windows.Forms.Label();
this.fixedRVPositionTextBox = new System.Windows.Forms.TextBox();
this.fixedRVPositionLabel = new System.Windows.Forms.Label();
this.categoryComboBox = new System.Windows.Forms.ComboBox();
this.categoryLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// regulValveNameLabel
//
this.regulValveNameLabel.AutoSize = true;
this.regulValveNameLabel.Location = new System.Drawing.Point(28, 68);
this.regulValveNameLabel.Location = new System.Drawing.Point(28, 93);
this.regulValveNameLabel.Name = "regulValveNameLabel";
this.regulValveNameLabel.Size = new System.Drawing.Size(87, 13);
this.regulValveNameLabel.TabIndex = 3;
this.regulValveNameLabel.TabIndex = 5;
this.regulValveNameLabel.Text = "Regulation valve";
//
// nameTextBox
@@ -84,78 +86,98 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
//
this.regulValveNameComboBox.Enabled = false;
this.regulValveNameComboBox.FormattingEnabled = true;
this.regulValveNameComboBox.Location = new System.Drawing.Point(138, 65);
this.regulValveNameComboBox.Location = new System.Drawing.Point(138, 90);
this.regulValveNameComboBox.Name = "regulValveNameComboBox";
this.regulValveNameComboBox.Size = new System.Drawing.Size(130, 21);
this.regulValveNameComboBox.TabIndex = 4;
this.regulValveNameComboBox.TabIndex = 6;
//
// storedPosReuseCheckBox
//
this.storedPosReuseCheckBox.AutoSize = true;
this.storedPosReuseCheckBox.Enabled = false;
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 170);
this.storedPosReuseCheckBox.Location = new System.Drawing.Point(31, 171);
this.storedPosReuseCheckBox.Name = "storedPosReuseCheckBox";
this.storedPosReuseCheckBox.Size = new System.Drawing.Size(162, 17);
this.storedPosReuseCheckBox.TabIndex = 13;
this.storedPosReuseCheckBox.TabIndex = 11;
this.storedPosReuseCheckBox.Text = "Enable stored position re-use";
this.storedPosReuseCheckBox.UseVisualStyleBackColor = true;
//
// flowStableSecTextBox
//
this.flowStableSecTextBox.Enabled = false;
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 193);
this.flowStableSecTextBox.Location = new System.Drawing.Point(138, 194);
this.flowStableSecTextBox.Name = "flowStableSecTextBox";
this.flowStableSecTextBox.Size = new System.Drawing.Size(46, 20);
this.flowStableSecTextBox.TabIndex = 17;
this.flowStableSecTextBox.TabIndex = 13;
//
// flowStableSecLabel
//
this.flowStableSecLabel.AutoSize = true;
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 196);
this.flowStableSecLabel.Location = new System.Drawing.Point(28, 197);
this.flowStableSecLabel.Name = "flowStableSecLabel";
this.flowStableSecLabel.Size = new System.Drawing.Size(74, 13);
this.flowStableSecLabel.TabIndex = 16;
this.flowStableSecLabel.TabIndex = 12;
this.flowStableSecLabel.Text = "Flow stable [s]";
//
// fixedRVNameComboBox
//
this.fixedRVNameComboBox.Enabled = false;
this.fixedRVNameComboBox.FormattingEnabled = true;
this.fixedRVNameComboBox.Location = new System.Drawing.Point(138, 91);
this.fixedRVNameComboBox.Location = new System.Drawing.Point(138, 115);
this.fixedRVNameComboBox.Name = "fixedRVNameComboBox";
this.fixedRVNameComboBox.Size = new System.Drawing.Size(130, 21);
this.fixedRVNameComboBox.TabIndex = 22;
this.fixedRVNameComboBox.TabIndex = 8;
//
// fixedRVNameLabel
//
this.fixedRVNameLabel.AutoSize = true;
this.fixedRVNameLabel.Location = new System.Drawing.Point(28, 94);
this.fixedRVNameLabel.Location = new System.Drawing.Point(28, 118);
this.fixedRVNameLabel.Name = "fixedRVNameLabel";
this.fixedRVNameLabel.Size = new System.Drawing.Size(82, 13);
this.fixedRVNameLabel.TabIndex = 21;
this.fixedRVNameLabel.TabIndex = 7;
this.fixedRVNameLabel.Text = "Fixed reg. valve";
//
// fixedRVPositionTextBox
//
this.fixedRVPositionTextBox.Enabled = false;
this.fixedRVPositionTextBox.Location = new System.Drawing.Point(138, 117);
this.fixedRVPositionTextBox.Location = new System.Drawing.Point(138, 140);
this.fixedRVPositionTextBox.Name = "fixedRVPositionTextBox";
this.fixedRVPositionTextBox.Size = new System.Drawing.Size(46, 20);
this.fixedRVPositionTextBox.TabIndex = 24;
this.fixedRVPositionTextBox.TabIndex = 10;
//
// fixedRVPositionLabel
//
this.fixedRVPositionLabel.AutoSize = true;
this.fixedRVPositionLabel.Location = new System.Drawing.Point(28, 120);
this.fixedRVPositionLabel.Location = new System.Drawing.Point(28, 143);
this.fixedRVPositionLabel.Name = "fixedRVPositionLabel";
this.fixedRVPositionLabel.Size = new System.Drawing.Size(89, 13);
this.fixedRVPositionLabel.TabIndex = 23;
this.fixedRVPositionLabel.TabIndex = 9;
this.fixedRVPositionLabel.Text = "Fixed RV position";
//
// categoryComboBox
//
this.categoryComboBox.Enabled = false;
this.categoryComboBox.FormattingEnabled = true;
this.categoryComboBox.Location = new System.Drawing.Point(138, 65);
this.categoryComboBox.Name = "categoryComboBox";
this.categoryComboBox.Size = new System.Drawing.Size(81, 21);
this.categoryComboBox.TabIndex = 4;
//
// categoryLabel
//
this.categoryLabel.AutoSize = true;
this.categoryLabel.Location = new System.Drawing.Point(28, 68);
this.categoryLabel.Name = "categoryLabel";
this.categoryLabel.Size = new System.Drawing.Size(49, 13);
this.categoryLabel.TabIndex = 3;
this.categoryLabel.Text = "Category";
//
// RegulValveTandemCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.categoryComboBox);
this.Controls.Add(this.categoryLabel);
this.Controls.Add(this.fixedRVPositionTextBox);
this.Controls.Add(this.fixedRVPositionLabel);
this.Controls.Add(this.fixedRVNameComboBox);
@@ -190,5 +212,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
private System.Windows.Forms.Label fixedRVNameLabel;
private System.Windows.Forms.TextBox fixedRVPositionTextBox;
private System.Windows.Forms.Label fixedRVPositionLabel;
private System.Windows.Forms.ComboBox categoryComboBox;
private System.Windows.Forms.Label categoryLabel;
}
}
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new RegulValveTandem(cfg, components); }
public IComponentCfg DefaultConfig() { return new RegulValveTandemCfg(this); }
public IComponentCfg DefaultConfig() { return new RegulValveTandemCfg("RV", this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
+30 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.BenchControl.GenericDevices;
@@ -12,7 +12,9 @@ namespace TBF.BenchControl
public string Name;
public float Qfrom;
public float Qto;
public IValve Pump; /// pump to use with this path or null
public IValve Pump; /// pump to use with this path or null
public IList<IRegulValve> RegulValves;
public IList<float> RegulValvesPct;
public IList<IValve> ValvesOpen; /// a list of valves to open or null
public IList<IValve> ValvesClose; /// a list of valves to close or null
@@ -23,6 +25,8 @@ namespace TBF.BenchControl
Name = name;
ValvesOpen = new List<IValve>();
ValvesClose = new List<IValve>();
RegulValves = new List<IRegulValve>();
RegulValvesPct = new List<float>();
}
/// Constructor from data entity
@@ -33,6 +37,30 @@ namespace TBF.BenchControl
Qto = entity.Qto;
Pump = (IValve)TbfComponents.FindComponent(entity.Pump, components);
///
/// Feeding regulation valve components
///
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))
{
RegulValves.Add(regValve);
}
}
///
/// Feeding regulation valve precentages
///
string[] rvPosStr = (entity.RegulValvesPct != null) ? entity.RegulValvesPct.Split(new char[] { ';' }) : new string[0];
for (int i = 0; i < RegulValves.Count; i++)
{
string str = (i < rvPosStr.Length) ? rvPosStr[i] : "---";
float pct;
if (!Utils.TryParseUFloat(str, out pct) || pct > 100.0f || str == "---") pct = 0;
RegulValvesPct.Add(pct);
}
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
ValvesOpen = new List<IValve>();
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
@@ -10,6 +10,11 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IRegulValve : IComponent
{
/// <summary>
/// All, Feeding, Bench, Output or None
/// </summary>
ValveCategory Category { get; }
/// <summary>
/// true = The regulation valve is 4-20 mA current controlled coaxial valve
/// </summary>