MettlerToledo.Multi drain valve fixes (BalanceDev, BalanceCfg, etc. changes), ver. 2.18.794

This commit is contained in:
Milan Hanajik 2018-01-31 09:51:04 +01:00
parent 95ad2484ef
commit 2bc8a5629f
7 changed files with 424 additions and 378 deletions

View File

@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Multi
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; }
@ -21,11 +21,22 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// Serialized parameters
///
public int IdNr; /// Identification number 1..3
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Resolution; /// Resolution of the integer value in the serial protocol in 'kg'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
public string Format;
public int EmptyTimeSec; /// s
/// Max. water mass in 'kg' or volume in 'l'
private float capacity;
public float Capacity { get { return capacity; } set { capacity = value; } }
/// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l')
private float empty;
public float Empty { get { return empty; } set { empty = value; } }
private string drainValve;
public string DrainValve { get { return drainValve; } set { drainValve = value; } }
private int drainTimeSec;
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
public int ComPortNr;
public int BaudRate;
@ -93,7 +104,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
Resolution = 0.001f;
Empty = 20.0f;
Format = "F3";
EmptyTimeSec = 180;
DrainTimeSec = 180;
ComPortNr = 3;
BaudRate = 2400;
@ -118,12 +129,12 @@ namespace TBF.BenchControl.MettlerToledo.Multi
if (IdNr == 1)
{
return string.Format("Name={0}, Id#={1}, {2}kg, empty={3}kg, fmt.={4}, emptyTm={5}s, Com{6}, {7}Bd, {8}-bits, parity={9}, stopBits={10}, {11}",
Name, IdNr, Capacity, Empty, Format, EmptyTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
Name, IdNr, Capacity, Empty, Format, DrainTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
}
else
{
return string.Format("Name={0}, Id#={1}, {2}kg, empty={3}kg, fmt.={4}, emptyTm={5}s",
Name, IdNr, Capacity, Empty, Format, EmptyTimeSec);
Name, IdNr, Capacity, Empty, Format, DrainTimeSec);
}
}
}

View File

