PLC Compare Instructions

Compare instructions are used to compare the two numeric values or two tags which are numerical data types (like Integer(INT), Float (or) Real, DINT).

Refer the following diagram of the Tank Level measurement system and we are going to see how to generate the High-Level Alarm (HAL) and Low-Level Alarm (LAL) by using Ladder Logic.

Tank Level measurement

In the above example LT level transmitter used to measure the tank level, HSP is a high-level setpoint and LSP is a low-level setpoint (Setpoint is the input given/set by the operator).

Ladder Logic for to generate Tank Level alarms
Rung1 – High-Level Alarm Logic (HAL)
Rung2 – Low-Level Alarm Logic (LAL)

A and B are the Inputs and OUT is the output/result of the compare instruction. The Compare instruction activates the output to a Logic high state when the inputs A and B are satisfying the instruction’s condition.

Refer Rung1- In this logic compare instruction uses “>=” (Greater than or Equal to) condition. So when LT101 value is greater than or equal to HSP value, the output of the block OUT activates HAL to logic high state.

Refer Rung2 – This ladder logic activates the tag LAL to logic high state when LT101 value is less than or equal to LSP value.

Similary, PLC Ladder logic has the following compare instructions,

  • GRE (or) > – Greater than
  • LES (or) < – Less than
  • EQU (or) = – Equal to
  • NEQ (or) != – Not equal to
  • LIM – Limit

LIM (Limit)

The LIM (Limit) is one of the types of Compare instructions, It is used to compare one tag value between two limits, i.e., this LIM instruction is the combination of GRE and LES instruction. Refer the following diagram,

Limit Instruction

Above Limit instructions activates the Output to logic high state when LT101 value is from 21 to 39.

Note: Inputs to the compare instructions are Numerical data type (like INT, FLOAT, DINT, etc.,) and the output from the instruction is the BOOL or BIT data type


Comments

Leave a Reply

Discover more from See!tHow

Subscribe now to keep reading and get access to the full archive.

Continue reading