70 lines
1.8 KiB
C#
70 lines
1.8 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; } }
|
|
|
|
public string LevelMeasurement;
|
|
|
|
|
|
/// 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;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, {1}l, empty={2}l, drainVlv={3}, drainTm={4}s",
|
|
Name, Capacity, Empty, DrainValve, DrainTimeSec);
|
|
}
|
|
}
|
|
}
|