Clamping function#
-
bool uz_PI_Controller_Clamping_Circuit(float preIntegrator, float preSat, float upper_limit, float lower_limit)#
Compares the values before and after the Integrator and decides if clamping is necessary.
- Parameters:
preIntegrator – value before the integrator
preSat – value after the integrator and before the saturation
upper_limit – Max limit for deadzone. Must be greater than lower limit
lower_limit – min limit for deadzone
- Returns:
Returns true if clamping is necessary
Example#
1#include "uz_piController.h"
2int main(void) {
3 float preIntegrator = 10.5f;
4 float preSat = 1.1f;
5 float upper_limit = 10.0f;
6 float lower_limit = -8.0f;
7 bool clamp = uz_PI_Controller_Clamping_Circuit(preIntegrator, preSat, upper_threshold, lower_threshold);
8}
Description#
Compares the values before the integrator preIntegrator
and before the output limitation preSat
. Activates clamping if preSat
is outside the limit and preIntegrator
and preSat
have the same sign.
The function is called by sample-function.
Warning
The values for upper_limit
and lower_limit
must be the same as configured in the PI-Controller configuration struct.