Control / Continous / PID

Description
Continuous Proportional-Integral-Derivative (PID) Controller defined as:

Derivative function: A first-order low-pass filter can be applied to the derivative term to reduce noise and prevent instability. Set Kf > 0 to enable the filter.The equivalent filter time constant is:

Output saturation: The parameters Umin and Umax define the lower and upper limits of the controller output. The Saturation method selects how these limits are applied: * "No saturation": no output saturation is applied and Umin/Umax are set to -inf/inf. * "Internal": the PID clamps its output between Umin and Umax. * "External": the PID publishes its raw output and the Sat input receives the feedback from an external saturator. The anti-windup uses the Sat value from the previous simulation step, which prevents an algebraic loop with that saturator.
When saturation occurs, an anti-windup mechanism can be applied to the integral term. Three modes are available:
-
"NoAntiWindup": Disables the anti-windup mechanism. The integrator continues to accumulate during saturation, which may cause a delay before the output desaturates.
-
"ConditionalIntegration": Activates a conditional anti-windup method. When the PID output is saturated and the integrator is increasing the gap (positive error (e) and high saturation or negative error (e) and low saturation), the integrator is instantly frozen.

- "BackCalculation": Activates a feedback correction loop on the integrator. When the PID output saturates, a feedback signal adjusts the integral term to reduce windup. The loop gain Kb defines the speed of this correction.

Here is the internal structure of the PID controller with the external saturation and back-calculation anti-windup:

Library
Control > Continous
Parameters
| Property | Display Name | Parameter Type | Description |
|---|---|---|---|
| Kp | Kp | DoubleParameter | Proportional gain |
| Ki | Ki | DoubleParameter | Integral gain |
| Kd | Kd | DoubleParameter | Derivative gain |
| Umin | Umin | DoubleParameter | Minimal saturation |
| Umax | Umax | DoubleParameter | Maximal saturation |
| Kb | Kb | DoubleParameter | Antiwindup correction factor |
| SamplingTime | Sampling Time [s] | DoubleParameter | Sampling Time |
| Iinit | Iinit | DoubleParameter | Initial integral contribution |
| IntegrationMethod | Anti-Windup Integration method | PIDIntegrationMethodParameter | Integration method |
| Kf | Kf | DoubleParameter | Derivative low-pass filter gain |
| SaturationMethod | Saturation | PIDSaturationMethodParameter | Saturation method |
Pins
| Property | Pin Name | Type | Description |
|---|---|---|---|
| In | In | ControlIn | Input |
| Out | Out | ControlOut | Output |
Default Size
| Width | Height |
|---|---|
| 8 | 4 |