65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
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, Generic.IComponentCfg
|
|
{
|
|
public IComponent GetComponent(IList<IComponent> components)
|
|
{
|
|
if (Factory.ClassName.Equals("MettlerToledo Balance")) return new BalanceDev(this);
|
|
else return new BalanceNewDev(this);
|
|
}
|
|
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;
|
|
public float Capacity; /// Max. water mass in 'kg' or volume in 'l'
|
|
public float Empty; /// 'Empty' water mass in 'kg' or volume in 'l'
|
|
public string Format;
|
|
public int EmptyTimeSec; /// s
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
BalanceCfg()
|
|
{
|
|
Name = "Balance";
|
|
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";
|
|
EmptyTimeSec = 180;
|
|
}
|
|
|
|
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}, emptyTm={4}s, Com{5}, {6}Bd, {7}-bits, parity={8}, stopBits={9}, {10}",
|
|
Name, Capacity, Empty, Format, EmptyTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
|
}
|
|
}
|
|
}
|