Files
tbf/TBF/BenchControl/Danfoss/VLT2800/PumpCfg.cs
T

81 lines
2.8 KiB
C#

///
/// Copyright (c) 2013-2016 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.Danfoss.VLT2800
{
public class PumpCfg : ComponentCfgBase, Generic.IComponentCfg, SchematicDrawing.IDrawingItemCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PumpCfgCtrl(); }
///
/// Serialized parameters
///
public int Delay; // Delay of the pump function in [s] (affects the duration of transition sequence steps)
public PumpProtocol Protocol; // Modbus or FC with Siemens address
public int BitPosition;
public int BusAddress; // Modbus or FC address in range 1..247 (Modbus) or 1..31 (FC with Siemens address)
public int ComPortNr;
public int BaudRate;
public Parity Parity;
public int DataBits;
public StopBits StopBits;
/// 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 bool Flip { 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
PumpCfg()
{
Name = "Pump-Danfoss";
ParentName = string.Empty;
Delay = 1;
ComPortNr = 3;
/// Default protocol settings (the same as Danfoss VLT2800 factory settings)
Protocol = PumpProtocol.FC;
BusAddress = 1;
BaudRate = 9600;
DataBits = 8;
Parity = System.IO.Ports.Parity.Even; /// 'Parity.None' is the default value for Protocol = PumpProtocol.Modbus
StopBits = System.IO.Ports.StopBits.One;
Shape = SchematicDrawing.Shape.PumpFM;
}
public PumpCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
public string ToString(int i)
{
return string.Format("Name={0}, Delay={1}s, Protocol={2}, BusAddress={3}, Com{4}, {5}Bd, {6}-bits, parity={7}, stopBits={8}",
Name, Delay, Protocol, BusAddress, ComPortNr, BaudRate, DataBits, Parity, StopBits);
}
}
}