# PID Control, One Term at a Time

> A cruise control has to hold a hundred kilometres an hour while the road tilts under it. This lecture builds the controller that does it, one term at a time, on a single response curve you watch the whole way through: proportional action, which reacts to the error now and always leaves a steady gap; integral action, which accumulates the error's history and finally erases that gap, at the cost of overshoot and windup; and derivative action, which reads the slope of the error and leans against the approach. The three are then assembled into the standard PID law and tuned, with each gain pushed too far in turn, so the trade between rise time, overshoot and noise is something you see rather than something you are told.

- Canonical watch page: [PID Control, One Term at a Time](https://academa.ai/lectures/pid-control-one-term-at-a-time)
- Publisher: [Academa, Inc.](https://academa.ai)
- Subject: Engineering
- Published: 2026-08-28T19:27:07.264Z
- Updated: 2026-08-28T19:27:07.264Z
- Duration: PT1002S (16 minutes 42 seconds)
- Chapters: 5
- Views: 0
- Language: en-US
- Access: Free
- Video stream: [HLS content](https://academa.ai/media/l/01M14TYE5YQN06G7H8ST7F6QPD/0/dark/master.m3u8)
- Audiovisual record: [Semantic JSON](https://academa.ai/media/l/01M14TYE5YQN06G7H8ST7F6QPD/0/semantic.json)
- Thumbnail: [Image](https://academa.ai/media/l/01M14TYE5YQN06G7H8ST7F6QPD/0/dark/poster.jpg)

## Description

Build a PID controller one term at a time on a cruise control: proportional offset, integral windup, derivative damping, and tuning.

## Chapters

- [00:00–02:43.501 · Holding a Setpoint](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=0)
- [02:43.501–06:11.383 · Proportional Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=163.50145833333332)
- [06:11.383–09:59.431 · Integral Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=371.3833333333333)
- [09:59.431–13:33.086 · Derivative Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=599.4309166666667)
- [13:33.086–16:42 · Tuning the Three Gains](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=813.0858541666666)

## Transcript

### [00:00 · Holding a Setpoint](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=0)

Every machine that has to hold something steady is solving the same problem. A cruise control holding a speed. A thermostat holding a room temperature. The world knocks it off target, and it has to push back, by exactly the right amount and no more. So here is the question this whole lecture answers. How does a machine hold a setpoint that the world keeps knocking it off? PID answers with three corrections: the present error, its accumulated past, and its direction of travel. Let's make it concrete. A car on a road, and a driver who sets the cruise control to one hundred kilometres an hour. Left alone with no extra throttle, this car rolls along at sixty. And it does not respond instantly. Ask for more throttle, and the engine takes about a second to deliver the extra pull, and the car takes a few seconds more to work that pull into speed. Every real plant has that lag, and it is the reason control is hard at all. That target has a name. It's the setpoint, r. What the car is actually doing at each instant we'll call v of t. And the whole job of a controller is to make v equal r, and then keep it there. Now, the naive fix. Guess the throttle. Find the setting that holds a hundred on flat road, push the pedal to exactly there, and leave it. And on flat road, it works. And then, fifteen seconds in, the road tilts up. The grade swallows part of the engine's pull, and the speed sags. The throttle does not move, because nothing in this machine is looking at the speed. It settles twenty kilometres an hour below target, and it stays there for good. And notice where the fault is. The machine is not wrong about the throttle. It is wrong because it has no idea what the speed is doing. Nothing measures the output, so nothing can react to it. That is the whole disease of an open loop. It guesses, and it never checks. So let's close the loop. Measure the speed, subtract it from the setpoint, and call that difference the error. The error is the only thing our controller gets to look at. So everything from here is one question. Given the error, what throttle should I command? That is u equals some function of e, and the rest of this lecture is filling that function in. There are three classic answers, and they stack. Proportional, which reacts to the error right now. Integral, which remembers the whole history of the error. And derivative, which watches where the error is heading.

### [02:43.501 · Proportional Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=163.50145833333332)

So, the first answer, and it is the one everybody invents for themselves. Look at the error right now, and push back in proportion to it. Big error, big correction. Small error, small correction. Nothing else. In symbols, that is u equals K p times e. One number to pick, the proportional gain, and that is the entire controller. So let's watch it drive. Same car, same hill at fifteen seconds. We start with the gain set to one: the moment we switch on, the error is forty, so the controller asks for forty units of throttle, and the car pulls away. Notice the shape it makes. It starts flat, because the engine has not delivered anything yet. Then it swings up hard while the error is big. And it flattens out as the error shrinks, because the correction shrinks with it. And then it stops. Eighty kilometres an hour. Twenty short of the setpoint, and it will sit there all day. The controller is running, the loop is closed, and the car is still twenty short. And this is not a bug you can tune away. It is arithmetic. This controller commands a throttle proportional to the error, so if the error ever reached zero, the command would be zero as well, and with no extra throttle the car falls straight back to sixty. Say that again, because it is the crux. The only way this controller can command throttle is to be wrong. Ask it to hold a hundred and it must run below a hundred, permanently, to have any error left to work with. So the error cannot reach zero. It stops where the throttle it produces is exactly the throttle the car needs. Solve for that point and you get this. The error left over is the whole forty kilometre gap, divided by one plus the gain. Which tells you exactly what raising the gain buys. Turn it up to three, and the leftover error is ten. The car holds ninety, and it gets there quicker. Turn it up to nine and the error is down to four. But look what has happened to the shape. It arrives fast, sails past the setpoint, and takes a couple of swings to settle. And notice why that overshoot appeared at all. The engine's pull lags behind the command. By the time the car is on target there is still a large pull in the pipeline, and that surplus carries it straight past the line. Push on to fifteen and the ringing is worse again, while the offset has only crept from four down to two and a half. You can chase that gap as far as your patience for overshoot allows. You never reach zero. And now the hill, which is the same story told louder. Every one of these curves drops when the grade hits, and every one settles at a new, lower speed. With the gain at three the car held ninety on the flat. On the hill it holds eighty five. Same controller, same gain, twice the error. A bigger load needs a bigger throttle, and the only way this controller can command a bigger throttle is to be further from the setpoint. It is paid in error. So proportional control is fast, it is simple, and it is structurally incapable of finishing the job. To kill that last gap, the controller needs something proportional can never have. It needs a memory.

### [06:11.383 · Integral Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=371.3833333333333)

Proportional control reacts to the error right now, and right now is exactly what strands it. It has no way of knowing that this same small error has been sitting there, unfixed, for the last ten seconds. What it needs is a record. So here is the error from that last run, plotted on its own. It starts at forty, falls fast while the correction is big, flattens out at ten, and sits there until fifteen seconds. Then the hill makes the error jump and settle higher. One thing to keep straight: this is the error, not the speed. Zero on this axis means the car is exactly on target, and every kilometre of gap up here is a kilometre the controller has failed to close. Now, instead of reading the height of this curve, add it up. Every second that goes by with an error of ten piles ten more onto the total. That accumulation is the area underneath the curve, from the moment we switched on up to now. And watch what that pile does while the error is stuck. It grows, and it keeps growing, and nothing ever takes anything off it. A leftover error that proportional control is perfectly happy with turns into an accumulation that gets bigger without limit. So that is our second term. Add to the throttle a piece proportional to the accumulated error, the integral of e, with a gain of its own, K i. And now ask where this controller can possibly come to rest. Suppose it settles with any error at all left over, even half a kilometre an hour. Then the integral keeps climbing, so the throttle keeps climbing, so the speed keeps climbing. It cannot be at rest. The only value of the error it can hold still at is exactly zero. That is a strong claim, so let me put it plainly. A controller with an integral term, on a plant like this one, drives the steady error to zero. Not small. Not nearly. Zero. So let's drive it. Grey is proportional alone, stuck at ninety. Green is the same proportional gain with the integral added, K i equal to one. It takes its time, because it has to build the pile up before the extra throttle amounts to anything. But it arrives. And it arrives exactly on the line, with no offset at all, which proportional control could not do at any gain. Then the hill hits. The speed sags, so the error comes back, so the pile starts growing again, and the controller walks the car back up to a hundred and holds it there. That is the integral's whole job. It refuses to accept a leftover error, because a leftover error is a pile that never stops growing. But that memory costs you. Turn K i up to two and a half, and by the time the speed reaches the setpoint the accumulator has already commanded a large throttle. Being on target does not empty the pile. It only stops adding to it. So the car sails past, and the error has to go negative, the car has to spend time above the setpoint, before that accumulation comes back down. That is the overshoot and the ringing you are looking at. Taken to the extreme it has a name: integrator windup. If the throttle saturates, or the car is held back for a while, the accumulator keeps piling up error it cannot act on, and the plant spends the next several seconds paying it back. So proportional gets us moving, integral finishes the job, and between them they have bought us an oscillation. The third term is the cure for that.

### [09:59.431 · Derivative Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=599.4309166666667)

The trouble with that last run is that the controller only discovered it was going too fast after it had already gone too fast. Everything it knows is about the present and about the past. Nobody in there is looking ahead. But there is a look ahead sitting right in the data. Here is the error again, this time from an aggressive proportional plus integral tuning, the kind that rings. And at any instant we can ask a different question about it. Not how big is the error, but how fast is it changing. That is the slope of this curve, and here it is at two seconds in. The error is still about twelve kilometres an hour, and it is falling at roughly twelve kilometres an hour each second. At that rate the car reaches the target in about one second. And that number is a prediction. It is the controller's only honest statement about the future, and it costs nothing to compute, because it is right there in the measurement it already has. It is also the warning that proportional and integral cannot hear. Proportional sees a large error and pushes. The integral sees a large pile and pushes. Neither one knows that the correction already in the pipeline is more than enough. So give the controller a third term. A piece proportional to the rate of change of the error, with a gain of its own, K d. And read the sign carefully, because the sign is the whole idea. When the error is falling, d e by d t is negative, so this term subtracts throttle. The faster you are closing in, the harder it eases off. It is a brake that comes on only when you are approaching quickly. Now watch it along the whole run. Every time the car swings toward the line, the slope is steep and the term leans against the motion. Every time it swings away, the sign flips and the term leans the other way. And once the swinging stops, the curve goes flat and the slope is zero. That last part matters. At steady state, derivative action is silent. It cannot fix an offset and it cannot cause one. It only ever speaks while things are changing. So here is that same aggressive tuning, with it and without it. Red is proportional plus integral, the run we just took apart. Green is the same two gains with derivative added, K d equal to three. The two leave the line at the same speed, because early on the error is huge and the proportional term dominates both of them. But the peak overshoot falls from about seventeen kilometres an hour to about ten, the ringing shrinks, and the green curve is within one kilometre an hour of the setpoint by about six seconds. Same car, same integral, one extra term. And the hill gets the same treatment, a shallow dip instead of a plunge, because the moment the speed starts to fall the derivative term sees the slope and pushes back, before the error has had time to grow. So there is the whole controller. Three terms, one error signal. The present, the past, and the projected future, added up into a single number and sent to the throttle. One caution before we tune it. That derivative is the slope of a measured signal, and real measurements are noisy. Differentiate noise and you amplify it, which is why practical controllers filter the derivative, or take it from the measurement rather than from the error.

### [13:33.086 · Tuning the Three Gains](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=813.0858541666666)

So. Three gains, and one system that has to rise quickly, settle cleanly, and hold. Tuning is nothing more than deciding how much of each of the three answers you want. Proportional is the present. It reacts to the error you have right now, it is your main lever on how quickly you respond, and on its own it always leaves a gap. Integral is the past. It accumulates what proportional keeps leaving behind, and it is the only one of the three that can drive the steady error to zero. It buys you accuracy, and it costs you overshoot. Derivative is the future. It reads the slope and leans against fast change. It buys you damping, and it costs you sensitivity to noise. Here is the tuning we ended on. K p six, K i three, K d three. Quick off the line, one small overshoot, settled inside about six seconds, and it takes the hill in its stride. And watch which term is doing the work along that curve. In the first second it is nearly all proportional. Through the middle of the rise, derivative is holding it back. And after the hill, the last few kilometres an hour are closed by the integral, slowly, with the other two almost silent. Now let's break it, one gain at a time, and watch the same curve move. Triple the proportional gain and the response gets snappy and impatient. It hits harder, it swings wider, and it argues with itself for a good deal longer before it settles. Put that back, and turn the integral up instead. The accumulator gets ahead of the plant, so the overshoot grows, and there is a long slow ring while the pile is paid back down. And too much derivative goes the other way. It is so eager to lean against any change at all that it drags its feet, and the rise slows right down. In a real plant it would also be turning every twitch of sensor noise into a twitch of the throttle. The three broken tunings make the trade explicit. Too much proportional gain buys speed with overshoot and fast ringing. Too much integral gain buys persistence with overshoot and slow ringing. Too much derivative gain buys resistance to change with a slower rise and greater noise sensitivity. Which is also why tuning rules exist. Ziegler and Nichols, relay tuning, and the rest of them are recipes for finding a decent corner of that trade without walking the whole space by hand. So that is P I D. One error signal, read three ways. What it is, what it has been, and where it is going. Multiply each reading by a gain, add them up, and send the sum to the actuator. It is a strikingly small idea, and it runs a startling fraction of the machines around you. The ovens, the drones, the disk drives, the cruise control in the car you came here in. Three terms. One error.

## About Academa, Inc.

Academa makes technical knowledge easier to understand through visual lectures and lets learners request new lecture videos on the topics they need.

## Complete audiovisual record

Immutable source: [semantic.json](https://academa.ai/media/l/01M14TYE5YQN06G7H8ST7F6QPD/0/semantic.json)

Record version: 1. Render attempt: 0.

### How to read this timeline

Each scene owns its object identifiers. A beat's board is the complete board when listed, empty when marked empty, and unchanged from the nearest earlier listed board in the same scene when marked unchanged. Action times are absolute positions in the published video.

### Scene 1: [Holding a Setpoint](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=0)

Span: 00:00–02:43.501 (0s–163.50145833333332s).

#### Objects

- axes: an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0)
- card: a Title that says "Feedback Control — PID Control, One Term at a Time"
- engine\_lag: a Vector \[red\] labelled "upright("engine")" drawn in axes (start=(0.0, 55.0), end=(1.0, 55.0))
- eq\_error: a Math \[text\] that says "$e(t) = r - v(t)$"
- eq\_law: a Math \[text\] that says "$u(t) = C(e(t))$"
- eq\_set: a Math \[text\] that says "$r = 100 thin upright("km/h")$"
- full\_law: a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"
- gap\_dot: a PlotPoint \[red\] drawn in axes (target='open\_curve', x=27.0)
- gap\_line: a Line \[red\] labelled "e" drawn in axes (start=(27.0, 80.35775546255915), end=(27.0, 100.0))
- hill\_line: a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)
- open\_curve: a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>)
- point: a Point \[yellow\] drawn in axes (location=(15.0, 99.59808288114526))
- point\_2: a Point \[yellow\] drawn in axes (location=(27.0, 80.35775546255915))
- question: a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"
- setpoint\_line: a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)
- speed\_lag: a Vector \[green\] labelled "upright("car")" drawn in axes (start=(1.0, 55.0), end=(4.0, 55.0))

#### Beats

##### [00:00](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=0)

Narration: Every machine that has to hold something steady is solving the same problem. A cruise control holding a speed. A thermostat holding a room temperature. The world knocks it off target, and it has to push back, by exactly the right amount and no more.

Board: Empty.

Actions:
- [00:00](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=0): card is shown on the screen, written out.
- [00:1.5](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=1.5): card: enter:write-left-to-right.
- [00:14.512](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=14.5125): card is hidden from the screen — left the board.

##### [00:15.712](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=15.712499999999999)

Narration: So here is the question this whole lecture answers. How does a machine hold a setpoint that the world keeps knocking it off? PID answers with three corrections: the present error, its accumulated past, and its direction of travel.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [00:16.723](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=16.723): question is shown on the screen, written out.
- [00:23.712](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=23.712): full\_law is shown on the screen, written out.
- [00:31.56](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=31.560499999999998): full\_law moves to a new place on the board.

##### [00:32.761](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=32.7605)

Narration: Let's make it concrete. A car on a road, and a driver who sets the cruise control to one hundred kilometres an hour. Left alone with no extra throttle, this car rolls along at sixty.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"

Actions:
- [00:35.21](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=35.21000000000001): axes is shown on the screen, written out.
- [00:37.962](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=37.962): setpoint\_line is shown on the screen, written out.

##### [00:44.437](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=44.4365)

Narration: And it does not respond instantly. Ask for more throttle, and the engine takes about a second to deliver the extra pull, and the car takes a few seconds more to work that pull into speed. Every real plant has that lag, and it is the reason control is hard at all.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)

Actions:
- [00:49.754](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=49.754): engine\_lag is shown on the screen, drawn.
- [00:52.749](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=52.749): speed\_lag is shown on the screen, drawn.

##### [01:1.012](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=61.012)

Narration: That target has a name. It's the setpoint, r. What the car is actually doing at each instant we'll call v of t. And the whole job of a controller is to make v equal r, and then keep it there.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); engine\_lag — a Vector \[red\] labelled "upright("engine")" drawn in axes (start=(0.0, 55.0), end=(1.0, 55.0)); speed\_lag — a Vector \[green\] labelled "upright("car")" drawn in axes (start=(1.0, 55.0), end=(4.0, 55.0))

