PI-Controller
Toolbox for a standard PI-Controller in parallel form. It’s transfer function is:
It has a configurable output limitation with internal clamping to prevent the integrator from rising further if the output limitation is active. An input port for an external clamping signal is available as well.
Setup
Configuration
-
struct uz_PI_Controller_config
Configuration struct for PI-Controller. Pass to init function. Accessible by the user.
Public Members
-
float Kp
Proportional gain for PI-Controller. Must be greater or equal than 0.0f
-
float Ki
Integral gain for PI-Controller. Must be greater or equal than 0.0f
-
float samplingTime_sec
SamplingTime of the PI-Controller in seconds. Must be greater than 0.0f
-
float upper_limit
Upper limit for the output limitation. Must be greater than lower limit
-
float lower_limit
Lower limit for the output limitation
-
float Kp
Example
1#include "uz/uz_piController/uz_piController.h"
2int main(void) {
3 struct uz_PI_Controller_config config = {
4 .Kp = 10.0f,
5 .Ki = 10.0f,
6 .samplingTime_sec = 0.00005f,
7 .upper_limit = 10.0f,
8 .lower_limit = -10.0f
9 };
10}
Description
With this config struct one can customize the PI-Controller variables. It has to be initialized before the init-function is called.
Init function
-
typedef struct uz_PI_Controller uz_PI_Controller
Object definition for generating a PI-Controller.
-
uz_PI_Controller *uz_PI_Controller_init(struct uz_PI_Controller_config config)
Initialization of the PI-Controller object.
- Parameters
config – uz_PI_Controller_config configuration struct
- Returns
Pointer to uz_PI_Controller instance
Example
1int main(void) {
2 uz_PI_Controller *PI_instance = uz_PI_Controller_init(config);
3}
Description
Allocates the memory for the PI-Controller instance and asserts the input values of the configuration struct.
Reset
-
void uz_PI_Controller_reset(uz_PI_Controller *self)
Resets the PI-Controller.
- Parameters
self – uz_PI_Controller instance
Example
1int main(void) {
2 uz_PI_Controller_reset(PI_instance);
3}
Description
Resets the PI-Controller. The initial condition for the integrator after the reset is 0.0f.