Main Content

PI Controller (Discrete or Continuous)

R2026b

Discrete-time or continuous-time PI controller with external anti-windup input

  • Discrete PI Controller block

Libraries:
Simscape / Electrical / Control / General Control

Description

The Discrete PI Controller block implements discrete-time or continuous-time PI control with external anti-windup input.

This diagram shows the equivalent circuit for the controller with external anti-windup input.

Equivalent circuit for the controller with external anti-windup input

Equations

The PI Controller (Discrete or Continuous) block calculates the control signal using the backward Euler discretization method:

u(k)=[Kp+(Ki+du(k)Kaw)Tszz1]e(k),

where

  • u is the control signal.

  • Kp is the proportional gain coefficient.

  • Ki is the integral gain coefficient.

  • Kaw is the anti-windup gain coefficient.

  • Ts is the sampling period.

  • e is the error signal.

To prevent excessive overshoot, the block can use back calculation to implement an external anti-windup mechanism. It inputs du(k), the difference between the saturated control signal, usat(k), and the calculated unsaturated control signal, u(k). It then multiplies the difference by the anti-windup coefficient and adds the amplified signal from the integral gain.

Examples

Ports

Input

expand all

Error signal, e(k), obtained as the difference between the reference, r(k), and measurement, y(k), signals.

Data Types: single | double

Difference, du(k), between the saturated u^sat(k) and the unsaturated control signals, u(k). If du(k) is zero, the anti-windup is disabled.

Description

Data Types: single | double

External reset signal for the integrator.

Use the External reset parameter to specify the reset strategy. (since R2026b)

Data Types: single | double

Output

expand all

Control signal, u(k).

Data Types: single | double

Parameters

expand all

Since R2026b

Option to specify the external reset strategy for the integrator:

  • rising — Reset the state when the reset signal rises from a nonpositive value to a positive value.

  • falling — Reset the state when the reset signal falls from a positive value to a nonpositive value.

  • either — Reset the state when:

    • The reset signal changes from zero to a nonzero value.

    • The reset signal changes from a nonzero to zero.

    • The reset signal changes sign.

  • level — Reset the state when the reset signal is nonzero at the current time step or changes from nonzero at the previous time step to zero at the current time step.

Proportional gain, Kp, of the PI controller.

Integral gain,Ki, of the PI controller.

Anti-windup gain, Kaw, of the PI controller.

Value of the integrator at simulation start time.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, set this parameter to -1. For discrete-time operation, set this parameter to a positive scalar. For continuous-time operation, set this parameter to 0.

If this block is in a masked subsystem or a variant subsystem that supports switching between continuous operation and discrete operation, promote this parameter to ensure correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters to a Mask.

References

[1] Åström, K. and T. Hägglund. Advanced PID Control. Research Triangle Park, NC: ISA, 2005.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2017b

expand all