Blog
PID Control Explained Simply: Why a Valve Overshoots, Hunts or Settles
PID control explained simply: how proportional, integral and derivative decide how hard a BMS pushes a valve, and why sloppy tuning makes a room keep swinging.

Part 5 of 16 in Cobler's Building Automation and BMS Fundamentals course. New here? See the course page.
Say the air leaving AHU-12A's cooling coil is 2 °C warmer than we want. Should the controller open the chilled water valve a little, or all the way? Open it too much and the temperature overshoots and swings. Open it too little and it never quite gets there.
The usual answer is a calculation called PID control. So here's PID control explained simply, with no calculus, on one loop on AHU-12A.
Think of steering a car. A small drift towards the lane line gets a small turn of the wheel, and a big drift gets a bigger one. A building controller makes that same kind of decision many times a minute.
The real loop on AHU-12A
First, a switch. In Parts 1 and 4 the valve held the return air at 24 °C, to keep the first examples simple. From now on we'll use the loop AHU-12A really runs:
- A fan blows air across a coil filled with chilled water. The cooled air, called supply air, goes out to the floor.
- A sensor measures the supply air temperature.
- The controller compares it with a setpoint of 14 °C and positions the chilled water valve. More open means more chilled water and colder supply air.
The variable air volume (VAV) boxes on the floor then look after each room's own 24 °C target. Part 13 covers them.
The gap between the setpoint and the measurement is the error, with the same sign convention as Part 4:
$$\text{error} = \text{setpoint} - \text{measured value}$$
So if the supply air is 16 °C and the setpoint is 14 °C, the error is 14 − 16 = −2 °C. The minus sign means "too warm", and a too-warm error opens the chilled water valve further.
Worth knowing: some controllers use measured value minus setpoint for cooling, so "too warm" comes out positive. The sign only sets the direction. What matters is that "too warm" opens the valve.
So how does the controller turn that −2 °C into a valve position? PID asks three questions about the error, one for each letter:
- P, proportional: how big is the error right now?
- I, integral: how long has the error lasted?
- D, derivative: how fast is the error changing?
The controller adds the three answers to get the valve command. Let's take them one at a time.
Proportional control
Proportional control moves the valve in proportion to the error. A bigger error gives a bigger opening, and as the error shrinks, the valve closes back by the same rule. That's our steering wheel.
The setting that decides how strongly it reacts is the gain. As an illustration, say AHU-12A's controller opens the valve 50% for every 1 °C of error:
- 1 °C too warm asks for 50% open.
- 0.2 °C too warm asks for 10% open.
That sounds perfect, but proportional control alone has one weakness. It leaves a small, permanent gap between the setpoint and the measurement.
Why? Because the coil always needs some chilled water. Warm air from the floor and fresh air from outside keep arriving, so the valve must stay partly open. But with proportional control, only the error holds the valve open. At zero error it would ask for 0%, the coil would warm up, and the error would come back.
So the loop settles where the error is just big enough to hold the valve where the coil needs it. Say the coil needs the valve about 30% open. With a gain of 50% per degree, the error settles at 0.6 °C, so AHU-12A holds 14.6 °C, not 14.0 °C.
Engineers call this leftover gap offset, or sometimes "droop". A higher gain makes the offset smaller, but too high a gain makes the loop swing, as we'll see shortly.
Integral control
So how do we close that last 0.6 °C? Well, what if the controller remembered how long the air had been too warm? Integral control does exactly that.
It keeps a running total of the error over time. While the supply air sits 0.6 °C too warm, the total grows, and the integral part keeps adding a little more valve opening. It stops adding only when the error is zero, so it pushes the supply air all the way down to 14.0 °C.
It's like a person thinking, "it's been slightly too warm for ten minutes now, so I'll open the valve a bit more".
Proportional and integral together are called PI control:
- Proportional reacts quickly to the size of the error.
- Integral removes the offset, so the loop lands on the setpoint.
Most temperature, pressure and flow loops in buildings run on PI control.
But integral can cause trouble too. If its total builds up too quickly, it keeps opening the valve after the supply air has reached 14 °C. That big total takes time to run down. So the supply air overshoots below the setpoint, and the loop has to correct back the other way.
Derivative control
That overshoot is what the third letter tries to stop. Derivative control looks at how fast the error is changing, not how big it is. Its job is to see what's coming.
Think about parking a car. You brake before the bumper touches the wall, because you can see the gap closing fast. In the same way, if the supply air is falling fast towards 14 °C, the derivative part eases the valve back early.
So why don't more building loops use it? There are two reasons:
- It reacts to sensor noise. A sensor reading always wobbles a little, and derivative control turns every wobble into a valve movement. The valve twitches.
- Most building loops change slowly. Air, water, ducts and concrete take minutes to warm up or cool down, so there's little sudden change to anticipate.
So despite the name, most building loops are P or PI, and full PID is the exception:
- P only is simple and quick, but leaves an offset. It's fine where a small, steady error doesn't matter.
- PI is the standard for most building air-conditioning loops. It removes the offset.
- Full PID is kept for a few faster loops, such as some pressure or flow loops.
Hunting
Now, what happens when the settings are wrong? Hunting means a loop that keeps swinging above and below its setpoint in a steady wave, instead of settling. On AHU-12A, the valve opens wide, closes, then opens wide again, and the supply air rises and falls around 14 °C every few minutes.
The usual cause is tuning that's too aggressive. The controller reacts so strongly that it pushes the temperature past the setpoint, then pushes it back past again. Too high a gain, or an integral that builds up too quickly, can do it.
It's like a driver who over-corrects at every lane line and weaves down the road.
And hunting costs more than comfort. Every swing drives the valve actuator, the small device from Part 2 that moves the valve. Its gears, linkage and valve seat wear out much sooner, and across hundreds of loops that becomes a real maintenance cost.
Worth knowing: other faults, such as a valve that sticks and then jumps, can make a trend look similar. Part 8 shows how to tell them apart.
Trends and tuning
So how do we see what a loop is doing? A trend is a graph of a point's value over time, recorded by the building management system (BMS). If we plot the supply air temperature against the 14 °C setpoint, the shape tells us a lot.

