MettlerToledo.TankDraining, ITankDrainingCfg, ITankDraining class/interfaces added, EmptyValve --> DrainValve

This commit is contained in:
Milan Hanajik
2017-03-02 09:17:22 +01:00
parent 33b349e333
commit df0a38e3c6
11 changed files with 294 additions and 142 deletions
@@ -0,0 +1,14 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TBF.BenchControl.GenericDevices
{
public interface ITankDraining
{
}
}
@@ -0,0 +1,29 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.BenchControl.GenericDevices
{
public interface ITankDrainingCfg
{
/// <summary>
/// Max. mass of water in 'kg' or volume in 'l'
/// </summary>
float Capacity { get; }
/// <summary>
/// 'Empty' water mass in 'kg' or volume in 'l'
/// </summary>
float Empty { get; }
/// <summary>
/// Time in [s] to drain the tank completely
/// </summary>
int DrainTimeSec { get; }
/// <summary>
/// Name of the drain valve
/// </summary>
string DrainValve { get; }
}
}
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2016 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.IO; using System.IO;
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Standard namespace TBF.BenchControl.MettlerToledo.Standard
{ {
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg, GenericDevices.ITankDrainingCfg
{ {
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); } public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
@@ -23,10 +23,38 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public int DataBits; public int DataBits;
public StopBits StopBits; public StopBits StopBits;
public Handshake Handshake; public Handshake Handshake;
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l' /// 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 string Format; public string Format;
public int EmptyTimeSec; /// s
/// Buoyancy related serialized parameters displayed in Metrology tab page /// Buoyancy related serialized parameters displayed in Metrology tab page
private float buoyancyTemp; private float buoyancyTemp;
@@ -78,7 +106,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
BalanceCfg() BalanceCfg()
{ {
Name = "WT"; Name = "WT1";
ParentName = string.Empty; ParentName = string.Empty;
ComPortNr = 3; ComPortNr = 3;
BaudRate = 2400; BaudRate = 2400;
@@ -89,7 +117,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
Capacity = 200.0f; Capacity = 200.0f;
Empty = 20.0f; Empty = 20.0f;
Format = "F3"; Format = "F3";
EmptyTimeSec = 180; DrainValve = "VB1";
DrainTimeSec = 180;
BuoyancyTemp = 20.0f; BuoyancyTemp = 20.0f;
BuoyancyPress = 1.0f; BuoyancyPress = 1.0f;
BuoyancyHumi = 40.0f; BuoyancyHumi = 40.0f;
@@ -103,8 +132,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public string ToString(int i) public string ToString(int i)
{ {
return string.Format("Name={0}, {1}kg, empty={2}kg, fmt.={3}, emptyTm={4}s, Com{5}, {6}Bd, {7}-bits, parity={8}, stopBits={9}, {10}", return string.Format("Name={0}, {1}kg, empty={2}kg, fmt.={3}, drainTm={4}s, Com{5}, {6}Bd, {7}-bits, parity={8}, stopBits={9}, {10}",
Name, Capacity, Empty, Format, EmptyTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake); Name, Capacity, Empty, Format, DrainTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
} }
} }
} }
@@ -53,45 +53,47 @@ namespace TBF.BenchControl.MettlerToledo.Standard
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.drainTimeTextBox = 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.drainValveComboBox = new System.Windows.Forms.ComboBox();
this.drainingValveLabel = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// handshakeComboBox // handshakeComboBox
// //
this.handshakeComboBox.Enabled = false; this.handshakeComboBox.Enabled = false;
this.handshakeComboBox.FormattingEnabled = true; this.handshakeComboBox.FormattingEnabled = true;
this.handshakeComboBox.Location = new System.Drawing.Point(236, 216); this.handshakeComboBox.Location = new System.Drawing.Point(236, 222);
this.handshakeComboBox.Name = "handshakeComboBox"; this.handshakeComboBox.Name = "handshakeComboBox";
this.handshakeComboBox.Size = new System.Drawing.Size(43, 21); this.handshakeComboBox.Size = new System.Drawing.Size(43, 21);
this.handshakeComboBox.TabIndex = 25; this.handshakeComboBox.TabIndex = 27;
// //
// stopBitsComboBox // stopBitsComboBox
// //
this.stopBitsComboBox.Enabled = false; this.stopBitsComboBox.Enabled = false;
this.stopBitsComboBox.FormattingEnabled = true; this.stopBitsComboBox.FormattingEnabled = true;
this.stopBitsComboBox.Location = new System.Drawing.Point(236, 193); this.stopBitsComboBox.Location = new System.Drawing.Point(236, 200);
this.stopBitsComboBox.Name = "stopBitsComboBox"; this.stopBitsComboBox.Name = "stopBitsComboBox";
this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21); this.stopBitsComboBox.Size = new System.Drawing.Size(43, 21);
this.stopBitsComboBox.TabIndex = 23; this.stopBitsComboBox.TabIndex = 25;
// //
// parityComboBox // parityComboBox
// //
this.parityComboBox.Enabled = false; this.parityComboBox.Enabled = false;
this.parityComboBox.FormattingEnabled = true; this.parityComboBox.FormattingEnabled = true;
this.parityComboBox.Location = new System.Drawing.Point(100, 216); this.parityComboBox.Location = new System.Drawing.Point(100, 222);
this.parityComboBox.Name = "parityComboBox"; this.parityComboBox.Name = "parityComboBox";
this.parityComboBox.Size = new System.Drawing.Size(43, 21); this.parityComboBox.Size = new System.Drawing.Size(43, 21);
this.parityComboBox.TabIndex = 19; this.parityComboBox.TabIndex = 21;
// //
// nameTextBox // nameTextBox
// //
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(136, 27); this.nameTextBox.Location = new System.Drawing.Point(137, 27);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(143, 20); this.nameTextBox.Size = new System.Drawing.Size(142, 20);
this.nameTextBox.TabIndex = 2; this.nameTextBox.TabIndex = 2;
// //
// nameLabel // nameLabel
@@ -106,7 +108,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// classNameLabel // classNameLabel
// //
this.classNameLabel.AutoSize = true; this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(133, 7); this.classNameLabel.Location = new System.Drawing.Point(134, 9);
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(89, 13); this.classNameLabel.Size = new System.Drawing.Size(89, 13);
this.classNameLabel.TabIndex = 0; this.classNameLabel.TabIndex = 0;
@@ -115,184 +117,204 @@ namespace TBF.BenchControl.MettlerToledo.Standard
// handshakeLabel // handshakeLabel
// //
this.handshakeLabel.AutoSize = true; this.handshakeLabel.AutoSize = true;
this.handshakeLabel.Location = new System.Drawing.Point(162, 219); this.handshakeLabel.Location = new System.Drawing.Point(162, 225);
this.handshakeLabel.Name = "handshakeLabel"; this.handshakeLabel.Name = "handshakeLabel";
this.handshakeLabel.Size = new System.Drawing.Size(62, 13); this.handshakeLabel.Size = new System.Drawing.Size(62, 13);
this.handshakeLabel.TabIndex = 24; this.handshakeLabel.TabIndex = 26;
this.handshakeLabel.Text = "Handshake"; this.handshakeLabel.Text = "Handshake";
// //
// stopBitsLabel // stopBitsLabel
// //
this.stopBitsLabel.AutoSize = true; this.stopBitsLabel.AutoSize = true;
this.stopBitsLabel.Location = new System.Drawing.Point(162, 196); this.stopBitsLabel.Location = new System.Drawing.Point(162, 203);
this.stopBitsLabel.Name = "stopBitsLabel"; this.stopBitsLabel.Name = "stopBitsLabel";
this.stopBitsLabel.Size = new System.Drawing.Size(49, 13); this.stopBitsLabel.Size = new System.Drawing.Size(49, 13);
this.stopBitsLabel.TabIndex = 22; this.stopBitsLabel.TabIndex = 24;
this.stopBitsLabel.Text = "Stop Bits"; this.stopBitsLabel.Text = "Stop Bits";
// //
// dataBitsTextBox // dataBitsTextBox
// //
this.dataBitsTextBox.Enabled = false; this.dataBitsTextBox.Enabled = false;
this.dataBitsTextBox.Location = new System.Drawing.Point(236, 170); this.dataBitsTextBox.Location = new System.Drawing.Point(236, 178);
this.dataBitsTextBox.Name = "dataBitsTextBox"; this.dataBitsTextBox.Name = "dataBitsTextBox";
this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20); this.dataBitsTextBox.Size = new System.Drawing.Size(43, 20);
this.dataBitsTextBox.TabIndex = 21; this.dataBitsTextBox.TabIndex = 23;
// //
// dataBitsLabel // dataBitsLabel
// //
this.dataBitsLabel.AutoSize = true; this.dataBitsLabel.AutoSize = true;
this.dataBitsLabel.Location = new System.Drawing.Point(162, 173); this.dataBitsLabel.Location = new System.Drawing.Point(162, 181);
this.dataBitsLabel.Name = "dataBitsLabel"; this.dataBitsLabel.Name = "dataBitsLabel";
this.dataBitsLabel.Size = new System.Drawing.Size(50, 13); this.dataBitsLabel.Size = new System.Drawing.Size(50, 13);
this.dataBitsLabel.TabIndex = 20; this.dataBitsLabel.TabIndex = 22;
this.dataBitsLabel.Text = "Data Bits"; this.dataBitsLabel.Text = "Data Bits";
// //
// partityLabel // partityLabel
// //
this.partityLabel.AutoSize = true; this.partityLabel.AutoSize = true;
this.partityLabel.Location = new System.Drawing.Point(26, 221); this.partityLabel.Location = new System.Drawing.Point(26, 225);
this.partityLabel.Name = "partityLabel"; this.partityLabel.Name = "partityLabel";
this.partityLabel.Size = new System.Drawing.Size(33, 13); this.partityLabel.Size = new System.Drawing.Size(33, 13);
this.partityLabel.TabIndex = 18; this.partityLabel.TabIndex = 20;
this.partityLabel.Text = "Parity"; this.partityLabel.Text = "Parity";
// //
// baudRateTextBox // baudRateTextBox
// //
this.baudRateTextBox.Enabled = false; this.baudRateTextBox.Enabled = false;
this.baudRateTextBox.Location = new System.Drawing.Point(100, 193); this.baudRateTextBox.Location = new System.Drawing.Point(100, 200);
this.baudRateTextBox.Name = "baudRateTextBox"; this.baudRateTextBox.Name = "baudRateTextBox";
this.baudRateTextBox.Size = new System.Drawing.Size(43, 20); this.baudRateTextBox.Size = new System.Drawing.Size(43, 20);
this.baudRateTextBox.TabIndex = 17; this.baudRateTextBox.TabIndex = 19;
// //
// baudRateLabel // baudRateLabel
// //
this.baudRateLabel.AutoSize = true; this.baudRateLabel.AutoSize = true;
this.baudRateLabel.Location = new System.Drawing.Point(26, 196); this.baudRateLabel.Location = new System.Drawing.Point(26, 203);
this.baudRateLabel.Name = "baudRateLabel"; this.baudRateLabel.Name = "baudRateLabel";
this.baudRateLabel.Size = new System.Drawing.Size(58, 13); this.baudRateLabel.Size = new System.Drawing.Size(53, 13);
this.baudRateLabel.TabIndex = 16; this.baudRateLabel.TabIndex = 18;
this.baudRateLabel.Text = "Baud Rate"; this.baudRateLabel.Text = "Baud rate";
// //
// comPortNrTextBox // comPortNrTextBox
// //
this.comPortNrTextBox.Enabled = false; this.comPortNrTextBox.Enabled = false;
this.comPortNrTextBox.Location = new System.Drawing.Point(100, 170); this.comPortNrTextBox.Location = new System.Drawing.Point(100, 178);
this.comPortNrTextBox.Name = "comPortNrTextBox"; this.comPortNrTextBox.Name = "comPortNrTextBox";
this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20); this.comPortNrTextBox.Size = new System.Drawing.Size(43, 20);
this.comPortNrTextBox.TabIndex = 15; this.comPortNrTextBox.TabIndex = 17;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 173); this.label1.Location = new System.Drawing.Point(26, 181);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 13); this.label1.Size = new System.Drawing.Size(67, 13);
this.label1.TabIndex = 14; this.label1.TabIndex = 16;
this.label1.Text = "Serial Port #:"; this.label1.Text = "Serial port #:";
// //
// capacityLabel // capacityLabel
// //
this.capacityLabel.AutoSize = true; this.capacityLabel.AutoSize = true;
this.capacityLabel.Location = new System.Drawing.Point(26, 54); this.capacityLabel.Location = new System.Drawing.Point(26, 82);
this.capacityLabel.Name = "capacityLabel"; this.capacityLabel.Name = "capacityLabel";
this.capacityLabel.Size = new System.Drawing.Size(76, 13); this.capacityLabel.Size = new System.Drawing.Size(75, 13);
this.capacityLabel.TabIndex = 3; this.capacityLabel.TabIndex = 5;
this.capacityLabel.Text = "Tank Capacity"; this.capacityLabel.Text = "Tank capacity";
// //
// capacityTextBox // capacityTextBox
// //
this.capacityTextBox.Enabled = false; this.capacityTextBox.Enabled = false;
this.capacityTextBox.Location = new System.Drawing.Point(137, 51); this.capacityTextBox.Location = new System.Drawing.Point(137, 79);
this.capacityTextBox.Name = "capacityTextBox"; this.capacityTextBox.Name = "capacityTextBox";
this.capacityTextBox.Size = new System.Drawing.Size(43, 20); this.capacityTextBox.Size = new System.Drawing.Size(43, 20);
this.capacityTextBox.TabIndex = 4; this.capacityTextBox.TabIndex = 6;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(186, 54); this.label2.Location = new System.Drawing.Point(186, 82);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 13); this.label2.Size = new System.Drawing.Size(19, 13);
this.label2.TabIndex = 5; this.label2.TabIndex = 7;
this.label2.Text = "kg"; this.label2.Text = "kg";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(186, 77); this.label3.Location = new System.Drawing.Point(186, 104);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(19, 13); this.label3.Size = new System.Drawing.Size(19, 13);
this.label3.TabIndex = 8; this.label3.TabIndex = 10;
this.label3.Text = "kg"; this.label3.Text = "kg";
// //
// emptyTextBox // emptyTextBox
// //
this.emptyTextBox.Enabled = false; this.emptyTextBox.Enabled = false;
this.emptyTextBox.Location = new System.Drawing.Point(137, 74); this.emptyTextBox.Location = new System.Drawing.Point(137, 101);
this.emptyTextBox.Name = "emptyTextBox"; this.emptyTextBox.Name = "emptyTextBox";
this.emptyTextBox.Size = new System.Drawing.Size(43, 20); this.emptyTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTextBox.TabIndex = 7; this.emptyTextBox.TabIndex = 9;
// //
// emptyLabel // emptyLabel
// //
this.emptyLabel.AutoSize = true; this.emptyLabel.AutoSize = true;
this.emptyLabel.Location = new System.Drawing.Point(26, 77); this.emptyLabel.Location = new System.Drawing.Point(26, 104);
this.emptyLabel.Name = "emptyLabel"; this.emptyLabel.Name = "emptyLabel";
this.emptyLabel.Size = new System.Drawing.Size(64, 13); this.emptyLabel.Size = new System.Drawing.Size(109, 13);
this.emptyLabel.TabIndex = 6; this.emptyLabel.TabIndex = 8;
this.emptyLabel.Text = "Tank Empty"; this.emptyLabel.Text = "Tank empty threshold";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(186, 123); this.label4.Location = new System.Drawing.Point(186, 149);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(24, 13); this.label4.Size = new System.Drawing.Size(24, 13);
this.label4.TabIndex = 13; this.label4.TabIndex = 15;
this.label4.Text = "sec"; this.label4.Text = "sec";
// //
// emptyTimeTextBox // drainTimeTextBox
// //
this.emptyTimeTextBox.Enabled = false; this.drainTimeTextBox.Enabled = false;
this.emptyTimeTextBox.Location = new System.Drawing.Point(137, 120); this.drainTimeTextBox.Location = new System.Drawing.Point(137, 146);
this.emptyTimeTextBox.Name = "emptyTimeTextBox"; this.drainTimeTextBox.Name = "drainTimeTextBox";
this.emptyTimeTextBox.Size = new System.Drawing.Size(43, 20); this.drainTimeTextBox.Size = new System.Drawing.Size(43, 20);
this.emptyTimeTextBox.TabIndex = 12; this.drainTimeTextBox.TabIndex = 14;
// //
// label5 // label5
// //
this.label5.AutoSize = true; this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(26, 123); this.label5.Location = new System.Drawing.Point(26, 149);
this.label5.Name = "label5"; this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(90, 13); this.label5.Size = new System.Drawing.Size(54, 13);
this.label5.TabIndex = 11; this.label5.TabIndex = 13;
this.label5.Text = "Tank Empty Time"; this.label5.Text = "Drain time";
// //
// formatTextBox // formatTextBox
// //
this.formatTextBox.Enabled = false; this.formatTextBox.Enabled = false;
this.formatTextBox.Location = new System.Drawing.Point(137, 97); this.formatTextBox.Location = new System.Drawing.Point(137, 49);
this.formatTextBox.Name = "formatTextBox"; this.formatTextBox.Name = "formatTextBox";
this.formatTextBox.Size = new System.Drawing.Size(43, 20); this.formatTextBox.Size = new System.Drawing.Size(43, 20);
this.formatTextBox.TabIndex = 10; this.formatTextBox.TabIndex = 4;
// //
// formatLabel // formatLabel
// //
this.formatLabel.AutoSize = true; this.formatLabel.AutoSize = true;
this.formatLabel.Location = new System.Drawing.Point(26, 100); this.formatLabel.Location = new System.Drawing.Point(26, 52);
this.formatLabel.Name = "formatLabel"; this.formatLabel.Name = "formatLabel";
this.formatLabel.Size = new System.Drawing.Size(76, 13); this.formatLabel.Size = new System.Drawing.Size(76, 13);
this.formatLabel.TabIndex = 9; this.formatLabel.TabIndex = 3;
this.formatLabel.Text = "Decimal points"; this.formatLabel.Text = "Decimal points";
// //
// drainValveComboBox
//
this.drainValveComboBox.Enabled = false;
this.drainValveComboBox.FormattingEnabled = true;
this.drainValveComboBox.Location = new System.Drawing.Point(137, 123);
this.drainValveComboBox.Name = "drainValveComboBox";
this.drainValveComboBox.Size = new System.Drawing.Size(143, 21);
this.drainValveComboBox.TabIndex = 12;
//
// drainingValveLabel
//
this.drainingValveLabel.AutoSize = true;
this.drainingValveLabel.Location = new System.Drawing.Point(26, 126);
this.drainingValveLabel.Name = "drainingValveLabel";
this.drainingValveLabel.Size = new System.Drawing.Size(61, 13);
this.drainingValveLabel.TabIndex = 11;
this.drainingValveLabel.Text = "Drain valve";
//
// BalanceCfgCtrl // BalanceCfgCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.drainValveComboBox);
this.Controls.Add(this.drainingValveLabel);
this.Controls.Add(this.formatTextBox); this.Controls.Add(this.formatTextBox);
this.Controls.Add(this.formatLabel); this.Controls.Add(this.formatLabel);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.emptyTimeTextBox); this.Controls.Add(this.drainTimeTextBox);
this.Controls.Add(this.label5); this.Controls.Add(this.label5);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.emptyTextBox); this.Controls.Add(this.emptyTextBox);
@@ -347,9 +369,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
private System.Windows.Forms.TextBox emptyTextBox; private System.Windows.Forms.TextBox emptyTextBox;
private System.Windows.Forms.Label emptyLabel; private System.Windows.Forms.Label emptyLabel;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox emptyTimeTextBox; private System.Windows.Forms.TextBox drainTimeTextBox;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox formatTextBox; private System.Windows.Forms.TextBox formatTextBox;
private System.Windows.Forms.Label formatLabel; private System.Windows.Forms.Label formatLabel;
private System.Windows.Forms.ComboBox drainValveComboBox;
private System.Windows.Forms.Label drainingValveLabel;
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Globalization; using System.Globalization;
@@ -14,6 +14,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
{ {
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;
@@ -27,6 +29,55 @@ namespace TBF.BenchControl.MettlerToledo.Standard
} }
} }
int GetParityIx(Parity par)
{
if (par == Parity.None) return 0;
if (par == Parity.Even) return 0;
if (par == Parity.Odd) return 0;
return -1;
}
Parity GetParity(string str)
{
if (str.Equals(Parity.None.ToString())) return Parity.None;
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
return (Parity)(-1);
}
int GetStopBitsIx(StopBits sb)
{
if (sb == StopBits.None) return 0;
if (sb == StopBits.One) return 1;
if (sb == StopBits.OnePointFive) return 2;
if (sb == StopBits.Two) return 3;
return -1;
}
StopBits GetStopBits(string str)
{
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
return (StopBits)(-1);
}
int GetHandshakeIx(Handshake par)
{
if (par == Handshake.None) return 0;
if (par == Handshake.RequestToSend) return 0;
if (par == Handshake.XOnXOff) return 0;
return -1;
}
Handshake GetHandshake(string str)
{
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
return (Handshake)(-1);
}
public BalanceCfgCtrl() public BalanceCfgCtrl()
{ {
InitializeComponent(); InitializeComponent();
@@ -45,55 +96,23 @@ namespace TBF.BenchControl.MettlerToledo.Standard
handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString()); handshakeComboBox.Items.Add(Handshake.XOnXOff.ToString());
} }
int GetParityIx(Parity par)
{
if (par == Parity.None) return 0;
if (par == Parity.Even) return 0;
if (par == Parity.Odd) return 0;
return -1;
}
Parity GetParity(string str)
{
if (str.Equals(Parity.None.ToString())) return Parity.None;
if (str.Equals(Parity.Even.ToString())) return Parity.Even;
if (str.Equals(Parity.Odd.ToString())) return Parity.Odd;
return (Parity)(-1);
}
int GetStopBitsIx(StopBits sb)
{
if (sb == StopBits.None) return 0;
if (sb == StopBits.One) return 1;
if (sb == StopBits.OnePointFive) return 2;
if (sb == StopBits.Two) return 3;
return -1;
}
StopBits GetStopBits(string str)
{
if (str.Equals(StopBits.None.ToString())) return StopBits.None;
if (str.Equals(StopBits.One.ToString())) return StopBits.One;
if (str.Equals(StopBits.OnePointFive.ToString())) return StopBits.OnePointFive;
if (str.Equals(StopBits.Two.ToString())) return StopBits.Two;
return (StopBits)(-1);
}
int GetHandshakeIx(Handshake par)
{
if (par == Handshake.None) return 0;
if (par == Handshake.RequestToSend) return 0;
if (par == Handshake.XOnXOff) return 0;
return -1;
}
Handshake GetHandshake(string str)
{
if (str.Equals(Handshake.None.ToString())) return Handshake.None;
if (str.Equals(Handshake.RequestToSend.ToString())) return Handshake.RequestToSend;
if (str.Equals(Handshake.XOnXOff.ToString())) return Handshake.XOnXOff;
return (Handshake)(-1);
}
private void BalanceCfgCtrl_Load(object sender, EventArgs e) private void BalanceCfgCtrl_Load(object sender, EventArgs e)
{ {
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(); Redraw();
} }
@@ -110,7 +129,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
capacityTextBox.Text = config.Capacity.ToString(); capacityTextBox.Text = config.Capacity.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(); drainTimeTextBox.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();
@@ -126,7 +146,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
capacityTextBox.Enabled = true; capacityTextBox.Enabled = true;
emptyTextBox.Enabled = true; emptyTextBox.Enabled = true;
formatTextBox.Enabled = true; formatTextBox.Enabled = true;
emptyTimeTextBox.Enabled = true; drainTimeTextBox.Enabled = true;
drainValveComboBox.Enabled = true;
comPortNrTextBox.Enabled = true; comPortNrTextBox.Enabled = true;
baudRateTextBox.Enabled = true; baudRateTextBox.Enabled = true;
@@ -172,10 +193,15 @@ namespace TBF.BenchControl.MettlerToledo.Standard
flags |= CfgUpdateFlags.Error; flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Decimal points' should be between 0 and 9"; message += Environment.NewLine + "'Decimal points' should be between 0 and 9";
} }
if (!int.TryParse(emptyTimeTextBox.Text, out dummy) || dummy < 1 || dummy > 999) if (!drainValveComboBox.Items.Contains(drainValveComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Drain valve'";
}
if (!int.TryParse(drainTimeTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{ {
flags |= CfgUpdateFlags.Error; flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Tank Empty Time' should be between 1 and 999 sec"; message += Environment.NewLine + "'Tank drain time' should be between 1 and 999 sec";
} }
return flags; return flags;
@@ -191,7 +217,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
config.Capacity = Utils.ParseUFloat(capacityTextBox.Text); config.Capacity = Utils.ParseUFloat(capacityTextBox.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(drainTimeTextBox.Text);
config.DrainValve = drainValveComboBox.Text.Equals("---") ? string.Empty : drainValveComboBox.Text;
config.ComPortNr = int.Parse(comPortNrTextBox.Text); config.ComPortNr = int.Parse(comPortNrTextBox.Text);
config.BaudRate = int.Parse(baudRateTextBox.Text); config.BaudRate = int.Parse(baudRateTextBox.Text);
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2016 Sensus Metering Systems /// Copyright (c) 2013-2017 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <note> /// <note>
/// Implemented and tested on 15.10.2013 by Milan Hanajik /// Implemented and tested on 15.10.2013 by Milan Hanajik
/// </note> /// </note>
public class BalanceDev : ComponentBase, IDevice, GenericDevices.IBalance public class BalanceDev : TankDraining, IDevice, GenericDevices.IBalance
{ {
/// <summary> /// <summary>
/// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..." /// Info: StartMassMeasurement() and "Balnce response = .., Mass = ..."
@@ -49,7 +49,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public int BalanceNr { get { return balanceNr; } } public int BalanceNr { get { return balanceNr; } }
public double Capacity { get { return balanceCfg.Capacity; } } public double Capacity { get { return balanceCfg.Capacity; } }
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; } }
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
namespace TBF.BenchControl.MettlerToledo
{
public class TankDraining : ComponentBase
{
public GenericDevices.IValve DrainValve;
GenericDevices.ITankDrainingCfg tankManagementCfg;
public TankDraining()
: base()
{
}
public TankDraining(Generic.IComponentCfg cfg)
: base(cfg)
{
tankManagementCfg = cfg as GenericDevices.ITankDrainingCfg;
if (tankManagementCfg == null) throw new Exception(string.Format("Cannot create component {0}", cfg.Name));
}
}
}
+4 -4
View File
@@ -1132,7 +1132,7 @@ namespace TBF.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Emptying. /// Looks up a localized string similar to Draining.
/// </summary> /// </summary>
internal static string Emptying_chdr { internal static string Emptying_chdr {
get { get {
@@ -1141,7 +1141,7 @@ namespace TBF.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Emptying ({0}: step {1}/{2}). /// Looks up a localized string similar to Draining ({0}: step {1}/{2}).
/// </summary> /// </summary>
internal static string Emptying_i_n { internal static string Emptying_i_n {
get { get {
@@ -1150,7 +1150,7 @@ namespace TBF.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Emptying the tank. /// Looks up a localized string similar to Draining the tank.
/// </summary> /// </summary>
internal static string Emptying_tank { internal static string Emptying_tank {
get { get {
@@ -1159,7 +1159,7 @@ namespace TBF.Resources {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Emptying valve. /// Looks up a localized string similar to Drain valve.
/// </summary> /// </summary>
internal static string Emptying_valve { internal static string Emptying_valve {
get { get {
+4 -4
View File
@@ -169,7 +169,7 @@
<value>Diverter</value> <value>Diverter</value>
</data> </data>
<data name="Emptying_valve" xml:space="preserve"> <data name="Emptying_valve" xml:space="preserve">
<value>Emptying valve</value> <value>Drain valve</value>
</data> </data>
<data name="Name" xml:space="preserve"> <data name="Name" xml:space="preserve">
<value>Name</value> <value>Name</value>
@@ -370,7 +370,7 @@
<value>Test bench is not running, however you can change the settings to resolve the problem.</value> <value>Test bench is not running, however you can change the settings to resolve the problem.</value>
</data> </data>
<data name="Emptying_chdr" xml:space="preserve"> <data name="Emptying_chdr" xml:space="preserve">
<value>Emptying</value> <value>Draining</value>
</data> </data>
<data name="Q_set_method_chdr" xml:space="preserve"> <data name="Q_set_method_chdr" xml:space="preserve">
<value>Q-Set Method</value> <value>Q-Set Method</value>
@@ -626,7 +626,7 @@
<value>Clear</value> <value>Clear</value>
</data> </data>
<data name="Emptying_tank" xml:space="preserve"> <data name="Emptying_tank" xml:space="preserve">
<value>Emptying the tank</value> <value>Draining the tank</value>
</data> </data>
<data name="Measuring_the_weight" xml:space="preserve"> <data name="Measuring_the_weight" xml:space="preserve">
<value>Measuring the weight</value> <value>Measuring the weight</value>
@@ -644,7 +644,7 @@
<value>Purging ({0}: step {1}/{2})</value> <value>Purging ({0}: step {1}/{2})</value>
</data> </data>
<data name="Emptying_i_n" xml:space="preserve"> <data name="Emptying_i_n" xml:space="preserve">
<value>Emptying ({0}: step {1}/{2})</value> <value>Draining ({0}: step {1}/{2})</value>
</data> </data>
<data name="Switching_flow_detection" xml:space="preserve"> <data name="Switching_flow_detection" xml:space="preserve">
<value>Switching flow detection</value> <value>Switching flow detection</value>
+3
View File
@@ -438,6 +438,8 @@
<Compile Include="BenchControl\GenericDevices\INetworkAdapter.cs" /> <Compile Include="BenchControl\GenericDevices\INetworkAdapter.cs" />
<Compile Include="BenchControl\GenericDevices\ISequenceCondition.cs" /> <Compile Include="BenchControl\GenericDevices\ISequenceCondition.cs" />
<Compile Include="BenchControl\GenericDevices\ISimultTestMethod.cs" /> <Compile Include="BenchControl\GenericDevices\ISimultTestMethod.cs" />
<Compile Include="BenchControl\GenericDevices\ITankDraining.cs" />
<Compile Include="BenchControl\GenericDevices\ITankDrainingCfg.cs" />
<Compile Include="BenchControl\HeatMetersPath.cs" /> <Compile Include="BenchControl\HeatMetersPath.cs" />
<Compile Include="BenchControl\Keithley\Multimeter_2010_RS232\Factory.cs" /> <Compile Include="BenchControl\Keithley\Multimeter_2010_RS232\Factory.cs" />
<Compile Include="BenchControl\Keithley\Multimeter_2010_RS232\Multimeter.cs" /> <Compile Include="BenchControl\Keithley\Multimeter_2010_RS232\Multimeter.cs" />
@@ -490,6 +492,7 @@
<Compile Include="BenchControl\MettlerToledo\Standard\ReadStableMassOp.cs" /> <Compile Include="BenchControl\MettlerToledo\Standard\ReadStableMassOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\SetUnitsOp.cs" /> <Compile Include="BenchControl\MettlerToledo\Standard\SetUnitsOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\TaringOp.cs" /> <Compile Include="BenchControl\MettlerToledo\Standard\TaringOp.cs" />
<Compile Include="BenchControl\MettlerToledo\TankDraining.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\Factory.cs" /> <Compile Include="BenchControl\Modbus\Easytherm\Factory.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\Easytherm.cs" /> <Compile Include="BenchControl\Modbus\Easytherm\Easytherm.cs" />
<Compile Include="BenchControl\Modbus\Easytherm\EasythermCfg.cs" /> <Compile Include="BenchControl\Modbus\Easytherm\EasythermCfg.cs" />
@@ -32,7 +32,7 @@ namespace TBF.UiControls
Div, Div,
Tdiv, Tdiv,
Scale, Scale,
EmptyValve, DrainValve,
FixedColumnsCount, FixedColumnsCount,
} }
readonly int fixedColumnsCount = (int)Column.FixedColumnsCount; readonly int fixedColumnsCount = (int)Column.FixedColumnsCount;
@@ -125,7 +125,7 @@ namespace TBF.UiControls
editors[(int)Column.Div] = diverterComboBox; editors[(int)Column.Div] = diverterComboBox;
editors[(int)Column.Tdiv] = tempMeterDivComboBox; editors[(int)Column.Tdiv] = tempMeterDivComboBox;
editors[(int)Column.Scale] = balanceComboBox; editors[(int)Column.Scale] = balanceComboBox;
editors[(int)Column.EmptyValve] = emptyValveComboBox; editors[(int)Column.DrainValve] = emptyValveComboBox;
/// Prepare valve combo-boxes (max. 64 valves) /// Prepare valve combo-boxes (max. 64 valves)
for (int i = 0; i < 64; i++) for (int i = 0; i < 64; i++)
{ {
@@ -262,7 +262,7 @@ namespace TBF.UiControls
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.Balance = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text; entity.Balance = lvi.SubItems[(int)Column.Scale].Text.Equals("---") ? null : lvi.SubItems[(int)Column.Scale].Text;
entity.EmptyTankValve = lvi.SubItems[(int)Column.EmptyValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.EmptyValve].Text; entity.EmptyTankValve = lvi.SubItems[(int)Column.DrainValve].Text.Equals("---") ? null : lvi.SubItems[(int)Column.DrainValve].Text;
string valvesOpen = string.Empty; string valvesOpen = string.Empty;
string valvesClose = string.Empty; string valvesClose = string.Empty;