From d4eb52d70e51c8b17e4fb128bfed3a40be8fdd13 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 11 Sep 2019 15:44:05 +0200 Subject: [PATCH] RegulValve.SetFlowOp in progress --- TBF/BenchControl/Elde/RegulValve/SetFlowOp.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/TBF/BenchControl/Elde/RegulValve/SetFlowOp.cs b/TBF/BenchControl/Elde/RegulValve/SetFlowOp.cs index 8be334b8e..368aece46 100644 --- a/TBF/BenchControl/Elde/RegulValve/SetFlowOp.cs +++ b/TBF/BenchControl/Elde/RegulValve/SetFlowOp.cs @@ -385,20 +385,24 @@ namespace TBF.BenchControl.Elde.RegulValve } else if (opState == OpState.SettingFlow) { - /// - /// Repeated untill the required flow is reached - /// - if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi)) + /// Regulation valve is setting flow to the required value + + if ((currentReqFlowLo <= flow) && (flow <= currentReqFlowHi)) { - if (flowWithinBoundsTime++ >= regulValve.FlowStableSec) + /// Flow is within range + + if (flowWithinBoundsTime++ >= regulValve.FlowStableSec) { - if (regulValve.RegulValveCfg.StoredPositionReuse) + /// Flow is within range for sufficiently long time + + if (regulValve.RegulValveCfg.StoredPositionReuse) { float storedPosition; if (regulValve.Dict.TryGetValue(reqFlowAve, out storedPosition)) { /// update the stored valve position - StoreTargetPosition(reqFlowAve, (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, reqFlowAve, rvPosition.ToString("F1"), storedPosition); }