Various.Evaporation comp., MetrologyDlgEvaporationTab and IEvaporation/IScaleOrTank/ITankDraining with EvaporationRate(double T) introduced.

This commit is contained in:
Milan Hanajik
2019-05-15 15:14:04 +02:00
parent 59087474d9
commit 1a122cfa12
27 changed files with 1024 additions and 87 deletions
@@ -38,6 +38,9 @@ namespace TBF.BenchControl.MettlerToledo.Multi
private int drainTimeSec;
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
private string evaporation;
public string Evaporation { get { return evaporation; } set { evaporation = value; } }
public int ComPortNr;
public int BaudRate;
public Parity Parity;
@@ -42,8 +42,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
private string drainValve;
public string DrainValve { get { return drainValve; } set { drainValve = value; } }
private int drainTimeSec;
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
private int drainTimeSec;
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
private string evaporation;
public string Evaporation { get { return evaporation; } set { evaporation = value; } }
public string Format;
@@ -62,34 +62,36 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.label6 = new System.Windows.Forms.Label();
this.emptyUpTextBox = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.evaporationComboBox = new System.Windows.Forms.ComboBox();
this.evaporationLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// handshakeComboBox
//
this.handshakeComboBox.Enabled = false;
this.handshakeComboBox.FormattingEnabled = true;
this.handshakeComboBox.Location = new System.Drawing.Point(236, 222);
this.handshakeComboBox.Location = new System.Drawing.Point(236, 252);
this.handshakeComboBox.Name = "handshakeComboBox";
this.handshakeComboBox.Size = new System.Drawing.Size(43, 21);
this.handshakeComboBox.TabIndex = 29;
this.handshakeComboBox.TabIndex = 31;
//
// stopBitsComboBox
//
this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 200);
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 229);
this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21);
this.stopBitsComboBox.TabIndex = 27;
this.stopBitsComboBox.TabIndex = 29;
//
// parityComboBox
//
this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(100, 222);
this.parityComboBox.Location = new System.Drawing.Point(100, 252);
this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(43, 21);
this.parityComboBox.TabIndex = 23;
this.parityComboBox.TabIndex = 25;
//
// nameTextBox
//
@@ -120,85 +122,85 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// handshakeLabel
//
this.handshakeLabel.AutoSize = true;
this.handshakeLabel.Location = new System.Drawing.Point(162, 225);
this.handshakeLabel.Location = new System.Drawing.Point(162, 255);
this.handshakeLabel.Name = "handshakeLabel";
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
this.handshakeLabel.TabIndex = 28;
this.handshakeLabel.TabIndex = 30;
this.handshakeLabel.Text = "Handshake";
//
// stopBitsLabel
//
this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(162, 203);
this.stopBitsLabel.Location = new System.Drawing.Point(162, 232);
this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 26;
this.stopBitsLabel.TabIndex = 28;
this.stopBitsLabel.Text = "Stop Bits";
//
// dataBitsTextBox
//
this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 178);
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 206);
this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
this.dataBitsTextBox.TabIndex = 25;
this.dataBitsTextBox.TabIndex = 27;
//
// dataBitsLabel
//
this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(162, 181);
this.dataBitsLabel.Location = new System.Drawing.Point(162, 209);
this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 24;
this.dataBitsLabel.TabIndex = 26;
this.dataBitsLabel.Text = "Data Bits";
//
// partityLabel
//
this.partityLabel.AutoSize = true;
this.partityLabel.Location = new System.Drawing.Point(26, 225);
this.partityLabel.Location = new System.Drawing.Point(26, 255);
this.partityLabel.Name = "partityLabel";
this.partityLabel.Size = new System.Drawing.Size(33, 13);
this.partityLabel.TabIndex = 22;
this.partityLabel.TabIndex = 24;
this.partityLabel.Text = "Parity";
//
// baudRateTextBox
//
this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(100, 200);
this.baudRateTextBox.Location = new System.Drawing.Point(100, 229);
this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(43, 20);
this.baudRateTextBox.TabIndex = 21;
this.baudRateTextBox.TabIndex = 23;
//
// baudRateLabel
//
this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(26, 203);
this.baudRateLabel.Location = new System.Drawing.Point(26, 232);
this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(53, 13);
this.baudRateLabel.TabIndex = 20;
this.baudRateLabel.TabIndex = 22;
this.baudRateLabel.Text = "Baud rate";
//
// comPortNrTextBox
//
this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 178);
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 206);
this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
this.comPortNrTextBox.TabIndex = 19;
this.comPortNrTextBox.TabIndex = 21;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 181);
this.label1.Location = new System.Drawing.Point(26, 209);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(67, 13);
this.label1.TabIndex = 18;
this.label1.TabIndex = 20;
this.label1.Text = "Serial port #:";
//
// capacityLabel
//
this.capacityLabel.AutoSize = true;
this.capacityLabel.Location = new System.Drawing.Point(26, 82);
this.capacityLabel.Location = new System.Drawing.Point(26, 76);
this.capacityLabel.Name = "capacityLabel";
this.capacityLabel.Size = new System.Drawing.Size(75, 13);
this.capacityLabel.TabIndex = 5;
@@ -207,7 +209,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// capacityTextBox
//
this.capacityTextBox.Enabled = false;
this.capacityTextBox.Location = new System.Drawing.Point(137, 79);
this.capacityTextBox.Location = new System.Drawing.Point(137, 73);
this.capacityTextBox.Name = "capacityTextBox";
this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
this.capacityTextBox.TabIndex = 6;
@@ -215,7 +217,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(186, 82);
this.label2.Location = new System.Drawing.Point(186, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 13);
this.label2.TabIndex = 7;
@@ -224,7 +226,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(186, 104);
this.label3.Location = new System.Drawing.Point(186, 99);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(19, 13);
this.label3.TabIndex = 10;
@@ -233,7 +235,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// emptyTextBox
//
this.emptyTextBox.Enabled = false;
this.emptyTextBox.Location = new System.Drawing.Point(137, 101);
this.emptyTextBox.Location = new System.Drawing.Point(137, 96);
this.emptyTextBox.Name = "emptyTextBox";
this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTextBox.TabIndex = 9;
@@ -241,7 +243,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// emptyLabel
//
this.emptyLabel.AutoSize = true;
this.emptyLabel.Location = new System.Drawing.Point(26, 104);
this.emptyLabel.Location = new System.Drawing.Point(26, 99);
this.emptyLabel.Name = "emptyLabel";
this.emptyLabel.Size = new System.Drawing.Size(109, 13);
this.emptyLabel.TabIndex = 8;
@@ -250,33 +252,33 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(186, 149);
this.label4.Location = new System.Drawing.Point(186, 170);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(24, 13);
this.label4.TabIndex = 17;
this.label4.TabIndex = 19;
this.label4.Text = "sec";
//
// drainTimeTextBox
//
this.drainTimeTextBox.Enabled = false;
this.drainTimeTextBox.Location = new System.Drawing.Point(137, 146);
this.drainTimeTextBox.Location = new System.Drawing.Point(137, 167);
this.drainTimeTextBox.Name = "drainTimeTextBox";
this.drainTimeTextBox.Size = new System.Drawing.Size(43, 20);
this.drainTimeTextBox.TabIndex = 16;
this.drainTimeTextBox.TabIndex = 18;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 149);
this.label5.Location = new System.Drawing.Point(26, 170);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(54, 13);
this.label5.TabIndex = 15;
this.label5.TabIndex = 17;
this.label5.Text = "Drain time";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(137, 49);
this.formatTextBox.Location = new System.Drawing.Point(137, 50);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(43, 20);
this.formatTextBox.TabIndex = 4;
@@ -284,7 +286,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 52);
this.formatLabel.Location = new System.Drawing.Point(26, 53);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(76, 13);
this.formatLabel.TabIndex = 3;
@@ -294,24 +296,24 @@ namespace TBF.BenchControl.MettlerToledo.Standard
//
this.drainValveComboBox.Enabled = false;
this.drainValveComboBox.FormattingEnabled = true;
this.drainValveComboBox.Location = new System.Drawing.Point(137, 123);
this.drainValveComboBox.Location = new System.Drawing.Point(137, 143);
this.drainValveComboBox.Name = "drainValveComboBox";
this.drainValveComboBox.Size = new System.Drawing.Size(143, 21);
this.drainValveComboBox.TabIndex = 14;
this.drainValveComboBox.TabIndex = 16;
//
// drainingValveLabel
//
this.drainingValveLabel.AutoSize = true;
this.drainingValveLabel.Location = new System.Drawing.Point(26, 126);
this.drainingValveLabel.Location = new System.Drawing.Point(26, 146);
this.drainingValveLabel.Name = "drainingValveLabel";
this.drainingValveLabel.Size = new System.Drawing.Size(61, 13);
this.drainingValveLabel.TabIndex = 13;
this.drainingValveLabel.TabIndex = 15;
this.drainingValveLabel.Text = "Drain valve";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(285, 104);
this.label6.Location = new System.Drawing.Point(285, 99);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(19, 13);
this.label6.TabIndex = 12;
@@ -320,7 +322,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// emptyUpTextBox
//
this.emptyUpTextBox.Enabled = false;
this.emptyUpTextBox.Location = new System.Drawing.Point(236, 101);
this.emptyUpTextBox.Location = new System.Drawing.Point(236, 96);
this.emptyUpTextBox.Name = "emptyUpTextBox";
this.emptyUpTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyUpTextBox.TabIndex = 11;
@@ -328,16 +330,36 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(225, 87);
this.label7.Location = new System.Drawing.Point(225, 81);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(83, 13);
this.label7.TabIndex = 30;
this.label7.Text = "not draining (up)";
//
// evaporationComboBox
//
this.evaporationComboBox.Enabled = false;
this.evaporationComboBox.FormattingEnabled = true;
this.evaporationComboBox.Location = new System.Drawing.Point(137, 119);
this.evaporationComboBox.Name = "evaporationComboBox";
this.evaporationComboBox.Size = new System.Drawing.Size(143, 21);
this.evaporationComboBox.TabIndex = 14;
//
// evaporationLabel
//
this.evaporationLabel.AutoSize = true;
this.evaporationLabel.Location = new System.Drawing.Point(26, 122);
this.evaporationLabel.Name = "evaporationLabel";
this.evaporationLabel.Size = new System.Drawing.Size(64, 13);
this.evaporationLabel.TabIndex = 13;
this.evaporationLabel.Text = "Evaporation";
//
// BalanceCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.evaporationComboBox);
this.Controls.Add(this.evaporationLabel);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.emptyUpTextBox);
@@ -370,7 +392,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
this.Controls.Add(this.comPortNrTextBox);
this.Controls.Add(this.label1);
this.Name = "BalanceCfgCtrl";
this.Size = new System.Drawing.Size(327, 250);
this.Size = new System.Drawing.Size(400, 350);
this.Load += new System.EventHandler(this.BalanceCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -410,5 +432,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox emptyUpTextBox;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox evaporationComboBox;
private System.Windows.Forms.Label evaporationLabel;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -100,6 +100,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
if (parent.TbfComponents != null)
{
evaporationComboBox.Items.Add("---");
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
{
@@ -107,6 +108,10 @@ namespace TBF.BenchControl.MettlerToledo.Standard
{
drainValveComboBox.Items.Add(cmpnt.Name);
}
else if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Various.Evaporation.Factory)
{
evaporationComboBox.Items.Add(cmpnt.Name);
}
}
}
@@ -127,8 +132,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
emptyTextBox.Text = config.Empty.ToString();
emptyUpTextBox.Text = config.EmptyUp.ToString();
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format;
drainTimeTextBox.Text = config.DrainTimeSec.ToString();
evaporationComboBox.Text = string.IsNullOrEmpty(config.Evaporation) ? "---" : config.Evaporation;
drainValveComboBox.Text = string.IsNullOrEmpty(config.DrainValve) ? "---" : config.DrainValve;
drainTimeTextBox.Text = config.DrainTimeSec.ToString();
comPortNrTextBox.Text = config.ComPortNr.ToString();
baudRateTextBox.Text = config.BaudRate.ToString();
@@ -145,8 +151,9 @@ namespace TBF.BenchControl.MettlerToledo.Standard
emptyTextBox.Enabled = true;
emptyUpTextBox.Enabled = true;
formatTextBox.Enabled = true;
drainTimeTextBox.Enabled = true;
evaporationComboBox.Enabled = true;
drainValveComboBox.Enabled = true;
drainTimeTextBox.Enabled = true;
comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true;
@@ -197,7 +204,12 @@ namespace TBF.BenchControl.MettlerToledo.Standard
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Decimal points' should be between 0 and 9";
}
if (!drainValveComboBox.Items.Contains(drainValveComboBox.Text))
if (!evaporationComboBox.Items.Contains(evaporationComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Evaporation'";
}
if (!drainValveComboBox.Items.Contains(drainValveComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Drain valve'";
@@ -222,6 +234,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.EmptyUp = Utils.ParseUFloat(emptyUpTextBox.Text);
config.Format = "F" + formatTextBox.Text;
config.Evaporation = evaporationComboBox.Text.Equals("---") ? string.Empty : evaporationComboBox.Text;
config.DrainTimeSec = int.Parse(drainTimeTextBox.Text);
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
@@ -30,9 +30,9 @@ namespace TBF.BenchControl.MettlerToledo
readonly GenericDevices.ITankDrainingCfg tankDrainingCfg;
bool hasDrainValve { get { return !string.IsNullOrEmpty(tankDrainingCfg.DrainValve); } } /// Available in UI (unlike 'drainValve')
IValve drainValve;
public GenericDevices.IValve DrainValve { get { return drainValve; } }
IEvaporation evaporationCmpnt;
IOperation openTheDrainValveOp;
IOperation closeTheDrainValveOp;
@@ -75,6 +75,7 @@ namespace TBF.BenchControl.MettlerToledo
protected void Initalize()
{
drainValve = TbfComponents.FindComponent(tankDrainingCfg.DrainValve) as IValve;
evaporationCmpnt = TbfComponents.FindComponent(tankDrainingCfg.Evaporation) as IEvaporation;
openTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, drainValve, null);
closeTheDrainValveOp = new Elde.SetValvesOp(StateMachine.ControlBoard, null, drainValve);
@@ -136,6 +137,13 @@ namespace TBF.BenchControl.MettlerToledo
public virtual bool IsEmpty() { return false; }
public virtual bool ContainsMoreThen(float thld) { return thld == 0; }
/// <summary>
/// For a given temperature in [°C] returns an evaporation rate in [kg/s]
/// </summary>
public double EvaporationRate(double temperature)
{
return (evaporationCmpnt != null) ? evaporationCmpnt.EvaporationRate(temperature) : 0;
}
public int ConditionsCount
{