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
BlockPID (continuous)KindpidControllerLibraryControl

Description

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.

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 PID (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 filterPI (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 every term. Must not be 0.

  • Integral timeTi0.5 s

    ≥ 0.000001

    Integral time, in seconds: the integral gain is k / Ti.

  • Derivative timeTd0.05 s

    ≥ 0

    Derivative time, in seconds: the derivative gain is k · Td. 0 or more.

  • Derivative filter ratioNd10

    ≥ 1

    Derivative filter ratio: the derivative is filtered with time constant Td / Nd. At least 1; 10 is usual.

  • Upper limityMax1

    Upper limit of the output.

  • Lower limityMin-1

    Lower limit of the output.

Equations

Modelica
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 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; 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.