Why feedback: rejecting disturbances and coping with change
About this lesson
Feedback is worth the trouble for two reasons. It fights disturbances, pushes from outside that nobody measures, and it copes when the thing being controlled changes. Follow one cruise control up a hill and then towing a trailer, with the throttle fixed (open loop) and with the speedometer fed back to a three-line Python rule (closed loop).
Cruise control at 100 km/h
Cruise control holds a car at a speed the driver picks, here 100 km/h. In the words of “Parts of a loop”: the car is the plant, the engine is the actuator and the speedometer is the sensor.
goal (setpoint) 100 km/h plant the car (output: speed) actuator engine, throttle 0 to 100 % sensor speedometer The car's speed follows the throttle with a time constant of 20 s: about how long it takes to get two-thirds of the way.
Read the lesson step by step
Cruise control at 100 km/h
Cruise control holds a car at a speed the driver picks, here 100 km/h. In the words of “Parts of a loop”: the car is the plant, the engine is the actuator and the speedometer is the sensor.
goal (setpoint) 100 km/h plant the car (output: speed) actuator engine, throttle 0 to 100 % sensor speedometer The car's speed follows the throttle with a time constant of 20 s: about how long it takes to get two-thirds of the way.Open loop: 50 % and forget
On a flat road, 50 % throttle holds exactly 100 km/h. So we fix the throttle at 50 % and never look again. That is open-loop control, as in “Open loop versus closed loop”, and on this flat road it works perfectly.
throttle 50 %, worked out once flat road 2 km/h per % × 50 % = 100 km/h Open loop is cheap and simple. It is only right while the world matches the one we worked the number out for.A hill pulls the car back
At 20 s the road tilts up. Gravity now pulls the car back: a disturbance, a push from outside that nobody asked for. The throttle stays at 50 %, so the car slows to about 80.0 km/h.
# open loop on the hill import math TAU, K = 20, 2 # s, km/h per % speed, dt = 100.0, 0.05 for n in range(2400): # 120 s gas = 50 # throttle, % hill = 10 if n * dt >= 20 else 0 target = K * (gas - hill) speed = target + (speed - target) * math.exp(-dt / TAU) print(round(speed, 1)) # 80.1Close the loop
Now close the loop, as in “Open loop versus closed loop”: the speedometer feeds back. The rule starts at 50 % and adds 5 % throttle per km/h of error, the gap between 100 km/h and the speed. On the flat, error is zero.
error = 100 - speed # 0 on the flat gas = 50 + 5 * error # 50 % gas = min(max(gas, 0), 100) gas is the throttle, in %, kept between 0 and 100. Same starting point as open loop, plus a correction that grows with the error.Feedback climbs the hill
Same hill, same moment. The speed dips, the error grows, and the throttle opens up to 59.1 %. Within about 7 seconds the car settles at 98.2 km/h. Open loop lost 20.0 km/h; feedback lost 1.8.
# closed loop on the hill import math TAU, K = 20, 2 # s, km/h per % speed, dt = 100.0, 0.05 for n in range(2400): # 120 s error = 100 - speed gas = min(max(50 + 5 * error, 0), 100) hill = 10 if n * dt >= 20 else 0 target = K * (gas - hill) speed = target + (speed - target) * math.exp(-dt / TAU) print(round(speed, 1)) # 98.2It never saw the hill
No sensor measures the slope. The controller only sees the speed falling, and that is enough. Each km/h lost asks for 5 % more throttle, so the loss shrinks about 11 times: from 20.0 to 1.8 km/h.
open loop closed loop throttle 50 % 50 → 59.1 % settles at 80.0 98.2 km/h loss shrinks by 1 + 2 × 5 = 11 (2 km/h per % × 5 % per km/h: the loop gain, met again in later lessons)Now the car itself changes
Next trip, the car tows a trailer on a flat road. Nothing pushes from outside this time: the plant itself is different. A quarter more drag (and weight) means the same throttle now gives 20 % less speed.
bare car 2 km/h per % throttle with trailer 1.6 km/h per % throttle (20 % less) The numbers we tuned for were for a car that no longer exists. Real plants change too: load, wear, tyres, temperature.Open loop trusts old numbers
The open-loop controller still sends 50 %, the right number for a car without a trailer. With the trailer, 50 % only holds 80.0 km/h. Its whole accuracy rested on knowing the car exactly.
# open loop with the trailer import math TAU, K = 20, 1.6 # s, km/h per % speed, dt = 100.0, 0.05 for n in range(2400): # 120 s gas = 50 # throttle, % target = K * (gas) speed = target + (speed - target) * math.exp(-dt / TAU) print(round(speed, 1)) # 80.0Feedback copes with the change
The same three-line rule, not retuned. The speedometer shows the car falling short, so the throttle rises to 61.1 %. The car holds 97.8 km/h. A 20 % change in the car became a 2.2 % change in speed.
# closed loop with the trailer import math TAU, K = 20, 1.6 # s, km/h per % speed, dt = 100.0, 0.05 for n in range(2400): # 120 s error = 100 - speed gas = min(max(50 + 5 * error, 0), 100) target = K * (gas) speed = target + (speed - target) * math.exp(-dt / TAU) print(round(speed, 1)) # 97.8Why feedback is worth it
Feedback costs a sensor and a rule, and still leaves a small error. In return it fights pushes it cannot see and copes with a plant that is not what we assumed. Those two gifts are why almost every controller uses it.
hill trailer open loop 80.0 80.0 km/h closed loop 98.2 97.8 km/h feedback costs a sensor, a rule, wiring it gives disturbance rejection and tolerance of change still left a small error
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01In the cruise-control example, which of these is a disturbance rather than a change in the plant?
The hill is a push from outside the car. The trailer, extra weight and extra drag all change the car itself, the plant.
02On the hill the open-loop car slows to about 80.0 km/h. Why does it not speed back up?
Open loop sets the throttle once and never looks at the result, so nothing tells it the car has slowed.
03The closed-loop controller has no sensor for the slope of the road. How does it still fight the hill?
Feedback reacts to the effect, not the cause. Any push that slows the car shows up as error, and the rule adds 5 % of throttle per km/h of error.
04With a trailer the same throttle gives 20 % less speed. By how much does the closed-loop speed change?
The closed loop settles at 97.8 km/h instead of 100: about 2.2 % lower. Open loop drops the full 20 %, to 80.0 km/h.
05Which is a fair cost of feedback in this lesson?
Feedback needs the speedometer and a rule, and our proportional rule leaves 1.8 km/h of error on the hill. Later lessons show how to shrink or remove it.
Glossary
- Disturbance
- A push on the plant from outside that nobody asked for, like a hill pulling a car back or a gust of wind.
- Plant change
- A change in the thing being controlled itself, like a car towing a trailer. The old settings no longer give the old result.
- Open loop
- Control that sets the actuator and never measures the output. It is only right while the world and the plant match what was assumed.
- Closed loop (feedback)
- Control that measures the output and sends it back to the controller, so the controller can correct what it sees.
- Error
- Goal minus measured output. Here, 100 km/h minus the speedometer reading.
- Proportional control
- A rule whose correction grows in proportion to the error. Here: 5 % more throttle for every km/h too slow.
- Disturbance rejection
- Feedback's ability to shrink the effect of a disturbance without measuring the disturbance itself.
- Sensitivity
- How much the output changes when the plant changes. Feedback makes it much smaller: here a 20 % change in the car became a 2.2 % change in speed.
Notes and sources
- The car is a simple model with illustrative numbers: in steady state it goes 2 km/h for every % of throttle (1.6 with the trailer), with a 20-second time constant. Every curve and number in the figure is computed from that model.
- The hill is modelled as a steady pull worth 10 % of throttle. A real slope pulls back with the car's weight times the sine of its angle; turning that into throttle depends on the engine, so this lesson keeps it as one number.
- The small error left (1.8 km/h on the hill, 2.2 km/h with the trailer) comes from the proportional rule. Raising the gain of 5 shrinks it; integral action, taught later in this course, removes it.
- The Python on each step is plain Python 3 with the math module. It updates the throttle every 0.05 s and moves the car forward with the exact solution of its equation between updates, just as the figure does.
- N. S. Nise, Control Systems Engineering, 8th ed., Wiley (ch. 1; sensitivity in ch. 7)
- K. Ogata, Modern Control Engineering, 5th ed., Pearson (ch. 1: open- versus closed-loop control)
- G. F. Franklin, J. D. Powell, A. Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson (ch. 2 cruise-control model; ch. 4 a first analysis of feedback)
- MIT OpenCourseWare 16.06 Principles of Automatic Control (S. Hall)
- MIT OpenCourseWare 6.302 Feedback Systems (Dawson, Lundberg)
- Python Control Systems Library (python-control) documentation
Quiz Unlocks after the last step.