PI (continuous)

Continuous PI controller with output limits and anti-windup: y = k·(e + ∫e/Ti), clamped, where e = reference − measured.

  • signal
  • Modelica Standard Library
  • 3 ports
  • 4 parameters
BlockPI (continuous)KindpiControllerLibraryControl

Description

A continuous PI controller with output limits and anti-windup, from the Modelica library (LimPID with a PI structure). It forms the error between the reference and the measurement itself, so no Subtract block is needed.

When the output reaches a limit, back-calculation pulls the integral back so the controller leaves saturation without overshoot.

Example

PI and PID loops The same first-order plant under continuous PI and PID controllers and their sampled counterparts.

Set point (PI)PIPlant (PI)y (PI)Set point (PID)PIDPlant (PID)y (PID)Set point (PI (sampled))PI (sampled)Plant (PI (sampled))y (PI (sampled))Set point (PID (sampled))PID (sampled)Plant (PID (sampled))y (PID (sampled))
In Gradara, select a PI (continuous) block and press F1, then choose Open example. It opens as a new model in My models, ready to run.

Also in this example:PI (discrete)Discrete PIDStepGainLow-pass filterPID (continuous)

Ports

Inputs 2

  • refreference

    Setpoint.

  • measmeasured

    Measured value, in the same units as the reference.

Outputs 1

  • y

    Controller output, limited to the range from Lower limit to Upper limit.

Parameters

  • Gaink1

    Gain, applied to both the proportional and the integral term. Must not be 0.

  • Integral timeTi0.5 s

    ≥ 0.000001

    Integral time, in seconds: the integral gain is k / Ti. Larger values mean slower integral action.

  • Upper limityMax1

    Upper limit of the output.

  • Lower limityMin-1

    Lower limit of the output.

Equations

Modelica
e = reference − measured
v = k · (e + xi)
y = max(yMin, min(yMax, v))
dxi/dt = (e + (y − v)/(k · 0.9)) / Ti, with xi = 0 at time 0

Implementation

Modelica Standard Library 4.1.0Modelica.Blocks.Continuous.LimPID
MSL documentation

Assumptions and limitations

  • The anti-windup time constant is Ti · Ni with the library default Ni = 0.9; it is not adjustable here.
  • Continuous: for a fixed-rate controller that exports to C exactly, use PI (discrete).

Tips

  • Converting from proportional and integral gains kp, ki: k = kp and Ti = kp / ki.

Used in

These larger examples use it too. Open them from Examples in the app.

  • EV drivetrain
  • PMSM · Field-oriented control

See also

Select a block in Gradara and press F1 to open its page offline.