Actions:
- [01:1.012](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=61.012): engine\_lag is hidden from the screen.
- [01:1.012](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=61.012): speed\_lag is hidden from the screen.
- [01:3.288](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=63.288): eq\_set is shown on the screen, written out.

##### [01:14.697](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=74.6965)

Narration: Now, the naive fix. Guess the throttle. Find the setting that holds a hundred on flat road, push the pedal to exactly there, and leave it. And on flat road, it works.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)

Actions:
- [01:16.543](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=76.54299999999999): open\_curve is shown on the screen, drawn.

##### [01:26.385](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=86.385)

Narration: And then, fifteen seconds in, the road tilts up.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); open\_curve — a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>)

Actions:
- [01:27.685](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=87.685): point is shown on the screen, grown.
- [01:29.485](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=89.485): hill\_line is shown on the screen, written out.
- [01:29.685](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=89.685): point is hidden from the screen.

##### [01:31.072](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=91.0715)

Narration: The grade swallows part of the engine's pull, and the speed sags. The throttle does not move, because nothing in this machine is looking at the speed. It settles twenty kilometres an hour below target, and it stays there for good.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); open\_curve — a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)

Actions:
- [01:40.22](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=100.22): gap\_dot is shown on the screen, written out.
- [01:40.22](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=100.22): gap\_line is shown on the screen, written out.
- [01:40.569](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=100.569): point\_2 is shown on the screen, grown.
- [01:42.569](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=102.569): point\_2 is hidden from the screen.

##### [01:45.255](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=105.2555)

Narration: And notice where the fault is. The machine is not wrong about the throttle. It is wrong because it has no idea what the speed is doing. Nothing measures the output, so nothing can react to it.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); open\_curve — a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_dot — a PlotPoint \[red\] drawn in axes (target='open\_curve', x=27.0); gap\_line — a Line \[red\] labelled "e" drawn in axes (start=(27.0, 80.35775546255915), end=(27.0, 100.0))

Actions:
- [01:45.778](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=105.77799999999999): gap\_line is indicated — a transient flash.
- [01:52.79](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=112.78999999999999): open\_curve is indicated — a transient flash.

##### [01:57.953](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=117.9525)

Narration: That is the whole disease of an open loop. It guesses, and it never checks. So let's close the loop. Measure the speed, subtract it from the setpoint, and call that difference the error.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [02:2.886](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=122.886): open\_curve is indicated — a transient flash.
- [02:9.562](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=129.562): eq\_error is shown on the screen, written out.
- [02:10.085](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=130.08499999999998): eq\_error (the "r - v(t)" part) is emphasized.

##### [02:11.416](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=131.416)

