143 lines
3.9 KiB
C#
143 lines
3.9 KiB
C#
///
|
|
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.IO.Ports;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.MettlerToledo.Standard
|
|
{
|
|
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
|
|
protected override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int ComPortNr;
|
|
public int BaudRate;
|
|
public Parity Parity;
|
|
public int DataBits;
|
|
public StopBits StopBits;
|
|
public Handshake Handshake;
|
|
|
|
/// 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;
|
|
|
|
/// Buoyancy related serialized parameters displayed in Metrology tab page
|
|
private float buoyancyTemp;
|
|
private float buoyancyPress;
|
|
private float buoyancyHumi;
|
|
private float weightStandardDensity;
|
|
public float BuoyancyTemp
|
|
{
|
|
get { return buoyancyTemp; }
|
|
set { buoyancyTemp = value; }
|
|
}
|
|
public float BuoyancyPress
|
|
{
|
|
get { return buoyancyPress; }
|
|
set { buoyancyPress = value; }
|
|
}
|
|
public float BuoyancyHumi
|
|
{
|
|
get { return buoyancyHumi; }
|
|
set { buoyancyHumi = value; }
|
|
}
|
|
public float WeightStandardDensity
|
|
{
|
|
get { return weightStandardDensity; }
|
|
set { weightStandardDensity = value; }
|
|
}
|
|
|
|
/// Calibration info serialized parameters displayed in Metrology tab page
|
|
string calibCertificateNr;
|
|
DateTime calibDate;
|
|
DateTime calibValidDate;
|
|
public string CalibCertificateNr
|
|
{
|
|
get { return calibCertificateNr; }
|
|
set { calibCertificateNr = value; }
|
|
}
|
|
public DateTime CalibDate
|
|
{
|
|
get { return calibDate; }
|
|
set { calibDate = value; }
|
|
}
|
|
public DateTime CalibValidDate
|
|
{
|
|
get { return calibValidDate; }
|
|
set { calibValidDate = value; }
|
|
}
|
|
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
BalanceCfg()
|
|
{
|
|
Name = "WT1";
|
|
ParentName = string.Empty;
|
|
ComPortNr = 3;
|
|
BaudRate = 2400;
|
|
Parity = System.IO.Ports.Parity.Even;
|
|
DataBits = 7;
|
|
StopBits = System.IO.Ports.StopBits.One;
|
|
Handshake = System.IO.Ports.Handshake.XOnXOff;
|
|
Capacity = 200.0f;
|
|
Empty = 20.0f;
|
|
Format = "F3";
|
|
DrainValve = "VB1";
|
|
DrainTimeSec = 180;
|
|
BuoyancyTemp = 20.0f;
|
|
BuoyancyPress = 1.0f;
|
|
BuoyancyHumi = 40.0f;
|
|
}
|
|
|
|
public BalanceCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
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, DrainTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
|
}
|
|
}
|
|
}
|