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 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]; public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
protected override XmlSerializer GetSerializer() { return Serializer; } protected override XmlSerializer GetSerializer() { return Serializer; }
@ -21,11 +21,22 @@ namespace TBF.BenchControl.MettlerToledo.Multi
/// Serialized parameters /// Serialized parameters
/// ///
public int IdNr; /// Identification number 1..3 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 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 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 ComPortNr;
public int BaudRate; public int BaudRate;
@ -93,7 +104,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
Resolution = 0.001f; Resolution = 0.001f;
Empty = 20.0f; Empty = 20.0f;
Format = "F3"; Format = "F3";
EmptyTimeSec = 180; DrainTimeSec = 180;
ComPortNr = 3; ComPortNr = 3;
BaudRate = 2400; BaudRate = 2400;
@ -118,12 +129,12 @@ namespace TBF.BenchControl.MettlerToledo.Multi
if (IdNr == 1) 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}", 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 else
{ {
return string.Format("Name={0}, Id#={1}, {2}kg, empty={3}kg, fmt.={4}, emptyTm={5}s", 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> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.handshakeComboBox = new System.Windows.Forms.ComboBox(); this.handshakeComboBox = new System.Windows.Forms.ComboBox();
this.stopBitsComboBox = new System.Windows.Forms.ComboBox(); this.stopBitsComboBox = new System.Windows.Forms.ComboBox();
this.parityComboBox = new System.Windows.Forms.ComboBox(); this.parityComboBox = new System.Windows.Forms.ComboBox();
this.nameTextBox = new System.Windows.Forms.TextBox(); this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label(); this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label(); this.classNameLabel = new System.Windows.Forms.Label();
this.handshakeLabel = new System.Windows.Forms.Label(); this.handshakeLabel = new System.Windows.Forms.Label();
this.stopBitsLabel = new System.Windows.Forms.Label(); this.stopBitsLabel = new System.Windows.Forms.Label();
this.dataBitsTextBox = new System.Windows.Forms.TextBox(); this.dataBitsTextBox = new System.Windows.Forms.TextBox();
this.dataBitsLabel = new System.Windows.Forms.Label(); this.dataBitsLabel = new System.Windows.Forms.Label();
this.parityLabel = new System.Windows.Forms.Label(); this.parityLabel = new System.Windows.Forms.Label();
this.baudRateTextBox = new System.Windows.Forms.TextBox(); this.baudRateTextBox = new System.Windows.Forms.TextBox();
this.baudRateLabel = new System.Windows.Forms.Label(); this.baudRateLabel = new System.Windows.Forms.Label();
this.comPortNrTextBox = new System.Windows.Forms.TextBox(); this.comPortNrTextBox = new System.Windows.Forms.TextBox();
this.comPortNrLabel = new System.Windows.Forms.Label(); this.comPortNrLabel = new System.Windows.Forms.Label();
this.capacityLabel = new System.Windows.Forms.Label(); this.capacityLabel = new System.Windows.Forms.Label();
this.capacityTextBox = new System.Windows.Forms.TextBox(); this.capacityTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.emptyTextBox = new System.Windows.Forms.TextBox(); this.emptyTextBox = new System.Windows.Forms.TextBox();
this.emptyLabel = new System.Windows.Forms.Label(); this.emptyLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.emptyTimeTextBox = new System.Windows.Forms.TextBox(); this.emptyTimeTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.formatTextBox = new System.Windows.Forms.TextBox(); this.formatTextBox = new System.Windows.Forms.TextBox();
this.formatLabel = new System.Windows.Forms.Label(); this.formatLabel = new System.Windows.Forms.Label();
this.idNrTextBox = new System.Windows.Forms.TextBox(); this.idNrTextBox = new System.Windows.Forms.TextBox();
this.idNrLabel = new System.Windows.Forms.Label(); this.idNrLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.resolutionTextBox = new System.Windows.Forms.TextBox(); this.resolutionTextBox = new System.Windows.Forms.TextBox();
this.resolutionLabel = new System.Windows.Forms.Label(); this.resolutionLabel = new System.Windows.Forms.Label();
this.SuspendLayout(); this.drainValveComboBox = new System.Windows.Forms.ComboBox();
// this.drainingValveLabel = new System.Windows.Forms.Label();
// handshakeComboBox this.SuspendLayout();
// //
this.handshakeComboBox.Enabled = false; // handshakeComboBox
this.handshakeComboBox.FormattingEnabled = true; //
this.handshakeComboBox.Location = new System.Drawing.Point(236, 224); this.handshakeComboBox.Enabled = false;
this.handshakeComboBox.Name = "handshakeComboBox"; this.handshakeComboBox.FormattingEnabled = true;
this.handshakeComboBox.Size = new System.Drawing.Size(43, 21); this.handshakeComboBox.Location = new System.Drawing.Point(236, 256);
this.handshakeComboBox.TabIndex = 30; this.handshakeComboBox.Name = "handshakeComboBox";
// this.handshakeComboBox.Size = new System.Drawing.Size(43, 21);
// stopBitsComboBox this.handshakeComboBox.TabIndex = 32;
// //
this.stopBitsComboBox.Enabled = false; // stopBitsComboBox
this.stopBitsComboBox.FormattingEnabled = true; //
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 203); this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.Name = "stopBitsComboBox"; this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21); this.stopBitsComboBox.Location = new System.Drawing.Point(236, 235);
this.stopBitsComboBox.TabIndex = 28; this.stopBitsComboBox.Name = "stopBitsComboBox";
// this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21);
// parityComboBox this.stopBitsComboBox.TabIndex = 30;
// //
this.parityComboBox.Enabled = false; // parityComboBox
this.parityComboBox.FormattingEnabled = true; //
this.parityComboBox.Location = new System.Drawing.Point(100, 224); this.parityComboBox.Enabled = false;
this.parityComboBox.Name = "parityComboBox"; this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Size = new System.Drawing.Size(43, 21); this.parityComboBox.Location = new System.Drawing.Point(100, 256);
this.parityComboBox.TabIndex = 24; this.parityComboBox.Name = "parityComboBox";
// this.parityComboBox.Size = new System.Drawing.Size(43, 21);
// nameTextBox this.parityComboBox.TabIndex = 26;
// //
this.nameTextBox.Enabled = false; // nameTextBox
this.nameTextBox.Location = new System.Drawing.Point(136, 26); //
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Enabled = false;
this.nameTextBox.Size = new System.Drawing.Size(143, 20); this.nameTextBox.Location = new System.Drawing.Point(150, 26);
this.nameTextBox.TabIndex = 2; this.nameTextBox.Name = "nameTextBox";
// this.nameTextBox.Size = new System.Drawing.Size(143, 20);
// nameLabel this.nameTextBox.TabIndex = 2;
// //
this.nameLabel.AutoSize = true; // nameLabel
this.nameLabel.Location = new System.Drawing.Point(26, 29); //
this.nameLabel.Name = "nameLabel"; this.nameLabel.AutoSize = true;
this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.Location = new System.Drawing.Point(26, 29);
this.nameLabel.TabIndex = 1; this.nameLabel.Name = "nameLabel";
this.nameLabel.Text = "Name"; this.nameLabel.Size = new System.Drawing.Size(35, 13);
// this.nameLabel.TabIndex = 1;
// classNameLabel this.nameLabel.Text = "Name";
// //
this.classNameLabel.AutoSize = true; // classNameLabel
this.classNameLabel.Location = new System.Drawing.Point(133, 7); //
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.AutoSize = true;
this.classNameLabel.Size = new System.Drawing.Size(89, 13); this.classNameLabel.Location = new System.Drawing.Point(147, 7);
this.classNameLabel.TabIndex = 0; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Text = "ComponentName"; this.classNameLabel.Size = new System.Drawing.Size(89, 13);
// this.classNameLabel.TabIndex = 0;
// handshakeLabel this.classNameLabel.Text = "ComponentName";
// //
this.handshakeLabel.AutoSize = true; // handshakeLabel
this.handshakeLabel.Location = new System.Drawing.Point(162, 227); //
this.handshakeLabel.Name = "handshakeLabel"; this.handshakeLabel.AutoSize = true;
this.handshakeLabel.Size = new System.Drawing.Size(62, 13); this.handshakeLabel.Location = new System.Drawing.Point(162, 259);
this.handshakeLabel.TabIndex = 29; this.handshakeLabel.Name = "handshakeLabel";
this.handshakeLabel.Text = "Handshake"; this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
// this.handshakeLabel.TabIndex = 31;
// stopBitsLabel this.handshakeLabel.Text = "Handshake";
// //
this.stopBitsLabel.AutoSize = true; // stopBitsLabel
this.stopBitsLabel.Location = new System.Drawing.Point(162, 206); //
this.stopBitsLabel.Name = "stopBitsLabel"; this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13); this.stopBitsLabel.Location = new System.Drawing.Point(162, 238);
this.stopBitsLabel.TabIndex = 27; this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Text = "Stop Bits"; this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
// this.stopBitsLabel.TabIndex = 29;
// dataBitsTextBox this.stopBitsLabel.Text = "Stop Bits";
// //
this.dataBitsTextBox.Enabled = false; // dataBitsTextBox
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 181); //
this.dataBitsTextBox.Name = "dataBitsTextBox"; this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20); this.dataBitsTextBox.Location = new System.Drawing.Point(236, 213);
this.dataBitsTextBox.TabIndex = 26; this.dataBitsTextBox.Name = "dataBitsTextBox";
// this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
// dataBitsLabel this.dataBitsTextBox.TabIndex = 28;
// //
this.dataBitsLabel.AutoSize = true; // dataBitsLabel
this.dataBitsLabel.Location = new System.Drawing.Point(162, 184); //
this.dataBitsLabel.Name = "dataBitsLabel"; this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13); this.dataBitsLabel.Location = new System.Drawing.Point(162, 216);
this.dataBitsLabel.TabIndex = 25; this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Text = "Data Bits"; this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
// this.dataBitsLabel.TabIndex = 27;
// parityLabel this.dataBitsLabel.Text = "Data Bits";
// //
this.parityLabel.AutoSize = true; // parityLabel
this.parityLabel.Location = new System.Drawing.Point(26, 229); //
this.parityLabel.Name = "parityLabel"; this.parityLabel.AutoSize = true;
this.parityLabel.Size = new System.Drawing.Size(33, 13); this.parityLabel.Location = new System.Drawing.Point(26, 261);
this.parityLabel.TabIndex = 23; this.parityLabel.Name = "parityLabel";
this.parityLabel.Text = "Parity"; this.parityLabel.Size = new System.Drawing.Size(33, 13);
// this.parityLabel.TabIndex = 25;
// baudRateTextBox this.parityLabel.Text = "Parity";
// //
this.baudRateTextBox.Enabled = false; // baudRateTextBox
this.baudRateTextBox.Location = new System.Drawing.Point(100, 203); //
this.baudRateTextBox.Name = "baudRateTextBox"; this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Size = new System.Drawing.Size(43, 20); this.baudRateTextBox.Location = new System.Drawing.Point(100, 235);
this.baudRateTextBox.TabIndex = 22; this.baudRateTextBox.Name = "baudRateTextBox";
// this.baudRateTextBox.Size = new System.Drawing.Size(43, 20);
// baudRateLabel this.baudRateTextBox.TabIndex = 24;
// //
this.baudRateLabel.AutoSize = true; // baudRateLabel
this.baudRateLabel.Location = new System.Drawing.Point(26, 206); //
this.baudRateLabel.Name = "baudRateLabel"; this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Size = new System.Drawing.Size(58, 13); this.baudRateLabel.Location = new System.Drawing.Point(26, 238);
this.baudRateLabel.TabIndex = 21; this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Text = "Baud Rate"; this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
// this.baudRateLabel.TabIndex = 23;
// comPortNrTextBox this.baudRateLabel.Text = "Baud Rate";
// //
this.comPortNrTextBox.Enabled = false; // comPortNrTextBox
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 181); //
this.comPortNrTextBox.Name = "comPortNrTextBox"; this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20); this.comPortNrTextBox.Location = new System.Drawing.Point(100, 213);
this.comPortNrTextBox.TabIndex = 20; this.comPortNrTextBox.Name = "comPortNrTextBox";
// this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
// comPortNrLabel this.comPortNrTextBox.TabIndex = 22;
// //
this.comPortNrLabel.AutoSize = true; // comPortNrLabel
this.comPortNrLabel.Location = new System.Drawing.Point(26, 184); //
this.comPortNrLabel.Name = "comPortNrLabel"; this.comPortNrLabel.AutoSize = true;
this.comPortNrLabel.Size = new System.Drawing.Size(68, 13); this.comPortNrLabel.Location = new System.Drawing.Point(26, 216);
this.comPortNrLabel.TabIndex = 19; this.comPortNrLabel.Name = "comPortNrLabel";
this.comPortNrLabel.Text = "Serial Port #:"; this.comPortNrLabel.Size = new System.Drawing.Size(68, 13);
// this.comPortNrLabel.TabIndex = 21;
// capacityLabel this.comPortNrLabel.Text = "Serial Port #:";
// //
this.capacityLabel.AutoSize = true; // capacityLabel
this.capacityLabel.Location = new System.Drawing.Point(26, 71); //
this.capacityLabel.Name = "capacityLabel"; this.capacityLabel.AutoSize = true;
this.capacityLabel.Size = new System.Drawing.Size(76, 13); this.capacityLabel.Location = new System.Drawing.Point(25, 71);
this.capacityLabel.TabIndex = 5; this.capacityLabel.Name = "capacityLabel";
this.capacityLabel.Text = "Tank Capacity"; this.capacityLabel.Size = new System.Drawing.Size(76, 13);
// this.capacityLabel.TabIndex = 5;
// capacityTextBox this.capacityLabel.Text = "Tank Capacity";
// //
this.capacityTextBox.Enabled = false; // capacityTextBox
this.capacityTextBox.Location = new System.Drawing.Point(137, 68); //
this.capacityTextBox.Name = "capacityTextBox"; this.capacityTextBox.Enabled = false;
this.capacityTextBox.Size = new System.Drawing.Size(43, 20); this.capacityTextBox.Location = new System.Drawing.Point(151, 68);
this.capacityTextBox.TabIndex = 6; this.capacityTextBox.Name = "capacityTextBox";
// this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
// label2 this.capacityTextBox.TabIndex = 6;
// //
this.label2.AutoSize = true; // label2
this.label2.Location = new System.Drawing.Point(186, 71); //
this.label2.Name = "label2"; this.label2.AutoSize = true;
this.label2.Size = new System.Drawing.Size(19, 13); this.label2.Location = new System.Drawing.Point(200, 71);
this.label2.TabIndex = 7; this.label2.Name = "label2";
this.label2.Text = "kg"; this.label2.Size = new System.Drawing.Size(19, 13);
// this.label2.TabIndex = 7;
// label3 this.label2.Text = "kg";
// //
this.label3.AutoSize = true; // label3
this.label3.Location = new System.Drawing.Point(186, 113); //
this.label3.Name = "label3"; this.label3.AutoSize = true;
this.label3.Size = new System.Drawing.Size(19, 13); this.label3.Location = new System.Drawing.Point(200, 113);
this.label3.TabIndex = 13; this.label3.Name = "label3";
this.label3.Text = "kg"; this.label3.Size = new System.Drawing.Size(19, 13);
// this.label3.TabIndex = 13;
// emptyTextBox this.label3.Text = "kg";
// //
this.emptyTextBox.Enabled = false; // emptyTextBox
this.emptyTextBox.Location = new System.Drawing.Point(137, 110); //
this.emptyTextBox.Name = "emptyTextBox"; this.emptyTextBox.Enabled = false;
this.emptyTextBox.Size = new System.Drawing.Size(43, 20); this.emptyTextBox.Location = new System.Drawing.Point(151, 110);
this.emptyTextBox.TabIndex = 12; this.emptyTextBox.Name = "emptyTextBox";
// this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
// emptyLabel this.emptyTextBox.TabIndex = 12;
// //
this.emptyLabel.AutoSize = true; // emptyLabel
this.emptyLabel.Location = new System.Drawing.Point(26, 113); //
this.emptyLabel.Name = "emptyLabel"; this.emptyLabel.AutoSize = true;
this.emptyLabel.Size = new System.Drawing.Size(64, 13); this.emptyLabel.Location = new System.Drawing.Point(25, 113);
this.emptyLabel.TabIndex = 11; this.emptyLabel.Name = "emptyLabel";
this.emptyLabel.Text = "Tank Empty"; this.emptyLabel.Size = new System.Drawing.Size(109, 13);
// this.emptyLabel.TabIndex = 11;
// label4 this.emptyLabel.Text = "Tank empty threshold";
// //
this.label4.AutoSize = true; // label4
this.label4.Location = new System.Drawing.Point(186, 155); //
this.label4.Name = "label4"; this.label4.AutoSize = true;
this.label4.Size = new System.Drawing.Size(24, 13); this.label4.Location = new System.Drawing.Point(200, 155);
this.label4.TabIndex = 18; this.label4.Name = "label4";
this.label4.Text = "sec"; this.label4.Size = new System.Drawing.Size(24, 13);
// this.label4.TabIndex = 18;
// emptyTimeTextBox this.label4.Text = "sec";
// //
this.emptyTimeTextBox.Enabled = false; // emptyTimeTextBox
this.emptyTimeTextBox.Location = new System.Drawing.Point(137, 152); //
this.emptyTimeTextBox.Name = "emptyTimeTextBox"; this.emptyTimeTextBox.Enabled = false;
this.emptyTimeTextBox.Size = new System.Drawing.Size(43, 20); this.emptyTimeTextBox.Location = new System.Drawing.Point(151, 152);
this.emptyTimeTextBox.TabIndex = 17; this.emptyTimeTextBox.Name = "emptyTimeTextBox";
// this.emptyTimeTextBox.Size = new System.Drawing.Size(43, 20);
// label5 this.emptyTimeTextBox.TabIndex = 17;
// //
this.label5.AutoSize = true; // label5
this.label5.Location = new System.Drawing.Point(26, 155); //
this.label5.Name = "label5"; this.label5.AutoSize = true;
this.label5.Size = new System.Drawing.Size(90, 13); this.label5.Location = new System.Drawing.Point(26, 155);
this.label5.TabIndex = 16; this.label5.Name = "label5";
this.label5.Text = "Tank Empty Time"; this.label5.Size = new System.Drawing.Size(58, 13);
// this.label5.TabIndex = 16;
// formatTextBox this.label5.Text = "Drain Time";
// //
this.formatTextBox.Enabled = false; // formatTextBox
this.formatTextBox.Location = new System.Drawing.Point(137, 131); //
this.formatTextBox.Name = "formatTextBox"; this.formatTextBox.Enabled = false;
this.formatTextBox.Size = new System.Drawing.Size(43, 20); this.formatTextBox.Location = new System.Drawing.Point(151, 131);
this.formatTextBox.TabIndex = 15; this.formatTextBox.Name = "formatTextBox";
// this.formatTextBox.Size = new System.Drawing.Size(43, 20);
// formatLabel this.formatTextBox.TabIndex = 15;
// //
this.formatLabel.AutoSize = true; // formatLabel
this.formatLabel.Location = new System.Drawing.Point(26, 134); //
this.formatLabel.Name = "formatLabel"; this.formatLabel.AutoSize = true;
this.formatLabel.Size = new System.Drawing.Size(76, 13); this.formatLabel.Location = new System.Drawing.Point(26, 134);
this.formatLabel.TabIndex = 14; this.formatLabel.Name = "formatLabel";
this.formatLabel.Text = "Decimal points"; this.formatLabel.Size = new System.Drawing.Size(76, 13);
// this.formatLabel.TabIndex = 14;
// idNrTextBox this.formatLabel.Text = "Decimal points";
// //
this.idNrTextBox.Enabled = false; // idNrTextBox
this.idNrTextBox.Location = new System.Drawing.Point(137, 47); //
this.idNrTextBox.Name = "idNrTextBox"; this.idNrTextBox.Enabled = false;
this.idNrTextBox.Size = new System.Drawing.Size(43, 20); this.idNrTextBox.Location = new System.Drawing.Point(151, 47);
this.idNrTextBox.TabIndex = 4; this.idNrTextBox.Name = "idNrTextBox";
this.idNrTextBox.TextChanged += new System.EventHandler(this.idNrTextBox_TextChanged); this.idNrTextBox.Size = new System.Drawing.Size(43, 20);
// this.idNrTextBox.TabIndex = 4;
// idNrLabel this.idNrTextBox.TextChanged += new System.EventHandler(this.idNrTextBox_TextChanged);
// //
this.idNrLabel.AutoSize = true; // idNrLabel
this.idNrLabel.Location = new System.Drawing.Point(26, 50); //
this.idNrLabel.Name = "idNrLabel"; this.idNrLabel.AutoSize = true;
this.idNrLabel.Size = new System.Drawing.Size(85, 13); this.idNrLabel.Location = new System.Drawing.Point(25, 50);
this.idNrLabel.TabIndex = 3; this.idNrLabel.Name = "idNrLabel";
this.idNrLabel.Text = "ID Number (1..3)"; this.idNrLabel.Size = new System.Drawing.Size(85, 13);
// this.idNrLabel.TabIndex = 3;
// label1 this.idNrLabel.Text = "ID Number (1..3)";
// //
this.label1.AutoSize = true; // label1
this.label1.Location = new System.Drawing.Point(186, 92); //
this.label1.Name = "label1"; this.label1.AutoSize = true;
this.label1.Size = new System.Drawing.Size(19, 13); this.label1.Location = new System.Drawing.Point(200, 92);
this.label1.TabIndex = 10; this.label1.Name = "label1";
this.label1.Text = "kg"; this.label1.Size = new System.Drawing.Size(19, 13);
// this.label1.TabIndex = 10;
// resolutionTextBox this.label1.Text = "kg";
// //
this.resolutionTextBox.Enabled = false; // resolutionTextBox
this.resolutionTextBox.Location = new System.Drawing.Point(137, 89); //
this.resolutionTextBox.Name = "resolutionTextBox"; this.resolutionTextBox.Enabled = false;
this.resolutionTextBox.Size = new System.Drawing.Size(43, 20); this.resolutionTextBox.Location = new System.Drawing.Point(151, 89);
this.resolutionTextBox.TabIndex = 9; this.resolutionTextBox.Name = "resolutionTextBox";
// this.resolutionTextBox.Size = new System.Drawing.Size(43, 20);
// resolutionLabel this.resolutionTextBox.TabIndex = 9;
// //
this.resolutionLabel.AutoSize = true; // resolutionLabel
this.resolutionLabel.Location = new System.Drawing.Point(26, 92); //
this.resolutionLabel.Name = "resolutionLabel"; this.resolutionLabel.AutoSize = true;
this.resolutionLabel.Size = new System.Drawing.Size(57, 13); this.resolutionLabel.Location = new System.Drawing.Point(25, 92);
this.resolutionLabel.TabIndex = 8; this.resolutionLabel.Name = "resolutionLabel";
this.resolutionLabel.Text = "Resolution"; this.resolutionLabel.Size = new System.Drawing.Size(57, 13);
// this.resolutionLabel.TabIndex = 8;
// BalanceCfgCtrl this.resolutionLabel.Text = "Resolution";
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); // drainValveComboBox
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; //
this.Controls.Add(this.label1); this.drainValveComboBox.Enabled = false;
this.Controls.Add(this.resolutionTextBox); this.drainValveComboBox.FormattingEnabled = true;
this.Controls.Add(this.resolutionLabel); this.drainValveComboBox.Location = new System.Drawing.Point(150, 173);
this.Controls.Add(this.idNrTextBox); this.drainValveComboBox.Name = "drainValveComboBox";
this.Controls.Add(this.idNrLabel); this.drainValveComboBox.Size = new System.Drawing.Size(143, 21);
this.Controls.Add(this.formatTextBox); this.drainValveComboBox.TabIndex = 20;
this.Controls.Add(this.formatLabel); //
this.Controls.Add(this.label4); // drainingValveLabel
this.Controls.Add(this.emptyTimeTextBox); //
this.Controls.Add(this.label5); this.drainingValveLabel.AutoSize = true;
this.Controls.Add(this.label3); this.drainingValveLabel.Location = new System.Drawing.Point(25, 176);
this.Controls.Add(this.emptyTextBox); this.drainingValveLabel.Name = "drainingValveLabel";
this.Controls.Add(this.emptyLabel); this.drainingValveLabel.Size = new System.Drawing.Size(61, 13);
this.Controls.Add(this.label2); this.drainingValveLabel.TabIndex = 19;
this.Controls.Add(this.capacityTextBox); this.drainingValveLabel.Text = "Drain valve";
this.Controls.Add(this.capacityLabel); //
this.Controls.Add(this.handshakeComboBox); // BalanceCfgCtrl
this.Controls.Add(this.stopBitsComboBox); //
this.Controls.Add(this.parityComboBox); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.nameTextBox); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.nameLabel); this.Controls.Add(this.drainValveComboBox);
this.Controls.Add(this.classNameLabel); this.Controls.Add(this.drainingValveLabel);
this.Controls.Add(this.handshakeLabel); this.Controls.Add(this.label1);
this.Controls.Add(this.stopBitsLabel); this.Controls.Add(this.resolutionTextBox);
this.Controls.Add(this.dataBitsTextBox); this.Controls.Add(this.resolutionLabel);
this.Controls.Add(this.dataBitsLabel); this.Controls.Add(this.idNrTextBox);
this.Controls.Add(this.parityLabel); this.Controls.Add(this.idNrLabel);
this.Controls.Add(this.baudRateTextBox); this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.baudRateLabel); this.Controls.Add(this.formatLabel);
this.Controls.Add(this.comPortNrTextBox); this.Controls.Add(this.label4);
this.Controls.Add(this.comPortNrLabel); this.Controls.Add(this.emptyTimeTextBox);
this.Name = "BalanceCfgCtrl"; this.Controls.Add(this.label5);
this.Size = new System.Drawing.Size(300, 250); this.Controls.Add(this.label3);
this.Load += new System.EventHandler(this.BalanceCfgCtrl_Load); this.Controls.Add(this.emptyTextBox);
this.ResumeLayout(false); this.Controls.Add(this.emptyLabel);
this.PerformLayout(); 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.Label label1;
private System.Windows.Forms.TextBox resolutionTextBox; private System.Windows.Forms.TextBox resolutionTextBox;
private System.Windows.Forms.Label resolutionLabel; 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)); static readonly ILog log = LogManager.GetLogger(typeof(BalanceCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } } public bool ShowMore { get { return false; } }
BalanceCfg config; BalanceCfg config;
@ -95,7 +97,22 @@ namespace TBF.BenchControl.MettlerToledo.Multi
private void BalanceCfgCtrl_Load(object sender, EventArgs e) 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() public void Closing()
@ -113,7 +130,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
resolutionTextBox.Text = config.Resolution.ToString(); resolutionTextBox.Text = config.Resolution.ToString();
emptyTextBox.Text = config.Empty.ToString(); emptyTextBox.Text = config.Empty.ToString();
formatTextBox.Text = (config.Format.Length > 1) ? config.Format.Substring(1) : config.Format; 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(); comPortNrTextBox.Text = config.ComPortNr.ToString();
baudRateTextBox.Text = config.BaudRate.ToString(); baudRateTextBox.Text = config.BaudRate.ToString();
@ -133,6 +151,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
emptyTextBox.Enabled = true; emptyTextBox.Enabled = true;
formatTextBox.Enabled = true; formatTextBox.Enabled = true;
emptyTimeTextBox.Enabled = true; emptyTimeTextBox.Enabled = true;
drainValveComboBox.Enabled = true;
comPortNrTextBox.Enabled = true; comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true; baudRateTextBox.Enabled = true;
@ -181,6 +200,11 @@ namespace TBF.BenchControl.MettlerToledo.Multi
flags |= CfgUpdateFlags.Error; flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Time' should be between 1 and 999 sec"; 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) if (idNr == 1)
{ {
@ -217,7 +241,8 @@ namespace TBF.BenchControl.MettlerToledo.Multi
config.Resolution = Utils.ParseUFloat(resolutionTextBox.Text); config.Resolution = Utils.ParseUFloat(resolutionTextBox.Text);
config.Empty = Utils.ParseUFloat(emptyTextBox.Text); config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
config.Format = "F" + formatTextBox.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) if (config.IdNr == 1)
{ {

View File

@ -52,7 +52,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public int IdNr { get { return balanceCfg.IdNr; } } public int IdNr { get { return balanceCfg.IdNr; } }
public double Capacity { get { return balanceCfg.Capacity; } } public double Capacity { get { return balanceCfg.Capacity; } }
public double Resolution { get { return balanceCfg.Resolution; } } public double Resolution { get { return balanceCfg.Resolution; } }
public int EmptyTimeSec { get { return balanceCfg.EmptyTimeSec; } } public int EmptyTimeSec { get { return balanceCfg.DrainTimeSec; } }
/// Buoyancy /// Buoyancy
public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } } public float BuoyancyTemp { get { return balanceCfg.BuoyancyTemp; } }
@ -104,7 +104,9 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public void Initialize() 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; 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' /// Max. water mass in 'kg' or volume in 'l'
private float capacity; private float capacity;
public float Capacity public float Capacity { get { return capacity; } set { capacity = value; } }
{
get { return capacity; }
set { capacity = value; }
}
/// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l') /// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l')
private float empty; private float empty;
public float Empty public float Empty { get { return empty; } set { empty = value; } }
{
get { return empty; }
set { empty = value; }
}
private string drainValve; private string drainValve;
public string DrainValve public string DrainValve { get { return drainValve; } set { drainValve = value; } }
{
get { return drainValve; }
set { drainValve = value; }
}
private int drainTimeSec; private int drainTimeSec;
public int DrainTimeSec public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
{
get { return drainTimeSec; }
set { drainTimeSec = value; }
}
public string Format; public string Format;

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.793.0")] [assembly: AssemblyVersion("2.18.794.0")]
[assembly: AssemblyFileVersion("2.18.793.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.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.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.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 valvesOpen = string.Empty;
string valvesClose = string.Empty; string valvesClose = string.Empty;