Index: firmware/App/Controllers/ConcentratePumps.c =================================================================== diff -u -r3a87ca0e2a722318216623d7e1f4c354c58c506c -re3699de422fa3ba1b8145c4cc44257702c9e336f --- firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision 3a87ca0e2a722318216623d7e1f4c354c58c506c) +++ firmware/App/Controllers/ConcentratePumps.c (.../ConcentratePumps.c) (revision e3699de422fa3ba1b8145c4cc44257702c9e336f) @@ -225,7 +225,7 @@ concentratePumps[ CONCENTRATEPUMPS_CP2_BICARB ].isConcPumpParkInProgress = FALSE; } - // Don't monitor persistence for cp speed alarms if we parked. + // Don't monitor persistence for cp speed alarms if we are parked. if ( TRUE == acidConcentratePumpParkPersistenceClear ) { // Clear flag and resume persistence checking once park bit is set. @@ -273,7 +273,7 @@ { CONCENTRATE_PUMPS_T pumpId; - for ( pumpId = CONCENTRATEPUMPS_CP1_ACID; pumpId < NUM_OF_CONCENTRATE_PUMPS; pumpId++ ) + for ( pumpId = CONCENTRATEPUMPS_FIRST; pumpId < NUM_OF_CONCENTRATE_PUMPS; pumpId++ ) { switch ( concentratePumps[ pumpId ].execState ) { @@ -304,7 +304,7 @@ * @brief * The execConcenratePumpsSelfTest function executes the concentrate pumps * self-test. - * @details \b Inputs: none + * @details \b Inputs: calibration * @details \b Outputs: none * @return ConcentratepumpSelfTestResult (SELF_TEST_STATUS_T) *************************************************************************/ @@ -332,7 +332,8 @@ * The requestConcentratePumpOn function requests the module to turn on * the concentrate pumps. * @details \b Inputs: none - * @details \b Outputs: set flag isPumpOnRequested to TRUE + * @details \b Outputs: concentratePumps[],acidConcentratePumpParkPersistenceClear, + * bicarbConcentratePumpParkPersistenceClear * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id * @return none @@ -356,7 +357,7 @@ * The handleConcentratePumpParkRequest function accepts/rejects the park * concentrate pumps request. * @details \b Inputs: Pump state and DD operating mode - * @details \b Outputs: command response set to true if able to perform parking pump. + * @details \b Outputs: concentratePumps[] * @return result as true if park is accomplished. *************************************************************************/ BOOL handleConcentratePumpParkRequest( void ) @@ -383,7 +384,7 @@ * @brief * The isConcPumpParkInProgress function requests whether the concentrate * pump park is in progress or not. - * @details \b Inputs: concentratePumps + * @details \b Inputs: concentratePumps[] * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id @@ -410,9 +411,9 @@ * The requestConcentratePumpOff function requests the module to turn off * the concentrate pumps. * @details \b Inputs: none - * @details \b Outputs: set flag isPumpOffRequested to TRUE + * @details \b Outputs: concentratePumps[] * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. - * @param pumpId concentrate pump id + * @param pumpId ID of concentrate pump * @param park TRUE if pump should be parked, FALSE if not * @return none *************************************************************************/ @@ -435,7 +436,7 @@ * The setConcentratePumpTargetSpeed function sets the target step speed based on * given speed in mL/min to specified concentrate pump. * @details \b Inputs: none - * @details \b Outputs: set target step speed for given pump + * @details \b Outputs: concentratePumps[] * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId pump id to set step speed * @param targetSpeed_ml_min target speed in mL/min @@ -483,13 +484,13 @@ /*********************************************************************//** * @brief - * The getConcentratePumpTargetFlowMLPM function returns the concentrate pump's - * flow rate in mL/min. + * The getConcentratePumpTargetFlowMLPM function returns the target flow rate + * for a given concentrate pump. * @details \b Inputs: concentratePumps * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id to get its target flow - * @return the current concentrate pump flow rate (in mL/min). + * @return the current target flow rate (in mL/min) for the given conecntrate pump. *************************************************************************/ F32 getConcentratePumpTargetFlowMLPM( CONCENTRATE_PUMPS_T pumpId ) { @@ -509,12 +510,13 @@ /*********************************************************************//** * @brief - * The getPumpTargetSpeed function gets the concentrate pump target spped. + * The getPumpTargetSpeed function gets the current target spped for the given + * concentrate pump. * @details \b Inputs: pumpTargetSpeed * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. - * @param pumpId concentrate pump id to get the target speed - * @return the current concentrate pump target speed. + * @param pumpId concentrate pump id to get the current target speed + * @return the current target spped for the given concentrate pump. *************************************************************************/ F32 getPumpTargetSpeed( CONCENTRATE_PUMPS_T pumpId ) { @@ -534,12 +536,14 @@ /*********************************************************************//** * @brief - * The getMeasuredPumpSpeedMLPM function gets the measured concentrate pump flow rate. + * The getMeasuredPumpSpeedMLPM function gets the measured flow rate + * for a given concentrate pump. * @details \b Inputs: measuredPumpSpeed * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id to increase current step speed - * @return the current concentrate pump flow rate (in mL/min). + * @return the current measured flow rate (in mL/min) for the given concentrate + * pump. *************************************************************************/ F32 getMeasuredPumpSpeedMLPM( CONCENTRATE_PUMPS_T pumpId ) { @@ -566,7 +570,8 @@ * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id to get park request state for - * @return the current concentrate pump park request. + * @return TRUE if a park request is pending for the given concentrate pump, + * FALSE if not *************************************************************************/ BOOL getConcPumpParkRequest( CONCENTRATE_PUMPS_T pumpId ) { @@ -592,7 +597,7 @@ * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id to get parked state for - * @return the current concentrate pump parked state. + * @return TRUE if the given concentrate pump is currently parked, FALSE if not. *************************************************************************/ BOOL getConcPumpIsParked( CONCENTRATE_PUMPS_T pumpId ) { @@ -618,7 +623,7 @@ * @details \b Outputs: none * @details \b Alarms: ALARM_ID_DD_SOFTWARE_FAULT when invalid pump ID is seen. * @param pumpId concentrate pump id to get park faulted state for - * @return the current concentrate pump park faulted state. + * @return TRUE if the given concentrate pump has failed a park command.. *************************************************************************/ BOOL getConcPumpParkIsFaulted( CONCENTRATE_PUMPS_T pumpId ) { @@ -638,11 +643,11 @@ /*********************************************************************//** * @brief - * The stopConcentratePump function sets the concentrate pump step speed + * The stopConcentratePump function sets the given concentrate pump step speed * to zero and turns off concentrate pump. Also parks the pump if requested. * @details \b Inputs: none * @details \b Outputs: concentratePumps - * @param pumpId concentrate pump id + * @param pumpId ID of the concentrate pump * @return none *************************************************************************/ static void stopConcentratePump( CONCENTRATE_PUMPS_T pumpId ) @@ -681,11 +686,11 @@ /*********************************************************************//** * @brief - * The handleConcentratePumpOffState function turns on concentrate pumps and - * switch to on state upon request. + * The handleConcentratePumpOffState function turns on a given concentrate + * pumps and switch to on state upon request. * @details \b Inputs: none - * @details \b Outputs: concentrate pumps turn on - * @param pumpId concentrate pump id + * @details \b Outputs: pump turned on + * @param pumpId ID of the concentrate pump * @return state *************************************************************************/ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpOffState( CONCENTRATE_PUMPS_T pumpId ) @@ -721,11 +726,11 @@ /*********************************************************************//** * @brief * The handleConcentratePumpRampToTargetSpeedState function executes the - * concentrate pump ramp up to target speed state. Once the speed is close + * given concentrate pump ramp up to target speed state. Once the speed is close * to target the state is transitioned to control target state. * @details \b Inputs: none * @details \b Outputs: none - * @param pumpId concentrate pump id + * @param pumpId ID of the concentrate pump to ramp. * @return next state of the state machine *************************************************************************/ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpRampToTargetSpeedState( CONCENTRATE_PUMPS_T pumpId ) @@ -748,12 +753,12 @@ /*********************************************************************//** * @brief - * The handleConcentratePumpControlTargetSpeedState function turns off concentrate - * pumps switch to off state upon request. While in on state, the function - * controls concentrate pumps to a target step speed. + * The handleConcentratePumpControlTargetSpeedState function turns off given + * concentrate pumps switch to off state upon request. While in on state, + * the function controls concentrate pumps to a target step speed. * @details \b Inputs: currentPumpSpeed[] - * @details \b Outputs: control concentrate pumps to target step speed - * @param pumpId concentrate pump id + * @details \b Outputs: control given concentrate pumps to target step speed + * @param pumpId ID of the concentrate pump * @return state *************************************************************************/ static CONCENTRATE_PUMP_STATE_T handleConcentratePumpControlTargetSpeedState( CONCENTRATE_PUMPS_T pumpId ) @@ -787,7 +792,7 @@ /*********************************************************************//** * @brief * The stepConcentratePumpToTargetSpeed function steps current step speed - * toward target speed with predefined step increase. + * toward target speed for the given concentrate pump,with predefined step increase. * @details \b Inputs: none * @details \b Outputs: currentPumpSpeed[] * @param pumpId concentrate pump id to increase current step speed @@ -820,7 +825,7 @@ concentratePumps[ pumpId ].currentPumpSpeed += speedIncrease; // If the pump's target speed is set to be 0, do not ramp down set it to zero immediately - if ( fabs( getPumpTargetSpeed( pumpId ) < NEARLY_ZERO ) ) + if ( getPumpTargetSpeed( pumpId ) < NEARLY_ZERO ) { concentratePumps[ pumpId ].currentPumpSpeed = 0.0F; } @@ -858,7 +863,7 @@ * The calcMeasuredPumpsSpeed function iterates through the concentrate * pumps and calculates the concentrate pump flow. It also checks that * the hall sensor pulse width count for the concentrate pump is valid. - * @details \b Inputs: none + * @details \b Inputs: Hall sensor reading from FPGA * @details \b Outputs: measuredPumpSpeed * @details \b Alarms: ALARM_ID_DD_CONC_PUMP_HALL_SENSOR_OUT_OF_RANGE when * hall sensor pulse width is out of range. @@ -923,11 +928,15 @@ /*********************************************************************//** * @brief - * The monitorPumpSpeed function monitors the concentrate pumps speed and + * The monitorPumpSpeed function monitors the given concentrate pumps speed and * triggers the alarms if they are out of range. * @details \b Inputs: concentratePumps * @details \b Outputs: none - * @param pumpId pump id to set step speed + * @details \b Alarm: ALARM_ID_DD_CP1_SPEED_CONTROL_ERROR when the speed difference + * between requested and measured is not in range. + * @details \b Alarm: ALARM_ID_DD_CP2_SPEED_CONTROL_ERROR when the speed difference + * between requested and measured is not in range. + * @param pumpId pump id to check the difference between requested and measured speed * @param alarm which the corresponding alarm of the concentrate pump * @return none *************************************************************************/ @@ -954,7 +963,7 @@ /*********************************************************************//** * @brief * The checkConcentratePumpControlSet function monitors the status of the - * concentrate pumps control set bit and if they are different from the + * given concentrate pumps control set bit and if they are different from the * required set bit, they are set again. * @details \b Inputs: concentratePumps * @details \b Outputs: none @@ -998,7 +1007,7 @@ * at the set interval. * @details \b Inputs: concentratePumpMonitorTimerCounter * @details \b Outputs: concentratePumpMonitorTimerCounter - * @details \b Messages: MSG_ID_DD_CONCENTRATE_PUMP_DATA to publish concentrate pump states. + * @details \b Message \Sent: MSG_ID_DD_CONCENTRATE_PUMP_DATA to publish concentrate pump states. * @return none *************************************************************************/ static void publishConcentratePumpData( void )