Narration: The error is the only thing our controller gets to look at. So everything from here is one question. Given the error, what throttle should I command? That is u equals some function of e, and the rest of this lecture is filling that function in.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; eq\_error — a Math \[text\] that says "$e(t) = r - v(t)$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); open\_curve — a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_dot — a PlotPoint \[red\] drawn in axes (target='open\_curve', x=27.0); gap\_line — a Line \[red\] labelled "e" drawn in axes (start=(27.0, 80.35775546255915), end=(27.0, 100.0))

Actions:
- [02:11.416](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=131.416): eq\_error (the "r - v(t)" part) is no longer emphasized.
- [02:22.201](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=142.20099999999996): eq\_law is shown on the screen, written out.

##### [02:27.852](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=147.852)

Narration: There are three classic answers, and they stack. Proportional, which reacts to the error right now. Integral, which remembers the whole history of the error. And derivative, which watches where the error is heading.

Board: full\_law — a Math \[text\] that says "$u(t) = K\_p e(t) + K\_i integral\_0^t e(s) dif s + K\_d dot(e)(t)$"; question — a Panel that says "How does a machine hold a setpoint that the world keeps knocking it off?"; eq\_set — a Math \[text\] that says "$r = 100 thin upright("km/h")$"; eq\_error — a Math \[text\] that says "$e(t) = r - v(t)$"; eq\_law — a Math \[text\] that says "$u(t) = C(e(t))$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); open\_curve — a FunctionPlot \[blue\] labelled "v(t)" drawn in axes (function=\<function\>); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_dot — a PlotPoint \[red\] drawn in axes (target='open\_curve', x=27.0); gap\_line — a Line \[red\] labelled "e" drawn in axes (start=(27.0, 80.35775546255915), end=(27.0, 100.0))

Actions:
- [02:31.997](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=151.997): full\_law (the "K\_p e(t)" part) is emphasized.
- [02:35.63](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=155.63): full\_law (the "K\_i integral\_0^t e(s) dif s" part) is emphasized.
- [02:35.63](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=155.63): full\_law (the "K\_p e(t)" part) is no longer emphasized.
- [02:39.555](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=159.55499999999998): full\_law (the "K\_d dot(e)(t)" part) is emphasized.
- [02:39.555](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=159.55499999999998): full\_law (the "K\_i integral\_0^t e(s) dif s" part) is no longer emphasized.
- [02:42.21](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.20979166666666): full\_law (the "K\_d dot(e)(t)" part) is no longer emphasized.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): axes is hidden from the screen — left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): setpoint\_line is hidden from the screen — axes left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): open\_curve is hidden from the screen — axes left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): hill\_line is hidden from the screen — axes left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): gap\_dot is hidden from the screen — axes left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): gap\_line is hidden from the screen — axes left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): eq\_error is hidden from the screen — left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): eq\_law is hidden from the screen — left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): eq\_set is hidden from the screen — left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): full\_law is hidden from the screen — left the board.
- [02:42.46](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=162.45979166666666): question is hidden from the screen — left the board.

### Scene 2: [Proportional Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=163.50145833333332)

Span: 02:43.501–06:11.383 (163.50145833333332s–371.3833333333333s).

#### Objects

- axes: an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0)
- claim: a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"
- concept: a Panel that says "Command a correction proportional to the error. Big error, big push; small error, small push. The constant $K\_p$ is the proportional gain."
- curve\_fifteen: a FunctionPlot \[red\] labelled "K\_p = 15" drawn in axes (function=\<function\>)
- curve\_nine: a FunctionPlot \[magenta\] labelled "K\_p = 9" drawn in axes (function=\<function\>)
- curve\_one: a FunctionPlot \[blue\] labelled "K\_p = 1" drawn in axes (function=\<function\>)
- curve\_three: a FunctionPlot \[green\] labelled "K\_p = 3" drawn in axes (function=\<function\>)
- gap\_line: a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0))
- heading: a Heading that says "Proportional: React to the Error Now"
- heading\_two: a Heading that says "Why the Offset Has to Be There"
- hill\_line: a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)
- law: a Math \[text\] that says "$u = K\_p e$"
- point: a Point \[yellow\] drawn in axes (location=(0.5, 61.34853565529148))
- point\_2: a Point \[yellow\] drawn in axes (location=(2.5, 73.64920058908646))
- point\_3: a Point \[yellow\] drawn in axes (location=(10.0, 80.0353124059384))
- point\_4: a Point \[yellow\] drawn in axes (location=(12.0, 90.00333009852743))
- point\_5: a Point \[yellow\] drawn in axes (location=(12.0, 95.99549961921497))
- point\_6: a Point \[yellow\] drawn in axes (location=(12.0, 97.49480466706471))
- point\_7: a Point \[yellow\] drawn in axes (location=(12.0, 90.00333009852743))
- point\_8: a Point \[yellow\] drawn in axes (location=(27.0, 85.00164088992261))
- result: a Math \[text\] that says "$e\_infinity = frac(40, 1 + K\_p) eq.not 0$"
- setpoint\_line: a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)
- settled: a VariableNumber (initial\_value=80.0)
- work: a Derivation \[text\] that says "$e\_infinity &= r - v\_infinity \\ &= frac(r - v\_0, 1 + K\_p) \\ &= frac(40, 1 + K\_p) thin upright("km/h")$"

#### Beats

##### [02:43.501](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=163.50145833333332)

Narration: So, the first answer, and it is the one everybody invents for themselves. Look at the error right now, and push back in proportion to it. Big error, big correction. Small error, small correction. Nothing else.

Board: Empty.

Actions:
- [02:43.501](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=163.50145833333332): heading is shown on the screen, written out.
- [02:51.152](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=171.15245833333333): concept is shown on the screen, written out.

##### [02:59.914](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=179.91445833333333)

Narration: In symbols, that is u equals K p times e. One number to pick, the proportional gain, and that is the entire controller.

Board: concept — a Panel that says "Command a correction proportional to the error. Big error, big push; small error, small push. The constant $K\_p$ is the proportional gain."; heading — a Heading that says "Proportional: React to the Error Now"

Actions:
- [03:0.668](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=180.66845833333332): law is shown on the screen, written out.

##### [03:9.756](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=189.75595833333333)

Narration: So let's watch it drive. Same car, same hill at fifteen seconds. We start with the gain set to one: the moment we switch on, the error is forty, so the controller asks for forty units of throttle, and the car pulls away.

Board: concept — a Panel that says "Command a correction proportional to the error. Big error, big push; small error, small push. The constant $K\_p$ is the proportional gain."; law — a Math \[text\] that says "$u = K\_p e$"; heading — a Heading that says "Proportional: React to the Error Now"

Actions:
- [03:10.498](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=190.4984583333333): axes is shown on the screen, written out.
- [03:10.498](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=190.4984583333333): setpoint\_line is shown on the screen, written out.
- [03:10.498](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=190.4984583333333): hill\_line is shown on the screen, written out.
- [03:16.745](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=196.74545833333332): curve\_one is shown on the screen, drawn.

##### [03:25.019](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=205.01945833333332)

Narration: Notice the shape it makes. It starts flat, because the engine has not delivered anything yet. Then it swings up hard while the error is big. And it flattens out as the error shrinks, because the correction shrinks with it.

Board: concept — a Panel that says "Command a correction proportional to the error. Big error, big push; small error, small push. The constant $K\_p$ is the proportional gain."; law — a Math \[text\] that says "$u = K\_p e$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading — a Heading that says "Proportional: React to the Error Now"; setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_one — a FunctionPlot \[blue\] labelled "K\_p = 1" drawn in axes (function=\<function\>)

Actions:
- [03:27.411](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=207.41145833333331): point is shown on the screen, grown.
- [03:29.411](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=209.41145833333331): point is hidden from the screen.
- [03:31.799](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=211.79945833333332): point\_2 is shown on the screen, grown.
- [03:33.799](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=213.79945833333332): point\_2 is hidden from the screen.
- [03:35.003](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=215.00345833333333): point\_3 is shown on the screen, grown.
- [03:37.003](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=217.00345833333333): point\_3 is hidden from the screen.

##### [03:39.679](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=219.67895833333333)

Narration: And then it stops. Eighty kilometres an hour. Twenty short of the setpoint, and it will sit there all day. The controller is running, the loop is closed, and the car is still twenty short.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [03:41.896](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=221.89645833333333): gap\_line is shown on the screen, written out.

##### [03:53.79](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=233.78995833333332)

Narration: And this is not a bug you can tune away. It is arithmetic. This controller commands a throttle proportional to the error, so if the error ever reached zero, the command would be zero as well, and with no extra throttle the car falls straight back to sixty.

Board: concept — a Panel that says "Command a correction proportional to the error. Big error, big push; small error, small push. The constant $K\_p$ is the proportional gain."; law — a Math \[text\] that says "$u = K\_p e$"; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading — a Heading that says "Proportional: React to the Error Now"; setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_one — a FunctionPlot \[blue\] labelled "K\_p = 1" drawn in axes (function=\<function\>); gap\_line — a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0))

Actions:
- [03:56.773](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=236.77345833333334): concept is hidden from the screen — left the board.
- [03:56.773](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=236.77345833333334): heading is hidden from the screen — left the board.
- [03:56.773](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=236.77345833333334): law is hidden from the screen — left the board.
- [03:56.773](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=236.77345833333334): heading\_two is shown on the screen, written out.
- [03:56.773](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=236.77345833333334): claim is shown on the screen, written out.
- [04:2.195](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=242.1954583333333): claim (the "e = 0" part) is emphasized.
- [04:4.087](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=244.0874583333333): claim (the "e = 0" part) is no longer emphasized.
- [04:4.087](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=244.0874583333333): claim (the "u = 0" part) is emphasized.

##### [04:10.168](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=250.16795833333333)

Narration: Say that again, because it is the crux. The only way this controller can command throttle is to be wrong. Ask it to hold a hundred and it must run below a hundred, permanently, to have any error left to work with.

Board: axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_one — a FunctionPlot \[blue\] labelled "K\_p = 1" drawn in axes (function=\<function\>); gap\_line — a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0)); claim — a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"; heading\_two — a Heading that says "Why the Offset Has to Be There"

