Flow Lab

Syllabus / Module 13: Applications: Control Systems

Lesson 13.3

PID Control

Proportional, integral and derivative action; tuning (Ziegler–Nichols, manual); integrator windup; discrete-time PID.

Written byClaude Sonnet

🌊
Why this matters for simulation: Drones and altitude-hold autopilots run PID loops.

By the end of this lesson you can…

  • Write $C(s) = K_p + K_i/s + K_d s$ and say what each term does to speed, steady-state error and damping.
  • Form the characteristic polynomial $10s^3 + (11 + K_d)s^2 + (1 + K_p)s + K_i$ for the cruise plant with an engine lag and compute its poles.
  • Show with the final value theorem that integral action removes the steady-state error of a step reference and a constant hill.
  • Explain integrator windup under saturation and apply anti-windup by clamping.
  • Explain why the derivative amplifies sensor noise by about $K_d/\Delta t$, add a derivative filter, and apply the Ziegler-Nichols reaction-curve rules.
  • Show that raising $K_i$ with $K_p$ fixed ends in instability, and find the edge $K_i = 1.1(1 + K_p)$.
On this page
·
  1. The plant and the setup
  2. P, I and D
  3. The closed-loop poles
  4. The hill and the integral
  5. Derivative action and damping
  6. Noise and the derivative filter
  7. Windup and anti-windup
  8. Tuning: from intuition to Ziegler-Nichols
  9. Where PID shows up in the physics
  10. More worked examples
  11. Concept checks
  12. Playground and exercise
  13. Problems
  14. What comes next
  15. Key Takeaways

13.2 Transfer Functions & Time Response ended on a trade. Proportional control leaves the error 1/(1+Kp)1/(1+K_p); cutting it by raising the gain costs damping, and with the engine lag the overshoot grew from 2.05%2.05\% at K=4K = 4 to 26.55%26.55\% at K=19K = 19. A PID controller adds two new tools: an integral term, which remembers the error and drives it to exactly zero, and a derivative term, which looks at how fast the error is changing and puts damping back. It runs cruise controls, thermostats, drone altitude loops and wind-tunnel speed loops. This lesson builds it on the cruise plant of the last two lessons, shows what each term buys and charges, and ends with a gain that makes the loop unstable.

