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
piControllerLibraryControlDescription
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.
Also in this example:PI (discrete)Discrete PIDStepGainLow-pass filterPID (continuous)
Ports
Inputs 2
-
ref
referenceSetpoint.
-
meas
measuredMeasured value, in the same units as the reference.
Outputs 1
-
y
Controller output, limited to the range from Lower limit to Upper limit.
Parameters
-
Gain
k1Gain, applied to both the proportional and the integral term. Must not be 0.
-
Integral time
Ti0.5 s≥ 0.000001
Integral time, in seconds: the integral gain is k / Ti. Larger values mean slower integral action.
-
Upper limit
yMax1Upper limit of the output.
-
Lower limit
yMin-1Lower limit of the output.
Equations
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.Blocks.Continuous.LimPIDAssumptions 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.