Actions:
- [04:10.168](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=250.16795833333333): claim (the "u = 0" part) is no longer emphasized.
- [04:18.643](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=258.64345833333334): work is shown on the screen, written out.
- [04:18.643](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=258.64345833333334): work (the "r" part) is emphasized.
- [04:20.013](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=260.01345833333335): work (the "r" part) is no longer emphasized.
- [04:20.013](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=260.01345833333335): work (the "v\_infinity" part) is emphasized.
- [04:24.088](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=264.08845833333334): work (the "v\_infinity" part) is no longer emphasized.

##### [04:24.688](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=264.6884583333333)

Narration: So the error cannot reach zero. It stops where the throttle it produces is exactly the throttle the car needs. Solve for that point and you get this. The error left over is the whole forty kilometre gap, divided by one plus the gain.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [04:31.596](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=271.5964583333333): work is shown on the screen, written out.
- [04:37.319](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=277.31945833333333): work is shown on the screen, written out.
- [04:37.923](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=277.9234583333333): work (the "1 + K\_p" part) is emphasized.
- [04:39.282](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=279.2819583333333): work (the "1 + K\_p" part) is no longer emphasized.

##### [04:39.882](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=279.88195833333333)

Narration: Which tells you exactly what raising the gain buys. Turn it up to three, and the leftover error is ten. The car holds ninety, and it gets there quicker.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [04:39.882](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=279.88195833333333): curve\_one is hidden from the screen.
- [04:44.305](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=284.3054583333333): curve\_three is shown on the screen, drawn.
- [04:48.171](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=288.1714583333333): gap\_line is redrawn as the numbers it depends on change.
- [04:48.171](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=288.1714583333333): point\_4 is shown on the screen, grown.
- [04:48.171](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=288.1714583333333): settled ticks to 90.0.
- [04:49.611](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=289.6114583333333): curve\_three is indicated — a transient flash.
- [04:50.171](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=290.1714583333333): point\_4 is hidden from the screen.

##### [04:50.988](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=290.9884583333333)

Narration: Turn it up to nine and the error is down to four. But look what has happened to the shape. It arrives fast, sails past the setpoint, and takes a couple of swings to settle.

Board: axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_line — a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0)); claim — a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"; heading\_two — a Heading that says "Why the Offset Has to Be There"; curve\_three — a FunctionPlot \[green\] labelled "K\_p = 3" drawn in axes (function=\<function\>)

Actions:
- [04:50.988](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=290.9884583333333): curve\_three is hidden from the screen.
- [04:51.94](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=291.94045833333337): curve\_nine is shown on the screen, drawn.
- [04:53.403](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=293.40345833333333): gap\_line is redrawn as the numbers it depends on change.
- [04:53.403](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=293.40345833333333): point\_5 is shown on the screen, grown.
- [04:53.403](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=293.40345833333333): settled ticks to 96.0.
- [04:55.403](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=295.40345833333333): point\_5 is hidden from the screen.

##### [05:2.142](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=302.1419583333333)

Narration: And notice why that overshoot appeared at all. The engine's pull lags behind the command. By the time the car is on target there is still a large pull in the pipeline, and that surplus carries it straight past the line.

Board: axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_line — a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0)); claim — a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"; heading\_two — a Heading that says "Why the Offset Has to Be There"; curve\_nine — a FunctionPlot \[magenta\] labelled "K\_p = 9" drawn in axes (function=\<function\>)

Actions:
- None.

##### [05:15.234](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=315.23445833333335)

Narration: Push on to fifteen and the ringing is worse again, while the offset has only crept from four down to two and a half. You can chase that gap as far as your patience for overshoot allows. You never reach zero.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [05:15.234](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=315.23445833333335): curve\_nine is hidden from the screen.
- [05:16.221](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=316.2214583333334): curve\_fifteen is shown on the screen, drawn.
- [05:17.266](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=317.2664583333334): curve\_fifteen is indicated — a transient flash.
- [05:20.842](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=320.84245833333335): gap\_line is redrawn as the numbers it depends on change.
- [05:20.842](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=320.84245833333335): point\_6 is shown on the screen, grown.
- [05:20.842](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=320.84245833333335): settled ticks to 97.5.
- [05:22.842](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=322.84245833333335): point\_6 is hidden from the screen.
- [05:25.811](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=325.81145833333335): result is shown on the screen, written out.
- [05:25.811](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=325.81145833333335): result (the "eq.not 0" part) is emphasized.
- [05:27.344](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=327.3439583333333): result (the "eq.not 0" part) is no longer emphasized.

##### [05:27.944](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=327.9439583333333)

Narration: And now the hill, which is the same story told louder. Every one of these curves drops when the grade hits, and every one settles at a new, lower speed.

Board: axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); gap\_line — a Line \[red\] labelled "e\_infinity" drawn in axes (start=(12.0, \<VariableNumber settled = 97.5\>), end=(12.0, 100.0)); claim — a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"; result — a Math \[text\] that says "$e\_infinity = frac(40, 1 + K\_p) eq.not 0$"; heading\_two — a Heading that says "Why the Offset Has to Be There"; curve\_fifteen — a FunctionPlot \[red\] labelled "K\_p = 15" drawn in axes (function=\<function\>)

Actions:
- [05:27.944](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=327.9439583333333): curve\_fifteen is hidden from the screen.
- [05:27.944](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=327.9439583333333): gap\_line is hidden from the screen.
- [05:30.184](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=330.1844583333333): curve\_three is shown on the screen, written out.
- [05:34.213](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=334.2134583333333): hill\_line is indicated — a transient flash.

##### [05:38.378](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=338.3779583333333)

Narration: With the gain at three the car held ninety on the flat. On the hill it holds eighty five. Same controller, same gain, twice the error. A bigger load needs a bigger throttle, and the only way this controller can command a bigger throttle is to be further from the setpoint. It is paid in error.

Board: axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); claim — a Math \[text\] that says "$e = 0 quad =\> quad u = 0$"; result — a Math \[text\] that says "$e\_infinity = frac(40, 1 + K\_p) eq.not 0$"; heading\_two — a Heading that says "Why the Offset Has to Be There"; curve\_three — a FunctionPlot \[green\] labelled "K\_p = 3" drawn in axes (function=\<function\>)

Actions:
- [05:39.097](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=339.09745833333335): curve\_three is indicated — a transient flash.
- [05:40.479](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=340.47945833333335): point\_7 is shown on the screen, grown.
- [05:42.479](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=342.47945833333335): point\_7 is hidden from the screen.
- [05:43.59](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=343.59045833333334): point\_8 is shown on the screen, grown.
- [05:45.59](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=345.59045833333334): point\_8 is hidden from the screen.

##### [05:57.623](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=357.6229583333333)

Narration: So proportional control is fast, it is simple, and it is structurally incapable of finishing the job. To kill that last gap, the controller needs something proportional can never have. It needs a memory.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): axes is hidden from the screen — left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): setpoint\_line is hidden from the screen — axes left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): hill\_line is hidden from the screen — axes left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): curve\_three is hidden from the screen — axes left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): claim is hidden from the screen — left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): heading\_two is hidden from the screen — left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): result is hidden from the screen — left the board.
- [06:10.342](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=370.34166666666664): work is hidden from the screen — left the board.

### Scene 3: [Integral Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=371.3833333333333)

Span: 06:11.383–09:59.431 (371.3833333333333s–599.4309166666667s).

#### Objects

- concept: a Panel that says "Add a correction proportional to the accumulated error, so a small error that refuses to go away eventually commands a large push. The constant $K\_i$ is the integral gain."
- curve\_p: a FunctionPlot \[gray\] labelled "K\_i = 0" drawn in response\_axes (function=\<function\>)
- curve\_pi: a FunctionPlot \[green\] labelled "K\_i = 1" drawn in response\_axes (function=\<function\>)
- curve\_pi\_hot: a FunctionPlot \[red\] labelled "K\_i = 2.5" drawn in response\_axes (function=\<function\>)
- elapsed: a VariableNumber
- error\_axes: an Axes (x\_range=(0.0, 30.0), y\_range=(-5.0, 45.0), x\_ticks\_every=5.0)
- error\_curve: a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>)
- error\_hill\_line: a Line \[gray\] drawn in error\_axes (start=(15.0, -3.0), end=(15.0, 42.0), dashed=True)
- heading: a Heading that says "Integral: Remember the Error"
- heading\_two: a Heading that says "What the Memory Buys, and What It Costs"
- hill\_line: a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)
- law: a Math \[text\] that says "$u = K\_p e$"
- pile: an AreaUnder \[blue\] drawn in error\_axes (x\_range=(0.0, \<VariableNumber elapsed = 30.0\>), opacity=0.35, target='error\_curve')
- point: a Point \[yellow\] drawn in error\_axes (location=(15.0, 10.000904500763426))
- point\_2: a Point \[yellow\] drawn in error\_axes (location=(12.0, 9.996669901472572))
- point\_3: a Point \[yellow\] drawn in response\_axes (location=(12.0, 90.00333009852743))
- point\_4: a Point \[yellow\] drawn in response\_axes (location=(12.0, 100.0997004952489))
- point\_5: a Point \[yellow\] drawn in response\_axes (location=(16.0, 95.09080651531968))
- point\_6: a Point \[yellow\] drawn in response\_axes (location=(27.0, 99.9004908514925))
- point\_7: a Point \[yellow\] drawn in response\_axes (location=(4.0, 115.76131755621778))
- point\_8: a Point \[yellow\] drawn in response\_axes (location=(4.0, 115.76131755621778))
- point\_9: a Point \[yellow\] drawn in response\_axes (location=(6.0, 92.32492436659642))
- response\_axes: an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0)
- setpoint\_line: a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)
- windup: a Panel that says "Integrator windup: while the actuator is saturated the pile keeps growing on error the controller cannot act on, and the plant pays it back afterwards."
- zero\_line: a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True)
- zero\_result: a Math \[text\] that says "$e\_infinity = 0$"

#### Beats

##### [06:11.383](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=371.3833333333333)

Narration: Proportional control reacts to the error right now, and right now is exactly what strands it. It has no way of knowing that this same small error has been sitting there, unfixed, for the last ten seconds. What it needs is a record.

Board: Empty.

