- possibility to invert valves (UI as well as the functionality)

- UI prepared for the usage of valve delays
This commit is contained in:
Milan Hanajik
2014-09-06 07:37:27 +02:00
parent 74a6800f9e
commit 6933442e76
7 changed files with 122 additions and 60 deletions
@@ -6,10 +6,13 @@ namespace TBF.BenchControl.Elde.Valve
{
public class ValveCfg : ComponentCfgBase, IChildComponentCfg
{
public int BitPosition; /// Bit-position
public int OpenCloseTime; /// Delay for SetValvesOp operations
public int BitPosition; /// Bit-position
public ValveCategory Category; /// None, Feeding, Bench or Output
public bool Inverted; /// The valve is inverted: 0=open, 1=closed
///
public string CoupledToName; /// Name of the coupled valve or null
public bool Invert; /// The coupled valve has inverted position
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.
@@ -17,37 +20,43 @@ namespace TBF.BenchControl.Elde.Valve
/// Parameterless constructor
public ValveCfg()
{
OpenCloseTime = 1; /// Defaut value
}
/// Constructor 1
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition,
ValveCategory category, string coupledToName, bool invert, int lagOpening, int lagClosing)
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition, bool inverted, int openCloseTime,
ValveCategory category, string coupledToName, bool invertCouple, int lagOpening, int lagClosing)
: base(factory, name, parentName)
{
this.OpenCloseTime = openCloseTime;
this.BitPosition = bitPosition;
this.Category = category;
this.Inverted = inverted;
this.CoupledToName = coupledToName;
this.Invert = invert;
this.InvertCouple = invertCouple;
this.LagOpening = lagOpening;
this.LagClosing = lagClosing;
}
/// Constructor 2 without CoupledTo valve
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition, ValveCategory category)
: this(factory, name, parentName, bitPosition, category, null, false, 0, 0)
public ValveCfg(IComponentFactory factory, string name, string parentName, int bitPosition, bool inverted, int openCloseTime, ValveCategory category)
: this(factory, name, parentName, bitPosition, inverted, openCloseTime, category, null, false, 0, 0)
{
}
public IComponentCfg Clone()
{
return new ValveCfg(Factory, Name, ParentName, BitPosition, Category, CoupledToName, Invert, LagOpening, LagClosing);
return new ValveCfg(Factory, Name, ParentName, BitPosition, Inverted, OpenCloseTime, Category, CoupledToName, InvertCouple, LagOpening, LagClosing);
}
public string ToString(int i)
{
return string.Format("bit={0}, cat={1}, coupledTo={2}, invert={3}, lagOpen={4}, lagClose={5}",
return string.Format("bit={0}, inv.={1}, delay={2}s, cat.={3}, coupledTo={4}, inv.Couple={5}, lagOpen={6}s, lagClose={7}s",
BitPosition,
(Inverted ? "yes" : "no"),
OpenCloseTime,
Category,
(string.IsNullOrEmpty(CoupledToName) ? "---" : CoupledToName),
(Invert ? "yes" : "no"),
(InvertCouple ? "yes" : "no"),
LagOpening,
LagClosing);
}