Index: firmware/App/Services/PIControllers.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -26,10 +26,8 @@ */ // ********** private definitions ********** - -#define MIN_KI NEARLY_ZERO ///< minimum integral coefficient - cannot be zero. - -/// record for PI controller. + +/// Record for PI controller. typedef struct { // -- PI's parameters -- F32 Kp; ///< Proportional Value. @@ -45,11 +43,12 @@ F32 controlSignal; ///< actual control signal. } PI_CONTROLLER_T; -#define SET_CONTROLLER( c, id ) ((c) = &piControllers[id]) ///< macro to set a local controller pointer to a given piController. +#define MIN_KI NEARLY_ZERO ///< minimum integral coefficient - cannot be zero. +#define SET_CONTROLLER( c, id ) ( (c) = &piControllers[ id ] ) ///< macro to set a local controller pointer to a given piController. // ********** private data ********** -/// PI Controllers -- initial configurations. +/// PI Controllers - initial configurations. static PI_CONTROLLER_T piControllers[ NUM_OF_PI_CONTROLLERS_IDS ] = { // Kp Ki uMax uMin ref meas err esw esum ctrl { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, // PI_CONTROLLER_ID_RO_PUMP @@ -59,16 +58,16 @@ /*********************************************************************//** * @brief - * Initialize controller before operation. Make sure to call it before - * first call to runController function. - * + * The initializePIController function initializes controller before operation. + * Make sure to call it before first call to runController function. + * Inputs : none + * Outputs : PI controllers module initialized * @param controllerID ID filter number * @param initialControlSignal Value of the output on the first iteration * @param kP Coefficient for proportional * @param kI Coefficient for integral * @param controlMin Minimum control output * @param controlMax Maximum control output - * * @return none *************************************************************************/ void initializePIController( PI_CONTROLLER_ID_T controllerID, F32 initialControlSignal, @@ -101,12 +100,12 @@ /*********************************************************************//** * @brief - * Reset controller before new set point. Make sure to call it before first - * call to runController function. - * + * The resetPIController functions resets controller before new set point. + * Make sure to call it before first call to runController function. + * Inputs : none + * Outputs : Reset a PI controller * @param controllerID ID filter number * @param initialControlSignal Value of the output on the first iteration - * * @return none *************************************************************************/ void resetPIController( PI_CONTROLLER_ID_T controllerID, F32 initialControlSignal ) @@ -131,12 +130,12 @@ /*********************************************************************//** * @brief - * Call this function whenever a new measured signal sampled is acquired. - * + * The runPIController functions executes a PI controller with a new sampled measured signal. + * Inputs : none + * Outputs : Feeds new signal to PI controller * @param controllerID ID filter number * @param referenceSignal reference signal value * @param measuredSignal latest measured sample - * * @return value of the control signal *************************************************************************/ F32 runPIController(PI_CONTROLLER_ID_T controllerID, F32 referenceSignal, F32 measuredSignal) @@ -179,11 +178,11 @@ /*********************************************************************//** * @brief - * Returns the latest requested signal sample. - * + * The getPIControllerSignals function returns the latest requested signal sample. + * Inputs : none + * Outputs : none * @param controllerID ID filter number * @param signalID signal sample ID request - * * @return latest sample requested *************************************************************************/ F32 getPIControllerSignals( PI_CONTROLLER_ID_T controllerID, PI_CONTROLLER_SIGNALS_ID signalID )