PID Control
Three terms for a fast, accurate response
A PID controller is put on the plant G(s) = 1/((s + 1)(s + 2)) to make it follow the target value 1 (dashed line). The gold curve is the closed-loop step response from t = 0 to 12, and the steady-state error and overshoot in the display below are measured on the curve over these 12 seconds. At first there is only the proportional gain Kp = 4, so the output stops at 4/6 ≈ 0.67, leaving a steady-state error of 0.33. Raise the integral gain Ki and the remaining error accumulates and pushes the output up to the target; even Ki = 2 brings the error almost to 0 within 12 seconds. Raising Ki a lot, though, increases the overshoot, so you end up adjusting Kp and Kd together to find a response that is fast, error-free, and smooth.
Present, past, and future of the error
A PID controller takes a single error e(t), the difference between the target value and the output, and adds it up in three ways to form the control input u = Kp·e + Ki·∫e dt + Kd·de/dt. The proportional term responds immediately in proportion to the present error, pushing hard when the error is large and gently when it is small; it is the most intuitive term. The integral term accumulates the error over time, so even a small error that lingers keeps growing the integral until it pushes that error out. The derivative term responds to how fast the error is changing, so when the error is shrinking quickly it foresees the coming overshoot and applies the brakes. In effect, the three look at the error's present, past, and future.
The limit of P, the accuracy of I, the stability of D
Proportional control alone leaves a steady-state error. Since the control input is u = Kp·e, keeping an input other than 0 in steady state requires the error e not to be 0. The plant in this example has a DC gain of 1/2, so with Kp alone the output stops at Kp/(2 + Kp) and always falls short of the target. The integral term solves this. As long as any error remains, the integral keeps accumulating and increasing the input, and it stops only when the error is exactly 0, so the steady-state error becomes 0. In exchange, the integral adds a pole at the origin that delays the phase and makes the response prone to oscillation, while the derivative term does the opposite, advancing the phase and adding damping. Setting the speed with proportional, erasing the error with integral, and adding damping with derivative is the division of labor in PID.
Tuning and real-world pitfalls
PID is the standard tool of industrial control, used for temperature, speed, position, and flow alike. Choosing the three gains is called tuning, and because speed, overshoot, and robustness are interlocked, improving one tends to hurt another. The classic Ziegler–Nichols method switches off the integral and derivative terms and raises only the proportional gain to find the critical gain at which the system just starts oscillating steadily, along with that oscillation period. This is the stability boundary seen with the Routh test in the F1 unit and the Nyquist criterion in the F4 unit, and from there the three gains are set by following a table. Reality has traps, too. The derivative term amplifies fast changes and therefore measurement noise as well, so it usually comes with a low-pass filter, and, as in this plot, the derivative is sometimes applied only to the output so that the input does not jump the instant the target steps. Also, if the integral keeps accumulating while the input is stuck at its limit, it later pushes too hard, a problem called integral windup, which anti-windup schemes prevent.
Back to the first screen
On the first screen, you put a PID controller on the plant G = 1/((s + 1)(s + 2)) and tuned the three gains. With only the proportional gain, a steady-state error remained, the output stopping short of the target. Raising the integral gain accumulated the remaining error and lifted the output exactly to the target, but raising it too far increased overshoot and ringing. Adjusting proportional and derivative together to add damping smoothed the response again. With proportional handling speed, integral accuracy, and derivative damping, the three together produced a response that is fast, error-free, and well damped. The loops analyzed so far with the Routh test, the root locus, the Bode plot, and the Nyquist plot have now been shaped into the form you want by designing a controller.
PID shaped the response in the time domain by adding three terms. The tool that does the same job in the frequency domain, aiming directly at the phase and gain of the Bode plot, is the compensator. The next unit, Lead and Lag Compensation, inserts into the loop a small transfer function made of one pole and one zero. A lead compensator raises the phase near the crossover frequency to enlarge the phase margin, so like the derivative term it adds damping and speed, while a lag compensator raises the gain at low frequencies to improve steady-state accuracy, so like the integral term it reduces error. What the D and I of a PID did, a compensator does again by shaping phase and gain on the Bode plot.