Actions:
- [06:11.383](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=371.3833333333333): heading is shown on the screen, written out.
- [06:25.675](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=385.6753333333333): concept is shown on the screen, written out.

##### [06:27.088](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=387.0878333333333)

Narration: So here is the error from that last run, plotted on its own. It starts at forty, falls fast while the correction is big, flattens out at ten, and sits there until fifteen seconds. Then the hill makes the error jump and settle higher.

Board: concept — a Panel that says "Add a correction proportional to the accumulated error, so a small error that refuses to go away eventually commands a large push. The constant $K\_i$ is the integral gain."; heading — a Heading that says "Integral: Remember the Error"

Actions:
- [06:27.691](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=387.6913333333333): error\_axes is shown on the screen, written out.
- [06:27.691](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=387.6913333333333): zero\_line is shown on the screen, written out.
- [06:29.99](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=389.9903333333333): error\_curve is shown on the screen, drawn.
- [06:38.21](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=398.2103333333333): error\_hill\_line is shown on the screen, written out.
- [06:40.369](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=400.3693333333333): point is shown on the screen, grown.
- [06:42.369](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=402.3693333333333): point is hidden from the screen.

##### [06:43.454](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=403.4538333333333)

Narration: One thing to keep straight: this is the error, not the speed. Zero on this axis means the car is exactly on target, and every kilometre of gap up here is a kilometre the controller has failed to close.

Board: concept — a Panel that says "Add a correction proportional to the accumulated error, so a small error that refuses to go away eventually commands a large push. The constant $K\_i$ is the integral gain."; error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-5.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Integral: Remember the Error"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); error\_hill\_line — a Line \[gray\] drawn in error\_axes (start=(15.0, -3.0), end=(15.0, 42.0), dashed=True)

Actions:
- [06:48.666](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=408.66633333333334): zero\_line is indicated — a transient flash.
- [06:49.375](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=409.37533333333334): The y axis of error\_axes is lit up.
- [06:53.357](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=413.3573333333333): point\_2 is shown on the screen, grown.
- [06:55.357](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=415.3573333333333): point\_2 is hidden from the screen.

##### [06:57.974](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=417.97433333333333)

Narration: Now, instead of reading the height of this curve, add it up. Every second that goes by with an error of ten piles ten more onto the total. That accumulation is the area underneath the curve, from the moment we switched on up to now.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [07:9.155](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=429.1553333333333): pile is shown on the screen, written out.
- [07:9.155](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=429.1553333333333): elapsed ticks to 6.0.
- [07:10.655](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=430.6553333333333): pile is redrawn as the numbers it depends on change.

##### [07:13.726](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=433.7258333333333)

Narration: And watch what that pile does while the error is stuck. It grows, and it keeps growing, and nothing ever takes anything off it. A leftover error that proportional control is perfectly happy with turns into an accumulation that gets bigger without limit.

Board: concept — a Panel that says "Add a correction proportional to the accumulated error, so a small error that refuses to go away eventually commands a large push. The constant $K\_i$ is the integral gain."; error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-5.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Integral: Remember the Error"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); error\_hill\_line — a Line \[gray\] drawn in error\_axes (start=(15.0, -3.0), end=(15.0, 42.0), dashed=True); pile — an AreaUnder \[blue\] drawn in error\_axes (x\_range=(0.0, \<VariableNumber elapsed = 30.0\>), opacity=0.35, target='error\_curve')

Actions:
- [07:17.673](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=437.6733333333333): pile is redrawn as the numbers it depends on change.
- [07:17.673](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=437.6733333333333): elapsed ticks to 30.0.
- [07:28.772](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=448.77233333333334): pile is indicated — a transient flash.

##### [07:30.649](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=450.6493333333333)

Narration: So that is our second term. Add to the throttle a piece proportional to the accumulated error, the integral of e, with a gain of its own, K i.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [07:33.876](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=453.8763333333333): law is shown on the screen, written out.
- [07:37.591](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=457.5913333333333): law becomes "$u = K\_p e + K\_i integral\_0^t e dif s$".
- [07:39.159](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=459.1593333333333): law (the "K\_i integral\_0^t e dif s" part) is emphasized.
- [07:41.423](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=461.4228333333333): law (the "K\_i integral\_0^t e dif s" part) is no longer emphasized.

##### [07:42.023](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=462.0228333333333)

Narration: And now ask where this controller can possibly come to rest. Suppose it settles with any error at all left over, even half a kilometre an hour. Then the integral keeps climbing, so the throttle keeps climbing, so the speed keeps climbing. It cannot be at rest.

Board: concept — a Panel that says "Add a correction proportional to the accumulated error, so a small error that refuses to go away eventually commands a large push. The constant $K\_i$ is the integral gain."; law — a Math \[text\] that says "$u = K\_p e$"; error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-5.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Integral: Remember the Error"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); error\_hill\_line — a Line \[gray\] drawn in error\_axes (start=(15.0, -3.0), end=(15.0, 42.0), dashed=True); pile — an AreaUnder \[blue\] drawn in error\_axes (x\_range=(0.0, \<VariableNumber elapsed = 30.0\>), opacity=0.35, target='error\_curve')

Actions:
- [07:51.729](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=471.72933333333333): pile is indicated — a transient flash.
- [07:52.193](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=472.1933333333333): law (the "K\_i integral\_0^t e dif s" part) is emphasized.
- [07:58.602](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=478.6023333333333): law (the "K\_i integral\_0^t e dif s" part) is no longer emphasized.

##### [07:59.202](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=479.20233333333334)

Narration: The only value of the error it can hold still at is exactly zero. That is a strong claim, so let me put it plainly. A controller with an integral term, on a plant like this one, drives the steady error to zero. Not small. Not nearly. Zero.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [08:2.104](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=482.10433333333333): zero\_result is shown on the screen, written out.
- [08:2.72](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=482.7203333333333): zero\_line is indicated — a transient flash.
- [08:2.72](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=482.7203333333333): zero\_result (the "0" part) is emphasized.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): law is hidden from the screen.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): concept is hidden from the screen — left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): error\_axes is hidden from the screen — left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): zero\_line is hidden from the screen — error\_axes left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): error\_curve is hidden from the screen — error\_axes left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): error\_hill\_line is hidden from the screen — error\_axes left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): pile is hidden from the screen — error\_axes left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): heading is hidden from the screen — left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): zero\_result is hidden from the screen — left the board.
- [08:15.073](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=495.07283333333334): zero\_result (the "0" part) is no longer emphasized.

##### [08:16.273](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=496.2728333333333)

Narration: So let's drive it. Grey is proportional alone, stuck at ninety. Green is the same proportional gain with the integral added, K i equal to one.

Board: Empty.

Actions:
- [08:16.273](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=496.2728333333333): heading\_two is shown on the screen, written out.
- [08:16.981](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=496.9813333333333): response\_axes is shown on the screen, written out.
- [08:16.981](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=496.9813333333333): setpoint\_line is shown on the screen, written out.
- [08:16.981](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=496.9813333333333): hill\_line is shown on the screen, written out.
- [08:17.91](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=497.9103333333333): curve\_p is shown on the screen, written out.
- [08:20.778](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=500.7783333333333): point\_3 is shown on the screen, grown.
- [08:21.985](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=501.9853333333333): curve\_pi is shown on the screen, drawn.
- [08:22.778](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=502.7783333333333): point\_3 is hidden from the screen.
- [08:24.446](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=504.4463333333333): law is shown on the screen, written out.

##### [08:28.53](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=508.52983333333333)

Narration: It takes its time, because it has to build the pile up before the extra throttle amounts to anything. But it arrives. And it arrives exactly on the line, with no offset at all, which proportional control could not do at any gain.

Board: law — a Math \[text\] that says "$u = K\_p e$"; response\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_two — a Heading that says "What the Memory Buys, and What It Costs"; setpoint\_line — a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_p — a FunctionPlot \[gray\] labelled "K\_i = 0" drawn in response\_axes (function=\<function\>); curve\_pi — a FunctionPlot \[green\] labelled "K\_i = 1" drawn in response\_axes (function=\<function\>)

Actions:
- [08:37.655](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=517.6553333333334): point\_4 is shown on the screen, grown.
- [08:38.723](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=518.7233333333334): setpoint\_line is indicated — a transient flash.
- [08:39.655](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=519.6553333333334): point\_4 is hidden from the screen.

##### [08:43.793](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=523.7933333333333)

Narration: Then the hill hits. The speed sags, so the error comes back, so the pile starts growing again, and the controller walks the car back up to a hundred and holds it there.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [08:44.745](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=524.7453333333333): hill\_line is indicated — a transient flash.
- [08:46.823](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=526.8233333333333): point\_5 is shown on the screen, grown.
- [08:48.823](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=528.8233333333333): point\_5 is hidden from the screen.
- [08:53.047](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=533.0473333333333): point\_6 is shown on the screen, grown.
- [08:55.047](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=535.0473333333333): point\_6 is hidden from the screen.

##### [08:55.435](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=535.4353333333333)

Narration: That is the integral's whole job. It refuses to accept a leftover error, because a leftover error is a pile that never stops growing.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [08:56.735](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=536.7353333333333): curve\_pi is indicated — a transient flash.

##### [09:4.65](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=544.6498333333333)

Narration: But that memory costs you. Turn K i up to two and a half, and by the time the speed reaches the setpoint the accumulator has already commanded a large throttle. Being on target does not empty the pile. It only stops adding to it.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [09:4.65](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=544.6498333333333): curve\_p is hidden from the screen.
- [09:8.481](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=548.4813333333333): curve\_pi\_hot is shown on the screen, drawn.
- [09:10.687](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=550.6873333333333): point\_7 is shown on the screen, grown.
- [09:12.687](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=552.6873333333333): point\_7 is hidden from the screen.

##### [09:19.843](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=559.8433333333332)

Narration: So the car sails past, and the error has to go negative, the car has to spend time above the setpoint, before that accumulation comes back down. That is the overshoot and the ringing you are looking at.

