3.9.7 mcUtils_PiControl
C
/* Executes the floating point PI control algorithm. */ void mcUtils_PiControl(const float32_t error, tmcUtils_PiControl_s * const pControl ) /* Executes the fixed point PI control algorithm. */ void mcUtils_PiControl(const int16_t error, tmcUtils_PiControl_s * const pControl)
Summary
This function performs the execution of the PI control algorithm.
Description
This function executes the PI control algorithm by calculating the control output based on the current error, updating the integral term, and applying output limitations to prevent wind-up.
Precondition
None.
Parameters
Param | Description |
---|---|
error | Current error value,which is the difference between the desired set point and the actual measured value. Please refer the generated header for the exact data type. |
pControl | A pointer to the PI control structure, which holds the controller's state and parameters.. |
Returns
None
Example
// Define the PI controller data structure tmcUtils_PiControl_s piControl; // Define the parameters for floating point PI control Float32_t error; // Define the parameters for fixed point PI control int16_t error; /* Executes the PI control algorithm. */ mcUtils_PiControl(error, &piControl);
Remarks
None.