SetFlowOp with 'delay' parameter (default 0), flow setting starts after this delay in sec.
This commit is contained in:
@@ -179,9 +179,9 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -197,7 +197,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
return new SetFlowOp(UniCB, this, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
readonly double shrinkedTgtFlowHi;
|
||||
readonly double targetFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double maximalFlow;
|
||||
@@ -59,6 +60,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
double targetPositionHi;
|
||||
|
||||
int startTime;
|
||||
int setFlowTime;
|
||||
int expireTime;
|
||||
DoubleBox flowBox;
|
||||
int isFlowOkDuration;
|
||||
@@ -75,10 +77,11 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <param name="qTo">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay [s]</param>
|
||||
/// <param name="leaveFlowControlRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowBox,
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = uniCB;
|
||||
if (this.uniCB == null) throw new ArgumentNullException("cBoard is null or not Uni");
|
||||
@@ -101,18 +104,28 @@ namespace TBF.Rig.Uni.RegValve
|
||||
if (this.flowBox == null) throw new ArgumentNullException("flowBox");
|
||||
|
||||
this.timeout = timeout;
|
||||
this.delay = delay;
|
||||
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox, int timeout, int delay)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, false)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, timeout, 0, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -121,7 +134,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox flowbox)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, int.MaxValue, false)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, flowbox, int.MaxValue, 0, false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -168,6 +181,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
|
||||
/// Store the current time, etc.
|
||||
startTime = StateMachine.Time;
|
||||
setFlowTime = StateMachine.Time + delay;
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
if (expireTime < 0) expireTime = int.MaxValue;
|
||||
|
||||
@@ -212,12 +226,16 @@ namespace TBF.Rig.Uni.RegValve
|
||||
return Event.OpArgumentError;
|
||||
}
|
||||
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / flowMeter.NominalFlow,
|
||||
2000 * currentReqFlowHi / flowMeter.NominalFlow);
|
||||
if (StateMachine.Time > setFlowTime)
|
||||
{
|
||||
uniCB.SetFlow(false, regV.Idx1, 2000 * currentReqFlowLo / flowMeter.NominalFlow,
|
||||
2000 * currentReqFlowHi / flowMeter.NominalFlow);
|
||||
|
||||
log.InfoFormat("Run(): rv#={0} TARGET: flowLo={1} flowHi={2}", regV.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
log.InfoFormat("Run(): rv#={0} TARGET: flowLo={1} flowHi={2}", regV.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.SettingFlow;
|
||||
}
|
||||
|
||||
opState = OpState.SettingFlow;
|
||||
return Event.Starting;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,10 +86,11 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo, DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout);
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -105,7 +106,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
public IOperation SetFlowAndMeasureOp(GenericDevices.IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, true);
|
||||
return new SetFlowOp(uniCB, this, flowMeter, qFrom, qTo, measuredFlow, regValveCfg.ReTryCommands, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
readonly bool reTryCommands;
|
||||
|
||||
@@ -74,11 +75,12 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// <param name="requiredFlowHi">Upper limit of the flow to be achieved in [m3/h]</param>
|
||||
/// <param name="pidCoef">PID coefficient (float)</param>
|
||||
/// <param name="timeout">Timeout for the flow setting in [s]</param>
|
||||
/// <param name="delay">Flow setting starts after this delay in [s]</param>
|
||||
/// <param name="leaveFlowControlRunning">true = Leave the measurement running after op. stop</param>
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(TBF.Rig.ControlBoard.IControlBoard cb, IRegValve _regulValve, IFlowMeter flowMeter,
|
||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
bool reTryCmds, int timeout, bool leaveFlowControlRunning)
|
||||
bool reTryCmds, int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard");
|
||||
@@ -105,11 +107,11 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7 * requiredFlowLo) + (0.3 * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7 * requiredFlowHi) + (0.3 * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.measuredFlow = measuredFlow;
|
||||
this.reTryCommands = reTryCmds;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.delay = delay;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
@@ -120,18 +122,8 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, bool reTryCmds, int timeout)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IFlowMeter flowMeter, double qFrom, double qTo,
|
||||
DoubleBox measuredFlow, bool reTryCmds)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, int.MaxValue, false)
|
||||
DoubleBox measuredFlow, bool reTryCmds, int timeout, int delay)
|
||||
: this(uniCB, regValve, flowMeter, qFrom, qTo, measuredFlow, reTryCmds, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,11 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <param name="measuredFlow">Measured flow [m3/h]</param>
|
||||
/// <param name="timeout">Timeout in [s]</param>
|
||||
/// <returns>SetFlowOp instance</returns>
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
public IOperation SetFlowOp(GenericDevices.IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi,
|
||||
DoubleBox measuredFlow, int timeout, int delay)
|
||||
{
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout);
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi,
|
||||
measuredFlow, timeout, delay);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,7 +94,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
DoubleBox measuredFlow, int timeout, float filterConstant)
|
||||
{
|
||||
return new SetFlowOp(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi,
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, true);
|
||||
flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, 0, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly int delay;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double nominalFlow;
|
||||
@@ -76,7 +77,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <remarks>Only Elde.Valve flow are used, other flow on the lists are ignored</remarks>
|
||||
public SetFlowOp(TBF.Rig.ControlBoard.IControlBoard cb, IRegValve regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
int timeout, int delay, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard is not Uni");
|
||||
@@ -111,10 +112,10 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
|
||||
this.finalReqFlowLo = (0.7 * requiredFlowLo) + (0.3 * this.reqFlowAve); /// Move the lower limit 15% of the range up
|
||||
this.finalReqFlowHi = (0.7 * requiredFlowHi) + (0.3 * this.reqFlowAve); /// Move the upper limit 15% of the range down
|
||||
///
|
||||
this.measuredFlow = measuredFlow;
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.delay = delay;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
@@ -124,19 +125,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// Set required water flow - Do not leave the measurement running.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set required water flow - No timeout.
|
||||
/// Events: FlowSet
|
||||
/// </summary>
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, int.MaxValue, false)
|
||||
public SetFlowOp(UniCB uniCB, IRegValve regValve, IRegValve fixedRV, float fixedPctLo, float fixedPctHi, IFlowMeter flowMeter,
|
||||
double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow, int timeout, int delay)
|
||||
: this(uniCB, regValve, fixedRV, fixedPctLo, fixedPctHi, flowMeter, requiredFlowLo, requiredFlowHi, measuredFlow, timeout, delay, false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user