TTK4155 Ping-pong project
|
General PID implementation for AVR. More...
Functions | |
void | pi_init (int16_t Kp_set, int16_t Ki_set, struct pi_t *regulator_p) |
Initialization of PID controller parameters. More... | |
int16_t | pi_controller (int16_t set_point, int16_t measurement, struct pi_t *regulator_p) |
PID control algorithm. More... | |
void | pi_reset_integrator (struct pi_t *regulator_p) |
Resets the integrator. More... | |
General PID implementation for AVR.
Discrete PID controller implementation. Set up by giving P/I/D terms to Init_PID(), and uses a struct PID_DATA to store internal values.
int16_t pi_controller | ( | int16_t | set_point, |
int16_t | measurement, | ||
struct pi_t * | regulator_p | ||
) |
PID control algorithm.
Calculates output from setpoint, process value and PID status.
set_point | Desired value. |
measurement | Measured value. |
pi_st | PI status struct. |
void pi_init | ( | int16_t | Kp_set, |
int16_t | Ki_set, | ||
struct pi_t * | regulator_p | ||
) |
Initialization of PID controller parameters.
Initialize the variables used by the PID algorithm.
Kp | Proportional term. |
Ki | Integral term. |
regulator_p | Struct with PI status. |
void pi_reset_integrator | ( | struct pi_t * | regulator_p | ) |
Resets the integrator.
Calling this function will reset the integrator in the PID regulator.