Vous êtes sur la page 1sur 16

Department of Electrical Engineering

Faculty Member: Dr. Jawad Arif Dated: 19th April, 2020

Semester: 8th Section: B

EE-428: Industrial Process Control

Lab 10: Comparison Instructions

PLO4 PLO5 PLO8 PLO9


Name Reg. No Viva / Analysis Modern Ethics Individua
Quiz / of data Tool and l and
Lab in Lab Usage Safety Team
Performa Report Work
nce
5 Marks 5 Marks 5 Marks 5 Marks 5 Marks
Abdullah Ashfaq 129399

Hamza Azam Malik 192200

Muhammad Ali Haider 179947

Waleed Khan 199345

Hassan Kamran 176530


Exercise 10
Comparison Instructions

EXERCISE OBJECTIVE

• To program and test PLC ladder programs that use comparison instructions.

DISCUSSION

PLC’s have special input instructions that are used to perform comparison
functions. For example, the PLC on your trainer includes the following comparison
instructions:

• Equal (EQU);
• Not Equal (NEQ);
• Less Than (LES);
• Less Than or Equal (LEQ);
• Greater Than (GRT);
• Greater Than or Equal (GEQ).

Each of these instructions compares a pair of arithmetical values. The result of the
comparison determines whether the comparison instruction is true or false.

Suppose, for example, that a GEQ instruction is presented with two values. If the
first value is greater than the second, then the GEQ instruction is logically true.
This causes the rung containing the GEQ instruction to be true, making the
output instruction on this rung true.

Parameters of the Comparison Instructions of the Trainer PLC

With the trainer PLC, the following parameters must be programmed when
entering a comparison instruction:

• Source A: address of the word to be compared against the constant or word


at Source B.

• Source B: constant or address of the word to be compared against the word


at Source A.

Operation of the Comparison Instructions of the Trainer PLC

The Equal (EQU) instruction

This instruction determines whether the values at Sources A and B are equal. If
so, the EQU instruction is true. If not, the EQU instruction is false.
Comparison Instructions

The Not Equal (NEQ) instruction

This instruction determines whether the values at Sources A and B are not equal.
If so, the NEQ instruction is true. If not, the NEQ instruction is false.

The Less Than (LES) instruction

This instruction determines whether the value at Source A is less than the value at
Source B. If so, the LES instruction is true. If not, the LES instruction is false.

The Less Than or Equal (LEQ) instruction

This instruction determines whether the value at Source A is less than or equal to
the value at Source B. If so, the LEQ instruction is true. If not, the LEQ instruction
is false.

The Greater Than (GRT) instruction

This instruction determines whether the value at Source A is greater than the
value at Source B. If so, the GRT instruction is true. If not, the GRT instruction is
false.

The Greater Than or Equal (GEQ) instruction

This instruction determines whether the value at Source A is greater than or


equal to the value at Source B. If so, the GEQ instruction is true. If not, the GEQ
instruction is false.

Using PLC Comparison Instructions to Perform Sequential Control

The PLC comparison instructions can be used in conjunction with counter or


timer instructions to sequentially activate and deactivate PLC outputs. With this
type of ladder program, a comparison instruction is driven by the accumulated
value of a counter or timer instruction. The comparison instruction is activated
when the accumulated value is equal, not equal, greater than, or less than a
constant, depending on the comparison performed.

Procedure Summary

In this exercise, you will program and test three ladder programs: one that uses
an Equal (EQU) instruction, one that uses comparison instructions driven by the
accumulated value of a counter instruction, and one that uses comparison
instructions driven by the accumulated value of a timer instruction. You will then
use the acquired knowledge to create and test your own ladder program.

Note: As earlier mentioned, the manual applies specifically to PLC Trainer


Model 3240-4. If you are using another model, follow the exercise procedure
by adapting it as described below.

8-3
• Model 3240-A, Model 3240-D, or Model 3240-3: Same way as with
Model 3240-4.

• Model 3270-4: Connect an external 24-VDC source to the supply jacks


