You are on page 1of 4

Instrumentation Tools

Learn Instrumentation and Control Engineering. Inst Tools covers topics of Industrial
Instrumentation, PLC, DCS, SCADA, Field Instruments, Analyzers and so on.
https://instrumentationtools.com

Author: Instrumentation Tools

Categories: PLC Tutorials

PLC Data Comparison Instructions

om
s .c
ol
To
i on
at
nt
me
ru
st
In

As we have seen with counter and timers, some PLC instructions generate digital values other
than simple Boolean (on/off) signals. Counters have current value (CV) registers and timers
have elapsed time (ET) registers, both of which are typically integer number values. Many other
PLC instructions are designed to receive and manipulate non-Boolean values such as these to
perform useful control functions.

The IEC 61131-3 standard specifies a variety of data comparison instructions for comparing two
non-Boolean values, and generating Boolean outputs. The basic comparative operations of
“less than” (), “less than or equal to” (?), “greater than or equal to” (?), “equal to” (=), and
“not equal to” (6=) may be found as a series of “box” instructions in the IEC standard:

InstrumentationTools.com
Instrumentation Tools
Learn Instrumentation and Control Engineering. Inst Tools covers topics of Industrial
Instrumentation, PLC, DCS, SCADA, Field Instruments, Analyzers and so on.
https://instrumentationtools.com

om
s .c
ol
To
i on
at
nt

The Q output for each instruction “box” activates whenever the evaluated comparison function
me

is “true” and the enable input (EN) is active. If the enable input remains active but the
comparison function is false, the Q output de-activates. If the enable input de-de-activates, the
ru

Q output retains its last state.


st

A practical application for a comparative function is something called alternating motor control,
In

where the run-times of two redundant electric motors are monitored, with the PLC determining
which motor to turn on next based on which motor has run the least:

InstrumentationTools.com
Instrumentation Tools
Learn Instrumentation and Control Engineering. Inst Tools covers topics of Industrial
Instrumentation, PLC, DCS, SCADA, Field Instruments, Analyzers and so on.
https://instrumentationtools.com

om
s .c
ol
To
i on
at
nt
me
ru
st
In

.In this program, two retentive on-delay timers keep track of each electric motor’s total run time,
storing the run time values in two registers in the PLC’s memory: Motor A runtime and Motor B
runtime. These two integer values are input to the “greater than” instruction box for
comparison. If motor A has run longer than motor B, motor B will be the one enabled to start up
next time the “start” switch is pressed.

InstrumentationTools.com
Instrumentation Tools
Learn Instrumentation and Control Engineering. Inst Tools covers topics of Industrial
Instrumentation, PLC, DCS, SCADA, Field Instruments, Analyzers and so on.
https://instrumentationtools.com

If motor A has run less time or the same amount of time as motor B (the scenario shown by the
blue-highlighted status indications), motor A will be the one enabled to start. The two series-
connected virtual contacts OUT motor A and OUT motor B ensure the comparison between
motor run times is not made until both motors are stopped. If the comparison were continually
made, a situation might arise where both motors would start if someone happened to press the
Start pushbutton with one motor is already running.

Also Read : PLC Math instructions

om
Credits : by Tony R. Kuphaldt – under the terms and conditions of the Creative Commons

.c
Attribution 4.0 License

s
ol
To
i on
at
nt
me
ru
st
In

InstrumentationTools.com
Powered by TCPDF (www.tcpdf.org)

You might also like