TactivergeOffline

Level 4 Engineering Complex Systems · Term 2: Dynamic Systems and Control

Systems that evolve in time: states, first- and second-order models, transient response and stability, and the feedback controllers that shape them, from proportional control to PID with saturation, tested in simulation against written specifications.

In this file: 27 lessons across weeks 10–18, with 138 practice questions (questions only, no answers).

Model, control, optimise and benchmark dynamic engineering systems using calculus, control theory, signal processing and computer architecture, with explicit assumptions and reproducible evidence. Levels describe what you can do, not your age. About About 3–4 hours a week: 1.5–2 hours of lessons and worked problems, 1–1.5 hours of simulation and 30 minutes of write-up..

Week 10: Dynamic systems

This week you will

Systems with memory

Flick a light switch and the room is bright at once. Turn on an oven and you wait ten minutes. What does the oven have that the bulb does not?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Almost everything worth controlling is dynamic: motors spin up, rooms warm, lifts accelerate, batteries charge. If you treat a dynamic system as static, you will push too hard, overshoot and blame the hardware. This term is about systems whose present depends on their past, and how to steer them.

Goals

Predict

A motor is switched from 0 V to 6 V in an instant. What does its speed do?

  1. Jumps to full speed instantly
  2. Rises smoothly over a short time, then levels off
  3. Rises forever while the voltage is on

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Robotics Workbench in Systems Engineer mode. Step one wheel's motor command from zero to a fixed value and watch the measured wheel speed. Then step it back to zero. Note how long each change takes and whether the speed ever jumps.

What the interactive shows, in words

In the workbench, stepping a motor command from zero to a fixed value makes the wheel speed rise quickly at first, then more slowly, levelling off after a fraction of a second; stepping back to zero makes it fall the same way. The speed never jumps.

Understand

Static versus dynamic

A static system's output depends only on the input right now: a resistor's current follows its voltage instantly, a lever's output force follows the push. A dynamic system's output depends on what happened before: a cup of tea's temperature now depends on how hot it was a minute ago. Dynamic systems have memory.

Memory is stored stuff

Physically, memory is something stored that cannot change instantly: kinetic energy in a spinning rotor, heat in an oven's walls, charge on a capacitor, water in a tank. Changing the stored amount takes a finite flow over a finite time, which is why outputs lag inputs.

Describe the rate, not the value

Because the output cannot jump, we describe a dynamic system by how fast it changes: dT/dt = (heater power − losses)/heat capacity. Solve or simulate that rate equation and you get the value at every time. That is the language of this whole term.

Explain it another way: intuitive

A static system is a mirror: it shows you the input right now. A dynamic system is a bath: what's in it now depends on everything you poured in and everything that drained out.

Explain it another way: technical

A static system is y(t) = f(u(t)). A dynamic system needs internal variables x(t) with dx/dt = f(x, u) and an output y = g(x, u). The internal variables are its states; their values summarise the whole relevant past.

Explain it another way: mathematical

Static: y = 3u. Dynamic: dy/dt = −y/τ + (K/τ)·u. For a constant u the dynamic one approaches y = K·u, but only as t grows; at t = 0⁺ its output is still whatever it was before the step.

Explain it another way: applied

Lift engineers model the cabin as dynamic (mass, rope stretch). The door edge sensor is treated as static: it reports an obstruction essentially at once. Choosing which parts need a dynamic model is a key modelling decision.

Try these examples

Example 1

Classify: (a) a phone charger's output voltage versus mains input, (b) a water tank's level versus inflow, (c) an LED's brightness versus current.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which of these is best modelled as a dynamic system for a 1-minute experiment?

  • A potentiometer's output voltage versus knob angle
  • A kettle's water temperature versus heater power
  • A light-dependent resistor's resistance versus light level
  • A gear train's output angle versus input angle

2. Physically, why can't an oven's temperature jump when you switch it on?

  • The thermostat is slow to read
  • Heat must flow into the walls and air, and a finite power takes time to deliver a finite energy
  • Electricity takes time to reach the heater
  • Ovens are designed to be slow on purpose

3. Which description captures a dynamic system?

  • y = 2u
  • dy/dt = −0.5·y + u
  • y = u²
  • y = sin(u)

4. An engineer models a motor driver chip as static but the motor as dynamic. When is that justified?

  • Never: everything is dynamic
  • When the driver responds much faster than the motor, so its lag is negligible on the motor's timescale
  • Only if the chip is cheap
  • When the motor is small

5. A first-order system τ·dy/dt + y = K·u starts at rest (y = 0). Its parameters are K = 4 and τ = 0.4 s, and a step input u = 2 is applied at time zero. What is y at t = 0.6 s?

Answer:

Apply it

List five systems in your home. For each, name the stored quantity that gives it memory (or say why it is effectively static) and estimate how long it takes to respond to a sudden change.

Reflect

Which system you use every day responds more slowly than you would like, and what is being stored that makes it slow?

Inputs, outputs, states and parameters

A greenhouse model has a heater, a thermometer, a temperature and a wall thickness. Which of those is the model's memory?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Before you can simulate or control anything you need to agree what is a knob you turn (input), what you measure (output), what the system remembers (state), what is fixed by its design (parameter) and what the world does to it (disturbance). Mixing these up is the most common source of broken models.

Goals

Predict

In a model of a lift, which quantity is a parameter rather than a state?

  1. Cabin position
  2. Cabin velocity
  3. Cabin empty mass
  4. Motor current

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the feedback lab with a first-order plant. Write down every slider and label each one input, parameter or controller setting. Then change only the plant time constant and see which curves change.

What the interactive shows, in words

The feedback lab has sliders for the set point (input), the plant gain and time constant (parameters), the controller gains (design choices) and an optional disturbance. Changing only the time constant changes how fast the output curve rises, without changing where it ends up.

Understand

Five kinds of quantity

Inputs are what you choose (heater power, motor voltage). Disturbances are inputs you don't choose (wind, a passenger stepping in). States are what the system remembers (temperature, speed). Outputs are what you measure, often a state seen through a sensor. Parameters are fixed numbers in the equations (mass, time constant, gain).

Parameters stay put, states move

In a single run the parameters are constants; the states change from step to step. Changing a parameter means simulating a different system. That is why a fair test changes one parameter at a time across runs.

Block diagrams

Engineers draw a model as boxes joined by arrows. Each arrow is a signal (a quantity that varies in time) and each box transforms signals. Parameters live inside the boxes. A feedback loop is an arrow that carries the output back to the input side.

Explain it another way: intuitive

Think of a recipe: ingredients are inputs, the oven temperature dial is an input too, the cake's doneness is the state, the oven's size is a parameter, and opening the door is a disturbance.

Explain it another way: technical

A model dx/dt = f(x, u, d; p), y = h(x) has state x, input u, disturbance d, parameters p and output y. Identification estimates p from data; simulation computes x(t) given p, x(0), u(t) and d(t).

Explain it another way: applied

In the Elevator build, the controller gains are inputs to your design, the cabin mass and rope stiffness are parameters, the cabin position and speed are states, and the passengers' weight is a disturbance the controller must reject.

Try these examples

Example 1

A model of a phone battery: dQ/dt = −I(t), V = V₀(Q) − I·R. Label Q, I, V, R and V₀.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A drone hovering in wind: which is a disturbance?

  • Motor thrust command
  • Gust of wind
  • Drone altitude
  • Propeller diameter

2. You change the time constant in the feedback lab between two runs. What have you done?

  • Changed the state
  • Simulated a different system
  • Changed the input
  • Added a disturbance

3. Why is the measured temperature an output and not simply the state?

  • They are always identical
  • The sensor adds noise, lag and resolution limits, so the measurement is the state seen through a sensor
  • Outputs are always voltages
  • States cannot be measured

4. In a block diagram, what does an arrow represent?

  • A wire
  • A signal: a quantity that varies with time
  • A parameter
  • The direction of energy flow only

5. A first-order system starts at 0 and settles towards a final value y∞ = 3.3. At t = 1.35 s the reading is y = 0.8553. What is the time constant τ in seconds?

Answer: s

Apply it

Draw a labelled block diagram of the Smart Greenhouse: heater command in, air temperature state, thermometer output, outside temperature disturbance, wall insulation and air volume as parameters. Mark which arrow would carry feedback.

Reflect

Name a system where it is genuinely hard to decide whether something is an input or a disturbance. What decides it?

Is the code right? Is the model right?

Your simulation of a cooling cup is bug-free and matches the equation perfectly. It is still wrong by 10 °C. How can both be true?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every engineering simulation can fail in two separate ways: the code can be wrong, or the physics can be wrong. Engineers check both, in that order, and write down which they checked. A model that passes only one is not yet evidence.

Goals

Predict

A simulation agrees with the exact solution of its equation to four decimal places. What has that proved?

  1. The model matches reality
  2. The code solves the equation correctly
  3. Both
  4. Neither

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Investigation: in the feedback lab, set a first-order plant with K = 1, τ = 2 s under P control with Kp = 1 and a set point of 1. Theory says the loop settles at 0.5 with a time constant of 1 s, so y(1 s) ≈ 0.5 × 0.632 = 0.32. Read y at t = 1 s from the plot. If it agrees, you have a verification check; write down what it does not tell you about a real motor.

What the interactive shows, in words

In the feedback lab, a first-order plant under P control (K = 1, τ = 2 s, Kp = 1) rises smoothly towards 0.5 and is at about 0.32 after 1 s, matching the formula. That agreement is a verification check.

Understand

Verification: solving the equations right

Check the code against cases with known answers: an exact solution, a conserved quantity, a limit like 'no input means no change'. Then halve the time step: if the answer still changes noticeably, the step was too big. These checks say nothing about the real world.

Validation: solving the right equations

Compare the model with measurements, ideally from runs not used to fit its parameters. Fitting τ to one cooling curve and then predicting a second cup at a different starting temperature is a real test; matching the curve you fitted to is not.

Order matters, and so does honesty

Verify first: a bug can masquerade as a physics problem. Then validate, report the error, and list the assumptions the model makes (constant room temperature, uniform cup temperature). Saying 'validated for these conditions' is honest; 'validated' alone rarely is.

Explain it another way: intuitive

Verification asks whether you followed the recipe correctly. Validation asks whether the recipe makes the cake you wanted.

Explain it another way: technical

Verification: code-to-model agreement (convergence order, analytic benchmarks, unit tests). Validation: model-to-reality agreement on held-out data, with quantified error and a stated domain of validity.

Explain it another way: applied

Every integrator behind this term's diagrams is unit-tested against its closed-form solution: that is verification. None of them has been validated against a real motor or lift, which is why they are called educational models.

Try these examples

Example 1

Euler's method on dy/dt = −y/2 from y(0) = 1 gives y(2) = 0.3487 with dt = 0.2 and 0.3660 with dt = 0.02. The exact value is e^(−1) = 0.3679. What does this tell you?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. You compare your cooling model with a thermometer log from a second cup. Which activity is that?

  • Verification
  • Validation
  • Calibration of the thermometer
  • Debugging

2. Why validate on data you did not fit to?

  • It is quicker
  • A model can match the data it was tuned on without capturing the physics; held-out data tests whether it generalises
  • Fitted data is always wrong
  • It is a legal requirement

3. Halving the simulation time step changes your answer by 15 %. What should you conclude?

  • The model is invalid
  • The simulation has not converged: reduce the step further before trusting it
  • The physics is chaotic
  • Nothing: 15 % is fine

4. Euler's error for a problem is 0.020 at dt = 0.1 s. Euler's error is proportional to dt. What error do you expect at dt = 0.025 s?

Answer:

5. You simulate τ·dy/dt + y = 0 with explicit Euler, τ = 1.5 s. Above what time step dt (in seconds) does the simulation become unstable?

Answer: s

Apply it

Write a half-page verification and validation plan for a model of your choice (cooling drink, falling paper cone, charging phone). List two verification checks, one validation dataset you could collect, and the error you would accept.

Reflect

Which is harder to do well for a student project, verification or validation? Why?

Week 11: System states

This week you will

How many numbers does a system remember?

A photo shows a swing at the bottom of its arc. Can you say where it will be one second later?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Choosing the state is the first design decision in any simulation or controller. Too few states and your model cannot predict; too many and it becomes slow and hard to tune. A simple rule works surprisingly often: one state per independent place energy is stored.

Goals

Predict

A mass bounces on a spring. What is the minimum you need to know right now to predict its whole future motion (with no new forces)?

  1. Its position only
  2. Its position and velocity
  3. Its position, velocity and acceleration
  4. Its whole past history

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Start the mass at x₀ = 1 m with v₀ = 0, then at x₀ = 0 with v₀ = 2 m/s. Both pass through x = 0 at some point, but their paths in the phase plane never cross. Why can two trajectories never cross in the phase plane?

What the interactive shows, in words

The phase plane plots velocity against position. With damping, a trajectory starting at position 1 and zero velocity spirals inwards to the origin; one starting at the origin with velocity 2 traces a different spiral. The paths never cross. With no damping, paths are closed ellipses.

Understand

The state is the system's memory

If you know the state now and the inputs from now on, you can predict everything. Nothing else from the past matters. For a hot cup, temperature is enough. For a swing, you need angle and angular velocity: the photo at the bottom doesn't tell you which way it is moving or how fast.

Count the energy stores

Each independent place energy is stored usually gives one state: a capacitor's voltage, an inductor's current, a mass's velocity, a spring's stretch, a body's temperature, a tank's level. A mass on a spring has two stores, so two states, position and velocity.