intended for this purpose at the left bottom of the trainer front panel.
When asked to activate a PLC input, connect the corresponding PLC
input jack to the positive terminal of the 24-VDC source, using a
connection lead. When asked to deactivate a PLC input, remove the lead
between the corresponding PLC input jack and the 24-VDC source. To
determine whether or not a PLC output is activated, observe the PLC
output status indicators on the PLC module.

• Model 9066, connect the DC COM jacks (2) to the DC SUPPLY


OUTPUT negative terminal. To activate a PLC input, connect the
corresponding PLC input jack to the positive terminal of the DC SUPPLY
OUTPUT. To determine whether or not a PLC output is activated, you
can see it on the LCD display default page (if not on this page, press
ESC and select I/O status). To act on a physical device, connect
VAC/VDC jacks to the positive terminal of the DC SUPPLY OUTPUT if
you are are using the two first outputs or connect DC 24 + and DC 24 V -
to the corresponding terminals of the DC SUPPLY OUTPUT to use last
four outputs.

EQUIPMENT REQUIRED

Refer to the Equipment Utilization Chart, in Appendix A of this manual, to obtain


the list of equipment required to perform this exercise.

PROCEDURE

Setting Up the Equipment

G 1. Connect the RS-232 serial port of the computer station to the


communications port of the PLC on the PLC Trainer, using
a 1761-CBL-PM02 cable.

G 2. Turn on the computer and start RSLogix Micro.

Turn on the PLC Trainer.

G 3. In this exercise, you will study the operation of PLC instructions through
observation of the ladder program view, the data files of the processor,
as well as the status of the lamps next to the PLC output jacks on the
trainer front panel.

Note: Since trainer models 3270-4 and 9066 do not have


output lamps, observe the PLC output status LED's on the PLC
module instead.
The EQU Instruction

G 4. Create a new project having the following processor name: EXERC_8.

The project tree of processor EXERC_8 and program file LAD 2 should
be displayed in the RSLogix Micro window. Program file LAD 2 contains
the main ladder program.

The next steps of this procedure consist in entering the ladder program
of Figure 8-1.

Figure 8-1. The Equal (EQU) instruction.

G 5. Select the User category of instructions by clicking the corresponding


instruction category selection tab.

Enter a new rung into program file LAD 2. In this rung, enter
instruction XIC I:0/0. Then, enter instruction CTU C5:0.

You have now finished entering the instructions of rung 0 in the ladder
program of Figure 8-1.

G 6. Select the User category of instructions by clicking the corresponding


instruction category selection tab.

Enter a new rung into program file LAD 2. In this rung, enter an
EQU instruction by performing the following steps:

– Select the Compare category of instructions by clicking the


corresponding instruction category selection tab.

8-4
– Click the Equal button on the instruction toolbar to insert this
instruction in the rung, type: C5:0.ACC, then press the mouse left
button to enter this address for Source A of the EQU instruction. This
address is that of the word containing the accumulated value of
instruction CTU C5:0.
– Double-click Source B within the EQU instruction, type: 5, then
press the mouse left button to accept this constant.
– This completes the parameter setting for the EQU instruction.

Note: You do not have to enter anything in the ? fields below


the values just entered for Sources A and B of the EQU
instruction. These fields will indicate the current values at
Sources A and B when the PLC executes the ladder program
in the Run mode.

Select the User category of instructions and enter instruction OTE O:0/0.

You have now finished entering the instructions of rung 1 in the ladder
program of Figure 8-1.

G 7. Enter a new rung into program file LAD 2. In this rung, enter instruction
XIC I:0/1. Then, enter instruction RES C5:0.

You have now finished entering the instructions of rung 2 in the ladder
program of Figure 8-1.

G 8. Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.

The main ladder program in RSLogix Micro should be identical to that


shown in Figure 8-1.

G 9. Save the project in a project file named EXERC_8.RSS.

G 10. Make sure the system communications are properly configured.

G 11. Download project EXERC_8 to the PLC.

Go online and place the PLC in the Run mode.

G 12. In rung 1 of program file LAD 2, locate the EQU instruction. The
accumulated value of instruction CTU C5:0, which is currently 0, is
indicated below the address specified for Source A.

