RegValve.SetFlowOp : RqrdFlowRangeRatio = 0.5, requiredFlowLo/HI -= MeasurementCorrection.GetCorrection(...),

This commit is contained in:
Milan Hanajik
2021-06-28 13:58:13 +02:00
parent 2106e82ede
commit 4c89c0f7c4
+12 -5
View File
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using TBF.Rig.ControlBoard.Uni;
using TBF.Rig.GenericDevices;
using TBF.Boxes;
@@ -18,6 +19,10 @@ namespace TBF.Rig.Uni.RegValve
return string.Format("SetFlowOp({0}, Qfrom={1}, Qto={2})", regV.Name, shrinkedTgtFlowLo, shrinkedTgtFlowHi);
}
public const double RqrdFlowRangeRatio = 0.5;
/// Set by the constructor
readonly UniCB uniCB;
readonly RegValve regV;
@@ -85,9 +90,11 @@ namespace TBF.Rig.Uni.RegValve
maximalFlow = flowMeter.NominalFlow * 1.25;
this.targetFlowAve = (qFrom + qTo) / 2;
this.shrinkedTgtFlowLo = (0.7 * qFrom) + (0.3 * this.targetFlowAve); /// Move the lower limit 15% of the range up
this.shrinkedTgtFlowHi = (0.7 * qTo) + (0.3 * this.targetFlowAve); /// Move the upper limit 15% of the range down
double rqrdFlowLoBeforeCorr = qFrom - MeasurementCorrection.GetCorrection(qFrom, flowMeter.Corrections);
double rqrdFlowHiBeforeCorr = qTo - MeasurementCorrection.GetCorrection(qTo, flowMeter.Corrections);
targetFlowAve = (rqrdFlowLoBeforeCorr + rqrdFlowHiBeforeCorr) / 2;
shrinkedTgtFlowLo = (RqrdFlowRangeRatio * rqrdFlowLoBeforeCorr) + ((1 - RqrdFlowRangeRatio) * targetFlowAve); /// Move the lower limit 15% of the range up
shrinkedTgtFlowHi = (RqrdFlowRangeRatio * rqrdFlowHiBeforeCorr) + ((1 - RqrdFlowRangeRatio) * targetFlowAve); /// Move the upper limit 15% of the range down
this.flowBox = flowBox;
if (this.flowBox == null) throw new ArgumentNullException("flowBox");
@@ -191,8 +198,8 @@ namespace TBF.Rig.Uni.RegValve
/// Set the targer flow/frequency range
currentReqFlowLo = shrinkedTgtFlowLo; /// Default lower limit
currentReqFlowHi = shrinkedTgtFlowHi; /// Default upper limit
if (flow1 >= targetFlowAve) currentReqFlowHi = targetFlowAve; /// Decrease upper limit
if (flow1 <= targetFlowAve) currentReqFlowLo = targetFlowAve; /// Increase lower limit
//if (flow1 >= targetFlowAve) currentReqFlowHi = targetFlowAve; /// Decrease upper limit
//if (flow1 <= targetFlowAve) currentReqFlowLo = targetFlowAve; /// Increase lower limit
if ((currentReqFlowLo >= currentReqFlowHi) || (currentReqFlowLo > maximalFlow) || (currentReqFlowHi <= 0))
{