# The control loop: the heart of automation

> Measure, compare, correct: the control loop is the basic mechanism that keeps a quantity (temperature, pressure, flow) at its setpoint, automatically and continuously.

- Source : https://industryhub.site/en/learn/automation/boucle-de-regulation
- Track : automation
- Level : Discovery
- Reading time : 7 min
- Language : English

## In brief

A control loop measures a quantity, compares it to a setpoint, and acts to correct the deviation. Sensor, controller, actuator: this trio, often driven by a PID controller, is the elementary gesture of automation.

## In one sentence

A control loop **keeps a physical quantity, all by itself**, at the value you ask for, by continuously correcting deviations. It is the basic gesture that every control system in a plant repeats thousands of times a second.

## The three organs in a circle

A loop links three organs in a closed circle: the **sensor** measures the actual quantity, the **controller** compares it to the **setpoint** and computes the deviation, the **actuator** acts to reduce that deviation. The result changes the quantity, which the sensor measures again — the loop is *closed*.

<svg role="img" aria-label="Closed control loop diagram: setpoint, comparator, PID controller, actuator, process, and sensor feedback" viewBox="0 0 680 185" style="display:block;width:100%;max-width:640px;height:auto;margin:1.5rem auto;font-family:system-ui,-apple-system,sans-serif">
  <defs><marker id="ar-loop" markerWidth="9" markerHeight="9" refX="6" refY="3" orient="auto"><path d="M0,0 L6,3 L0,6 Z" fill="#5b6b69"/></marker></defs>
  <text x="8" y="62" font-size="12.5" fill="#5b6b69">Setpoint</text>
  <line x1="58" y1="58" x2="75" y2="58" stroke="#5b6b69" stroke-width="2" marker-end="url(#ar-loop)"/>
  <circle cx="92" cy="58" r="15" fill="#fff" stroke="#0b3b39" stroke-width="1.5"/>
  <text x="92" y="63" text-anchor="middle" font-size="14" font-weight="700" fill="#0b3b39">Σ</text>
  <text x="74" y="40" font-size="13" fill="#5b6b69">+</text>
  <text x="74" y="92" font-size="14" fill="#c8861a">−</text>
  <line x1="107" y1="58" x2="146" y2="58" stroke="#5b6b69" stroke-width="2" marker-end="url(#ar-loop)"/>
  <rect x="148" y="36" width="120" height="44" rx="8" fill="#f3efe6" stroke="#0b3b39" stroke-width="1.5"/>
  <text x="208" y="62" text-anchor="middle" font-size="13" font-weight="700" fill="#0b3b39">PID controller</text>
  <line x1="268" y1="58" x2="300" y2="58" stroke="#5b6b69" stroke-width="2" marker-end="url(#ar-loop)"/>
  <rect x="302" y="36" width="104" height="44" rx="8" fill="#f3efe6" stroke="#0b3b39" stroke-width="1.5"/>
  <text x="354" y="62" text-anchor="middle" font-size="13" font-weight="700" fill="#0b3b39">Actuator</text>
  <line x1="406" y1="58" x2="438" y2="58" stroke="#5b6b69" stroke-width="2" marker-end="url(#ar-loop)"/>
  <rect x="440" y="36" width="110" height="44" rx="8" fill="#f3efe6" stroke="#0b3b39" stroke-width="1.5"/>
  <text x="495" y="62" text-anchor="middle" font-size="13" font-weight="700" fill="#0b3b39">Process</text>
  <line x1="550" y1="58" x2="640" y2="58" stroke="#5b6b69" stroke-width="2"/>
  <text x="592" y="48" font-size="12" fill="#5b6b69">measurement</text>
  <line x1="620" y1="58" x2="620" y2="150" stroke="#5b6b69" stroke-width="2"/>
  <line x1="620" y1="150" x2="92" y2="150" stroke="#5b6b69" stroke-width="2"/>
  <rect x="300" y="130" width="110" height="40" rx="8" fill="#fff" stroke="#0b3b39" stroke-width="1.5"/>
  <text x="355" y="155" text-anchor="middle" font-size="13" font-weight="700" fill="#0b3b39">Sensor</text>
  <line x1="92" y1="150" x2="92" y2="75" stroke="#5b6b69" stroke-width="2" marker-end="url(#ar-loop)"/>
</svg>

As long as the deviation exists, the system corrects. This is **feedback control** (*closed loop*).

## Open loop, closed loop

- In **open loop**, you command without checking the result: you set heating to 50% and hope. If a window opens, no one corrects.
- In **closed loop**, you measure continuously and adapt: if the temperature drops, the controller raises the heating by itself.

The closed loop is what makes a process **robust** against disturbances.

## The PID controller

The most widespread controller is the **PID** (Proportional-Integral-Derivative). From the deviation $e(t) = \text{setpoint} - \text{measurement}$, it computes the command:

$$u(t) = K_p\, e(t) + K_i \int_0^{t} e(\tau)\,d\tau + K_d\, \frac{d\,e(t)}{dt}$$

Three reactions add up:

- **Proportional ($K_p$)**: the larger the deviation, the harder the correction. Immediate, but leaves a small residual error.
- **Integral ($K_i$)**: accumulates the deviation over time to erase that residual error. A patient reaction.
- **Derivative ($K_d$)**: anticipates by looking at the rate of the deviation. Damps the jolts.

Tuning a PID means balancing **speed** and **stability**: you typically aim for an overshoot below **10–20%** and a fast return to setpoint, with no sustained oscillation. Methods like **Ziegler-Nichols** or *lambda tuning* give a first set of gains, then refined on the real process. A badly tuned PID oscillates; well tuned, it holds tight.

## Where you find them

Loops run everywhere: in a controller ([PLC](/en/glossary#term-plc)), a distributed control system ([DCS](/en/glossary#term-dcs)), a simple thermostat. A large process unit has **hundreds to thousands** of them, interacting — hence the challenge of decoupling and anti-windup.

A key safety point: a control loop **drives** the process, but it does not **protect** it. Protection belongs to a separate system, the safety instrumented system ([from risk to SIL](/en/learn/safety/du-risque-au-sil)). You never entrust safety to the loop that drives.
