Target flow range for flow control shrinked by 15% from each side, ver. 2.18.2051

This commit is contained in:
Milan Hanajik
2018-11-08 09:54:40 +01:00
parent 68413867ad
commit 82acf60f2e
4 changed files with 21 additions and 21 deletions
+14 -14
View File
@@ -24,7 +24,7 @@ namespace TBF.BenchControl.Elde.RegulValve
readonly IFlowMeter flowMeter;
readonly float requiredFlowLo;
readonly float requiredFlowHi;
readonly float requiredFlowAve;
readonly float reqFlowAve;
readonly float pidCoef;
readonly int timeout;
readonly bool leaveMeasurementRunning;
@@ -92,9 +92,9 @@ namespace TBF.BenchControl.Elde.RegulValve
nominalFlow = flowMeter.NominalFlow;
this.requiredFlowLo = requiredFlowLo;
this.requiredFlowHi = requiredFlowHi;
this.requiredFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.requiredFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
this.requiredFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
this.pidCoef = pidCoef;
if (flowBox == null) throw new ArgumentNullException("flowBox");
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.Elde.RegulValve
void StoreTargetPosition(float avgReqFlow, float actPosition)
{
if (!regulValve.Dict.ContainsKey(requiredFlowAve))
if (!regulValve.Dict.ContainsKey(reqFlowAve))
{
regulValve.Dict.Add(new KeyValuePair<float, float>(avgReqFlow, actPosition));
}
@@ -173,13 +173,13 @@ namespace TBF.BenchControl.Elde.RegulValve
if (flow != 0)
{
flowBox.Val = flow;
if (flow >= requiredFlowAve) currentReqFlowHi = requiredFlowAve; /// Decrease upper limit
if (flow <= requiredFlowAve) currentReqFlowLo = requiredFlowAve; /// Increase lower limit
if (flow >= reqFlowAve) currentReqFlowHi = reqFlowAve; /// Decrease upper limit
if (flow <= reqFlowAve) currentReqFlowLo = reqFlowAve; /// Increase lower limit
}
flowWithinBoundsTime = 0;
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
{
log.InfoFormat("SetFlowOp:Start() rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
@@ -231,7 +231,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
flowWithinBoundsTime = 0;
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(requiredFlowAve, out targetPositionLo, out targetPositionHi))
if (regulValve.RegulValveCfg.StoredPositionReuse && FetchTargetPosition(reqFlowAve, out targetPositionLo, out targetPositionHi))
{
log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
@@ -396,19 +396,19 @@ namespace TBF.BenchControl.Elde.RegulValve
if (regulValve.RegulValveCfg.StoredPositionReuse)
{
float storedPosition;
if (regulValve.Dict.TryGetValue(requiredFlowAve, out storedPosition))
if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
{
/// update the stored valve position
StoreTargetPosition(requiredFlowAve, (rvPosition + storedPosition) / 2.0f);
StoreTargetPosition(reqFlowAve, (rvPosition + storedPosition) / 2.0f);
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% stored={3} <--- Updating a stored position",
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"), storedPosition);
regulValveNr, reqFlowAve, rvPosition.ToString("F1"), storedPosition);
}
else
{
/// store the valve position
StoreTargetPosition(requiredFlowAve, rvPosition);
StoreTargetPosition(reqFlowAve, rvPosition);
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
regulValveNr, requiredFlowAve, rvPosition.ToString("F1"));
regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
}
}