Four ways AHU-12A's supply air loop can respond when the load rises. Each shape points to a different tuning setting (illustrative traces).
- P only, with offset. It settles quickly but stays flat just above the setpoint, around 14.6 °C. The fix is to add integral action.
- PI, too gentle (sluggish). It creeps towards 14 °C very slowly. On a hot afternoon the load changes before it catches up, so it may never get there.
- PI, well tuned. It comes down promptly, may dip below the setpoint once, then holds flat on 14 °C.
- PI, too aggressive (hunting). It overshoots, swings back past the setpoint, and keeps swinging in a regular wave.
It helps to plot the valve position on the same graph. In a hunting loop, the valve swings in step with the temperature.
Choosing the gain and the integral setting for each loop, plus the derivative if it's used, is called tuning. We're balancing two opposite failures:
- Too aggressive: the loop overshoots and hunts. Comfort is unsteady and the actuator wears out.
- Too gentle: the loop is sluggish. People say the floor is stuffy even though the controller is "working".
Good tuning is quick enough to reach the setpoint and calm enough to stay there. There's no single right setting, because a small VAV box responds in seconds while a chilled water plant takes many minutes.
So loops are tuned during commissioning, one at a time. Someone changes the setpoint, watches the trend, and adjusts the settings until the loop settles cleanly.
Try it
That's also why "the temperature keeps swinging" or "the floor never cools down" is often a tuning problem, not broken hardware. The sensor, valve and controller can all be healthy while the settings are wrong. Still, check the sensor and the valve before retuning, because a faulty one can look like a tuning problem.
Retuning loops so they settle, and making controllers work together instead of against each other, is part of automation and controls work.
Many loops at once
So now one loop holds one value well. But a building runs many loops at once, and they have to start, stop and hand over in the right order.
When should AHU-12A start? What has to be true before its loops may run, and what should it do when a part fails? The building writes all that down in a plan, in Part 6: What Is a Sequence of Operation in a BMS?
Check your understanding
1. AHU-12A's supply air loop uses proportional control only. It settles at 14.6 °C with a 14 °C setpoint. Why, and what would remove the gap?
Show the answer
The coil needs the valve partly open all the time, and with proportional control only the error holds it open. So the loop settles where the error is just big enough to keep the valve where the coil needs it, here 0.6 °C.
Adding integral action removes the gap, because the integral part keeps adding valve opening for as long as any error remains.
2. A trend shows the supply air swinging above and below 14 °C every few minutes, with the valve swinging open and closed in step. What's the most likely cause, and why does it matter?
Show the answer
The loop is hunting, most likely because its tuning is too aggressive, with too high a gain or too fast an integral. Comfort is unsteady, and the constant movement wears out the valve actuator.
The usual fix is to retune the loop more gently, after checking that the sensor and valve work properly.
Recap
- PID turns the error (setpoint minus measured value) into a valve command by asking three questions.
- Proportional reacts to how big the error is, but on its own it leaves an offset.
- Integral reacts to how long the error has lasted, and removes the offset.
- Derivative reacts to how fast the error is changing, and is usually switched off on slow temperature loops.
- Most building loops are P or PI. A loop tuned too aggressively hunts, and one tuned too gently is sluggish.
- Loops are tuned at commissioning by watching their trends.
Go deeper on video (optional)
This short video shows the three parts of PID acting on a valve loop, which matches the P, I and D sections above. It's optional.
For a more mathematical treatment of the same idea, see feedback control and PID explained. You don't need it for this course.
This is Part 5 of 16 in Cobler's Building Automation and BMS Fundamentals course. Previous: How Control Loops Work: Setpoints, Feedback and Closing the Loop. Next: What Is a Sequence of Operation in a BMS?.
Cobler builds CobiNeural, a platform that shows a facility team its building's energy, water and indoor air data as live numbers across the whole site. To see how your building performs, talk to us.
FAQ
Frequently asked questions
PID stands for proportional, integral and derivative. These are the three parts of the calculation a controller uses to decide how far to open or close a valve or damper. Proportional reacts to how big the error is right now. Integral reacts to how long the error has lasted, and derivative to how fast it is changing. Most building HVAC loops use only P or PI, because temperatures in buildings change slowly.
Hunting means a loop keeps swinging above and below its setpoint in a steady, repeating wave instead of settling. It is most often caused by tuning that is too aggressive: the controller reacts too strongly, pushes past the setpoint, then over-corrects the other way. Besides making the temperature swing, the constant movement wears out the valve actuator early. The usual fix is to retune the loop more gently, after checking that the sensor and valve are working properly. A sticking valve can cause a similar pattern.
P (proportional) control alone reacts quickly but leaves a small permanent gap, called offset, so the temperature settles slightly away from the setpoint. Adding I (integral) removes that offset over time, which is why PI is the standard for most building control loops. Adding D (derivative) helps anticipate fast changes and reduce overshoot. But it also reacts to sensor noise, so full PID is kept for the few faster loops that need it.
Ask us about this topic
Something in this article you want to dig into — or a situation in your own building it doesn't quite cover? Send us your question. We don't run public comments; the team replies to you directly by email.


