Index: firmware/App/Controllers/ROPump.c =================================================================== diff -u -r1adf63258d838dea53d8e283d752e7c24626ab0b -re832be54a818fe1af79b225e4b43cd148be89fa4 --- firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision 1adf63258d838dea53d8e283d752e7c24626ab0b) +++ firmware/App/Controllers/ROPump.c (.../ROPump.c) (revision e832be54a818fe1af79b225e4b43cd148be89fa4) @@ -131,7 +131,8 @@ static RO_PI_FLOW_PROFILES_T currentROPumpProfile; ///< RO Pump flow profile table. -///< Most values are currently the same until future efforts into fine tuning op modes. +///< Most values are currently the same until future efforts into tuning op modes. +///< TODO: Fine tune each op mode. static PI_CONTROLLER_PROFILE_DATA_T roPIFlowProfiles[ NUM_OF_RO_PI_FLOW_PROFILES ] = { // Kp Ki uMin uMax maxErrorSumStep Control Interval { ROP_FLOW_CONTROL_P_COEFFICIENT, ROP_FLOW_CONTROL_I_COEFFICIENT, MIN_RO_PUMP_DUTY_CYCLE, MAX_RO_PUMP_DUTY_CYCLE, ROP_PWM_STEP_LIMIT, ROP_CONTROL_INTERVAL }, ///< RO_PI_FLOW_PROFILE_FLUSH @@ -216,9 +217,9 @@ * The setROPumpTargetFlowRate function sets a new target flow rate for the * RO pump. * @details Inputs: targetROPumpPressure, targetROPumpFlowRate, - * roPumpControlMode, rampUp2FlowTimeoutCounter + * roPumpControlMode, rampUp2FlowTimeoutCounter, currentROPumpProfile * @details Outputs: targetROPumpPressure, targetROPumpFlowRate, - * roPumpControlMode, rampUp2FlowTimeoutCounter + * roPumpControlMode, rampUp2FlowTimeoutCounter, roPumpPWMDutyCyclePct * @param roFlowRate which is target RO flow rate * @param maxPressure which is the maximum allowed pressure that the RO pump * can reach @@ -336,10 +337,10 @@ * The execROPumpMonitor function executes the RO pump monitor. The RO flow * sensor is read, filtered, converted to L/min and calibrated. * @details Inputs: measuredFlowReadingsSum, flowFilterCounter, - * measuredROFlowRateLPM, measuredROFlowRateLPM, roPumpState, - * flowOutOfRangeCounter, roPumpControlMode + * measuredROFlowRateLPM, roPumpState, roFeedbackVoltage, + * flowOutOfRangeCounter, roPumpControlMode, Ppo * @details Outputs: measuredFlowReadingsSum, flowFilterCounter, - * measuredROFlowRateLPM, measuredROFlowRateLPM + * measuredROFlowRateLPM, roVolumeL, roPumpFeedbackDutyCyclePct * @return none *************************************************************************/ void execROPumpMonitor( void ) @@ -394,7 +395,7 @@ // The feedback voltage is on the 0V line so when the duty cycle is 0, the feedback is 2.5V // The duty cycle is calculated by getting the 1 - (ratio of feedback / to the voltage at 0 percent duty cycle). roPumpFeedbackDutyCyclePct.data = 1.0F - ( roFeedbackVoltage / ROP_FEEDBACK_0_PCT_DUTY_CYCLE_VOLTAGE ); - isDutyCylceOutOfRange = ( fabs( getROFeedbackVoltage() - roPumpDutyCyclePctSet ) > ROP_DUTY_CYCLE_OUT_OF_RANGE_TOLERANCE ? TRUE : FALSE ); + isDutyCylceOutOfRange = ( fabs( getROFeedbackVoltage() - roPumpDutyCyclePctSet ) > ROP_DUTY_CYCLE_OUT_OF_RANGE_TOLERANCE ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_RO_PUMP_DUTY_CYCLE_OUT_OF_RANGE, isDutyCylceOutOfRange, getROFeedbackVoltage(), roPumpDutyCyclePctSet ); @@ -625,7 +626,7 @@ RO_PUMP_STATE_T state = RO_PUMP_CONTROL_TO_TARGET_FLOW_STATE; // Control at set interval - if ( ++roControlTimerCounter >= roPumpControlInterval && roPumpControlMode == PUMP_CONTROL_MODE_CLOSED_LOOP ) + if ( ( ++roControlTimerCounter >= roPumpControlInterval ) && ( PUMP_CONTROL_MODE_CLOSED_LOOP == roPumpControlMode ) ) { // Get the pressure to use it for setting the control F32 actualPressure = getMeasuredDGPressure( PRESSURE_SENSOR_RO_PUMP_OUTLET ); @@ -859,6 +860,7 @@ return dutyCyclePct; } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ Index: firmware/App/Controllers/ROPump.h =================================================================== diff -u -rb907e7c16b84a6792f022e098e6ed37b43d41f75 -re832be54a818fe1af79b225e4b43cd148be89fa4 --- firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision b907e7c16b84a6792f022e098e6ed37b43d41f75) +++ firmware/App/Controllers/ROPump.h (.../ROPump.h) (revision e832be54a818fe1af79b225e4b43cd148be89fa4) @@ -34,7 +34,6 @@ #define MAX_RO_FLOWRATE_LPM 1.8F ///< Maximum target RO flow rate in L/min. #define MIN_RO_FLOWRATE_LPM 0.0F ///< Minimum target RO flow rate in L/min. - /// Enumerations of RO pump PI controller profiles. typedef enum { Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r2b6abbe347b2da260a4d46aca233bbfb6a59bf04 -re832be54a818fe1af79b225e4b43cd148be89fa4 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 2b6abbe347b2da260a4d46aca233bbfb6a59bf04) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision e832be54a818fe1af79b225e4b43cd148be89fa4) @@ -327,7 +327,7 @@ /*********************************************************************//** * @brief * The getIntegratedVolumeML function returns the integrated volume in mL - * @details Inputs: none + * @details Inputs: integratedVolumeML * @details Outputs: integrated volume * @return integrated volume *************************************************************************/ @@ -400,8 +400,6 @@ return volume; } - - /*********************************************************************//** * @brief * The resetChemicalUsedVolumeML function resets the used volume of a chemical @@ -797,7 +795,7 @@ // If we've reached our target fill to volume (by weight), we're done filling - go back to generation idle mode // SRSDG 398 if ( TRUE == hasTargetFillVolumeBeenReached( inactiveReservoir ) ) { - F32 filledVolumeML = getReservoirWeight( inactiveRsrvr ) - reservoirBaseWeight; + F32 filledVolumeML = getReservoirWeight( inactiveReservoir ) - reservoirBaseWeight; F32 integratedVolumeToLoadCellReadingPercent = fabs( 1.0F - ( filledVolumeML / getIntegratedVolumeML() ) ); F32 avgAcidConductivity = acidConductivityTotal / conductivitySampleCount; F32 avgBicarbConductivity = bicarbConductivityTotal / conductivitySampleCount; @@ -1013,8 +1011,8 @@ * @brief * The publishFillModeData function publishes fill mode data * at the set interval. - * @details Inputs: fillModeDataPublicationTimerCounter - * @details Outputs: fillModeDataPublicationTimerCounter + * @details Inputs: fillModeDataPublicationTimerCounter, fillModeDataPublishInterval + * @details Outputs: fillModeData * @return none *************************************************************************/ static void publishFillModeData( void ) @@ -1189,11 +1187,11 @@ /*********************************************************************//** * @brief - * The testSetFillModeDataPublishIntervalOverride function overrides the - * fill mode data publish interval. - * @details Inputs: FillModeDataPublishInterval - * @details Outputs: FillModeDataPublishInterval - * @param: value override fill mode data publish interval with (in ms) + * The testSetIntegratedVolumeOverride function overrides the + * integrated volume. + * @details Inputs: value + * @details Outputs: integratedVolumeML + * @param: value integrated volume in mL * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetIntegratedVolumeOverride( U32 value ) @@ -1212,10 +1210,10 @@ /*********************************************************************//** * @brief - * The testResetFillModeDataPublishIntervalOverride function resets the - * override of the fill mode data publish interval. - * @details Inputs: FillModeDataPublishInterval - * @details Outputs: FillModeDataPublishInterval + * The testResetIntegratedVolumeOverride function resets the + * override of integrated volume. + * @details Inputs: none + * @details Outputs: integratedVolumeML * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetIntegratedVolumeOverride( void ) Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r2830e6300c40e331b274511fa9183937810cc190 -re832be54a818fe1af79b225e4b43cd148be89fa4 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2830e6300c40e331b274511fa9183937810cc190) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision e832be54a818fe1af79b225e4b43cd148be89fa4) @@ -335,8 +335,8 @@ /*********************************************************************//** * @brief * The handlePOSTStateStart function handles the POST start state. - * @details Inputs: startPOSTDelayCounter - * @details Outputs: startPOSTDelayCounter + * @details Inputs: startPOSTDelayCounter, systemREG1 + * @details Outputs: startPOSTDelayCounter, systemREG1 * @return next POST state *************************************************************************/ static DG_POST_STATE_T handlePOSTStateStart( void ) Index: firmware/App/Services/PIControllers.h =================================================================== diff -u -r1adf63258d838dea53d8e283d752e7c24626ab0b -re832be54a818fe1af79b225e4b43cd148be89fa4 --- firmware/App/Services/PIControllers.h (.../PIControllers.h) (revision 1adf63258d838dea53d8e283d752e7c24626ab0b) +++ firmware/App/Services/PIControllers.h (.../PIControllers.h) (revision e832be54a818fe1af79b225e4b43cd148be89fa4) @@ -54,7 +54,6 @@ NUM_OF_CONTROLLER_SIGNAL ///< Number of PI controller signals } PI_CONTROLLER_SIGNALS_ID; - /// Data structure for PI control profiles. typedef struct ControllerProfile { @@ -66,7 +65,6 @@ U32 controlInterval; ///< Control interval value } PI_CONTROLLER_PROFILE_DATA_T; - // ********** public function prototypes ********** void initializePIController( PI_CONTROLLER_ID_T controllerID, F32 initialControlSignal, @@ -76,7 +74,6 @@ F32 getPIControllerSignals( PI_CONTROLLER_ID_T controllerID, PI_CONTROLLER_SIGNALS_ID signalID ); void setPIControllerStepLimit( PI_CONTROLLER_ID_T controllerID, PI_CONTROLLER_SIGNALS_ID signalID, F32 stepLimit ); - /**@}*/ #endif