Board: law — a Math \[text\] that says "$u = K\_p e$"; response\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_two — a Heading that says "What the Memory Buys, and What It Costs"; setpoint\_line — a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_pi — a FunctionPlot \[green\] labelled "K\_i = 1" drawn in response\_axes (function=\<function\>); curve\_pi\_hot — a FunctionPlot \[red\] labelled "K\_i = 2.5" drawn in response\_axes (function=\<function\>)

Actions:
- [09:20.749](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=560.7493333333333): point\_8 is shown on the screen, grown.
- [09:22.749](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=562.7493333333333): point\_8 is hidden from the screen.
- [09:22.978](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=562.9783333333332): point\_9 is shown on the screen, grown.
- [09:24.978](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=564.9783333333332): point\_9 is hidden from the screen.
- [09:30.42](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=570.4203333333332): curve\_pi\_hot is indicated — a transient flash.

##### [09:32.552](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=572.5523333333333)

Narration: Taken to the extreme it has a name: integrator windup. If the throttle saturates, or the car is held back for a while, the accumulator keeps piling up error it cannot act on, and the plant spends the next several seconds paying it back.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [09:35.907](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=575.9073333333333): windup is shown on the screen, written out.

##### [09:48.443](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=588.4428333333333)

Narration: So proportional gets us moving, integral finishes the job, and between them they have bought us an oscillation. The third term is the cure for that.

Board: law — a Math \[text\] that says "$u = K\_p e$"; windup — a Panel that says "Integrator windup: while the actuator is saturated the pile keeps growing on error the controller cannot act on, and the plant pays it back afterwards."; response\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_two — a Heading that says "What the Memory Buys, and What It Costs"; setpoint\_line — a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_pi — a FunctionPlot \[green\] labelled "K\_i = 1" drawn in response\_axes (function=\<function\>); curve\_pi\_hot — a FunctionPlot \[red\] labelled "K\_i = 2.5" drawn in response\_axes (function=\<function\>)

Actions:
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): heading\_two is hidden from the screen — left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): law is hidden from the screen — left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): response\_axes is hidden from the screen — left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): setpoint\_line is hidden from the screen — response\_axes left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): hill\_line is hidden from the screen — response\_axes left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): curve\_pi is hidden from the screen — response\_axes left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): curve\_pi\_hot is hidden from the screen — response\_axes left the board.
- [09:58.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=598.38925): windup is hidden from the screen — left the board.

### Scene 4: [Derivative Action](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=599.4309166666667)

Span: 09:59.431–13:33.086 (599.4309166666667s–813.0858541666666s).

#### Objects

- caption: a Tex \[text\] that says "Both runs use $K\_p = 6$ and $K\_i = 3$. Only the green one has a derivative term."
- caution: a Panel that says "The derivative of a measured signal amplifies measurement noise, so practical controllers filter it, or take it from the measurement rather than from the error."
- concept: a Panel that says "Add a correction proportional to the rate of change of the error, so a fast approach is met with a brake before the target arrives. The constant $K\_d$ is the derivative gain."
- curve\_pi: a FunctionPlot \[red\] labelled "K\_d = 0" drawn in response\_axes (function=\<function\>)
- curve\_pid: a FunctionPlot \[green\] labelled "K\_d = 3" drawn in response\_axes (function=\<function\>)
- error\_axes: an Axes (x\_range=(0.0, 30.0), y\_range=(-20.0, 45.0), x\_ticks\_every=5.0)
- error\_curve: a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>)
- heading: a Heading that says "Derivative: Watch Where the Error Is Going"
- heading\_three: a Heading that says "The Whole Controller"
- heading\_two: a Heading that says "The Same Gains, With and Without It"
- hill\_line: a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)
- law: a Math \[text\] that says "$u = K\_p e + K\_i integral\_0^t e dif s$"
- point: a Point \[yellow\] drawn in error\_axes (location=(2.0, -14.63571006249039))
- point\_2: a Point \[yellow\] drawn in response\_axes (location=(2.35, 116.63155846479191))
- point\_3: a Point \[yellow\] drawn in response\_axes (location=(3.06, 110.35052006169673))
- point\_4: a Point \[yellow\] drawn in response\_axes (location=(6.0, 100.74774824076836))
- point\_5: a Point \[yellow\] drawn in response\_axes (location=(16.0, 96.88660775428984))
- probe: a VariableNumber (initial\_value=2.0)
- response\_axes: an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0)
- roles: a Block \[text\] that says "Proportional reacts to the present error. Integral reacts to the accumulated past. Derivative reacts to the error's direction of travel."
- setpoint\_line: a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)
- tangent: a TangentLine \[yellow\] drawn in error\_axes (target='error\_curve', x=\<VariableNumber probe = 30.0\>, length=4.0)
- term: a Math \[text\] that says "$K\_d frac(dif e, dif t)$"
- zero\_line: a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True)

#### Beats

##### [09:59.431](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=599.4309166666667)

Narration: The trouble with that last run is that the controller only discovered it was going too fast after it had already gone too fast. Everything it knows is about the present and about the past. Nobody in there is looking ahead.

Board: Empty.

Actions:
- [09:59.431](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=599.4309166666667): heading is shown on the screen, written out.
- [10:0.279](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=600.2789166666666): error\_axes is shown on the screen, written out.
- [10:0.279](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=600.2789166666666): zero\_line is shown on the screen, written out.
- [10:2.902](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=602.9019166666667): error\_curve is shown on the screen, drawn.

##### [10:12.825](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=612.8249166666667)

Narration: But there is a look ahead sitting right in the data. Here is the error again, this time from an aggressive proportional plus integral tuning, the kind that rings. And at any instant we can ask a different question about it. Not how big is the error, but how fast is it changing.

Board: error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-20.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Derivative: Watch Where the Error Is Going"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>)

Actions:
- [10:17.283](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=617.2829166666667): error\_curve is indicated — a transient flash.

##### [10:30.724](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=630.7244166666667)

Narration: That is the slope of this curve, and here it is at two seconds in. The error is still about twelve kilometres an hour, and it is falling at roughly twelve kilometres an hour each second. At that rate the car reaches the target in about one second.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [10:31.804](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=631.8039166666667): tangent is shown on the screen, written out.
- [10:33.882](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=633.8819166666667): point is shown on the screen, grown.
- [10:35.882](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=635.8819166666667): point is hidden from the screen.
- [10:38.619](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=638.6189166666667): tangent is indicated — a transient flash.

##### [10:46.081](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=646.0809166666667)

Narration: And that number is a prediction. It is the controller's only honest statement about the future, and it costs nothing to compute, because it is right there in the measurement it already has.

Board: error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-20.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Derivative: Watch Where the Error Is Going"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); tangent — a TangentLine \[yellow\] drawn in error\_axes (target='error\_curve', x=\<VariableNumber probe = 30.0\>, length=4.0)

Actions:
- [10:47.323](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=647.3229166666667): tangent is indicated — a transient flash.

##### [10:57.083](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=657.0834166666667)

Narration: It is also the warning that proportional and integral cannot hear. Proportional sees a large error and pushes. The integral sees a large pile and pushes. Neither one knows that the correction already in the pipeline is more than enough.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [10:58.198](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=658.1979166666667): error\_axes moves to a new place on the board.
- [10:58.198](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=658.1979166666667): roles is shown on the screen, written out.
- [10:58.825](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=658.8249166666667): roles (the "Proportional" part) is emphasized.
- [11:5.199](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=665.1989166666667): roles (the "Integral" part) is emphasized.
- [11:5.199](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=665.1989166666667): roles (the "Proportional" part) is no longer emphasized.

##### [11:12.706](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=672.7064166666667)

Narration: So give the controller a third term. A piece proportional to the rate of change of the error, with a gain of its own, K d.

Board: roles — a Block \[text\] that says "Proportional reacts to the present error. Integral reacts to the accumulated past. Derivative reacts to the error's direction of travel."; error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-20.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Derivative: Watch Where the Error Is Going"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); tangent — a TangentLine \[yellow\] drawn in error\_axes (target='error\_curve', x=\<VariableNumber probe = 30.0\>, length=4.0)

Actions:
- [11:14.169](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=674.1689166666667): term is shown on the screen, written out.
- [11:14.169](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=674.1689166666667): roles (the "Derivative" part) is emphasized.
- [11:14.169](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=674.1689166666667): roles (the "Integral" part) is no longer emphasized.
- [11:18.395](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=678.3949166666667): concept is shown on the screen, written out.
- [11:20.369](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=680.3689166666667): roles (the "Derivative" part) is no longer emphasized.

##### [11:20.969](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=680.9689166666667)

Narration: And read the sign carefully, because the sign is the whole idea. When the error is falling, d e by d t is negative, so this term subtracts throttle. The faster you are closing in, the harder it eases off. It is a brake that comes on only when you are approaching quickly.

Board: roles — a Block \[text\] that says "Proportional reacts to the present error. Integral reacts to the accumulated past. Derivative reacts to the error's direction of travel."; concept — a Panel that says "Add a correction proportional to the rate of change of the error, so a fast approach is met with a brake before the target arrives. The constant $K\_d$ is the derivative gain."; term — a Math \[text\] that says "$K\_d frac(dif e, dif t)$"; error\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(-20.0, 45.0), x\_ticks\_every=5.0); heading — a Heading that says "Derivative: Watch Where the Error Is Going"; zero\_line — a Line \[gray\] drawn in error\_axes (end=(30.0, 0.0), dashed=True); error\_curve — a FunctionPlot \[red\] labelled "e(t)" drawn in error\_axes (function=\<function\>); tangent — a TangentLine \[yellow\] drawn in error\_axes (target='error\_curve', x=\<VariableNumber probe = 30.0\>, length=4.0)

Actions:
- [11:29.015](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=689.0149166666667): term (the "frac(dif e, dif t)" part) is emphasized.

##### [11:40.947](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=700.9469166666668)

Narration: Now watch it along the whole run. Every time the car swings toward the line, the slope is steep and the term leans against the motion. Every time it swings away, the sign flips and the term leans the other way. And once the swinging stops, the curve goes flat and the slope is zero.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [11:42.363](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=702.3629166666667): tangent is redrawn as the numbers it depends on change.
- [11:42.363](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=702.3629166666667): probe ticks to 30.0.
- [11:47.471](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=707.4709166666667): term (the "K\_d" part) is emphasized.
- [11:47.471](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=707.4709166666667): term (the "frac(dif e, dif t)" part) is no longer emphasized.
- [11:54.309](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=714.3089166666667): term (the "K\_d" part) is no longer emphasized.