▶ Video P, I and D on the cruise loop: what each term does to the poles and the hill, windup and anti-windup, derivative noise and the filter, a discrete implementation, Ziegler-Nichols, and the integral gain that breaks the loopcaptions only
Transcript
  1. Welcome to PID control, on the cruise plant of the last two lessons. The controller sees the error e and adds three terms: K p times the error, K i times its integral, and K d times its derivative. As a transfer function that is K p plus K i over s plus K d s. The terms answer three questions: how big is the error now, how long has it been there, and where is it heading. P is fast but leaves an offset. I keeps growing while any error remains, so the controller rests only at zero error. D opposes a speed that is changing quickly, like a damper.
  2. Now the hill. With P alone at K p equal 4 the step error is 0.2000, and after the hill the error doubles to 0.4000. Add integral action, K i equal 0.5. The hill dip falls from 0.4069 to 0.1850, and the speed climbs back to 1, with an error of 0.0015 at 80 seconds, the slow pole still finishing. The final value theorem explains it: the hill's transfer function has a zero at the origin, which blocks a constant disturbance. At rest the integrator holds u equal 2: it has become the memory of the hill.
  3. Close the loop and the characteristic polynomial is a cubic: 10 s cubed plus 11 plus K d times s squared, plus 1 plus K p times s, plus K i. The three gains set the three coefficients. Take K p equal 10 and K i equal 1. The PI loop has poles at minus 0.5 plus or minus 0.8660 i, and rings with 16.50 percent overshoot. Adding K d equal 6 raises the s squared coefficient from 11 to 17 and moves the pair to minus 0.7962 plus or minus 0.5428 i, further left and lower. Overshoot falls to 6.21 percent. D buys damping, not speed: settling grows from 8.10 to 14.28 seconds, held by the slow pole at minus 0.1077.
  4. When the command is clipped the loop is momentarily open, the error stays large, and the integral keeps accumulating a debt the plant never sees. That is integrator windup. Take PI with K p 4 and K i 1 and a limit of 2.5. With no anti-windup the speed overshoots by 36.53 percent and settles at 17.35 seconds. Clamping freezes the integral while the output is saturated and the error would push it deeper. Overshoot falls to 4.43 percent, settling to 13.38 seconds. Anti-windup cannot beat the limit: with the limit at 1.5 the hill needs u equal 2, and both runs end with an error of 0.4925.
  5. Differentiation amplifies fast changes, and noise is nothing but fast changes. A backward difference of noise of rms sigma has rms about sigma root 2 over delta t, and the D term multiplies it by K d. With sigma 0.01, K d 6 and delta t 0.01 the estimate is 8.485, and the lab measures a jitter of 8.4985 in the command. The cure is a derivative filter. A filter time constant of 0.1 seconds drops the jitter to 0.6513, a factor of thirteen, with almost no change in the response. At 0.5 it is 0.2161, at 1.0 it is 0.1579, but the filter pole comes in from the left, meets the dominant poles, and the derivative gets sluggish.
  6. For a first guess there is the Ziegler-Nichols reaction-curve rule, quoted from memory. Draw the tangent at the steepest point of the open-loop step, and read an apparent delay L and a time constant T. For this plant the steepest slope is 0.07743 at about 2.555 seconds, so L is 0.6429 and T is 12.9155. The rule gives K p 24.11, K i 18.75 and K d 7.75. The lab then shows poles at minus 0.3752 plus or minus 1.2355 i and minus 1.1247, overshoot 56.74 percent, and a peak command of 24.20. It aims at a loop that rings on purpose, so detune it.
  7. Hold K p at 4 and raise K i. At 0.5 the overshoot is 5.87 percent, with poles at minus 0.4823 plus or minus 0.3699 i. At 2 it is 46.90 percent and settling takes 26.53 seconds. At 5.5 the pair sits on the imaginary axis at plus or minus 0.7071 i, the overshoot is 101.95 percent and the response never settles. At 6 the pair has crossed to plus 0.0141 plus or minus 0.7291 i, and the response grows. The edge comes from substituting s equal i omega into the polynomial: K i equals 1.1 times 1 plus K p. At K p equal 4 that is 5.5. More integral action removes the offset faster, and then the poles slide right.
  8. P sets the speed and leaves an offset, I removes it, and D adds damping. The three gains set the coefficients of a cubic whose roots are the closed-loop poles. The costs are windup, noise, and a Ziegler-Nichols command that is far too large. And at K p equal 4, K i equal 6 is unstable. Lesson 13.4 is not yet written. It is meant to take the s equal i omega substitution that found the edge and turn it into the Routh-Hurwitz criterion, a stability test that needs no root finder, and the root locus, a picture of how every pole moves as one gain changes.

The plant and the setup

Every number here comes from one plant: the car of 13.1 Feedback & Block Diagrams with the 11 s engine lag of 13.2 (assumed). With yy the speed deviation, uu the command and dd a hill in the same units,

a˙=u−a,10 y˙=a−y+d,P(s)=1(10s+1)(s+1).\dot a = u - a, \qquad 10\,\dot y = a - y + d, \qquad P(s) = \frac{1}{(10s+1)(s+1)} .

The reference is a unit step at t=0t = 0 and the hill of 13.1 (d=−1d = -1) arrives at t=40t = 40 s (13.1 used 3030 s; the integral needs longer to settle first). The lab runs the loop to 8080 s with RK4 at Δt=0.01\Delta t = 0.01 s, the controller sampled at that step.

P, I and D

The controller sees the error e=r−ye = r - y and forms three terms:

u(t)=Kp e(t)+Ki∫0te dσ+Kd e˙(t),C(s)=Kp+Kis+Kd s.u(t) = K_p\,e(t) + K_i\int_0^t e\,d\sigma + K_d\,\dot e(t), \qquad C(s) = K_p + \frac{K_i}{s} + K_d\,s .

Textbooks also write Kp(1+1/(Tis)+Tds)K_p(1 + 1/(T_i s) + T_d s), with Ti=Kp/KiT_i = K_p/K_i and Td=Kd/KpT_d = K_d/K_p. The terms answer three questions: how big is the error now (P), how long has it been there (I), and where is it heading (D).

Proportional. Closing the loop with KpK_p gives the 13.2 polynomial 10s2+11s+1+Kp10s^2 + 11s + 1 + K_p. At Kp=4K_p = 4 the poles are −0.55±0.4444i-0.55 \pm 0.4444i and the step error settles at 1/(1+Kp)=0.21/(1+K_p) = 0.2. A bigger KpK_p is faster with less error, but the poles climb toward the imaginary axis and the throttle jumps by KpK_p on a unit step.

