Refactorization : IRegValve.position is double, Uni.RegValve.adcChannel properly initialized, ver. 3.1.1603
This commit is contained in:
@@ -614,7 +614,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
/// <param name="valveMode">Valve regulation mode, see the enum</param>
|
/// <param name="valveMode">Valve regulation mode, see the enum</param>
|
||||||
/// <param name="valveValue">Target position or target frequency or pulse duration</param>
|
/// <param name="valveValue">Target position or target frequency or pulse duration</param>
|
||||||
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
||||||
public void ValveMove(int valveNo, RegulValveMode valveMode, float[] valveValue, int stableTime)
|
public void ValveMove(int valveNo, RegulValveMode valveMode, double[] valveValue, int stableTime)
|
||||||
{
|
{
|
||||||
controlCom.ValveMove(valveNo, valveMode, valveValue, stableTime);
|
controlCom.ValveMove(valveNo, valveMode, valveValue, stableTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
///
|
///
|
||||||
int regulValveNo;
|
int regulValveNo;
|
||||||
RegulValveMode regulValveMode;
|
RegulValveMode regulValveMode;
|
||||||
float[] regulValveValue;
|
double[] regulValveValue;
|
||||||
|
|
||||||
Random rand;
|
Random rand;
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
/// <param name="regulValveMode">???</param>
|
/// <param name="regulValveMode">???</param>
|
||||||
/// <param name="regulValveValue">???</param>
|
/// <param name="regulValveValue">???</param>
|
||||||
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
||||||
public void ValveMove(int regulValveNo, RegulValveMode regulValveMode, float[] regulValveValue, int stableTime)
|
public void ValveMove(int regulValveNo, RegulValveMode regulValveMode, double[] regulValveValue, int stableTime)
|
||||||
{
|
{
|
||||||
log.InfoFormat("ValveMove({0}, {1}, [{2},{3}], {4})", regulValveNo, regulValveMode, regulValveValue[0], regulValveValue[1], stableTime);
|
log.InfoFormat("ValveMove({0}, {1}, [{2},{3}], {4})", regulValveNo, regulValveMode, regulValveValue[0], regulValveValue[1], stableTime);
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
switch (regulValveMode)
|
switch (regulValveMode)
|
||||||
{
|
{
|
||||||
case RegulValveMode.TargetFrequency:
|
case RegulValveMode.TargetFrequency:
|
||||||
float targetFlow = ((regulValveValue[0] + regulValveValue[1]) / 2.0f) * (Qnom / 2000.0f);
|
double targetFlow = ((regulValveValue[0] + regulValveValue[1]) / 2.0) * (Qnom / 2000.0);
|
||||||
TestBenchSim.UpdateSimFlow(targetFlow);
|
TestBenchSim.UpdateSimFlow(targetFlow);
|
||||||
|
|
||||||
//if (referenceFreq < valveValue[0]) referenceFreq += ((float)rand.Next(20) + 10.0f) / 2.0f;
|
//if (referenceFreq < valveValue[0]) referenceFreq += ((float)rand.Next(20) + 10.0f) / 2.0f;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
/// <param name="valveMode">???</param>
|
/// <param name="valveMode">???</param>
|
||||||
/// <param name="valveValue">???</param>
|
/// <param name="valveValue">???</param>
|
||||||
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
/// <param name="stableTime">Stabilization time when setting the flow: 0=200ms, step 50ms, max. 1.5 sec.</param>
|
||||||
void ValveMove(int valveNo, RegulValveMode valveMode, float[] valveValue, int stableTime);
|
void ValveMove(int valveNo, RegulValveMode valveMode, double[] valveValue, int stableTime);
|
||||||
|
|
||||||
void RunDeviceBefore();
|
void RunDeviceBefore();
|
||||||
void RunDeviceAfter();
|
void RunDeviceAfter();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
|
|
||||||
/// Set by the constructor
|
/// Set by the constructor
|
||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly IRegulValve regulValve;
|
readonly IRegValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly int regulValveStableTime;
|
readonly int regulValveStableTime;
|
||||||
readonly int flowMeterNr;
|
readonly int flowMeterNr;
|
||||||
@@ -208,13 +208,13 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
if (regulValve.IsCoax)
|
if (regulValve.IsCoax)
|
||||||
{
|
{
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)((freqLo + freqHi) / 2), (float)((freqLo + freqHi) / 2) },
|
new double[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||||
regulValveStableTime);
|
regulValveStableTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)freqLo, (float)freqHi },
|
new double[2] { freqLo, freqHi },
|
||||||
regulValveStableTime);
|
regulValveStableTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -754,10 +754,10 @@ namespace TBF.BenchControl.ControlBoard.Legacy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="targetFlow">Target flow [m3/h]</param>
|
/// <param name="targetFlow">Target flow [m3/h]</param>
|
||||||
/// <param name="nominalFlow">Nominal flow of the path [m3/h]</param>
|
/// <param name="nominalFlow">Nominal flow of the path [m3/h]</param>
|
||||||
public static void UpdateSimFlow(float targetFlow)
|
public static void UpdateSimFlow(double targetFlow)
|
||||||
{
|
{
|
||||||
float A = 0.7f; /// higher value -> slower regulation
|
double A = 0.7; /// higher value -> slower regulation
|
||||||
float B = 1.0f - A;
|
double B = 1.0 - A;
|
||||||
|
|
||||||
switch (regulValveNo)
|
switch (regulValveNo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,7 +90,11 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
|||||||
/// A/D converters: Feedback from RV-s and diverters
|
/// A/D converters: Feedback from RV-s and diverters
|
||||||
for (int i = 0; i < Const.ADCsCount; i++) /// Byte 25 .. 56
|
for (int i = 0; i < Const.ADCsCount; i++) /// Byte 25 .. 56
|
||||||
{
|
{
|
||||||
AnalogInput[15 - i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
#if DEBUG
|
||||||
|
AnalogInput[Const.ADCsCount - 1 - i] = (short)(11 * (15 - i));
|
||||||
|
#else
|
||||||
|
AnalogInput[Const.ADCsCount - 1 - i] = GetInt16(data, offs + (int)Poz.Analogy + 2 * i);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Groch temperature meters
|
/// Groch temperature meters
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace TBF.BenchControl.ControlBoard.Uni
|
|||||||
|
|
||||||
OutputPath devices;
|
OutputPath devices;
|
||||||
IFlowMeter flowMeter { get { return devices.FlowMeter; } }
|
IFlowMeter flowMeter { get { return devices.FlowMeter; } }
|
||||||
IRegulValve regValve { get { return devices.RegValve; } }
|
IRegValve regValve { get { return devices.RegValve; } }
|
||||||
IDiverter diverter { get { return devices.Diverter; } }
|
IDiverter diverter { get { return devices.Diverter; } }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2017 Sensus Metering Systems
|
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using log4net;
|
using log4net;
|
||||||
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
|
|
||||||
/// Set by the constructor
|
/// Set by the constructor
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly float timePulseSec;
|
readonly double timePulseSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set required water flow.
|
/// Set required water flow.
|
||||||
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public ChangeRegulValvePositionOp(RegulValve regulValve, float timePulseSec)
|
public ChangeRegulValvePositionOp(RegulValve regulValve, double timePulseSec)
|
||||||
{
|
{
|
||||||
this.regulValve = regulValve as RegulValve;
|
this.regulValve = regulValve as RegulValve;
|
||||||
if (this.regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
if (this.regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.Dummy.RegulValve
|
namespace TBF.BenchControl.Dummy.RegulValve
|
||||||
{
|
{
|
||||||
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, SchematicDrawing.IDrawingItCmpnt
|
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegValve, SchematicDrawing.IDrawingItCmpnt
|
||||||
{
|
{
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
||||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||||
@@ -20,11 +20,11 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
///
|
///
|
||||||
public bool IsCoax { get { return false; } }
|
public bool IsCoax { get { return false; } }
|
||||||
|
|
||||||
public float Position { get { return 50.0f; } }
|
public double Position { get { return 50.0; } }
|
||||||
|
|
||||||
|
|
||||||
IDictionary<double, float> dict;
|
IDictionary<double, double> dict;
|
||||||
public IDictionary<double, float> Dict { get { return dict; } }
|
public IDictionary<double, double> Dict { get { return dict; } }
|
||||||
|
|
||||||
|
|
||||||
public RegulValve()
|
public RegulValve()
|
||||||
@@ -35,7 +35,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
: base(cfg)
|
: base(cfg)
|
||||||
{
|
{
|
||||||
RegulValveCfg = cfg as RegulValveCfg;
|
RegulValveCfg = cfg as RegulValveCfg;
|
||||||
dict = new Dictionary<double, float>();
|
dict = new Dictionary<double, double>();
|
||||||
|
|
||||||
log.Warn(this.ToString());
|
log.Warn(this.ToString());
|
||||||
}
|
}
|
||||||
@@ -86,12 +86,12 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
||||||
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||||
{
|
{
|
||||||
return new SetRegulValvePositionOp(this, pctLo, pctHi, timeoutMs);
|
return new SetRegulValvePositionOp(this, pctLo, pctHi, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||||
{
|
{
|
||||||
return new ChangeRegulValvePositionOp(this, timePulseSec);
|
return new ChangeRegulValvePositionOp(this, timePulseSec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetFlowOp(IRegulValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(IRegValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox measuredFlow, int timeout, bool leaveMeasurementRunning)
|
DoubleBox measuredFlow, int timeout, bool leaveMeasurementRunning)
|
||||||
{
|
{
|
||||||
this.regulValve = regulValve as RegulValve;
|
this.regulValve = regulValve as RegulValve;
|
||||||
@@ -72,7 +72,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// Set required water flow - Do not leave the measurement running.
|
/// Set required water flow - Do not leave the measurement running.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
public SetFlowOp(IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||||
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// Set required water flow - No timeout.
|
/// Set required water flow - No timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
public SetFlowOp(IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||||
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
: this(regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
return string.Format("SetRegulValvePositionOp({0},{1},{2})", regulValve.Name, posLoPct, posHiPct);
|
return string.Format("SetRegulValvePositionOp({0},{1},{2})", regulValve.Name, posLoPct, posHiPct);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int CoaxValveNr = 7; /// Coax. valve has number 7
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Internal states of this operation
|
/// Internal states of this operation
|
||||||
///
|
///
|
||||||
@@ -32,8 +30,8 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
|
|
||||||
/// Set by the constructor
|
/// Set by the constructor
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly float posLoPct;
|
readonly double posLoPct;
|
||||||
readonly float posHiPct;
|
readonly double posHiPct;
|
||||||
readonly int timeout;
|
readonly int timeout;
|
||||||
|
|
||||||
/// Process values
|
/// Process values
|
||||||
@@ -51,7 +49,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetRegulValvePositionOp(RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
public SetRegulValvePositionOp(RegulValve regulValve, double posLoPct, double posHiPct, int timeout)
|
||||||
{
|
{
|
||||||
this.regulValve = regulValve as RegulValve;
|
this.regulValve = regulValve as RegulValve;
|
||||||
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
if (regulValve == null) throw new ArgumentNullException("regValve is null or not Elde");
|
||||||
@@ -68,7 +66,7 @@ namespace TBF.BenchControl.Dummy.RegulValve
|
|||||||
/// Set required water flow - no timeout.
|
/// Set required water flow - no timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetRegulValvePositionOp(RegulValve regValve, float posLoPct, float posHiPct)
|
public SetRegulValvePositionOp(RegulValve regValve, double posLoPct, double posHiPct)
|
||||||
: this(regValve, posLoPct, posHiPct, int.MaxValue)
|
: this(regValve, posLoPct, posHiPct, int.MaxValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float timePulseSec;
|
readonly double timePulseSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set required water flow.
|
/// Set required water flow.
|
||||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public ChangeRegulValvePositionOp(TBF.BenchControl.ControlBoard.IControlBoard cb, RegulValve rv, float timePulseSec)
|
public ChangeRegulValvePositionOp(TBF.BenchControl.ControlBoard.IControlBoard cb, RegulValve rv, double timePulseSec)
|
||||||
{
|
{
|
||||||
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
TBF.BenchControl.ControlBoard.Legacy.RegulValveMode.PulseWidth,
|
TBF.BenchControl.ControlBoard.Legacy.RegulValveMode.PulseWidth,
|
||||||
new float[2] { timePulseSec, timePulseSec },
|
new double[2] { timePulseSec, timePulseSec },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.Elde.RegulValve
|
namespace TBF.BenchControl.Elde.RegulValve
|
||||||
{
|
{
|
||||||
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegulValve, IDrawingItCmpntWithSetpoint
|
public class RegulValve : ComponentBase, IDevice, GenericDevices.IRegValve, IDrawingItCmpntWithSetpoint
|
||||||
{
|
{
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
||||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||||
@@ -20,8 +20,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
public readonly RegulValveCfg RegulValveCfg;
|
public readonly RegulValveCfg RegulValveCfg;
|
||||||
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
|
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
|
||||||
|
|
||||||
IDictionary<double, float> dict;
|
IDictionary<double, double> dict;
|
||||||
public IDictionary<double, float> Dict { get { return dict; } }
|
public IDictionary<double, double> Dict { get { return dict; } }
|
||||||
|
|
||||||
public readonly CBoard ControlBoard;
|
public readonly CBoard ControlBoard;
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
///
|
///
|
||||||
public bool IsCoax { get { return false; } }
|
public bool IsCoax { get { return false; } }
|
||||||
///
|
///
|
||||||
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
|
public double Position { get { return ControlBoard.RValvePosition(Idx1); } }
|
||||||
///
|
///
|
||||||
public double SetpointVal
|
public double SetpointVal
|
||||||
{
|
{
|
||||||
@@ -81,13 +81,13 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
}
|
}
|
||||||
else if (args.Command == CfgChangeCmd.RVOpenStep)
|
else if (args.Command == CfgChangeCmd.RVOpenStep)
|
||||||
{
|
{
|
||||||
ControlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { 2.0f, 2.0f }, StableTime);
|
ControlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new double[2] { 2.0, 2.0 }, StableTime);
|
||||||
// TODO: avoid conflicts
|
// TODO: avoid conflicts
|
||||||
// TOTEST
|
// TOTEST
|
||||||
}
|
}
|
||||||
else if (args.Command == CfgChangeCmd.RVCloseStep)
|
else if (args.Command == CfgChangeCmd.RVCloseStep)
|
||||||
{
|
{
|
||||||
ControlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new float[2] { -2.0f, -2.0f }, StableTime);
|
ControlBoard.ValveMove(Idx1, RegulValveMode.PulseWidth, new double[2] { -2.0, -2.0 }, StableTime);
|
||||||
// TODO: avoid conflicts
|
// TODO: avoid conflicts
|
||||||
// TOTEST
|
// TOTEST
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||||
|
|
||||||
this.dict = new Dictionary<double, float>();
|
this.dict = new Dictionary<double, double>();
|
||||||
|
|
||||||
#if GENESIS
|
#if GENESIS
|
||||||
adcChannel = (Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2);
|
adcChannel = (Idx1 < 6) ? (Idx1 - 1) : (Idx1 - 2);
|
||||||
@@ -199,12 +199,12 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
||||||
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||||
{
|
{
|
||||||
return new SetRegulValvePositionOp(ControlBoard, this, pctLo, pctHi, timeoutMs);
|
return new SetRegulValvePositionOp(ControlBoard, this, pctLo, pctHi, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||||
{
|
{
|
||||||
return new ChangeRegulValvePositionOp(ControlBoard, this, timePulseSec);
|
return new ChangeRegulValvePositionOp(ControlBoard, this, timePulseSec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
|
|
||||||
double currentReqFlowLo;
|
double currentReqFlowLo;
|
||||||
double currentReqFlowHi;
|
double currentReqFlowHi;
|
||||||
float targetPositionLo;
|
double targetPositionLo;
|
||||||
float targetPositionHi;
|
double targetPositionHi;
|
||||||
|
|
||||||
int startTime;
|
int startTime;
|
||||||
int expireTime;
|
int expireTime;
|
||||||
@@ -78,7 +78,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regulValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
@@ -114,7 +114,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// Set required water flow - Do not leave the measurement running.
|
/// Set required water flow - Do not leave the measurement running.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox flowbox, bool reTryCmds, int timeout)
|
DoubleBox flowbox, bool reTryCmds, int timeout)
|
||||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, timeout, false)
|
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, timeout, false)
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// Set required water flow - No timeout.
|
/// Set required water flow - No timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox flowbox, bool reTryCmds)
|
DoubleBox flowbox, bool reTryCmds)
|
||||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
||||||
{
|
{
|
||||||
@@ -137,9 +137,9 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <param name="positionLo">Target valve position low limit (output)</param>
|
/// <param name="positionLo">Target valve position low limit (output)</param>
|
||||||
/// <param name="positionHi">Target valve position high limit (output)</param>
|
/// <param name="positionHi">Target valve position high limit (output)</param>
|
||||||
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
||||||
bool FetchTargetPosition(double avgReqFlow, out float positionLo, out float positionHi)
|
bool FetchTargetPosition(double avgReqFlow, out double positionLo, out double positionHi)
|
||||||
{
|
{
|
||||||
float targetPosition;
|
double targetPosition;
|
||||||
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
||||||
{
|
{
|
||||||
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
||||||
@@ -154,11 +154,11 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreTargetPosition(double avgReqFlow, float actPosition)
|
void StoreTargetPosition(double avgReqFlow, double actPosition)
|
||||||
{
|
{
|
||||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||||
{
|
{
|
||||||
regulValve.Dict.Add(new KeyValuePair<double, float>(avgReqFlow, actPosition));
|
regulValve.Dict.Add(new KeyValuePair<double, double>(avgReqFlow, actPosition));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
{
|
{
|
||||||
/// Issues the appropriate ValveMove(...) command
|
/// Issues the appropriate ValveMove(...) command
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { targetPositionLo, targetPositionHi },
|
new double[2] { targetPositionLo, targetPositionHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.SettingPosition;
|
opState = OpState.SettingPosition;
|
||||||
@@ -290,7 +290,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
{
|
{
|
||||||
/// Repeat appropriate ValveMove(...) command
|
/// Repeat appropriate ValveMove(...) command
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { targetPositionLo, targetPositionHi },
|
new double[2] { targetPositionLo, targetPositionHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
log.InfoFormat("SetFlowOp: ValveMove({0}, Position, {1}, {2}, {3})",
|
log.InfoFormat("SetFlowOp: ValveMove({0}, Position, {1}, {2}, {3})",
|
||||||
@@ -335,7 +335,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)freqLo, (float)freqHi },
|
new double[2] { freqLo, freqHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.ValveMoveToFlow3;
|
opState = OpState.ValveMoveToFlow3;
|
||||||
@@ -367,7 +367,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)freqLo, (float)freqHi },
|
new double[2] { (float)freqLo, (float)freqHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
log.InfoFormat("SetFlowOp: ValveMove({0}, Frequency, {1}, {2}, {3})",
|
log.InfoFormat("SetFlowOp: ValveMove({0}, Frequency, {1}, {2}, {3})",
|
||||||
@@ -396,7 +396,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
|
|
||||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||||
{
|
{
|
||||||
float storedPosition;
|
double storedPosition;
|
||||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||||
{
|
{
|
||||||
/// update the stored valve position
|
/// update the stored valve position
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float posLoPct;
|
readonly double posLoPct;
|
||||||
readonly float posHiPct;
|
readonly double posHiPct;
|
||||||
readonly int timeout;
|
readonly int timeout;
|
||||||
|
|
||||||
/// Process values
|
/// Process values
|
||||||
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, double posLoPct, double posHiPct, int timeout)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
this.controlBoard = controlBoard;
|
this.controlBoard = controlBoard;
|
||||||
@@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
/// Set required water flow - no timeout.
|
/// Set required water flow - no timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, double posLoPct, double posHiPct)
|
||||||
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ namespace TBF.BenchControl.Elde.RegulValve
|
|||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.TargetPosition,
|
RegulValveMode.TargetPosition,
|
||||||
new float[2] { posLoPct, posHiPct },
|
new double[2] { posLoPct, posHiPct },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
opState = OpState.CheckState;
|
opState = OpState.CheckState;
|
||||||
return Event.None;
|
return Event.None;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float timePulseSec;
|
readonly double timePulseSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set required water flow.
|
/// Set required water flow.
|
||||||
@@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public ChangeRegulValvePositionOp(CBoard controlBoard, RegulValve _regulValve, float timePulseSec)
|
public ChangeRegulValvePositionOp(CBoard controlBoard, RegulValve _regulValve, double timePulseSec)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
this.controlBoard = controlBoard;
|
this.controlBoard = controlBoard;
|
||||||
@@ -55,7 +55,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.PulseWidth,
|
RegulValveMode.PulseWidth,
|
||||||
new float[2] { timePulseSec, timePulseSec },
|
new double[2] { timePulseSec, timePulseSec },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.Elde.RegulValveCoax
|
namespace TBF.BenchControl.Elde.RegulValveCoax
|
||||||
{
|
{
|
||||||
public class RegulValve : ComponentBase, GenericDevices.IRegulValve, IDrawingItCmpntWithSetpoint
|
public class RegulValve : ComponentBase, GenericDevices.IRegValve, IDrawingItCmpntWithSetpoint
|
||||||
{
|
{
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValve));
|
||||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||||
@@ -19,8 +19,8 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
public readonly RegulValveCfg RegulValveCfg;
|
public readonly RegulValveCfg RegulValveCfg;
|
||||||
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
|
public IDrawingItem DrawingItem { get { return RegulValveCfg as IDrawingItem; } }
|
||||||
|
|
||||||
IDictionary<double, float> dict;
|
IDictionary<double, double> dict;
|
||||||
public IDictionary<double, float> Dict { get { return dict; } }
|
public IDictionary<double, double> Dict { get { return dict; } }
|
||||||
|
|
||||||
public readonly CBoard ControlBoard;
|
public readonly CBoard ControlBoard;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
///
|
///
|
||||||
public bool IsCoax { get { return true; } }
|
public bool IsCoax { get { return true; } }
|
||||||
///
|
///
|
||||||
public float Position { get { return ControlBoard.RValvePosition(Idx1); } }
|
public double Position { get { return ControlBoard.RValvePosition(Idx1); } }
|
||||||
///
|
///
|
||||||
public double SetpointVal
|
public double SetpointVal
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
ControlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||||
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||||
|
|
||||||
this.dict = new Dictionary<double, float>();
|
this.dict = new Dictionary<double, double>();
|
||||||
|
|
||||||
log.Warn(this.ToString());
|
log.Warn(this.ToString());
|
||||||
}
|
}
|
||||||
@@ -107,12 +107,12 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
||||||
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||||
{
|
{
|
||||||
return new SetRegulValvePositionOp(ControlBoard, this, pctLo, pctHi, timeoutMs);
|
return new SetRegulValvePositionOp(ControlBoard, this, pctLo, pctHi, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||||
{
|
{
|
||||||
return new ChangeRegulValvePositionOp(ControlBoard, this, timePulseSec);
|
return new ChangeRegulValvePositionOp(ControlBoard, this, timePulseSec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
|
|
||||||
double currentReqFlowLo;
|
double currentReqFlowLo;
|
||||||
double currentReqFlowHi;
|
double currentReqFlowHi;
|
||||||
float targetPositionLo;
|
double targetPositionLo;
|
||||||
float targetPositionHi;
|
double targetPositionHi;
|
||||||
|
|
||||||
int expireTime;
|
int expireTime;
|
||||||
DoubleBox measuredFlow;
|
DoubleBox measuredFlow;
|
||||||
@@ -77,7 +77,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve _regulValve, IFlowMeter flowMeter,
|
public SetFlowOp(CBoard controlBoard, IRegValve _regulValve, IFlowMeter flowMeter,
|
||||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||||
bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||||
{
|
{
|
||||||
@@ -121,7 +121,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// Set required water flow - Do not leave the measurement running.
|
/// Set required water flow - Do not leave the measurement running.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
||||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, timeout, false)
|
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, timeout, false)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// Set required water flow - No timeout.
|
/// Set required water flow - No timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||||
DoubleBox measuredFlow, bool reTryCmds)
|
DoubleBox measuredFlow, bool reTryCmds)
|
||||||
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, int.MaxValue, false)
|
: this(controlBoard, regValve, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, reTryCmds, int.MaxValue, false)
|
||||||
{
|
{
|
||||||
@@ -144,9 +144,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// <param name="positionLo">Target valve position low limit (output)</param>
|
/// <param name="positionLo">Target valve position low limit (output)</param>
|
||||||
/// <param name="positionHi">Target valve position high limit (output)</param>
|
/// <param name="positionHi">Target valve position high limit (output)</param>
|
||||||
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
||||||
bool FetchTargetPosition(double avgReqFlow, out float positionLo, out float positionHi)
|
bool FetchTargetPosition(double avgReqFlow, out double positionLo, out double positionHi)
|
||||||
{
|
{
|
||||||
float targetPosition;
|
double targetPosition;
|
||||||
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
||||||
{
|
{
|
||||||
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
||||||
@@ -161,11 +161,11 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreTargetPosition(double avgReqFlow, float actPosition)
|
void StoreTargetPosition(double avgReqFlow, double actPosition)
|
||||||
{
|
{
|
||||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||||
{
|
{
|
||||||
regulValve.Dict.Add(new KeyValuePair<double, float>(avgReqFlow, actPosition));
|
regulValve.Dict.Add(new KeyValuePair<double, double>(avgReqFlow, actPosition));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
{
|
{
|
||||||
/// Issues the appropriate ValveMove(...) command
|
/// Issues the appropriate ValveMove(...) command
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
new double[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.SettingPosition;
|
opState = OpState.SettingPosition;
|
||||||
@@ -308,7 +308,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
{
|
{
|
||||||
/// Repeat appropriate ValveMove(...) command
|
/// Repeat appropriate ValveMove(...) command
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
new double[2] { (targetPositionLo + targetPositionHi) / 2, (targetPositionLo + targetPositionHi) / 2 },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
log.InfoFormat(" Run() ValveMove({0}, Position, {1}, {2}, {3})",
|
log.InfoFormat(" Run() ValveMove({0}, Position, {1}, {2}, {3})",
|
||||||
@@ -355,7 +355,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)((freqLo + freqHi) / 2), (float)((freqLo + freqHi) / 2) },
|
new double[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
log.WarnFormat(" Run() ValveMove({0}, Freq., {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
log.WarnFormat(" Run() ValveMove({0}, Freq., {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
||||||
regulValveNr, (freqLo + freqHi) / 2, (freqLo + freqHi) / 2,
|
regulValveNr, (freqLo + freqHi) / 2, (freqLo + freqHi) / 2,
|
||||||
@@ -387,7 +387,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)((freqLo + freqHi) / 2), (float)((freqLo + freqHi) / 2) },
|
new double[2] { (freqLo + freqHi) / 2, (freqLo + freqHi) / 2 },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
log.WarnFormat(" Run() ValveMove({0}, Frequency, {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
log.WarnFormat(" Run() ValveMove({0}, Frequency, {1}, {2}, {3}) flowMtr#={4} TARGET: flowLo={5} flowHi={6}",
|
||||||
@@ -417,7 +417,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
{
|
{
|
||||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||||
{
|
{
|
||||||
float storedPosition;
|
double storedPosition;
|
||||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||||
{
|
{
|
||||||
/// update the stored valve position
|
/// update the stored valve position
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly RegulValve regulValve;
|
readonly RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float posLoPct;
|
readonly double posLoPct;
|
||||||
readonly float posHiPct;
|
readonly double posHiPct;
|
||||||
readonly int timeout;
|
readonly int timeout;
|
||||||
|
|
||||||
/// Process values
|
/// Process values
|
||||||
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, float posLoPct, float posHiPct, int timeout)
|
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regulValve, double posLoPct, double posHiPct, int timeout)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
this.controlBoard = controlBoard;
|
this.controlBoard = controlBoard;
|
||||||
@@ -75,7 +75,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
/// Set required water flow - no timeout.
|
/// Set required water flow - no timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, float posLoPct, float posHiPct)
|
public SetRegulValvePositionOp(CBoard controlBoard, RegulValve regValve, double posLoPct, double posHiPct)
|
||||||
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
: this(controlBoard, regValve, posLoPct, posHiPct, int.MaxValue)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
|
|||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.TargetPosition,
|
RegulValveMode.TargetPosition,
|
||||||
new float[2] { posLoPct, posHiPct },
|
new double[2] { posLoPct, posHiPct },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
opState = OpState.CheckState;
|
opState = OpState.CheckState;
|
||||||
return Event.None;
|
return Event.None;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly Elde.RegulValve.RegulValve regulValve;
|
readonly Elde.RegulValve.RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float timePulseSec;
|
readonly double timePulseSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set required water flow.
|
/// Set required water flow.
|
||||||
@@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public ChangeRegulValvePositionOp(CBoard controlBoard, IRegulValve _regulValve, float timePulseSec)
|
public ChangeRegulValvePositionOp(CBoard controlBoard, IRegValve _regulValve, float timePulseSec)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
this.controlBoard = controlBoard;
|
this.controlBoard = controlBoard;
|
||||||
@@ -50,12 +50,12 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <summary>Start this operation</summary>
|
/// <summary>Start this operation</summary>
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
double positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||||
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.PulseWidth,
|
RegulValveMode.PulseWidth,
|
||||||
new float[2] { timePulseSec, timePulseSec },
|
new double[2] { timePulseSec, timePulseSec },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.Elde.RegulValveTandem
|
namespace TBF.BenchControl.Elde.RegulValveTandem
|
||||||
{
|
{
|
||||||
public class RegulValveTandem : ComponentBase, GenericDevices.IRegulValve
|
public class RegulValveTandem : ComponentBase, GenericDevices.IRegValve
|
||||||
{
|
{
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValveTandem));
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegulValveTandem));
|
||||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||||
|
|
||||||
public readonly RegulValveTandemCfg RegulValveTandemCfg;
|
public readonly RegulValveTandemCfg RegulValveTandemCfg;
|
||||||
|
|
||||||
IDictionary<double, float> dict;
|
IDictionary<double, double> dict;
|
||||||
public IDictionary<double, float> Dict { get { return dict; } }
|
public IDictionary<double, double> Dict { get { return dict; } }
|
||||||
|
|
||||||
CBoard controlBoard { get { return regulValve.ControlBoard; } }
|
CBoard controlBoard { get { return regulValve.ControlBoard; } }
|
||||||
public ValveCategory Category { get { return RegulValveTandemCfg.Category; } }
|
public ValveCategory Category { get { return RegulValveTandemCfg.Category; } }
|
||||||
@@ -33,7 +33,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
///
|
///
|
||||||
public bool IsCoax { get { return false; } }
|
public bool IsCoax { get { return false; } }
|
||||||
|
|
||||||
public float Position
|
public double Position
|
||||||
{
|
{
|
||||||
get { return regulValve.Position; }
|
get { return regulValve.Position; }
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
fixedPctLo = Math.Max(0.0f, RegulValveTandemCfg.FixedRVPosition - 3.0f);
|
fixedPctLo = Math.Max(0.0f, RegulValveTandemCfg.FixedRVPosition - 3.0f);
|
||||||
fixedPctHi = Math.Min(100.0f, RegulValveTandemCfg.FixedRVPosition + 3.0f);
|
fixedPctHi = Math.Min(100.0f, RegulValveTandemCfg.FixedRVPosition + 3.0f);
|
||||||
|
|
||||||
this.dict = new Dictionary<double, float>();
|
this.dict = new Dictionary<double, double>();
|
||||||
|
|
||||||
log.Warn(this.ToString());
|
log.Warn(this.ToString());
|
||||||
}
|
}
|
||||||
@@ -103,12 +103,12 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
||||||
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly Elde.RegulValve.RegulValve fixedRV;
|
readonly Elde.RegulValve.RegulValve fixedRV;
|
||||||
readonly int fixedRVNr;
|
readonly int fixedRVNr;
|
||||||
readonly float fixedPctLo;
|
readonly double fixedPctLo;
|
||||||
readonly float fixedPctHi;
|
readonly double fixedPctHi;
|
||||||
readonly int flowMeterNr;
|
readonly int flowMeterNr;
|
||||||
readonly double finalReqFlowLo;
|
readonly double finalReqFlowLo;
|
||||||
readonly double finalReqFlowHi;
|
readonly double finalReqFlowHi;
|
||||||
@@ -51,9 +51,9 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
OpState opState;
|
OpState opState;
|
||||||
|
|
||||||
double currentReqFlowLo;
|
double currentReqFlowLo;
|
||||||
double currentReqFlowHi;
|
double currentReqFlowHi;
|
||||||
float targetPositionLo;
|
double targetPositionLo;
|
||||||
float targetPositionHi;
|
double targetPositionHi;
|
||||||
|
|
||||||
int expireTime;
|
int expireTime;
|
||||||
DoubleBox measuredFlow;
|
DoubleBox measuredFlow;
|
||||||
@@ -76,7 +76,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regV, IRegulValve fxdRV, float fxdPctLo, float fxdPctHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||||
int timeout, bool leaveMeasurementRunning)
|
int timeout, bool leaveMeasurementRunning)
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// Set required water flow - Do not leave the measurement running.
|
/// Set required water flow - Do not leave the measurement running.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// Set required water flow - No timeout.
|
/// Set required water flow - No timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(CBoard controlBoard, IRegulValve regValve, IRegulValve fixedRV, float fixedPctLo, float fixedPctHi,
|
public SetFlowOp(CBoard controlBoard, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||||
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
: this(controlBoard, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||||
{
|
{
|
||||||
@@ -149,28 +149,28 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <param name="positionLo">Target valve position low limit (output)</param>
|
/// <param name="positionLo">Target valve position low limit (output)</param>
|
||||||
/// <param name="positionHi">Target valve position high limit (output)</param>
|
/// <param name="positionHi">Target valve position high limit (output)</param>
|
||||||
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
||||||
bool FetchTargetPosition(double avgReqFlow, out float positionLo, out float positionHi)
|
bool FetchTargetPosition(double avgReqFlow, out double positionLo, out double positionHi)
|
||||||
{
|
{
|
||||||
float targetPosition;
|
double targetPosition;
|
||||||
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
if (regulValve.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
||||||
{
|
{
|
||||||
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
positionLo = Math.Max(targetPosition * 0.95, 0.0);
|
||||||
positionHi = Math.Min(targetPosition * 1.05f, 100.0f);
|
positionHi = Math.Min(targetPosition * 1.05, 100.0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
positionLo = 0.0f;
|
positionLo = 0.0;
|
||||||
positionHi = 0.0f;
|
positionHi = 0.0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreTargetPosition(double avgReqFlow, float actPosition)
|
void StoreTargetPosition(double avgReqFlow, double actPosition)
|
||||||
{
|
{
|
||||||
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
if (!regulValve.Dict.ContainsKey(reqFlowAve))
|
||||||
{
|
{
|
||||||
regulValve.Dict.Add(new KeyValuePair<double, float>(avgReqFlow, actPosition));
|
regulValve.Dict.Add(new KeyValuePair<double, double>(avgReqFlow, actPosition));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// Done once, issues an appropriate ValveMove(...) command
|
/// Done once, issues an appropriate ValveMove(...) command
|
||||||
///
|
///
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { targetPositionLo, targetPositionHi },
|
new double[2] { targetPositionLo, targetPositionHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.SettingPosition;
|
opState = OpState.SettingPosition;
|
||||||
@@ -271,7 +271,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// Done once, issues an appropriate ValveMove(...) command
|
/// Done once, issues an appropriate ValveMove(...) command
|
||||||
///
|
///
|
||||||
controlBoard.ValveMove(fixedRVNr, RegulValveMode.TargetPosition,
|
controlBoard.ValveMove(fixedRVNr, RegulValveMode.TargetPosition,
|
||||||
new float[2] { fixedPctLo, fixedPctHi },
|
new double[2] { fixedPctLo, fixedPctHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.SettingPosition_FixedRV;
|
opState = OpState.SettingPosition_FixedRV;
|
||||||
@@ -304,7 +304,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
double freqLo = 2000.0 * currentReqFlowLo / nominalFlow;
|
||||||
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
double freqHi = 2000.0 * currentReqFlowHi / nominalFlow;
|
||||||
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
controlBoard.ValveMove(regulValveNr, RegulValveMode.TargetFrequency,
|
||||||
new float[2] { (float)freqLo, (float)freqHi },
|
new double[2] { freqLo, freqHi },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
|
|
||||||
opState = OpState.SettingFlow;
|
opState = OpState.SettingFlow;
|
||||||
@@ -321,7 +321,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
{
|
{
|
||||||
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
if (regulValve.RegulValveCfg.StoredPositionReuse)
|
||||||
{
|
{
|
||||||
float storedPosition;
|
double storedPosition;
|
||||||
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
|
||||||
{
|
{
|
||||||
/// update the stored valve position
|
/// update the stored valve position
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
readonly CBoard controlBoard;
|
readonly CBoard controlBoard;
|
||||||
readonly Elde.RegulValve.RegulValve regulValve;
|
readonly Elde.RegulValve.RegulValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float posLoPct;
|
readonly double posLoPct;
|
||||||
readonly float posHiPct;
|
readonly double posHiPct;
|
||||||
readonly int timeout;
|
readonly int timeout;
|
||||||
|
|
||||||
/// Process values
|
/// Process values
|
||||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetRegulValvePositionOp(CBoard controlBoard, IRegulValve regV, float posLoPct, float posHiPct, int timeout)
|
public SetRegulValvePositionOp(CBoard controlBoard, IRegValve regV, float posLoPct, float posHiPct, int timeout)
|
||||||
{
|
{
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
this.controlBoard = controlBoard;
|
this.controlBoard = controlBoard;
|
||||||
@@ -94,7 +94,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.TargetPosition,
|
RegulValveMode.TargetPosition,
|
||||||
new float[2] { posLoPct, posHiPct },
|
new double[2] { posLoPct, posHiPct },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
return Event.None;
|
return Event.None;
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
|
|||||||
{
|
{
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
RegulValveMode.Stop,
|
RegulValveMode.Stop,
|
||||||
new float[2] { posLoPct, posHiPct },
|
new double[2] { posLoPct, posHiPct },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace TBF.BenchControl
|
|||||||
public float Qfrom;
|
public float Qfrom;
|
||||||
public float Qto;
|
public float Qto;
|
||||||
public IValve Pump; /// pump to use with this path or null
|
public IValve Pump; /// pump to use with this path or null
|
||||||
public IList<IRegulValve> RegulValves;
|
public IList<IRegValve> RegulValves;
|
||||||
public IList<float> RegulValvesPct;
|
public IList<float> RegulValvesPct;
|
||||||
public IList<IValve> ValvesOpen; /// a list of valves to open or null
|
public IList<IValve> ValvesOpen; /// a list of valves to open or null
|
||||||
public IList<IValve> ValvesClose; /// a list of valves to close or null
|
public IList<IValve> ValvesClose; /// a list of valves to close or null
|
||||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl
|
|||||||
Name = name;
|
Name = name;
|
||||||
ValvesOpen = new List<IValve>();
|
ValvesOpen = new List<IValve>();
|
||||||
ValvesClose = new List<IValve>();
|
ValvesClose = new List<IValve>();
|
||||||
RegulValves = new List<IRegulValve>();
|
RegulValves = new List<IRegValve>();
|
||||||
RegulValvesPct = new List<float>();
|
RegulValvesPct = new List<float>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ namespace TBF.BenchControl
|
|||||||
///
|
///
|
||||||
foreach (var cmpnt in components)
|
foreach (var cmpnt in components)
|
||||||
{
|
{
|
||||||
IRegulValve regValve = cmpnt as IRegulValve;
|
IRegValve regValve = cmpnt as IRegValve;
|
||||||
if (regValve != null && regValve.Category == TBF.BenchControl.ValveCategory.Feeding)
|
if (regValve != null && regValve.Category == TBF.BenchControl.ValveCategory.Feeding)
|
||||||
{
|
{
|
||||||
RegulValves.Add(regValve);
|
RegulValves.Add(regValve);
|
||||||
|
|||||||
+5
-5
@@ -8,7 +8,7 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.GenericDevices
|
namespace TBF.BenchControl.GenericDevices
|
||||||
{
|
{
|
||||||
public interface IRegulValve : IComponent
|
public interface IRegValve : IComponent
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All, Feeding, Bench, Output or None
|
/// All, Feeding, Bench, Output or None
|
||||||
@@ -23,12 +23,12 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Regulation valve position 0.0 .. 100.0 %
|
/// Regulation valve position 0.0 .. 100.0 %
|
||||||
/// </summary>
|
/// </summary>
|
||||||
float Position { get; }
|
double Position { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dictionary for position re-use
|
/// Dictionary for position re-use
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IDictionary<double, float> Dict { get; }
|
IDictionary<double, double> Dict { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Operation to set the water flow within tolerances
|
/// Operation to set the water flow within tolerances
|
||||||
@@ -65,7 +65,7 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// <param name="posHiPct">Higher limit of the required valve position in %</param>
|
/// <param name="posHiPct">Higher limit of the required valve position in %</param>
|
||||||
/// <param name="timeout">Timeout in [s]</param>
|
/// <param name="timeout">Timeout in [s]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
IOperation SetRegulValvePositionOp(float posLoPct, float posHiPct, int timeout);
|
IOperation SetRegulValvePositionOp(double posLoPct, double posHiPct, int timeout);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Operation to set the regulation valve to a required position
|
/// Operation to set the regulation valve to a required position
|
||||||
@@ -73,6 +73,6 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timePulseSec">Time pulse in sec</param>
|
/// <param name="timePulseSec">Time pulse in sec</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
IOperation ChangeRegulValvePositionOp(float timePulseSec);
|
IOperation ChangeRegulValvePositionOp(double timePulseSec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace TBF.BenchControl.Operations
|
|||||||
int rvCount;
|
int rvCount;
|
||||||
IOperation[] setRVPosOps;
|
IOperation[] setRVPosOps;
|
||||||
|
|
||||||
public SetAllRegulValvesOp(IList<IRegulValve> regulValves, IList<float> positions, int timeout)
|
public SetAllRegulValvesOp(IList<IRegValve> regulValves, IList<float> positions, int timeout)
|
||||||
{
|
{
|
||||||
if (regulValves == null || regulValves.Count == 0)
|
if (regulValves == null || regulValves.Count == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace TBF.BenchControl
|
|||||||
public float Qfrom;
|
public float Qfrom;
|
||||||
public float Qto;
|
public float Qto;
|
||||||
public IFlowMeter FlowMeter;
|
public IFlowMeter FlowMeter;
|
||||||
public IRegulValve RegValve;
|
public IRegValve RegValve;
|
||||||
public float PidCoef;
|
public float PidCoef;
|
||||||
public IDiverter Diverter;
|
public IDiverter Diverter;
|
||||||
public ITempMeter TempMtrDiv;
|
public ITempMeter TempMtrDiv;
|
||||||
@@ -45,7 +45,7 @@ namespace TBF.BenchControl
|
|||||||
Qfrom = outputPathEntity.Qfrom;
|
Qfrom = outputPathEntity.Qfrom;
|
||||||
Qto = outputPathEntity.Qto;
|
Qto = outputPathEntity.Qto;
|
||||||
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(outputPathEntity.FlowMeter, components);
|
FlowMeter = (IFlowMeter)TbfComponents.FindComponent(outputPathEntity.FlowMeter, components);
|
||||||
RegValve = (IRegulValve)TbfComponents.FindComponent(outputPathEntity.RegValve, components);
|
RegValve = (IRegValve)TbfComponents.FindComponent(outputPathEntity.RegValve, components);
|
||||||
PidCoef = outputPathEntity.PidCoef;
|
PidCoef = outputPathEntity.PidCoef;
|
||||||
Diverter = (IDiverter)TbfComponents.FindComponent(outputPathEntity.Diverter, components);
|
Diverter = (IDiverter)TbfComponents.FindComponent(outputPathEntity.Diverter, components);
|
||||||
TempMtrDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempMtrDiv, components);
|
TempMtrDiv = (ITempMeter)TbfComponents.FindComponent(outputPathEntity.TempMtrDiv, components);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
/// Global static variables set only once.
|
/// Global static variables set only once.
|
||||||
///------------------------------------------------------------
|
///------------------------------------------------------------
|
||||||
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
|
public static IList<IFlowMeter> FlowMeters; /// list of reference flowmeters
|
||||||
public static IList<IRegulValve> RegulValves; /// list of regulation valves
|
public static IList<IRegValve> RegulValves; /// list of regulation valves
|
||||||
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
|
public static IList<IPumpFM> PumpsWithFM; /// list of FM controlled pumps
|
||||||
public static IList<IWaterMeter> WaterMeters; /// list of water meters
|
public static IList<IWaterMeter> WaterMeters; /// list of water meters
|
||||||
public static IList<ICamera> Cameras; /// list of cameras
|
public static IList<ICamera> Cameras; /// list of cameras
|
||||||
@@ -951,7 +951,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected Event SetFlowEtc(Test test, IFlowMeter flowMeter, IRegulValve regulValve, IValve pump, IValve stopBFValve, IList<IOperation> extraOperations, bool doNotWait)
|
protected Event SetFlowEtc(Test test, IFlowMeter flowMeter, IRegValve regulValve, IValve pump, IValve stopBFValve, IList<IOperation> extraOperations, bool doNotWait)
|
||||||
{
|
{
|
||||||
IList<Event> e;
|
IList<Event> e;
|
||||||
Event retVal = Event.Done;
|
Event retVal = Event.Done;
|
||||||
@@ -1866,7 +1866,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
log.FatalFormat(" Output path: {0}", (outPath != null) ? outPath.ToString() : "none");
|
log.FatalFormat(" Output path: {0}", (outPath != null) ? outPath.ToString() : "none");
|
||||||
if (inPath.Pump is IPump) log.FatalFormat(" Pump power: {0}%", (inPath.Pump as IPump).Power);
|
if (inPath.Pump is IPump) log.FatalFormat(" Pump power: {0}%", (inPath.Pump as IPump).Power);
|
||||||
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
|
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
|
||||||
if (outPath.RegValve is IRegulValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegValve.Position);
|
if (outPath.RegValve is IRegValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegValve.Position);
|
||||||
log.FatalFormat(" Flow: {0}", RefFlow);
|
log.FatalFormat(" Flow: {0}", RefFlow);
|
||||||
log.FatalFormat(" Mass: {0}", Mass);
|
log.FatalFormat(" Mass: {0}", Mass);
|
||||||
log.FatalFormat(" Start mass: {0}", StartMass);
|
log.FatalFormat(" Start mass: {0}", StartMass);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace TBF.BenchControl
|
|||||||
|
|
||||||
ProcessData.IperlHeads = new List<TestMethods.iPerlCommunication.iPerlHead.IperlHead>();
|
ProcessData.IperlHeads = new List<TestMethods.iPerlCommunication.iPerlHead.IperlHead>();
|
||||||
SequenceBase.FlowMeters = new List<IFlowMeter>();
|
SequenceBase.FlowMeters = new List<IFlowMeter>();
|
||||||
SequenceBase.RegulValves = new List<IRegulValve>();
|
SequenceBase.RegulValves = new List<IRegValve>();
|
||||||
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
||||||
SequenceBase.WaterMeters = new List<IWaterMeter>();
|
SequenceBase.WaterMeters = new List<IWaterMeter>();
|
||||||
SequenceBase.Cameras = new List<ICamera>();
|
SequenceBase.Cameras = new List<ICamera>();
|
||||||
@@ -263,9 +263,9 @@ namespace TBF.BenchControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
|
if (cmpnt is IFlowMeter) SequenceBase.FlowMeters.Add(cmpnt as IFlowMeter);
|
||||||
if ((cmpnt is IRegulValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
|
if ((cmpnt is IRegValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
|
||||||
{
|
{
|
||||||
SequenceBase.RegulValves.Add(cmpnt as IRegulValve);
|
SequenceBase.RegulValves.Add(cmpnt as IRegValve);
|
||||||
}
|
}
|
||||||
if (cmpnt is IPumpFM && !(cmpnt is BuiltIn.PumpTandem.Pump)) SequenceBase.PumpsWithFM.Add(cmpnt as IPumpFM);
|
if (cmpnt is IPumpFM && !(cmpnt is BuiltIn.PumpTandem.Pump)) SequenceBase.PumpsWithFM.Add(cmpnt as IPumpFM);
|
||||||
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter);
|
if (cmpnt is IWaterMeter) SequenceBase.WaterMeters.Add(cmpnt as IWaterMeter);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace TBF.BenchControl.TestMethods.Endurance
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace TBF.BenchControl.TestMethods.FixedStart
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartAdvanced
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartDeferredEval
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollAdvanced
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollDeferredEval
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartMassCollection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ namespace TBF.BenchControl.TestMethods.FixedStartTankCollection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace TBF.BenchControl.TestMethods.FlowAdjustment
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStart
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(devices.RegValve is GenericDevices.IRegulValve))
|
if (!(devices.RegValve is GenericDevices.IRegValve))
|
||||||
{
|
{
|
||||||
/// Regulation valve is missing
|
/// Regulation valve is missing
|
||||||
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
message = string.Format("{0}: {1}", test.Name, Strings.Missing_a_regulation_valve);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
readonly TBF.BenchControl.ControlBoard.Legacy.CBoard controlBoard;
|
||||||
readonly RegValve regulValve;
|
readonly RegValve regulValve;
|
||||||
readonly int regulValveNr;
|
readonly int regulValveNr;
|
||||||
readonly float timePulseSec;
|
readonly double timePulseSec;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set required water flow.
|
/// Set required water flow.
|
||||||
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public ChangeRegulValvePositionOp(TBF.BenchControl.ControlBoard.IControlBoard cb, RegValve rv, float timePulseSec)
|
public ChangeRegulValvePositionOp(TBF.BenchControl.ControlBoard.IControlBoard cb, RegValve rv, double timePulseSec)
|
||||||
{
|
{
|
||||||
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
controlBoard = cb as TBF.BenchControl.ControlBoard.Legacy.CBoard;
|
||||||
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (controlBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
@@ -49,12 +49,12 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <summary>Start this operation</summary>
|
/// <summary>Start this operation</summary>
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
float positionPct = controlBoard.RValvePosition(regulValveNr);
|
double positionPct = controlBoard.RValvePosition(regulValveNr);
|
||||||
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
log.WarnFormat("RV#={0}, actPos={1}%", regulValveNr, positionPct.ToString("F1"));
|
||||||
|
|
||||||
controlBoard.ValveMove(regulValveNr,
|
controlBoard.ValveMove(regulValveNr,
|
||||||
TBF.BenchControl.ControlBoard.Legacy.RegulValveMode.PulseWidth,
|
TBF.BenchControl.ControlBoard.Legacy.RegulValveMode.PulseWidth,
|
||||||
new float[2] { timePulseSec, timePulseSec },
|
new double[2] { timePulseSec, timePulseSec },
|
||||||
regulValve.StableTime);
|
regulValve.StableTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using TBF.Boxes;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.Uni.RegValve
|
namespace TBF.BenchControl.Uni.RegValve
|
||||||
{
|
{
|
||||||
public class RegValve : ComponentBase, IDevice, GenericDevices.IRegulValve, IDrawingItCmpntWithSetpoint
|
public class RegValve : ComponentBase, IDevice, GenericDevices.IRegValve, IDrawingItCmpntWithSetpoint
|
||||||
{
|
{
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(RegValve));
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegValve));
|
||||||
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
public override string ToString() { return string.Format("RegulValve({0})", Cfg.ToString(1)); }
|
||||||
@@ -20,21 +20,31 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
public readonly RegValveCfg regValveCfg;
|
public readonly RegValveCfg regValveCfg;
|
||||||
public IDrawingItem DrawingItem { get { return regValveCfg as IDrawingItem; } }
|
public IDrawingItem DrawingItem { get { return regValveCfg as IDrawingItem; } }
|
||||||
|
|
||||||
IDictionary<double, float> dict;
|
IDictionary<double, double> dict;
|
||||||
public IDictionary<double, float> Dict { get { return dict; } }
|
public IDictionary<double, double> Dict { get { return dict; } }
|
||||||
|
|
||||||
readonly UniCB uniCB;
|
readonly UniCB uniCB;
|
||||||
|
readonly int adcChannel;
|
||||||
|
|
||||||
public ValveCategory Category { get { return regValveCfg.Category; } }
|
public ValveCategory Category { get { return regValveCfg.Category; } }
|
||||||
public int Idx1 { get { return regValveCfg.Idx1; } } /// 1..7
|
public int Idx1 { get { return regValveCfg.Idx1; } } /// 1 .. 8
|
||||||
public int DacValueClosed { get { return regValveCfg.AdcValueClosed; } } /// 0..1023
|
public int DacValueClosed { get { return regValveCfg.AdcValueClosed; } } /// 0 .. 1023
|
||||||
public int DacValueOpen { get { return regValveCfg.AdcValueOpen; } } /// 0..1023
|
public int DacValueOpen { get { return regValveCfg.AdcValueOpen; } } /// 0 .. 1023
|
||||||
public int StableTime { get { return regValveCfg.StableTime; } } /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
public int StableTime { get { return regValveCfg.StableTime; } } /// 0=200ms, step=50ms, max. 1500ms (max.26)
|
||||||
public int FlowStableSec { get { return regValveCfg.FlowStableSec; } } /// 0..60 sec
|
public int FlowStableSec { get { return regValveCfg.FlowStableSec; } } /// 0 .. 60 sec
|
||||||
///
|
///
|
||||||
public bool IsCoax { get { return false; } }
|
public bool IsCoax { get { return false; } }
|
||||||
///
|
|
||||||
public float Position { get { return Raw2Position(uniCB.AnalogInput(AdcChannel)); } } /// 0 .. 100%
|
/// 0.0 .. 100.0
|
||||||
|
public double Position
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int denominator = DacValueOpen - DacValueClosed;
|
||||||
|
if (denominator == 0) denominator = 1;
|
||||||
|
return 100.0 * Convert.ToDouble(uniCB.AnalogInput(adcChannel) - DacValueClosed) / Convert.ToDouble(denominator);
|
||||||
|
}
|
||||||
|
}
|
||||||
///
|
///
|
||||||
public double SetpointVal
|
public double SetpointVal
|
||||||
{
|
{
|
||||||
@@ -52,21 +62,8 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// TODO
|
/// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
public int AdcChannel;
|
|
||||||
public RegValveMode RegValveMode;
|
|
||||||
public RegValveState RegValveState;
|
public RegValveState RegValveState;
|
||||||
public float TargetRegValvePosition;
|
public double TargetRegValvePosition;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="analogInputValue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
float Raw2Position(Int16 analogInputValue)
|
|
||||||
{
|
|
||||||
/// TODO
|
|
||||||
return 0.5f; /// return 50%
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendCommand(Command command, int v1, int v2, int v3, StopDevs v4)
|
public void SendCommand(Command command, int v1, int v2, int v3, StopDevs v4)
|
||||||
{
|
{
|
||||||
@@ -131,7 +128,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
}
|
}
|
||||||
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
else if (args.Command == CfgChangeCmd.GetAdc1 || args.Command == CfgChangeCmd.GetAdc2)
|
||||||
{
|
{
|
||||||
short adcValue = uniCB.AnalogInput(AdcChannel);
|
short adcValue = uniCB.AnalogInput(adcChannel);
|
||||||
RegValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
RegValveCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(args.Command, Idx1, adcValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,11 +146,12 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
: base(cfg)
|
: base(cfg)
|
||||||
{
|
{
|
||||||
regValveCfg = cfg as RegValveCfg;
|
regValveCfg = cfg as RegValveCfg;
|
||||||
|
adcChannel = regValveCfg.Idx1 - 1;
|
||||||
|
|
||||||
this.uniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
|
this.uniCB = TbfComponents.FindComponent(cfg.ParentName, components) as UniCB;
|
||||||
if (this.uniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
|
if (this.uniCB == null) throw new Exception(string.Format("Cannot find {0} (a parent of {1})", cfg.ParentName, Name));
|
||||||
|
|
||||||
this.dict = new Dictionary<double, float>();
|
this.dict = new Dictionary<double, double>();
|
||||||
|
|
||||||
StartChangeHandler();
|
StartChangeHandler();
|
||||||
|
|
||||||
@@ -167,7 +165,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
public void Initialize() { }
|
public void Initialize() { }
|
||||||
public void RunDeviceBefore()
|
public void RunDeviceBefore()
|
||||||
{
|
{
|
||||||
Int16 adcValue = uniCB.Data.AnalogInput[AdcChannel];
|
Int16 adcValue = uniCB.AnalogInput(adcChannel);
|
||||||
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
|
Handlers.OnAdcChanged(this, new CmdResponseArgs(CfgChangeCmd.GetAdc, Idx1, adcValue));
|
||||||
}
|
}
|
||||||
public void RunDeviceAfter() { }
|
public void RunDeviceAfter() { }
|
||||||
@@ -214,12 +212,12 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Lower limit of the required valve position in [%]</param>
|
||||||
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
/// <param name="flowLo">Higher limit of the required valve position in [%]</param>
|
||||||
/// <returns>SetPositionOp instance</returns>
|
/// <returns>SetPositionOp instance</returns>
|
||||||
public IOperation SetRegulValvePositionOp(float pctLo, float pctHi, int timeoutMs)
|
public IOperation SetRegulValvePositionOp(double pctLo, double pctHi, int timeoutMs)
|
||||||
{
|
{
|
||||||
return new SetRegValvePositionOp(uniCB, this, pctLo, pctHi, timeoutMs);
|
return new SetRegValvePositionOp(uniCB, this, pctLo, pctHi, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOperation ChangeRegulValvePositionOp(float timePulseSec)
|
public IOperation ChangeRegulValvePositionOp(double timePulseSec)
|
||||||
{
|
{
|
||||||
return new ChangeRegulValvePositionOp(uniCB, this, timePulseSec);
|
return new ChangeRegulValvePositionOp(uniCB, this, timePulseSec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
|
|
||||||
double currentReqFlowLo;
|
double currentReqFlowLo;
|
||||||
double currentReqFlowHi;
|
double currentReqFlowHi;
|
||||||
float targetPositionLo;
|
double targetPositionLo;
|
||||||
float targetPositionHi;
|
double targetPositionHi;
|
||||||
|
|
||||||
int startTime;
|
int startTime;
|
||||||
int expireTime;
|
int expireTime;
|
||||||
@@ -78,7 +78,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||||
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
/// <param name="leaveMeasurementRunning">true = Leave the measurement running after op. stop</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
public SetFlowOp(UniCB cBoard, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||||
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
DoubleBox flowBox, bool reTryCmds, int timeout, bool leaveMeasurementRunning)
|
||||||
{
|
{
|
||||||
this.cBoard = cBoard;
|
this.cBoard = cBoard;
|
||||||
@@ -113,7 +113,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// Set required water flow - Do not leave the measurement running.
|
/// Set required water flow - Do not leave the measurement running.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
public SetFlowOp(UniCB cBoard, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||||
DoubleBox flowbox, bool reTryCmds, int timeout)
|
DoubleBox flowbox, bool reTryCmds, int timeout)
|
||||||
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, timeout, false)
|
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, timeout, false)
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// Set required water flow - No timeout.
|
/// Set required water flow - No timeout.
|
||||||
/// Events: FlowSet
|
/// Events: FlowSet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SetFlowOp(UniCB cBoard, IRegulValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
public SetFlowOp(UniCB cBoard, IRegValve regValve, IFlowMeter flowMeter, double targetFlowLo, double targetFlowHi,
|
||||||
DoubleBox flowbox, bool reTryCmds)
|
DoubleBox flowbox, bool reTryCmds)
|
||||||
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
: this(cBoard, regValve, flowMeter, targetFlowLo, targetFlowHi, flowbox, reTryCmds, int.MaxValue, false)
|
||||||
{
|
{
|
||||||
@@ -136,28 +136,28 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <param name="positionLo">Target valve position low limit (output)</param>
|
/// <param name="positionLo">Target valve position low limit (output)</param>
|
||||||
/// <param name="positionHi">Target valve position high limit (output)</param>
|
/// <param name="positionHi">Target valve position high limit (output)</param>
|
||||||
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
/// <returns>true when positions for the target flow are stored in the memory, otherwise return false</returns>
|
||||||
bool FetchTargetPosition(double avgReqFlow, out float positionLo, out float positionHi)
|
bool FetchTargetPosition(double avgReqFlow, out double positionLo, out double positionHi)
|
||||||
{
|
{
|
||||||
float targetPosition;
|
double targetPosition;
|
||||||
if (regV.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
if (regV.Dict.TryGetValue(avgReqFlow, out targetPosition))
|
||||||
{
|
{
|
||||||
positionLo = Math.Max(targetPosition * 0.95f, 0.0f);
|
positionLo = Math.Max(targetPosition * 0.95, 0.0);
|
||||||
positionHi = Math.Min(targetPosition * 1.05f, 100.0f);
|
positionHi = Math.Min(targetPosition * 1.05, 100.0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
positionLo = 0.0f;
|
positionLo = 0;
|
||||||
positionHi = 0.0f;
|
positionHi = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StoreTargetPosition(double avgReqFlow, float actPosition)
|
void StoreTargetPosition(double avgReqFlow, double actPosition)
|
||||||
{
|
{
|
||||||
if (!regV.Dict.ContainsKey(targetFlowAve))
|
if (!regV.Dict.ContainsKey(targetFlowAve))
|
||||||
{
|
{
|
||||||
regV.Dict.Add(new KeyValuePair<double, float>(avgReqFlow, actPosition));
|
regV.Dict.Add(new KeyValuePair<double, double>(avgReqFlow, actPosition));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public Event Run()
|
public Event Run()
|
||||||
{
|
{
|
||||||
float rvPosition = regV.Position;
|
double rvPosition = regV.Position;
|
||||||
double flowMtrFreq = flowMeter.ReadFrequency();
|
double flowMtrFreq = flowMeter.ReadFrequency();
|
||||||
double flow = flowMeter.ReadFlow();
|
double flow = flowMeter.ReadFlow();
|
||||||
|
|
||||||
@@ -387,12 +387,12 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
|
|
||||||
if (regV.regValveCfg.StoredPositionReuse)
|
if (regV.regValveCfg.StoredPositionReuse)
|
||||||
{
|
{
|
||||||
float storedPosition;
|
double storedPosition;
|
||||||
if (regV.Dict.TryGetValue(targetFlowAve, out storedPosition))
|
if (regV.Dict.TryGetValue(targetFlowAve, out storedPosition))
|
||||||
{
|
{
|
||||||
/// update the stored valve position
|
/// update the stored valve position
|
||||||
|
|
||||||
StoreTargetPosition(targetFlowAve, (rvPosition + storedPosition) / 2.0f);
|
StoreTargetPosition(targetFlowAve, (rvPosition + storedPosition) / 2.0);
|
||||||
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
|
||||||
regulValveNr, targetFlowAve, rvPosition.ToString("F1"), storedPosition);
|
regulValveNr, targetFlowAve, rvPosition.ToString("F1"), storedPosition);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
readonly UniCB cBoard;
|
readonly UniCB cBoard;
|
||||||
readonly RegValve regV;
|
readonly RegValve regV;
|
||||||
readonly int regValveNr;
|
readonly int regValveNr;
|
||||||
readonly float posLoPct;
|
readonly double posLoPct;
|
||||||
readonly float posHiPct;
|
readonly double posHiPct;
|
||||||
readonly int timeout;
|
readonly int timeout;
|
||||||
|
|
||||||
/// Process values
|
/// Process values
|
||||||
@@ -54,7 +54,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
/// <param name="posHiPct">Upper limit of the position to be achieved</param>
|
||||||
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
/// <param name="timeout">Timeout in sec. for setting the flow</param>
|
||||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||||
public SetRegValvePositionOp(UniCB cBoard, RegValve regValve, float posLoPct, float posHiPct, int timeout)
|
public SetRegValvePositionOp(UniCB cBoard, RegValve regValve, double posLoPct, double posHiPct, int timeout)
|
||||||
{
|
{
|
||||||
this.cBoard = cBoard;
|
this.cBoard = cBoard;
|
||||||
if (this.cBoard == null) throw new ArgumentNullException("ctrlBoard");
|
if (this.cBoard == null) throw new ArgumentNullException("ctrlBoard");
|
||||||
@@ -114,7 +114,7 @@ namespace TBF.BenchControl.Uni.RegValve
|
|||||||
|
|
||||||
if (positionReached) return Event.PositionReached;
|
if (positionReached) return Event.PositionReached;
|
||||||
|
|
||||||
float positionPct = regV.Position;
|
double positionPct = regV.Position;
|
||||||
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regValveNr, positionPct.ToString("F1"));
|
log.WarnFormat("Run(): RV#={0}, actPos={1}%", regValveNr, positionPct.ToString("F1"));
|
||||||
|
|
||||||
if (opState == OpState.CheckState)
|
if (opState == OpState.CheckState)
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("3.1.1602.0")]
|
[assembly: AssemblyVersion("3.1.1603.0")]
|
||||||
[assembly: AssemblyFileVersion("3.1.1602.0")]
|
[assembly: AssemblyFileVersion("3.1.1603.0")]
|
||||||
|
|||||||
+1
-1
@@ -1964,7 +1964,7 @@
|
|||||||
<Compile Include="BenchControl\GenericDevices\IDiverter.cs" />
|
<Compile Include="BenchControl\GenericDevices\IDiverter.cs" />
|
||||||
<Compile Include="BenchControl\GenericDevices\IFlowMeter.cs" />
|
<Compile Include="BenchControl\GenericDevices\IFlowMeter.cs" />
|
||||||
<Compile Include="BenchControl\GenericDevices\IPressureMeter.cs" />
|
<Compile Include="BenchControl\GenericDevices\IPressureMeter.cs" />
|
||||||
<Compile Include="BenchControl\GenericDevices\IRegulValve.cs" />
|
<Compile Include="BenchControl\GenericDevices\IRegValve.cs" />
|
||||||
<Compile Include="BenchControl\GenericDevices\ITempMeter.cs" />
|
<Compile Include="BenchControl\GenericDevices\ITempMeter.cs" />
|
||||||
<Compile Include="BenchControl\GenericDevices\IValve.cs" />
|
<Compile Include="BenchControl\GenericDevices\IValve.cs" />
|
||||||
<Compile Include="BenchControl\Generic\IComponent.cs" />
|
<Compile Include="BenchControl\Generic\IComponent.cs" />
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace TBF.UI.Bench.Paths
|
|||||||
|
|
||||||
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
||||||
public IList<IValve> Valves;
|
public IList<IValve> Valves;
|
||||||
public IList<IRegulValve> FeedingRegulValves;
|
public IList<IRegValve> FeedingRegulValves;
|
||||||
public ISession Session; /// One common DB session passed also to the controls inside tab pages
|
public ISession Session; /// One common DB session passed also to the controls inside tab pages
|
||||||
public IList<Procedure> Procedures;
|
public IList<Procedure> Procedures;
|
||||||
public IList<Test> Tests;
|
public IList<Test> Tests;
|
||||||
@@ -71,10 +71,10 @@ namespace TBF.UI.Bench.Paths
|
|||||||
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
||||||
|
|
||||||
/// Find all feeding regulation valves
|
/// Find all feeding regulation valves
|
||||||
FeedingRegulValves = new List<IRegulValve>();
|
FeedingRegulValves = new List<IRegValve>();
|
||||||
foreach (var cmpnt in TbfComponents)
|
foreach (var cmpnt in TbfComponents)
|
||||||
{
|
{
|
||||||
IRegulValve regValve = cmpnt as IRegulValve;
|
IRegValve regValve = cmpnt as IRegValve;
|
||||||
if (regValve != null && regValve.Category == TBF.BenchControl.ValveCategory.Feeding)
|
if (regValve != null && regValve.Category == TBF.BenchControl.ValveCategory.Feeding)
|
||||||
{
|
{
|
||||||
FeedingRegulValves.Add(regValve);
|
FeedingRegulValves.Add(regValve);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ namespace TBF.UI.Bench.Paths
|
|||||||
foreach (var cmpnt in parent.TbfComponents)
|
foreach (var cmpnt in parent.TbfComponents)
|
||||||
{
|
{
|
||||||
if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is IFlowMeter) flowMeterComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
if (cmpnt is IRegulValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is IRegValve) regulValveComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
if (cmpnt is IDiverter) diverterComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is IDiverter) diverterComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is ITempMeter) tempMeterDivComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
if (cmpnt is IScaleOrTank) scaleComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is IScaleOrTank) scaleComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace TBF.UI.Bench.Transitions
|
|||||||
/// Auxiliary public lists used also by user controls in tab pages
|
/// Auxiliary public lists used also by user controls in tab pages
|
||||||
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
||||||
public IList<IValve> Valves;
|
public IList<IValve> Valves;
|
||||||
public IList<IRegulValve> RegulValves;
|
public IList<IRegValve> RegulValves;
|
||||||
|
|
||||||
|
|
||||||
IList<ITabWithListViewEx> seqStepsCtrls;
|
IList<ITabWithListViewEx> seqStepsCtrls;
|
||||||
@@ -98,12 +98,12 @@ namespace TBF.UI.Bench.Transitions
|
|||||||
var cmptnEntities = Session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List();
|
var cmptnEntities = Session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List();
|
||||||
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(cmptnEntities);
|
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(cmptnEntities);
|
||||||
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
||||||
RegulValves = new List<IRegulValve>();
|
RegulValves = new List<IRegValve>();
|
||||||
foreach (var cmpnt in TbfComponents)
|
foreach (var cmpnt in TbfComponents)
|
||||||
{
|
{
|
||||||
if ((cmpnt is IRegulValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
|
if ((cmpnt is IRegValve) && !(cmpnt is BenchControl.Elde.RegulValveTandem.RegulValveTandem))
|
||||||
{
|
{
|
||||||
RegulValves.Add(cmpnt as IRegulValve);
|
RegulValves.Add(cmpnt as IRegValve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace TBF.UI.Procedures
|
|||||||
/// Auxiliary public lists used also by user controls in tab pages
|
/// Auxiliary public lists used also by user controls in tab pages
|
||||||
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
public IList<BenchControl.Generic.IComponent> TbfComponents;
|
||||||
public IList<IValve> Valves;
|
public IList<IValve> Valves;
|
||||||
public IList<IRegulValve> RegulValves;
|
public IList<IRegValve> RegulValves;
|
||||||
public IList<ITestMethod> TestMethods;
|
public IList<ITestMethod> TestMethods;
|
||||||
public IList<ITestMethod> UsedTestMethods;
|
public IList<ITestMethod> UsedTestMethods;
|
||||||
ComboBox methodCBox;
|
ComboBox methodCBox;
|
||||||
@@ -146,7 +146,7 @@ namespace TBF.UI.Procedures
|
|||||||
var cmptnEntities = session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List();
|
var cmptnEntities = session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List();
|
||||||
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(cmptnEntities);
|
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(cmptnEntities);
|
||||||
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
Valves = BenchControl.BuiltIn.ValveBase.GetMasterValves(TbfComponents);
|
||||||
RegulValves = new List<IRegulValve>();
|
RegulValves = new List<IRegValve>();
|
||||||
TestMethods = new List<ITestMethod>();
|
TestMethods = new List<ITestMethod>();
|
||||||
dataEntryComboBox.Items.Add("---");
|
dataEntryComboBox.Items.Add("---");
|
||||||
printer1ComboBox.Items.Add("---");
|
printer1ComboBox.Items.Add("---");
|
||||||
@@ -161,7 +161,7 @@ namespace TBF.UI.Procedures
|
|||||||
|
|
||||||
foreach (var cmpnt in TbfComponents)
|
foreach (var cmpnt in TbfComponents)
|
||||||
{
|
{
|
||||||
if (cmpnt is IRegulValve) RegulValves.Add(cmpnt as IRegulValve);
|
if (cmpnt is IRegValve) RegulValves.Add(cmpnt as IRegValve);
|
||||||
if (cmpnt is ITestMethod) TestMethods.Add(cmpnt as ITestMethod);
|
if (cmpnt is ITestMethod) TestMethods.Add(cmpnt as ITestMethod);
|
||||||
if (cmpnt is IDataEntry) dataEntryComboBox.Items.Add(cmpnt.Cfg.Name);
|
if (cmpnt is IDataEntry) dataEntryComboBox.Items.Add(cmpnt.Cfg.Name);
|
||||||
if (cmpnt is IResultsPrinter)
|
if (cmpnt is IResultsPrinter)
|
||||||
|
|||||||
Reference in New Issue
Block a user