106 lines
3.5 KiB
C#
106 lines
3.5 KiB
C#
///
|
|
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using Config.Entities;
|
|
using SchematicDrawing;
|
|
using TBF.Rig.Generic;
|
|
|
|
namespace TBF.Rig.Uni.RegValve
|
|
{
|
|
public class RegValveCfg : ComponentCfgBase, IChildComponentCfg, IDrawingItemWithSetpoint
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RegValveCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Component> cmpntEntities)
|
|
{
|
|
return new RegValveCfgCtrl();
|
|
}
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int Idx1; /// 1..8
|
|
public ValveCategory Category; /// Feeding, Output or All
|
|
public int AdcValueClosed; /// 0..1023
|
|
public int AdcValueOpen; /// 0..1023
|
|
public int StableTimeMs; /// 200..1500 ms, step is 50 ms
|
|
public int FlowStableSec; /// 0..60 sec
|
|
public bool StoredPositionReuse; /// true = store and re-use previous regulation valve positions
|
|
public string SetpFormat { get; set; }
|
|
public Common.Unit SetpUnit { get; set; }
|
|
|
|
/// Schematic drawing info
|
|
public Shape Shape { get; set; }
|
|
public int X { get; set; }
|
|
public int Y { get; set; }
|
|
public Sz Sz { get; set; }
|
|
public Orient Orient { get; set; }
|
|
public bool Flip { get; set; }
|
|
public int LblX { get; set; }
|
|
public int LblY { get; set; }
|
|
public Orient LblOrient { get; set; }
|
|
public int SetpX { get; set; }
|
|
public int SetpY { get; set; }
|
|
public Orient SetpOrient { get; set; }
|
|
|
|
[XmlIgnore]
|
|
public IList<GNode> GNodes { get; set; }
|
|
|
|
/// <summary>
|
|
/// Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.
|
|
/// </summary>
|
|
public int StableTime { get { return (StableTimeMs - 200) / 50; } }
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
RegValveCfg()
|
|
{
|
|
GNodes = new List<GNode>();
|
|
}
|
|
|
|
public RegValveCfg(string name, IComponentFactory factory)
|
|
: this()
|
|
{
|
|
Shape = Shape.RegV;
|
|
Sz = Sz.M;
|
|
SetpFormat = "{0:F0} %";
|
|
SetpUnit = Common.Unit.Pct;
|
|
|
|
Name = name;
|
|
Factory = factory;
|
|
ParentName = "UniCB";
|
|
Category = ValveCategory.Output;
|
|
Idx1 = 1;
|
|
AdcValueClosed = 100;
|
|
AdcValueOpen = 500;
|
|
StableTimeMs = 500;
|
|
FlowStableSec = 5;
|
|
StoredPositionReuse = false;
|
|
|
|
LblX = 38;
|
|
SetpX = 38;
|
|
SetpY = 22;
|
|
}
|
|
|
|
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0} ({1}), Idx1={2}, Cat.={3}, ADC-Closed={4}, ADC-Open={5}, StabTm={6}ms, FlowStable={7}s, PosReuse={8}",
|
|
Name,
|
|
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
|
Idx1,
|
|
Category,
|
|
AdcValueClosed,
|
|
AdcValueOpen,
|
|
StableTimeMs,
|
|
FlowStableSec,
|
|
StoredPositionReuse);
|
|
}
|
|
}
|
|
}
|