The phase plane

Plot one state against the other and the system's history becomes a path. Each point has exactly one direction of travel (the arrows), so paths cannot cross: if they did, the same state would have two futures. Spirals mean oscillation dying away; closed loops mean oscillation that never dies.

Explain it another way: intuitive

The state is the save file of a video game: load it and the game continues exactly as before. If the save file were missing your speed, you'd restart standing still.

Explain it another way: technical

A state vector x(t) ∈ ℝⁿ is minimal if no component can be computed from the others. For linear systems n equals the number of independent energy storage elements, which is also the order of the differential equation.

Explain it another way: mathematical

m·ẍ + c·ẋ + k·x = F is second order, so it needs two initial conditions, x(0) and ẋ(0). With x₁ = x, x₂ = ẋ: ẋ₁ = x₂ and ẋ₂ = (F − c·x₂ − k·x₁)/m.

Explain it another way: applied

A balancing robot's controller uses four states: wheel position, wheel speed, tilt angle and tilt rate. Drop the tilt rate and it cannot tell whether it is falling or recovering.

Try these examples

Example 1

How many states does a circuit with one resistor, one capacitor and one inductor in series need?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A car moving along a straight road, driven by an engine force against drag. You care about position and speed. How many states?

  • 1
  • 2
  • 3
  • 4

2. Which variable is the natural state for a resistor–capacitor circuit?

  • Current through the resistor
  • Voltage across the capacitor
  • Supply voltage
  • Resistance

3. Why can't two trajectories cross in a phase plane of a time-invariant system?

  • They can, if the input changes
  • At a crossing point the same state would have two different futures, which contradicts the state determining the future
  • Because energy is conserved
  • Because the plot would be confusing

4. In the phase plane, a trajectory spirals into the origin. What is the mass doing?

  • Moving steadily in one direction
  • Oscillating with decreasing amplitude
  • Oscillating forever
  • Speeding up

5. A mass–spring–damper has m = 12 kg and k = 200 N/m. What is its natural frequency ωn in rad/s?

Answer: rad/s

Apply it

Choose states for (a) a water tower filling and draining, (b) a pendulum, (c) a heated room with thick walls. Justify each by naming the energy or material store. For (c), discuss whether the walls need their own state.

Reflect

What would go wrong if a robot's controller forgot one of its states?

From one second-order equation to two first-order ones

Computers can only take small steps forward. How do you step forward an equation that talks about acceleration?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every serious simulation tool, flight controller and robotics library works with first-order state equations. Learning this one rewrite lets you simulate almost anything with the same few lines of code.

Goals

Predict

For m = 1, c = 0, k = 4, what will the phase-plane path look like?

  1. A spiral into the origin
  2. A closed ellipse
  3. A straight line to the origin
  4. A spiral outwards

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set c = 0 and k = 4 and check the eigenvalues read 0 ± 2j. Now raise c slowly. Find the value of c where the eigenvalues stop having an imaginary part, and check it against c = 2√(km).

What the interactive shows, in words

With damping c = 0 and stiffness 4, the phase-plane path is a closed ellipse and the eigenvalues are 0 ± 2j. As c increases the path becomes an inward spiral and the eigenvalues get a negative real part. At c = 4 (twice the square root of k times m) the imaginary part vanishes and the path slides into the origin without circling.

Understand

Any order, first-order steps

An nth-order equation needs n initial conditions, so it has n states. Define x₁ = y, x₂ = ẏ, …, xₙ = y⁽ⁿ⁻¹⁾. Each state's derivative is the next state, except the last, which comes from the original equation.

The A and B matrices

For linear systems the right-hand sides are weighted sums, so they fit in matrices: dx/dt = A·x + B·u. A says how the states push on each other; B says how the input pushes on each state. The same code steps any system once you supply A and B.

Eigenvalues preview

Each eigenvalue λ of A gives a mode that behaves like e^(λt). Negative real part: decays. Positive: grows. Imaginary part: oscillates. You will use this in week 15; for now, notice that the phase-plane readout's eigenvalues change exactly when the picture changes shape.

Explain it another way: intuitive

A second-order equation is like a staircase you can't step up in one go. Introducing velocity as a state adds a landing halfway, so each step is a small first-order one.

Explain it another way: technical

Companion form maps y⁽ⁿ⁾ + aₙ₋₁y⁽ⁿ⁻¹⁾ + … + a₀y = b·u to dx/dt = A·x + B·u with A in companion form. The characteristic polynomial of A equals that of the ODE.

Explain it another way: mathematical

For A = [[0,1],[−k/m,−c/m]]: trace = −c/m, determinant = k/m, so λ = (−c/m ± √((c/m)² − 4k/m))/2. Real eigenvalues exactly when c² ≥ 4km, that is c ≥ 2√(km).

Explain it another way: applied

Robotics libraries describe a drone, an arm or a car as A and B (after linearising), then reuse the same simulation, estimation and control code.

Derivation: Mass–spring–damper in state-space form
  1. Start from Newton's second law for a mass on a spring with a damper: m·ẍ = F − c·ẋ − k·x.

  2. Choose states x₁ = x (position) and x₂ = ẋ (velocity). Then ẋ₁ = x₂ by definition.

  3. Divide Newton's law by m: ẋ₂ = ẍ = −(k/m)·x₁ − (c/m)·x₂ + F/m.

  4. Stack them: d/dt [x₁; x₂] = [[0, 1], [−k/m, −c/m]]·[x₁; x₂] + [0; 1/m]·F. That is dx/dt = A·x + B·u with u = F.

  5. The eigenvalues of A solve λ² + (c/m)·λ + k/m = 0, the same characteristic equation as the original ODE: λ = −ζωn ± ωn√(ζ² − 1).

Try these examples

Example 1

Write L·di/dt + R·i + q/C = V(t) with q the capacitor charge (i = dq/dt) in state-space form.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. In A = [[0, 1], [−k/m, −c/m]], what does the entry −c/m in the bottom-right mean?

  • How position affects velocity's rate
  • How velocity affects its own rate of change: damping
  • The input gain
  • The spring stiffness

2. For m = 2 kg and k = 50 N/m, at what damping c (N·s/m) do the eigenvalues become real (critical damping)?

Answer: N·s/m

3. How many states does d³y/dt³ + 2ÿ + 3ẏ + y = u need?

  • 1
  • 2
  • 3
  • 4

4. In the mass–spring–damper, why is B = [0; 1/m]?

  • The force changes position directly
  • The force changes acceleration, so it enters the velocity equation only, scaled by 1/m
  • Because m = 1
  • B is always [0; 1]

5. A mass–spring–damper has m = 10 kg, c = 12.6 N·s/m and k = 400 N/m. What is its damping ratio ζ? (No unit.)

Answer:

Apply it

Write the state-space form of a DC motor with states speed ω and current i: J·dω/dt = kₜ·i − b·ω and L·di/dt = V − R·i − kₑ·ω. Identify A and B and say which entry couples the electrical and mechanical parts.

Reflect

Why do you think almost every simulation library asks for first-order equations rather than higher-order ones?

Updating every state, one step at a time

Your spring simulation gains energy every swing until it explodes. The physics is right. What went wrong?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Simulation errors can look exactly like physics: oscillations, overshoot, instability. If you can't tell a numerical artefact from real behaviour, you can't trust any controller you tune in simulation.

Goals

Predict

Euler's method on τ·dy/dt = −y with τ = 1 s and dt = 1.5 s. What do the samples do?

  1. Decay smoothly
  2. Flip sign each step but shrink
  3. Grow without limit
  4. Stay constant

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Slide dt from 0.1 s up to 2.6 s. Find the step where the samples start alternating sign, and the step where they start growing. Write both as multiples of τ.

What the interactive shows, in words

The Euler stepper plots the exact decay e^(−t) as a smooth curve and Euler's samples as dots. With dt below 1 s the dots follow the curve. Between 1 and 2 s they alternate above and below zero while shrinking. Above 2 s they alternate and grow without limit.

Understand

One step, all states

For dx/dt = f(x, u), each Euler step computes all rates from the current state, then updates all states together: x_new = x + dt·f(x, u). In code, compute the rates into new variables first; don't overwrite position and then use the new position to update velocity unless you mean to use a different method.

Euler's stability limit

For τ·dy/dt = −y, one Euler step is y_new = (1 − dt/τ)·y. If dt < τ the factor is between 0 and 1: smooth decay. If τ < dt < 2τ it is negative: decaying but ringing. If dt > 2τ its size is above 1: the simulation blows up, though the real system is perfectly stable.

The fastest mode sets the step

In a system with several time constants, the smallest one sets the stability limit. Closing a feedback loop makes the system faster (smaller τ), so a step that was fine open-loop can fail closed-loop. Rule of thumb: dt ≤ τ_min/10 for accuracy, never above 2τ_min.

Explain it another way: intuitive

Euler takes the slope at the start of a step and walks in a straight line. If the step is long compared with how quickly things change, you walk right past the target, and even further back the next time.

Explain it another way: technical

For linear dx/dt = A·x, explicit Euler gives x_{n+1} = (I + dt·A)·x_n. It is stable iff every eigenvalue λ of A satisfies |1 + dt·λ| < 1. For λ = −1/τ that is dt < 2τ. For an undamped oscillator (λ = ±jω), |1 + jω·dt| > 1 always, so Euler always gains energy.

Explain it another way: mathematical

y_n = (1 − dt/τ)ⁿ·y₀. Exact: y(n·dt) = e^(−n·dt/τ)·y₀. For small dt, 1 − dt/τ ≈ e^(−dt/τ), so the two agree; the gap grows like dt.

Explain it another way: applied

Game physics engines often use semi-implicit (symplectic) Euler for springs precisely because explicit Euler slowly pumps energy into oscillators. Control engineers simulate with RK4 or smaller steps and check convergence.

Try these examples

Example 1

A motor model has an electrical time constant of 2 ms and a mechanical one of 200 ms. What Euler step would you choose?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which update correctly applies explicit Euler to x' = v, v' = −k·x/m?

  • x = x + dt·v; then v = v − dt·k·x/m using the new x
  • ax = v; av = −k·x/m; then x = x + dt·ax; v = v + dt·av
  • v = v − dt·k·x/m; then x = x + dt·v using the new v
  • Update x only; v follows automatically

2. Euler on τ·dy/dt = −y with τ = 0.4 s and dt = 0.6 s. By what factor is y multiplied each step?

Answer:

3. Your open-loop simulation was stable with dt = 50 ms. You add a strong P controller and it explodes. Most likely cause?

  • The controller is unstable in reality
  • The closed loop is faster (smaller τ), so dt now exceeds the numerical stability limit
  • Floating-point overflow
  • The plant changed

4. Explicit Euler on an undamped spring (no friction) for many periods. What happens to the amplitude?

  • Stays exactly constant
  • Slowly grows
  • Slowly shrinks
  • Drops to zero at once

5. You simulate τ·dy/dt + y = 0 with explicit Euler, τ = 1.5 s. Above what time step dt (in seconds) does the simulation become unstable?

Answer: s

6. A first-order system has time constant τ = 25 s. How long after a step does it take to get within band = 5 % of its final value?

Answer: s

Apply it

Write a 10-line Python loop that simulates m·ẍ + c·ẋ + k·x = 0 with explicit Euler. Run it with c = 0 and three step sizes and plot the energy ½kx² + ½mv² against time. Then switch to RK4 or semi-implicit Euler and compare.

Reflect

How would you convince a teammate that an oscillation in your simulation is real and not numerical?

Week 12: First-order models

This week you will

The time constant: 63 % and counting

Why do engineers quote 63 % rather than half when they say how fast something heats up?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

First-order models describe a huge range of systems well enough to design with: heaters, motors, tanks, RC filters, sensors. Two numbers, K and τ, tell you where it will end up and how long it will take. Engineers use them every day.

Goals

Predict

A first-order system takes 2 s to reach 63 % of its final value. Roughly when is it within 2 % of the final value?

  1. About 4 s
  2. About 8 s
  3. About 20 s
  4. Never

Write down your guess and your reason. The reveal is in the online lesson.

Discover

In Explore mode, set K = 2, τ = 1.5 s, u = 1. Check the curve crosses the 63 % line at τ. Then double τ, then double K: describe in one sentence each what changes and what doesn't.

What the interactive shows, in words

The step responder draws a curve rising from zero towards K times u. A dashed line at 63 % of the final value meets the curve at t = τ, and a second marker at 4τ shows it within 2 % of the final value. Doubling τ stretches the curve horizontally; doubling K stretches it vertically.

Understand

Two numbers describe it all

In τ·dy/dt + y = K·u, the static gain K is how much the output changes per unit of input once everything settles. The time constant τ (seconds) is how quickly it gets there. Change K and the curve stretches up; change τ and it stretches sideways; the shape never changes.

Landmarks to sketch with

After 1τ: 63 % of the change. 2τ: 86 %. 3τ: 95 %. 4τ: 98 %. 5τ: 99.3 %. The slope at the start is (y∞ − y₀)/τ: if it kept that rate, it would arrive in exactly one τ. Those numbers let you sketch any first-order response in seconds.

Time constants are physical

τ is a storage size divided by a flow rate. For an RC circuit τ = R·C. For a heated object τ = (thermal mass)/(heat-loss coefficient). Bigger storage or slower leakage means a longer τ. That is why a thick pot takes longer to boil than a thin one.

Explain it another way: intuitive

The system always closes a fixed fraction of the gap per unit time. Close to the target there's little gap, so it moves slowly. Like a nervous parker edging into a space.

