Comparators & Deadband Logic

A controller lives in two worlds at once. Sensors hand it numbers — a space temperature, a duct pressure, a valve position — and equipment mostly wants decisions: run or don't, open or close, alarm or stay quiet. The block that carries a value across that gap is the comparator, and it looks so simple — is A bigger than B? — that it's easy to miss the trap inside it. This page is one question, start to finish: how does a number become a decision — and why does a single threshold chatter?

This page assumes you can read a sheet at the block level — pins, wires, and the scan. That's Function-Block Basics, the opening lesson of this chapter. The TRUE/FALSE side of the story — what AND, OR, and a latch do with a comparator's answer — has a lesson of its own in this chapter, on boolean logic and latches; you don't need it first, but the two pages are neighbors.

The comparator family: number in, decision out

A comparator takes two analog values in on blue wires and puts one digital answer out on a green-or-grey one. That's the whole block — and it's the bridge every threshold decision in a building crosses. Start cooling when the space is too warm. Trip the alarm when the static is too high. Enable the economizer when outdoor air is cooler than return air. Each of those sentences has a number on one side, a decision on the other, and a comparator in the middle.

The family has four workhorses — greater-than, less-than, and their boundary-included twins — plus an equals pair you'll reach for far less often than you'd think:

BlockReads asTypical job
A > BTRUE above the linehigh alarms, stage-up checks, a cooling call
A < BTRUE below the linelow alarms, freeze protection, changeover
A ≥ B · A ≤ Bsame, boundary includedinterchangeable with > / < on measured values
A = B · A ≠ Bequal (within a tolerance)discrete values only — modes, counts, whole-number points

About that third row: on paper, A > B and A ≥ B differ in exactly one case — when the two values are precisely equal. On a real measured value, that case is a knife-edge. A space temperature is a float wandering through a continuum; the moment it sits at exactly the setpoint is one value out of infinitely many, and even if a scan happens to catch it there, the next scan won't. In the field, swapping > for changes nothing you could ever observe. What actually matters about a comparator is its direction — which side of the line reads TRUE — and where you draw the line. Spend your attention there.

The equals row deserves its own warning, because EQ on an analog value is a trap. A measured temperature is never exactly 72.0 — partly because the value never holds still, and partly because of how computers store decimals: two routes to "the same" number (say, a setpoint typed as 72.0 and a value computed as 71.999999…) can differ out in the far decimal places, so a bit-exact equality test fails even when every display in the building shows 72.0. This site's Function-Block Editor builds the guard in: its A = B block actually asks "are these within a tiny tolerance of each other?", not "are the bits identical?" — and production palettes do the same, or hand you a tolerance parameter. Even with the tolerance, an equality on a moving measurement is a decision that's true for a scan or two while the value passes through — not something to hang a sequence on. Save EQ for values that are genuinely discrete: a mode number, a stage count, a whole-number software point.

Chatter: one threshold is a trap

So wire the obvious thermostat: space temperature into A, a 74 °F setpoint into B, and A > B drives the cooling call. It even works — until the space temperature arrives. Cooling runs, the temperature falls to the setpoint, the comparator goes FALSE, cooling stops, the temperature drifts up a fraction, TRUE again. Now add what a real analog input looks like up close: a little noise, a sensor resolution step, a value that jitters a few tenths of a degree scan to scan. With the temperature riding the line, that jitter re-answers the question differently every few scans — and the sheet evaluates several times a second. The output doesn't cycle; it chatters.

Here's the part that makes this a trap rather than a corner case: a controlled variable spends its life near its setpoint — that's what control means. Put a single threshold at the setpoint and you've guaranteed the value will hover exactly where the comparator is most unstable. And the output isn't a number on a screen. If it's a compressor call, every flip is a contactor pulling in and dropping out — arcing the contacts toward an eventual weld — and a compressor start with locked-rotor inrush through windings that never get a rest, oil that never returns, pressures that never equalize. A compressor is rated for a handful of starts an hour; a chattering threshold can demand ten a minute. Real equipment carries anti-short-cycle timers as a last line of defense against exactly this, and minimum on/off timing gets a lesson of its own later in this chapter — but a sequence that leans on the safety timer to clean up its own chatter is a sequence with a bug in it.

The picture below is the whole problem in one glance. The blue trace is a space temperature drifting up through the band and back down, with honest sensor noise on it. Below it, the same signal put through two different decisions: a single A > B at the setpoint, and the two-line set/reset pair the next section builds. Same input, same noise — one output chatters at every crossing, the other switches exactly twice.

One threshold chatters; a deadband switches clean Three aligned traces. The top trace is a noisy space temperature drifting up through a setpoint and back down. Horizontal reference lines mark the setpoint plus two band edges half a band above and below it. The middle trace is the output of a single greater-than comparator at the setpoint: it flips rapidly back and forth each time the noisy temperature crosses the setpoint — a burst of chatter on the way up and another on the way down. The bottom trace is the deadband output — set above the upper edge, reset below the lower edge, latched in between: it switches on exactly once as the temperature crosses the upper edge and off exactly once as it falls below the lower edge. Same input, two switches instead of many. set line — SP + ½ band single threshold (SP) reset line — SP − ½ band TEMP SINGLE GT AT SP SET / RESET BAND + LATCH flips with every noise wiggle one start, one stop — noise absorbed ON OFF ON OFF time → same noisy input: the single threshold flips eight times, the set/reset pair twice — once on at the set line, once off at the reset line

