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 13:03:19 +02:00
parent 1388f459fe
commit caf43fedb3
19 changed files with 294 additions and 92 deletions

View File

@ -11,11 +11,12 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual float Qfrom { get; set; } /// Water flow in [m3/h]
public virtual float Qto { get; set; } /// Water flow in [m3/h]
public virtual string Pump { get; set; }
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
/// Valves
/// Valves
public virtual string ValvesOpen { get; set; }
public virtual string ValvesClose { get; set; }
@ -41,7 +42,8 @@ namespace Config.Entities
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Pump = Pump;
result.ValvesOpen = ValvesOpen;
result.RegulValvesPct = RegulValvesPct;
result.ValvesOpen = ValvesOpen;
result.ValvesClose = ValvesClose;
return result;

View File

@ -16,6 +16,7 @@ namespace Config.Mappings
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Pump);
Map(x => x.RegulValvesPct);
Map(x => x.ValvesOpen)
.CustomType("StringClob")
.CustomSqlType("varchar(8000)");

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.353.0")]
[assembly: AssemblyFileVersion("2.10.353.0")]
[assembly: AssemblyVersion("2.11.364.0")]
[assembly: AssemblyFileVersion("2.11.364.0")]

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.353.0")]
[assembly: AssemblyFileVersion("2.10.353.0")]
[assembly: AssemblyVersion("2.11.364.0")]
[assembly: AssemblyFileVersion("2.11.364.0")]

View File

@ -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

View File

@ -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",

View File

@ -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;
}
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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)

View File

@ -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))
{

View File

@ -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;
}
}

View File

@ -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)
{

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));

View File

@ -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>

View File