Explain it another way: technical

First-order LTI: transfer function K/(τs + 1), single real pole at s = −1/τ. Step response y(t) = Ku(1 − e^(−t/τ)), initial slope Ku/τ, 2 % settling time τ·ln 50 ≈ 3.91τ.

Explain it another way: mathematical

y(t)/y∞ = 1 − e^(−t/τ). Set it to f and solve: t = −τ·ln(1 − f). For f = 0.5, t = 0.693τ (the half-life); for f = 0.632, t = τ; for f = 0.98, t = 3.91τ.

Explain it another way: applied

Electric kettle: K ≈ 80 °C rise for full power, τ of a few minutes. A temperature sensor in a metal sheath might have τ = 5 s: it will read 63 % of a sudden change after 5 s, which matters if you're controlling a fast process.

Derivation: Solving the first-order step response
  1. Model: τ·dy/dt + y = K·u, with a constant input u applied from t = 0 and y(0) = y₀.

  2. At equilibrium dy/dt = 0, so the final value is y∞ = K·u. Define the remaining error e = y − y∞.

  3. Since y∞ is constant, de/dt = dy/dt, and the model becomes τ·de/dt = −e.

  4. Separate variables: de/e = −dt/τ. Integrate: ln|e| = −t/τ + const, so e(t) = e(0)·e^(−t/τ).

  5. Therefore y(t) = y∞ + (y₀ − y∞)·e^(−t/τ). From rest (y₀ = 0): y(t) = K·u·(1 − e^(−t/τ)).

  6. At t = τ the remaining error is e^(−1) ≈ 0.368, so 63.2 % of the change is done. At 4τ only e^(−4) ≈ 1.8 % is left: the usual 2 % settling estimate (exactly 3.91τ).

Try these examples

Example 1

K = 3, step u = 2, τ = 4 s, starting at rest. Find y at t = 4 s and at t = 8 s.

The worked solution is in the online lesson.

Example 2

A probe starting at 20 °C is plunged into 80 °C water. τ = 5 s. What does it read after 10 s?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. K = 4, step u = 5 from rest, τ = 3 s. What is y at t = 3 s?

Answer:

2. A first-order system τ·dy/dt + y = K·u starts at rest (y = 0). Its parameters are K = 1.2 and τ = 0.8 s, and a step input u = 10 is applied at time zero. What is y at t = 0.4 s?

Answer:

3. A first-order system has time constant τ = 0.75 s. How long after a step does it take to get within band = 5 % of its final value?

Answer: s

4. You double K and keep τ. How does the time to reach 63 % of the final value change?

  • Halves
  • Doubles
  • Stays the same
  • Quadruples

5. If a first-order response kept its initial rate of rise, when would it reach the final value?

  • At t = τ/2
  • At t = τ
  • At t = 4τ
  • Never

6. An RC filter has R = 10 kΩ and C = 47 µF. What is its time constant, in seconds?

Answer: s

Apply it

Make a cup of tea and log its temperature every minute for 20 minutes (or use any published cooling data). Plot T − T_room on a log scale. Is it a straight line? Its slope gives −1/τ. Report τ and how well a single exponential fits.

Reflect

Why is 'within 2 %' a more useful engineering target than 'at the final value'?

Read the plant from its step response

You're handed a heater you've never seen. One five-minute test is enough to model it. Which test, and what do you read off?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Real plants don't come with τ printed on the side. A step test, apply a known input change and log the output, is the quickest way to get a model good enough to start tuning a controller. It is one of the most common tests in industry.

Goals

Predict

A step test levels off at 50 °C above start, and at t = 3 min it was 31.6 °C above start. What is τ?

  1. About 1.5 min
  2. About 3 min
  3. About 6 min
  4. Can't tell without more data

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Switch to Mystery plant mode. For each of the five plants, read the final value from the dots, compute 63 % of it, read off the time and enter your τ. Aim for within 12 %, then press New mystery plant.

What the interactive shows, in words

In mystery mode the diagram shows noisy measurement dots rising and levelling off. You read the level, take 63 % of it, and read across to the time where the dots cross that height: that time is τ. After checking, the true curve is drawn over the dots.

Understand

The step test

Hold the system steady, then change the input by a known Δu and log the output until it settles. K = Δy∞/Δu, the change in final output per unit input. τ is the time to cover 63 % of Δy∞. If the response has an initial delay before it starts moving, measure τ from when it starts.

Any point will do, some are better

From one reading y at time t: τ = −t / ln(1 − y/y∞). Readings near the start (small y/y∞) and near the end (y/y∞ close to 1) are sensitive to noise, because a small error in y makes a big change in the logarithm. Points between 30 % and 80 % give the most reliable τ.

Use all the data

Better still, fit the whole curve: plot ln(1 − y/y∞) against t. For a true first-order system it is a straight line with slope −1/τ. If it curves, the plant isn't first-order: a second store, a delay or a nonlinearity is showing.

Explain it another way: intuitive

Like timing how long a bath takes to fill to the overflow: watch it once, and you can predict it next time.

Explain it another way: technical

System identification from step data: K̂ = Δy∞/Δu; τ̂ from the 63.2 % crossing or by least-squares on ln(1 − y/ŷ∞) versus t. Errors in ŷ∞ bias τ̂, so log until clearly settled.

Explain it another way: mathematical

τ = −t/ln(1 − f) with f = y/y∞. Sensitivity: dτ/df = −t/((1 − f)·ln²(1 − f)), which is large as f → 0 or f → 1.

Explain it another way: applied

Process engineers 'bump test' a valve or heater on a real plant: a small, safe step, logged for a few time constants. The resulting K and τ (plus a dead time) feed standard PID tuning rules.

Try these examples

Example 1

A 10 % step in fan power changes a room's temperature by 1.8 °C once settled; it reached 1.0 °C after 12 minutes. Find K and τ.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A step test settles 40 units above where it started. It is 25.3 units above the start at t = 6 s. What is τ, in seconds?

Answer: s

2. A first-order system starts at 0 and settles towards a final value y∞ = 40. At t = 7.5 s the reading is y = 15.74. What is the time constant τ in seconds?

Answer: s

3. Raising a heater's power by 200 W raises its settled temperature by 30 °C. What is the static gain K in °C per watt?

Answer: °C/W

4. Which readings give the most noise-robust estimate of τ from a single point?

  • The first 5 % of the rise
  • Between about 30 % and 80 % of the rise
  • The last 2 % of the rise
  • Any point equally

5. You plot ln(1 − y/y∞) against t and it curves instead of being a straight line. What does that suggest?

  • You made an arithmetic mistake
  • The plant is not purely first-order (another store, a delay or a nonlinearity)
  • τ is negative
  • The test was perfect

Apply it

Use the Smart Greenhouse build: apply a heater step and log the air temperature. Estimate K and τ by the 63 % method and by the log-plot method, and compare them.

Reflect

What would you do differently if every step test cost an hour of a real factory's production?

A greenhouse is a first-order system

Open the greenhouse door on a cold morning and the air cools in minutes. Shut it and the heater takes far longer to win it back. Why the asymmetry?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Thermal systems are the classic first-order plant, and they are everywhere: homes, ovens, battery packs, data centres. Model one carefully and you have a template for all of them.

Goals

Predict

You double the greenhouse's insulation (halve G). What happens to the time constant τ = C/G?

  1. Halves
  2. Doubles
  3. Stays the same
  4. Falls to zero

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Smart Greenhouse at Level 2. Switch the heater on at a fixed power with no control and log the air temperature. Mark the 63 % point and estimate τ. Then predict, before running it, what happens when you halve the heater power.

What the interactive shows, in words

With the heater switched on at fixed power, the greenhouse air temperature rises steeply at first and then levels off at a few degrees above outside, following a first-order curve. Halving the heater power halves the final rise but leaves the time to reach 63 % unchanged.

Understand

An energy balance is a first-order model

One energy store (the air and contents), one way in (the heater), one way out (the walls): C·dT/dt = P − G·(T − T_out). Rearranged, it is exactly τ·dy/dt + y = K·u with y = T − T_out, τ = C/G and K = 1/G.

Why cooling can be faster than heating

Opening the door makes G much larger, so τ = C/G becomes much smaller and the air rushes towards T_out. Shut the door and G drops back; now the heater fights the slow τ. The model is the same equation with a different parameter, which is why the asymmetry isn't mysterious.

The model's honest limits

One lumped temperature assumes the air is well mixed. Real greenhouses have warm ceilings and cold floors, soil that stores heat with its own slow τ, and sunshine that varies. A first-order model is a good start for control design; it isn't a full thermal simulation.

Explain it another way: intuitive

The greenhouse is a leaky bucket of heat. The heater pours in; the walls leak out faster the hotter it is inside. Bigger bucket or smaller leak: slower to change.

Explain it another way: technical

Lumped-capacitance thermal model, valid when internal temperature differences are small compared with the wall drop. τ = C/G, steady-state rise ΔT = P/G.

Explain it another way: mathematical

With C = 600 kJ/K and G = 400 W/K: τ = 600,000/400 = 1,500 s = 25 min. A 2 kW heater gives ΔT∞ = 2,000/400 = 5 K.

Explain it another way: applied

Building engineers quote a U-value (W/m²K) for walls; multiply by area to get G. Thermal mass (C) is why stone houses stay cool through a hot afternoon.

Derivation: From an energy balance to τ and K
  1. Energy stored in the air and plants: C·T, with C the heat capacity (J/K). Its rate of change = heat in − heat out.

  2. Heat in: heater power P. Heat out through the walls: G·(T − T_out), with G the loss coefficient (W/K).

  3. So C·dT/dt = P − G·(T − T_out). Divide by G: (C/G)·dT/dt + (T − T_out) = P/G.

  4. Compare with τ·dy/dt + y = K·u, where y = T − T_out and u = P: τ = C/G and K = 1/G.

  5. Better insulation (smaller G) raises both τ and K: slower to respond, but each watt buys more temperature.

Try these examples

Example 1

A greenhouse settles 8 °C above outside with its heater on, and τ = 15 min. Starting at outside temperature, how far above outside is it after 30 min?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A greenhouse has heat capacity C = 900 kJ/K and loss coefficient G = 500 W/K. What is τ, in minutes?

Answer: min

2. Same greenhouse (G = 500 W/K) with a 3 kW heater. What steady temperature rise above outside does it reach, in °C?

Answer: °C

3. Opening the door multiplies G by 5. What happens to τ?

  • Multiplied by 5
  • Divided by 5
  • Unchanged
  • Divided by 25

4. A first-order system τ·dy/dt + y = K·u starts at rest (y = 0). Its parameters are K = 2 and τ = 12 s, and a step input u = 5 is applied at time zero. What is y at t = 36 s?

Answer:

5. When is a one-temperature (lumped) greenhouse model likely to fail?

  • When the air is well mixed by a fan
  • When strong sunshine heats the soil and the soil's own slow heat store matters
  • When the heater is small
  • Never

Apply it

In the Smart Greenhouse build, compare the step response with two different insulation or ventilation settings. Fit τ and K to both and check that the ratio of τ values matches the ratio you'd predict from τ = C/G.

Reflect

Your first-order model fits a greenhouse well for an hour but not overnight. What would you add?

Week 13: Second-order models

This week you will

Mass, spring, damper: ωn and ζ

A car suspension, a seismometer and a robot joint held by a stiff controller all obey the same equation. Which two numbers describe how each one moves?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Second-order behaviour (overshoot, ringing, settling) is what most people mean when they say a control loop 'feels' good or bad. Two numbers, ωn and ζ, summarise it completely. Learn them once and you can read any second-order system.

Goals

Predict

You double the mass of a mass–spring–damper and keep c and k. What happens to its natural frequency?

  1. Doubles
  2. Halves
  3. Falls by a factor of √2
  4. Unchanged

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set ζ = 0.3. Now change m and k widely and watch the overshoot column: what stays fixed and what changes? Then hold m and k and change ζ.

What the interactive shows, in words

The mass–spring–damper diagram has sliders for mass, stiffness and damping ratio and plots the step response with a table comparing formula predictions (natural frequency, overshoot, peak time, settling time) with the simulation. At ζ = 0.3 the overshoot stays at about 37 % whatever the mass and stiffness, while the peak time changes.

Understand

Three forces, one equation

The spring pulls back in proportion to stretch (k·x). The damper resists in proportion to speed (c·ẋ). Whatever is left accelerates the mass (m·ẍ). So m·ẍ + c·ẋ + k·x = F. Electrical RLC circuits, pendulums at small angles and many closed control loops share this form.

Natural frequency ωn

ωn = √(k/m) rad/s is how fast it would oscillate with no damping. Stiffer spring: faster. Heavier mass: slower. Divide by 2π for hertz. ωn sets the timescale: double it and every time in the response halves.

Damping ratio ζ

ζ = c/(2√(km)) compares the actual damping with the critical value c_crit = 2√(km). ζ < 1 is underdamped (overshoots and rings), ζ = 1 is critically damped (fastest with no overshoot), ζ > 1 is overdamped (sluggish). ζ sets the shape.

Explain it another way: intuitive

ωn is the tempo of the music; ζ is how quickly each note fades. A car on worn shocks has the same tempo but its notes ring on.

Explain it another way: technical

Transfer function ωn²/(s² + 2ζωn·s + ωn²). Poles at −ζωn ± jωn√(1 − ζ²) when ζ < 1. ζ is dimensionless; ωn in rad/s.

Explain it another way: mathematical

