80 lines
2.7 KiB
C#
80 lines
2.7 KiB
C#
///
|
|
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.Various.TankWithLevelMsrmnt
|
|
{
|
|
public class TankCfg : ComponentCfgBase, Generic.IComponentCfg, GenericDevices.ITankDrainingCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TankCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl() { return new TankCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
|
|
/// Max. water mass in 'kg' or volume in 'l'
|
|
private float capacity;
|
|
public float Capacity { get { return capacity; } set { capacity = value; } }
|
|
|
|
/// Mass threshold for 'Tank is empty' in 'kg' (or volume in 'l')
|
|
private float empty;
|
|
public float Empty { get { return empty; } set { empty = value; } }
|
|
|
|
private string drainValve;
|
|
public string DrainValve { get { return drainValve; } set { drainValve = value; } }
|
|
|
|
private int drainTimeSec;
|
|
public int DrainTimeSec { get { return drainTimeSec; } set { drainTimeSec = value; } }
|
|
|
|
private string evaporation;
|
|
public string Evaporation { get { return evaporation; } set { evaporation = value; } }
|
|
|
|
public string DrainValve2;
|
|
public string LevelMeasurement; /// Name of a level measurement component, 'Various.ManualLevelMsrmnt' is used when left empty.
|
|
public float ThldLevel1; /// Threshold level 1 (used by WaitTankContainsMoreThenOp) in l or kg
|
|
public float ThldLevel2; /// Threshold level 2 - ' ' -
|
|
public float ThldLevel3; /// Threshold level 3 - ' ' -
|
|
public float ThldLevel4; /// Threshold level 4 - ' ' -
|
|
public string CalibrationTable; /// Path name of a calibration table in CSV format (column1 = height[mm], column2 = volume[l])
|
|
/// Volume calculation using formulas for std. tanks in Level2Volume() is used when left empty.
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
TankCfg()
|
|
{
|
|
}
|
|
|
|
public TankCfg(string name, IComponentFactory factory)
|
|
: this()
|
|
{
|
|
Name = name;
|
|
Factory = factory;
|
|
ParentName = string.Empty;
|
|
InitializeAll();
|
|
}
|
|
|
|
public string ComponentName { get { return Name; } }
|
|
|
|
public void InitializeAll()
|
|
{
|
|
Capacity = 2000.0f;
|
|
Empty = 20.0f;
|
|
DrainValve = "VB1";
|
|
DrainTimeSec = 180;
|
|
LevelMeasurement = string.Empty;
|
|
CalibrationTable = string.Empty;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Capacity={0}l, empty={1}l, drainValve={2}, drainTime={3}s, levelMsrmnt={4}, cal.table={5}",
|
|
Capacity, Empty, DrainValve, DrainTimeSec, LevelMeasurement, CalibrationTable);
|
|
}
|
|
}
|
|
}
|