2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2020-12-02 12:36:21 +00:00
|
|
|
|
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
using System.Collections.Generic;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using TBF.BenchControl.GenericDevices;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl
|
|
|
|
|
|
{
|
|
|
|
|
|
public class OutputPath
|
|
|
|
|
|
{
|
|
|
|
|
|
public int ItemNr;
|
|
|
|
|
|
public string Name;
|
|
|
|
|
|
public float Qfrom;
|
|
|
|
|
|
public float Qto;
|
|
|
|
|
|
public IFlowMeter FlowMeter;
|
2018-04-24 11:24:36 +00:00
|
|
|
|
public IRegulValve RegulValve;
|
2015-01-03 20:17:06 +00:00
|
|
|
|
public float PidCoef;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public IDiverter Diverter;
|
|
|
|
|
|
public ITempMeter TempDiv;
|
2018-10-22 16:14:47 +00:00
|
|
|
|
public IScaleOrTank Scale;
|
2018-04-24 11:24:36 +00:00
|
|
|
|
public IValve StartValve1;
|
|
|
|
|
|
public bool InvertSV1;
|
|
|
|
|
|
public IValve StartValve2;
|
|
|
|
|
|
public bool InvertSV2;
|
|
|
|
|
|
public int LagSV2;
|
|
|
|
|
|
public IValve StartValve3;
|
|
|
|
|
|
public bool InvertSV3;
|
|
|
|
|
|
public int LagSV3;
|
2020-12-02 12:42:03 +00:00
|
|
|
|
public float[] RegulValvesPct;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public IList<IValve> ValvesOpen;
|
|
|
|
|
|
public IList<IValve> ValvesClose;
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructor from name, the rest is empty
|
|
|
|
|
|
public OutputPath(string name, int itemNr)
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemNr = itemNr;
|
|
|
|
|
|
Name = name;
|
|
|
|
|
|
ValvesOpen = new List<IValve>();
|
|
|
|
|
|
ValvesClose = new List<IValve>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructor from data entity
|
2020-12-02 12:36:21 +00:00
|
|
|
|
public OutputPath(Config.Entities.OutputPath entity, IList<BenchControl.Generic.IComponent> components)
|
|
|
|
|
|
: this(entity.Name, entity.ItemNr)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2020-12-02 12:36:21 +00:00
|
|
|
|
Qfrom = entity.Qfrom;
|
|
|
|
|
|
Qto = entity.Qto;
|
|
|
|
|
|
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(entity.FlowMeter, components);
|
|
|
|
|
|
RegulValve = (IRegulValve)TbfComponents.FindComponent(entity.RegulValve, components);
|
|
|
|
|
|
PidCoef = entity.PidCoef;
|
|
|
|
|
|
Diverter = (IDiverter)TbfComponents.FindComponent(entity.Diverter, components);
|
|
|
|
|
|
TempDiv = (ITempMeter)TbfComponents.FindComponent(entity.TempDiv, components);
|
|
|
|
|
|
Scale = (IScaleOrTank)TbfComponents.FindComponent(entity.Scale, components);
|
2020-12-02 12:42:03 +00:00
|
|
|
|
RegulValvesPct = string.IsNullOrEmpty(entity.RegulValvesPct) ? new float[0] : Utils.GetRegulValvesPositions(entity.RegulValvesPct);
|
2020-12-02 12:36:21 +00:00
|
|
|
|
string[] svs = entity.StartValve != null ? entity.StartValve.Split(new char[] { '~' }) : new string[0];
|
2018-04-24 11:24:36 +00:00
|
|
|
|
int iTmp;
|
|
|
|
|
|
///
|
|
|
|
|
|
StartValve1 = (IValve)TbfComponents.FindComponent(((svs.Length > 0) ? svs[0] : string.Empty), components);
|
|
|
|
|
|
InvertSV1 = (svs.Length > 1) ? svs[1].Equals("i") : false;
|
|
|
|
|
|
StartValve2 = (IValve)TbfComponents.FindComponent(((svs.Length > 2) ? svs[2] : string.Empty), components);
|
|
|
|
|
|
InvertSV2 = (svs.Length > 3) ? svs[3].Equals("i") : false;
|
|
|
|
|
|
LagSV2 = (svs.Length > 4 && int.TryParse(svs[4], out iTmp)) ? iTmp : 0;
|
|
|
|
|
|
StartValve3 = (IValve)TbfComponents.FindComponent(((svs.Length > 5) ? svs[5] : string.Empty), components);
|
|
|
|
|
|
InvertSV3 = (svs.Length > 6) ? svs[6].Equals("i") : false;
|
|
|
|
|
|
LagSV3 = (svs.Length > 7 && int.TryParse(svs[7], out iTmp)) ? iTmp : 0;
|
|
|
|
|
|
|
2020-12-02 12:36:21 +00:00
|
|
|
|
string[] vOpen = entity.ValvesOpen.Split(new char[] { ';' });
|
2014-07-28 07:54:35 +00:00
|
|
|
|
ValvesOpen = new List<IValve>();
|
|
|
|
|
|
foreach (var vName in vOpen) ValvesOpen.Add((IValve)TbfComponents.FindComponent(vName, components));
|
|
|
|
|
|
|
2020-12-02 12:36:21 +00:00
|
|
|
|
string[] vClose = entity.ValvesClose.Split(new char[] { ';' });
|
2014-07-28 07:54:35 +00:00
|
|
|
|
ValvesClose = new List<IValve>();
|
|
|
|
|
|
foreach (var vName in vClose) ValvesClose.Add((IValve)TbfComponents.FindComponent(vName, components));
|
|
|
|
|
|
}
|
2016-04-14 10:29:14 +00:00
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return string.Format("{0} RV={1}, Flowm.={2}, Div.={3}, Scale={4}",
|
|
|
|
|
|
Name,
|
|
|
|
|
|
(RegulValve != null) ? RegulValve.Name : "---",
|
|
|
|
|
|
(FlowMeter != null) ? FlowMeter.Name : "---",
|
|
|
|
|
|
(Diverter != null) ? Diverter.Name : "---",
|
2017-03-28 21:47:32 +00:00
|
|
|
|
(Scale != null) ? Scale.Name : "---");
|
2016-04-14 10:29:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|