m = 2 kg, k = 200 N/m, c = 8 N·s/m: ωn = √100 = 10 rad/s; c_crit = 2√400 = 40; ζ = 8/40 = 0.2. Strongly underdamped.

Explain it another way: applied

Car suspensions are usually designed with ζ somewhere around 0.2–0.4 for comfort; sports cars go higher. Measuring instruments like galvanometers were damped near ζ = 0.7 to settle quickly without much overshoot.

Derivation: Standard form: where ωn and ζ come from
  1. Newton's law on the mass: m·ẍ + c·ẋ + k·x = F.

  2. Divide by m: ẍ + (c/m)·ẋ + (k/m)·x = F/m.

  3. Define ωn² = k/m and 2ζωn = c/m. Then ẍ + 2ζωn·ẋ + ωn²·x = ωn²·(F/k).

  4. Solving 2ζωn = c/m for ζ: ζ = c/(2m·ωn) = c/(2√(km)).

  5. The characteristic roots are s = −ζωn ± ωn√(ζ² − 1). Complex (oscillation) for ζ < 1, repeated for ζ = 1, real and distinct for ζ > 1.

Try these examples

Example 1

A 0.5 kg mass on a 50 N/m spring. What c gives critical damping?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. m = 2 kg, k = 200 N/m. What is ωn in rad/s?

Answer: rad/s

2. Same system with c = 8 N·s/m. What is ζ?

Answer:

3. A mass–spring–damper has m = 1 kg and k = 800 N/m. What is its natural frequency ωn in rad/s?

Answer: rad/s

4. A mass–spring–damper has m = 2 kg, c = 127 N·s/m and k = 900 N/m. What is its damping ratio ζ? (No unit.)

Answer:

5. You make the spring four times stiffer, keeping m and c. What happens?

  • ωn doubles and ζ halves
  • ωn quadruples, ζ unchanged
  • ωn halves and ζ doubles
  • Nothing changes

Apply it

Push down on a car's bonnet corner (with permission) and let go, or film a door closer or a desk lamp spring. Count the oscillations and estimate whether ζ is below 0.2, around 0.5, or above 1. Justify your estimate.

Reflect

Which matters more to a passenger in a lift, ωn or ζ? Why?

Under, critical, over

A door closer that slams, one that creeps for ten seconds, and one that shuts perfectly. Same spring. What's different?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Picking a damping ratio is one of the most common design choices in mechanical and control engineering. It trades speed against overshoot, and the right answer depends on what overshoot costs: a spilled coffee, a cracked part, or nothing at all.

Goals

Predict

Which reaches within 2 % of its final value first after a step?

  1. ζ = 0.1
  2. ζ = 0.7
  3. ζ = 3
  4. They all take the same time

Write down your guess and your reason. The reveal is in the online lesson.

Discover

In the feedback lab, choose the second-order plant with P control at a fixed gain. Try ζ = 0.1, 0.4, 0.7, 1 and 2, and record overshoot and settling time for each in a table. Which ζ gives the shortest settling?

What the interactive shows, in words

In the feedback lab with a second-order plant, a damping ratio of 0.1 gives a large overshoot and long ringing; 0.4 gives moderate overshoot; 0.7 gives a small overshoot and the quickest settling; 1 rises without overshoot; 2 rises slowly without overshoot.

Understand

Underdamped (ζ < 1)

The response overshoots, then oscillates with frequency ωd = ωn√(1 − ζ²) inside an exponentially shrinking envelope e^(−ζωn t). Small ζ: big overshoot, long ringing. It rises fastest, which is why lightly damped systems feel 'snappy'.

Critically damped (ζ = 1)

The response x(t) = 1 − (1 + ωn t)·e^(−ωn t) rises without any overshoot and is the fastest response that never crosses the final value. It is the boundary between oscillating and not.

Overdamped (ζ > 1)

Two real time constants. The slower one dominates, and it gets slower as ζ grows: for large ζ it is roughly 2ζ/ωn. No overshoot, but sluggish. A door closer that takes ten seconds is badly overdamped.

Choosing ζ

If overshoot is dangerous (a robot gripper closing on an egg, a lift levelling at a floor), choose ζ close to 1. If a little overshoot is fine and speed matters, ζ ≈ 0.5–0.7 is common: 0.7 gives about 4.6 % overshoot and close to the shortest 2 % settling time.

Explain it another way: intuitive

Underdamped is a kid on a trampoline, critically damped is a gymnast sticking the landing, overdamped is someone sinking into a beanbag.

Explain it another way: technical

Pole locations: ζ < 1 complex conjugate pair; ζ = 1 repeated real pole at −ωn; ζ > 1 two real poles −ωn(ζ ∓ √(ζ² − 1)), the one closer to zero dominating.

Explain it another way: mathematical

For ζ = 2, ωn = 1: poles at −2 ± √3 = −0.268 and −3.73. The slow mode e^(−0.268t) has τ ≈ 3.7 s, compared with τ = 1 s for ζ = 1. That is why heavy damping is slow.

Explain it another way: applied

Analogue meter needles, camera gimbals and robot joint controllers are commonly tuned somewhere near ζ = 0.7: fast, with small overshoot.

Try these examples

Example 1

A gripper must close on an egg and never overshoot the target position. Should you choose ζ = 0.5 or ζ = 1.1?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. m = 1 kg, k = 16 N/m, c = 8 N·s/m. Which regime?

  • Underdamped
  • Critically damped
  • Overdamped
  • Undamped

2. Which damping ratio gives the fastest step response that never overshoots?

  • ζ = 0.5
  • ζ = 1
  • ζ = 2
  • ζ = 0

3. A mass–spring–damper has m = 1 kg, c = 40 N·s/m and k = 400 N/m. What is its damping ratio ζ? (No unit.)

Answer:

4. An underdamped second-order system has damping ratio ζ = 0.37. What percent overshoot does its step response have?

Answer: %

5. Overshoot would crack the part being handled. The best design choice is…

  • ζ ≈ 0.2 for speed
  • ζ slightly above 1 for margin
  • ζ = 10 to be extra safe
  • ζ = 0

Apply it

Write a design note (half a page) for three products of your choice, choosing a target ζ for each and explaining what overshoot would cost and what slowness would cost.

Reflect

Why might an engineer deliberately aim for ζ = 1.1 rather than exactly 1?

Taming a shaking drum

A washing machine's drum weighs about as much as a child and sits on springs. Why doesn't the whole machine walk across the floor during the spin?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Real products use second-order models to make hard trade-offs: soft springs isolate the floor from the spin, but let the drum swing; stiff springs hold it still, but pass vibration to the house. Dampers buy a compromise.

Goals

Safety: Only experiment with real machines that are switched off and unplugged; use the simulated build for anything that spins.

Predict

A 40 kg drum sits on springs with total stiffness 16,000 N/m. Roughly what is its natural frequency?

  1. About 0.3 Hz
  2. About 3 Hz
  3. About 30 Hz
  4. About 300 Hz

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the washing machine build at Level 4. Run the spin up slowly and find the speed where the tub shakes most. Compare it with the natural frequency you predicted. Then change the damping and watch the peak.

What the interactive shows, in words

In the washing machine build, slowly increasing the spin speed makes the tub's shaking grow to a peak near the suspension's natural frequency (around 190 rpm for the stated parameters) and then fall at higher speeds. More damping lowers that peak.

Understand

The drum as a second-order system

Drum and wet clothes: mass m. Suspension springs: stiffness k. Friction dampers: c. The off-centre clothes act as a rotating force. Free response follows m·ẍ + c·ẋ + k·x = F(t); ωn and ζ tell you how it rings and where it resonates.

Passing through resonance

When the spin frequency matches ωn, each push arrives in step with the swing and the amplitude builds up. With little damping that build-up is dangerous. Designers keep ωn well below the spin speed and accelerate through resonance quickly.

The isolation trade-off

Above resonance, softer springs transmit less vibration to the floor: good. But a soft suspension has a low ωn and lets the drum swing further at start-up. Dampers limit that swing; too much damping, though, passes more force to the cabinet at high speed. Every washing machine is a negotiated ζ.

Explain it another way: intuitive

Pushing a swing in time with its motion makes it go higher and higher. A spinning lump of clothes does the same to the drum at one particular speed.

Explain it another way: technical

Forced response magnitude at frequency ω: |X/F| = 1/√((k − mω²)² + (cω)²). The peak near ω ≈ ωn is roughly F/(c·ωn) = 1/(2ζ) times the static deflection, so ζ sets the peak height.

Explain it another way: mathematical

m = 40 kg, k = 16,000 N/m, c = 480 N·s/m: ωn = 20 rad/s (3.18 Hz, 191 rpm), ζ = 480/(2√640,000) = 480/1,600 = 0.3. Peak amplification ≈ 1/(2ζ) ≈ 1.7× the static deflection.

Explain it another way: applied

Machines also detect imbalance with motor-current sensing and redistribute the load by tumbling slowly before attempting the spin. Control and mechanics share the job.

Try these examples

Example 1

With m = 40 kg and k = 16,000 N/m, what damper constant gives ζ = 0.3?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A drum of 40 kg on springs of total stiffness 16,000 N/m. What is ωn in rad/s?

Answer: rad/s

2. Convert ωn = 20 rad/s to revolutions per minute.

Answer: rpm

3. Same drum with dampers c = 480 N·s/m. What is ζ?

Answer:

4. A mass–spring–damper has m = 1 kg and k = 2000 N/m. What is its natural frequency ωn in rad/s?

Answer: rad/s

5. Why do washing machines accelerate quickly through about 190 rpm?

  • To save energy
  • It is near the suspension's natural frequency, where vibration builds up; less time there means less build-up
  • Because the motor is weakest there
  • To dry the clothes faster

Apply it

In the washing machine build, find one spring and damper setting that keeps the tub's shaking low both at start-up and at full spin. Record the settings, the measured peak, and the ζ you calculate for them.

Reflect

Where else have you felt a machine shake hardest at one particular speed?

Week 14: Transient response

This week you will

Reading a step response like an engineer

Two controllers both reach the set point. One is twice as good. Which four numbers would prove it?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

'It looks better' isn't evidence. Step-response metrics turn a curve into numbers you can write in a specification, compare across designs and check automatically. Every control datasheet speaks this language.

Goals

Predict

A response settles at 2.0 and peaks at 2.5. What is its percent overshoot?

  1. 5 %
  2. 20 %
  3. 25 %
  4. 50 %

Write down your guess and your reason. The reveal is in the online lesson.

Discover

In the feedback lab, pick a second-order plant with PI control. Read rise time (10–90 %), overshoot, peak time and 2 % settling time off the plot by hand. Then compare with the lab's own readout and explain any differences.

What the interactive shows, in words

A second-order PI-controlled response rises past the set point, peaks, oscillates a little and settles. Rise time is measured between the 10 % and 90 % crossings, overshoot as the peak's excess over the final value, and settling time as the moment after which it stays within 2 % of the final value.

Understand

The five numbers

Rise time: from 10 % to 90 % of the final value. Peak time tp: when the first maximum occurs. Percent overshoot: (peak − final)/final × 100. Settling time ts: after this, the response stays within ±2 % (sometimes 5 %) of final. Steady-state error: set point minus final value.

Conventions are part of the number

'Settling time 3 s' means nothing without the band: 2 % and 5 % can differ by a factor of 1.3. Rise time may be 0–100 % or 10–90 %. Good reports state the convention once, then use it everywhere.

Metrics pull against each other

Faster rise usually means more overshoot. Less overshoot often means slower settling. Removing steady-state error with integral action can add overshoot. A specification lists limits on several metrics at once, so a design is judged on the whole set.

Explain it another way: intuitive

Rise time: how quickly you get there. Overshoot: how far past you go. Settling: how long until you stop wobbling. Steady-state error: whether you ever really arrive.

Explain it another way: technical

For a standard underdamped second-order system: tp = π/ωd, %OS = 100·exp(−ζπ/√(1 − ζ²)), ts(2 %) ≈ 4/(ζωn), rise time (10–90 %) ≈ (1 − 0.4167ζ + 2.917ζ²)/ωn (an empirical fit).

Explain it another way: applied

In the Elevator build, overshoot is literally millimetres past the floor and settling time is how long until the doors can open. Comfort limits add two more metrics: acceleration and jerk.

Try these examples

Example 1

A log shows: final value 1.00, first peak 1.12 at t = 0.8 s, inside 0.98–1.02 for good from t = 2.4 s, crossing 0.1 at 0.15 s and 0.9 at 0.45 s. Give the metrics.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A step response settles at 4.0 and peaks at 4.6. What is the percent overshoot?

Answer: %

2. A response with final value 10 passes 1.0 at t = 0.3 s and 9.0 at t = 1.1 s. What is the 10–90 % rise time, in seconds?

Answer: s

3. Design A settles in 2.1 s (5 % band). Design B settles in 2.6 s (2 % band). Which is faster?

  • A
  • B
  • You can't tell without using the same band
  • They are equal

4. A second-order system has ωn = 5 rad/s and ζ = 0.6. Estimate its 2 % settling time ts with the rule of thumb ts ≈ 4/(ζ·ωn).

Answer: s

5. A response settles at 0.95 when the set point is 1.0. What does that tell you?

  • It has 5 % overshoot
  • It has a steady-state error of 0.05
  • It hasn't settled yet
  • Its rise time is 0.95 s

Apply it

Write a one-paragraph specification for a robot joint's step response using at least four metrics with numbers and conventions. Then test one configuration in the feedback lab and report pass or fail for each line.

Reflect

