69 lines
2.5 KiB
C#
69 lines
2.5 KiB
C#
///
|
|
/// Copyright (c) 2013-2016 Sensus Metering Systems
|
|
///
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Serialization;
|
|
using TBF.Rig.Generic;
|
|
|
|
namespace TBF.Rig.Elde.Valve
|
|
{
|
|
public class ValveCfg : ComponentCfgBase, IChildComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ValveCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new ValveCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int BitPosition; /// Bit-position
|
|
public ValveCategory Category; /// Feeding, Bench, Output or None
|
|
public int OpenCloseTime; /// Delay for SetValvesOp operations
|
|
public bool Inverted; /// The valve is inverted: 0=open, 1=closed
|
|
///
|
|
public string CoupledToName; /// Name of the coupled valve or null
|
|
public bool InvertCouple; /// The coupled valve has inverted position
|
|
public int LagOpening; /// Delay (referred to the master valve) when opening this valve in [s]
|
|
public int LagClosing; /// Delay (referred to the master valve) when closing this valve in [s]
|
|
/// Negative values of delays mean an earlier function of the coupled valve.
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
ValveCfg()
|
|
{
|
|
Name = "V";
|
|
ParentName = "CB";
|
|
BitPosition = 0;
|
|
Category = ValveCategory.None;
|
|
OpenCloseTime = 1;
|
|
Inverted = false;
|
|
CoupledToName = string.Empty;
|
|
InvertCouple = false;
|
|
LagOpening = 0;
|
|
LagClosing = 0;
|
|
}
|
|
|
|
public ValveCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0} ({1}), Bit={2}, Cat.={5}, Inv.={3}, Delay={4}s, CoupledTo={6}, Inv.Couple={7}, LagOpen={8}s, LagClose={9}s",
|
|
Name,
|
|
string.IsNullOrEmpty(ParentName) ? "-" : ParentName,
|
|
BitPosition,
|
|
Inverted ? "yes" : "no",
|
|
OpenCloseTime,
|
|
Category,
|
|
string.IsNullOrEmpty(CoupledToName) ? "-" : CoupledToName,
|
|
InvertCouple ? "yes" : "no",
|
|
LagOpening,
|
|
LagClosing);
|
|
}
|
|
}
|
|
}
|