@ -31,349 +31,371 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// </summary>
private void InitializeComponent()
{
this.handshakeComboBox = new System.Windows.Forms.ComboBox();
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
this.parityComboBox = new System.Windows.Forms.ComboBox();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.handshakeLabel = new System.Windows.Forms.Label();
this.stopBitsLabel = new System.Windows.Forms.Label();
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
this.dataBitsLabel = new System.Windows.Forms.Label();
this.parityLabel = new System.Windows.Forms.Label();
this.baudRateTextBox = new System.Windows.Forms.TextBox();
this.baudRateLabel = new System.Windows.Forms.Label();
this.comPortNrTextBox = new System.Windows.Forms.TextBox();
this.comPortNrLabel = new System.Windows.Forms.Label();
this.capacityLabel = new System.Windows.Forms.Label();
this.capacityTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.emptyTextBox = new System.Windows.Forms.TextBox();
this.emptyLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.emptyTimeTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.idNrTextBox = new System.Windows.Forms.TextBox();
this.idNrLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.resolutionTextBox = new System.Windows.Forms.TextBox();
this.resolutionLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// handshakeComboBox
//
this.handshakeComboBox.Enabled = false;
this.handshakeComboBox.FormattingEnabled = true;
this.handshakeComboBox.Location = new System.Drawing.Point(236, 224);
this.handshakeComboBox.Name = "handshakeComboBox";
this.handshakeComboBox.Size = new System.Drawing.Size(43, 21);
this.handshakeComboBox.TabIndex = 30;
//
// stopBitsComboBox
//
this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 203);
this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21);
this.stopBitsComboBox.TabIndex = 28;
//
// parityComboBox
//
this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(100, 224);
this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(43, 21);
this.parityComboBox.TabIndex = 24;
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(136, 26);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(143, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(26, 29);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(133, 7);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentName";
//
// handshakeLabel
//
this.handshakeLabel.AutoSize = true;
this.handshakeLabel.Location = new System.Drawing.Point(162, 227);
this.handshakeLabel.Name = "handshakeLabel";
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
this.handshakeLabel.TabIndex = 29;
this.handshakeLabel.Text = "Handshake";
//
// stopBitsLabel
//
this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(162, 206);
this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 27;
this.stopBitsLabel.Text = "Stop Bits";
//
// dataBitsTextBox
//
this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 181);
this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
this.dataBitsTextBox.TabIndex = 26;
//
// dataBitsLabel
//
this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(162, 184);
this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 25;
this.dataBitsLabel.Text = "Data Bits";
//
// parityLabel
//
this.parityLabel.AutoSize = true;
this.parityLabel.Location = new System.Drawing.Point(26, 229);
this.parityLabel.Name = "parityLabel";
this.parityLabel.Size = new System.Drawing.Size(33, 13);
this.parityLabel.TabIndex = 23;
this.parityLabel.Text = "Parity";
//
// baudRateTextBox
//
this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(100, 203);
this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(43, 20);
this.baudRateTextBox.TabIndex = 22;
//
// baudRateLabel
//
this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(26, 206);
this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
this.baudRateLabel.TabIndex = 21;
this.baudRateLabel.Text = "Baud Rate";
//
// comPortNrTextBox
//
this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 181);
this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
this.comPortNrTextBox.TabIndex = 20;
//
// comPortNrLabel
//
this.comPortNrLabel.AutoSize = true;
this.comPortNrLabel.Location = new System.Drawing.Point(26, 184);
this.comPortNrLabel.Name = "comPortNrLabel";
this.comPortNrLabel.Size = new System.Drawing.Size(68, 13);
this.comPortNrLabel.TabIndex = 19;
this.comPortNrLabel.Text = "Serial Port #:";
//
// capacityLabel
//
this.capacityLabel.AutoSize = true;
this.capacityLabel.Location = new System.Drawing.Point(26, 71);
this.capacityLabel.Name = "capacityLabel";
this.capacityLabel.Size = new System.Drawing.Size(76, 13);
this.capacityLabel.TabIndex = 5;
this.capacityLabel.Text = "Tank Capacity";
//
// capacityTextBox
//
this.capacityTextBox.Enabled = false;
this.capacityTextBox.Location = new System.Drawing.Point(137, 68);
this.capacityTextBox.Name = "capacityTextBox";
this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
this.capacityTextBox.TabIndex = 6;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(186, 71);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 13);
this.label2.TabIndex = 7;
this.label2.Text = "kg";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(186, 113);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(19, 13);
this.label3.TabIndex = 13;
this.label3.Text = "kg";
//
// emptyTextBox
//
this.emptyTextBox.Enabled = false;
this.emptyTextBox.Location = new System.Drawing.Point(137, 110);
this.emptyTextBox.Name = "emptyTextBox";
this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTextBox.TabIndex = 12;
//
// emptyLabel
//
this.emptyLabel.AutoSize = true;
this.emptyLabel.Location = new System.Drawing.Point(26, 113);
this.emptyLabel.Name = "emptyLabel";
this.emptyLabel.Size = new System.Drawing.Size(64, 13);
this.emptyLabel.TabIndex = 11;
this.emptyLabel.Text = "Tank Empty";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(186, 155);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(24, 13);
this.label4.TabIndex = 18;
this.label4.Text = "sec";
//
// emptyTimeTextBox
//
this.emptyTimeTextBox.Enabled = false;
this.emptyTimeTextBox.Location = new System.Drawing.Point(137, 152);
this.emptyTimeTextBox.Name = "emptyTimeTextBox";
this.emptyTimeTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTimeTextBox.TabIndex = 17;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 155);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(90, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Tank Empty Time";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(137, 131);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(43, 20);
this.formatTextBox.TabIndex = 15;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 134);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(76, 13);
this.formatLabel.TabIndex = 14;
this.formatLabel.Text = "Decimal points";
//
// idNrTextBox
//
this.idNrTextBox.Enabled = false;
this.idNrTextBox.Location = new System.Drawing.Point(137, 47);
this.idNrTextBox.Name = "idNrTextBox";
this.idNrTextBox.Size = new System.Drawing.Size(43, 20);
this.idNrTextBox.TabIndex = 4;
this.idNrTextBox.TextChanged += new System.EventHandler(this.idNrTextBox_TextChanged);
//
// idNrLabel
//
this.idNrLabel.AutoSize = true;
this.idNrLabel.Location = new System.Drawing.Point(26, 50);
this.idNrLabel.Name = "idNrLabel";
this.idNrLabel.Size = new System.Drawing.Size(85, 13);
this.idNrLabel.TabIndex = 3;
this.idNrLabel.Text = "ID Number (1..3)";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(186, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(19, 13);
this.label1.TabIndex = 10;
this.label1.Text = "kg";
//
// resolutionTextBox
//
this.resolutionTextBox.Enabled = false;
this.resolutionTextBox.Location = new System.Drawing.Point(137, 89);
this.resolutionTextBox.Name = "resolutionTextBox";
this.resolutionTextBox.Size = new System.Drawing.Size(43, 20);
this.resolutionTextBox.TabIndex = 9;
//
// resolutionLabel
//
this.resolutionLabel.AutoSize = true;
this.resolutionLabel.Location = new System.Drawing.Point(26, 92);
this.resolutionLabel.Name = "resolutionLabel";
this.resolutionLabel.Size = new System.Drawing.Size(57, 13);
this.resolutionLabel.TabIndex = 8;
this.resolutionLabel.Text = "Resolution";
//
// BalanceCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.resolutionTextBox);
this.Controls.Add(this.resolutionLabel);
this.Controls.Add(this.idNrTextBox);
this.Controls.Add(this.idNrLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.emptyTimeTextBox);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.emptyTextBox);
this.Controls.Add(this.emptyLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.capacityTextBox);
this.Controls.Add(this.capacityLabel);
this.Controls.Add(this.handshakeComboBox);
this.Controls.Add(this.stopBitsComboBox);
this.Controls.Add(this.parityComboBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.handshakeLabel);
this.Controls.Add(this.stopBitsLabel);
this.Controls.Add(this.dataBitsTextBox);
this.Controls.Add(this.dataBitsLabel);
this.Controls.Add(this.parityLabel);
this.Controls.Add(this.baudRateTextBox);
this.Controls.Add(this.baudRateLabel);
this.Controls.Add(this.comPortNrTextBox);
this.Controls.Add(this.comPortNrLabel);
this.Name = "BalanceCfgCtrl";
this.Size = new System.Drawing.Size(300, 250);
this.Load += new System.EventHandler(this.BalanceCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.handshakeComboBox = new System.Windows.Forms.ComboBox();
this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
this.parityComboBox = new System.Windows.Forms.ComboBox();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.handshakeLabel = new System.Windows.Forms.Label();
this.stopBitsLabel = new System.Windows.Forms.Label();
this.dataBitsTextBox = new System.Windows.Forms.TextBox();
this.dataBitsLabel = new System.Windows.Forms.Label();
this.parityLabel = new System.Windows.Forms.Label();
this.baudRateTextBox = new System.Windows.Forms.TextBox();
this.baudRateLabel = new System.Windows.Forms.Label();
this.comPortNrTextBox = new System.Windows.Forms.TextBox();
this.comPortNrLabel = new System.Windows.Forms.Label();
this.capacityLabel = new System.Windows.Forms.Label();
this.capacityTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.emptyTextBox = new System.Windows.Forms.TextBox();
this.emptyLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.emptyTimeTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label();
this.idNrTextBox = new System.Windows.Forms.TextBox();
this.idNrLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.resolutionTextBox = new System.Windows.Forms.TextBox();
this.resolutionLabel = new System.Windows.Forms.Label();
this.drainValveComboBox = new System.Windows.Forms.ComboBox();
this.drainingValveLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// handshakeComboBox
//
this.handshakeComboBox.Enabled = false;
this.handshakeComboBox.FormattingEnabled = true;
this.handshakeComboBox.Location = new System.Drawing.Point(236, 256);
this.handshakeComboBox.Name = "handshakeComboBox";
this.handshakeComboBox.Size = new System.Drawing.Size(43, 21);
this.handshakeComboBox.TabIndex = 32;
//
// stopBitsComboBox
//
this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 235);
this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21);
this.stopBitsComboBox.TabIndex = 30;
//
// parityComboBox
//
this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(100, 256);
this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(43, 21);
this.parityComboBox.TabIndex = 26;
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(150, 26);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(143, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(26, 29);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(147, 7);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentName";
//
// handshakeLabel
//
this.handshakeLabel.AutoSize = true;
this.handshakeLabel.Location = new System.Drawing.Point(162, 259);
this.handshakeLabel.Name = "handshakeLabel";
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
this.handshakeLabel.TabIndex = 31;
this.handshakeLabel.Text = "Handshake";
//
// stopBitsLabel
//
this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(162, 238);
this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 29;
this.stopBitsLabel.Text = "Stop Bits";
//
// dataBitsTextBox
//
this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 213);
this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
this.dataBitsTextBox.TabIndex = 28;
//
// dataBitsLabel
//
this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(162, 216);
this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 27;
this.dataBitsLabel.Text = "Data Bits";
//
// parityLabel
//
this.parityLabel.AutoSize = true;
this.parityLabel.Location = new System.Drawing.Point(26, 261);
this.parityLabel.Name = "parityLabel";
this.parityLabel.Size = new System.Drawing.Size(33, 13);
this.parityLabel.TabIndex = 25;
this.parityLabel.Text = "Parity";
//
// baudRateTextBox
//
this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(100, 235);
this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(43, 20);
this.baudRateTextBox.TabIndex = 24;
//
// baudRateLabel
//
this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(26, 238);
this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
this.baudRateLabel.TabIndex = 23;
this.baudRateLabel.Text = "Baud Rate";
//
// comPortNrTextBox
//
this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 213);
this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
this.comPortNrTextBox.TabIndex = 22;
//
// comPortNrLabel
//
this.comPortNrLabel.AutoSize = true;
this.comPortNrLabel.Location = new System.Drawing.Point(26, 216);
this.comPortNrLabel.Name = "comPortNrLabel";
this.comPortNrLabel.Size = new System.Drawing.Size(68, 13);
this.comPortNrLabel.TabIndex = 21;
this.comPortNrLabel.Text = "Serial Port #:";
//
// capacityLabel
//
this.capacityLabel.AutoSize = true;
this.capacityLabel.Location = new System.Drawing.Point(25, 71);
this.capacityLabel.Name = "capacityLabel";
this.capacityLabel.Size = new System.Drawing.Size(76, 13);
this.capacityLabel.TabIndex = 5;
this.capacityLabel.Text = "Tank Capacity";
//
// capacityTextBox
//
this.capacityTextBox.Enabled = false;
this.capacityTextBox.Location = new System.Drawing.Point(151, 68);
this.capacityTextBox.Name = "capacityTextBox";
this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
this.capacityTextBox.TabIndex = 6;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(200, 71);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 13);
this.label2.TabIndex = 7;
this.label2.Text = "kg";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(200, 113);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(19, 13);
this.label3.TabIndex = 13;
this.label3.Text = "kg";
//
// emptyTextBox
//
this.emptyTextBox.Enabled = false;
this.emptyTextBox.Location = new System.Drawing.Point(151, 110);
this.emptyTextBox.Name = "emptyTextBox";
this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTextBox.TabIndex = 12;
//
// emptyLabel
//
this.emptyLabel.AutoSize = true;
this.emptyLabel.Location = new System.Drawing.Point(25, 113);
this.emptyLabel.Name = "emptyLabel";
this.emptyLabel.Size = new System.Drawing.Size(109, 13);
this.emptyLabel.TabIndex = 11;
this.emptyLabel.Text = "Tank empty threshold";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(200, 155);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(24, 13);
this.label4.TabIndex = 18;
this.label4.Text = "sec";
//
// emptyTimeTextBox
//
this.emptyTimeTextBox.Enabled = false;
this.emptyTimeTextBox.Location = new System.Drawing.Point(151, 152);
this.emptyTimeTextBox.Name = "emptyTimeTextBox";
this.emptyTimeTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTimeTextBox.TabIndex = 17;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 155);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(58, 13);
this.label5.TabIndex = 16;
this.label5.Text = "Drain Time";
//
// formatTextBox
//
this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(151, 131);
this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(43, 20);
this.formatTextBox.TabIndex = 15;
//
// formatLabel
//
this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 134);
this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(76, 13);
this.formatLabel.TabIndex = 14;
this.formatLabel.Text = "Decimal points";
//
// idNrTextBox
//
this.idNrTextBox.Enabled = false;
this.idNrTextBox.Location = new System.Drawing.Point(151, 47);
this.idNrTextBox.Name = "idNrTextBox";
this.idNrTextBox.Size = new System.Drawing.Size(43, 20);
this.idNrTextBox.TabIndex = 4;
this.idNrTextBox.TextChanged += new System.EventHandler(this.idNrTextBox_TextChanged);
//
// idNrLabel
//
this.idNrLabel.AutoSize = true;
this.idNrLabel.Location = new System.Drawing.Point(25, 50);
this.idNrLabel.Name = "idNrLabel";
this.idNrLabel.Size = new System.Drawing.Size(85, 13);
this.idNrLabel.TabIndex = 3;
this.idNrLabel.Text = "ID Number (1..3)";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(200, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(19, 13);
this.label1.TabIndex = 10;
this.label1.Text = "kg";
//
// resolutionTextBox
//
this.resolutionTextBox.Enabled = false;
this.resolutionTextBox.Location = new System.Drawing.Point(151, 89);
this.resolutionTextBox.Name = "resolutionTextBox";
this.resolutionTextBox.Size = new System.Drawing.Size(43, 20);
this.resolutionTextBox.TabIndex = 9;
//
// resolutionLabel
//
this.resolutionLabel.AutoSize = true;
this.resolutionLabel.Location = new System.Drawing.Point(25, 92);
this.resolutionLabel.Name = "resolutionLabel";
this.resolutionLabel.Size = new System.Drawing.Size(57, 13);
this.resolutionLabel.TabIndex = 8;
this.resolutionLabel.Text = "Resolution";
//
// drainValveComboBox
//
this.drainValveComboBox.Enabled = false;
this.drainValveComboBox.FormattingEnabled = true;
this.drainValveComboBox.Location = new System.Drawing.Point(150, 173);
this.drainValveComboBox.Name = "drainValveComboBox";
this.drainValveComboBox.Size = new System.Drawing.Size(143, 21);
this.drainValveComboBox.TabIndex = 20;
//
// drainingValveLabel
//
this.drainingValveLabel.AutoSize = true;
this.drainingValveLabel.Location = new System.Drawing.Point(25, 176);
this.drainingValveLabel.Name = "drainingValveLabel";
this.drainingValveLabel.Size = new System.Drawing.Size(61, 13);
this.drainingValveLabel.TabIndex = 19;
this.drainingValveLabel.Text = "Drain valve";
//
// BalanceCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.drainValveComboBox);
this.Controls.Add(this.drainingValveLabel);
this.Controls.Add(this.label1);
this.Controls.Add(this.resolutionTextBox);
this.Controls.Add(this.resolutionLabel);
this.Controls.Add(this.idNrTextBox);
this.Controls.Add(this.idNrLabel);
this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel);
this.Controls.Add(this.label4);
this.Controls.Add(this.emptyTimeTextBox);
this.Controls.Add(this.label5);
this.Controls.Add(this.label3);
this.Controls.Add(this.emptyTextBox);
this.Controls.Add(this.emptyLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.capacityTextBox);
this.Controls.Add(this.capacityLabel);
this.Controls.Add(this.handshakeComboBox);
this.Controls.Add(this.stopBitsComboBox);
this.Controls.Add(this.parityComboBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.handshakeLabel);
this.Controls.Add(this.stopBitsLabel);
this.Controls.Add(this.dataBitsTextBox);
this.Controls.Add(this.dataBitsLabel);
this.Controls.Add(this.parityLabel);
this.Controls.Add(this.baudRateTextBox);
this.Controls.Add(this.baudRateLabel);
this.Controls.Add(this.comPortNrTextBox);
this.Controls.Add(this.comPortNrLabel);
this.Name = "BalanceCfgCtrl";
this.Size = new System.Drawing.Size(450, 300);
this.Load += new System.EventHandler(this.BalanceCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -410,5 +432,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox resolutionTextBox;
private System.Windows.Forms.Label resolutionLabel;
private System.Windows.Forms.ComboBox drainValveComboBox;
private System.Windows.Forms.Label drainingValveLabel;
}
}

