61 lines
2.0 KiB
C#
61 lines
2.0 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 ITempMeter TempIn;
|
|
public ITempMeter TempOut;
|
|
public IPressureMeter PressIn;
|
|
public IPressureMeter PressOut;
|
|
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;
|
|
TempIn = TbfComponents.FindComponent(entity.TempIn, components) as ITempMeter;
|
|
TempOut = TbfComponents.FindComponent(entity.TempOut, components) as ITempMeter;
|
|
PressIn = TbfComponents.FindComponent(entity.PressIn, components) as IPressureMeter;
|
|
PressOut = TbfComponents.FindComponent(entity.PressOut, 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 : "---");
|
|
}
|
|
}
|
|
}
|