|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
Precision PI Controller. More...
Data Structures | |
| struct | precision_pi |
| State of an independent proportional-integral controller. More... | |
Functions | |
| void | precision_pi_init (struct precision_pi *pi, double kp, double ki) |
| Initialize a PI controller. | |
| void | precision_pi_reset (struct precision_pi *pi) |
| Reset the accumulated integral term. | |
| void | precision_pi_set_limits (struct precision_pi *pi, double integral_limit, double output_limit) |
| Set the limits of a PI controller. | |
| double | precision_pi_update (struct precision_pi *pi, double error) |
| Update a PI controller from an error sample. | |
| double | precision_pi_update_interval (struct precision_pi *pi, double error, double interval) |
| Update a PI controller from an error sample taken after an interval. | |
Precision PI Controller.
| void precision_pi_init | ( | struct precision_pi * | pi, |
| double | kp, | ||
| double | ki ) |
#include <zephyr/precision_timing/precision_pi.h>
Initialize a PI controller.
| pi | Controller instance. |
| kp | Proportional gain. |
| ki | Integral gain. |
| void precision_pi_reset | ( | struct precision_pi * | pi | ) |
#include <zephyr/precision_timing/precision_pi.h>
Reset the accumulated integral term.
The configured gains are preserved.
| pi | Controller instance. |
| void precision_pi_set_limits | ( | struct precision_pi * | pi, |
| double | integral_limit, | ||
| double | output_limit ) |
#include <zephyr/precision_timing/precision_pi.h>
Set the limits of a PI controller.
The integral term is held within +-integral_limit, so it cannot wind up while a large error lasts. The output is held within +-output_limit, and while the output is at that limit the integral term does not move further towards it. A limit of 0 disables it, which is the state after precision_pi_init().
| pi | Controller instance. |
| integral_limit | Largest magnitude of the integral term, 0 for no limit. |
| output_limit | Largest magnitude of the output, 0 for no limit. |
| double precision_pi_update | ( | struct precision_pi * | pi, |
| double | error ) |
#include <zephyr/precision_timing/precision_pi.h>
Update a PI controller from an error sample.
Same as precision_pi_update_interval() with an interval of 1.
| pi | Controller instance. |
| error | Current control error. |
| double precision_pi_update_interval | ( | struct precision_pi * | pi, |
| double | error, | ||
| double | interval ) |
#include <zephyr/precision_timing/precision_pi.h>
Update a PI controller from an error sample taken after an interval.
The gains are given for an interval of 1 and are divided by interval. When the plant integrates the output over the interval, as a clock does with a rate correction, the loop gains per sample are then kp and ki for any interval, so the loop keeps its stability and damping when the sample rate changes.
| pi | Controller instance. |
| error | Current control error. |
| interval | Time since the previous sample, in the unit the gains are given for. Must be greater than 0. |