##### [11:59.378](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=719.3784166666667)

Narration: That last part matters. At steady state, derivative action is silent. It cannot fix an offset and it cannot cause one. It only ever speaks while things are changing.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): concept is hidden from the screen — left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): error\_axes is hidden from the screen — left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): zero\_line is hidden from the screen — error\_axes left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): error\_curve is hidden from the screen — error\_axes left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): tangent is hidden from the screen — error\_axes left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): heading is hidden from the screen — left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): roles is hidden from the screen — left the board.
- [12:11.522](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=731.5224166666667): term is hidden from the screen — left the board.

##### [12:12.722](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=732.7224166666667)

Narration: So here is that same aggressive tuning, with it and without it. Red is proportional plus integral, the run we just took apart. Green is the same two gains with derivative added, K d equal to three.

Board: Empty.

Actions:
- [12:12.722](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=732.7224166666667): heading\_two is shown on the screen, written out.
- [12:13.094](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=733.0939166666667): response\_axes is shown on the screen, written out.
- [12:13.094](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=733.0939166666667): setpoint\_line is shown on the screen, written out.
- [12:13.094](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=733.0939166666667): hill\_line is shown on the screen, written out.
- [12:17.425](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=737.4249166666667): curve\_pi is shown on the screen, written out.
- [12:22.58](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=742.5799166666667): curve\_pid is shown on the screen, drawn.
- [12:26.701](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=746.7009166666667): caption is shown on the screen, written out.

##### [12:28.148](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=748.1484166666667)

Narration: The two leave the line at the same speed, because early on the error is huge and the proportional term dominates both of them. But the peak overshoot falls from about seventeen kilometres an hour to about ten, the ringing shrinks, and the green curve is within one kilometre an hour of the setpoint by about six seconds.

Board: response\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); caption — a Tex \[text\] that says "Both runs use $K\_p = 6$ and $K\_i = 3$. Only the green one has a derivative term."; heading\_two — a Heading that says "The Same Gains, With and Without It"; setpoint\_line — a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_pi — a FunctionPlot \[red\] labelled "K\_d = 0" drawn in response\_axes (function=\<function\>); curve\_pid — a FunctionPlot \[green\] labelled "K\_d = 3" drawn in response\_axes (function=\<function\>)

Actions:
- [12:37.889](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=757.8889166666667): point\_2 is shown on the screen, grown.
- [12:39.7](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=759.6999166666667): point\_3 is shown on the screen, grown.
- [12:39.889](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=759.8889166666667): point\_2 is hidden from the screen.
- [12:41.7](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=761.6999166666667): point\_3 is hidden from the screen.
- [12:45.807](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=765.8069166666667): point\_4 is shown on the screen, grown.

##### [12:47.568](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=767.5684166666667)

Narration: Same car, same integral, one extra term. And the hill gets the same treatment, a shallow dip instead of a plunge, because the moment the speed starts to fall the derivative term sees the slope and pushes back, before the error has had time to grow.

Board: response\_axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); caption — a Tex \[text\] that says "Both runs use $K\_p = 6$ and $K\_i = 3$. Only the green one has a derivative term."; heading\_two — a Heading that says "The Same Gains, With and Without It"; setpoint\_line — a Line \[yellow\] drawn in response\_axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in response\_axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_pi — a FunctionPlot \[red\] labelled "K\_d = 0" drawn in response\_axes (function=\<function\>); curve\_pid — a FunctionPlot \[green\] labelled "K\_d = 3" drawn in response\_axes (function=\<function\>); point\_4 — a Point \[yellow\] drawn in response\_axes (location=(6.0, 100.74774824076836))

Actions:
- [12:47.807](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=767.8069166666667): point\_4 is hidden from the screen.
- [12:51.423](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=771.4229166666667): hill\_line is indicated — a transient flash.
- [12:53.315](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=773.3149166666667): point\_5 is shown on the screen, grown.
- [12:55.315](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=775.3149166666667): point\_5 is hidden from the screen.
- [12:59.016](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=779.0159166666667): curve\_pid is indicated — a transient flash.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): caption is hidden from the screen — left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): heading\_two is hidden from the screen — left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): response\_axes is hidden from the screen — left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): setpoint\_line is hidden from the screen — response\_axes left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): hill\_line is hidden from the screen — response\_axes left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): curve\_pi is hidden from the screen — response\_axes left the board.
- [13:2.174](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=782.1739166666666): curve\_pid is hidden from the screen — response\_axes left the board.

##### [13:3.374](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=783.3739166666667)

Narration: So there is the whole controller. Three terms, one error signal. The present, the past, and the projected future, added up into a single number and sent to the throttle.

Board: Empty.

Actions:
- [13:3.374](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=783.3739166666667): heading\_three is shown on the screen, written out.
- [13:6.729](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=786.7289166666667): law is shown on the screen, written out.
- [13:11.803](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=791.8029166666668): law becomes "$u = K\_p e + K\_i integral\_0^t e dif s + K\_d frac(dif e, dif t)$".

##### [13:16.153](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=796.1529166666667)

Narration: One caution before we tune it. That derivative is the slope of a measured signal, and real measurements are noisy. Differentiate noise and you amplify it, which is why practical controllers filter the derivative, or take it from the measurement rather than from the error.

Board: law — a Math \[text\] that says "$u = K\_p e + K\_i integral\_0^t e dif s$"; heading\_three — a Heading that says "The Whole Controller"

Actions:
- [13:16.733](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=796.7329166666667): caution is shown on the screen, written out.
- [13:32.044](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=812.0441875): caution is hidden from the screen — left the board.
- [13:32.044](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=812.0441875): heading\_three is hidden from the screen — left the board.
- [13:32.044](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=812.0441875): law is hidden from the screen — left the board.

### Scene 5: [Tuning the Three Gains](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=813.0858541666666)

Span: 13:33.086–16:41.897 (813.0858541666666s–1001.8970416666666s).

#### Objects

