UniCB.StopFlowControl( ) implemented, used 3x in SetFlowOp.Stop( ) instead of uniCB.StopAll( )
This commit is contained in:
@@ -22,8 +22,9 @@ namespace TBF.Rig.Uni.RegValve
|
||||
|
||||
public const double RqrdFlowRangeRatio = 0.5;
|
||||
|
||||
|
||||
/// Set by the constructor
|
||||
///
|
||||
/// Set by the constructor
|
||||
///
|
||||
readonly UniCB uniCB;
|
||||
readonly RegValve regV;
|
||||
readonly IFlowMeter flowMeter;
|
||||
@@ -31,12 +32,12 @@ namespace TBF.Rig.Uni.RegValve
|
||||
readonly double shrinkedTgtFlowHi;
|
||||
readonly double targetFlowAve;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double maximalFlow;
|
||||
|
||||
///
|
||||
/// Internal states of this operation
|
||||
/// Internal state of this operation
|
||||
///
|
||||
enum OpState
|
||||
{
|
||||
@@ -74,10 +75,10 @@ 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="leaveMeasurementRunning">true = Leave the measurement running after op. stop</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 leaveMeasurementRunning)
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = uniCB;
|
||||
if (this.uniCB == null) throw new ArgumentNullException("cBoard is null or not Uni");
|
||||
@@ -101,7 +102,7 @@ namespace TBF.Rig.Uni.RegValve
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.leaveMeasurementRunning = leaveMeasurementRunning;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -157,9 +158,14 @@ namespace TBF.Rig.Uni.RegValve
|
||||
return;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
/// <summary>
|
||||
/// Start this operation
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regV.Idx1, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
/// Store the current time, etc.
|
||||
startTime = StateMachine.Time;
|
||||
expireTime = StateMachine.Time + timeout;
|
||||
@@ -170,13 +176,12 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// Start the flow measurement
|
||||
uniCB.MeasureFlow(false, flowMeter.Idx1);
|
||||
|
||||
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3}",
|
||||
regV.Idx1, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi);
|
||||
|
||||
opState = OpState.Wait4FlowMsrmntAndSendRVMove;
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <summary>
|
||||
/// Run this operation
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Event.OpArgumentError
|
||||
/// Event.Starting
|
||||
@@ -186,6 +191,8 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// </returns>
|
||||
public Event Run()
|
||||
{
|
||||
log.DebugFormat("Op.Run() opState={0}", opState);
|
||||
|
||||
if (StateMachine.Time > expireTime) return Event.RegulValveTimeOut;
|
||||
|
||||
if (opState == OpState.Wait4FlowMsrmntAndSendRVMove)
|
||||
@@ -309,10 +316,10 @@ namespace TBF.Rig.Uni.RegValve
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (!leaveMeasurementRunning)
|
||||
if (!leaveFlowControlRunning)
|
||||
{
|
||||
/// Stop flow measurement
|
||||
uniCB.StopAll(false);
|
||||
uniCB.StopFlowControl(false, regV.Idx1);
|
||||
}
|
||||
|
||||
opState = OpState.Idle;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
readonly bool reTryCommands;
|
||||
|
||||
readonly double nominalFlow;
|
||||
@@ -74,11 +74,11 @@ 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="leaveMeasurementRunning">true = Leave the measurement running after op. stop</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 leaveMeasurementRunning)
|
||||
bool reTryCmds, int timeout, bool leaveFlowControlRunning)
|
||||
{
|
||||
uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard");
|
||||
@@ -110,7 +110,7 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.leaveMeasurementRunning = leaveMeasurementRunning;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
@@ -471,8 +471,8 @@ namespace TBF.Rig.Uni.RegValveAnalog
|
||||
public void Stop()
|
||||
{
|
||||
opState = OpState.Idle;
|
||||
if (leaveMeasurementRunning) return;
|
||||
uniCB.StopAll(false); /// Stop measurement
|
||||
if (leaveFlowControlRunning) return;
|
||||
uniCB.StopFlowControl(false, regValve.Idx1);
|
||||
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
readonly double finalReqFlowHi;
|
||||
readonly double reqFlowAve;
|
||||
readonly int timeout;
|
||||
readonly bool leaveMeasurementRunning;
|
||||
readonly bool leaveFlowControlRunning;
|
||||
|
||||
readonly double nominalFlow;
|
||||
readonly double maximalFlow;
|
||||
@@ -72,11 +72,11 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
/// <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="leaveMeasurementRunning">true = Leave the measurement running after op. stop</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 regV, IRegValve fxdRV, float fxdPctLo, float fxdPctHi,
|
||||
IFlowMeter flowMeter, double requiredFlowLo, double requiredFlowHi, DoubleBox measuredFlow,
|
||||
int timeout, bool leaveMeasurementRunning)
|
||||
int timeout, bool leaveFlowControlRunning)
|
||||
{
|
||||
this.uniCB = cb as UniCB;
|
||||
if (uniCB == null) throw new ArgumentNullException("ctrlBoard is not Uni");
|
||||
@@ -115,7 +115,7 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
|
||||
this.timeout = timeout;
|
||||
|
||||
this.leaveMeasurementRunning = leaveMeasurementRunning;
|
||||
this.leaveFlowControlRunning = leaveFlowControlRunning;
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
@@ -356,9 +356,9 @@ namespace TBF.Rig.Uni.RegValveTandem
|
||||
{
|
||||
opState = OpState.Idle;
|
||||
|
||||
if (leaveMeasurementRunning) return;
|
||||
if (leaveFlowControlRunning) return;
|
||||
|
||||
uniCB.StopAll(false); /// Stop measurement
|
||||
uniCB.StopFlowControl(false, regValve.Idx1); /// Stop measurement
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user