102 lines
3.7 KiB
C#
102 lines
3.7 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];
|
|
public 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;
|
|
|
|
public float Capacity { get; set; } /// Max. water mass in 'kg' or volume in 'l'
|
|
public float Empty { get; set; } /// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l')
|
|
public float EmptyUp { get; set; } /// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l') when the drain valve is not open
|
|
public string DrainValve { get; set; }
|
|
public int DrainTimeSec { get; set; }
|
|
public string Evaporation { get; set; }
|
|
|
|
public string Format;
|
|
|
|
/// Buoyancy related serialized parameters displayed in Metrology tab page
|
|
public float BuoyancyTemp { get; set; }
|
|
public float BuoyancyPress { get; set; }
|
|
public float BuoyancyHumi { get; set; }
|
|
public float WeightStandardDensity { get; set; }
|
|
|
|
/// Calibration info serialized parameters displayed in Metrology tab page
|
|
public string CalibCertificateNr { get; set; }
|
|
public DateTime CalibDate { get; set; }
|
|
public DateTime CalibValidDate { get; set; }
|
|
|
|
/// Schematic drawing info
|
|
public SchematicDrawing.Shape Shape { get; set; }
|
|
public int X { get; set; }
|
|
public int Y { get; set; }
|
|
public SchematicDrawing.Sz Sz { get; set; }
|
|
public SchematicDrawing.Orient Orient { get; set; }
|
|
public int LblX { get; set; }
|
|
public int LblY { get; set; }
|
|
public SchematicDrawing.Orient LblOrient { get; set; }
|
|
public int ValX { get; set; }
|
|
public int ValY { get; set; }
|
|
public double ValFact { get; set; }
|
|
public string ValFmt { get; set; }
|
|
public SchematicDrawing.Orient ValOrient { get; set; }
|
|
|
|
|
|
/// 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;
|
|
EmptyUp = 2.0f;
|
|
Format = "F3";
|
|
DrainValve = "VB1";
|
|
DrainTimeSec = 180;
|
|
BuoyancyTemp = 20.0f;
|
|
BuoyancyPress = 1.0f;
|
|
BuoyancyHumi = 40.0f;
|
|
Shape = SchematicDrawing.Shape.Tank;
|
|
}
|
|
|
|
public BalanceCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, {1}kg, empty={2}kg, emptyUp={3}kg, drainVlv={4}, drainTm={5}s, Com{6}, {7}Bd, {8}-bits, parity={9}, stopBits={10}, {11}",
|
|
Name, Capacity, Empty, EmptyUp, DrainValve, DrainTimeSec, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
|
}
|
|
}
|
|
}
|