Lecture note · Fig. 9 · control systems
Driven oscillations: how a system answers a push, and how a controller takes the push over
Numa Koudsie · for school students and first- and second-year undergraduates
01A push from outside
Push a child on a swing. Push at the wrong moments and the swing barely moves; push in time with it and, with gentle pushes, it soon flies high.
The swing has a rhythm of its own, and your hand is a second rhythm that the swing does not control. Everything interesting about driven systems comes from the meeting of these two rhythms. A washing machine shakes hardest for a few seconds while its drum speeds up through one particular rate of turning. A loudspeaker cone follows the music only because it was designed so that its own rhythm lies far from the notes it plays. London’s Millennium Bridge swayed on its opening day in 2000 because thousands of footsteps fed its sideways motion.
In the first two cases a system with its own natural frequency is driven by a force that depends on time and on nothing else: the driver does not care where the system is. That is the idealisation of this page. The bridge shows its limit: the walkers adjusted their steps to the sway, so the force depended on the very motion it was driving, a feedback loop that needs a larger model. In control engineering this force is the input, the motion is the output, and the system in between is the plant. Our plant is the simplest one with a rhythm of its own (Figure 1).
02The model
Three forces act along the floor. The spring pulls back in proportion to the stretch, \(-kx\) (Hooke’s law). The damper, a piston in oil, resists in proportion to the speed, \(-c\dot x\). The driver pushes with \(F(t)\). Newton’s second law adds them:
\[ m\ddot x + c\dot x + kx = F_0\cos\Omega t . \tag{1} \]It is tidier to describe the plant by two numbers with a direct meaning. The natural frequency \(\omega_0 = \sqrt{k/m}\) is the angular frequency at which the block would ring with no damper; the damping ratio \(\zeta = c/(2\sqrt{km})\) says how quickly the ringing dies, from \(\zeta = 0\) (forever) to \(\zeta = 1\) (no ringing at all). Dividing (1) by \(m\),
\[ \ddot x + 2\zeta\omega_0\,\dot x + \omega_0^2\,x = \frac{F_0}{m}\cos\Omega t . \tag{2} \]On the page \(m = 1\ \mathrm{kg}\), and the sliders set the spring constant \(k\), the damping ratio \(\zeta\), \(F_0\) and the drive frequency \(f = \Omega/2\pi\); the natural frequency follows from the spring, \(f_0 = \sqrt{k/m}/2\pi\), and the damper from both, \(c = 2\zeta\sqrt{km}\). With the defaults, \(k = 9.87\ \mathrm{N/m}\) and \(\zeta = 0.05\), so \(f_0 = 0.5\ \mathrm{Hz}\) and \(c = 0.314\ \mathrm{kg/s}\). After Solve the block starts at rest in its rest position, \(x(0) = 0\), \(\dot x(0) = 0\); §10 shows how to start it anywhere by hand.
Notice what sets this equation apart from the double pendulum of Fig. 2: the time \(t\) appears on its own, inside \(\cos\Omega t\). The future depends not only on where the block is, but also on the clock, because the clock belongs to someone else.
03The exact solution★
Equation (2) is linear, so its solutions add. The general solution is one particular solution that keeps pace with the driver plus any solution of the free equation (right-hand side zero), chosen to satisfy the starting conditions.
3.1The steady state
Guess that, once things settle, the block moves at the driver’s own frequency. Complex numbers make the guess painless: write the driving term \(F_0\cos\Omega t/m\) as the real part of \(\tfrac{F_0}{m}e^{i\Omega t}\) and try \(x = \operatorname{Re}\,Z e^{i\Omega t}\). Each time derivative becomes a factor \(i\Omega\), and (2) turns into algebra:
\[ \begin{gathered} \left(\omega_0^2 - \Omega^2 + 2i\zeta\omega_0\Omega\right) Z = \frac{F_0}{m} \\ \Longrightarrow\quad Z = \frac{F_0/m}{\omega_0^2 - \Omega^2 + 2i\zeta\omega_0\Omega} = X e^{-i\varphi} . \end{gathered} \tag{3} \]The denominator has a plain reading. Multiplied by \(m\) it is \(k - m\Omega^2 + ic\Omega\), one term for each part of the plant. The spring gives \(k\). The mass gives \(-m\Omega^2\): at the drive frequency the acceleration is \(-\Omega^2\) times the displacement, so inertia acts like a spring with negative stiffness. The damper gives \(ic\Omega\), a push a quarter cycle out of step with the displacement. Near \(\Omega = \omega_0\) the first two cancel, and only the damper is left to hold the motion back.
Dividing by a complex number divides by its length and turns back by its angle. So \(X\) is \(F_0/m\) divided by the length of the denominator, and the phase lag \(\varphi\) is the angle of the denominator, somewhere between \(0^\circ\) and \(180^\circ\) because its imaginary part \(2\zeta\omega_0\Omega\) is positive; \(\operatorname{atan2}(y, x)\) is simply the name, in code, for the angle of the point \((x, y)\). All the coefficients in (2) are real, so the real part of the complex solution solves the real problem, and the steady motion is \(x_\text{p}(t) = \operatorname{Re}\,X e^{i(\Omega t - \varphi)} = X\cos(\Omega t - \varphi)\), with
\[ X = \frac{F_0/m}{\sqrt{\left(\omega_0^2-\Omega^2\right)^2 + \left(2\zeta\omega_0\Omega\right)^2}}, \qquad \varphi = \operatorname{atan2}\!\left(2\zeta\omega_0\Omega,\ \omega_0^2-\Omega^2\right) . \tag{4} \]3.2The transient
For the free equation, try \(x = e^{st}\). Each derivative brings down a factor \(s\), so \(s^2 + 2\zeta\omega_0 s + \omega_0^2 = 0\), and \(s = -\zeta\omega_0 \pm i\,\omega_0\sqrt{1-\zeta^2}\). The real part makes the motion die away with the time constant \(\tau = 1/(\zeta\omega_0)\); the imaginary part makes it ring at the damped frequency \(\omega_d = \omega_0\sqrt{1-\zeta^2}\). At \(\zeta = 1\) the imaginary part reaches zero and there is nothing left to ring: the damping ratio measures the damper against the one, \(c = 2\sqrt{km}\), that just stops the ringing. Adding such a ringing, \(e^{-t/\tau}(C_1\cos\omega_d t + C_2\sin\omega_d t),\) to the steady state and demanding \(x(0) = \dot x(0) = 0\) fixes its two constants: at \(t = 0\) the two conditions read \(X\cos\varphi + C_1 = 0\) and \(X\Omega\sin\varphi - \zeta\omega_0 C_1 + \omega_d C_2 = 0\), so
\[ \begin{aligned} x(t) &= X\cos(\Omega t-\varphi) + e^{-t/\tau}\left(C_1\cos\omega_d t + C_2\sin\omega_d t\right), \\ C_1 &= -X\cos\varphi, \qquad C_2 = \frac{\zeta\omega_0\,C_1 - X\Omega\sin\varphi}{\omega_d} . \end{aligned} \tag{5} \]Read (5) as a story in two acts. At first the block rings at its own frequency, because a sudden push excites its own rhythm. That ringing dies within a few \(\tau\), and afterwards only the driver’s rhythm remains. With the defaults, \(\tau = 6.37\ \mathrm{s}\), \(X = 0.482\ \mathrm{m}\) and \(\varphi = 25.3^\circ\).
04Resonance and phase
Formula (4) contains the whole of Figure 2. Drive slowly, \(\Omega \ll \omega_0\), and the block simply follows the force, stretched by the static amount \(F_0/k\). Drive fast, \(\Omega \gg \omega_0\), and the block hardly moves: its inertia wins. In between, near \(\Omega = \omega_0\), the spring term and the inertia term in (3) cancel, only the small damping term is left to limit the motion, and the amplitude soars. This is resonance.
The height of the peak measures how weakly damped the plant is. At \(\Omega = \omega_0\) exactly, (4) gives
\[ X(\omega_0) = \frac{F_0}{2\zeta k} = Q\,\frac{F_0}{k}, \qquad Q = \frac{1}{2\zeta}, \tag{6} \]so the quality factor \(Q\) is the amplification at resonance. The default \(\zeta = 0.05\) gives \(Q = 10\): a force that would stretch the spring by \(0.101\ \mathrm{m}\) if applied slowly moves the block \(1.01\ \mathrm{m}\) at resonance. The true maximum sits slightly below \(\omega_0\). To find it, look at the square of the denominator of (4) as a function of \(\Omega^2\) and complete the square:
\[ \left(\omega_0^2-\Omega^2\right)^2 + \left(2\zeta\omega_0\Omega\right)^2 = \left[\Omega^2 - \omega_0^2\left(1-2\zeta^2\right)\right]^2 + 4\zeta^2\left(1-\zeta^2\right)\omega_0^4 . \tag{6a} \]The amplitude is largest where this is smallest, where the bracket vanishes: \(\Omega_r = \omega_0\sqrt{1-2\zeta^2}\), that is \(f_r = 0.4987\ \mathrm{Hz}\) for the defaults. For \(\zeta \ge 1/\sqrt2\) the bracket cannot vanish for any drive; the denominator is then smallest at \(\Omega = 0\), the amplitude only falls as the drive speeds up, and there is no peak at all.
The phase tells the swing story in numbers. Below resonance the block moves with the force (\(\varphi \approx 0\)). At resonance it lags by exactly a quarter period, \(\varphi = 90^\circ\): the force is largest when the block is fastest, which is precisely when a push does the most work. Far above resonance the block moves against the force (\(\varphi \to 180^\circ\)).
Set the drive frequency equal to the natural frequency, \(f = f_0 = 0.50\ \mathrm{Hz}\), and press Solve. Wait until the transient has died, then compare Measured, last 10 s with \(Q F_0/k\) from (6), and read Phase lag φ. Now raise the damping ratio to 0.2, repeat, and find the factor by which the amplitude fell.
05The control engineer’s view★
Engineers compress everything above into one function. Take the Laplace transform of (1) with the block starting at rest: each time derivative becomes a factor \(s\), and the output is the input multiplied by the transfer function \(G(s)\). Here \(X(s)\) and \(F(s)\) are the transforms of \(x(t)\) and \(F(t)\), not the amplitude \(X\) of (4):
\[ X(s) = G(s)\,F(s), \qquad G(s) = \frac{1}{ms^2 + cs + k} . \tag{7} \]The zeros of the denominator, the poles \(s = -\zeta\omega_0 \pm i\omega_d\), are the plant’s own rhythm in disguise: their real part is the decay rate with a minus sign, \(-1/\tau\), their imaginary part the ringing frequency \(\omega_d\). Both lie in the left half of the complex plane, which is what makes the plant stable: left alone, it returns to rest.
Setting \(s = i\Omega\) gives the response to a steady sinusoidal input, and comparing with (3), \(G(i\Omega) = X e^{-i\varphi}/F_0\). Plotting \(|G(i\Omega)|\) and \(\varphi\) against the drive frequency on logarithmic axes gives the Bode plot, the Bode view of the last figure on this page; its linear view shows the same curves as the amplitude function of §12. It is the plant’s identity card: from it an engineer reads how strongly each frequency gets through and how late it arrives. Designing a controller, a device that measures \(x\) and adds a correcting force, means reshaping this card. §10 does that for this oscillator, and Fig. 10 for a wind turbine.
06The start: beats and decay
Figure 4 is the run the page stores with its default settings. The drive at \(0.45\ \mathrm{Hz}\) is close to the natural \(0.50\ \mathrm{Hz}\), so during the first seconds two nearby rhythms are present at once: the driver’s, and the block’s own ringing from equation (5). Like two guitar strings slightly out of tune, they drift in and out of step once every \(1/|f-f_d| = 20.25\ \mathrm{s}\), where \(f_d = \omega_d/2\pi = 0.499\ \mathrm{Hz}\) is the damped ringing frequency (with \(f_0\) in its place the estimate is 20 s, close enough at this weak damping). The amplitude swells and shrinks with that rhythm; the first swell reaches \(0.596\ \mathrm{m}\) at \(t = 8.0\ \mathrm{s}\). Because the ringing decays with \(\tau = 6.4\ \mathrm{s}\), the second beat is already weak, and after half a minute only the steady oscillation at \(\pm X = \pm 0.482\ \mathrm{m}\) is left.
Lower the damping ratio to 0.01 and press Solve. The beats now last for the whole minute. Count the time between two swells and compare with \(1/|f - f_0|\). Then set \(f = 0.20\ \mathrm{Hz}\), far from resonance. There are no slow beats now, but the block’s own ringing rides on the slow drive; use \(C_1\) in equation (5) to explain why it starts as large as the steady motion. (The force switches on at full strength at \(t = 0\).)
07Where the energy goes
The driver does work at the rate \(P_\text{in} = F\dot x\); the damper turns energy into heat at the rate \(P_\text{loss} = c\dot x^2\). The energy stored in the oscillator, \(E = \tfrac12 m\dot x^2 + \tfrac12 kx^2\), changes by the difference:
\[ E(T) - E(0) = \underbrace{\int_0^T F\dot x\,\mathrm{d}t}_{W_\text{in}} - \underbrace{\int_0^T c\,\dot x^2\,\mathrm{d}t}_{W_\text{loss}} . \tag{8} \]In the steady state the stored energy only sloshes between spring and block, so on average every joule the driver puts in is lost in the damper. The speed swings with amplitude \(\Omega X\), and the square of a sine averages to one half over a period, so \(\langle P_\text{in}\rangle = \langle P_\text{loss}\rangle = \tfrac12 c\,\Omega^2 X^2\), which is \(0.292\ \mathrm{W}\) for the defaults. Over the full 60 s run the page finds \(W_\text{in} = 19.03\ \mathrm{J}\), \(W_\text{loss} = 17.93\ \mathrm{J}\) and \(E(T) - E(0) = 1.11\ \mathrm{J}\). Equation (8) then holds to \(1.3\times10^{-12}\) of \(W_\text{in}\): this is the Energy balance readout, a test of the whole computation.
08Solve first, then play
Unlike the earlier figures, this page does not integrate while you watch. The force is a known function of time, and with the controller on a known function of time and of the state, so the whole future is fixed the moment you press Solve or let go of the block. The page uses that.
- Solve. The fourth-order Runge–Kutta method advances \((x, \dot x)\), and with the controller its memory \(z\), from \(t = 0\) to \(60\ \mathrm{s}\) in 60 000 steps of \(h = 1\ \mathrm{ms}\), carrying \(W_\text{in}\) and \(W_\text{loss}\) along in the same steps. Measured in headless Chromium, a solve took 5–13 ms, and up to 45 ms for the first one after the page loads; the time depends on the machine.
- Store. Every tenth state is written into the page’s dataset, together with \(F\), \(E\), \(P_\text{in}\) and \(P_\text{loss}\): 6 001 rows, one every \(10\ \mathrm{ms}\). The exact solution (5) is stored next to it only to measure the error. With the defaults the largest difference over the run is \(5\times10^{-12}\ \mathrm{m}\), the RK4 vs exact readout.
- Play. Each frame converts the playback time into the nearest stored row, \(n = \operatorname{round}(t_\text{play}/10\,\mathrm{ms})\), and draws that row as it is. Nothing is interpolated or recomputed, so the picture and the data panel always show the same numbers, and the Stored run slider can jump to any instant.
When you move a slider after solving, the page says so and keeps playing the old run until you solve again: the data on screen always belong to the settings of the last Solve. Two actions solve by themselves, because they are commands rather than changes of the machine: letting go of the block, and a new target \(r\), which takes effect from the state on screen at that moment.
09The driver: a coil in a magnet
The driver on the screen works like a loudspeaker, or like the electrodynamic shakers that engineers use to vibrate test pieces. A coil of wire is wound on a light tube fixed to the right face of the block, and the tube slides into the narrow gap of a magnet that stands on the floor. In the gap the field \(B\) points straight out from the central pole, so every piece of the winding is perpendicular to it, and the Lorentz force \(\mathrm d\vec F = I\,\mathrm d\vec\ell \times \vec B\) on each piece points along the axis. Added up over the length \(\ell\) of wire in the gap, it gives
\[ F = B\ell\, I , \qquad I(t) = I_0\cos\Omega t , \tag{9} \]so a source that drives the current \(I_0\cos\Omega t\) through the coil pushes the block with exactly the force of (1), with \(F_0 = B\ell I_0\). The page takes \(B\ell = 10\ \mathrm{T\,m}\), for instance \(B = 1\ \mathrm T\) and 10 m of wire, about 100 turns of a coil 3.2 cm across; then \(I_0 = F_0/(B\ell)\) is 0.1 A with the defaults and 0.5 A at the largest force of 5 N. The dots and crosses on the winding show the current: a dot is current coming out of the screen, a cross current going into it, and when they swap, the force turns round. Two conditions keep this force a function of time alone, as §1 requires of an outside push. The winding must never leave the uniform field of the gap, which is why the gap on the screen is longer than the winding by the full travel of the block. Here the drawing is generous: with the defaults the block travels about a metre, while the coils of real shakers travel millimetres to a few centimetres, so a real magnet of this length would be a large machine; the physics does not change with the stroke as long as the field stays uniform. And the source must drive the current, not a voltage.
The second condition comes from Faraday’s law. A wire moving at the speed \(\dot x\) through the field has an electromotive force (emf), a voltage made by the motion, of \(B\ell\dot x\) induced in it. Walk once around the circuit, Kirchhoff’s voltage law: the voltage \(V\) of the source is used up by the coil’s resistance \(R\), by its self-inductance \(\Lambda\) and by this motional emf, which opposes the current that drives the motion:
\[ V = RI + \Lambda\dot I + B\ell\,\dot x . \tag{10} \]Mechanics gives the same pair of equations by a second route. Treat the charge \(q\) that has passed through the coil as a second coordinate, so that \(I = \dot q\), and take \(\mathscr L = \tfrac12 m\dot x^2 - \tfrac12 kx^2 + \tfrac12 \Lambda\dot q^2 + B\ell\,x\dot q\), with Rayleigh’s dissipation function \(\mathscr D = \tfrac12 c\dot x^2 + \tfrac12 R\dot q^2\) and the source voltage \(V\) as the generalised force on \(q\). Lagrange’s equation for \(x\) is (1) with \(F = B\ell I\), which is (9); the one for \(q\) is (10). The term \(B\ell\,x\dot q\) couples block and coil, and the same coupling constant \(B\ell\) appears in both directions: as newtons per ampere in the force and as volts per metre per second in the emf. The last term of (10) is the back-emf. The source pays for it with the power \(B\ell\dot x\cdot I = F\dot x\), which is exactly the driver’s power \(P_\text{in}\) of §7: the electrical energy that disappears into the back-emf is the work done on the block. A current source raises its voltage by whatever (10) asks, so the current, and with it the force, stays \(I_0\cos\Omega t\). A plain voltage source would not. With \(\Lambda\) negligible it lets \(I = (V - B\ell\dot x)/R\) flow, and the force becomes
\[ F = \frac{B\ell}{R}\,V - \frac{(B\ell)^2}{R}\,\dot x , \tag{11} \]the push of the source plus a second damper. With \(R = 8\ \Omega\) that damper would have \((B\ell)^2/R = 12.5\ \mathrm{kg/s}\), forty times the page’s damper with the defaults and a damping ratio of about 2 on its own. The same induction brakes Pohl’s wheel in the teaching laboratory: its damping is an eddy-current brake, an electromagnet whose field induces currents in the metal of the turning wheel, and the laboratory runs that magnet at constant current for the same reason the page drives its coil with one.
The damper is drawn as what it is, a piston in oil. Its force \(-c\dot x\) always points against the motion, and its oil darkens while it turns energy into heat, by \(P_\text{loss} = c\dot x^2\) as a fraction of the largest value in the run. The three arrows over the block are the forces on it, the coil’s \(F\), the damper’s \(-c\dot x\) and the spring’s \(-kx\), each drawn twice as long as the stretch of the spring that would carry it, so they share the length scale of the motion; their sum is \(m\ddot x\). Driven at \(f_0\) in the steady state, the spring’s arrow swings about \(Q\) times longer than the other two, while the coil’s and the damper’s arrows cancel: the driver only replaces what the damper takes, as §7 says. The bars at the top keep the books of (8): the work \(W_\text{in}\) the coil has done since \(t = 0\), the heat \(W_\text{loss}\) the damper has made, and the energy \(E\) the oscillator holds now, which is their difference.
10Closing the loop
So far the force has been decided by someone who does not look at the block. Now let the force look. A sensor measures \(x\), a controller compares it with a target \(r\) and computes the current the coil shall carry, and the force on the block becomes the outside push plus the controller’s share \(u\). This force depends on where the block is: the push is no longer from outside alone, which is the whole point of feedback. The simplest useful controller uses the error \(e = r - x\), its running sum and the measured speed:
\[ u = K_p\,e + K_i\!\int_0^t e\,\mathrm dt' - K_d\,\dot x , \qquad m\ddot x + c\dot x + kx = F_0\cos\Omega t + u . \tag{12} \]Each gain is a physical part added to the plant. \(K_p\) (N/m) is a second spring whose rest position is the target instead of the wall: push the block away from \(r\) and the coil pulls it back in proportion. \(K_d\) (kg/s) is a second damper, acting on the measured speed. \(K_i\) (N/(m·s)) is the controller’s memory: as long as the block sits on the wrong side of \(r\), the integral grows and the coil pushes harder, and it stops growing only when the error is zero. Collect the terms of (12) that multiply \(x\) and \(\dot x\):
\[ m\ddot x + (c + K_d)\,\dot x + (k + K_p)\,x = K_p r + K_i\!\int_0^t (r - x)\,\mathrm dt' + F_0\cos\Omega t . \tag{13} \]Without the integral, (13) is the equation of §2 with the stiffer spring \(k + K_p\) and the stronger damper \(c + K_d\), pushed by a constant force \(K_p r\): a new oscillator, with its own natural frequency \(\sqrt{(k+K_p)/m}\) and damping ratio \(\zeta_\text{cl} = (c + K_d)/(2\sqrt{m(k+K_p)})\). Where does it come to rest? Set every derivative to zero and \(F_0 = 0\):
\[ x^* = \frac{K_p}{k + K_p}\,r \quad (K_i = 0), \qquad x^* = r \quad (K_i > 0). \tag{14} \]A proportional controller never reaches its target. To hold the block at \(x^*\) the coil must carry the spring, \(u = kx^*\), and a proportional controller only produces that force out of an error, \(K_p(r - x^*) = kx^*\), which is (14). With the page’s presets, \(K_p = 20\ \mathrm{N/m}\) against \(k = 9.87\ \mathrm{N/m}\), the block stops at \(0.67\,r\): 0.201 m for \(r = 0.30\ \mathrm m\), and the P box on the screen shows the controller’s whole force resting on that 0.1 m of error. The integral removes it. Its memory keeps growing until the error is gone, and at the end the integral part alone supplies the \(kx^* = 2.96\ \mathrm N\) that hold the spring, while the proportional part has nothing left to do. The derivative gain decides how the block gets there: with \(K_d = 0\) the preset loop has \(\zeta_\text{cl} = 0.03\) and rings for a long time; with \(K_d = 4\ \mathrm{kg/s}\) it has \(\zeta_\text{cl} = 0.40\) and settles in a few seconds.
Memory has a price. Differentiate (13) once to remove the integral, and the free motion of the loop obeys a third-order equation, \(m\,\mathrm d^3x/\mathrm dt^3 + (c+K_d)\ddot x + (k+K_p)\dot x + K_i x = 0\). A third-order system can go unstable even though every coefficient is positive, because the integral keeps pushing after the block has already passed the target. The Routh–Hurwitz condition for three positive coefficients says that all free motions die away exactly when
\[ (c + K_d)(k + K_p) > m\,K_i . \tag{15} \]Read it as a race: the damping available in the loop, times its stiffness, must beat the rate at which the memory accumulates force. The PID preset has \(128.9 > 10\) and is stable; set \(K_p = 5\), \(K_d = 0\), \(K_i = 60\) and the left side is 4.7 against 60: the block’s swings grow until the page stops the solver at \(|x| = 1000\ \mathrm m\), and the readout says so. The outside push still acts through the closed loop. Its steady answer is (3) with the coefficients of (13) and the integral’s term \(K_i/(i\Omega)\):
\[ X = \frac{F_0}{\left|\,k + K_p - m\Omega^2 + i\left((c + K_d)\Omega - K_i/\Omega\right)\right|} , \tag{16} \]the block swinging with this amplitude about \(x^*\). The Bode plot draws this closed-loop response \(H(i\Omega)\) in ink, with the bare plant \(G(i\Omega)\) dashed behind it: the controller moves the peak to the new natural frequency, flattens it with \(K_d\), and the integral pushes the response at low frequencies to zero, because a slow push is simply held off. The page grades its RK4 run against the exact closed-loop solution as well: the particular solution of (16) plus the free motion of (13), propagated sample by sample with the exact matrix exponential \(e^{A\,\Delta t}\) of the loop’s state matrix.
Now take the block in your hand; the Take control box above the figure walks you through it. Switch the controller on, choose the target \(r\) with its slider or by dragging the flag on the ruler, then grab the block on the screen and drag it anywhere within the ruler. A new target takes effect at once: the page solves again from the state on screen, and the block moves to it. While you hold it, the page’s clock stops, but the controller keeps working: it reads your hand’s position, pulls against it with \(u\), and its integral keeps adding up the error, \(z = \int (r - x)\,\mathrm dt'\), second by second. A fourth arrow shows the force your hand must give, \(F_\text{hand} = kx + c\dot x - F\), the force that balances spring, damper and coil. Let go, and the page solves (12) again from the state you left behind, \(x(0)\), \(\dot x(0)\) (the speed of your hand, so you can throw the block) and \(z(0)\), and plays the new run from \(t = 0\), the outside push restarting with it. The equilibrium (14) does not depend on where the block starts, so the controller brings it back to \(x^*\) from wherever you left it; with the controller off you see instead the free, damped swing dying away with the decay time \(\tau\) of §3. Hold the block for a few seconds away from the target with the integral on, and the release overshoots far past \(r\): the memory has filled up with error while you held it, and it takes as long again to empty. That is integrator windup, the most common fault of real PI controllers, and the reason real ones limit their integral. The exact solutions need only their constants adjusted to the new start: in (5) they become \(C_1 = x(0) - X\cos\varphi\) and \(C_2 = (\dot x(0) + \zeta\omega_0 C_1 - X\Omega\sin\varphi)/\omega_d\), and in the closed loop the free motion starts from \(x(0)\), \(\dot x(0)\) and \(z(0)\) less the equilibrium and the steady swing. The page grades every released run against them as before.
The force profile under the motion shows who pushes when, in newtons, over the same window of the run: the outside push, the spring’s \(-kx\), the damper’s \(-c\dot x\), and with the controller on its force \(u\) and its three parts. After a release you can watch the division of labour: the proportional part jumps with the error, the derivative part brakes the fast motion, and the integral part rises slowly until it alone carries the spring at \(x^*\).
11Phase space and stable points
Two numbers tell the whole story of the block at one instant: where it is and how fast it moves. Equation (1) gives the acceleration from them, so the next instant follows, and the next. Draw the two numbers as a point in a plane, \(x\) across and \(\dot x\) up, and the motion becomes a path that the point traces: the phase space of the oscillator. A swing pushed by nobody draws a closed loop in it, out at the turning points with no speed, through the middle at full speed. A damper turns the loop into a spiral that winds into the middle, like a marble rolling around the inside of a bowl and losing a little height on every turn. The bottom of the bowl, where the marble can rest, is a fixed point.
Write the state as \(\mathbf y = (x, \dot x)\). With the push switched off, (1) or the loop (13) without its integral is a pair of first-order equations, \(\dot{\mathbf y} = A(\mathbf y - \mathbf y^*)\):
\[ \frac{\mathrm d}{\mathrm dt}\begin{pmatrix} x - x^* \\ \dot x \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ -\dfrac{k + K_p}{m} & -\dfrac{c + K_d}{m} \end{pmatrix} \begin{pmatrix} x - x^* \\ \dot x \end{pmatrix} . \tag{17} \]The fixed point is where both rates vanish: \(\dot x = 0\) and the spring and the controller balance, \(\mathbf y^* = (x^*, 0)\) with \(x^*\) from (14); with the controller off, \(K_p = K_d = 0\) and \(x^* = 0\). Because (17) is linear, its solutions are combinations of \(e^{\lambda t}\), where the eigenvalues \(\lambda\) of the matrix are the roots of its characteristic polynomial, the denominator of (7) with the loop’s coefficients:
\[ \begin{gathered} m\lambda^2 + (c + K_d)\,\lambda + (k + K_p) = 0 \\ \Longrightarrow\quad \lambda = -\zeta_\text{cl}\,\omega_\text{cl} \pm \omega_\text{cl}\sqrt{\zeta_\text{cl}^2 - 1}, \qquad \omega_\text{cl} = \sqrt{\frac{k + K_p}{m}} . \end{gathered} \tag{18} \]The two numbers of the matrix that do not depend on how we draw it decide everything. Its trace, \(-(c + K_d)/m\), is the sum of the eigenvalues, and its determinant, \((k + K_p)/m\), their product. A negative trace and a positive determinant put both eigenvalues in the left half of the complex plane, and every path runs into the fixed point: it is asymptotically stable. The sign of the discriminant, \(\mathrm{tr}^2 - 4\det\), decides how the path arrives. For \(\zeta_\text{cl} < 1\) the eigenvalues are complex, the path spirals in, and the fixed point is a stable focus: the marble in thin oil, overshooting the bottom again and again. For \(\zeta_\text{cl} > 1\) both eigenvalues are real and negative, the path creeps straight in, and the fixed point is a stable node: the marble in honey. At \(\zeta_\text{cl} = 1\) the two meet in a degenerate node, the fastest approach without overshoot. With the page’s defaults, \(\lambda = -0.157 \pm 3.138\,i\ \mathrm{s^{-1}}\): a stable focus whose spiral shrinks by \(e^{-0.157 \cdot 2\pi/3.138} = 0.73\) per turn. With the PD preset, \(\lambda = -2.157 \pm 5.022\,i\ \mathrm{s^{-1}}\), and the same spiral shrinks by \(0.067\) per turn; \(K_d\) would need to reach \(10.6\ \mathrm{kg/s}\) to make it a node.
Linearising is exact here, but stability can also be proved without solving anything, by an energy that can only fall. Take the energy of the oscillator measured from the fixed point, with the controller’s spring included,
\[ V = \tfrac12 m\dot x^2 + \tfrac12 (k + K_p)(x - x^*)^2 , \qquad \frac{\mathrm dV}{\mathrm dt} = -(c + K_d)\,\dot x^2 \le 0 . \tag{19} \]The rate follows from (17) in one line, and it is the heat of the two dampers, the real one and the controller’s. \(V\) is a bowl with its bottom at the fixed point, and the state can only roll downhill in it; it stops losing height only where \(\dot x = 0\), and the only place it can stay with \(\dot x = 0\) is the bottom. So every path, from wherever you let the block go, ends at \(\mathbf y^*\). A function with these two properties is a Lyapunov function, and (19) shows that stability is the damper’s work: with \(c + K_d = 0\) the paths would be closed ellipses around the fixed point, a centre, forever.
Integral action adds a third number to the state, the memory \(z = \int_0^t (r - x)\,\mathrm dt'\), and the phase space becomes three-dimensional, \(\mathbf y = (x, \dot x, z)\). Its fixed point needs \(\dot z = r - x = 0\), so the block sits exactly at the target, and the memory holds just the force that carries the spring:
\[ \mathbf y^* = \left(r,\ 0,\ \frac{k r}{K_i}\right), \qquad m\lambda^3 + (c + K_d)\lambda^2 + (k + K_p)\lambda + K_i = 0 . \tag{20} \]The cubic always has one real root, and for positive coefficients it is negative; the other two decide stability, and (15) is exactly the condition that their real parts are negative. On the boundary, \((c + K_d)(k + K_p) = mK_i\), the cubic factors as \(\left(m\lambda + c + K_d\right)\left(\lambda^2 + \omega_\text{cl}^2\right)\): two eigenvalues sit on the imaginary axis at \(\pm i\omega_\text{cl}\), and the loop rings forever at the frequency of its stiffer spring; past the boundary the ringing grows. With the PID preset, \(\lambda = -1.982 \pm 4.955\,i\) and \(-0.351\ \mathrm{s^{-1}}\). The fast pair is the PD loop’s spiral, almost unchanged; the slow real root belongs to the memory, and its time \(1/0.351\ \mathrm{s^{-1}} = 2.85\ \mathrm s\) is how long the integral takes to remove the last of the error. In the example of §10 with \(K_i = 60\), \(\lambda = +1.227 \pm 4.490\,i\) and \(-2.769\ \mathrm{s^{-1}}\): the fixed point is an unstable focus, and the paths spiral out.
The outside push makes the equations depend on the clock, and a fixed point no longer exists: the block cannot rest while it is pushed. What replaces it is the steady swing of (4) or (16), which in phase space is an ellipse around the fixed point,
\[ \left(\frac{x - x^*}{X}\right)^2 + \left(\frac{\dot x}{X\Omega}\right)^2 = 1 , \tag{21} \]traced once per drive period. To see paths approach it, look at the block only once per period, like a dancer lit by a strobe that flashes on every beat. Each flash records one point, and the map from one flash to the next, the Poincaré map of the driven oscillator, has the steady swing as its fixed point. A disturbance of the steady swing is a free motion, so it is multiplied per period by \(\mu = e^{\lambda T}\), with \(T = 1/f\); for \(|\mu| < 1\) the dots converge on one point of the ellipse. The size \(|\mu| = e^{\mathrm{Re}\,\lambda\, T}\) says how fast: \(0.705\) per period with the defaults (\(f = 0.45\ \mathrm{Hz}\)), \(0.008\) with the PD preset, and \(0.458\) with the PID preset, where the slow memory sets the pace. The steady swing is therefore the attractor of every driven run: the stable limit set to which all paths converge, whatever the start.
The phase portrait under the force profile draws all of this for the run on screen. The arrows are the free flow (17), the direction in which the state would move with the push switched off; with integral action they show the slice of the three-dimensional flow through the fixed point, \(z = z^*\), so a path may cross them at an angle. The cross marks the fixed point \(\mathbf y^*\), the dashed rose ellipse is the steady swing (21), the dark path is the run up to now and the pale one what is still to come, and the burgundy dots are the strobe flashes, one per drive period. Drag the block away and let go: the path starts where your hand left it and spirals into the ellipse, the dots falling onto one point of it. The caption gives the eigenvalues, the kind of fixed point and \(|\mu|\).
12On screen
The last figure is the frequency response of the steady swing. In its linear view, the one used in the teaching laboratory with Pohl’s wheel, the left panel is the amplitude function \(A(f) = F_0\,|G(i\,2\pi f)|\) of (4) in metres, the resonance curve with its peak near \(f_0\) and a width set by \(\zeta\), and the right panel the phase difference \(\varphi(f)\) between push and swing, from \(0^\circ\) for slow pushes through \(90^\circ\) at \(f_0\) to \(180^\circ\) for fast ones. With the controller on, the ink curves are the closed loop (16) and the bare plant is dashed behind them. The Bode view shows the same curves per newton on logarithmic axes, as control engineers draw them.
The whole mechanism is drawn on one length scale, in pixels per metre, and the block may travel as far either side of rest as the canvas leaves room for the coil drive. The scale is kept from one Solve to the next, so a run with more damping or a smaller force really swings less on the screen, and the previous run stays in view as an outlined block and a dotted curve. The scale widens only when a new run needs more room, and Fit scale sets it to the present run; the ruler under the floor gives the ends of the range in metres, the target \(r\) as a flag you can drag, and with the controller on the equilibrium \(x^*\) as a rose line through the block. The box at the top right is the controller: the value it reads, its three parts and their sum \(u\), each as a bar, and a dashed command line down to the current source. Watch the force arrow and the block together: at a low drive frequency the block moves with the force, near \(f_0\) it lags a quarter period behind it, and far above \(f_0\) it moves against it, as the phase lag of (4) says. Below, a window of the stored run follows the present sample: \(x(t)\) dark up to it and pale after it, \(F(t)/k\) dashed in burgundy and the steady band \(x^* \pm X\) dashed in rose. The window spans four drive periods, but never less than 6 s or more than 20 s (8.9 s with the defaults). Under it, a thin strip shows the whole 60 s, with the window shaded. Both views mark the present drive frequency with a filled dot and the amplitude measured from the last 10 s of the run with a ring around it: when the run has settled, the two coincide.
13What the model leaves out
- Real springs obey Hooke’s law only for small stretches; at large amplitude the restoring force stops being proportional to \(x\), and the resonance peak bends and can jump.
- Real friction is often dry rather than viscous: it does not grow with speed. The linear damper is the version that keeps the equation solvable.
- The current source is ideal: it delivers the current it is told whatever the back-emf, so in open loop the force stays \(F_0\cos\Omega t\) whatever the block does. A real amplifier has a voltage limit, and at resonance, where the block moves fastest, the back-emf it must overcome is largest.
- The page covers the underdamped range \(\zeta \le 0.9\) only, where the exact solution (5) applies; \(\zeta \ge 1\) needs a different form of the transient.
- The controller is ideal: it measures \(x\) and \(\dot x\) without noise or delay and acts at every instant, and the coil delivers whatever force it asks. A real controller samples, and the delay of one sample costs stability margin; a noisy speed measurement makes \(K_d\) amplify the noise; a real amplifier has a current limit, and an integral that keeps growing against it is the classic windup.
13.1Further reading
- J. R. Taylor, Classical Mechanics, University Science Books, 2005: chapter 5, oscillations, driven damped oscillators and resonance.
- A. P. French, Vibrations and Waves, W. W. Norton, 1971 (now CRC Press): chapter 4, forced vibrations and resonance.
- K. J. Åström and R. M. Murray, Feedback Systems: An Introduction for Scientists and Engineers, Princeton University Press, 2008: chapter 8, transfer functions, frequency response and Bode plots; chapter 10, PID control, for Section 9. The authors’ free electronic edition.
- Grundpraktikum Physik, Universität des Saarlandes, Pohlsches Rad, nichtlineare Schwingungen und Chaos, 2022 (in German): Pohl’s wheel, its motor drive and its eddy-current brake run at constant current (Section 9).
- R. P. Feynman, R. B. Leighton and M. Sands, The Feynman Lectures on Physics, Vol. I, online edition: chapter 23, Resonance (the complex-number method of Section 3.1) and chapter 24, Transients (the mean power of Section 7 and the dying free motion of Section 3.2).