97 lines
4.0 KiB
C#
97 lines
4.0 KiB
C#
///
|
|
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
|
|
///
|
|
using System.Collections.Generic;
|
|
using log4net;
|
|
using TBF.Rig.Generic;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.Rig.Dummy.RegValve
|
|
{
|
|
public class RegValve : ComponentBase, GenericDevices.IRegValve, SchematicDrawing.IDrawingItCmpnt
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegValve));
|
|
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
|
|
|
public readonly RegValveCfg RegulValveCfg;
|
|
public SchematicDrawing.IDrawingItem DrawingItem { get { return RegulValveCfg as SchematicDrawing.IDrawingItem; } }
|
|
|
|
public ValveCategory Category { get { return RegulValveCfg.Category; } }
|
|
public int Idx1 { get { return TBF.Rig.Uni.RegValveAnalog.RegValve.RVAnalogIdx + 1; } }
|
|
///
|
|
public bool IsCoax { get { return false; } }
|
|
|
|
public double Position { get { return 50.0; } }
|
|
|
|
|
|
IDictionary<double, double> dict;
|
|
public IDictionary<double, double> Dict { get { return dict; } }
|
|
|
|
|
|
public RegValve() { }
|
|
|
|
public RegValve(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
|
: base(cfg)
|
|
{
|
|
RegulValveCfg = cfg as RegValveCfg;
|
|
log.Warn(this.ToString());
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
dict = new Dictionary<double, double>();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Operation to set the water flow within tolerances
|
|
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
|
|
/// </summary>
|
|
/// <param name="flowMeter">Flowmeter component</param>
|
|
/// <param name="requiredFlowLo">Lower limit of the required flow [m3/h]</param>
|
|
/// <param name="requiredFlowHi">Higher limit of the required flow [m3/h]</param>
|
|
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
|
/// <param name="timeout">Timeout in [s]</param>
|
|
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
|
/// <returns>SetFlowOp instance</returns>
|
|
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
|
DoubleBox measuredFlow, int timeout, int delay)
|
|
{
|
|
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Operation to set the water flow within tolerances. Leave the measurement running.
|
|
/// Events: Event.None, Event.FlowReached, Event.FlowTimeOut
|
|
/// </summary>
|
|
/// <param name="flowMeter">Flowmeter component</param>
|
|
/// <param name="requiredFlowLo">Lower limit of the required flow [m3/h]</param>
|
|
/// <param name="requiredFlowHi">Higher limit of the required flow [m3/h]</param>
|
|
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
|
/// <param name="timeout">Timeout in [s]</param>
|
|
/// <returns>SetFlowOp instance</returns>
|
|
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
|
DoubleBox measuredFlow, int timeout, float filterConstant)
|
|
{
|
|
return new SetFlowOp(this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Operation to set the regulation valve to a required position
|
|
/// Events: Event.None
|
|
/// </summary>
|
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
|
/// <returns>SetPositionOp instance</returns>
|
|
public IOperation SetRegValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
|
{
|
|
return new SetRegValvePositionOp(this, pctLo, pctHi, timeoutMs);
|
|
}
|
|
|
|
public IOperation ChangeRegValvePositionOp(double timePulseSec)
|
|
{
|
|
return new ChangeRegValvePositionOp(this, timePulseSec);
|
|
}
|
|
}
|
|
}
|