PID (continuous)
Continuous PID controller with a filtered derivative, output limits, and anti-windup: y = k·(e + ∫e/Ti + Td·de/dt), clamped.
- signal
- Modelica Standard Library
- 3 ports
- 6 parameters
pidControllerLibraryControlDescription
A continuous PID controller with a filtered derivative, output limits and anti-windup, from the Modelica library (LimPID with a PID structure). It forms the error between the reference and the measurement itself.
The derivative acts on the measurement only (set-point weight 0), so a reference step causes no derivative kick.
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 filterPI (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 every term. Must not be 0.
-
Integral time
Ti0.5 s≥ 0.000001
Integral time, in seconds: the integral gain is k / Ti.
-
Derivative time
Td0.05 s≥ 0
Derivative time, in seconds: the derivative gain is k · Td. 0 or more.
-
Derivative filter ratio
Nd10≥ 1
Derivative filter ratio: the derivative is filtered with time constant Td / Nd. At least 1; 10 is usual.
-
Upper limit
yMax1Upper limit of the output.
-
Lower limit
yMin-1Lower limit of the output.
Equations
e = reference − measured dxd/dt = (−measured − xd) / (Td/Nd) v = k · (e + xi + Td · (−measured − xd) / (Td/Nd)) y = max(yMin, min(yMax, v)) dxi/dt = (e + (y − v)/(k · 0.9)) / Ti, with xi = xd = 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; the set-point weights are fixed at 1 (proportional) and 0 (derivative).
- Continuous: for a fixed-rate controller that exports to C exactly, use Discrete PID.
Tips
- Converting from parallel gains kp, ki, kd: k = kp, Ti = kp / ki, Td = kd / kp.
See also
Select a block in Gradara and press F1 to open its page offline.