Documentation

## PID Controller Types for Tuning

PID Tuner and the pidtune command can tune many PID and 2-DOF PID controller types. The term controller type refers to which terms are present in the controller action. For example, a PI controller has only a proportional and an integral term, while a PIDF controller contains proportional, integrator, and filtered derivative terms. This topic summarizes the types of PID controllers available for tuning with PID Tuner and pidtune.

### Specifying PID Controller Type

To select the controller type, use one of these methods:

• For command-line tuning, provide the type argument to the pidtune command. For example, C = pidtune(G,'PI') tunes a PI controller for plant G.

• For tuning in PID Tuner:

• Provide the type argument to the pidTuner command when you open PID Tuner. For example, pidTuner(G,'PIDF2') opens PID Tuner with an initial design that is a 2-DOF PID controller with a filter on the derivative term.

• Provide the baseline-controller Cbase argument to the pidTuner command when you open PID Tuner. PID Tuner designs a controller of the same type as Cbase. For example, suppose C0 is a pid controller object that has proportional and derivative action only (PD controller). Then, pidTuner(G,C0) opens PID Tuner with an initial design that is a PD controller.

• In PID Tuner, use the Type menu to change controller types.

### 1-DOF Controllers

The following table summarizes the available 1-DOF PID controller types and provides representative controller formulas for parallel form. The standard-form and discrete-time formulas are analogous.

TypeController ActionsContinuous-Time Controller Formula (parallel form)Discrete-Time Controller Formula (parallel form, ForwardEuler integration method)
PProportional onlyKpKp
IIntegral only

$\frac{{K}_{i}}{s}$

${K}_{i}\frac{{T}_{s}}{z-1}$

PIProportional and integral

${K}_{p}+\frac{{K}_{i}}{s}$

${K}_{p}+{K}_{i}\frac{{T}_{s}}{z-1}$

PDProportional and derivative

${K}_{p}+{K}_{d}s$

${K}_{p}+{K}_{d}\frac{z-1}{{T}_{s}}$

PDFProportional and derivative with first-order filter on derivative term

${K}_{p}+\frac{{K}_{d}s}{{T}_{f}s+1}$

${K}_{p}+{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}$

PIDProportional, integral, and derivative

${K}_{p}+\frac{{K}_{i}}{s}+{K}_{d}s$

${K}_{p}+{K}_{i}\frac{{T}_{s}}{z-1}+{K}_{d}\frac{z-1}{{T}_{s}}$

PIDFProportional, integral, and derivative with first-order filter on derivative term

${K}_{p}+\frac{{K}_{i}}{s}+\frac{{K}_{d}s}{{T}_{f}s+1}$

${K}_{p}+{K}_{i}\frac{{T}_{s}}{z-1}+{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}$

### 2-DOF Controllers

PID Tuner can automatically design 2-DOF PID controller types with free setpoint weights. The following table summarizes the 2-DOF controller types in PID Tuner. The standard-form and discrete-time formulas are analogous. For more information about 2-DOF PID controllers generally, see Two-Degree-of-Freedom PID Controllers.

TypeController ActionsContinuous-Time Controller Formula (parallel form)Discrete-Time Controller Formula (parallel form, ForwardEuler integration method)
PI22-DOF proportional and integral

$u={K}_{p}\left(br-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)$

$u={K}_{p}\left(br-y\right)+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)$

PD22-DOF proportional and derivative

$u={K}_{p}\left(br-y\right)+{K}_{d}s\left(cr-y\right)$

$u={K}_{p}\left(br-y\right)+{K}_{d}\frac{z-1}{{T}_{s}}\left(cr-y\right)$

PDF22-DOF proportional and derivative with first-order filter on derivative term

$u={K}_{p}\left(br-y\right)+{K}_{d}\frac{s}{{T}_{f}s+1}\left(cr-y\right)$

$u={K}_{p}\left(br-y\right)+{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}\left(cr-y\right)$

PID22-DOF proportional, integral, and derivative

$u={K}_{p}\left(br-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)+{K}_{d}s\left(cr-y\right)$

$u={K}_{p}\left(br-y\right)+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)+{K}_{d}\frac{z-1}{{T}_{s}}\left(cr-y\right)$

PIDF22-DOF proportional, integral, and derivative with first-order filter on derivative term

$u={K}_{p}\left(br-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)+{K}_{d}\frac{s}{{T}_{f}s+1}\left(cr-y\right)$

$u={K}_{p}\left(br-y\right)+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)+{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}\left(cr-y\right)$

### 2-DOF Controllers with Fixed Setpoint Weights

With PID control, step changes in the reference signal can cause spikes in the control signal contributed by the proportional and derivative terms. By fixing the setpoint weights of a 2-DOF controller, you can mitigate the influence on the control signal exerted by changes in the reference signal. For example, consider the relationship between the inputs r (setpoint) and y (feedback) and the output u (control signal) of a continuous-time 2-DOF PID controller.

$u={K}_{p}\left(br-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)+{K}_{d}s\left(cr-y\right)$

If you set b = 0 and c = 0, then changes in the setpoint r do not feed through directly to either the proportional or the derivative terms in u. The b = 0, c = 0 controller is called an I-PD type controller. I-PD controllers are also useful for improving disturbance rejection.

Use PID Tuner to design the fixed-setpoint-weight controller types summarized in the following table. The standard-form and discrete-time formulas are analogous.

TypeController ActionsContinuous-Time Controller Formula (parallel form)Discrete-Time Controller Formula (parallel form, ForwardEuler integration method)
I-PD2-DOF PID with b = 0, c = 0

$u=-{K}_{p}y+\frac{{K}_{i}}{s}\left(r-y\right)-{K}_{d}sy$

$u=-{K}_{p}y+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)-{K}_{d}\frac{z-1}{{T}_{s}}y$

I-PDF2-DOF PIDF with b = 0, c = 0

$u=-{K}_{p}y+\frac{{K}_{i}}{s}\left(r-y\right)-{K}_{d}\frac{s}{{T}_{f}s+1}y$

$u=-{K}_{p}y+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)-{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}y$

ID-P2-DOF PID with b = 0, c = 1

$u=-{K}_{p}y+\frac{{K}_{i}}{s}\left(r-y\right)+{K}_{d}s\left(r-y\right)$

$u=-{K}_{p}y+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)+{K}_{d}\frac{z-1}{{T}_{s}}\left(r-y\right)$

IDF-P2-DOF PIDF with b = 0, c = 1

$u=-{K}_{p}y+\frac{{K}_{i}}{s}\left(r-y\right)+{K}_{d}\frac{s}{{T}_{f}s+1}\left(r-y\right)$

$u=-{K}_{p}y+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)+{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}\left(r-y\right)$

PI-D2-DOF PID with b = 1, c = 0

$u={K}_{p}\left(r-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)-{K}_{d}sy$

$u={K}_{p}\left(r-y\right)+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)-{K}_{d}\frac{z-1}{{T}_{s}}y$

PI-DF2-DOF PIDF with b = 1, c = 0

$u={K}_{p}\left(r-y\right)+\frac{{K}_{i}}{s}\left(r-y\right)-{K}_{d}\frac{s}{{T}_{f}s+1}y$

$u={K}_{p}\left(r-y\right)+{K}_{i}\frac{{T}_{s}}{z-1}\left(r-y\right)-{K}_{d}\frac{1}{{T}_{f}+\frac{{T}_{s}}{z-1}}y$