@ -32,7 +32,8 @@ namespace TBF
public IList<BenchControl.Generic.IComponent> TbfComponents;
public IList<IValve> Valves;
public ISession Session; /// One common DB session passed also to the controls inside tab pages
public IList<IRegulValve> FeedingRegulValves;
public ISession Session; /// One common DB session passed also to the controls inside tab pages
#if HEAT_METERS_SUPPORT
private System.Windows.Forms.TabPage heatMetersTabPage;
@ -64,6 +65,17 @@ namespace TBF
/// Find all master valves
Valves = BenchControl.GenericDevices.ValveBase.MasterValves(TbfComponents);
/// Find all feeding regulation valves
FeedingRegulValves = new List<IRegulValve>();
foreach (var cmpnt in TbfComponents)
{
IRegulValve regValve = cmpnt as IRegulValve;
if (regValve != null && (regValve.Category == TBF.BenchControl.ValveCategory.Feeding || regValve.Category == TBF.BenchControl.ValveCategory.All))
{
FeedingRegulValves.Add(regValve);
}
}
/// Create the database session for paths
Session = Config.FluentCommon.CreateSession(Config.Entities.DBKind.Config);

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.10.363.1")]
[assembly: AssemblyFileVersion("2.10.363.1")]
[assembly: AssemblyVersion("2.11.364.1")]
[assembly: AssemblyFileVersion("2.11.364.1")]

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
using TBF.Resources;
@ -29,6 +28,8 @@ namespace TBF.UiControls
FixedColumnsCount,
}
readonly int fixedColumnsCount = (int)Column.FixedColumnsCount;
int regvCount;
int valvesCount;
PathsDlg parent;
Control parentControl;
@ -46,9 +47,10 @@ namespace TBF.UiControls
this.parentControl = parentControl;
/// Load the paths
MyItems = parent.Session
.CreateQuery("FROM FeedingPath ORDER BY ItemNr")
.List<Config.Entities.FeedingPath>();
//MyItems = parent.Session
// .CreateQuery("FROM FeedingPath ORDER BY ItemNr")
// .List<Config.Entities.FeedingPath>();
MyItems = parent.Session.QueryOver<FeedingPath>().OrderBy(x => x.ItemNr).Asc.List();
SubItemClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemClicked);
SubItemRightClicked += new Results.Forms.SubItemEventHandler(listViewEx_SubItemRightClicked);
@ -61,14 +63,23 @@ namespace TBF.UiControls
Columns.Add(Strings.Q_to_m3h, (ls.FeedingColumnCount > 2) ? ls.FeedingColumnWidths[2] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
Columns.Add(Strings.Pump, (ls.FeedingColumnCount > 3) ? ls.FeedingColumnWidths[3] : 60 * parent.Dpi / PathsDlg.Dpi100pct);
int clmn = (int)Column.FixedColumnsCount;
foreach (var rv in parent.FeedingRegulValves)
{
Columns.Add(rv.Cfg.Name, (ls.FeedingColumnCount > clmn) ? ls.FeedingColumnWidths[clmn] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
clmn++;
}
regvCount = clmn - (int)Column.FixedColumnsCount;
foreach (var vlv in parent.Valves)
{
if (vlv.Category == ValveCategory.All || vlv.Category == ValveCategory.Feeding)
if (vlv.Category == TBF.BenchControl.ValveCategory.All || vlv.Category == TBF.BenchControl.ValveCategory.Feeding)
{
Columns.Add(vlv.Cfg.Name, (ls.FeedingColumnCount > clmn) ? ls.FeedingColumnWidths[clmn] : 50 * parent.Dpi / PathsDlg.Dpi100pct);
clmn++;
}
}
valvesCount = clmn - (int)Column.FixedColumnsCount - regvCount;
/// Pump
ComboBox pumpCBox = new ComboBox();
@ -78,20 +89,32 @@ namespace TBF.UiControls
if (cmpnt is IPump) pumpCBox.Items.Add(cmpnt.Cfg.Name);
}
editors = new Control[fixedColumnsCount + 64];
editors = new Control[fixedColumnsCount + regvCount + 64];
///
editors[(int)Column.Name] = new TextBox(); /// Name
editors[(int)Column.Qfrom] = new TextBox(); /// Q_from
editors[(int)Column.Qto] = new TextBox(); /// Q_to
editors[(int)Column.Pump] = pumpCBox;
/// Prepare valve combo-boxes (max. 64 valves)
for (int i = 0; i < regvCount; i++)
{
ComboBox cb = new ComboBox();
cb.Items.Add("---");
cb.Items.Add("0");
cb.Items.Add("25");
cb.Items.Add("50");
cb.Items.Add("75");
cb.Items.Add("100");
editors[fixedColumnsCount + i] = cb;
}
/// Prepare valve combo-boxes (max. 64 valves)
for (int i = 0; i < 64; i++)
{
ComboBox cb = new ComboBox();
cb.Items.Add("---");
cb.Items.Add(Strings.open);
cb.Items.Add(Strings.close);
editors[fixedColumnsCount + i] = cb;
editors[fixedColumnsCount + regvCount + i] = cb;
}
///
for (int i = 0; i < editors.Length; i++)
@ -143,7 +166,7 @@ namespace TBF.UiControls
void listViewEx_SubItemEndEditing(object sender, Results.Forms.SubItemEndEditingEventArgs e)
{
if (e.SubItem >= fixedColumnsCount)
if (e.SubItem >= fixedColumnsCount + regvCount)
{
e.Item.SubItems[e.SubItem].BackColor = (e.DisplayText == Strings.open) ? Color.LightGray : Color.White;
}
@ -161,9 +184,16 @@ namespace TBF.UiControls
lvi.SubItems.Add(path.Qto.ToString());
lvi.SubItems.Add(path.Pump != null ? path.Pump.Cfg.Name : "---");
foreach (var valve in parent.Valves)
string[] rvPosStr = (entity.RegulValvesPct != null) ? entity.RegulValvesPct.Split(new char[] {';'})
: new string[0];
for (int i = 0; i < regvCount; i++)
{
lvi.SubItems.Add((i < rvPosStr.Length) ? rvPosStr[i] : "---");
}
foreach (var valve in parent.Valves)
{
if (valve.Category == ValveCategory.All || valve.Category == ValveCategory.Feeding)
if (valve.Category == TBF.BenchControl.ValveCategory.All || valve.Category == TBF.BenchControl.ValveCategory.Feeding)
{
if (path.ValvesOpen != null && path.ValvesOpen.Contains(valve))
{
@ -208,14 +238,33 @@ namespace TBF.UiControls
entity.Pump = lvi.SubItems[(int)Column.Pump].Text.Equals("---") ? string.Empty : lvi.SubItems[(int)Column.Pump].Text;
}
///
/// Regulation valves
///
string regulValvesPct = string.Empty;
for (int i = fixedColumnsCount; i < fixedColumnsCount + regvCount; i++)
{
if (regulValvesPct.Length > 0) regulValvesPct += ";";
float fdummy;
if (lvi.SubItems[i].Text.Equals("---") ||
(Utils.TryParseUFloat(lvi.SubItems[i].Text, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f)))
{
regulValvesPct += lvi.SubItems[i].Text;
}
}
entity.RegulValvesPct = regulValvesPct;
///
/// Valves
///
string valvesOpen = string.Empty;
string valvesClose = string.Empty;
int k = 0;
for (int j = 0; j < parent.Valves.Count; j++)
{
if (parent.Valves[j].Category == ValveCategory.All || parent.Valves[j].Category == ValveCategory.Feeding)
if (parent.Valves[j].Category == TBF.BenchControl.ValveCategory.All || parent.Valves[j].Category == TBF.BenchControl.ValveCategory.Feeding)
{
string text = lvi.SubItems[fixedColumnsCount + k].Text;
string text = lvi.SubItems[fixedColumnsCount + regvCount + k].Text;
if (text.Equals(Strings.open))
{
if (valvesOpen != string.Empty) valvesOpen += ";";
@ -249,6 +298,7 @@ namespace TBF.UiControls
{
Config.FluentCommon.SaveToDb(parent.Session, entity);
}
parent.Session.Flush();
/// Update the column widths
Program.LocalSettings.FeedingColumnWidths = new int[Columns.Count];