- applications: a Block \[text\] that says "Ovens hold temperature. Drones hold attitude. Disk drives hold position. Cruise control holds speed."
- axes: an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0)
- curve\_good: a FunctionPlot \[green\] labelled "K\_p = 6, K\_i = 3, K\_d = 3" drawn in axes (function=\<function\>)
- curve\_hot\_d: a FunctionPlot \[blue\] labelled "K\_d = 15" drawn in axes (function=\<function\>)
- curve\_hot\_i: a FunctionPlot \[magenta\] labelled "K\_i = 7" drawn in axes (function=\<function\>)
- curve\_hot\_p: a FunctionPlot \[red\] labelled "K\_p = 18" drawn in axes (function=\<function\>)
- heading: a Heading that says "Three Gains, One Trade"
- heading\_curve: a Heading that says "One Gain at a Time"
- heading\_trade: a Heading that says "What Too Much Gain Does"
- heading\_two: a Heading that says "Where PID Works"
- hill\_line: a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True)
- methods: a Block \[text\] that says "Ziegler and Nichols: use sustained oscillation to set a starting point. Relay tuning: excite a controlled cycle and estimate the plant response."
- pid\_summary: a Text \[text\] that says "One error signal is read as present, accumulated past, and direction of travel."
- point: a Point \[yellow\] drawn in axes (location=(6.0, 100.74774824076836))
- point\_2: a Point \[yellow\] drawn in axes (location=(1.0, 81.37159628279002))
- point\_3: a Point \[yellow\] drawn in axes (location=(4.0, 107.7876990608755))
- point\_4: a Point \[yellow\] drawn in axes (location=(20.0, 100.17060465631636))
- roles: a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."
- setpoint\_line: a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True)
- trade: a Table \[text\] that says "Gain pushed too high Visible cost $K\_p$ More overshoot and faster ringing $K\_i$ More overshoot and slower ringing $K\_d$ Slower rise and more noise sensitivity" (rows=(('Gain pushed too high', 'Visible cost'), ('$K\_p$', 'More over…, header=True)

#### Beats

##### [13:33.086](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=813.0858541666666)

Narration: So. Three gains, and one system that has to rise quickly, settle cleanly, and hold. Tuning is nothing more than deciding how much of each of the three answers you want.

Board: Empty.

Actions:
- [13:33.086](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=813.0858541666666): heading is shown on the screen, written out.

##### [13:45.389](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=825.3888541666666)

Narration: Proportional is the present. It reacts to the error you have right now, it is your main lever on how quickly you respond, and on its own it always leaves a gap.

Board: heading — a Heading that says "Three Gains, One Trade"

Actions:
- [13:46.736](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=826.7358541666666): roles is shown on the screen, written out.
- [13:46.736](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=826.7358541666666): roles (the "Proportional reads the present error and sets the main response speed." part) is emphasized.
- [13:56.139](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=836.1388541666666): roles (the "Proportional reads the present error and sets the main response speed." part) is no longer emphasized.

##### [13:56.739](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=836.7388541666667)

Narration: Integral is the past. It accumulates what proportional keeps leaving behind, and it is the only one of the three that can drive the steady error to zero. It buys you accuracy, and it costs you overshoot.

Board: roles — a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."; heading — a Heading that says "Three Gains, One Trade"

Actions:
- [13:58.179](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=838.1788541666666): roles (the "Integral reads the accumulated past and removes steady error." part) is emphasized.
- [14:10.125](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=850.1248541666666): roles (the "Integral reads the accumulated past and removes steady error." part) is no longer emphasized.

##### [14:10.725](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=850.7248541666667)

Narration: Derivative is the future. It reads the slope and leans against fast change. It buys you damping, and it costs you sensitivity to noise.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [14:11.933](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=851.9328541666666): roles (the "Derivative reads the direction of travel and adds damping." part) is emphasized.
- [14:20.349](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=860.3493541666667): roles moves to a new place on the board.
- [14:20.349](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=860.3493541666667): heading is hidden from the screen — left the board.
- [14:20.349](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=860.3493541666667): roles (the "Derivative reads the direction of travel and adds damping." part) is no longer emphasized.

##### [14:20.949](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=860.9493541666667)

Narration: Here is the tuning we ended on. K p six, K i three, K d three. Quick off the line, one small overshoot, settled inside about six seconds, and it takes the hill in its stride.

Board: roles — a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."

Actions:
- [14:20.949](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=860.9493541666667): heading\_curve is shown on the screen, written out.
- [14:21.298](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=861.2978541666666): axes is shown on the screen, written out.
- [14:21.298](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=861.2978541666666): setpoint\_line is shown on the screen, written out.
- [14:21.298](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=861.2978541666666): hill\_line is shown on the screen, written out.
- [14:24.004](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=864.0038541666667): curve\_good is shown on the screen, drawn.
- [14:31.225](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=871.2248541666667): point is shown on the screen, grown.
- [14:32.932](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=872.9318541666667): curve\_good is indicated — a transient flash.
- [14:33.225](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=873.2248541666667): point is hidden from the screen.

##### [14:34.867](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=874.8668541666666)

Narration: And watch which term is doing the work along that curve. In the first second it is nearly all proportional. Through the middle of the rise, derivative is holding it back. And after the hill, the last few kilometres an hour are closed by the integral, slowly, with the other two almost silent.

Board: roles — a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_curve — a Heading that says "One Gain at a Time"; setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_good — a FunctionPlot \[green\] labelled "K\_p = 6, K\_i = 3, K\_d = 3" drawn in axes (function=\<function\>)

Actions:
- [14:38.675](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=878.6748541666666): point\_2 is shown on the screen, grown.
- [14:38.675](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=878.6748541666666): roles (the "Proportional reads the present error and sets the main response speed." part) is emphasized.
- [14:40.675](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=880.6748541666666): point\_2 is hidden from the screen.
- [14:41.972](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=881.9718541666666): point\_3 is shown on the screen, grown.
- [14:41.972](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=881.9718541666666): roles (the "Derivative reads the direction of travel and adds damping." part) is emphasized.
- [14:41.972](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=881.9718541666666): roles (the "Proportional reads the present error and sets the main response speed." part) is no longer emphasized.
- [14:43.972](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=883.9718541666666): point\_3 is hidden from the screen.
- [14:45.223](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=885.2228541666666): point\_4 is shown on the screen, grown.
- [14:45.223](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=885.2228541666666): roles (the "Derivative reads the direction of travel and adds damping." part) is no longer emphasized.
- [14:45.223](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=885.2228541666666): roles (the "Integral reads the accumulated past and removes steady error." part) is emphasized.
- [14:47.223](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=887.2228541666666): point\_4 is hidden from the screen.
- [14:53.292](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=893.2918541666667): roles (the "Integral reads the accumulated past and removes steady error." part) is no longer emphasized.

##### [14:53.892](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=893.8918541666667)

Narration: Now let's break it, one gain at a time, and watch the same curve move. Triple the proportional gain and the response gets snappy and impatient. It hits harder, it swings wider, and it argues with itself for a good deal longer before it settles.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [14:59.268](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=899.2678541666667): curve\_hot\_p is shown on the screen, drawn.
- [15:4.84](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=904.8398541666667): curve\_hot\_p is indicated — a transient flash.

##### [15:10.479](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=910.4788541666667)

Narration: Put that back, and turn the integral up instead. The accumulator gets ahead of the plant, so the overshoot grows, and there is a long slow ring while the pile is paid back down.

Board: roles — a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_curve — a Heading that says "One Gain at a Time"; setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_good — a FunctionPlot \[green\] labelled "K\_p = 6, K\_i = 3, K\_d = 3" drawn in axes (function=\<function\>); curve\_hot\_p — a FunctionPlot \[red\] labelled "K\_p = 18" drawn in axes (function=\<function\>)

Actions:
- [15:10.955](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=910.9548541666667): curve\_hot\_p is hidden from the screen.
- [15:12.604](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=912.6038541666667): curve\_hot\_i is shown on the screen, drawn.
- [15:19.117](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=919.1168541666666): curve\_hot\_i is indicated — a transient flash.

##### [15:22.77](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=922.7703541666666)

Narration: And too much derivative goes the other way. It is so eager to lean against any change at all that it drags its feet, and the rise slows right down. In a real plant it would also be turning every twitch of sensor noise into a twitch of the throttle.

Board: roles — a Block \[text\] that says "Proportional reads the present error and sets the main response speed. Integral reads the accumulated past and removes steady error. Derivative reads the direction of travel and adds damping."; axes — an Axes (x\_range=(0.0, 30.0), y\_range=(50.0, 120.0), x\_ticks\_every=5.0); heading\_curve — a Heading that says "One Gain at a Time"; setpoint\_line — a Line \[yellow\] drawn in axes (start=(0.0, 100.0), end=(30.0, 100.0), dashed=True); hill\_line — a Line \[gray\] drawn in axes (start=(15.0, 52.0), end=(15.0, 116.0), dashed=True); curve\_good — a FunctionPlot \[green\] labelled "K\_p = 6, K\_i = 3, K\_d = 3" drawn in axes (function=\<function\>); curve\_hot\_i — a FunctionPlot \[magenta\] labelled "K\_i = 7" drawn in axes (function=\<function\>)

Actions:
- [15:22.77](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=922.7703541666666): curve\_hot\_i is hidden from the screen.
- [15:23.746](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=923.7458541666666): curve\_hot\_d is shown on the screen, drawn.
- [15:30.34](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=930.3398541666667): curve\_hot\_d is indicated — a transient flash.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): axes is hidden from the screen — left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): setpoint\_line is hidden from the screen — axes left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): hill\_line is hidden from the screen — axes left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): curve\_good is hidden from the screen — axes left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): curve\_hot\_d is hidden from the screen — axes left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): heading\_curve is hidden from the screen — left the board.
- [15:38.071](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.0713541666667): roles is hidden from the screen — left the board.

##### [15:38.671](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.6713541666667)

Narration: The three broken tunings make the trade explicit. Too much proportional gain buys speed with overshoot and fast ringing. Too much integral gain buys persistence with overshoot and slow ringing. Too much derivative gain buys resistance to change with a slower rise and greater noise sensitivity.

Board: Empty.

Actions:
- [15:38.671](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.6713541666667): heading\_trade is shown on the screen, written out.
- [15:38.671](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=938.6713541666667): trade is shown on the screen, written out.
- [15:43.014](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=943.0138541666666): trade is shown on the screen, written out.
- [15:45.766](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=945.7658541666666): trade is indicated — a transient flash.
- [15:47.774](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=947.7738541666666): trade is shown on the screen, written out.
- [15:50.433](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=950.4328541666666): trade is indicated — a transient flash.
- [15:52.604](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=952.6038541666667): trade is shown on the screen, written out.
- [15:56.981](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=956.9808541666666): trade is indicated — a transient flash.

##### [15:58.986](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=958.9863541666666)

Narration: Which is also why tuning rules exist. Ziegler and Nichols, relay tuning, and the rest of them are recipes for finding a decent corner of that trade without walking the whole space by hand.

Board: heading\_trade — a Heading that says "What Too Much Gain Does"

Actions:
- [16:0.287](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=960.2868541666667): methods is shown on the screen, written out.
- [16:2.318](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=962.3178541666666): methods (the "Ziegler and Nichols: use sustained oscillation to set a starting point." part) is emphasized.
- [16:3.967](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=963.9668541666666): methods (the "Relay tuning: excite a controlled cycle and estimate the plant response." part) is emphasized.
- [16:3.967](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=963.9668541666666): methods (the "Ziegler and Nichols: use sustained oscillation to set a starting point." part) is no longer emphasized.
- [16:11.421](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=971.4208541666667): heading\_trade is hidden from the screen — left the board.
- [16:11.421](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=971.4208541666667): methods is hidden from the screen — left the board.
- [16:11.421](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=971.4208541666667): trade is hidden from the screen — left the board.
- [16:11.421](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=971.4208541666667): methods (the "Relay tuning: excite a controlled cycle and estimate the plant response." part) is no longer emphasized.

##### [16:12.621](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=972.6208541666666)

Narration: So that is P I D. One error signal, read three ways. What it is, what it has been, and where it is going. Multiply each reading by a gain, add them up, and send the sum to the actuator.

Board: Empty.

Actions:
- [16:12.621](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=972.6208541666666): heading\_two is shown on the screen, written out.
- [16:14.861](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=974.8608541666666): pid\_summary is shown on the screen, written out.

##### [16:27.129](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=987.1293541666666)

Narration: It is a strikingly small idea, and it runs a startling fraction of the machines around you. The ovens, the drones, the disk drives, the cruise control in the car you came here in. Three terms. One error.

Board: pid\_summary — a Text \[text\] that says "One error signal is read as present, accumulated past, and direction of travel."; heading\_two — a Heading that says "Where PID Works"

Actions:
- [16:27.129](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=987.1293541666666): applications is shown on the screen, written out.
- [16:33.027](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=993.0268541666666): applications (the "Ovens hold temperature." part) is emphasized.
- [16:33.643](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=993.6428541666666): applications (the "Drones hold attitude." part) is emphasized.
- [16:33.643](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=993.6428541666666): applications (the "Ovens hold temperature." part) is no longer emphasized.
- [16:34.548](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=994.5478541666666): applications (the "Disk drives hold position." part) is emphasized.
- [16:34.548](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=994.5478541666666): applications (the "Drones hold attitude." part) is no longer emphasized.
- [16:35.767](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=995.7668541666666): applications (the "Cruise control holds speed." part) is emphasized.
- [16:35.767](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=995.7668541666666): applications (the "Disk drives hold position." part) is no longer emphasized.
- [16:40.605](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=1000.605375): applications (the "Cruise control holds speed." part) is no longer emphasized.
- [16:40.855](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=1000.855375): applications is hidden from the screen — left the board.
- [16:40.855](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=1000.855375): heading\_two is hidden from the screen — left the board.
- [16:40.855](https://academa.ai/lectures/pid-control-one-term-at-a-time?t=1000.855375): pid\_summary is hidden from the screen — left the board.