Activate and deactivate PLC input 0, using one of the toggle switches of
the trainer, until the accumulated value of instruction CTU C5:0 in rung 0
reaches 5.
Is PLC output 0 activated, indicating that the EQU instruction in
rung 1 is true? Why?

Yes, the PLC output 0 is lit because the value of source A is equal to the value of
source B in the EQU instruction.

G 13. Deactivate and activate PLC input 0. The accumulated value of


instruction CTU C5:0 is now 6.

Is PLC output 0 still activated? Why?

No, the PLC output is 0 is OFF because the value of source A is not equal to the
value of Source B.

G 14. Reset instruction CTU C5:0. To do so, activate PLC input 1, using another
toggle switch of the trainer. What happens to the accumulated value of
instruction CTU C5:0, as indicated within this instruction and below the
address specified for Source A of the EQU instruction? Explain.

Activation of PLC input 1 resets the counter which causes the accumulated value in
both counter and EQU instruction to go to ‘0’.

G 15. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and place all the switch toggles
downward).

G 16. Place the PLC in the Program mode and go offline.

Counter-Driven Comparison Instructions

G 17. Modify the existing main ladder program of project EXERC_8 as indicated
below in order to obtain the ladder program shown in Figure 8-2:

a. In rung 0, double-click Preset within instruction CTU C5:0, type: 13,


then press the mouse left button to accept this value.
b. In rung 1, replace the EQU instruction with a GRT (Greater Than)
instruction. To do so, select the EQU instruction and choose the
Change Instruction Type command in the context-sensitive menu.
Type GRT using the keyboard and press the Enter key. Do not
modify

Figure 8-2. Counter-driven comparison instructions.


the address specified for Source A and the constant specified for
Source B.

In rung 1, add a LEQ instruction in series with the newly entered


GRT instruction:

– Select the Compare category of instructions by clicking the


corresponding instruction category selection tab.
– Click the Less Than or Equal (LEQ) button on the instruction
toolbar, type: C5:0.ACC, then press the mouse left button to
enter this address for Source A.
– Double-click Source B within the LEQ instruction, type: 8, then
press the mouse left button to accept this constant.

c. Insert a new rung below rung 1. In the newly created rung (rung 2),
enter a Greater Than or Equal (GEQ) instruction having the
address: C5:0.ACC for Source A and the constant: 9 for Source B.

Then, enter a Less Than (LES) instruction in series with the


GEQ instruction. Enter the address: C5:0.ACC for Source A and the
constant: 12 for Source B of the LES instruction.

Finally, enter instruction OTE O:0/1 in rung 2.

d. Insert a new rung below rung 2. In the newly created rung (rung 3),
enter a Not Equal (NEQ) instruction having the address: C5:0.ACC
for Source A and the constant: 13 for Source B.

Then, enter instruction OTE O:0/2 in rung 3.

e. Leave rung 4 (rung containing the instruction RES C5:0) as it is.

Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.

The main ladder program in RSLogix Micro should be identical to that


shown in Figure 8-2.

G 18. Using the Save As command in the File menu, save the new main ladder
program in a project file named EXERC_8a.RSS.

Note: Do not forget to change the processor name while you


are in the Save Program As dialog box.

G 19. Download project EXERC_8a to the PLC of the PLC Trainer. Go online
and place the PLC in the Run mode.

G 20. Observe that the accumulated value of instruction CTU C5:0, which is
currently 0, is indicated below the address specified for Source A within
all the comparison instructions (GRT, LEQ, GEQ, LES, and NEQ
instructions).
Is PLC output 2 activated, indicating that the NEQ instruction in
rung 3 is true? Why?

Source A is less than 13 so NEQ is false and output 2 is not activated.

G 21. Activate and deactivate PLC input 0 several times, using one of the toggle
switches of the trainer, until the accumulated value of instruction CTU
C5:0 reaches 6.

Is PLC output 0 activated, indicating that the GRT and LEQ instructions in
rung 1 are both true? Why?

