Compare (input instruction)

GRT: Greater Than

Passes power while A is greater than B.

Also called: compare, greater than, >.

GRT(a, b)

What it does

A compare instruction sits in the rung exactly where a contact would, and behaves like one: it either passes power or it does not. The difference is that it is testing a number rather than a bit.

Comparisons are how analog values become logic. A level transmitter gives you a number; GRT is what turns that number into a pump start.

Both sides can be a tag or a constant, which means you can compare a process value against a fixed limit or against another tag such as an operator setpoint.

A rung you can run

Start a pump on high level, stop it on low, with hysteresis

[object Object]
GRT(Tank_Level,800)OTL(Pump_Run)
LES(Tank_Level,200)OTU(Pump_Run)
XIC(Pump_Run)OTE(Pump_Output)

Two different thresholds and a latch. The pump starts above 800 and does not stop until the level falls below 200, so a level hovering near one number cannot make it chatter.

Run this rung in the simulator

What it is called on other controllers

PlatformEquivalent
Rockwell (Studio 5000)GRT
Siemens (TIA Portal)CMP >
Mitsubishi (GX Works)> compare
CODESYS and IEC 61131-3GT

Common mistakes

  • Using a single comparison where the process needs hysteresis. A pump started by GRT(Level, 80) and stopped by LES(Level, 80) will chatter every time the level sits near 80. Use two different thresholds, or latch the state.
  • Comparing a timer accumulator against a preset when the timer's own .DN bit already says the same thing more cheaply and more clearly.

Practise it

Interactive exercises that use GRT. Each one checks your ladder against a real scan.

Related instructions

All ladder logic instructions