Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r1538c71d0c6b97469d599befce15f068d9acf5d4 -r2f2d0ccadd8a09037eb3d0dd144549b2c8c8129b --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 1538c71d0c6b97469d599befce15f068d9acf5d4) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 2f2d0ccadd8a09037eb3d0dd144549b2c8c8129b) @@ -263,14 +263,16 @@ if ( roFlowRate < MAX_RO_FLOWRATE_LPM && roFlowRate >= MIN_RO_FLOWRATE_LPM ) { + tgtROPumpPressure = 0.0; + targetROPumpPressure.data = 0.0; targetROPumpFlowRate.data = roFlowRate; roPumpControlMode = PUMP_CONTROL_MODE_CLOSED_LOOP; roPumpPWMDutyCyclePct = ROP_FLOW_TO_PWM_DC( roFlowRate ); -#ifdef EMC_TEST_BUILD +/*#ifdef EMC_TEST_BUILD roPumpPWMDutyCyclePct = 1.0; #else roPumpPWMDutyCyclePct = ROP_FLOW_TO_PWM_DC( roFlowRate ); -#endif +#endif*/ } else // requested pressure out of range { @@ -432,17 +434,16 @@ #endif #endif - // If there is a flow, transition to P controller to get - // the corresponding pressure of that flow + // If there is a flow, transition to P controller to get the corresponding pressure of that flow if ( getTargetROPumpFlowRate() > 0 && roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP ) { roPumpControlModeSet = roPumpControlMode; - // set initial PWM duty cycle + // Set initial PWM duty cycle roPumpPWMDutyCyclePctSet = roPumpPWMDutyCyclePct; setROPumpControlSignalPWM( roPumpPWMDutyCyclePctSet ); - // reset controller + // Reset controller resetPIController( I_CONTROLLER_ID_RO_PUMP_RAMP_UP, roPumpPWMDutyCyclePctSet ); - // set pump to on + // Set pump to on isROPumpOn = TRUE; result = RO_PUMP_RAMP_UP_STATE; } @@ -459,8 +460,8 @@ /*********************************************************************//** * @brief - * The handleROPumpRampUpState function handles the ro pump ramp up state \n - * of the ro pump controller state machine. + * The handleROPumpRampUpState function handles the RO pump ramp up state \n + * of the RO pump controller state machine. * @details * Inputs: roControlTimerCounter, roPumpPWMDutyCyclePctSet * Outputs: roControlTimerCounter, roPumpPWMDutyCyclePctSet @@ -474,7 +475,6 @@ if ( ++roControlTimerCounter >= ROP_CONTROL_INTERVAL ) { F32 targetFlowRate = getTargetROPumpFlowRate(); - F32 actualFlowRate = (F32)getMeasuredROFlowRate(); if ( fabs( actualFlowRate - targetFlowRate ) > ROP_FLOW_TARGET_TOLERANCE ) @@ -533,7 +533,7 @@ tgtROPumpPressure = avgPressure; // set initial PWM duty cycle - roPumpPWMDutyCyclePctSet = roPumpPWMDutyCyclePct; + //roPumpPWMDutyCyclePctSet = roPumpPWMDutyCyclePct; setROPumpControlSignalPWM( roPumpPWMDutyCyclePctSet ); // reset controller resetPIController( PI_CONTROLLER_ID_RO_PUMP, roPumpPWMDutyCyclePctSet );