Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Ports;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.MettlerToledo.Standard
|
||||
{
|
||||
public enum ActionA1D
|
||||
{
|
||||
Zero,
|
||||
Tara,
|
||||
None,
|
||||
Count
|
||||
}
|
||||
|
||||
public class BalanceCfg : ComponentCfgBase, GenericDevices.IScaleCfg, GenericDevices.ITankDrainingCfg, IDrawingItemWithMeasuredVal
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(BalanceCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { 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 Evaporation { get; set; }
|
||||
public string DrainValve { get; set; }
|
||||
public int DrainTimeSec { get; set; }
|
||||
public ActionA1D ActionAfter1stDraining { get; set; }
|
||||
|
||||
/// 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 Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
|
||||
public int MsrdX { get; set; }
|
||||
public int MsrdY { get; set; }
|
||||
public Orient MsrdOrient { get; set; }
|
||||
public string MsrdFormat { get; set; }
|
||||
public Config.Unit MsrdUnit { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimLo { get { return 0; } set { } }
|
||||
[XmlIgnore]
|
||||
public double MsrdValLimHi { get { return Capacity; } set { Capacity = (float)value; } }
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
BalanceCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
}
|
||||
|
||||
public BalanceCfg(IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
Shape = Shape.Scale;
|
||||
Sz = Sz.M;
|
||||
MsrdFormat = "{0:F3}";
|
||||
MsrdUnit = Config.Unit.kg;
|
||||
|
||||
Factory = factory;
|
||||
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;
|
||||
DrainValve = "VB1";
|
||||
DrainTimeSec = 180;
|
||||
BuoyancyTemp = 20.0f;
|
||||
BuoyancyPress = 1.0f;
|
||||
BuoyancyHumi = 40.0f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user