Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r6043f644995e28b3387e60181cdf915ea8ff3516 -r7df1fae66b80c946ff1bcdee4b43afb5ab7a1d4c --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 6043f644995e28b3387e60181cdf915ea8ff3516) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 7df1fae66b80c946ff1bcdee4b43afb5ab7a1d4c) @@ -127,6 +127,7 @@ static OVERRIDE_F32_T measuredROFlowRateLPM = { 0.0, 0.0, 0.0, 0 }; ///< Measured RO flow rate (in L/min). static U32 roControlTimerCounter = 0; ///< Determines when to perform control on RO pump. + static F32 roPumpOpenLoopTargetDutyCycle = 0; ///< Target RO pump open loop PWM. /* TODO These variables are used for POST. POST has not been implemented yet @@ -375,6 +376,7 @@ checkPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_UPPER_RANGE, isFlowOutOfUpperRange, currentFlow, targetFlow ); checkPersistentAlarm( ALARM_ID_FLOW_RATE_OUT_OF_LOWER_RANGE, isFlowOutOfLowerRange, currentFlow, targetFlow ); } +#endif // If the pump is off and PPi + 5psi < PPo for a certain period of time, activate safety shutdown if ( FALSE == isROPumpOn ) @@ -390,7 +392,7 @@ activateSafetyShutdown(); } } -#endif + // Publish RO pump data on interval publishROPumpData(); } @@ -553,7 +555,7 @@ resetPIController( PI_CONTROLLER_ID_RO_PUMP_MAX_PRES, roPumpDutyCyclePctSet ); state = RO_PUMP_CONTROL_TO_MAX_PRESSURE_STATE; } - // + // If the actual flow is still far from target flow, update the duty cycle using the I controller and stay in this state else if ( TRUE == isFlowOutOfRange ) { roPumpDutyCyclePctSet += ( targetFlowRate - actualFlowRate ) * ROP_RAMP_UP_P_COEFFICIENT;