Read the middle trace against the top one. Every burst of chatter sits exactly under a place where the noisy temperature is crossing the setpoint — the comparator isn't broken, it's answering the question it was asked, several times a second, about a value that keeps changing its mind by a tenth of a degree. The bottom trace ignores all of it: nothing happens until the temperature commits to the upper line, and nothing un-happens until it commits to the lower one. The gap between those two lines is the deadband, and building it takes exactly three blocks.

Building the deadband: two comparators and a latch

The fix splits the one line into two, with memory in between. Turn on above the setpoint plus half a band. Turn off below the setpoint minus half a band. In between — stay put. The "stay put" is the giveaway that plain comparators can't do this alone: between the lines, neither condition is true, so something has to remember which side of the story it's in. That something is an SR latch — the one boolean block with memory. (What a latch is, why safeties lean on it, and what happens when set and reset collide is this chapter's boolean-logic lesson; here the latch just does its day job.)

The Function-Block Editor ships this exact sequence as its cooling thermostat example, and it's worth walking wire by wire. Three sources on the left: the space temperature (an analog input), a setpoint constant of 74 °F, and a deadband constant of 1 °F — read the sheet's plain numbers as °F. An ADD and a SUBTRACT build the two lines from them: SP + DB = 75 °F and SP − DB = 73 °F. A greater-than watches for the temperature above the upper line and fires the latch's S; a less-than watches for it below the lower line and fires R; the latch output drives the cooling call. Here's the sheet at the moment the space has warmed to 76 °F:

The deadband thermostat as a wiresheet A function-block sheet with nine blocks. Three sources on the left: a space-temperature analog input reading 76, a setpoint constant of 74, and a deadband constant of 1. An ADD block computes setpoint plus deadband, 75; a SUBTRACT block computes setpoint minus deadband, 73. A greater-than comparator tests the temperature against 75 and currently reads TRUE; a less-than comparator tests it against 73 and reads FALSE. The greater-than output wires into the SR latch's set input, the less-than output into its reset input, and the latch output — TRUE — drives a binary output labeled COOL, on. Analog wires are blue; the true digital wires are green; the false one is grey. CONSTANT SP 74 ANALOG IN TEMP 76 CONSTANT DB 1 ADD SP + DB = 75 SUBTRACT SP − DB = 73 A > B 76 > 75 → TRUE A < B 76 < 73 → FALSE S R SR LATCH Q = TRUE BINARY OUT COOL ON warm past 75: the greater-than fires SET and cooling latches ON — it will hold, straight through the band, until TEMP falls below 73

Blue wires carry an analog value; green wires carry a TRUE digital signal, grey wires FALSE — the same coloring the editor uses live.

Now run the story forward. Cooling pulls the space back down through 75 °F — the greater-than drops to FALSE, and nothing happens, because a latch that isn't being set or reset simply holds. Down through the setpoint, still on. Only below 73 °F does the less-than fire R and drop the call. Inside the band, both comparators are FALSE and the latch's memory is the deadband — the sheet's answer to "stay put." The noise that flipped the single threshold eight times in the diagram above never comes close to a line 1 °F away, so the equipment cycles at the speed of the building, not the speed of the noise.

One number to be careful with: the DB constant here is half the band — it's applied once up and once down, so the space actually swings 2 °F from set to reset. Vendors split on this. Some deadband parameters mean the full width, some the half; copy a value between platforms without checking and you've silently doubled or halved the band. Read the block's documentation — or better, do what this sheet does and build the edges in the open where you can see them.

And here's a bonus the construction hands you for free. Swap the two wires into the latch — under-temperature fires S, over-temperature fires R — and the same nine blocks are a heating thermostat: the call rises when the space is cold, drops when it's warm. That's the whole difference between direct-acting control (output follows the measurement up — cooling) and reverse-acting control (output rises as the measurement falls — heating). The comparators don't change; only which one sets and which one resets. The editor ships both thermostats as a pair for exactly this reason.

How wide should the band be? It's a trade, and it's the same trade at every scale. Narrow means tight comfort and busy equipment; wide means the equipment rests and the occupants ride the swing. A room thermostat usually lands around 1–2 °F of total band; but zoom out and the pattern repeats — the equipment-staging lesson's stage-up and stage-down thresholds are this exact construction at plant scale, where the gap between them is a deliberate deadband that keeps a whole pump plant from hunting. And when the equipment can modulate instead of switch, the cleanest answer is to stop drawing lines altogether and close a PID loop around the setpoint instead.

One last note for the day you meet this in a real palette: most production environments bundle the whole thing into a single deadband or hysteresis comparator — one block, a setpoint, a band, chatter-free output. Use it; that's what it's for. But now you know what's inside the box: two lines and a memory. When a bundled block misbehaves — or when a palette doesn't have one — you can build it, and more importantly you can read one when you find it built out in the open on someone else's sheet.

Walk the band yourself

The whole lesson is sitting in the Function-Block Editor, running. Load the cooling thermostat example, click the TEMP block, and walk its value up in the inspector: 74 — nothing. 74.9 — nothing. Above 75 — the greater-than wire goes green and the call latches on. Now walk it back down and watch where it lets go: not at 75, not at 74, only below 73. Set and reset firing at different values is the deadband, live on the wire. Then load the heating thermostat and hunt for what changed — the blocks are identical; only the two wires into S and R have traded places.

Open the Function-Block Editor →
← Back to Education