PID controller





| Vectorized | C |
in the palette on the schematic

The block implements a mathematical model of regulators consisting of one link: P–, I–, D– controllers, two links: PI-, PD-controllers or three links: PID controller, depending on the specified properties.

The block implements the transfer function of the PID controller of the following type:


where Kp, Ki, Kd are the gain coefficients of the proportional, integrating and differentiating terms of the regulator, respectively, Td is the derivative time constant.
A PID controller is a device used in control loops equipped with a feedback link (Figure 1).


Figure 1. Structural diagram of a feedback control system with a PID controller.
The output signal of the PID controller is determined by three terms: the first term is proportional to the value of the loop error sign (error), the second term is proportional to the integral of the loop error sign, and the third term is its derivative:


If any of the three components is not used, the controller will be proportional, integrating, differentiating, or proportionally differentiating, or proportionally integrating, respectively, the components used.

Inputs

  • in – error signal.

Outputs

  • out – controlling action signal.

Properties

  • Controller type – the regulator operating mode can take the following values:
    • "P" – proportional controller;
    • "I" – integral controller;
    • "D" – differential controller;
    • "PI" – proportional-integral controller;
    • "PD" – proportional-differential controller;
    • "PID" – proportional-integral differential controller.
  • Initial conditions – vector of initial values yi(0) of the output value of the block.
  • Proportional termKp – the value of the gain of the P-term, appears in the operating modes "P", "PI", "PD", "PID".
  • Integral termKi – the value of the gain of the I-term, appears in the operating modes "I", "PI", "PID".
  • Differential termKd – the value of the gain of the D-term, appears in the operating modes "D", "PD", "PID".
  • Derivative time constant, secTd – appears in the operating modes "D", "PD", "PID".