Discrete PID Controller

Purpose

Implementation of a discrete-time controller (P, I, PI, PD or PID)

Library

Control / Discrete

Description

../../_images/discrete_pid_controller.svg

This block implements a highly configurable discrete-time controller with two different anti-windup mechanisms. The output signal is a weighted sum of at maximum three types of control actions: proportional action, integral action and derivative action.

../../_images/discretePIDT1.svg

Fig. 160 Implementation of a discrete PID controller in parallel form

The derivative action is filtered with a first-order low-pass filter. This filter is always integrated with the Forward Euler method. The selection of the filter time constant \(K_\mathrm{f}\) is a trade-off between filtering noise and avoid interactions with the dominant PID controller dynamics. This leads to the discrete transfer function below:

\[C_\mathrm{PID}(z) = \frac{U(z)}{E(z)} = K_\mathrm{p} + K_\mathrm{i} q(z) + K_\mathrm{d} \frac{K_\mathrm{f}}{1+ K_\mathrm{f} \frac{T}{z-1}}.\]

If Forward Euler is selected in the Integration Method parameter, then

\[q(z) = \frac{T}{z-1},\]

for Backward Euler

\[q(z) = \frac{Tz}{z-1},\]

and for Trapezoidal

\[q(z) = \frac{T}{2}\frac{z+1}{z-1}.\]

All other block parameters are explained in the continuous version of the PID controller.

Parameters

Basic

Controller type

Specifies the controller type. The controller can be of type P, I, PI, PD or PID.

Parameter source

Specifies whether the controller parameters are provided via the mask parameters (internal) or via input signals (external).

Proportional gain Kp

The proportional gain of the controller. This parameter is shown only if the Controller type parameter is set to P, I, PI, PD or PID and the Parameter source parameter is set to internal.

Integral gain Ki

The integral gain of the controller. This parameter is shown only if the Controller type parameter is set to I, PI or PID and the Parameter source parameter is set to internal.

Derivative gain Kd

The derivative gain of the controller. This parameter is shown only if the Controller type parameter is set to PD or PID and the Parameter source parameter is set to internal.

Derivative filter coefficient Kf

The filter coefficient which specifies the pole location of the first-order filter in the derivative term.

External reset

The behavior of the external reset input. The values rising, falling and either cause a reset of the integrator on the rising, falling or both edges of the reset signal. A rising edge is detected when the signal changes from \(0\) to a positive value, a falling edge is detected when the signal changes from a positive value to \(0\). If level is chosen, the output signal keeps the initial value while the reset input is not \(0\). Only the integrator in the integral action is reset.

Initial condition source

Specifies wheter the initial condition is provided via the Initial condition parameter (internal) or via an input signal (external).

Initial condition

The initial condition of the integrator in the integral action. The value may be a scalar or a vector corresponding to the implicit width of the component. This parameter is shown only if the Initial condition source parameter is set to internal.

Anti-Windup

Saturation

Specifies if the internally placed saturation (internal) is used or if the user wants to place the saturation externally (external). If external is selected, the internal Saturation block is not active.

Saturation limits

Specifies whether the saturation limits are provided via the mask parameters (constant) or via input signals (variable).

Upper saturation limit

An upper limit for the output signal. If the value is inf, the output signal is unlimited. If input and output are vectorized signals, a vector must be used. The number of elements in the vector must match the number of input signals. This parameter is shown only if the Saturation parameter is set to internal and the Saturation limits parameter is set to constant.

Lower saturation limit

A lower limit for the output signal. If the value is -inf, the output signal is unlimited. If input and output are vectorized signals, a vector must be used. The number of elements in the vector must match the number of input signals. This parameter is shown only if the Saturation parameter is set to internal and the Saturation limits parameter is set to constant.

Anti-Windup method

Specifies the method to avoid windup of the integral action. See also the Anti-windup Methods in the Continuous PID Controller block.

Back-calculation gain

The gain of the back-calculation anti-windup method. This parameter is shown only of the Anti-windup method parameter is set to Back-calculation.

Discrete-time settings

Integration method

The method used to integrate the input signal. This parameter affects the integrator of the integral action only. Please note, that the first-order low-pass filter in the derivative action is always integrated using the Forward Euler method. See also the Integration Methods in the Discrete Integrator block.

Sample time

A scalar specifying the sampling period or a two-element vector specifying the sampling period and offset, in seconds \((\mathrm{s})\). See also the Discrete-Periodic sample time type in section Sample Times.

Probe Signals

Proportional action

Proportion of the proportional action of the controller output signal.

Integral action

Proportion of the integral action of the controller output signal.

Derivative action

Proportion of the derivative action of the controller output signal.

Controller output before saturation

The input signal of the saturation block.

Controller output after saturation

The output signal of the saturation block.

References

  • A. Visioli, “Practical PID Control - Advances in industrial control”, Springer-Verlag, 2006.