Integral. The term Ki∫eK_i\int e keeps growing while any error remains, so the controller rests only when e=0e = 0. In transform terms C(s)C(s) has a pole at s=0s = 0, so the loop gain L=CPL = CP has a free integrator: the loop is type 1 (13.2), and for a step reference e∞=lim⁡s→01/(1+L(s))=0e_\infty = \lim_{s\to0} 1/(1+L(s)) = 0. The price is a third closed-loop pole and a more oscillatory transient.

Derivative. The term Kde˙K_d\dot e opposes a speed that is changing quickly, the way a damper opposes a piston. It adds nothing at steady state; in the polynomial below it adds KdK_d to the s2s^2 coefficient.

The closed-loop poles

Close the loop around PP with the ideal PID. The loop gain is L(s)=(Kds2+Kps+Ki)/(s(10s+1)(s+1))L(s) = (K_d s^2 + K_p s + K_i)/\bigl(s(10s+1)(s+1)\bigr), and 1+L=01 + L = 0 becomes

s (10s2+11s+1)+Kds2+Kps+Ki=10s3+(11+Kd) s2+(1+Kp) s+Ki=0.s\,(10s^2 + 11s + 1) + K_d s^2 + K_p s + K_i = 10s^3 + (11 + K_d)\,s^2 + (1 + K_p)\,s + K_i = 0 .

With Ki=0K_i = 0 the factor ss cancels and P and PD return to a quadratic. The three gains set the three coefficients: KdK_d the s2s^2 one, KpK_p the ss one, KiK_i the constant.

The lab’s measurements (Δt=0.01\Delta t = 0.01 s, unit step at 00, hill d=−1d = -1 at 4040 s): overshoot and 2%2\% settling are read from the true speed before the hill; the errors are 1−y1 - y; the dip is how far below 11 the speed falls after the hill; the peak is the largest ∣u∣|u| the PID formula asks for before the hill.

controllerpolesovershootsettlingerror at 40 sworst diperror at 80 speak uu
P: Kp=4K_p = 4−0.55±0.4444i-0.55 \pm 0.4444i0%0\%never0.20000.20000.40690.40690.40000.40004.0004.000
PI: 4, 0.54,\ 0.5−0.4823±0.3699i, −0.1353-0.4823 \pm 0.3699i,\ -0.13535.87%5.87\%13.6713.67 s−0.0005-0.00050.18500.18500.00150.00154.0874.087
PI: 10, 110,\ 1−0.5±0.8660i, −0.1-0.5 \pm 0.8660i,\ -0.116.50%16.50\%8.108.10 s0.00000.00000.11260.11260.00180.001810.05210.052
PID: 10, 1, 610,\ 1,\ 6−0.7962±0.5428i, −0.1077-0.7962 \pm 0.5428i,\ -0.10776.21%6.21\%14.2814.28 s−0.0013-0.00130.08950.08950.00150.001510.00010.000

The P row is the loop of 13.2: error 0.20.2, then 0.40.4 after the hill. With an integral term both go to zero (the 0.00150.0015 is the slow pole at −0.1353-0.1353 still finishing). A rough estimate keeps the last two terms, (1+Kp)s+Ki≈0(1 + K_p)s + K_i \approx 0, so the slow pole is near −Ki/(1+Kp)-K_i/(1 + K_p): −0.1-0.1 against the true −0.1353-0.1353 for 4, 0.54,\ 0.5, and −0.0909-0.0909 against −0.1-0.1 for 10, 110,\ 1.

◆ Interactive PID on the cruise loop: sliders for Kp, Ki, Kd, the derivative filter and the actuator limit, switches for anti-windup and sensor noise, with the closed-loop poles drawn from the characteristic polynomial

Loading simulation…

Worked example: the PI poles by hand. For Kp=4K_p = 4, Ki=0.5K_i = 0.5 the polynomial is 10s3+11s2+5s+0.510s^3 + 11s^2 + 5s + 0.5: the roots sum to −1.1-1.1 and multiply to −0.05-0.05. The lab’s −0.1353-0.1353 and −0.4823±0.3699i-0.4823 \pm 0.3699i sum to −1.0999-1.0999 and multiply to −0.1353×0.3694=−0.0500-0.1353 \times 0.3694 = -0.0500. The pair has ωn=0.3694=0.6078\omega_n = \sqrt{0.3694} = 0.6078 and ζ=0.4823/0.6078=0.7935\zeta = 0.4823/0.6078 = 0.7935.

