Skip to content
Tactiverge

School/△ Builder/Week 26

Proportional control: push harder when further away

On/off heaters are either flat out or off. What if the heater could push gently when you are nearly there?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

Proportional control is the first step towards the PID controllers inside drones, cruise control and 3D printers. With PWM from last week, a heater or motor can deliver any fraction of full power, and the simplest good rule is to make that fraction proportional to the error.

  • ◇ Apply the proportional rule effort = gain × error, with limits on the effort.
  • ◇ Predict where a proportional heater settles and the leftover (steady-state) error.
  • ◇ Explain how raising the gain changes the leftover error and the risk of instability.

2.Predict

A proportional heater has reached a steady temperature on a cold night. Is it exactly at the setpoint?

Guess first. Being wrong here is how the surprise works.

3.Discover

Choose Proportional. With the setpoint at 18 °C and outside at 5 °C, try a gain of 400 W per °C and read where it settles. Raise the gain to 1,500 and 3,000. Then switch to On/off and compare the energy and switching.

Loading the interactive…

Can't use the interactive? Read a description instead

The thermostat diagram plots 300 minutes of greenhouse temperature from a 12 °C start, with the setpoint, a ±1 °C band and the heater power underneath. In proportional mode the power is gain × error, limited to 0–3,000 W; the temperature settles below the setpoint at (100 × outside + gain × setpoint) ÷ (100 + gain), and the readout states that value. In on/off mode the heater is full on below the band and off above it, and the readout counts switchings.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

A proportional heater controller uses effort = gain × error, where error = setpoint − temperature. The gain is 40% per °C and the effort is limited to the range 0 to 100%. The setpoint is 18 °C and the temperature is 16 °C. What heater effort does it command, in %?

%

5.Understand

The proportional rule

effort = Kp × error. Big error, big effort; small error, small effort; no error, no effort. With PWM, 'effort' can be a duty cycle. Two practical limits: a heater cannot cool, so negative effort is clipped to 0, and it cannot exceed full power, so large efforts are clipped to 100%. When clipped, the controller is saturated and behaves like on/off.

The leftover error

On a cold night the heater must keep supplying heat. A proportional controller only supplies heat when there is an error, so it settles where the error is just big enough: the steady-state error. More gain means less error is needed, so it settles closer. Removing the error completely needs another idea, integral action, which you meet in Level 3.

Too much gain

Real systems have delays: the heater warms up, air takes time to mix, the sensor responds slowly, and firmware samples at intervals. With a very high gain, the controller overreacts to each change and can overshoot or oscillate. Engineers raise the gain until the error is small enough and stop well before the response turns twitchy.

Explain it another way

Braking for a red light: far away, you brake gently; close, you brake harder. Your effort follows how far you still have to go.

Derivation: Where a proportional heater settles
  1. Controller: heater power P = Kp × (r − T), limited to 0–3,000 W. (r = setpoint, T = temperature, Kp in W per °C.)

  2. Greenhouse: heat leaks out at UA × (T − T_out) watts, with UA = 100 W per °C in the model.

  3. Steady means heat in = heat out: Kp × (r − T) = UA × (T − T_out).

  4. Expand and collect the T terms: Kp·r + UA·T_out = (UA + Kp) × T.

  5. So T = (UA·T_out + Kp·r) ÷ (UA + Kp). With UA = 100, T_out = 5 °C, Kp = 400, r = 18 °C: T = (500 + 7,200) ÷ 500 = 15.4 °C, 2.6 °C short.

  6. Kp = 1,500 gives (500 + 27,000) ÷ 1,600 ≈ 17.2 °C: closer. The error shrinks as Kp grows but only reaches zero if Kp were infinite.

Worked example 1

Kp = 25% per °C, setpoint 20 °C. Efforts at 19 °C, 16 °C and 21 °C?

19 °C: 25 × 1 = 25%. 16 °C: 25 × 4 = 100%, the limit: 100% (saturated). 21 °C: 25 × (−1) = −25% → clipped to 0%.

Common mix-ups

  • A proportional controller reaches the setpoint exactly, given time.
    ✓ Against a steady heat loss it settles short of the setpoint. That offset is built into the rule.
  • Turn the gain up as high as possible.
    ✓ Delays in real systems make very high gains overshoot or oscillate.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A proportional heater controller uses effort = gain × error, where error = setpoint − temperature. The gain is 10% per °C and the effort is limited to the range 0 to 100%. The setpoint is 22 °C and the temperature is 17.5 °C. What heater effort does it command, in %?

%

Practice 3

Using T = (UA·T_out + Kp·r) ÷ (UA + Kp) with UA = 100 W per °C, T_out = 0 °C, Kp = 900 W per °C and r = 20 °C, where does the greenhouse settle, in °C?

°C

Practice 4

You double Kp. What happens to the leftover (steady-state) error?

Practice 5

At dusk the greenhouse is 8 °C below the setpoint and Kp × error is 300% of full power. What does the heater actually do?

7.Apply it

In the thermostat diagram, find the smallest gain that keeps the greenhouse within 1 °C of an 18 °C setpoint at 300 minutes with 5 °C outside. Check it against the settling formula, then compare its energy with an on/off thermostat with a 1.5 °C band.

Open BUILD 007: Design a Smart Greenhouse →

8.Reflect

Concepts: Proportional control · Open-loop and closed-loop control