Which metric would a passenger in a lift care about most, and which would the building manager care about?

From overshoot to ζ and back

A spec says 'no more than 5 % overshoot'. What damping ratio does that demand, before you touch a single gain?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Specifications are written in metrics (overshoot, settling time); designs are made in parameters (ζ, ωn, gains). These formulas translate between the two, so you can design on paper first and simulate to confirm.

Goals

Predict

Halving ζ from 0.6 to 0.3: what happens to the overshoot?

  1. It roughly doubles
  2. It goes from about 9 % to about 37 %
  3. It halves
  4. No change

Write down your guess and your reason. The reveal is in the online lesson.

Discover

For ζ = 0.2, 0.43, 0.6 and 0.8, compare the formula and simulation columns for overshoot and peak time. Then find the ζ that gives 5 % overshoot by sliding, and check it against the derivation.

What the interactive shows, in words

The mass–spring–damper table lists formula and simulation values side by side. At ζ = 0.43 both show about 22 % overshoot; at ζ = 0.69 both show about 5 %. Peak times agree to within a few milliseconds.

Understand

Overshoot depends only on ζ

%OS = 100·exp(−ζπ/√(1 − ζ²)). Landmarks: ζ = 0.2 → 53 %, 0.4 → 25 %, 0.5 → 16 %, 0.6 → 9.5 %, 0.7 → 4.6 %, 0.8 → 1.5 %. Memorise ζ = 0.5 → 16 % and ζ = 0.7 → 5 % and you can sanity-check most designs.

Timing depends on ωn too

Peak time tp = π/(ωn√(1 − ζ²)). The 2 % settling estimate ts ≈ 4/(ζωn) comes from the envelope e^(−ζωn t) dropping to e^(−4) ≈ 1.8 %. It is rough: good to roughly 10–20 % for light damping, poor near ζ = 1 and meaningless above it.

Spec to parameters

A spec 'OS ≤ 10 %, ts ≤ 2 s' becomes: ζ ≥ 0.59 (from the inverse formula) and ζωn ≥ 2 s⁻¹. Pick ζ = 0.6, then ωn ≥ 3.3 rad/s. Now you know what the closed loop must look like before you choose gains.

Explain it another way: intuitive

ζ is a knob labelled 'how much it overshoots'. ωn is a separate knob labelled 'how quickly everything happens'. A spec tells you where each knob must sit.

Explain it another way: technical

The formulas are exact for the standard form ωn²/(s² + 2ζωn s + ωn²). Real loops with zeros, extra poles, delay or saturation deviate; treat the formulas as design starting points and verify in simulation.

Explain it another way: mathematical

ζ = 0.456 for 20 % overshoot: ln 0.2 = −1.609, √(π² + 2.590) = 3.530, ζ = 1.609/3.530 = 0.456.

Explain it another way: applied

Lift levelling: overshooting the floor by even 5 mm is a trip hazard, so the design aims for ζ near or above 0.8 in the levelling phase and accepts a slightly slower approach.

Derivation: Using the overshoot formula in both directions
  1. For an underdamped second-order step response, the first peak is at tp = π/ωd with ωd = ωn√(1 − ζ²).

  2. Substituting tp into x(t) = 1 − e^(−ζωn t)·(cos ωd t + (ζωn/ωd)·sin ωd t): cos(π) = −1 and sin(π) = 0, so x(tp) = 1 + e^(−ζωn·π/ωd).

  3. So the fractional overshoot is OS = exp(−ζπ/√(1 − ζ²)). It depends only on ζ.

  4. To invert, take logs: ln OS = −ζπ/√(1 − ζ²). Square and rearrange: ζ = −ln OS / √(π² + (ln OS)²).

  5. Example: OS = 0.05 gives ln OS = −3.00 and ζ = 3.00/√(9.87 + 8.97) = 0.69. A '≤ 5 %' spec needs ζ ≥ 0.69.

Try these examples

Example 1

A spec requires OS ≤ 20 % and peak time ≤ 0.5 s. Find the minimum ζ and the minimum ωn.

The worked solution is in the online lesson.

Example 2

ζ = 0.5 and ωn = 4 rad/s. Predict overshoot, peak time and 2 % settling.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. What is the percent overshoot for ζ = 0.5?

Answer: %

2. An underdamped second-order system has damping ratio ζ = 0.18. What percent overshoot does its step response have?

Answer: %

3. A step response peaks os = 8 % above its final value. Assuming a standard second-order system, what is its damping ratio ζ?

Answer:

4. A second-order system has ωn = 5 rad/s and ζ = 0.6. Estimate its 2 % settling time ts with the rule of thumb ts ≈ 4/(ζ·ωn).

Answer: s

5. What minimum damping ratio keeps overshoot at or below 5 %? Give ζ to two decimal places.

Answer:

6. When is ts ≈ 4/(ζωn) a poor estimate?

  • When ζ = 0.2
  • When ζ is close to or above 1
  • When ωn is large
  • Never

Apply it

Turn this spec into ζ and ωn limits: 'overshoot ≤ 8 %, 2 % settling ≤ 1.5 s, peak time ≤ 0.6 s'. Pick one (ζ, ωn) pair that meets all three and confirm it in the mass–spring–damper diagram.

Reflect

Why is it useful to know the required ζ before you start adjusting controller gains?

Stop on the floor: specs in practice

A lift must stop within 5 mm of the floor, never sail past by more than 5 mm, and open its doors within 20 s. Which of those is a transient spec?

About 45 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Specifications are contracts. A lift that is fast but bounces past the floor fails, however impressive its speed. This lesson puts transient metrics to work on a realistic system with several competing limits.

Goals

Predict

The lift's levelling must not overshoot by more than 5 mm on a 3 m trip. If the final approach behaves like a second-order system, roughly what damping ratio would you aim for?

  1. About 0.2
  2. About 0.4
  3. 0.8 or more
  4. Exactly 0

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Elevator at Level 3. Before changing anything, write the five checks as metric + limit. Replay the default trip and note which checks fail. Then change one setting at a time, predicting each time which metric should move.

What the interactive shows, in words

At default settings the simulated lift overshoots floor 7, oscillates around it and never opens its doors. Increasing damping and adding integral action makes the cabin approach the floor without passing it and settle within 5 mm, after which the doors open.

Understand

Specs become metrics

'Stop within 5 mm' is a steady-state error limit. 'Never sail more than 5 mm past' is an overshoot limit in millimetres. 'Doors open within 20 s' is a settling-time limit. 'Acceleration under 1.2 m/s²' and 'jerk under 1.5 m/s³' limit how hard the actuator may push.

Predict, then test

Before tuning, use a model: high derivative action raises ζ (less overshoot), integral action removes steady-state error (but can add overshoot), and comfort limits cap how fast you can go. Write the prediction down; then the test tells you whether your understanding is right, not just whether you got lucky.

Every line, every time

A design passes only if every check passes in the same run. Report all five numbers, not just the one you improved. If two lines can't both be met, that's a finding worth writing up, not hiding.

Explain it another way: intuitive

A spec is a checklist on the wall. You don't get to tick only the boxes you like.

Explain it another way: technical

Lift levelling combines feedforward (an S-curve motion profile limiting acceleration and jerk) with feedback (PID on position). Transient specs apply mostly to the feedback's final approach.

Explain it another way: applied

Real lift standards bound levelling accuracy and comfort; manufacturers add load weighing so the motor holds the cabin before the brake lifts, which prevents a lurch at the start.

Try these examples

Example 1

Your design levels within 2 mm, overshoots 7 mm, opens doors at 14 s and keeps acceleration and jerk in limits. What do you change first, and what do you expect to get worse?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. 'The doors must open within 20 s of the call' is a limit on which metric?

  • Overshoot
  • Settling time (until the cabin is level and still)
  • Steady-state error
  • Rise time

2. A levelling loop behaves like a standard second-order system. Its approach is 100 mm and overshoot must be at most 5 mm. What is the minimum ζ? (Two decimal places.)

Answer:

3. A step response peaks os = 8 % above its final value. Assuming a standard second-order system, what is its damping ratio ζ?

Answer:

4. Why change one setting at a time when tuning against a spec?

  • It's faster
  • So each change in the metrics can be attributed to one cause
  • The simulator only allows one
  • Because specs say so

5. Your new design improves overshoot from 7 mm to 2 mm but doors now open at 22 s. How do you report it?

  • 'Overshoot fixed'
  • A table of all five checks for both designs, with the doors-open failure flagged
  • Only report overshoot because that's what you worked on
  • Round 22 s down to 20 s

Apply it

Pass all five Level 3 checks in the Elevator. In your submission, list your predictions for each change you made and whether they came true.

Reflect

Which of your predictions was wrong, and what did it teach you about the model?

Week 15: Stability

This week you will

Stable means bounded

A pencil balanced on its tip and a pencil lying flat both sit still. Only one of them is stable. What test tells them apart?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

An unstable controller is not just a bad one: it can drive an actuator to its limits, break a gearbox or tip a robot over. Stability is the first thing any control design must guarantee, before speed or accuracy.

Goals

Predict

A system's response contains a term e^(0.2t)·cos(3t). Over a long time it…

  1. Settles to zero
  2. Oscillates with growing amplitude
  3. Oscillates with constant amplitude
  4. Rises steadily without oscillating

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Move σ from −3 to +1 with ω = 3. Note the σ where the response stops dying away. Then set ω = 0 and repeat. Describe in one sentence what σ controls and what ω controls.

What the interactive shows, in words

The pole locator shows an s-plane with the right half shaded as unstable and a plot of e^(σt)·cos(ωt). With σ negative the oscillation dies away; at σ = 0 it keeps a constant size; with σ positive it grows. Raising ω makes the oscillation faster without changing whether it grows.

Understand

BIBO stability

A system is BIBO stable if every bounded input produces a bounded output. For linear systems this is the same as every natural mode decaying. A response that grows without limit after a small push, however slowly, is unstable.

Poles tell you

Each pole p of a linear system contributes e^(pt) to the response. Write p = σ + jω. If σ < 0 the mode decays, if σ > 0 it grows, and ω ≠ 0 makes it oscillate. So the test is simple: every pole in the left half-plane means stable.

Marginal cases

A pole exactly on the imaginary axis (σ = 0) neither grows nor decays: an undamped spring oscillates forever; a pure integrator holds its value. These are marginally stable: a bounded input at the right frequency can still make the output grow, so engineers treat them as not good enough.

Explain it another way: intuitive

Stable is a ball in a bowl: push it and it rolls back. Unstable is a ball on a dome: the tiniest push and it's gone.

Explain it another way: technical

For an LTI system with transfer function G(s), BIBO stability holds iff all poles have Re(p) < 0. In state space, iff all eigenvalues of A have negative real part.

Explain it another way: mathematical

Mass–spring–damper poles: −ζωn ± jωn√(1 − ζ²). Real part −ζωn < 0 whenever c > 0 and k > 0. A negative damper (c < 0), as in some flutter problems, moves them right: unstable.

Explain it another way: applied

A self-balancing robot's open-loop model has a pole with σ > 0: it falls over on its own. The controller's whole job is to move that pole into the left half-plane.

Try these examples

Example 1

Poles at −2, −0.5 ± 4j. Stable? Which mode lasts longest?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which set of poles gives a stable system?

  • −1, +0.5
  • −2 ± 3j
  • 0 ± 2j
  • +1 ± j

2. Poles at −10 and −0.2. Which dominates the long-term response?

  • −10, because it is bigger
  • −0.2, because it decays more slowly
  • Both equally
  • Neither

3. A pole at σ = −0.35 s⁻¹. How long does its envelope take to halve, in seconds?

Answer: s

4. An undamped mass on a spring is pushed at exactly its natural frequency. What happens?

  • It settles
  • The amplitude grows steadily: a bounded input gave an unbounded output
  • Nothing
  • It stops

5. A second-order system has ωn = 20 rad/s and ζ = 0.3. At what time tp does its step response reach its first peak?

Answer: s

Apply it

Find three real systems that are stable, marginally stable and unstable on their own, and for the unstable one describe what feedback keeps it upright or safe.

Reflect

Why do engineers insist on stability before they look at any other metric?

Eigenvalues: stability from the A matrix

You have the A matrix of a robot joint but no time to simulate it. Can two numbers tell you whether it will settle?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Eigenvalues are how engineers check stability of systems with many states, from aircraft to power grids. The 2×2 case gives you the full intuition with a pencil and paper.

Goals

Predict

A = [[0, 1], [−5, −2]]. Stable?

  1. Yes, and it oscillates
  2. Yes, without oscillating
  3. No, it grows
  4. Marginal

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Use the eigenvalue readout. Set k = 5 and c = 2 and confirm −1 ± 2j. Then find settings that give two different negative real eigenvalues, and settings that give a pure imaginary pair. Sketch the phase-plane shape for each.

What the interactive shows, in words

The phase-plane sketcher shows the eigenvalues of the mass–spring–damper. With k = 5 and c = 2 they read −1 ± 2j and the path spirals inwards. With heavy damping both are negative real numbers and the path slides in without circling. With c = 0 they are purely imaginary and the path is a closed loop.

Understand

Eigenvalues of a 2×2

For A = [[a, b], [c, d]] the eigenvalues solve λ² − (trace)·λ + det = 0, with trace = a + d and det = ad − bc. So λ = trace/2 ± √(trace²/4 − det). Complex when det > trace²/4.

Reading the result

Real part negative: that mode decays like e^(Re λ·t). Positive: grows. Imaginary part ω: oscillation at ω rad/s. For a 2×2 system, both real parts are negative exactly when trace < 0 and det > 0: a two-second stability check.

