Math Detours · Grade 12 · Connections · 5

Cruise control

Measure the error, push back in proportion, and the car settles. Feedback as a differential equation, and why too much gain makes it wobble.

Name ____________________Date ____________

Tonight's idea

Cruise control has one job: hold the speed \(v\) at a target \(v^*\). The simplest design measures the error \(e = v - v^*\) and pushes the throttle against it, in proportion. If the push gives an acceleration proportional to the error,

\[\frac{dv}{dt} = -k\,(v - v^*).\]

The constant \(k\) is the gain (per second). Since \(v^*\) is fixed, \(de/dt = dv/dt\), so \(de/dt = -ke\): rate proportional to amount, as in sheet a11. Separating variables, \(\ln|e| = -kt + C\), so

\(e(t) = e_0 e^{-kt}\), that is, \(v(t) = v^* + (v_0 - v^*)\,e^{-kt}\).

The error shrinks by the same factor every \(1/k\) seconds and never changes sign. A proportional controller cannot overshoot; a bigger \(k\) only arrives sooner.

0 5 10 15 20 25 30 t (s) v (m/s) k = 0.2 k = 0.6 with a 2 s lag target 30
From 20 to 30 m/s with gains 0.2 (solid) and 0.6 (dashed): no overshoot. Orange: gain 1 with a 2 s engine lag overshoots to 33 m/s and wobbles.

So why does a real car surge past the set speed? Nothing responds instantly. The engine takes a second or two to deliver what it is asked for, so the push at time \(t\) answers an earlier error. When the error reaches zero the throttle is still open; the car coasts past, and the controller pulls back, again too late. Small lag, small gain: harmless. Large gain with a lag: a wobble, shaped like the oscillator sheet.

Watch one: \(k = 0.5\), from 20 to 30 m/s

Here \(v^* = 30\), \(v_0 = 20\), so \(v(t) = 30 - 10e^{-0.5t}\). Check it against the equation: the left side is \(dv/dt = 5e^{-0.5t}\); the right side is \(-0.5(v - 30) = -0.5(-10e^{-0.5t}) = 5e^{-0.5t}\). They agree, and \(v(0) = 20\).

After 2 s, \(v = 30 - 10e^{-1} = 26.3\) m/s. To get within 0.1 m/s of the target, solve \(10e^{-0.5t} = 0.1\): \(t = 2\ln 100 \approx 9.2\) s. Each further 4.6 s cuts the error by another factor of ten.

Your turn

  1. Now \(k = 0.2\), \(v_0 = 20\) m/s, \(v^* = 30\) m/s. (a) Write \(v(t)\). (b) When is the speed within 1 m/s of the target? (c) Show the error halves every \(\ln 2 / k\) seconds whatever the start, and evaluate it.
  2. On a hill a constant drag \(d = 0.5\) m/s² acts: \(dv/dt = -k(v - v^*) - d\), with \(k = 0.2\). (a) Find the steady speed \(v_\infty\) from \(dv/dt = 0\). (b) Check that \(v = v_\infty + (v_0 - v_\infty)e^{-kt}\) solves it. (c) What gain would hold the shortfall to 0.5 m/s?
  3. A digital controller samples the error every \(h\) seconds and holds the correction between samples, so \(e_{n+1} = (1 - kh)\,e_n\). (a) With \(k = 0.2\), \(h = 1\), \(e_0 = 10\), list \(e_1, e_2, e_3\). (b) For which \(kh\) does the error shrink without changing sign? Alternate but shrink? Grow? (c) Describe \(k = 3\), \(h = 0.5\).
  4. Model the lag. The controller asks for acceleration \(-ke\), but the actual acceleration \(a\) catches up gradually: \(da/dt = (-ke - a)/\tau\). Using \(e' = a\), show \(\tau e'' + e' + ke = 0\). Try \(e = e^{rt}\) with \(\tau = 1\) s and find \(r\) for \(k = 0.2\), then for \(k = 1\). Which gain wobbles, and why?

Stretch: the threshold gain

In the lag model of question 4, show the roots \(r\) are complex, so the error oscillates, exactly when \(4k\tau \gt 1\). For \(\tau = 2\) s and \(k = 1\), find how fast the wobble dies away and its period.

Answers

  1. (a) \(v = 30 - 10e^{-0.2t}\). (b) \(10e^{-0.2t} = 1\) gives \(t = 5\ln 10 \approx 11.5\) s. (c) \(e_0 e^{-kt} = e_0/2\) gives \(e^{-kt} = \tfrac12\), so \(t = \ln 2 / k\); \(e_0\) cancels. Here \(\ln 2/0.2 \approx 3.5\) s.
  2. (a) \(0 = -0.2(v - 30) - 0.5\), so \(v_\infty = 30 - 2.5 = 27.5\) m/s. (b) Since \(k(v^* - v_\infty) = d\), the right side is \(-k(v - v_\infty) - k(v_\infty - v^*) - d = -k(v - v_\infty) = -k(v_0 - v_\infty)e^{-kt}\), which is \(dv/dt\). (c) The shortfall is \(d/k\); \(0.5/k = 0.5\) needs \(k = 1\). Proportional control always droops on a hill, and raising the gain is the obvious fix. That is where the trouble starts.
  3. (a) \(10, 8, 6.4, 5.12\). (b) The factor is \(1 - kh\): between 0 and 1 for \(0 \lt kh \lt 1\) (shrinks, same sign); between \(-1\) and 0 for \(1 \lt kh \lt 2\) (alternates, shrinks); below \(-1\) for \(kh \gt 2\) (alternates and grows). (c) \(kh = 1.5\), factor \(-0.5\): \(10, -5, 2.5, -1.25, \ldots\). It overshoots every step but halves each time. A sampled controller is a delay, and delay plus high gain is overshoot.
  4. \(e' = a\), so \(e'' = a' = (-ke - e')/\tau\); rearrange. With \(\tau = 1\): \(r^2 + r + k = 0\). For \(k = 0.2\), \(r = \tfrac{-1 \pm \sqrt{0.2}}{2} \approx -0.28, -0.72\), two decaying exponentials and no sign change. For \(k = 1\), \(r = -\tfrac12 \pm i\tfrac{\sqrt3}{2}\), so \(e = e^{-t/2}(A\cos\tfrac{\sqrt3}{2}t + B\sin\tfrac{\sqrt3}{2}t)\): a wobble of period \(4\pi/\sqrt3 \approx 7.3\) s dying away with half-life \(2\ln 2 \approx 1.4\) s. The gain is large enough that the lag lets the error cross zero before the throttle has eased off.

Stretch. \(\tau r^2 + r + k = 0\) has discriminant \(1 - 4k\tau\), negative exactly when \(k \gt 1/(4\tau)\). With \(\tau = 2\), \(k = 1\): \(2r^2 + r + 1 = 0\), so \(r = \tfrac{-1 \pm i\sqrt7}{4}\). The error is \(e^{-t/4}\) times a sinusoid of angular frequency \(\sqrt7/4\): the amplitude falls by a factor \(e\) every 4 s and one wobble takes \(8\pi/\sqrt7 \approx 9.5\) s. In this model the wobble always dies, because the real part is \(-1/(2\tau)\) whatever \(k\) is. A true dead-time delay, where the controller acts on an error measured \(\tau\) seconds ago, is worse: for \(k\tau\) beyond about 1.57 the wobble grows.

← PreviousNext: Why recessive genes do not die out →