GRT instruction is true in rung 1 because the value of source A is greater than
that of source B and LEQ instruction is true because value of source A is less than
that of source B. So output 0 is activated.

G 22. Deactivate and activate PLC input 0 until the accumulated value of
instruction CTU C5:0 reaches 9. What happens to PLC output 0 when
the accumulated value reaches 9? Why?

The PLC output 0 turns OFF when the accumulated value of turns to 9
because the LEQ instruction in rung 1 becomes false i.e. Source A is greater
than Source B.

Is PLC output 1 activated, indicating that the GEQ and LES


instructions in rung 2 are both true? Why?

Yes, PLC output 1 turns ON because GEQ and LES instructions in


rung 2 are true. This happens because in GEQ instruction Source A is equal to
Source B and in LES instruction Source A is less than Source B.
G 23. Deactivate and activate PLC input 0 until the accumulated value of
instruction CTU C5:0 reaches 12. What happens to PLC output 1
when the accumulated value reaches 12? Why?

As the accumulated value of counter reaches 12, the PLC output 1 turns ON
because the NEQ instruction in rung 3 is true.

G 24. Deactivate and then activate PLC input 0 so that the accumulated value
of instruction CTU C5:0 reaches 13. What happens to PLC output 2
when the accumulated value reaches 13? Why?

The PLC output 2 turns OFF because the NEQ instruction in the rung 3 becomes
false.

G 25. Deactivate and then activate PLC input 0 so that the accumulated value
of instruction CTU C5:0 reaches 14. What happens to PLC output 2
when the accumulated value reaches 14? Why?

When the accumulated value reaches 14 the NEQ instruction in the rung 3 turns ON
which causes the PLC output 2 to turn ON as well.

G 26. Reset CTU instruction C5:0. To do so, activate PLC input 1, using another
toggle switch of the trainer. What happens to the accumulated value
of instruction CTU C5:0, as indicated within this instruction and
below the address specified for Source A of the comparison
instructions? Explain.

As the PLC input 1 is activated, the accumulated value of counter, as indicated within

the CTU instruction and the address specified for Source A of the comparison
instructions turns to zero.
G 27. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and place all the switch toggles
downward).

G 28. Place the PLC in the Program mode and go offline.

Timer-Driven Comparison Instructions

G 29. Modify the existing main ladder program of project EXERC_8a as indicated
below in order to obtain the ladder program shown in Figure 8-3:

a. In rung 0, replace instruction CTU C5:0 with a TON (timer-on-delay)


instruction. To do so, select instruction CTU C5:0 and choose the
Change Instruction Type command in the context-sensitive menu.
Type TON using the keyboard and press the Enter key.

Set the parameters of the TON instruction as follows:

– Double-click Timer, type: T4:0, then press the mouse left button
to accept this address.
– Double-click Time Base, select 0.01 s in the drop-down list that
appears, then press the mouse left button to accept this
selection.
– Double-click Preset, type: 1500, then press the mouse left
button to accept this value.
– Leave the Accumulated value set to 0.

b. In rung 1, double-click Source A within the GRT instruction,


type: T4:0.ACC, then press the mouse left button to accept this
address. Then, double-click Source B within the GRT instruction,
type: 500, then press the mouse left button to accept this constant.

Using the same procedure, change the address of Source A of the


LEQ instruction in rung 1 to: T4:0.ACC, and the constant of Source
B of this instruction to: 800.

c. In rung 2, change the address of Source A of the GEQ instruction to:


T4:0.ACC, and the constant of Source B of this instruction to: 900.
Then, change the address of Source A of the LES instruction
to: T4:0.ACC, and the constant of Source B of this instruction to:
1200.

d. In rung 3, change the address of Source A of the NEQ instruction


to: T4:0.ACC, and the constant of Source B of this instruction to:
1300.

e. Delete rung 4 of the main ladder program.

Using the Verify Rung command, verify the rungs that have been edited.
Correct any errors.

The main ladder program in RSLogix Micro should be identical to that


shown in Figure 8-3.
Figure 8-3. Timer-driven comparison instructions.