Linking back to ζ and ωn

For a mass–spring–damper, det = k/m = ωn² and trace = −c/m = −2ζωn. So the eigenvalues are −ζωn ± ωn√(ζ² − 1): the same poles as before. State-space and second-order thinking are one idea seen two ways.

Explain it another way: intuitive

Eigenvalues are the system's natural 'speeds': each says how fast one pattern of motion grows or shrinks.

Explain it another way: technical

x(t) = Σ cᵢ·vᵢ·e^(λᵢt) for distinct eigenvalues λᵢ with eigenvectors vᵢ. Stability iff Re(λᵢ) < 0 for all i. The 2×2 trace–determinant plane maps every behaviour: spirals, nodes, saddles, centres.

Explain it another way: mathematical

A = [[−1, 2], [0, −3]]: triangular, eigenvalues on the diagonal, −1 and −3. Stable node. A = [[1, 0], [0, −2]]: eigenvalues 1 and −2, a saddle: unstable, because one mode grows.

Explain it another way: applied

Closing a control loop changes A to A − B·K. Choosing the gain matrix K to put the eigenvalues where you want them is called pole placement.

Try these examples

Example 1

m = 1, c = 2, k = 5. Find the eigenvalues, ζ and ωn.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A has trace −3 and determinant 2. Stable?

  • Yes
  • No
  • Marginal
  • Can't tell

2. A = [[0, 1], [−4, −5]]. What is the slower (closer to zero) eigenvalue?

Answer:

3. A = [[0, 1], [−10, −2]]. What is the size of the imaginary part of its eigenvalues (rad/s)?

Answer: rad/s

4. A = [[2, 0], [0, −3]]. What happens to most starting states?

  • They settle
  • They grow without limit along one direction
  • They oscillate
  • They stay put

5. A mass–spring–damper has m = 10 kg, c = 12.6 N·s/m and k = 400 N/m. What is its damping ratio ζ? (No unit.)

Answer:

Apply it

For a motor model A = [[−R/L, −kₑ/L], [kₜ/J, −b/J]] with your own reasonable numbers, compute the eigenvalues and say whether the motor is under- or overdamped.

Reflect

How would you check stability of a system with 20 states?

When a computer makes a stable loop unstable

Proportional control of a heater can't go unstable on paper, however high the gain. Run it on a microcontroller and it oscillates wildly. Who is right?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every real controller runs on a computer that samples, computes and holds. Ignoring that turns a guaranteed-stable paper design into an oscillating machine. Knowing the limit tells you how fast your control loop must run.

Goals

Predict

Sampling period 0.5 s, plant τ = 1 s, K = 1. Which gain is unstable?

  1. Kp = 1
  2. Kp = 3
  3. Kp = 6
  4. None of them

Write down your guess and your reason. The reveal is in the online lesson.

Discover

With T = 0.5 s, raise Kp until the samples start to grow, and compare with the readout's limit. Then halve T and find the new limit. What is the limit as T gets very small?

What the interactive shows, in words

The sampled-loop diagram plots the output only at sample times. With a modest gain the samples rise to a level just below the set point. Past the computed gain limit they alternate above and below with growing size. Shortening the sample period raises the limit.

Understand

Sample, compute, hold

A digital controller reads the sensor, computes a command and holds it until the next sample. Between samples the plant evolves open-loop. For a first-order plant this gives an exact recurrence: y[n+1] = a·y[n] + (1 − a)·K·u[n] with a = e^(−T/τ).

Overcorrection

With high gain, the held command pushes so hard that by the next sample the output has shot past the set point. The controller then pushes hard the other way. If each correction overshoots by more than the last error, the loop diverges. That is p = a − (1 − a)KKp < −1.

What helps

Sample faster (a → 1 and the limit grows), reduce the gain, or reduce delay. A common rule: sample 10–20 times per closed-loop time constant. The same mechanism explains why an Euler simulation with too big a step blows up (week 11).

Explain it another way: intuitive

Steering a car with your eyes closed, opening them only every two seconds. Correct gently and you're fine; correct hard and you zigzag off the road.

Explain it another way: technical

Discrete-time stability requires all poles inside the unit circle, |z| < 1. ZOH discretisation of K/(τs + 1) gives a pole at a = e^(−T/τ); P feedback moves it to a − (1 − a)KKp.

Explain it another way: mathematical

As T → 0, a ≈ 1 − T/τ, so the limit (1 + a)/(1 − a) ≈ 2τ/T → ∞: the continuous loop has no limit. Equivalently KKp·T/τ < 2, the same shape as Euler's dt < 2τ_cl rule.

Explain it another way: applied

Motor current loops run at tens of kHz because the electrical time constant is around a millisecond; temperature loops can run at 1 Hz because τ is minutes.

Derivation: The gain limit of a sampled P loop
  1. Plant τ·dy/dt + y = K·u. The controller samples y[n] every T seconds and holds u[n] = Kp·(r − y[n]) until the next sample.

  2. With u constant over a period, the first-order solution gives exactly y[n+1] = a·y[n] + (1 − a)·K·u[n], with a = e^(−T/τ).

  3. Substitute u[n]: y[n+1] = (a − (1 − a)·K·Kp)·y[n] + (1 − a)·K·Kp·r. The error is multiplied by p = a − (1 − a)·K·Kp each sample.

  4. Stability needs |p| < 1. p < 1 always holds; p > −1 needs K·Kp < (1 + a)/(1 − a).

  5. Example: τ = 1 s, T = 0.5 s, K = 1: a = 0.607, so Kp < 1.607/0.393 = 4.08. Halve T to 0.25 s: a = 0.779, Kp < 8.05.

Try these examples

Example 1

A heater has τ = 120 s and K = 0.5 °C per %. The controller runs every 10 s. What is the largest stable Kp?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. τ = 1 s, K = 1, sampling period T = 0.5 s. What is the largest stable Kp? (Two decimal places.)

Answer:

2. A digital P controller samples a first-order plant (τ = 0.5 s, K = 0.5) every T = 2 s and holds its output between samples. Above what gain Kp does the loop become unstable?

Answer:

3. You simulate a P-controlled loop τ·dy/dt + y = K·Kp·(r − y) with explicit Euler. τ = 0.2 s, K = 2, Kp = 4. Above what time step dt (in seconds) does the simulation become unstable?

Answer: s

4. Your digital P loop oscillates. Which change is most likely to fix it without slowing the response?

  • Sample faster
  • Use a slower processor
  • Add more sensor noise
  • Increase the gain

5. The per-sample multiplier p = −0.6. How does the error behave?

  • Decays smoothly
  • Flips sign each sample and shrinks
  • Grows
  • Stays constant

Apply it

For the Smart Greenhouse or any heater you model, choose a sample period from the closed-loop time constant, compute the gain limit, and state your safety margin (for example, 'Kp at one third of the limit').

Reflect

Name a loop in a device you own that must run very fast, and one that can run slowly. What sets the difference?

Week 16: Proportional feedback

This week you will

Why P control never quite arrives

A cruise control set to 100 km/h settles at 96 km/h on a hill and stays there. Is it broken?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Proportional control is the first controller most engineers build, and its leftover error is the first surprise they meet. Understanding exactly where it comes from tells you when it matters and what removes it.

Goals

Predict

K = 1, Kp = 9, set point 10. Where does the output settle?

  1. 10
  2. 9
  3. 1
  4. It oscillates

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set K = 1 and Kp = 3, then read the steady-state error. Increase Kp to 9, then 29. Write e∞ each time and check it against r/(1 + KKp). What would it take to make the error zero?

What the interactive shows, in words

The P-control explorer shows the closed-loop response settling below the set point. With loop gain 3 it settles at 0.75 (25 % error); with 9 at 0.9; with 29 at about 0.97. The error shrinks with gain but never reaches zero.

Understand

Error is the fuel

A P controller's command is proportional to the error. To hold a heater on, or a motor pushing uphill, it needs a steady command, so it needs a steady error. The loop settles at the point where the error is just big enough to produce the command that balances the plant.

The formula

For a plant with static gain K: e∞ = r/(1 + K·Kp). Loop gain KKp = 9 leaves 10 % error; 99 leaves 1 %. Raising the gain helps, but in real systems high gain amplifies noise, saturates actuators and, with any delay, threatens stability.

Disturbances too

A constant load (a hill, a heavier passenger, a draught) acts like an extra input. P control fights it but only by holding an error: the load's effect is divided by 1 + KKp, not removed. That is the lift's levelling error with a full cabin under P control.

Explain it another way: intuitive

A tired person holding a door against the wind: they only push back once the door has moved, and they need it to stay a little open to keep pushing.

Explain it another way: technical

Type-0 loop: plant has no integrator, so the position error constant is Kpos = K·Kp and e∞ = r/(1 + Kpos). Adding an integrator (type 1) makes e∞ = 0 for steps.

Explain it another way: mathematical

K = 2, Kp = 4, r = 10: e∞ = 10/(1 + 8) = 1.11. To get under 1 % of r you need 1 + KKp > 100, i.e. Kp > 49.5.

Explain it another way: applied

Cruise controls, thermostats and lift levelling all add integral action precisely to remove this error. The Elevator build's Level 4 asks you to calculate the P-only error for a full cabin before fixing it.

Derivation: Steady-state error of P control
  1. Plant τ·dy/dt + y = K·u. Controller u = Kp·e with e = r − y.

  2. At steady state nothing changes, so dy/dt = 0 and y∞ = K·u∞ = K·Kp·(r − y∞).

  3. Solve for y∞: y∞·(1 + K·Kp) = K·Kp·r, so y∞ = r·K·Kp/(1 + K·Kp).

  4. Error e∞ = r − y∞ = r/(1 + K·Kp). It shrinks as K·Kp grows but is never zero for finite gain.

  5. With a constant input disturbance d (u + d enters the plant), y∞ = (K·Kp·r + K·d)/(1 + K·Kp): the disturbance also leaves an error of −K·d/(1 + K·Kp).

Try these examples

Example 1

A heater loop has K = 0.5 °C per % power and Kp = 18 %/°C. Set point 60 °C above ambient. Steady error?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. K = 2, Kp = 4, r = 10. What is the steady-state error?

Answer:

2. A first-order plant with static gain K = 0.5 is under proportional control with gain Kp = 9. The set point steps to r = 5. What steady-state error r − y∞ remains?

Answer:

3. K = 1. What is the smallest Kp that keeps the P-only steady-state error at or below 1 % of the set point?

Answer:

4. Why can't a P controller hold a heater at exactly the set point?

  • The sensor is inaccurate
  • At zero error its command would be zero, and with no heat the temperature would fall
  • The heater is too weak
  • Because of noise

5. A constant load pushes the lift cabin down. Under P control, the levelling error is…

  • Zero
  • Proportional to the load and divided by 1 + loop gain
  • Growing over time
  • Independent of the load

Apply it

Calculate how far below the floor a full cabin settles in the Elevator under P-only control with the build's numbers, then check your answer against the simulator.

Reflect

When might a small steady-state error be perfectly acceptable?

Feedback makes it faster

The heater is slow: τ = 10 minutes. A P controller makes the room reach its (slightly low) target in 1 minute. Where did the speed come from?

About 30 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Feedback doesn't only correct errors; it changes the system's dynamics. Knowing that τcl = τ/(1 + KKp) lets you choose a gain for a speed target in one line, and warns you how hard the actuator will have to work.

Goals

Predict

τ = 6 s, K = 0.5. Which Kp gives a closed-loop time constant of 1 s?

  1. Kp = 2
  2. Kp = 5
  3. Kp = 10
  4. Kp = 12

Write down your guess and your reason. The reveal is in the online lesson.

Discover

In the feedback lab choose a first-order plant (note τ and K) and P control. For three gains, read the time to reach 63 % of the final value and compare with τ/(1 + KKp). Then add an actuator limit and repeat with the highest gain: does the formula still hold?

What the interactive shows, in words

In the feedback lab with a first-order plant, raising the P gain makes the output reach 63 % of its final value sooner, matching τ divided by one plus the loop gain. With an actuator limit and high gain, the command is clipped at the start and the early rise is slower than the formula predicts.

Understand

Same shape, faster clock

A P loop around a first-order plant is first-order again, but with τcl = τ/(1 + KKp). Loop gain 9 makes it ten times faster. The shape is the same exponential; only the timescale and the final value change.

Speed is bought with effort

At the instant of a step, the error is the whole step, so u(0) = Kp·r. Making the loop ten times faster means asking for roughly ten times the steady effort at the start. Real heaters, motors and valves have limits.

When the actuator saturates

If Kp·r exceeds the actuator's limit, the command is clipped and the plant just runs flat out: the response is set by the limit, not by τcl. The formula only applies while the loop stays linear. Check u(0) against the limit before trusting it.

Explain it another way: intuitive

A slow bath fills faster if you open the tap wider whenever it's further from full. Feedback is the hand on the tap.

Explain it another way: technical

Closing the loop moves the single pole from −1/τ to −(1 + KKp)/τ. Bandwidth rises by the same factor; so does sensitivity to measurement noise.

Explain it another way: mathematical

τ = 6 s, K = 0.5, Kp = 10: τcl = 6/6 = 1 s and e∞ = r/6. The command starts at u(0) = Kp·r = 10·r and settles at u∞ = Kp·e∞ = 10·r/6 ≈ 1.67·r: six times more effort at the start than at the end.

Explain it another way: applied

Motor speed loops make a sluggish motor respond in milliseconds, but only within the driver's current limit; beyond that the motor accelerates at its maximum rate whatever the gain.

Derivation: Closed-loop time constant with P control
  1. Plant τ·dy/dt + y = K·u with u = Kp·(r − y).

  2. Substitute: τ·dy/dt + y = K·Kp·r − K·Kp·y.

  3. Collect y: τ·dy/dt + (1 + K·Kp)·y = K·Kp·r.

  4. Divide by (1 + K·Kp): (τ/(1 + KKp))·dy/dt + y = (KKp/(1 + KKp))·r.

  5. This is first-order again, with τcl = τ/(1 + K·Kp) and gain KKp/(1 + KKp) (giving the steady error from the last lesson).

  6. Effort at t = 0: u(0) = Kp·r. Ten times faster with KKp = 9 needs an initial command Kp·r, roughly ten times the final effort. If the actuator saturates, the formula no longer holds.

Try these examples

Example 1

τ = 20 s, K = 2. Required τcl = 2 s. What Kp, and what initial command for a step of r = 5 if the actuator limit is ±40?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. τ = 6 s, K = 0.5, Kp = 10. What is τcl in seconds?

Answer: s

2. A plant τ·dy/dt + y = K·u has τ = 1 s and K = 4. It is put under proportional control u = Kp·(r − y) with Kp = 1. What is the closed-loop time constant in seconds?

Answer: s

3. τ = 12 s, K = 1. What Kp gives τcl = 1.5 s?

Answer:

4. Kp·r is three times the actuator limit. What does the early response look like?

  • Exactly τcl as predicted
  • Slower than predicted: the actuator runs at its limit until the error is small
  • Faster than predicted
  • Unstable

5. A first-order plant with static gain K = 4 is under proportional control with gain Kp = 3. The set point steps to r = 1. What steady-state error r − y∞ remains?

Answer:

Apply it

Pick a speed target for the Smart Greenhouse air temperature (for example τcl = 2 min). Compute the Kp needed from your week-12 model, check the initial heater command against its maximum power, and test in the build.

Reflect

What limits how fast you could make your home heating respond?

More gain, less damping

On a first-order plant, cranking up P gain only helps. On a robot joint with inertia, it makes it shake. What's different?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

This is the classic control trade-off: gain buys speed and accuracy but costs damping. Knowing exactly how much lets you choose a gain on paper, and see why almost every motion controller adds D.

Goals

Predict

A joint has ζ = 0.9 on its own. You close a P loop with KKp = 8. Roughly what overshoot do you expect?

  1. None
  2. About 5 %
  3. About 37 %
  4. It goes unstable

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose P, actuator limit None. Raise Kp from 1 to 15 and note the overshoot. The plant has ζ = 0.7 and K = 1: predict each overshoot from ζ/√(1 + Kp) before reading it.

What the interactive shows, in words

In the PID tuner with P control and no actuator limit, Kp = 1 gives a small overshoot. As Kp rises to 15, the response rises faster, settles closer to the set point and overshoots more, with visible ringing.

Understand

The algebra

Plant τ²ÿ + 2ζτẏ + y = K·u with u = Kp·(r − y) gives τ²ÿ + 2ζτẏ + (1 + KKp)·y = KKp·r. Matching to the standard form: ωn,cl = √(1 + KKp)/τ and ζcl = ζ/√(1 + KKp). The stiffness went up; the damping didn't.

What it feels like

Raising Kp is like fitting a stiffer spring to the joint: it springs back faster and harder, so it overshoots. The steady error still falls as 1/(1 + KKp). You trade accuracy against wobble.

Derivative action is extra damping

A D term adds a force proportional to velocity: exactly what a physical damper does. With u = Kp·e − Kd·ẏ, the ẏ coefficient grows from 2ζτ to 2ζτ + K·Kd, raising ζcl back up. That's why motion controllers are almost always PD or PID.

Explain it another way: intuitive

P control is a spring tying the output to the target. A stiffer spring pulls it there faster but bounces more. D control is a shock absorber.

Explain it another way: technical

Closed-loop poles −ζωn,cl ± jωn,cl√(1 − ζcl²) with ζcl·ωn,cl = ζ/τ unchanged: P control moves the poles vertically. Decay rate stays fixed; oscillation frequency rises.

Explain it another way: mathematical

ζ = 0.9, KKp = 8: ζcl = 0.3, OS = 100·exp(−0.3π/√0.91) = 37.2 %. For OS ≤ 10 % you need ζcl ≥ 0.59, i.e. 1 + KKp ≤ (0.9/0.59)² = 2.33: KKp ≤ 1.33.

Explain it another way: applied

Hobby servo motors and drone attitude loops show this directly: turn the P gain up and the arm or drone starts to jitter; adding D calms it.

Try these examples

Example 1

Plant ζ = 0.8, K = 1. Which Kp gives ζcl = 0.4?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. A second-order plant has ζ = 0.9 and K = 1. With Kp = 8, what is ζcl?

Answer:

2. With ζcl = 0.3, what overshoot do you expect, in percent?

Answer: %

3. An underdamped second-order system has damping ratio ζ = 0.32. What percent overshoot does its step response have?

Answer: %

4. When you raise Kp on a second-order plant, which stays the same?

  • ωn,cl
  • ζcl
  • The decay rate ζcl·ωn,cl of the envelope
  • The steady-state error

5. Your P-controlled joint overshoots 35 %. Which change reduces overshoot while keeping the gain?

  • Add derivative action
  • Add integral action
  • Raise Kp
  • Sample more slowly

Apply it

In the PID tuner, find the largest Kp that keeps overshoot under 10 % with P only. Then add D and find how much more Kp you can use for the same overshoot. Report both.

Reflect

Why do you think the decay rate doesn't change when you raise P gain?

Week 17: PID control in simulation

This week you will

I removes the error, D adds the damping

P gets you close. Which two extra terms get you exactly there, smoothly, and what does each cost?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

PID controllers run a huge share of industrial loops. Each term solves one problem and creates another. Knowing the trade-offs is what turns random slider-pushing into engineering.

Goals

Predict

You add integral action to a P loop with a steady error. What happens to the steady error?

  1. It shrinks but stays
  2. It goes to zero
  3. It doubles
  4. It oscillates forever

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Set the actuator limit to None. Start with P (Kp = 4): note the steady error. Switch to PI and raise Ki from 0 until the error disappears; note the overshoot. Then switch to PID and raise Kd: what happens to overshoot?

What the interactive shows, in words

In the PID tuner with no actuator limit, P control alone settles below the set point. PI removes that error but adds overshoot. Adding derivative action with PID reduces the overshoot.

Understand

Integral: memory of past error

u = Kp·e + Ki·∫e dt. The integral keeps adding up error, so the command keeps changing until e = 0. At steady state the integral alone supplies the command the plant needs. That is why PI removes steady-state error for steps and constant loads.

Derivative: brakes before the target

Kd·de/dt reacts to how fast the error is shrinking. As the output races towards the set point, D pushes back, like a damper. Many implementations differentiate the measurement, not the error, to avoid a 'kick' when the set point jumps.

The costs

Too much I: slow wobbles and overshoot, and windup when the actuator saturates (next lesson). Too much D: it amplifies sensor noise, because noise changes fast. Real D terms include a low-pass filter. P sets the basic stiffness; I and D trim accuracy and damping.

Explain it another way: intuitive

P looks at the present, I remembers the past, D predicts the future.

Explain it another way: technical

C(s) = Kp + Ki/s + Kd·s/(T_f·s + 1). The integrator adds a pole at s = 0, making the loop type 1 (zero step error). The filtered derivative adds phase lead up to about 1/T_f.

Explain it another way: mathematical

At steady state with PI: dy/dt = 0 and d(∫e)/dt = e must be 0, so e∞ = 0 regardless of K, Kp or a constant load d.

Explain it another way: applied

3D printer hot ends and drone attitude loops use PID. Temperature loops often use little or no D because temperature sensors are noisy and the process is slow.

Try these examples

Example 1

PI controller, Kp = 2, Ki = 1, plant K = 1. At steady state with set point 1, what is the integral value?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. What does integral action remove that P alone cannot?

  • Overshoot
  • Steady-state error to a step or constant load
  • Sensor noise
  • Saturation

2. Why is derivative action sensitive to sensor noise?

  • Noise has a large average
  • Noise changes quickly, so its rate of change is large
  • D uses a different sensor
  • It isn't

3. Why do many PID implementations differentiate the measurement instead of the error?

  • It's cheaper
  • A step in set point makes de/dt huge for one sample, giving a 'derivative kick'; the measurement doesn't jump
  • The error can't be differentiated
  • Tradition

4. A first-order plant with static gain K = 2 is under proportional control with gain Kp = 5. The set point steps to r = 50. What steady-state error r − y∞ remains?

Answer:

5. An underdamped second-order system has damping ratio ζ = 0.72. What percent overshoot does its step response have?

Answer: %

Apply it

Make a three-row table (P, I, D) with columns 'raises', 'lowers', 'risk'. Fill it from your own experiments in the PID tuner, not from memory, and note the settings you used.

Reflect

Which PID term would you add first to a noisy temperature loop, and which would you leave out?

Tuning to a written spec

Two engineers tune the same motor. One takes 10 minutes, one takes an afternoon. Both meet the spec. What did the first one do differently?

About 40 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Tuning by trial and error eventually works, but nobody can repeat it, check it or improve it. A procedure plus a log turns tuning into evidence.

Goals

Predict

In the usual manual procedure, which gain is set first?

  1. Ki
  2. Kd
  3. Kp
  4. All at once

Write down your guess and your reason. The reveal is in the online lesson.

Discover

In the Robotics Workbench (Systems Engineer mode), tune a joint or wheel speed controller against this spec: overshoot ≤ 10 %, 2 % settling ≤ 1 s, zero steady-state error. Follow P → D → I, logging every change: setting, overshoot, settling, error.

What the interactive shows, in words

The workbench lets you set controller gains and run a step test, reporting overshoot, settling time and steady-state error. Following the procedure, raising P speeds the response, adding D reduces overshoot, and a small I removes the remaining error.

Understand

A procedure
  1. I and D off. Raise Kp until the response is quick with modest overshoot. 2. Add Kd until overshoot meets the spec. 3. Add Ki until steady-state error is gone within the settling limit. 4. Re-check every line of the spec, because each change affects the others.
A tuning log

One row per test: gains, conditions (set point, load, noise), and every metric in the spec. Change one gain at a time. A log lets a teammate reproduce your result, shows why you stopped, and catches the moment something got worse.

When the spec can't be met

Sometimes no gains meet everything: the actuator can't push hard enough, noise rules out much D, or delay limits the gain. Then the honest result is 'not achievable with this hardware', with the evidence, and a proposal: faster sensor, bigger motor, or a relaxed spec.

Explain it another way: intuitive

Like seasoning soup: add one thing at a time, taste after each, and write down what you added so you can make it again.

Explain it another way: technical

Manual tuning is a coordinate search over (Kp, Kd, Ki). Rule-based methods (for example step-response rules) give a starting point from a plant's K, τ and delay; model-based methods place closed-loop poles directly.

Explain it another way: applied

Industrial commissioning engineers log every change because a plant may be retuned years later by someone else. The log is part of the deliverable.

Try these examples

Example 1

Log excerpt: Kp 2 → OS 0 %, ts 2.1 s; Kp 5 → OS 18 %, ts 1.6 s; Kp 5, Kd 0.2 → OS 6 %, ts 0.9 s; but e∞ = 0.04. Next step?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. You've set Kp. Overshoot is 18 % and the spec is 10 %. What next in the procedure?

  • Add Ki
  • Add Kd
  • Lower Kp to zero
  • Change the plant

2. Which tuning-log entry is most useful?

  • 'Tried some gains, looks better'
  • 'Kp 5, Ki 0, Kd 0.2; r = 1, no load; OS 6 %, ts 0.9 s, e∞ 0.04'
  • 'Kd up'
  • A screenshot with no numbers

3. You can't get settling under 1 s without the motor hitting its current limit. What is the right report?

  • Hide the limit and report the best run
  • State the spec is not achievable with this actuator, show the evidence, and propose options
  • Raise the gains until it passes in simulation without limits
  • Change the spec quietly

4. A second-order system has ωn = 5 rad/s and ζ = 0.6. Estimate its 2 % settling time ts with the rule of thumb ts ≈ 4/(ζ·ωn).

Answer: s

5. A step response peaks os = 50 % above its final value. Assuming a standard second-order system, what is its damping ratio ζ?

Answer:

Apply it

Submit your Workbench tuning log (at least six rows) with the final gains and a one-paragraph justification. If you couldn't meet the spec, say which line failed and what hardware change would fix it.

Reflect

Which change in your log surprised you most, and what did it reveal about the system?

Hitting the wall: saturation and windup

A robot arm is held still for two seconds, then released. It flies past its target. The controller was perfect in simulation. What did the simulation forget?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Every real actuator has limits. Integrator windup is one of the most common causes of 'it worked in simulation but overshoots on the robot'. The fix is simple once you know to look for it.

Goals

Predict

A PI loop's actuator is stuck at its limit for a long time while the error stays positive. What does the integral term do?

  1. Stays constant
  2. Keeps growing
  3. Resets to zero
  4. Shrinks

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Choose PI, Kp = 4, Ki = 6, actuator limit ±1.5, anti-windup off. Note the overshoot and settling. Tick anti-windup and compare. Then try limit None: which run is the fair 'ideal' reference?

What the interactive shows, in words

With a PI controller and an actuator limit of plus or minus 1.5, the effort plot sits on the limit at the start. Without anti-windup, the output overshoots by about 40 % and settles slowly. With anti-windup on, the same gains overshoot by only a few per cent.

Understand

Saturation opens the loop

A motor driver can't exceed its supply voltage; a heater can't exceed full power. When the controller asks for more, the actuator delivers its maximum. While saturated, changing the command changes nothing: the loop is effectively open, and the plant just runs flat out.

Windup

The integral doesn't know the actuator is saturated, so it keeps adding error. By the time the output reaches the set point the integral is far too large, and it takes a long period of negative error (overshoot) to unwind it. Bigger Ki and longer saturation mean worse windup.

Anti-windup

Conditional integration: stop integrating while the actuator is saturated and the error would push it further. Back-calculation: bleed the integral back in proportion to the difference between requested and actual command. Clamping: cap the integral. All three keep I useful without the overshoot.

Explain it another way: intuitive

Pushing a car that's stuck against a wall, getting angrier the longer it doesn't move. When the wall vanishes you shove it right across the road.

Explain it another way: technical

With saturation, the plant input is sat(u). The integrator state ∫e grows while the loop gain is effectively zero, so the controller state drifts far from its useful range. Anti-windup schemes keep the integrator consistent with the actual actuator output.

Explain it another way: applied

Large set-point changes, start-ups and blocked mechanisms are classic windup triggers: a lift starting a long trip, a robot joint briefly blocked by an obstacle, an oven at start-up.

Try these examples

Example 1

A heater is at full power for 60 s while the error averages 10 °C, and Ki = 0.05 %/(°C·s). How much has the integral term added to the command?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. What causes integrator windup?

  • Too much derivative gain
  • The integral accumulating error while the actuator is saturated and can't respond
  • Sensor noise
  • Sampling too fast

2. Which change directly prevents windup?

  • Raise Ki
  • Stop integrating while saturated (conditional integration)
  • Remove the actuator limit in simulation
  • Add more D

3. Can a pure P controller suffer integrator windup?

  • Yes
  • No: it has no integrator, though it still saturates
  • Only with noise
  • Only if sampled

4. An actuator is saturated for 4 s while the error is constant at 0.5. With Ki = 3, by how much does the integral term Ki·∫e grow?

Answer:

5. A plant τ·dy/dt + y = K·u has τ = 12 s and K = 1. It is put under proportional control u = Kp·(r − y) with Kp = 0.5. What is the closed-loop time constant in seconds?

Answer: s

Apply it

In the PID tuner, find a PI setting where anti-windup changes overshoot by at least a factor of three. Report both runs with all metrics, and explain the difference using the effort plot.

Reflect

Where in the Elevator build could saturation occur, and what would windup feel like to a passenger?

Week 18: Controller comparison project

This week you will

A fair fight between controllers

A report says 'PID beat PI by 40 %'. Before you believe it, what three questions should you ask?

About 35 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Engineering decisions are made from comparisons. A comparison where one option got an easier test is worse than none, because it looks like evidence. This lesson builds the habits that make your term project trustworthy.

Goals

Predict

One controller is tested without the load disturbance the others faced. Its results will probably look…

  1. Worse
  2. The same
  3. Better, for reasons unrelated to the controller
  4. Impossible to say

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Investigation: with 'Matched' conditions, record which controllers pass and why each failure happens. Then switch to 'Unfair' and record how PID's row changes. Write one sentence on what a reader of the unfair table would wrongly conclude.

What the interactive shows, in words

The scoreboard table lists overshoot, settling time, final error, peak effort and pass or fail for P, PI and PID on the same plant. Under matched conditions P fails on final error, PI fails on settling time and PID passes. Under the unfair setting, PID is tested with no load or noise and its row looks better for reasons unrelated to the controller.

Understand

Decide before you test

Write the specification (metrics, limits, conventions) and the protocol (set point, loads, noise, number of runs, duration) before the first run. Otherwise it is too easy to pick the metric that makes your favourite look good.

Match everything except the controller

Same plant parameters, same actuator limits, same disturbance at the same time, same noise seed or the same set of seeds, same simulation step. P is the natural baseline: it shows how much I and D actually add.

Tune each fairly, too

Comparing a carefully tuned PID with a carelessly tuned PI tests your effort, not the controller. Give each the same tuning method and budget, and report how you tuned. The scoreboard's gains came from one coarse grid search per controller, stated in its note.

Explain it another way: intuitive

A race where one runner starts ten metres ahead tells you nothing about who's faster.

Explain it another way: technical

Controlled comparison: one independent variable (controller structure), all others held fixed or randomised identically. Report all pre-registered metrics, including those where the preferred option loses.

Explain it another way: applied

Industrial controller upgrades are often justified by before-and-after data. If the 'after' period had milder weather or lighter loads, the improvement may be illusory.

Try these examples

Example 1

Three runs of PI give settling times 2.1, 2.4, 2.7 s; three of PID give 1.9, 2.0, 2.4 s, with different noise seeds per run. Is PID faster?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Which is a matched condition for a controller comparison?

  • Each controller gets its own random noise
  • All controllers face the same load step at the same time with the same noise seed
  • The best controller gets the hardest test
  • Each is tested on a different day's plant model

2. Why include a P-only controller in the comparison?

  • Because it usually wins
  • As a baseline: it shows how much the I and D terms actually add
  • It is required by law
  • To make the table longer

3. Settling times over four matched runs: 1.8, 2.0, 2.2, 2.0 s. What is the mean, in seconds?

Answer: s

4. Why write the specification before running any tests?

  • It's faster
  • So the metrics aren't chosen afterwards to favour one result
  • Because tests are expensive
  • It doesn't matter

5. A first-order plant with static gain K = 4 is under proportional control with gain Kp = 3. The set point steps to r = 1. What steady-state error r − y∞ remains?

Answer:

Apply it

Write the specification and test protocol for your term project: metrics with conventions, limits, loads (0, 300 and 600 kg), number of runs and how you will tune each controller. Submit it before you run any tests.

Reflect

Have you ever seen a comparison (an advert, a review) that wasn't fair? What was mismatched?

Every load, every time

Your lift is perfect with six passengers. Empty, it overshoots; full, it stops 3 cm low. Can one controller handle them all?

About 50 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Real systems never run at one operating point. Robustness, meeting the spec across the whole range of conditions, is what separates a demo from a product. This is the term project's core.

Goals

Predict

With P-only levelling, how does the settled error change from a half-full to a full cabin?

  1. It disappears
  2. It grows in proportion to the extra load
  3. It stays the same
  4. It reverses direction

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Open the Elevator at Level 4. Run your Level 3 design at 0, 300 and 600 kg and record all five checks for each. Calculate the P-only error for 600 kg before you look at the simulator's number. Then adjust one setting at a time until all three loads pass.

What the interactive shows, in words

The Level 4 elevator task runs the same design with an empty, half-full and full cabin. With P-only levelling, the full cabin settles about 29 mm low. Adding integral action brings all three loads to within 5 mm of the floor.

Understand

Load is a disturbance

The controller is tuned around a nominal load. Extra passengers add weight, a constant downward force: exactly the kind of disturbance that leaves a P-only error. Lighter loads change the effective mass, which changes ωn and ζ, so the same gains can overshoot.

The P-only error

If the levelling loop acts like a spring of stiffness Kp (N/m) and the extra weight is Δm·g, the settled error is Δm·g/Kp. With 300 kg extra and Kp = 100 kN/m: 300 × 9.81/100,000 ≈ 29 mm. Far outside a 5 mm spec.

Robust design

Integral action removes the load error at every load. Derivative action keeps enough damping when the mass changes. Feedforward (load weighing) helps the motor hold the cabin before the brake lifts. Test all three loads every time you change anything.

Explain it another way: intuitive

A good lift controller is like a good waiter's tray hand: it holds steady whether the tray carries one glass or ten.

Explain it another way: technical

Robust performance: the spec must hold over a parameter range (m ∈ [m_empty, m_full]). The P-only steady error is the disturbance force divided by the loop's static stiffness; a type-1 controller (with I) has zero error for constant disturbances.

Explain it another way: mathematical

Δm = 300 kg, g = 9.81 m/s², Kp = 100,000 N/m: error = 2,943/100,000 = 0.0294 m = 29.4 mm.

Explain it another way: applied

Lift manufacturers fit load-weighing sensors and pre-torque the motor before releasing the brake, then let PID handle the remainder. Feedforward plus feedback is the norm in industry.

Try these examples

Example 1

With Kp = 200 kN/m and P only, what is the extra levelling error going from 300 kg to 600 kg passengers?

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. P-only levelling, stiffness Kp = 100,000 N/m. Going from 300 kg to 600 kg of passengers, how much further (in mm) does the cabin settle below the floor? Use g = 9.81 m/s².

Answer: mm

2. Which part of a design removes that load-dependent levelling error?

  • More derivative gain
  • Integral action
  • A smaller motor
  • A softer jerk limit

3. Your design passes at 450 kg. Why must you still test the empty and the full cabin?

  • You don't: the middle load is representative
  • Load changes both the disturbance the controller must reject and the moving mass, so ζ, ωn and the steady error all shift
  • Only to check the doors
  • Because the sensor changes with load

4. A first-order plant with static gain K = 2 is under proportional control with gain Kp = 5. The set point steps to r = 50. What steady-state error r − y∞ remains?

Answer:

5. A mass–spring–damper has m = 10 kg, c = 12.6 N·s/m and k = 400 N/m. What is its damping ratio ζ? (No unit.)

Answer:

Apply it

Term project core: pass every Level 4 check for 0, 300 and 600 kg. Run P (baseline), PI and PID with your pre-written protocol and record all metrics for every controller and load in one table.

Reflect

Which load was hardest for your design, and what does the second-order model say about why?

Writing up the trade-offs

Your PID passes every check. Your teammate's PI is 1 s slower but uses half the peak motor current. Who wins, and how would you write it?

About 45 min · Checked by automated tests · Interactive lesson · Lite lesson (answers checked here)

Why it matters

Engineering results are only as useful as their write-up. A good report lets someone else check your work, repeat it, and decide quickly, including when the answer is 'it depends on what you value'.

Goals

Predict

Which sentence belongs in the limitations section of a simulation-only lift study?

  1. 'PID is the best controller'
  2. 'Results come from a linear educational model with no rope stretch nonlinearity, sensor delay or motor heating; hardware results may differ'
  3. 'We tuned PID carefully'
  4. 'The lift was fast'

Write down your guess and your reason. The reveal is in the online lesson.

Discover

Investigation: ask one question about your controllers (for example: how does the levelling error under P-only control change with load?). Change one setting across at least four recorded runs, hold everything else fixed, and draft the results table and one figure.

What the interactive shows, in words

The Level 5 elevator investigation records several runs where one setting changes and everything else is held fixed; the runs are recomputed by the server and summarised in a results table for the report.

Understand

Structure

Question → specification and protocol (written before testing) → results table (every controller, every load, every metric) → explanation → limitations → recommendation. Keep the table complete even where your preferred option loses.

Explain with the models

Link each observation to this term's theory: 'P leaves 29 mm at 600 kg, as e = Δm·g/Kp predicts'; 'PID overshoots less because D raises ζ'; 'PI is slower because, held to the overshoot limit, its ζ forces a low ωn'. A result you can explain is far more convincing than one you can only show.

Trade-offs and honest limits

When no option wins everything, say what each costs: speed, effort, sensitivity to noise, complexity. State the model's simplifications and that results are simulated. Recommend for a stated priority: 'if motor current is the constraint, choose PI'.

Explain it another way: intuitive

A good report is a map: anyone can follow your route, see where you looked, and see where the map ends.

Explain it another way: technical

Report all pre-specified metrics with their conventions, the number of runs and their spread, seeds, simulation step, plant parameters and actuator limits. Separate observations from interpretations.

Explain it another way: applied

Technical reports in industry often end with a decision table: options in rows, criteria in columns, and a recommendation tied to the customer's stated priorities.

Try these examples

Example 1

Rewrite 'PID was way better' as a reportable result.

The worked solution is in the online lesson.

Common mix-ups

Practice questions

Questions only. Check your answers in the Lite lesson; they are graded on our server and nothing is saved.

1. Your PID loses to PI on peak motor current. Should that column appear in your table?

  • No, it weakens the PID case
  • Yes: every pre-specified metric is reported for every controller
  • Only in an appendix nobody reads
  • Only if asked

2. Which explanation of 'P-only stops 29 mm low with a full cabin' uses the term's theory?

  • 'P control is bad'
  • 'The extra 300 kg acts as a constant load; P control needs a steady error to hold it, e = Δm·g/Kp ≈ 29 mm'
  • 'The simulator is wrong'
  • 'The motor is too weak'

3. Which is a genuine limitation of a simulation-only controller comparison?

  • The tables are long
  • Real hardware adds friction, delay, noise and nonlinearities the model omits, so rankings may change
  • Simulations are always wrong
  • There were three controllers

4. A step response peaks os = 10 % above its final value. Assuming a standard second-order system, what is its damping ratio ζ?

Answer:

5. A second-order system has ωn = 20 rad/s and ζ = 0.3. At what time tp does its step response reach its first peak?

Answer: s

Apply it

Write the term project report (about two pages): specification and protocol, full results table, two figures with captions, explanation using first- and second-order models, limitations and a recommendation tied to a stated priority.

Reflect

What would you need to test on real hardware before trusting your recommendation?