RegulValve.SetFlowOp in progress

This commit is contained in:
Milan Hanajik 2019-09-11 15:44:05 +02:00
parent e2650736cd
commit d4eb52d70e

View File

@ -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);
}