Balance empty mass is configurable
This commit is contained in:
@@ -19,6 +19,11 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
float Capacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if tank s empty, mass is less then some threshold
|
||||
/// </summary>
|
||||
bool IsEmpty(float mass);
|
||||
|
||||
/// <summary>
|
||||
/// Measurement correction table
|
||||
/// </summary>
|
||||
|
||||
@@ -13,16 +13,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
public int DataBits;
|
||||
public StopBits StopBits;
|
||||
public Handshake Handshake;
|
||||
|
||||
public float Capacity; /// Balance range in 'kg' or tank volume in 'l'
|
||||
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
|
||||
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
|
||||
|
||||
/// Parameterless constructor
|
||||
public BalanceCfg()
|
||||
{
|
||||
Empty = 20.0f;
|
||||
}
|
||||
|
||||
/// Constructor
|
||||
public BalanceCfg(IComponentFactory factory, string name, int comPortNr, int baudRate, Parity parity, int dataBits, StopBits stopBits, Handshake handshake, float capacity)
|
||||
public BalanceCfg(IComponentFactory factory, string name, int comPortNr, int baudRate, Parity parity, int dataBits, StopBits stopBits, Handshake handshake, float capacity, float empty)
|
||||
: base(factory, name)
|
||||
{
|
||||
this.ComPortNr = comPortNr;
|
||||
@@ -32,11 +33,12 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
this.StopBits = stopBits;
|
||||
this.Handshake = handshake;
|
||||
this.Capacity = capacity;
|
||||
}
|
||||
this.Empty = empty;
|
||||
}
|
||||
|
||||
public IComponentCfg Clone()
|
||||
{
|
||||
return new BalanceCfg(Factory, Name, ComPortNr, BaudRate, Parity, DataBits, StopBits, Handshake, Capacity);
|
||||
return new BalanceCfg(Factory, Name, ComPortNr, BaudRate, Parity, DataBits, StopBits, Handshake, Capacity, Empty);
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
|
||||
+241
-206
@@ -28,210 +28,242 @@
|
||||
/// </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.partityLabel = 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.label1 = new System.Windows.Forms.Label();
|
||||
this.rangeLabel = new System.Windows.Forms.Label();
|
||||
this.rangeTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(136, 173);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(136, 149);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// parityComboBox
|
||||
//
|
||||
this.parityComboBox.Enabled = false;
|
||||
this.parityComboBox.FormattingEnabled = true;
|
||||
this.parityComboBox.Location = new System.Drawing.Point(136, 101);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(136, 29);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(26, 32);
|
||||
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, 8);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(25, 176);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(25, 152);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(136, 125);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(25, 128);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(25, 104);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(136, 77);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(25, 80);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(136, 53);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(25, 56);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// rangeLabel
|
||||
//
|
||||
this.rangeLabel.AutoSize = true;
|
||||
this.rangeLabel.Location = new System.Drawing.Point(25, 201);
|
||||
this.rangeLabel.Name = "rangeLabel";
|
||||
this.rangeLabel.Size = new System.Drawing.Size(76, 13);
|
||||
this.rangeLabel.TabIndex = 15;
|
||||
this.rangeLabel.Text = "Tank Capacity";
|
||||
//
|
||||
// rangeTextBox
|
||||
//
|
||||
this.rangeTextBox.Enabled = false;
|
||||
this.rangeTextBox.Location = new System.Drawing.Point(136, 198);
|
||||
this.rangeTextBox.Name = "rangeTextBox";
|
||||
this.rangeTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.rangeTextBox.TabIndex = 16;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(185, 201);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(19, 13);
|
||||
this.label2.TabIndex = 17;
|
||||
this.label2.Text = "kg";
|
||||
//
|
||||
// BalanceCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.rangeTextBox);
|
||||
this.Controls.Add(this.rangeLabel);
|
||||
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.partityLabel);
|
||||
this.Controls.Add(this.baudRateTextBox);
|
||||
this.Controls.Add(this.baudRateLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "BalanceCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 240);
|
||||
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.partityLabel = 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.label1 = 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.SuspendLayout();
|
||||
//
|
||||
// handshakeComboBox
|
||||
//
|
||||
this.handshakeComboBox.Enabled = false;
|
||||
this.handshakeComboBox.FormattingEnabled = true;
|
||||
this.handshakeComboBox.Location = new System.Drawing.Point(136, 173);
|
||||
this.handshakeComboBox.Name = "handshakeComboBox";
|
||||
this.handshakeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.handshakeComboBox.TabIndex = 14;
|
||||
//
|
||||
// stopBitsComboBox
|
||||
//
|
||||
this.stopBitsComboBox.Enabled = false;
|
||||
this.stopBitsComboBox.FormattingEnabled = true;
|
||||
this.stopBitsComboBox.Location = new System.Drawing.Point(136, 149);
|
||||
this.stopBitsComboBox.Name = "stopBitsComboBox";
|
||||
this.stopBitsComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.stopBitsComboBox.TabIndex = 12;
|
||||
//
|
||||
// parityComboBox
|
||||
//
|
||||
this.parityComboBox.Enabled = false;
|
||||
this.parityComboBox.FormattingEnabled = true;
|
||||
this.parityComboBox.Location = new System.Drawing.Point(136, 101);
|
||||
this.parityComboBox.Name = "parityComboBox";
|
||||
this.parityComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parityComboBox.TabIndex = 8;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(136, 29);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(26, 32);
|
||||
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, 8);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// handshakeLabel
|
||||
//
|
||||
this.handshakeLabel.AutoSize = true;
|
||||
this.handshakeLabel.Location = new System.Drawing.Point(25, 176);
|
||||
this.handshakeLabel.Name = "handshakeLabel";
|
||||
this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
|
||||
this.handshakeLabel.TabIndex = 13;
|
||||
this.handshakeLabel.Text = "Handshake";
|
||||
//
|
||||
// stopBitsLabel
|
||||
//
|
||||
this.stopBitsLabel.AutoSize = true;
|
||||
this.stopBitsLabel.Location = new System.Drawing.Point(25, 152);
|
||||
this.stopBitsLabel.Name = "stopBitsLabel";
|
||||
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
|
||||
this.stopBitsLabel.TabIndex = 11;
|
||||
this.stopBitsLabel.Text = "Stop Bits";
|
||||
//
|
||||
// dataBitsTextBox
|
||||
//
|
||||
this.dataBitsTextBox.Enabled = false;
|
||||
this.dataBitsTextBox.Location = new System.Drawing.Point(136, 125);
|
||||
this.dataBitsTextBox.Name = "dataBitsTextBox";
|
||||
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.dataBitsTextBox.TabIndex = 10;
|
||||
//
|
||||
// dataBitsLabel
|
||||
//
|
||||
this.dataBitsLabel.AutoSize = true;
|
||||
this.dataBitsLabel.Location = new System.Drawing.Point(25, 128);
|
||||
this.dataBitsLabel.Name = "dataBitsLabel";
|
||||
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
|
||||
this.dataBitsLabel.TabIndex = 9;
|
||||
this.dataBitsLabel.Text = "Data Bits";
|
||||
//
|
||||
// partityLabel
|
||||
//
|
||||
this.partityLabel.AutoSize = true;
|
||||
this.partityLabel.Location = new System.Drawing.Point(25, 104);
|
||||
this.partityLabel.Name = "partityLabel";
|
||||
this.partityLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.partityLabel.TabIndex = 7;
|
||||
this.partityLabel.Text = "Parity";
|
||||
//
|
||||
// baudRateTextBox
|
||||
//
|
||||
this.baudRateTextBox.Enabled = false;
|
||||
this.baudRateTextBox.Location = new System.Drawing.Point(136, 77);
|
||||
this.baudRateTextBox.Name = "baudRateTextBox";
|
||||
this.baudRateTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.baudRateTextBox.TabIndex = 6;
|
||||
//
|
||||
// baudRateLabel
|
||||
//
|
||||
this.baudRateLabel.AutoSize = true;
|
||||
this.baudRateLabel.Location = new System.Drawing.Point(25, 80);
|
||||
this.baudRateLabel.Name = "baudRateLabel";
|
||||
this.baudRateLabel.Size = new System.Drawing.Size(58, 13);
|
||||
this.baudRateLabel.TabIndex = 5;
|
||||
this.baudRateLabel.Text = "Baud Rate";
|
||||
//
|
||||
// comPortNrTextBox
|
||||
//
|
||||
this.comPortNrTextBox.Enabled = false;
|
||||
this.comPortNrTextBox.Location = new System.Drawing.Point(136, 53);
|
||||
this.comPortNrTextBox.Name = "comPortNrTextBox";
|
||||
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.comPortNrTextBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(25, 56);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(98, 13);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Serial Port Number:";
|
||||
//
|
||||
// capacityLabel
|
||||
//
|
||||
this.capacityLabel.AutoSize = true;
|
||||
this.capacityLabel.Location = new System.Drawing.Point(25, 201);
|
||||
this.capacityLabel.Name = "capacityLabel";
|
||||
this.capacityLabel.Size = new System.Drawing.Size(76, 13);
|
||||
this.capacityLabel.TabIndex = 15;
|
||||
this.capacityLabel.Text = "Tank Capacity";
|
||||
//
|
||||
// capacityTextBox
|
||||
//
|
||||
this.capacityTextBox.Enabled = false;
|
||||
this.capacityTextBox.Location = new System.Drawing.Point(136, 198);
|
||||
this.capacityTextBox.Name = "capacityTextBox";
|
||||
this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.capacityTextBox.TabIndex = 16;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(185, 201);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(19, 13);
|
||||
this.label2.TabIndex = 17;
|
||||
this.label2.Text = "kg";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(185, 225);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(19, 13);
|
||||
this.label3.TabIndex = 20;
|
||||
this.label3.Text = "kg";
|
||||
//
|
||||
// emptyTextBox
|
||||
//
|
||||
this.emptyTextBox.Enabled = false;
|
||||
this.emptyTextBox.Location = new System.Drawing.Point(136, 222);
|
||||
this.emptyTextBox.Name = "emptyTextBox";
|
||||
this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
|
||||
this.emptyTextBox.TabIndex = 19;
|
||||
//
|
||||
// emptyLabel
|
||||
//
|
||||
this.emptyLabel.AutoSize = true;
|
||||
this.emptyLabel.Location = new System.Drawing.Point(25, 225);
|
||||
this.emptyLabel.Name = "emptyLabel";
|
||||
this.emptyLabel.Size = new System.Drawing.Size(64, 13);
|
||||
this.emptyLabel.TabIndex = 18;
|
||||
this.emptyLabel.Text = "Tank Empty";
|
||||
//
|
||||
// BalanceCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
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.partityLabel);
|
||||
this.Controls.Add(this.baudRateTextBox);
|
||||
this.Controls.Add(this.baudRateLabel);
|
||||
this.Controls.Add(this.comPortNrTextBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "BalanceCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 250);
|
||||
this.Load += new System.EventHandler(this.BalanceCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -252,8 +284,11 @@
|
||||
private System.Windows.Forms.Label baudRateLabel;
|
||||
private System.Windows.Forms.TextBox comPortNrTextBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label rangeLabel;
|
||||
private System.Windows.Forms.TextBox rangeTextBox;
|
||||
private System.Windows.Forms.Label capacityLabel;
|
||||
private System.Windows.Forms.TextBox capacityTextBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox emptyTextBox;
|
||||
private System.Windows.Forms.Label emptyLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,8 +102,9 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
dataBitsTextBox.Text = config.DataBits.ToString();
|
||||
stopBitsComboBox.Text = config.StopBits.ToString();
|
||||
handshakeComboBox.Text = config.Handshake.ToString();
|
||||
rangeTextBox.Text = config.Capacity.ToString();
|
||||
}
|
||||
capacityTextBox.Text = config.Capacity.ToString();
|
||||
emptyTextBox.Text = config.Empty.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
@@ -114,8 +115,9 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
dataBitsTextBox.Enabled = true;
|
||||
stopBitsComboBox.Enabled = true;
|
||||
handshakeComboBox.Enabled = true;
|
||||
rangeTextBox.Enabled = true;
|
||||
}
|
||||
capacityTextBox.Enabled = true;
|
||||
emptyTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgVerifyFlags VerifyCfg(ref string message)
|
||||
{
|
||||
@@ -137,14 +139,17 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Data Bits' is not valid";
|
||||
}
|
||||
float fdummy;
|
||||
bool floatOk = (float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out fdummy) ||
|
||||
float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out fdummy));
|
||||
if (!floatOk || fdummy <= 0)
|
||||
float mass;
|
||||
if (!Utils.TryParseUFloat(capacityTextBox.Text, out mass) || mass <= 0)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Range' is not valid";
|
||||
message += Environment.NewLine + "'Tank Capacity' is not valid";
|
||||
}
|
||||
if (!Utils.TryParseUFloat(emptyTextBox.Text, out mass) || mass <= 0)
|
||||
{
|
||||
flags |= CfgVerifyFlags.Error;
|
||||
message += Environment.NewLine + "'Tank Empty' is not valid";
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
@@ -160,8 +165,8 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
config.DataBits = int.Parse(dataBitsTextBox.Text);
|
||||
config.StopBits = GetStopBits(stopBitsComboBox.SelectedItem.ToString());
|
||||
config.Handshake = GetHandshake(handshakeComboBox.SelectedItem.ToString());
|
||||
bool floatOk = (float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.CurrentCulture, out config.Capacity) ||
|
||||
float.TryParse(rangeTextBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out config.Capacity));
|
||||
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text);
|
||||
config.Empty = Utils.ParseUFloat(emptyTextBox.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,11 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
serialPort.Open();
|
||||
}
|
||||
|
||||
public bool IsEmpty(float mass)
|
||||
{
|
||||
return (mass <= balanceCfg.Empty);
|
||||
}
|
||||
|
||||
public void ZeroWhenStable()
|
||||
{
|
||||
if (balanceCfg.DebugLevel == Entities.DebugMode.Simulate) return;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
return new BalanceCfg(this, "Balance1", 3, 2400, System.IO.Ports.Parity.Even, 7,
|
||||
System.IO.Ports.StopBits.One, System.IO.Ports.Handshake.XOnXOff,
|
||||
200); // kg
|
||||
200.0f, 20.0f); // kg
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.MettlerToledo
|
||||
{
|
||||
return new BalanceCfg(this, "Balance1", 3, 2400, System.IO.Ports.Parity.Even, 7,
|
||||
System.IO.Ports.StopBits.One, System.IO.Ports.Handshake.XOnXOff,
|
||||
200); // kg
|
||||
200.0f, 20.0f); // kg
|
||||
}
|
||||
|
||||
public IComponentCfgCtrl CreateCfgCtrl()
|
||||
|
||||
@@ -522,9 +522,9 @@ namespace TBF.BenchControl.Sequences
|
||||
else if (e.Contains(Event.UiCmdEmptyTank1)) selection = Selection.EmptyTank1;
|
||||
else if (e.Contains(Event.UiCmdEmptyTank2)) selection = Selection.EmptyTank2;
|
||||
else if (e.Contains(Event.UiCmdEmptyTank3)) selection = Selection.EmptyTank3;
|
||||
else if (emptying1 && (mass1.Val < (StateMachine.Balance1.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank1;
|
||||
else if (emptying2 && (mass2.Val < (StateMachine.Balance2.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank2;
|
||||
else if (emptying3 && (mass3.Val < (StateMachine.Balance3.Capacity / 100.0f + 20.0f))) selection = Selection.CloseTank3;
|
||||
else if (emptying1 && StateMachine.Balance1.IsEmpty(mass1.Val)) selection = Selection.CloseTank1;
|
||||
else if (emptying2 && StateMachine.Balance2.IsEmpty(mass2.Val)) selection = Selection.CloseTank2;
|
||||
else if (emptying3 && StateMachine.Balance3.IsEmpty(mass3.Val)) selection = Selection.CloseTank3;
|
||||
else if (e.Contains(Event.UiCmdPurgeBegin)) return Selection.PurgeBegin; /// Value used to branch the code later on
|
||||
else if (e.Contains(Event.UiCmdPurgeEnd)) return Selection.PurgeEnd;
|
||||
else if (e.Contains(Event.UiCmdStartTest)) return Selection.Test;
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
while (!e.Contains(Event.BalanceDone));
|
||||
}
|
||||
while (mass.Val > (Balance.Capacity / 40.0f + 20.0f));
|
||||
while (Balance.IsEmpty(mass.Val));
|
||||
|
||||
quit_emptying:
|
||||
//--------------------------------
|
||||
|
||||
Reference in New Issue
Block a user