View File

@ -15,6 +15,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
{
static readonly ILog log = LogManager.GetLogger(typeof(BalanceCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
BalanceCfg config;
@ -95,7 +97,22 @@ namespace TBF.BenchControl.MettlerToledo.Multi
private void BalanceCfgCtrl_Load(object sender, EventArgs e)
{
Redraw();
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.TbfComponents != null)
{
drainValveComboBox.Items.Add("---");
foreach (var cmpnt in parent.TbfComponents)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Elde.Valve.ValveFactory)
{
drainValveComboBox.Items.Add(cmpnt.Name);
}
}
}
Redraw();
}
public void Closing()
@ -113,7 +130,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
resolutionTextBox.Text = config.Resolution.ToString();
emptyTextBox.Text = config.Empty.ToString();
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format;
emptyTimeTextBox.Text = config.EmptyTimeSec.ToString();
emptyTimeTextBox.Text = config.DrainTimeSec.ToString();
drainValveComboBox.Text = string.IsNullOrEmpty(config.DrainValve) ? "---" : config.DrainValve;
comPortNrTextBox.Text = config.ComPortNr.ToString();
baudRateTextBox.Text = config.BaudRate.ToString();
@ -133,6 +151,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
emptyTextBox.Enabled = true;
formatTextBox.Enabled = true;
emptyTimeTextBox.Enabled = true;
drainValveComboBox.Enabled = true;
comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true;
@ -181,6 +200,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Time' should be between 1 and 999 sec";
}
if (!drainValveComboBox.Items.Contains(drainValveComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Drain valve'";
}
if (idNr == 1)
{
@ -217,7 +241,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
config.Resolution = Utils.ParseUFloat(resolutionTextBox.Text);
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.Format = "F" + formatTextBox.Text;
config.EmptyTimeSec = int.Parse(emptyTimeTextBox.Text);
config.DrainTimeSec = int.Parse(emptyTimeTextBox.Text);
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
if (config.IdNr == 1)
{

View File

@ -52,7 +52,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public int IdNr { get { return balanceCfg.IdNr; } }
public double Capacity { get { return balanceCfg.Capacity; } }
public double Resolution { get { return balanceCfg.Resolution; } }
public int EmptyTimeSec { get { return balanceCfg.EmptyTimeSec; } }
public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
/// Buoyancy
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
@ -104,7 +104,9 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public void Initialize()
{
msrmntState = MsrmntState.Failed; /// Data not valid yet
base.Initalize();
msrmntState = MsrmntState.Failed; /// Data not valid yet
if (balanceCfg.DebugLevel == DebugMode.Simulate) return;

View File

@ -29,33 +29,17 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Max. water mass in 'kg' or volume in 'l'
private float capacity;
public float Capacity
{
get { return capacity; }
set { capacity = value; }
}
public float Capacity { get { return capacity; } set { capacity = value; } }
/// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l')
private float empty;
public float Empty
{
get { return empty; }
set { empty = value; }
}
public float Empty { get { return empty; } set { empty = value; } }
private string drainValve;
public string DrainValve
{
get { return drainValve; }
set { drainValve = value; }
}
public string DrainValve { get { return drainValve; } set { drainValve = value; } }
private int drainTimeSec;
public int DrainTimeSec
{
get { return drainTimeSec; }
set { drainTimeSec = value; }
}
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
public string Format;

View File

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

View File

@ -256,7 +256,7 @@ namespace TBF.UiControls
entity.StartValve = lvi.SubItems[(int)Column.StartValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.StartValve].Text;
entity.Diverter = lvi.SubItems[(int)Column.Div].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Div].Text;
entity.TempDiv = lvi.SubItems[(int)Column.Tdiv].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Tdiv].Text;
entity.Scale = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
entity.Scale = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
string valvesOpen = string.Empty;
string valvesClose = string.Empty;