The hill and the integral

The hill enters after the engine lag, so the closed-loop transfer function from dd to yy is

YD=1/(10s+1)1+CP=s (s+1)10s3+(11+Kd)s2+(1+Kp)s+Ki.\frac{Y}{D} = \frac{1/(10s+1)}{1 + CP} = \frac{s\,(s+1)}{10s^3 + (11+K_d)s^2 + (1+K_p)s + K_i} .

A constant hill is D=d/sD = d/s, so the final value theorem gives y∞=lim⁡s→0s(s+1) d/char(s)=0y_\infty = \lim_{s\to0} s(s+1)\,d/\text{char}(s) = 0 whenever Ki≠0K_i \neq 0 and the loop is stable: the factor ss is a zero of the disturbance path at the origin, which blocks a constant disturbance. With Ki=0K_i = 0 the same calculation gives d/(1+Kp)d/(1+K_p), the dent of 13.1.

In the lab the dip falls from 0.40690.4069 with P alone to 0.18500.1850 with PI at 4, 0.54,\ 0.5, and the speed returns to 11. What does the integrator hold at the end? At rest 10y˙=a−y+d=010\dot y = a - y + d = 0 with y=1y = 1 gives a=1−d=2a = 1 - d = 2, so u=2u = 2. With e=0e = 0 the other terms vanish, so the integral state itself is 22: it has become the memory of the hill.

Derivative action and damping

For Kp=10K_p = 10, Ki=1K_i = 1 the PI loop has poles −0.5±0.8660i-0.5 \pm 0.8660i and rings: 16.50%16.50\% overshoot. Adding Kd=6K_d = 6 raises the s2s^2 coefficient from 1111 to 1717 and moves the pair to −0.7962±0.5428i-0.7962 \pm 0.5428i: further left and lower, so the damping ratio rises. Overshoot falls to 6.21%6.21\% and the hill dip from 0.11260.1126 to 0.08950.0895. D buys damping, not speed: settling goes from 8.108.10 s to 14.2814.28 s, because the slow integral pole at −0.1077-0.1077 holds the tail.

The lab takes the derivative of the measurement: u=Kpe+I−Kd y˙measu = K_p e + I - K_d\,\dot y_{\text{meas}}. The error’s derivative differs only when the reference jumps, where it is an infinite spike (the “derivative kick”, from memory of standard practice). The poles are unchanged, since the polynomial only knows about the loop.

Noise and the derivative filter

Differentiation amplifies fast changes, and noise is nothing but fast changes. White noise of rms σ\sigma sampled every Δt\Delta t gives a backward difference of rms about σ2/Δt\sigma\sqrt2/\Delta t (two independent samples differ with variance 2σ22\sigma^2), and the D term multiplies it by KdK_d. For σ=0.01\sigma = 0.01, Kd=6K_d = 6 and Δt=0.01\Delta t = 0.01 s the estimate is 6×0.01×1.4142/0.01=8.4856 \times 0.01 \times 1.4142/0.01 = 8.485; the lab measures an rms jitter of 8.49858.4985 in the PID output over 1010 to 3030 s. The P term passes only KpσK_p\sigma: the lab’s PI at Kp=10K_p = 10 measures 0.09890.0989. The car barely feels it (speed jitter 0.000440.00044 in every run below), but a real throttle would be shaken to pieces.

The cure is a derivative filter: replace KdsK_d s by Kds/(Tfs+1)K_d s/(T_f s + 1). The lab implements it on the measurement as y˙f(k)=(Tfy˙f(k−1)+yk−yk−1)/(Tf+Δt)\dot y_f(k) = (T_f\dot y_f(k-1) + y_k - y_{k-1})/(T_f + \Delta t), a plain backward difference at Tf=0T_f = 0. The polynomial becomes (Tfs+1)[s(10s2+11s+1)+Kps+Ki]+Kds2(T_f s + 1)\bigl[s(10s^2+11s+1) + K_p s + K_i\bigr] + K_d s^2, one degree higher, with an extra pole near −1/Tf-1/T_f. For Kp=10K_p = 10, Ki=1K_i = 1, Kd=6K_d = 6:

TfT_f (s)PID output jitterovershootsettlingextra poles
008.49858.49856.21%6.21\%14.2814.28 snone
0.10.10.65130.65135.64%5.64\%14.4114.41 s−9.2766-9.2766
0.50.50.21610.21613.95%3.95\%14.9314.93 spair at −1.1292±1.1157i-1.1292 \pm 1.1157i
1.01.00.15790.15793.36%3.36\%15.5015.50 spair at −0.7456±1.1322i-0.7456 \pm 1.1322i

At Tf=0.1T_f = 0.1 s the jitter falls by a factor of thirteen with almost no change in the response. The cost grows with TfT_f: the filter pole comes in from the left (−9.2766-9.2766 against the naive −1/Tf=−10-1/T_f = -10), meets the dominant poles, and the derivative gets sluggish. A rule of thumb (from memory) is TfT_f between Td/10T_d/10 and Td/5T_d/5; here Td=Kd/Kp=0.6T_d = K_d/K_p = 0.6 s, so 0.060.06 to 0.120.12 s.

Windup and anti-windup

Real actuators saturate. When the command is clipped the loop is momentarily open: the error stays large and the integral keeps accumulating a debt the plant never sees. That is integrator windup. When the car nears the reference the integral state is far too large, and the speed overshoots until the error has been negative long enough to unwind it.

In the lab take PI with Kp=4K_p = 4, Ki=1K_i = 1 and limit umax⁡=2.5u_{\max} = 2.5 (the step asks for 44, so it saturates at the start):

anti-windupovershootsettlingworst dip after the hillerror at 80 s
off36.53%36.53\%17.3517.35 s0.17350.17350.00000.0000
clamping4.43%4.43\%13.3813.38 s0.17350.17350.00000.0000

Windup costs 3232 points of overshoot; the hill is handled identically, since the u=2u = 2 it needs is within the limit.

Clamping (conditional integration) does not integrate when the output is saturated and the error would drive it deeper in. With uu the PID output and usatu_{\text{sat}} the clipped one,