G 30. Using the Save As command in the File menu, save the new main ladder
program in a project file named EXERC_8b.RSS.

Note: Do not forget to change the processor name while you


are in the Save Program As dialog box.

G 31. Download project EXERC_8b to the PLC of the PLC Trainer. Go online
and place the PLC in the Run mode.

G 32. Observe that the accumulated value of instruction TON T4:0, which is
currently 0, is indicated below the address specified for Source A within
all the comparison instructions (GRT, LEQ, GEQ, LES, and NEQ
instructions).
Is PLC output 2 activated, indicating that the NEQ instruction in rung
3 is true? Why?

Yes, the PLC output 2 is activated as the NEQ instruction in the rung 3
is true. This happens because the value of source A i.e. accumulated value, is
not equal to value of source B.

G 33. Activate PLC input 0, using one of the toggle switches of the trainer, and
observe that PLC outputs 0 through 2 are activated according to the
following time-driven sequence:

– When PLC input 0 is activated, PLC output 2 remains activated;


– 5 seconds later, PLC output 0 is activated;
– 3 seconds later, PLC output 0 is deactivated.
– 1 second later, PLC output 1 is activated;
– 3 seconds later, PLC output 1 deactivated;
– 1 second later, PLC output 2, which remained activated during the
entire cycle, flickers once, and becomes activated again.

Initiate a new cycle by deactivating and then activating PLC input 0.


Observe the PLC outputs and the ladder program of project EXERC_8b.

From your observations, explain how the ladder program of project


EXERC_8b operates.

RUNG 0:
Activates timer when input 0 is activated.
RUNG 1:
Output 0 is activated when accumulated value is between 500 and 800.
RUNG 2:
Output 1 is activated when the accumulated value is between 900 and 1200.
RUNG 3:
Output 2 is activated all the time except when the accumulated value becomes
equal to 1300.
G 34. On the PLC Trainer, make sure that all PLC inputs are deactivated
(remove all the switch connection leads and set all the switch toggles
downward).

G 35. Place the PLC in the Program mode. Go offline and close project
EXERC_8b.RSS.
CONCLUSION

In this exercise, you became familiar with the comparison instructions of the
trainer PLC: the EQU, NEQ, LES, LEQ, GRT, and GEQ instructions. You saw
that these instructions compare a pair of arithmetical values, and that the result of
the comparison determines whether the comparison instruction is true or false.
You saw that the two values to be compared are located at Sources A and B.
Source A is a word address programmed when entering the comparison
instruction. Similarly, Source B can be a constant or a word address programmed
when entering the comparison instruction.

REVIEW QUESTIONS

1. What is the function of the comparison instructions of the trainer PLC?

The comparison instructions compare a pair of arithmetical values. The result


of the comparison determines whether the comparison instruction is true or false.

2. With the trainer PLC, what two parameters must be programmed when
entering a comparison instruction? What do these parameters
represent?

With the trainer PLC, the following two parameters must be programmed

when entering a comparison instruction:


Source A: address of the word to be compared against the constant or word at Source B.
Source B: constant or address of the word to be compared against the word at Source A.

3. True or false? The LEQ instruction of the trainer PLC is true when the
value at Source B of this instruction is greater than or equal to the
value at Source A of this instruction.

FALSE. It is true when the value at Source A of this instruction is less than or
equal to the value at Source B of this instruction.

4. True or false? The NEQ instruction of the trainer PLC is true when the
value at Source A is greater than the value at Source B, and false when
these values are equal.

FALSE. It is true when the value at Source A is not equal to the value at Source Band
false when these value become equal.

5. Briefly explain how comparison instructions of the trainer PLC can be


used in conjunction with counter or timer instructions to sequentially
activate and deactivate PLC outputs.

The PLC comparison instructions can be used in conjunction with counter or timer instructions to
sequentially activate and deactivate PLC outputs. With this type of ladder program, a comparison
instruction is driven by the accumulated value of a counter or timer instruction. The comparison
instruction is activated when the accumulated value is equal, not equal, greater than, or less than a
constant, depending on the comparison performed.

Vous aimerez peut-être aussi