PID loops in HVAC: what P, I and D really do, and how to tune them on site
A practical look at proportional, integral and derivative control in building services, why loops hunt, and a tuning method that works on real plant.
Hold the supply air at 18 °C. Keep the flow temperature at 70. Keep the duct at 250 Pa. Most of what a BMS does is loops like these, and nearly all of them use some form of PID control. When a loop is set up properly you never think about it. When it isn’t, the valve swings open and shut all day and somebody rings to say the office is freezing, then roasting, then freezing again.
The basics
Every loop has four things: a setpoint (what you want), the measured value from the sensor, the error (the gap between them) and an output, usually 0–100%, going to a valve, damper or fan.
The loop also has an action. A heating valve is reverse acting: as the temperature drops, the output goes up. A cooling valve is direct acting: as the temperature rises, the output goes up. Get that backwards and the valve drives fully open and sits there. It sounds obvious, but it catches people out at commissioning more often than you’d think.
Proportional
The P term moves the output in proportion to the error. HVAC controllers usually describe it as a proportional band: how far the temperature has to drift from setpoint before the output reaches 100%.
Say you’ve got a heating loop with an 18 °C setpoint and a 4 K proportional band:
| Supply air | Error | Output |
|---|---|---|
| 18 °C | 0 K | 0% |
| 17 °C | 1 K | 25% |
| 16 °C | 2 K | 50% |
| 14 °C | 4 K | 100% |
Now look at what that means in practice. If the coil needs the valve at 50% to hold temperature on a cold day, the air has to sit 2 K below setpoint to produce that 50%. P-only control always leaves a gap like this, called offset. Narrow the band and the offset shrinks, but the loop gets jumpier and eventually starts to oscillate.
Some controllers talk about gain instead of a band. They’re two ways of saying the same thing: a higher gain is a narrower band.
Integral
The I term keeps pushing the output for as long as there’s an error, until the error is gone. That’s what gets rid of offset. It’s set as an integral time (sometimes called reset time). Shorter means more aggressive.
Set it too long and the loop takes forever to get to setpoint. Set it too short and it overshoots, swings back, overshoots again.
The thing to watch with integral is windup. If the loop keeps integrating while the plant can’t respond, because the fan’s off, the boiler’s disabled or the valve is already wide open, the integral term builds up a huge value. When the plant finally starts, the output stays pinned at 100% long after it should have backed off, and you get a big overshoot. If an AHU overshoots badly every morning at start-up, check whether its loops keep running while the unit is off. Good strategies reset or hold the loop when the plant isn’t running.
Derivative
D reacts to how fast the error is changing, which in theory damps the response. In HVAC it mostly just amplifies sensor noise into a twitchy output. The vast majority of building services loops run as PI with derivative set to zero, and that’s normally the right call.
Fast loops and slow loops
Different processes respond at completely different speeds, and the tuning has to suit them. A duct static pressure or water differential pressure loop reacts within seconds. Supply air temperature takes tens of seconds to a couple of minutes. A mixing circuit flow temperature is a minute or more. A room temperature can take many minutes to show any change at all.
So don’t copy the settings from a pressure loop onto a room temperature loop, or the other way round. One will be hopelessly sluggish and the other will never settle.
Cascade loops
A lot of AHUs use two loops in cascade. The outer loop looks at room or extract temperature and works out what the supply air temperature should be, within limits like 14–28 °C. The inner loop then drives the valves to hit that supply temperature.
For that to work, the inner loop has to be clearly faster than the outer one. Tune them to similar speeds and they end up fighting each other.
How I’d tune a loop on site
There are textbook methods, but this is what works on real building services plant:
- Get a trend running first. Log the setpoint, measured value and output at a short interval. For temperature loops, every 10 to 30 seconds is about right. Tuning without a trend is just guessing.
- Check the basics before touching any numbers. Is the action right? Is the sensor reading sensibly? Does the valve or damper actually move through its full stroke?
- Start with P only and a wide band. Turn integral off or make it very long, and set derivative to zero.
- Narrow the band in steps. Bump the setpoint after each change. When the loop starts oscillating steadily, roughly double the band from that point.
- Bring in integral, starting long. Shorten it gradually until the offset clears in a reasonable time without overshooting much.
- Test it. Move the setpoint a couple of degrees, or wait for a natural load change, and watch the trend. A small overshoot that settles quickly is what you’re after.
- Write the final values down on the commissioning sheet, so the next person doesn’t start from scratch.
When it isn’t the tuning at all
Plenty of loops hunt for reasons no amount of parameter tweaking will fix. The usual suspects:
- an oversized valve with poor authority, so nearly all the control happens in the first few per cent of travel (there’s a worked example in sizing control valves)
- a sensor in the wrong place, such as right against a coil, in a dead leg or in the sun
- an actuator that’s too slow for the loop
- overlapping sequences, where heating and cooling, or heat recovery and heating, act at the same time
- worn mechanics: sticking valves, slipping damper linkages, tired actuators
A good rule of thumb is this. If the trend shows the output moving nice and smoothly but the temperature isn’t following it, the problem is in the plant, not the PID.