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 IFlowMeter flowMeter;
readonly float requiredFlowLo; readonly float requiredFlowLo;
readonly float requiredFlowHi; readonly float requiredFlowHi;
readonly float requiredFlowAve; readonly float reqFlowAve;
readonly float pidCoef; readonly float pidCoef;
readonly int timeout; readonly int timeout;
readonly bool leaveMeasurementRunning; readonly bool leaveMeasurementRunning;
@@ -92,9 +92,9 @@ namespace TBF.BenchControl.Elde.RegulValve
nominalFlow = flowMeter.NominalFlow; nominalFlow = flowMeter.NominalFlow;
this.requiredFlowLo = requiredFlowLo; this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.requiredFlowHi = requiredFlowHi; this.requiredFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
this.requiredFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f; this.requiredFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
this.pidCoef = pidCoef; this.pidCoef = pidCoef;
if (flowBox == null) throw new ArgumentNullException("flowBox"); if (flowBox == null) throw new ArgumentNullException("flowBox");
@@ -155,7 +155,7 @@ namespace TBF.BenchControl.Elde.RegulValve
void StoreTargetPosition(float avgReqFlow, float actPosition) 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)); regulValve.Dict.Add(new KeyValuePair<float, float>(avgReqFlow, actPosition));
} }
@@ -173,13 +173,13 @@ namespace TBF.BenchControl.Elde.RegulValve
if (flow != 0) if (flow != 0)
{ {
flowBox.Val = flow; flowBox.Val = flow;
if (flow >= requiredFlowAve) currentReqFlowHi = requiredFlowAve; /// Decrease upper limit if (flow >= reqFlowAve) currentReqFlowHi = reqFlowAve; /// Decrease upper limit
if (flow <= requiredFlowAve) currentReqFlowLo = requiredFlowAve; /// Increase lower limit if (flow <= reqFlowAve) currentReqFlowLo = reqFlowAve; /// Increase lower limit
} }
flowWithinBoundsTime = 0; 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}", 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); regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
@@ -231,7 +231,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{ {
flowWithinBoundsTime = 0; 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}", log.InfoFormat("Run(): rv#={0} flowMtr#={1} TARGET: flowLo={2} flowHi={3} FETCHED: posLo={4} posHi={5}",
regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi); regulValveNr, flowMeter.Idx1, currentReqFlowLo, currentReqFlowHi, targetPositionLo, targetPositionHi);
@@ -396,19 +396,19 @@ namespace TBF.BenchControl.Elde.RegulValve
if (regulValve.RegulValveCfg.StoredPositionReuse) if (regulValve.RegulValveCfg.StoredPositionReuse)
{ {
float storedPosition; float storedPosition;
if (regulValve.Dict.TryGetValue(requiredFlowAve, out storedPosition)) if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition))
{ {
/// update the stored valve position /// 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", 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 else
{ {
/// store the valve position /// store the valve position
StoreTargetPosition(requiredFlowAve, rvPosition); StoreTargetPosition(reqFlowAve, rvPosition);
log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position", log.InfoFormat("Run(): rv#={0} reqFlow={1} pos={2}% <--- Storing a new position",
regulValveNr, requiredFlowAve, rvPosition.ToString("F1")); regulValveNr, reqFlowAve, rvPosition.ToString("F1"));
} }
} }
@@ -102,9 +102,9 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
nominalFlow = flowMeter.NominalFlow; nominalFlow = flowMeter.NominalFlow;
this.finalReqFlowLo = requiredFlowLo;
this.finalReqFlowHi = requiredFlowHi;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2; this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2;
this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
this.pidCoef = pidCoef; this.pidCoef = pidCoef;
this.measuredFlow = measuredFlow; this.measuredFlow = measuredFlow;
this.reTryCommands = reTryCmds; this.reTryCommands = reTryCmds;
@@ -108,10 +108,10 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
nominalFlow = flowMeter.NominalFlow; nominalFlow = flowMeter.NominalFlow;
this.finalReqFlowLo = requiredFlowLo;
this.finalReqFlowHi = requiredFlowHi;
this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f; this.reqFlowAve = (requiredFlowLo + requiredFlowHi) / 2.0f;
this.pidCoef = pidCoef; this.finalReqFlowLo = (0.7F * requiredFlowLo) + (0.3F * this.reqFlowAve); /// Move the lower limit 15% of the range up
this.finalReqFlowHi = (0.7F * requiredFlowHi) + (0.3F * this.reqFlowAve); /// Move the upper limit 15% of the range down
this.pidCoef = pidCoef;
this.measuredFlow = measuredFlow; this.measuredFlow = measuredFlow;
this.timeout = timeout; this.timeout = timeout;
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.18.1050.0")] [assembly: AssemblyVersion("2.18.1051.0")]
[assembly: AssemblyFileVersion("2.18.1050.0")] [assembly: AssemblyFileVersion("2.18.1051.0")]