85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
///
|
|
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using Common;
|
|
using Config.Entities;
|
|
using SchematicDrawing;
|
|
using TBF.Rig.Generic;
|
|
|
|
namespace TBF.Rig.Modbus.PumpFM.DanfossVLT
|
|
{
|
|
public class PumpCfg : ComponentCfgBase, IChildComponentCfg, IRouteBasedDrawingItem, IDrawingItemWithSetpoint
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PumpCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new PumpCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int BitNr { get; set; }
|
|
public bool Inverted { get; set; } /// When true the pump function is inverted: 0 = on, 1 = off
|
|
public int Delay; /// Delay of the pump function in [s] (affects the duration of transition sequence steps)
|
|
public byte ModbusAddress; /// 1..254
|
|
|
|
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 SetpX { get; set; }
|
|
public int SetpY { get; set; }
|
|
public Orient SetpOrient { get; set; }
|
|
public string SetpFormat { get; set; }
|
|
public Unit SetpUnit { get; set; }
|
|
|
|
[XmlIgnore]
|
|
public IList<GNode> GNodes { get; set; }
|
|
[XmlIgnore]
|
|
public IList<GEdge> EdgesToSet { get; set; }
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
PumpCfg()
|
|
{
|
|
GNodes = new List<GNode>();
|
|
EdgesToSet = new List<GEdge>();
|
|
}
|
|
|
|
public PumpCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
Shape = Shape.PumpFM;
|
|
Sz = Sz.M;
|
|
SetpFormat = "{0:F0} %";
|
|
SetpUnit = Unit.Pct;
|
|
|
|
Name = "P";
|
|
Factory = factory;
|
|
ParentName = "Modbus";
|
|
BitNr = 0;
|
|
Delay = 1;
|
|
ModbusAddress = 49;
|
|
}
|
|
|
|
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("name={0} bit={1} delay={2} addr={3} parent={4}",
|
|
Name,
|
|
BitNr,
|
|
Delay,
|
|
ModbusAddress,
|
|
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
|
|
}
|
|
}
|
|
}
|