TankWithLevelMsrmnt.Tank : shared static properties and ResetstaticProperties( ) eliminated.
This commit is contained in:
@@ -45,20 +45,6 @@ namespace TBF.Rig.Various.TankWithLevelMsrmnt
|
||||
IOperation readLevelOp;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of balances via static fields and methods
|
||||
/// </summary>
|
||||
static int nextTankIdx = 0;
|
||||
public static new void ResetStaticProperties()
|
||||
{
|
||||
nextTankIdx = 0;
|
||||
}
|
||||
public static int TanksCount { get { return nextTankIdx; } }
|
||||
public static Tank[] Tanks;
|
||||
///
|
||||
protected int tankNr; /// 0-based tank number
|
||||
public int ScaleNr { get { return tankNr + 1; } } /// Formula fits CEVAK config., TODO: Make ScaleNr a configurable parameter
|
||||
///
|
||||
public double Capacity { get { return tankCfg.Capacity; } }
|
||||
public int EmptyTimeSec { get { return tankCfg.DrainTimeSec; } }
|
||||
public IValve DrainValve2 { get { return drainValve2; } }
|
||||
@@ -70,37 +56,15 @@ namespace TBF.Rig.Various.TankWithLevelMsrmnt
|
||||
public double Volume { get { return Level2Volume(levelMeter.Level); } }
|
||||
|
||||
|
||||
public Tank()
|
||||
{
|
||||
}
|
||||
public Tank() { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="cfg">Balance properties</param>
|
||||
/// <param components="cfg">A list of components loaded so far</param>
|
||||
public Tank(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
tankCfg = cfg as TankCfg;
|
||||
|
||||
tankNr = nextTankIdx++;
|
||||
///
|
||||
if (Tanks == null || Tanks.Length < nextTankIdx)
|
||||
{
|
||||
Tank[] tanksSoFar = Tanks;
|
||||
Tanks = new Tank[nextTankIdx];
|
||||
if (tanksSoFar != null) for (int i = 0; i < tanksSoFar.Length; i++) Tanks[i] = tanksSoFar[i];
|
||||
Tanks[nextTankIdx - 1] = this;
|
||||
}
|
||||
|
||||
currentOp = CurrentOp.None;
|
||||
levelBox = new DoubleBox();
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// IDevice interface (required to call base and initialize 'DrainValve')
|
||||
///
|
||||
@@ -108,6 +72,9 @@ namespace TBF.Rig.Various.TankWithLevelMsrmnt
|
||||
{
|
||||
base.Initalize();
|
||||
|
||||
currentOp = CurrentOp.None;
|
||||
levelBox = new DoubleBox();
|
||||
|
||||
drainValve2 = TbfComponents.FindComponent(tankCfg.DrainValve2) as IValve;
|
||||
|
||||
manualLevelMeter = new Various.ManualLevelMsrmnt.ManualLevelMsrmnt();
|
||||
|
||||
Reference in New Issue
Block a user