Ik+1={Ikif usat≠u and e u>0,Ik+Ki e Δtotherwise.I_{k+1} = \begin{cases} I_k & \text{if } u_{\text{sat}} \neq u \text{ and } e\,u \gt 0, \\ I_k + K_i\,e\,\Delta t & \text{otherwise.} \end{cases}

The sign test lets the integral keep working in the direction that leads out of saturation.

Anti-windup cannot beat the limit. With the limit at 1.51.5 the hill needs u=2u = 2 and the car cannot hold the speed: both runs end with error 0.49250.4925 at 8080 s, near the 0.50.5 that y=u+d=1.5−1y = u + d = 1.5 - 1 predicts. Clamping only guarantees a clean recovery (overshoot 0.86%0.86\% against 36.13%36.13\% with it off).

Tuning: from intuition to Ziegler-Nichols

A workable order: raise KpK_p until the loop starts to ring; add KiK_i just enough to kill the offset in the time you can wait; add KdK_d to restore damping; then check noise and saturation.

Ziegler-Nichols gives a first guess. The reaction-curve rule (from memory) steps the open-loop plant, draws the tangent at the steepest point, and reads an apparent delay LL (where the tangent crosses zero) and a time constant T=1/slopeT = 1/\text{slope} for unit static gain. For PID: Kp=1.2 T/LK_p = 1.2\,T/L, Ti=2LT_i = 2L, Td=L/2T_d = L/2, so Ki=Kp/TiK_i = K_p/T_i and Kd=KpTdK_d = K_pT_d. (The other method needs the ultimate gain at which P control sustains an oscillation. It cannot be used here: 10s2+11s+1+Kp10s^2 + 11s + 1 + K_p has positive coefficients for every KpK_p, so the P loop never oscillates.)

For this plant the lab finds a steepest slope of 0.077430.07743 at about 2.5552.555 s, so L=0.6429L = 0.6429 s and T=12.9155T = 12.9155 s, hence Kp=24.106K_p = 24.106, Ti=1.286T_i = 1.286 s, Td=0.3215T_d = 0.3215 s, Ki=18.747K_i = 18.747, Kd=7.749K_d = 7.749. The button loads 24.1124.11, 18.7518.75 and 7.757.75: poles −0.3752±1.2355i-0.3752 \pm 1.2355i and −1.1247-1.1247, overshoot 56.74%56.74\%, settling 10.7410.74 s, hill dip 0.04990.0499, peak command 24.2024.20. The recipe aims (from memory) at quarter-amplitude decay, a loop that rings on purpose, and a 2424-fold command is more than a throttle supplies: detune it.

Where PID shows up in the physics

The yaw damper of 12.6 Lateral-Directional Modes was the D term of a heading controller: the yaw rate is the derivative of heading, and feeding it back moved the Dutch roll pole left. A heading autopilot adds P on the heading error and often I, so a steady crosswind leaves no standing error. An altitude hold around 12.5 Trim, Linearization & Longitudinal Modes has the same structure, with elevator rate limits as the saturation that makes anti-windup a safety matter.

More worked examples

The edge of stability, by hand. At the edge a pair sits at s=±iωs = \pm i\omega. Substituting into 10s3+11s2+(1+Kp)s+Ki10s^3 + 11s^2 + (1+K_p)s + K_i, the real part is −11ω2+Ki-11\omega^2 + K_i and the imaginary part is −10ω3+(1+Kp)ω-10\omega^3 + (1+K_p)\omega. Both vanish when ω2=(1+Kp)/10\omega^2 = (1 + K_p)/10 and Ki=11ω2=1.1 (1+Kp)K_i = 11\omega^2 = 1.1\,(1 + K_p). For Kp=4K_p = 4: ω=0.7071\omega = 0.7071 and Ki=5.5K_i = 5.5, and 10s3+11s2+5s+5.5=(s2+0.5)(10s+11)10s^3 + 11s^2 + 5s + 5.5 = (s^2 + 0.5)(10s + 11) has the third pole at −1.1-1.1.

Concept checks

✅ Concept check

The cruise loop has PI control, a stable closed loop, and a constant hill $d = -1$. What is the steady-state speed error caused by the hill?

✅ Concept check

For $K_p = 4$ and the cruise plant with the engine lag, what is the largest integral gain $K_i$ that keeps the PI loop stable?

✅ Concept check

A PI loop saturates its actuator during a large step, and the speed overshoots badly afterwards. What is the cause, and what is the fix?

✅ Concept checkselect all that apply

Select every statement that is true about the derivative term and sensor noise.

Playground and exercise

The same loop in plain Python, with every part of the lab: the filtered derivative on the measurement, the clamp, and an RK4 plant step with the command held over each Δt\Delta t.

🐍 PythonPlayground: the PID loop at dt = 0.01 s, with poles from the characteristic polynomial and the windup comparison
⌘/Ctrl + Enter

Now implement the four building blocks of the lesson: the polynomial, the stability edge, the filtered derivative and the clamped integral.

🧪 Coding exerciseExercise: characteristic polynomial, the Ki edge, the derivative filter, and the clamped integrator
⌘/Ctrl + Enter

Problems

✏️ Pen & paperPoles of a PI loop and its edge●○○

The cruise plant with the engine lag is under PI control with Kp=9K_p = 9. Write the characteristic polynomial for Ki=2K_i = 2, and find the largest stable KiK_i and the oscillation frequency there.

Show worked solution

The polynomial is 10s3+11s2+10s+210s^3 + 11s^2 + 10s + 2; a numerical root finder gives −0.2549-0.2549 and −0.4225±0.7785i-0.4225 \pm 0.7785i, all in the left half plane. At the edge s=iωs = i\omega: the real part −11ω2+Ki=0-11\omega^2 + K_i = 0 and the imaginary part −10ω3+10ω=0-10\omega^3 + 10\omega = 0 give ω2=1\omega^2 = 1, so ω=1\omega = 1 rad/s and Ki=11K_i = 11, which is 1.1(1+Kp)=1.1×101.1(1 + K_p) = 1.1 \times 10. Check: 10s3+11s2+10s+11=(s2+1)(10s+11)10s^3 + 11s^2 + 10s + 11 = (s^2 + 1)(10s + 11).

✏️ Pen & paperWhat the integrator holds●●○

With r=1r = 1, a hill d=−0.7d = -0.7 and a stable PI loop, find the steady-state speed, the steady-state command uu, and the integral state. If the actuator limit is 1.51.5, find the steady-state speed and error.

Show worked solution

Zero error means y=1y = 1. At rest a=ua = u and 0=a−y+d0 = a - y + d, so u=1−d=1.7u = 1 - d = 1.7. With e=0e = 0 the P and D terms vanish, so the integral state is 1.71.7. A limit of 1.51.5 is below this: the speed settles where y=u+d=1.5−0.7=0.8y = u + d = 1.5 - 0.7 = 0.8, an error of 0.20.2, whatever the controller does.

✏️ Pen & paperZiegler-Nichols by hand●●●

A plant with unit static gain has a step response whose tangent at the steepest point crosses zero at L=2L = 2 s and reaches 11 at L+TL + T with T=20T = 20 s. Use the reaction-curve rules (from memory: Kp=1.2 T/LK_p = 1.2\,T/L, Ti=2LT_i = 2L, Td=L/2T_d = L/2) to find KpK_p, KiK_i and KdK_d. Then explain why the lesson’s cruise plant gives a much larger KpK_p.

Show worked solution

Kp=1.2×20/2=12K_p = 1.2 \times 20/2 = 12, Ti=4T_i = 4 s so Ki=12/4=3K_i = 12/4 = 3, Td=1T_d = 1 s so Kd=12×1=12K_d = 12 \times 1 = 12. The cruise plant has L=0.6429L = 0.6429 s, much shorter relative to T=12.9155T = 12.9155 s: T/L=20.1T/L = 20.1, against 1010 here, so Kp=1.2×20.1=24.1K_p = 1.2 \times 20.1 = 24.1. The rule says a plant with a short effective delay can be driven hard.

What comes next

The KiK_i ladder is the warning. At Kp=4K_p = 4 the lab gives 5.87%5.87\% overshoot at Ki=0.5K_i = 0.5 (poles −0.4823±0.3699i-0.4823 \pm 0.3699i, −0.1353-0.1353) and 46.90%46.90\% at Ki=2K_i = 2 (poles −0.1562±0.4791i-0.1562 \pm 0.4791i, −0.7876-0.7876, settling 26.5326.53 s). At Ki=5.5K_i = 5.5 the pair sits on the imaginary axis at ±0.7071i\pm 0.7071i (101.95%101.95\%, never settles), and at Ki=6K_i = 6 it has crossed to +0.0141±0.7291i+0.0141 \pm 0.7291i and the response grows. More integral action removes the offset faster, and then the poles slide right. The edge Ki=1.1(1+Kp)K_i = 1.1(1 + K_p) came from substituting s=iωs = i\omega: the idea behind the Routh-Hurwitz criterion and the root locus of lesson 13.4 (13.4 Stability: Routh–Hurwitz & Root Locus), a stability test that needs no root finder and a picture of how every pole moves as one gain changes.

Key Takeaways

  • PID is u=Kpe+Ki∫e+Kde˙u = K_pe + K_i\int e + K_d\dot e, C(s)=Kp+Ki/s+KdsC(s) = K_p + K_i/s + K_ds: P sets speed and leaves an offset, I removes it by adding a pole at the origin, D adds damping.
  • The cruise loop with the engine lag has polynomial 10s3+(11+Kd)s2+(1+Kp)s+Ki10s^3 + (11+K_d)s^2 + (1+K_p)s + K_i. PI at 4, 0.54,\ 0.5: poles −0.4823±0.3699i-0.4823 \pm 0.3699i, −0.1353-0.1353 (5.87%5.87\%). PID at 10, 1, 610,\ 1,\ 6: −0.7962±0.5428i-0.7962 \pm 0.5428i, −0.1077-0.1077 (6.21%6.21\% against 16.50%16.50\% for PI at 10, 110,\ 1).
  • With Ki≠0K_i \neq 0 the hill gives zero steady-state error (the integral ends at u=1−d=2u = 1 - d = 2).
  • Windup: with a limit of 2.52.5 clamping cuts overshoot from 36.53%36.53\% to 4.43%4.43\%; no anti-windup can fix a limit below what the hill needs.
  • The derivative amplifies noise by Kd/ΔtK_d/\Delta t: jitter 8.49858.4985 at Tf=0T_f = 0, 0.65130.6513 at 0.10.1 s; the price is a filter pole near −1/Tf-1/T_f.
  • Ziegler-Nichols (from memory) gives 24.1124.11, 18.7518.75, 7.757.75 here: 56.74%56.74\% overshoot, peak command 24.2024.20.
  • Raising KiK_i at Kp=4K_p = 4 ends in instability at 5.55.5.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: