Integral action and PI control

The Core Idea

Integral action builds a correction from error that persists over time. A proportional-integral (PI) controller combines that memory with proportional action, which responds to the error present now.

What you will learn

  • Understand why proportional control can leave a gap between the measured value and the target.

  • See how integral action can help close that gap over time.

  • Recognize the tradeoff between correcting the error and adding too much integral action.

Why it matters

A process may need continuing output even when it is near its target. Understanding integral action helps you judge how a controller supplies that output.

Explained like you're five

Imagine you are filling a bathtub and you want the water at a certain line.

P (proportional) is you looking at the water right now: if it is far below the line, you open the tap a lot; as it gets close, you ease off. Simple — but there's a catch. The tub leaks a little, so when you ease the tap down near the line, the water stops rising just short of where you wanted. You're stuck a bit low forever, because to go higher you'd have to open the tap more, but "close to the line" tells you to ease off. That permanent little gap is called offset.

I (integral) is you remembering that it's been a little low for a while and getting impatient about it. The longer the water sits below the line, the more you nudge the tap open to make up for it — until the water finally reaches the line exactly. That memory of "we've been short for a while" is what closes the gap.

The catch with I: if you get impatient too fast and crank the tap hard, the water shoots past the line before you notice and have to drain some back. That overshoot is the tradeoff this lesson is about — just enough memory to reach the line, not so much that you blow past it.

The problem

A small heater starts at 20 °C. Its target is 50 °C. More heater output raises its temperature, but the process takes time to respond. The proportional controller changes output when it sees error; with this self-regulating process, it eventually needs some error to hold the heater on. We want to remove that persistent gap without sending the temperature far past the target.

Trace or controlMeaning
SPSetpoint: the requested temperature, 50 °C.
PVProcess variable: the measured temperature, in °C.
CVController output: heater command, 0–100%.
ErrorSP minus PV, in °C. A positive error asks for more heat.
PProportional gain: the immediate output response to error. Fixed at 2 in this lesson.
IIntegral gain: how quickly accumulated error changes the output contribution. Starts at 0.
DDerivative gain: held at 0, so this is P versus PI, not full PID.

Every trial uses the same heater, 20 °C start, 50 °C target, P gain of 2, and 60 simulated seconds. Change only I. The simulator's 100 ms controller interval is not the same as the playback speed.

Predict

First run P alone: I is locked at zero. Sketch where you think process variable (PV) will be after 60 s. Will it reach 50 °C, or level off below it? Lock in your sketch before revealing the experiment. Run it to the end and compare your purple prediction with the measured green PV.

Try it

Run the P-only experiment above and watch SP, PV, and CV as it goes. Use Restart then Run to repeat the same starting conditions as often as you like.

When it finishes, ask two questions: is PV sitting at the 50 °C target, and is CV still above zero? The purple line is your locked prediction; the other lines are the actual target, measurement, and heater output. Note the last PV and the recorded I contribution before moving on.

Look closer

Near the end, PV flattens below 50 °C while CV remains above 0%. This is not a broken controller: the heater must still supply heat to hold the elevated temperature. At P = 2, every remaining degree of error commands 2% output. The P-only trace's recorded I contribution stays 0% for the whole run.

Now imagine adding a small I gain. While PV is below SP, each controller update adds a little of that positive error to a running total. The resulting I contribution supplies some heater output even as P's immediate contribution shrinks. The measured PV can then reach SP. If I adds output faster than this heater can respond, PV can pass SP before the accumulated contribution unwinds: that is overshoot.

Change it

In this fresh copy of the same experiment, run with I = 0 first and press Save this trace after it finishes. Then set I to 0.2, press Restart, and run for the full 60 s. The saved P-only PV stays overlaid; the new PV starts from the same 20 °C. Compare the ending gap, any peak above 50 °C, and the readout of the recorded I contribution at 0, 10, and 60 s. The contribution is a percentage of CV, not another temperature.

Try I = 0.6 with another restart. Does the gap close sooner? What happens to the peak? Change only I and keep the saved P-only run as your reference. You may try intermediate values; the lesson does not require one magic setting.

Show a useful comparison

With I = 0, the integral contribution is exactly 0% and PV remains short of SP. With modest I, the contribution builds while error is positive and can hold the required output after error has become small. More I is not automatically better: output added during the heater's lag can carry PV past SP. Compare the traces, not just the final number.

Check yourself

Start a clean trial below. Adjust I only, then run the full 60 simulated seconds. The check passes when PV has actually reached 50 °C, steady-state error is at most 3% of the 30 °C start-to-target span (0.9 °C), and overshoot is at most 10% of that span (3 °C). The full 60 s exceeds this heater's minimum steady-state observation window of 40 s (zero dead time plus four 10 s time constants). The check is based on response behavior, not on a prescribed I value or the general proportional-integral-derivative (PID) Practice score. Restart and retry as often as you like.

Hint 1 — Which error remains?

If PV levels off below SP, which output contribution stays at zero? Would repeating the same P-only run change that?

Hint 2 — Change one gain

Keep P at 2 and D at 0. Add a small positive I value, restart from 20 °C, and watch whether PV reaches 50 °C during the full observation window.

Hint 3 — Balance the peak and the gap

Try I around 0.2. If PV peaks more than 3 °C above SP, reduce I and restart. If the end remains more than 0.9 °C from SP, increase I a little and restart. Judge the finished trace each time.

Passing the hands-on check records this PID concept as complete. The lesson page's Good, mark as learned action remains available even if you choose not to pass the check.

What happened and why

P responds to current error. I responds to the history of error. In this heater, P alone needs an offset to hold a nonzero CV; PI can build the missing CV contribution and reduce that offset. The recorded I values show that contribution growing while error persists. A larger I gain builds it faster, but the heater's delayed response means accumulated output can create overshoot. A good explanation of your tune names both effects: the final gap improved, and the peak stayed acceptable.

Show the controller math

In this lesson's parallel PI form, error = SP − PV and CV = P × error + I × accumulated error, limited to 0–100%. Accumulated error adds error × 0.1 s at each 100 ms controller update. P has units of % output per °C; I has units of % output per (°C·s). The recorded integral term is I × accumulated error in percentage points of output. At I = 0, that term stays zero. At SP with zero present error, P contributes zero, but I can still provide the heat needed to hold PV there. The exact gain numbers depend on the controller form and time units; do not copy them into another platform without checking those definitions.

In an interview, distinguish offset (a persistent gap) from overshoot (PV crossing beyond SP). If asked why adding I helped, say which trace and recorded contribution support your answer—not simply that “I makes it faster.”

Enable JavaScript to run the embedded simulator and complete the interactive exercises.