Compare (input instruction)

GEQ: Greater Than or Equal

Passes power while A is greater than or equal to B.

Also called: greater than or equal contact, compare contact, >= test.

GEQ(a, b)

What it does

GEQ is a contact, not an output. It sits on the condition side of the rung with the contacts, and it passes power for as long as the comparison holds. Either side can be a tag or a fixed number, so GEQ(Tank_Level, 800) and GEQ(Tank_Level, High_Setpoint) are both normal.

The only thing separating GEQ from GRT is what happens at the boundary. Use GEQ when landing exactly on the target counts as arriving: a fill that must reach 750 units is finished at 750, and GRT would sit there waiting for a 751 that may never come. That single choice is the most common off-by-one in ladder logic.

Compares are level sensitive, not edge triggered. A GEQ that is true stays true every scan for as long as the numbers say so, which is what you want for a permissive and what catches people out when they expected it to fire once.

A rung you can run

Fill to the target, not one unit over

RUNG 1Fill_Actual≥ Fill_TargetFill_DoneRUNG 2Fill_DoneFill_EnableFill_Valve
GEQ(Fill_Actual,Fill_Target)OTE(Fill_Done)
XIO(Fill_Done)XIC(Fill_Enable)OTE(Fill_Valve)

The valve is open while the fill is not done. The instant Fill_Actual reaches Fill_Target, and not one unit later, GEQ passes power, Fill_Done comes on and the valve rung drops out. Set Fill_Target from the tag panel, then drive Fill_Actual up and watch it change over at exactly the target.

Run this rung in the simulator

What it is called on other controllers

PlatformEquivalent
Rockwell (Studio 5000)GEQ
Siemens (TIA Portal)The comparator box, set to CMP >=
Mitsubishi (GX Works)LD>= / AND>= / OR>=
CODESYS and IEC 61131-3GE, or >= in structured text

Common mistakes

  • Reaching for GRT when the target value itself should count. On a fill, a batch count or a position, the machine then waits for a value it may never hit exactly, and the fault looks like a stuck sensor rather than a wrong instruction.
  • Comparing a raw analog value with no deadband. A noisy level sitting near the threshold crosses it repeatedly and the output chatters. Latch the result, or turn the comparison off with a second one at a slightly different value.

Practise it

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

Related instructions

All ladder logic instructions