65 lines
2.3 KiB
C#
65 lines
2.3 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
using System.Collections.Generic;
|
|
using TBF.BenchControl.GenericDevices;
|
|
|
|
namespace TBF.BenchControl
|
|
{
|
|
public class BenchPath
|
|
{
|
|
public int ItemNr;
|
|
public string Name;
|
|
public float Qfrom;
|
|
public float Qto;
|
|
public string Selector;
|
|
public ITempMeter TempMtrUp;
|
|
public ITempMeter TempMtrDown;
|
|
public IPressureMeter PressMtrUp;
|
|
public IPressureMeter PressMtrDown;
|
|
public IPressureMeter PressMtrDelta;
|
|
public IValve StopBFValve;
|
|
public IList<IValve> ValvesOpen;
|
|
public IList<IValve> ValvesClose;
|
|
|
|
/// Constructor from name, the rest is empty
|
|
public BenchPath(string name, int itemNr)
|
|
{
|
|
ItemNr = itemNr;
|
|
Name = name;
|
|
ValvesOpen = new List<IValve>();
|
|
ValvesClose = new List<IValve>();
|
|
}
|
|
|
|
/// Constructor from data entity
|
|
public BenchPath(Config.Entities.BenchPath entity, IList<BenchControl.Generic.IComponent> components)
|
|
: this(entity.Name, entity.ItemNr)
|
|
{
|
|
Qfrom = entity.Qfrom;
|
|
Qto = entity.Qto;
|
|
Selector = entity.Selector;
|
|
TempMtrUp = TbfComponents.FindComponent(entity.TempMtrUp, components) as ITempMeter;
|
|
TempMtrDown = TbfComponents.FindComponent(entity.TempMtrDown, components) as ITempMeter;
|
|
PressMtrUp = TbfComponents.FindComponent(entity.PressMtrUp, components) as IPressureMeter;
|
|
PressMtrDown = TbfComponents.FindComponent(entity.PressMtrDown, components) as IPressureMeter;
|
|
PressMtrDelta = TbfComponents.FindComponent(entity.PressMtrDelta, components) as IPressureMeter;
|
|
StopBFValve = TbfComponents.FindComponent(entity.StopBFValve, components) as IValve;
|
|
|
|
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
|
ValvesOpen = new List<IValve>();
|
|
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
|
|
|
|
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
|
ValvesClose = new List<IValve>();
|
|
foreach (var vName in vClose) ValvesClose.Add((IValve)TbfComponents.FindComponent(vName, components));
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} StopBF={1}",
|
|
Name,
|
|
(StopBFValve != null) ? StopBFValve.Name : "---");
|
|
}
|
|
}
|
|
}
|