Uploaded by Nerf Herder

NC3

advertisement
Order no.:
20922-00
First Edition
Revision level:
11/2016
By the staff of Festo Didactic
© Festo Didactic Ltée/Ltd, Quebec,
Canada 2015
Internet: www.festo-didactic.com
e-mail: did@de.festo.com
Printed in Canada
All rights reserved
ISBN 978-2-89747-317-4
(Printed version)
ISBN 978-2-89747-318-1
(CD-ROM)
Legal Deposit — Bibliotheque et Archives nationales du Québec, 2015
Legal Deposit — Library and Archives Canada, 2015
The purchaser shall receive a single right of use which is non-exclusive, non-time-limited and limited geographically to use at the purchaser's site/location as follows.
The purchaser shall be entitled to use the work to train his/her staff at the purchaser's site/location and
shall also be entitled to use parts of the copyright material as the basis for the production of his/her own
training documentation for the training of his/her staff at the purchaser's site/location with acknowledgement of source and to make copies for this purpose. In the case of schools/technical colleges, training
centers, and universities, the right of use shall also include use by school and college students and trainees at the purchaser's site/location for teaching purposes.
The right of use shall in all cases exclude the right to publish the copyright material or to make this available for use on intranet, Internet and LMS
platforms and databases such as Moodle, which allow access
by a wide variety of users, including those outside of the purchaser's site/location.
Entitlement to other rights relating to reproductions,
copies, adaptations, translations, microfilming and
transfer to and storage and processing in electronic systems, no matter whether in whole or in part, shall
require the prior consent of Festo Didactic GmbH & Co. KG.
Information in this document is subject to change without notice and does not represent a commitment on
the part of Festo Didactic. The Festo materials described in this document are furnished under a license
agreement or a nondisclosure agreement.
Festo Didactic recognizes product names as trademarks or registered trademarks of their respective
holders.
All other trademarks are the property of their respective owners. Other trademarks and trade names may
be used in this document to refer to either the entity claiming the marks and names or their products.
Festo Didactic disclaims any proprietary interest in trademarks and trade names other than its own.
Safety and Common Symbols
The following safety and common
symbols may be used in this manual and on
the equipment:
Symbol
ei as
mm
>l ERE
re
Description
DANGER indicates a hazard with a high level of risk which, if not
avoided, will result in death or serious injury.
WARNING
indicates a hazard with a medium
CAUTION indicates a hazard with a low level of risk which, if not
avoided, could result in minor or moderate injury.
CAUTION used without the Caution, risk of danger sign Ad, indicates a hazard with a potentially hazardous situation which, if not
avoided, may result in property damage.
Caution,
risk of electric shock
Caution,
hot surface
Caution, risk of danger
b>
Caution, lifting hazard
Caution, hand
entanglement hazard
Notice, non-ionizing radiation
5 a/c]
Direct current
ol
© Festo Didactic 20922-00
level of risk which,
if not avoided, could result in death or serious injury.
Alternating current
Both direct and alternating current
Three-phase alternating current
Earth (ground) terminal
Safety and Common Symbols
5D) bp (GO}—-jt+
|H IO
Symbol
Description
Protective conductor terminal
Frame or chassis terminal
Equipotentiality
On (supply)
Off (supply)
Equipment protected throughout
by double insulation or rein-
forced insulation
In position of a bi-stable push control
Out position of a bi-stable push control
© Festo Didactic 20922-00
Table of Contents
Preface........
JRO
TNS: Mail
scccsccnccmeacnencrasnccerenccennenumene
ar nclen seen eieameL Ke aNccaree eens Xll
Note: Introductionto PLC Programming. ............:s0ssssessseseeseeseeeeeneeee 1964
Exercise 2
Clamp and Stamp Application (LAD) ............... eee
OS
DISCUSSION eis siwaerannvesorsemwornesernnnunrensuexunranermnwersimunreneueunres 65
Clamp and WOrk......cccceccceccesecceseseceeceseceecesecesaeeeeeaeceeaeeeeteateeees 65
TWO tVP6S' Of SOMSONS epee var cere eye rrr yee
66
PrneuMatic.cyVlind ls yeiissecccccrnnvenerececnnnenneenwenneeeneennyes 67
Directional Control VaIVES ....... 0... cece ce ceeseeeeeee crests ena eeeeene ees 68
Latch and unlatch output instructions ........00..0...00ccc
eee 70
OUIPULLSICh MSHUCHON sccccccrancnemumacnmnimnummunnd 71
Output Unlatch instruction...
ccc cceecceteeseecseccesenseneensenees 71
PROCEDURE irancener-ersennnresennesoneenceeermneeneneen
meneame ranienene 72
Set Up ANd COMMECTIONS .... 0. ec ceee cee cee cece eee ceeeeeeeeee eens cee eeeeteeees 72
Real application Option 0.0.0.0. cccccccecssessetsetecsesceseesenseneees 73
Simulated application option............0..000000
cece
eee 76
Checking the I/O configuration ..............cceccesceeeece
cee cee eeee teers Of
Inserting the ]OGIC.....0..cccecccceceseecseeceeeeceseeeeeecnseesseeseeeeceeaeeneee 78
Rung. 0 (damp: INdiGatel) weer
ereneecmees
79
Rung 1 (clamp extend control — X33)... eeeeeeceeeeeeeee
teeta 81
Rung 2 (stamp extend control — X1 latch / X2 unlatch) ............ 82
Rung 3 (stamp retract control — X2 latch / X1 unlatch)............. 83
Running the PLC and HMI projects ............0.0...0: cece eee: 84
Testing the Application ..........ccccecccececeeceeeseeseceteeceeeeneeeseeeeneees 86
End ofthe: procedure scscanincancncunvnnrE 86
Exercise 3
Traffic Light Application (HMl)..............
cc ecsesseseeeseeeneeseeene ees OD
DISCUSSION. .....c.ccccecceeceeeeeecenecee
cess ces eeeecesaeeeseseeesaeeeeesaeeeaeeeeteateaees
Traffic lights
Human-machine interfaces. ..........0..2...00cccccceee
cee ctee cee ceeeeeeees 90
TOUCH SCIECNS 2... cececcececeeceseceeseeeaeeeeeecceeeeeeeecneeeeesseeeecneeensete
SCION TPS scence arn
nman
en
PROCEDURE
........ececeeeeeeeceeees
Set up and connections
PLC programming.........
Starting a new project .......... cece
re
cece ceeeeeeetetteteeeneteeeeeeeneenees 95
Entering instructions .....0.00.0.0..cccccccccce
cece eee cee cee ceeeeeeeeeeeetenes o7
Transferring the PLC project .........0..00000000
cic
ceeeeeteettee 100
Programming the interface .........:..c:ceccecsesecesceeeesecsseseeeseeses 101
Project Settings ........cc cc ccccsecsessessecsesceccsscsscsesaetsetseeseeeeeeesees 101
Network configuration .2c.c:aseswn
nara
102
PRTG WG TES ccces scscascovsnecasnaisnvsnsnancienvarnnnatecrnemasciaxestnndsea
sited 103
Developing the interface ..........ccccccececceeecteeeeteeteeceeteeeeeeensens 106
Testing the application in FactoryTalk View Studio................120
Transferring the HMI program to the touch screen...............122
© Festo Didactic 20922-00
Using the application .........ccc ccc ceceeeeeseeeceeeeeeceeeeeeaeenaeeenees 122
Troubleshooting ?isentccicriiaiiet 123
End of thé procedure..cccccccccasissssnusurraniewenu
renner
123
Table of Contents
Exercise 4
=‘ Traffic Light Application (LAD and SFC) ...............eeeeee 125
DISCUSSION 20... cece ccccce cece cee ceeceeeeceseeeceeceneseseeeeseeseesaeeseeeenesees 125
Programming. a traffic lightsaccsersnnwnne 125
Sequential function chart (SFC) programmiing.............0.00. 126
BrAn Ching... eee ceecceceeceseeceecaeeecaeceeceneeceecaeseseeessenseeesaneeeaees 127
Using ladder programming with a sequential function chart... 130
Timer On Delay instruction (Ladder) ............0::ceeeeeeee 131
Counter instruction (Ladder). .....0..0...
ccc eee seeeeeeene ete eeeee 132
Reset instruction (Ladder) .......0......c.cccecceseeecceseceeeeeeceeeeeesees 133
PROCEDURE ie cvescecexaecannornenneemgnannenennveiamrernmeenimmenmancernens 134
Preparation (tutorial) .........0...ceccccccceece
ceeeeee cee eeeteeeeeeeeeenteneees 134
Sét Up ‘Alid CONnNECHIONS
vee nee eyeern semen var
nyoere verve: 134
Ladder programming activity (no pedestrian).............0.0 136
PLC programming .........0...0ccccceccecceeceeceeeeee
tte teeeseeneeeeeeeeesees 136
HMI transfer
See tae
SFC programming activity A (no pedestrian) ...............00- 143
Additional activity B (adding pedestrian lights).................... 157
Additional activity C (managing pedestrian demand).......... 158
TROUBDIESNOO1ING scressreswensnereemennienernieeemreaienmmn: 159
Enid of the procedUne ivissnsnieseieesaneeranesereuaunsvarecnenseweneenss 160
Exercise 5
Water Level Application (LAD and FB) .................cssssseeeeee 161
DISCUSSION isin scsnumerne nero
161
BALCH PROCOSSOS ia :c arisen arnerasntnmennvursneenaineasworensmaranaaeennacnnisee 161
The water level application ..............e:ceseecesseeeseeeeeeerseeeeeeeee 162
Float and capacitive switches . 2.0.00...
cece
164
Analog level sensor (Optional)..........0.cccccccceseseseee
cere 165
Analog devices And VAlUCS......ccccccceecseesereceseecseeceeeeeseeeeens 166
Example featuring a level sensor and a pump drive............... 166
Analog value formats................:cccsceseeseeceeeeeeeeeteeteeeeeeeeeeeenees 167
Analog values and the benefits of function blocks .............. 167
IARC TEN SONI COI eee
168
Comparison instructions. ...........:ccc.ccccccccecescsecresneseeeseeeeeeeeeaee 168
Math instructions .....0.. cc cececeseeceeeeseeereeeneseeeeeennseeaceeceneentas 169
RO
PROCEDURE
caerccerieccesasecnaaiia
esas ces
ees
am
169
171
Preparation (tutorial
Set up and connections
Ladder programming activity ..
.176
PLC programming .........ccccccccccecceecesesseeeeeceeeeeeeceetecseseesaeseeeees 176
HMI transte fssceesoreceecenrceeee
eae 186
Function block programming activity 00.0.0...
eee eee 188
TPOUDIESNOOTING «0.0... eee cece cee cer ceee ene cee ceneaee seen eee eeeeee eee ees 193
Eric OF iNE prOGed US secs vesrsece eee sevesnersney ve ce meareenerey rere
VI
193
© Festo Didactic 20922-00
Table of Contents
Exercise 6
Box Filling Application (LAD and ST) ..................:2::seeeeee 195
DISCUSSION 00... ec ceceeeee cee ceee cee cote cereeenaeecereeceeerseneeceeeeeeeaeecneesenerens 195
The filling station...
Structured text ...
.. 195
196
Constructs .
Expressions...
197
197
Instructions.
QF.
PROCEDURE ©... ...c.cccc cece ceee cee cote ces seseace cececceecesuseccsecenseecsueecnseceeeeens
Preparation (tutorial) sccseccseninnwaraiaanienianies
Sol UPANG CONNGCHIONG cvscesiecccveaecerseecdierrsvenaverwiecaiirennvereate
Ladder programming activity ........... cc csecececeseeeeeeceeeeceeneerere
Project estion cceneceneere
eee
199
199
200
204
204
MainRoutine ................
LDO2_Recipe_Selection.
207
207
LDO3_ Reserved ...........:00eee
LDO1_Filling_Station (overview).......
207
209
LDO1_ Filling Station (GENERAL section) .....
21
LDO1_Filling_Station (TRANSITION LOGIC section).............211
LDO1_Filling Station (STEP LOGIC section)........
12 l4
LDO1_Filling Station (ACTIONS section)...
wn2ld
HMI transfer........0.ccceeceeeereeeeeseeeereeee
we 2?
Structured text programming activity.
Troubleshooting ..........c cece
mee TT:
an22U)
End of the procedure ............cccccccccecccceee
cee cteeeeecetesnseeeeeeeeeees 220
Appendix A
Equipment
Appendix B
Glossary of New Terms ..........-2.:--c1::ceceeeceeecee
seen cenenseeeneneeeeees 227
Appendix C
Conversion Table ........scscsscssessecseseecensesecascnseeessnesnenseesnansnaenees
22D
Appendix
Boolean Algebra and Digital Logic «0.0.0.0...
eee eesese enna 231
D_
Utilization Chart............0...0.2...teceeeeeeeeeee
tener
225
INGO, cccassecersccrenerommncannenereamanarsnnneraannemmnnenmeavenecnmrerenmrecmemnnmmannenenned 237
Polelcelah
dai --ieeenerrcertcece tronrrenree cere ccerer errr cers terre reer rce peri pr err nePer eer rere er Perec trre 239
BiDIIOQrAPNY «02... cc cece ceceeeeceeeceeseeeaeeceeeccseeeeeesenecceneneeeceeeseseeensneceeeeennaeeseeeseeaeeeea 241
© Festo Didactic 20922-00
VII
Preface
Programmable logic controllers (PLCs) are at the center of a multitude of automated systems. Some industries that benefit from these systems include manufacturing
plants,
breweries,
wastewater
treatment
plants,
mining
facilities,
and
automotive assembly plants.
This manual introduces students to four PLC programming languages: ladder,
sequential function chart, function block, and structured text. The most common
PLC instructions are used within Rockwell's Studio 5000 software environment.
In
addition
to
PLC
programming,
students
learn
how
to
conceive
interface
screens with FactoryTalk View Studio and make them work along with the PLC
project.
In terms of hardware, the Advanced PLC Training System uses modern, industrial-grade equipment that is instrumental in teaching theoretical and hands-on
knowledge required to work in the automation industry. Optional applications can
be purchased and connected to the PLC suitcase to add real-world sensors and
actuators to the setups.
In order to perform the exercises in this manual, the Studio 5000 and the FactoryTalk View Studio software must be installed on the student's computer.
We invite readers of this manual to send us their tips, feedback, and
suggestions for improving the book.
Please send these to did@de.festo.com.
The authors and Festo Didactic look forward to your comments.
VIII
© Festo Didactic 20922-00
About This Manual
Manual objectives
When
you have completed
Studio 5000 and
this manual,
you will be able to navigate through the
FactoryTalk View Studio software from
Rockwell and use the
online resources. You will know how to create PLC routines in ladder, sequential
function chart, function block, and structured text, and how to develop operator
interfaces.
Safety considerations
Safety symbols that may be used in this manual and on the equipment are listed
inthe Safety Symbols table at the beginning of the manual.
Safety procedures related to the tasks that you will be asked to perform are indicated in each exercise.
Make sure that you are wearing appropriate protective equipment when performing the tasks. You should never perform a task if you have any reason to think
that a manipulation could be dangerous for you or your teammates.
Reference material
The
resource
kit DVD-ROM
contains
the
PLC
and
HMI
projects
that
will
be
needed throughout the exercises.
Prerequisite
As a prerequisite to this course, you should have a basic understanding of electricity. It is assumed that you have a general understanding of these concepts:
e
e
DC and ac voltage, current, and power
Basic electrical components
(resistor/potentiometer,
inductor, capacitor,
di-
ode, transistor)
e
Ohm's law
e
Series and parallel circuits
e
=6Electrical measurement
Systems of units
Units are expressed using the International System of Units (SI) followed by the
units expressed in the U.S. customary system of units (between parentheses).
© Festo Didactic 20922-00
Exercise 2
Clamp and Stamp Application (LAD)
EXERCISE OBJECTIVE
DISCUSSION OUTLINE
In this exercise, you will:
°
Open an existing PLC project
.
Revise the tags
e
Create a ladder routine
.
Insert rungs and bit instructions
*
Test the PLC program with an application (real or simulated)
The Discussion of this exercise covers the following points:
=
Clamp and work
="
Two types of sensors
="
=
Pneumatic cylinders
Directional control valves
Latch and unlatch output instructions
s
Output Latch instruction. Output Unlatch instruction.
DISCUSSION
Clamp and work
Clamp and work systems usually consist of two hydraulic or pneumatic cylinders.
The clamp cylinder extends until it stalls against the workpiece. The work cylinder
advances
and
retracts
a machining
tool
to
perform
a
clamped workpiece, such as bending, pressing, drilling,
grinding. The sequence may resemble that of Figure 79.
© Festo Didactic 20922-00
particular
cutting,
task
on
stamping,
the
or
65
Exercise 2—Clamp and Stamp Application (LAD) # Discussion
Figure 79.
Clamp and work cycle.
1.
The clamp cylinder extends.
2.
The work cylinder extends.
3.
The work cylinder retracts.
4.
The clamp cylinder retracts.
In this particular example, the clamp cylinder cannot release its grip on the workpiece until the work cylinder has completely retracted. This ensures that the
workpiece remains clamped while being worked on. Proximity detectors may be
used to verify the position of the cylinders during the operation.
Two types of sensors
The physical application that you will be using in this exercise features two different types of sensors: a mechanical limit switch and two reed switches.
The single proximity detector at the bottom of the right cylinder is a mechanical
limit switch, shown
66
in Figure 80.
It is a single pole,
double throw
switch, which
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Discussion
means that it has both a normally-open and a normally-closed contact. The normally-open contact closes when the mechanical arm is pushed. A spring returns
the arm to its original position.
Figure 80.
The two reed
switches
Mechanical limit switch.
are located
on the left cylinder,
as shown
in Figure 81.
These single pole, single throw switches are only closed when the plunger inside
the cylinder is close to the switch.
£)
Reed
switches
are actuated
when
an applied
magnetic
field joins the pair of
ferrous metal reed contacts located inside a hermetically sealed envelope.
A
ie
Figure 81.
Terminals
Reed switch
Reed switch on a pneumatic cylinder.
Pneumatic cylinders
A pneumatic cylinder is an actuator that converts fluid energy into straight-line
or linear mechanical energy. Single-acting cylinders generate forces in a single
direction whereas double-acting cylinders generate forces during both extension
and retraction of the rod.
© Festo Didactic 20922-00
67
Exercise 2—Clamp and Stamp Application (LAD) # Discussion
A double-acting cylinder is shown in Figure 82. It contains two fluid ports and
does not include a spring. When fluid enters one port of the cylinder, the piston
moves toward the other port. The corresponding symbol is shown in Figure 83.
Extends
—*
co
| Exhaust
Fluid pressure
Retracts
——
| Exhaust
Figure 82.
Fluid pressure
Double-acting cylinder extending and retracting.
——
Figure 83.
Double-acting cylinder symbol.
Directional control valves
Directional control valves (DCVs) such as the one shown in Figure 84 are used
to control the flow in a fluid power branch circuit. They can perform three functions:
e — block fluid flow
68
e
allow fluid flow
*
change the direction of fluid flow
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Discussion
Figure 84.
Directional control valves.
Directional control valves are described according to:
e
the number of controlled openings, called ports or ways
e
the number of positions or states that the valve can assume
e
the type of valve actuators (also called operators) used to switch the
valve from one position to another
The symbols used for directional control valves indicate the above three characteristics and also show a simplified flow path for each position. The symbols do
not provide any information about the physical construction of the valve; they
simply indicate the function of the valve.
Let us ignore the valve operators for the moment
and consider only the number
of ports and positions of a valve. Most directional control valves have two or
three positions. Each position of the valve provides a different flow path configuration. Valve types are identified using two numbers of the form “m/n” where the
first number m is the number of ports and the second
number rn is the number of
positions.
The symbol for a directional contro! valve consists of two or more blocks (sometimes referred to as envelopes). There is a separate block for each position and
each block illustrates a different flow path. Ports are shown as lines protruding
from one of the blocks. The block with lines protruding, or with ports identified by
a letter or a number, shows the flow path through the valve in its normal position
(or return position). The other positions are called operated positions (or actuated
positions or working positions).
As an example, the symbol for a two-port, two-position (2/2) directional control
valve is shown in Figure 85. On the block showing the normal position of the
valve, the ports are numbered. The open (passing) flow path is shown as an
arrow. Ports that are closed (non-passing)
are shown
using short lines drawn
at
right angles.
© Festo Didactic 20922-00
69
Exercise 2— Clamp and Stamp Application (LAD) # Discussion
2 possible configurations
2
2
2 positions
1
Open Closed
1
Normally closed
Normally open
Figure 85. 2-port, 2-position directional control valve.
The devices used to switch the valve from one position (state) to another are
called valve actuators or operators. Different types of valve actuators may be
used.
Figure 86
shows
a valve
with
an
electrical
actuator
(a solenoid)
and
a
spring return. Since this valve is normally open, the normal position shows the
flowpath from port 1 to 2.
Solenoid actuator
(blocks flow from port 1)
2
Spring return (permits
flow from port 1 to port 2)
4
10
PE
Tr
12
113
Figure 86.
3-port, 2-position, normally-open, solenoid operating, spring return valve symbol.
Latch and unlatch output instructions
The Output Energize instruction (OTE) we saw in the previous lesson is considered to be a non-retentive instruction. In other words, the OTE instruction
does not retain its value when the rung is false. The output status changes with
the rung status:
e
lf the rung is true, the OTE instruction becomes true and the output tums
on
e
lf the rung is false, the OTE instruction becomes false and the output
turns off
There
are,
however,
some
conditions
where
an
output
needs
to remain
on
even
after the conditions that provided the output are no longer true. For example, if
separate start and stop buttons are used, you would not want to hold the start
button
for the duration
of the activation.
In this event,
an
instruction
with
a reten-
tive operation is desired.
These instructions are considered to be latching and are described in Figure 87.
The OTL and OTU instructions are always used
dress since both instructions modify the same bit.
70
in pairs with the same
bit ad-
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Discussion
Instruction
Abbreviation | Symbol
Output latch
OTL
—L+
Output unlatch
OTU
=
GreenButton
<Local:1:1.Data.0>
Actuator1
<Local:1:0.Data.0>
ae
i
ae
oll
RedButton
<Local1:1 Data. 1>
od
ak
Actuator
<Local:1:0.Data.0>
he
UJ
Figure 87. Associated OTL and OUT instructions triggered by two inputs.
Output Latch instruction
The Output Latch instruction (OTL) sets the addressed bit to logic state 1
when the rung containing the OTL is true. After, the bit remains at logic state 1,
regardless of the current OTL rung conditions,
until it is set to logic state 0 by the
associated OTU instruction.
Output Unlatch instruction
The Output Unlatch instruction (OTU) sets its addressed bit to 0 when the rung
containing the OTU
is true. Thereafter, the bit remains at logic state 0 regardless
of the current OTU rung conditions, until it is set to logic state 1 by the associated
OTL instruction.
Table 3 summarizes the logic state operation of the latching instructions.
Table 3. Latching instructions operation.
hietechon
Previous state
of bit 0:0/0
0
OTL
1
1
OTU
0
© Festo Didactic 20922-00
Runa
g
condition
New state
of bit O:0/4
True
4
False
0
True
41
False
41
True
0
False
4
True
0
False
0
71
Exercise 2— Clamp and Stamp Application (LAD) # Procedure Outline
PROCEDURE OUTLINE
The Procedure is divided into the following sections:
=
Set up and connections
Real application option. Simulated application option.
=
Ghecking the |/O configuration
= — Inserting the logic
Rung 0 (clamp indicator). Rung 1 (clamp extend control — X3). Rung 2
(stamp extend control — X71 latch / X2 unlatch). Rung 3 (stamp retract
control — X2 latch / X71 unlatch).
="
=
=
PROCEDURE
Running the PLC and HMI projects
Testing the application
End of the procedure
Set up and connections
In this exercise, you will complete a program that controls a clamp and stamp
application.
The program
will use
a push-button
to clamp
and another one
to
stamp a fictive sheet of metal. The logic will only permit stamping if the workpiece
is clamped first. You can either connect the real application to the trainer or use
the version that is simulated on the HMI and shown in Figure 88.
Stamp extend solenoid
Stamp retract reed switch
Stamp retract solenoid
Clamp extend solenoid
Stamp extend reed switch
&G
Figure 88.
72
HMI application.
Clamp extend mechanical
limit switch
Green squares indicate actuated sensors. Yellow squares show energized actuators. Gray squares indicate that the state of the sensor or actuator is off.
The clamp cylinder retracts when X3 is not actuated.
spring-return valve.
This is because it is a
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Procedure
Real application option
1.
Connect the equipment as shown in Figure 89 and Figure 90. The tags used
in
this
exercise
are
shown
in
Figure 91.
Adjust
the
air
pressure
be-
tween 200 kPa and 275 kPa (30 psi and 40 psi).
J)
To avoid air leaking from the connectors, make sure that plastic tubes are cut
clean and inserted deep enough into the connectors. Plastic tubes are removed by pressing the release button towards the body of the connector before pulling out the tubing.
FESTO
—
eu =——_,,
ae
ge 3207
Figure 89.
© Festo Didactic 20922-00
Clamp and stamp setup (real application).
73
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
Figure 90. Pneumatic connections.
‘Alias For
=3/0 | Base
Data
TIMER
Local:1:1, Data.0
Local:1:1.Data.1
Local: 1:1 Data.2
2 - Simulation
that 3 is retracting
cylinder extend reed switch
cylinder retract reed switch
extend
limt switch
Local:1:1.Data.3
1:).Data.4
NO push button,
NO push button
Local:1:0.Data.0
Local:1:0.Data.1
1:0.Data.2
Local:1:0.Data.3
cylinder extend (DCV1A)
cylinder extend
Figure 91. Tags and connections for Exercise 2 (real application).
74
© Festo Didactic 20922-00
Exercise 2—Clamp and Stamp Application (LAD) # Procedure
2.
Col
Open the Ex2_Real_Student project in Logix Designer (Figure 92).
» Ex2_20150125 Festo
Organize +
ai
BB Desktop
Downloads
=~
@
Date modified
8 Ex2_Real_20150125 Festo.ACD
29/01/2015 1:33 PM ~—_ Logix Designer Project
3,947 KB
29/01/2015 1:34 PM —_ Logix Designer Project
3,949 KB)
29/01/2015 1:31 PM
Logix Designer Project
3,951 KB
29/01/20151:35PM — Logix Designer Project
3,951 KB
| 3 E2_Real_Student_20150125_Festo.ACD
@ ©2 Virtual_20150125_Festo.ACD
a
3 2_Virtual_Student_20150125_Festo.
ACD
Type
fil
.D
Name
“E] Recent Places
Projects
Search Ex2. 20150125 Festo
New folder
Caoaihe
&
-
Size
) Runtime
Ga Libraries
1
Computer
Sia Network
File name:
Ex2_Real_Student_20150125_Festo.ACD
Figure 92.
3.
© Festo Didactic 20922-00
Opening the Ex2_Real_Student Logix Designer project.
Open the Controller Tags window. Click the Edit Tags tab and fill out the
Name and Alias For columns according to Figure 91. That way, you will have
all the necessary tags when writing the logic.
45
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
Simulated application option
1.
Connect the equipment as shown in Figure 93. The tags used in this exercise
are shown in Figure 94.
&
a
a
*
FESTO
Figure 93.
Name
Alias For
Clamp and stamp setup (virtual application).
=8]4] Base Tag
BOOL
Stamp cylinder extend reed switch
Sw2
SW3
BOOL
BOOL
Stamp cylinder retract reed switch
Clamp cylinder extend limit switch
)-TrrQifX3
TIMER — | Timer
X3 - retract simulation
(F)-TmrOnSw3
4 -TmrSW1
TIMER — | Timer SW3- SW3 simulation
TIMER — | Timer SW1 - SW’ simulation
-TmrSW2
PBI
PB2
TIMER — | Timer SW2- SW2 simulation
Local:1:|.Data.3
Local:1:|.Data.4
|Local:1:|.Data.3
|Local:1:|.Date.4
ui
Local:1:0.Data.0
x1
x2
Local:1:0.Data.1
Local:1:0.Data2
x3
Local:1:0.Data.3
Figure 94.
76
Data Type | Description
swi
|BOOL
/BOOL
Clamp NO push-button
Stamp NO push button
|Local:1:0.Data.0
|/BOOL
Clamp indicator (Light)
|Local:1:0.Data.1
|Local:1:0.Data2
|BOOL
|BOOL
Stamp cylinder extend (DCV1A)
Stamp cylinder retract (DCV1B)
|Local:1:0.Data.3
|BOOL
Clamp cylinder extend (DCV2A)
Tags and connections for Exercise 2 (virtual application).
© Festo Didactic 20922-00
Exercise 2—Clamp and Stamp Application (LAD) # Procedure
2.
Open the Ex2_Virtual_Student project in Logix Designer (Figure 95).
6 Open Project
Cclieglad|
|. » Ex2_20150125_Festo
Organize ¥
Search Ex2 20150125 Festo
New folder
Name
Date modified
Hl Desktop
3 Ex2_Real_20150125_Festo.ACD
29/01/2015 1:33 PM —_ Logix Designer Project
B
Downloads
3 Ex2_Real_Student_20150125_Festo.ACD
29/01/2015 1:34 PM — Logix Designer Project
=
Recent Places
8 Ex2_Virtual_20150125 Festo.ACD
29/01/2015 1:31 PM ~— Logix Designer Project
*
Favorites
) Projects
9
| 3
Ex2_Virtual_Student_20150125_Festo.ACD
Type
29/01/2015 1:35 PM
Logix Designer Project
a Runtime
Libraries
1 Computer
Gia Network
Filename:
&2_Virtual_Student_20150125_Festo.ACD
Figure 95.
3.
=
| Logix Designer (*.acd;*.I5k;*.I5x,
Opening the Ex2_Virtual_Student Logix Designer project.
Open the Controller Tags window. Click the Edit Tags tab and verify that the
Name and Alias For columns are as shown in Figure 94. Make some edits if
necessary. That way, you will have all the necessary tags when writing the
logic.
Checking the I/O configuration
4.
In the Controller Organizer window, expand the //O Configuration to reveal
how the controller is organized (Figure 96).
5-8] YO Configuration
-€f 1769 Bus
{ID [0] 1769-L24ER-QBFCIB Ex2_Virtual_20141110
Festo
| 3-63 Embedded YO
|
(eat IL] Embedded Discrete 10
16 [2] Embedded Analog 10
i
|
@ [3] Embedded Counters
(i Expansion 0
B-as Ethernet
{WD 1769-L24ER-QBFCLE E2_Virtual_20141110_Festo
Figure 96.
5.
© Festo Didactic 20922-00
I/O configuration.
What is the controller model that is configured for this project?
ff
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
6.
Double-click Discrete_lO to open the module properties. How is the module
Type described (General tab)?
7.
What is the default Requested Packet Interval (RPI)?
8.
Click Cancel to close the properties window.
Inserting the logic
In this section, we will create a ladder routine and insert four lines of code.
9.
In the Controller Organizer, we see that there is one program, MainProgram,
in the continuous task MainTask (Figure 97). In this program, there are two
routines at this time:
e
MainRoutine. The sole purpose of this routine is to call the other routines.
LDO2_Reserved. This routine induces time delays between cylinder displacements, when the (virtual) valve solenoids are actuated.
vides for a more realistic result on the touch screen.
This
pro-
.-{@} Controller Tags
2
=
Controller Fault Handler
Power-Up Handler
2 EI Tasks
|
SJ MainTask
Parameters and Local Tags
B MainRoutine
i
(2
Figure 97.
LDO2_Reserved
Unscheduled Programs/ Phases
MainProgram and Routines (virtual version).
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Procedure
10. Right-click MainProgram and
mation found
in Figure98
LD01_StampingStation.
select Add ® New Routine. Enter the inforto create a mew ladder routine called
LD01_StampingStation
Ladder Diagram
| Main Program
Assignment:
<none>
[2] Open Routine
Figure 98.
New ladder routine.
Rung 0 (clamp indicator)
11. Open the newly created routine LDOQ7 (Figure 99). We see that there are two
rungs already: the (End) rung that is not editable, and rung 0.
} ft
(End)
3
& &
(3)
hoa. =] aie
|
|
Figure 99.
Empty routine.
12. Let us start by having an indicator light turn on whenever the mechanical limit
switch
at the bottom
of the clamp
cylinder is actuated.
To
do
so, you
will
need an Examine On (XIC) and an Output Energize (OTE) instruction. First,
add the Examine On instruction by clicking the symbol while rung 0 is selected (Figure 100).
© Festo Didactic 20922-00
9
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
Click here
=|
Path: [AB_ETHIP-1\192,168.0.10\CompactBus\0
4H
tot ta
a]
SSBEB
aE] +
4
«1 \faontes FEA
{a
ae
»
Ta
| som
(End)
Figure 100.
Adding an Examine On (XIC) instruction.
13. Double-click the question mark (Figure 101). This gives you access to a list
of available tags. Select the alias tag that pertains to the mechanical switch
(SW3).
>| (és)
Path: [AB_ETHIP-1\1S2.168.0.10\CompactBus\0
4H
tot tet
Ab
HH
4d
(
>
r
4 + )\ Favorites KAdEOn_A Almms_A_Bt_{ TinedCounter
BBs we Ms
«.-| w
—
moo
td
A]
(End)
Select SW3 from the list
Figure 101.
Assigning a tag to the instruction.
14. Drag and drop an Output Energize (OTE) instruction as shown in Figure 102.
| Path
|
J AB_ETHIP-1\192.168.0.10\Compact Bus\0
4H
«
BBEE
Lo
Fs
r
Bi 4 TimerCounter
+=] we
JE
°
-—
a
U7
a
Figure1 02.
80
GO)
Clamp cylinder
extend limt switch
(End)
Drop instruction OTE here
tt 1
+ \ Favorites < Add-On A Alarms
2ooao
th
tet tel
~| fl
Adding an Output Energize instruction.
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Procedure
15. Assign the alias
(Figure 103).
tag
of the
indicator
light
(L1)
Clamp
to
the
OTE
indicator
Select tag L1
Light),
uy
Clamp cylinder
extend limit switch
Sw
instruction
<Local:1:0.Data.0>
16
0
ac
a
Figure 103.
Assigning tag L1 to the instruction.
Rung 1 (clamp extend control -X3)
16. Insert a rung. One way to do so is by clicking the corresponding icon in the
Language Element menu (Figure 104).
4]
ae
Click here
bo
A
Rung
——
B
Main
Clamp indicator
(Light)
4
<Local1:0. Data.O>
Clamp cylinder
extend limit switch
SW3
If
~
m
0
7
Figure 104.
Adding a rung.
17. Enter the logic for this rung according to Figure 105. Figure 106 shows where
to go to add a branch. X3 (clamp cylinder solenoid) energizes if one of these
two conditions is fulfilled:
«
PB1 (NO clamp push-button) is pressed, or
«
SW2 (stamp retract switch) is not actuated and X3 (valve solenoid) is
currently actuated.
Clamp cylinder
Clamp NO push-button
PB4
<Locak1:|Data.3>
‘
extend (DCV2A)
x3
<Local1:0 Data.3>
JE
Clamp cylinder
extend (DCV2A)
Stamp cylinder
x3
retract reed switch
<Local1:0.Data.3>
sw2
fi
Figure 105.
© Festo Didactic 20922-00
Rung 1 (clamp extend).
81
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
ons
Tools
Window
Help
we AR OE) FF
AQ
sec
Path: | AB_ETHIP-1\192.168.0.10\CompactBus\0
4H
4
[tol
| test
4k
4
+ 1 Favori
4)
~
4
D>
»
in
Branch
iy) SB
LE
Bb ae] cw
pitch
fe
Tp
3
1
Figure 106.
Adding a branch.
Rung2 (stamp extend control - X1 latch / X2 unlatch)
18. Insert another rung. This time, right-click the existing rung 1 and select Add
Rung (Figure 107).
Controller Organizer
43
w~AX
iY
SS
Sw
Ga)d
«.)
Controller Ex2_Virtual_20141110_Festo
I
Controller Tags
in 2 Controller Fault Handler
|
comet cyneet
Power-Up Handler
ahaa
&-G5 Tasks
=
|
o
MainTask
JE
G23, MainProgram
~-(B)
Program Tags
‘Clamp
NO push-button
~ F&}) MainRoutine
.~( LDO1_StampingStation
JB) L002_Reserved
PB1
<Local.1:.Gata.3>
af
JE
.2_ Unscheduled Programs
/ Phases
Clamp cylinder
Motion Groups
(i Ungrouped Axes
& Add-On Instructions
5-@a Data Types
Cut Rung
Ctrl+X
Copy Rung
Cte
Paste
: Gq User-Defined
Gi Strings
(End)
Oj Add-On-Defined
g
Delete Rung
Ctrl+V
r
Del
LG Predefined
-@
5-43
a Module-Defined
Edit Rung Comment
Trends
Import Rung...
0 Configuration
Export Rungs...
2-49) 1769 Bus
"(BD 10] 1769-L24ER-QBFCIB Ex2_Virtual_201
| GG
Embedded YO
i 4
Ctrl+D
[1] Embedded Discrete
[O
PM Eo
Ann A
Figure 107.
a
‘44 Start Pending Rung Edits
22
Accept Pending Rung Edits
‘2§
Cancel Pending Rung Edits
Ctrl+ Shift+S
Adding a rung (right-click).
© Festo Didactic 20922-00
Exercise 2-—Clamp and Stamp Application (LAD) # Procedure
19. Enter the logic for this rung according to Figure 108. You will need latch (L)
and unlatch (U) instructions. X1 will latch and X2 will unlatch if all of these
four conditions exist simultaneously:
*
PB2 is pressed
SW1
(stamp extend switch) is not actuated
SW2 (stamp retract switch) is actuated
SW3 (clamp extend switch) is actuated
Stamp NO push-button
Stamp cylinder
Stamp cylinder
Clamp cylinder
PB2
<Local1:|Data.4>
extendreed switch
swt
retractreed switch
sw2
extend limit switch
SwW3
[—]
Stamp cylinder
extend (DCV1A)
x1
<Locat 1:0. Data.1>
Stamp cylinder
retract (OCV1B)
x2
<Local 1:0. Data.2>
Figure 108.
Rung 2 (stamp extend).
Rung3 (stamp retract control - X2 latch / X1 unlatch)
20. Insert one last rung.
21. Enter the logic for this rung according to Figure 109. X2 will latch and X1 will
unlatch if all of these four conditions exist simultaneously:
PB2 is not pressed
SW1
(stamp extend switch) is actuated
SW2 (stamp retract switch) is not actuated
SW3 (clamp extend switch) is actuated
In parallel
to these
conditions,
add
an
Examine
On
instruction
linked
to the
first scan bit (simply type “S:FS” above the instruction). This forces the system to start with the stamping cylinder retracted.
Stamp NO push-button
Stamp cylinder
Stamp cylinder
Clamp cylinder
PB2
<Local1:LData 4>
extendreed switch
sw
retractreed switch
Sw2
extend limit switch
SwW3
SS
af
TE
Stamp cylinder
extend (DCV1A)
xd
<Local:1:0.Data.1>
—
ba
C
|
Figure 109.
© Festo Didactic 20922-00
If
Ie
Stamp cylinder
retract (DCV1B)
x2
<Locat 1:0.Data.2>
L
Rung 3 (stamp retract).
83
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
22. Save your program under a new name (File ® Save As...) as shown in Figure 110.
Sawein:
J) Projects
T=
-
Name
my
=
04/12/2012 10:54 PM
493355.VM7»64.LV33.BAKO00.acd
1
Ppl
Date modified
a FBDLevelControlSimulation.aed
Recent Places
@@
29/10/2014 1:20 PM
=
Desktop
—_
@F AQ3355.VM7x64,LV33.BAKOOL acd
@ AQ3355.ACD
_)fxbPLC1.Sem
@ fxbPLCL.VIM7x64,LV33.BAKO00.acd
@ fxbPLCL.ACD
29/10/2014
31/10/2014
31/10/2014
31/10/2014
31/10/2014
1:21
3:38
3:38
3:38
3:40
PM
PM
PM
PM
PM
Libraries
Lo fxbPLC1
31/10/2014 3:40 PM
Computer
< [la
Nowe
File name.
b
Ex2_Virtual_20141113_FrankMJACD
Save astype:
[Logic Desgner Praiect Fle CACD)
[| Encode Source Protected Content
Figure 110.
v
|
zt]
L.Gancet
Save
[Help
|
Saving the file under a different name.
Running the PLC and HMI projects
23. Now that your program is entered and saved, it is time to download it to the
PLC. Providing that your network is properly configured (see Exercise 1),
open the Communications menu and select Download (Figure 111).
File
Edit
View
ae
Search
4
Logic | Communications]
488
Offline
fl. @ Run
No Forces
rp
No Edits
2! m0
Go Online
aot
Upload...
a]
Program Made
49 Controller &2_Virtual_20141:
Run Mode
of] Controller Tags
Test Mode
Controller Fault Handler
Gi Power-Up Handler
Lock Controller
-Ga Tasks
-
@@
Clear Faults
MainTask
3 MainProgram
«A
Winc
Select Recent Path...
Controller Organizer
{2
Tools
Who Active
Go To Faults
Pronram Tans
Figure 111.
Download.
24. Put the controller mode to (Remote) Run.
84
© Festo Didactic 20922-00
Exercise 2—Clamp and Stamp Application (LAD) # Procedure
25. If necessary,
transfer the HMI
program
(.mer) to the touch
screen
using
create
a new
ME Transfer Utility, a Factory Talk View Studio tool (Figure 112).
Upload
Source file:
|e: \Users\LYI3\Desktop\Ex2_201 41112_Festo\Ex2_20141112_Festo.mer
[Download as:
ea 41112_Festo
Destination storage type
Internal Storage
A
[> Run application at start-up
When application runs: ——————}
WARNING
Include a goto configure mode button in your application if
you need to access the configuration mode screens.
TO Replace communications
Include a shutdown button in your application if you want to
PF Delete Log Files
be able to shut it down
Select destination terminal:
129 RSLinx Enterprise, VM7X64
f-€ 1789-AI7, Backplane
Eds
EtherNet, Ethernet
QJ 192.168.0.10, 1769-L24ER-QBFCIB, Lal
|Mode: Select
[Browsing: PanelView Plus_7 65 in
Figure 112.
£)
You
may
have
to
Transferring the .MER to the touch screen.
open
the
archived
project,
modify
it, and
runtime application if the PLC address or the version of the touch screen is different.
© Festo Didactic 20922-00
85
Exercise 2— Clamp and Stamp Application (LAD) # Procedure
26. Load and run the HMI program on the touch screen. The program should
resemble Figure 113. If errors show up on the screen, check connectivity
with the PLC and verify the tags you used in the PLC program.
STAMPING
Figure 113.
STATION
Running the HMI program.
Testing the application
27. Push the green button under the red emergency button on the trainer to acti-
vate the PLC outputs. Using the push-buttons, verify that the program operates as expected.
Test
Pressing PB1
Yes | No
extends the clamp cylinder.
Output 0 (light) energizes when the clamp cylinder is extended.
Pressing PB2 extends the stamp cylinder ONLY if the clamp cylinder is fully
extended.
The clamp cylinder cannot retract if the stamp cylinder is extended.
The stamp cylinder retracts if PB2 is released.
28. If you answered “No” to any of the preceding questions, please revise your
project, make some modifications, and download it again to the PLC.
End of the procedure
29. Turn off the trainer, disconnect the leads, and clean the work surface.
86
© Festo Didactic 20922-00
Exercise 2-— Clamp and Stamp Application (LAD) # Conclusion
CONCLUSION
In this exercise, you opened an incomplete PLC project and you made sure that
the tags were correct. Then you created a ladder routine to control the logic of
the application,
using
bit instructions.
Finally, you transferred
and ran your pro-
gram and tested it with a physical or simulated clamp and stamp application.
REVIEW QUESTIONS
1.
What is the Requested Packet Interval (RPI)?
2.
Which output instruction changes status along with the rung status?
3.
Which output instruction sets the addressed bit to 0 when the rung containing
the instruction is true?
4.
What are the conditions necessary to unlatch X2?
Stamping cylinder
NO stamping push
button
PB2
<Locatl 1:1 Data 4>
a6.
Je
Stamping cylinder
extended limit
switch
swt
Stamping cylinder
retracted limit
switch
sw2
Ye
SE
Clamping cylinder
extended cylinder
Sw3
3 fC
IC
pneumatic walve
solenoid (extend)
x1
<Locat 1:0 Data.1>
L
Stamping cylinder
pneumatic valve
solenoid (retract)
ea
<Locat1:0 Data. 2>
Rung for Question 4 and Question 5.
5.
© Festo Didactic 20922-00
In the previous figure, what happens simultaneously when X2 is unlatched?
87
Exercise 3
Traffic Light Application (HMI)
EXERCISE OBJECTIVE
DISCUSSION OUTLINE
DISCUSSION
In this exercise, you will:
e
Write a simple PLC program
e
Configure, program, and test a new HMI project
The Discussion of this exercise covers the following points:
=
Traffic lights
="
="
Human-machine
Touch screens
=
Screen types
interfaces
Traffic lights
There are many ways to regulate the traffic where roads intersect. Traffic lights,
roundabouts, and signs (e.g., yield or stop) are popular methods employed to
make vehicles and pedestrians circulate as smoothly
and
securely as possible.
The choice of a particular method depends on the type of traffic, the site configuration, and the local customs.
Typical intersections controlled by traffic lights are depicted in Figure 114. On this
picture, secondary roads intersect a main road and pedestrians can get from one
walkway to another when
their dedicated light is lit. This context is similar to the
two-sided traffic light application that will be used in this exercise and the next.
One side of the module corresponds to the East-West direction. The other side
pertains to the North-South axis.
© Festo Didactic 20922-00
89
Exercise 3 — Traffic Light Application (HMI) # Discussion
Figure 114.
Intersections in New York City (courtesy of our photographer Danielle Giguére).
Human-machine interfaces
In plant environments,
interactions between the systems and the operators have
greatly evolved over the past few decades. Control rooms used to be massive
and required a lot of personnel to monitor and maintain the equipment. This is
90
© Festo Didactic 20922-00
Exercise 3 - Traffic Light Application (HMI) # Discussion
shown in Figure 115 for a control room dating from the middle of the twentieth
century.
Figure 115.
Control room of an old energy station.
In recent years, the advent of computers and touch screens have changed the
face of control rooms. Greater amounts of information are concentrated on a
much
smaller footprint.
Monitors have replaced a large quantity of indicator lights
and dials that became somewhat obsolete. Instead of a series of push-buttons
and switches, operators use a computer or a touch screen to send commands to
the systems.
Figure 116.
© Festo Didactic 20922-00
Modern control room in an Italian power plant.
91
Exercise 3 — Traffic Light Application (HMI) # Procedure Outline
Touch screens
When
it comes to selecting an industrial touch screen, a number of factors come
into play. Some common factors that influence the choice (and price) include:
e
the type of environment that the device has to endure
e
the memory options
e
the size and resolution of the screen
e
the communication protocols it uses
Screen types
To organize information efficiently, programmers of human-machine interfaces
tend to organize information into logic groups. Logic groups may translate into
different screens. For example, sensor values that pertain to the same unit may
well
be next to each
other on a single screen.
Depending
on the display size,
more or less information may be viewed simultaneously and navigation buttons
permit the user to go from one screen to another. Common interface screens
include:
e
Main. General view of the application.
e
Inputs and outputs. States and values provided by the PLC modules.
e
Alarm management. May include the error codes, description
faults, and time stamp. Alarms can be acknowledged and cleared.
e
Trending and data logging. Analog values can be interesting to observe over time. These values can translate into a trend on a monitor or
of the
be exported.
PROCEDURE OUTLINE
The Procedure is divided into the following sections:
=
Set up and connections
=
PLC programming
Starting a new project. Entering instructions. Transferring the PLC
project.
="
Programming the interface
Project Settings. Network configuration. Arranging tags. Developing the
interface. Testing the application in FactoryTalk View Studio. Transferring
the HMI! program to the touch screen.
=
=
=
92
Using the application
Troubleshooting
End of the procedure
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
PROCEDURE
Set up and connections
The application we will use replicates the street lights that can be found at the
intersection of two roads. The present exercise focuses on HMI programming,
although some PLC programming will still be necessary for testing purposes.
Exercise 4 will focus on programming so that, for example,
when the green light
fs lit on one side, the red light is lit on the other side.
1.
Connect the equipment as shown in Figure 117 or Figure 118. The tags used
in this exercise are shown
in Figure 119. Note that the PLC
program and the
tags are the same whether or not you are using the real application. The difference lies in the outputs that are connected to the real application or to the
indicator lights of the training system.
Due to the fact that only eight indicator lights are available on the training system, the DO NOT WALK outputs are simply not connected if you use the virtual application. However, the HMI will still display all ten lights.
3355
3291
Figure 117.
© Festo Didactic 20922-00
Traffic light setup (real application).
93
Exercise 3 —Traffic Light Application (HMI) # Procedure
FESTO
ore
syauink
=
analog: (1,
Figure 118.
Name
Alias For
=3/4] Base Tag
Data Ty} Description
Local:1:|.Data.0 | Local:1/1.Date.0
PB2
Local:1:|.Data.1 | Local:1:1.Data.1 | BOOL | Push-Button 2 (NC)
sw3
Local:1:|.Data.2 | Local:1:1Data.2
Sw4
Local:1:|.Data.3 | Local:1:1.Data.3 | BOOL
Sw5
Local:1:|.Data.4 | Local:1:1.Data4
BOOL
BOOL
BOOL
BOOL
BOOL
|BOOL
|
|
|
|
|
|
HMI Toggle
HMI Toggle
HMI Toggle
HMI Toggle
HMI Toggle
Push-Button
Switch
Switch
Switch
Switch
Switch
1 (NO)
6
7
8
9
10
|BOOL | Toggle Switch 3
| Toggle Switch 4
|BOOL | Toggle Switch 5
Li
Local:1:0.Data.0 | Local:1:0.Data.0 | BOOL | Light 1- Red North/South
L2
Local:1:0.Data.1 | Local:1:0.Data.1 | BOOL | Light 2- Amber North/South
3
Local:1:0.Data.2 | Local:1:0.Data.2 | BOOL | Light 3- Green North/South
Local:1:0.Data.3 |
Local:1:0.Data.4 |
Local:1:0.Data.5 |
Local:1:0.Data.6 |
Local:1:0.Data.7 |
Local:1:0.Data.8 |
Local:1:0.Data.9 |
Figure 119.
94
Traffic light setup (virtual application).
SwW6
sw?
swe
sw9
sw10
PBI
L4
L5
Lé
L7
La
Lg
L10
fl
Local:1:0.Data3 |
Local:1:0.Data.4 |
Local:1:0.Data.5 |
Local:1:0.Data6 |
Local:1:0.Data7 |
Local:1:0.Data.8 |
Local:1:0.Data$ |
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
|
|
|
|
|
|
|
Light
Light
Light
Light
Light
Light
Light
4 - Amber No Walk North/South
5 - White Walk North/South
6 - Red East/West
7 - Amber East/West
8 - Green East/West
9- Amber No Walk East/West
10 - White Walk East/West
Tags and connections for Exercise 3.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
PLC programming
This program is relatively straightforward. One NO button, one NC button, and
three toggle switches control the five lights of the north-south axis. Five HMI toggle switches control the five lights of the east-west axis. When the state of an
input changes, the corresponding light turns on. For example, when the NO
push-button is pressed, the red light of the north-south axis turns on.
Starting a new project
2.
Open a new project in Logix Designer as shown in Figure 120. Enter a name
for the project. When selecting the project controller, be sure to choose the
product number indicated on the PLC (L24...). Then, select a compatible
controller revision (Figure 121).
4
=CompactLogix™ 5370 Controller
1769-L1GER-BB1B
CompactLogix™ 5370 Controller
1769-L18ER-BB1B
CompactLogix™ 5370 Controller
1769-L18ERM-BB1B
CompactLogix™ 5370 Controller
1769-L24ER-QB1B
CompactLogix™ 5370 Controller
1769-L24ER-QBFC1B
CompactLogix™ 5370 Controller
1769-L27ERM-QBFC1B
CompactLogix™ 5370 Controller
1769-L30ER
CompactLogix™ 5370 Controller
1769-L30ERM
CompactLogix™ 5370 Controller
1769-L30ER-NSE
CompactLogix™ 5370 Controller
1769-L33ER
CompactLogix™ 5370 Controller
1769-L33ERM
CompactLogix™ 5370 Controller
1769-L36ERM
CompactLogix™ 5370 Controller
Name:
MyExercise¥
Location:
C:\Users\LV33\Documents
Figure 120.
© Festo Didactic 20922-00
Starting a new PLC project.
95
Exercise 3 — Traffic Light Application (HMI) # Procedure
1769-L24ER-QBFC1B CompactLogix™
5370 Controller
sagas}
Revision:
Security Authority:
[No Protection
oO
Zo
Use only the selected Security Authority for authentication
and authonzation
Description:
Figure 121.
3.
Selecting controller revision.
Create a new ladder routine called
MainTask ® MainProgram (Figure 122).
LDO1_Traffic_Lights
in
Tasks®
a 2 Tasks
i a a MainTask
'
!
B aS MainProgram
\_..@) Parameters and Local Tags
EA MainRoutine
i
9
~~] Unscheduled Programs/ Phases
Figure 122.
96
New ladder routine.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
Entering instructions
4.
B
File
Edit
ag
_—
Open MainRoutine
(Figure 123).
View
Search
Logic
No Forces
No Edits
Communications
RUN
=
2
vo
Window
Jump
To
Subroutine
(JSR)
Help
~ a
4a (F: FR AQ.
| Path: [<none>
a
4
=H
«
=
>
Tools
instruction
—
—
E | Controller
ontroller 0 Organizer
reso
an
a
w
im OK
[
=|
add
6 teow
Offine =,
© |]
|7
and
wf
i)
x)
ted
teal
» X Sequencer
5fe
SS
Be
es
ump
Let | usR| uxR
X Equipment Phase),
ese
aoa
on
-
Ga Controller MyExercise3
SBR
TND
»
4
ISR
Jump To Subroutine
Routine Name
?
Return Par
?
Input Par
3 |
For!
J mp to Subroutine
—|
Controller Tags
RET
Program Control
a
>
?
(End)
oe MainProgram
Parameters and Local Tags
MainRoutine
&
LDO1_Traffic_Lights
(2 Unscheduled Programs/ Phases
Figure 123.
5.
Set Routine
Figure 124.
0
Name
to
call
Adding a JSR instruction.
routine
LDO1_Traffic_Lights
e
e
e
JSR:
Jump To Subroutine
Routine Name a
@
Input Par
&
é
Return Par
as
shown
in
MainRoutine
€
(End)
Figure 124.
© Festo Didactic 20922-00
Setting Routine Name.
6.
Get rid of the other parameters (/nput Par and Return Par) by right-clicking
them and selecting Remove Instruction Parameter.
7.
Open the Edit
Figure 119. As
scription for all
other tags need
Tags tab of the Controller Tags window. Enter all the tags of
shown in Figure 125, you need to enter the Name and Detags. HMI tags also require that you specify the Data Type. All
an Alias For to link them to a specific PLC input or output.
97
Exercise 3 — Traffic Light Application (HMI) # Procedure
ey
Uv
3
3
&
a
a
[-Locatt:!
‘LFaut
;
—DINT
o/1/2|/3)4]/5]/6|7
8 | Used: N
AZ| 13) 14) 15
INT Used; N
A®:Embedd...
Figure 125.
98
Entering the controller tags.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
8.
Open routine LDO1_Traffic_Lights. Enter one XIC and one OTE instruction
on ten different rungs. These instructions will link a button to a light, according to Table 4. Figure 126 shows two examples.
Table 4.
Correspondence between inputs and outputs.
Rung
aa
Description
Output | Description
0
PB1
Physical NO push-button
Li
Light 1 (Red, NS)
1
PB2 |
Physical NC push-button
L2
Light 2 (Amber, NS)
2
SW3._ |
Physical Toggle switch
L3
Light 3 (Green, NS)
3
SW4_ |
Physical Toggle switch
L4
Light 4 (Walk, NS)
4
SW5. |
Physical Toggle switch
L5
Light 5 (Don’t Walk, NS)
5
SW6 |
Virtual (HMI) toggle switch
L6
Light 6 (Red, EW)
6
SW7 |
Virtual (HMI) toggle switch
L7
Light 7 (Amber, EW)
7
Sws |
Virtual (HMI) toggle switch
L8
Light 8 (Green,
8
SW9_ | Virtual (HMI) toggle switch
L9
Light 9 (Walk, NS)
9
SW10 | Virtual (HMI) toggle switch
L10
EW)
Light 10 (Don’t Walk, NS)
LDO4_Traffic_Lights
Author : Festo
Rev : 2014-11-10
Revision History:
- 2014-11-10 : Original Release
Description : This function contains the logic regarding the control of a traffic light
Light1 - Red North/South
Light1 - Red
Push-Button 1 (NO)
a
North/South
PB4
u
<Local1:LData.0>
<Local1:0.Data.0>
JE
Light2 - Amber North/South
Light
2 - Amber
Push-Button 2 (NC)
1
North/South
Pa2
L2
<Local:1:1 Data. 1>
<Local1:0.Data.1>
JE
Figure 126.
© Festo Didactic 20922-00
Example rungs.
99
Exercise 3 — Traffic Light Application (HMI) # Procedure
9.
Right-click rungO and select Edit Rung Comment (Figure 127). Write a
meaningful comment (we used the name of the output in Figure 126). Do the
same thing for the other nine rungs.
Cop Rung
ents
Copy Rung
Ctrl+C
Paste
ic regarding the control of a traffic light
Ctrl+V
Delete Rung
(a
brth/South
Light 1- Red
North/South
Del
Add Rung
Ctrl+R
Edit Rung
Enter
u
<Local:1:0. Data 0>
Import Rungs.
Export Rungs...
——EEl==>=
Start Pending Rung Edits
porte/South
Light 2 - Amber
Ctrl+Shift+S
le
Accept Pending Rung Edits
<Local:1:0.Data 1>
Cancel Pending Rung Edits.
Assemble Rung Edit
Cancel Rung Edit
North/South
SEES A
Voy Ring
Go To...
CtrleG
Add Ladder Element...
Alt+Ins
Figure 127.
Light 3 - Green
—
- Local:1:0.
bata. 2=
<
Edit rung comment.
Transferring the PLC project
10. Save your program. Open Communications ® Who
Select the path to the controller and click Download.
Autobrowse
2
Active
(Figure 128).
_ Refresh|
Workstation, VM7X6d
-#s
©)
Linx Gateways, Ethernet
AB_ETHIP-1, Ethernet
= J 192.168.0.10, 1769-L24ER-QBFCIB LOGIXS324ER, 1769-L24ER-QBFCLB/A LOGINS324ER
a)
a
[__Dewnioad
|
CompactBus, CompactLogix System
t
769-L24ER-QBFC1B
LOGIX5324E
GJ 01, Embedded Discrete IO
[i] 02, Embedded AnalogIO
i» [g] 03, Embedded Counters
{J 192.168.0.11, PanelView Plus_? Standard 700, PanelView Plus_7 Standard 700
Path
AB_ETHIP-1\192.168.0.10\CompactBus\0
Path in Project:
<none>
Set Project Path
| Clear Project Path |
Figure 128.
Downloading from the Who Active window.
11. Once the program is downloaded, put the controller mode to (Remote) Run.
100
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
12. Push the green button under the red emergency button on the trainer to activate the PLC outputs.
13. (Test) Do the connected buttons and toggle switches trigger their corresponding PLC outputs when they change state?
QO Yes
OI No
If they don’t, revise your PLC program now and download it again.
Programming the interface
Let us start developing the HMI program. The MAIN screen will feature two seis
of five street lights and five HMI toggle switches to control the East-West lights.
14. Start a new project in FactoryTalk View Studio (Figure 129).
" New/Open Machine Edi
New
| Gasting
Application name:
My TrafficLightHMI
Description:
|
Language:
[English (United States), en-US
[Create]
Figure 129.
[__
impor...
Starting a new interface project.
Project Settings
15. Open System ® Project Settings, select PVPlus 700/1000 (640x480)”,
click OK (Figure 130).
g)
and
You may now be able to select your actual touch screen (a PVPlus 7). However, at the time the exercise
was tested, FactoryTalk View Studio could not cre-
ate a version 7 runtime application (.MER) unless a different touch screen was
selected.
© Festo Didactic 20922-00
101
Exercise 3 — Traffic Light Application (HMI) # Procedure
8 S My Traffic Light HMI
(VM7X64)
iffy My Traffic Light HMI2
6B My TrafficlightHMI2
=Ey System
Project Settings - /MyTrafficLightHML/
{os |le)s)
General | Funtime |
Project window size:
[PYPhus ? Standard/Perlormance 6/7" (640x480) _~|
Width:
[B40
Height:
[480
Please save Alarm Setup edits before changing the
Project Window Size setting between PanelMiew
Plus Compact and PanelMiew Plus, or vice versa.
Any unsaved Alarm Setup changes will be lost if the
Project Window Size setting is changed from a
PaneNiew Plus to PanelView Plus Compact terminal,
of ¥ICe versa
Ge
RSI inv Entemrice
Figure 130.
Selecting project window size.
Network configuration
16. Open RSLinx Enterprise ® Communication Setup from the Explorer window.
Select Create a new configuration in the opening window (if necessary).
17. Select the path to the PLC under the Design (Local) tab and click Device Shortcuts » Add. Call this shortcut “PLC” as shown in Figure 131.
Design [Local] | Funtime (Target) |
MM) RSLinx Enterprise, VIM7X64
(9 1789-A17, Backplane
j-ay EtherNet, Ethernet
E}-fJ
192.168.0.10, 1769-L24ER-QBFC1B, Ex1_20150112 Festo
5-4) CompactLogix System, CompactLogix System
;
o
1,1769-L2ER Embedded
Discrete YO, Embedded Discrete 10
ff] 2,1769-L2ER Embedded Analog I/O, Embedded Analog_IO
|. 3,1769-L2ER Embedded HSC, Embedded Counters
3} USB, 17-Node USB CIP Port
New shortcut
Select this path
Figure 131.
102
“PLC” shortcut.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
18. Next, click Copy from Design to Runtime (top right) and Yes as shown in
Figure 132 so that the file that will be executed by the touch screen also reflects this change.
The Runtime (Target) configuration and shortcut definitions will be replaced
with a copy of the Design (Local) configuration and shortcut definitions.
Do you want to continue?
No
Figure 132.
|
Copying configuration to Runtime.
19. Finally, click OK (bottom right) and Yes (Figure 133) to save this new configuration.
J)
You may not get the window of Figure 133.
You've made the following changes to the shortcut 'PLC’:
Design (Local) path edited
- Old:
- New: Ethernet.£d_20150112_Festo
Press Yes to apply changes. Press No to discard changes.
a
Figure 133.
Applying changes.
Arranging tags
£)
The subject of
debatable. It is
if a PLC tag is
and not all the
using HMI tags instead of direct references to the
easier to reference PLC tags directly, but HMI! tags
changed because then only the HMI tag needs to
references in the HMI project. Another advantage
bility to configure minimum
and maximum
PLC tags is
prove useful
be modified
is the possi-
values of a tag for the whole project.
Here we will create HMI tags.
20. Open HMI Tags » Tags. Create a new folder for the tags by clicking
shown in Figure 134. Call this new folder “Application”.
© Festo Didactic 20922-00
Cc
as
103
Exercise 3 —Traffic Light Application (HMI) # Procedure
Click here
xe
40%
Tag
we
(os)
Name:
Description:
Data
Source
Type:
@) Device
Address:
Memory
(PLC)L3
Search For:
P (2 system
Figure 134.
104
Creating an HMI folder.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
21. Click the empty row at the bottom and create a tag named “L1”. Set Type to
Digital, Data Source Type to Device, and browse for the address. In the
opening window shown in Figure 135, click Refresh All Folders so you can
see live tags. Then, select PLC
®
Enter tag name
Online ® L7 and click OK.
‘-
Click to browse
New
Data Source
Type:
[Help _|
@
Device
(©) Memory
(se)
Address:
(4
Search
For:
=
Lol
Select Tag
Folders
=
Contents of '/::PLC/Online*
=) MyTrafficlightHML
&
(9
| SESE
CG
Access Rig...
Application
Gaal: PLC
system
}
)-{)
-Q
Diagnostic Iter
Online
i
(Gal
system
«|
ReadWrite
ReadWrite
ReadWrite
ReadWrite
)
FRetresh All Folders
Descriptio:~
ee
+
Mt
Tag filter:
Selected Tag
(PLCIL1
Home atea
Click to refresh folders
Figure 135.
© Festo Didactic 20922-00
Tag browser window.
105
Exercise 3 —Traffic Light Application (HMI) # Procedure
22. Click Accept and select the next empty line (2) in the table at the bottom.
Enter the rest of the tags shown in Figure 136. Descriptions are optional but
recommended.
Tag Name
[Type
| Description
1
|Application}L1
Digital
Light1 - Red North/South
2
3
|Application\L10
|Application\L?
Digital
Digital
Light 10 - White Walk EastV¥est
Light 2 - Amber North/South
4
|Application\L3
Digital
Light 3 - Green North/South
5
6
7
&
|Application\L4
/Application\L5
|Application\L6
|ApplicationtL?
Digital
Digital
Digital
Digital
Light4
Light 5
Light 6
Light #
9 | Application\Lé
Digital
Light 6 - Green Eastfest
10
11
Digital
Digital
Light 9 - Amber No Walk East(Vfest
HMI Toggle Switch 10
|Application\L9
|Application\S¥/10
| 12 |Application\SW6 | Digital
13
14
15
jApplication\S\V7 | Digital
|Application\S¥V68 | Digital
aan
a
-Amber No Walk North/South
- White ¥falk North/South
- Red EastfVest
- Amber East'est
HMI Toggle Switch 6
HMI Toggle
HMI Toggle
Switch 7
Switch 8
HMI ——
switch 9
Figure 136.
HMI tags to enter.
Developing the interface
23. Open
Graphics
»
Displays
®»
MAIN.
At
this
point,
the
MAIN
display
(Figure 137) is almost empty, except for a Shutdown button.
[EF MAIN - /MyTrafficLightHMV// (Display)
[rc
= fe)
pSCn
Figure 137.
106
MAIN display almost empty.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
24. The Objects toolbar contains a variety of preprogrammed elements to navigate, display information, or enter data. Click Ellipse (Figure 138).
a
File Edit
View
MaS\0e
Ms
Qbjects
Arrange
Animation
4%
Application
Tools
Window
Help
eI
eae weesaesaancgs |
Objects J [MOAB OGOCN SV OOIOVCRRP ASSO TDEe Rae
sy SH
toolbar
Dolwsme raat
d vase G#SHHOTIOORSSSS
Z
;
Click here
ef. MyTrafficlightMl
—~7
hg My TraticLightHMl (VM 7X64)
“
Figure 138.
Ellipse tool.
25. Click on the display area while moving the cursor to draw a circle. The Properties window of Figure 139 opens automatically. Under the General tab,
change the back color to dark red. This circle will represent a red traffic light
that is not energized.
Line width:
Solid
WB Fore color
1
Back style:
Solid
Pattern style:
Figure 139.
© Festo Didactic 20922-00
Drawing a circle.
107
Exercise 3 —Traffic Light Application (HMI) # Procedure
26. Under the Common tab (Figure 140), you can specify the exact size and
position of the object. A size around 52 x 52 is fine. Click OK.
Position
Ton
5
Visible
Figure 140.
Common tab of the Ellipse Properties window.
27. Copy and paste this circle 5 times until you have six lights. Change the colors
according to Figure 141 so you have two sets of three lights: non-actuated
(darker) lights and actuated (brighter) lights.
O
OC)
f
Line width:
IB Fore color
©
i
Pattern style
1
Back color
|
el
a
Shutdown
Figure 141.
108
On and off street lights.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
28. Click the Text tool icon (Figure 142) and create a text box under the existing
lights.
WMoAseaco~xnwunoga
Woe
eae
=e
=
[Explorer -My TrefficLight HMI
Figure 142.
qrhva
iF] |
Text tool.
29. We will use this text do display the DON’T WALK state on screen. Write the
text on two lines. Choose an orange Fore color, and set Size to 16 as shown
in Figure 143.
Font
E
Back
ack color
col
BB Fore coler
a8
wo
Back
ack style:
style
Transparent
[¥) Size
to fit
(¥) Word wrap
Figure 143.
© Festo Didactic 20922-00
Don’t walk text properties.
109
Exercise 3 —Traffic Light Application (HMI) # Procedure
30. Repeat the operation to create a blue WALK text box of the same size underneath. The end result is shown in Figure 144.
DON'T
WALK
WALK
Figure 144.
31. Now
here
Walk and don’t walk text boxes.
is the trick. In a few procedure
steps,
we will position
the bright
lights on top of the dark ones and make them visible only if the corresponding tag is at logic state 1. Otherwise (if the tag is at logic state 0), we will only
see the dark lights that are on the background.
Let us start by setting the an-
imation of the bright red light. Right-click on the circle and
tion » Visibility.
=
8
select Anima-
si:
Properties
a
Key Assignments...
Arrange
©
C
>,
Color...
Convert to Wallpaper
eon
Tag Substitution...
Horizontal Position...
Vertical Position...
Fill...
Property Panel
DON
'T
WALK
-
Object Explorer
Cut
|
sae.
Rotation...
Copy
WALK
_
Horizontal Slider...
Paste
Vertical Slider...
Paste without localized strings
Delete
Duplicate
Figure 145.
110
Setting the visibility of the bright red light.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
32. In the Animation window, under the Visibility tab, click Tags (Figure 146).
Click Refresh All Folders and select HMI tag L7 in the Application folder.
Click OK.
Vertical Position
Horizontal Position
Eill
‘Visibility
Horizontal Slider
Touch
Vertical Sider
Color
Aotation
OLE Verb
‘width,
Select Tag
Folders
Contents of '*:Application’
iy) MyTrafficLightHMI
SJ Application
fi PLC
Name
Access Rig...
&
ReadWrite
PA
2G system
Refresh All Folders
ascii
uo
fv
ReadWrite
@B
¢ la
ReadWrite
ReadWrite
aoc
4
a
Description
*
Oc
Tag filter
Selected Tag
Application\L1
Home area:
Figure 146.
Setting the visibility tag of the red light.
33. Back in the Animation window,
make
sure the expression
resembles that of
Figure 147 and that the Visible (Expression true state) option is selected.
Click Apply and Close. The red light is now set to be visible only if L1 is on.
I
I
Vertical Position
Touch
I
I
Horizontal Slider
Color
width:
I
‘Vertical Slider
I
OLE Verb
Height
Expression
Application\LT
‘i
.
Expression true state
O Invisible
— @ Visible
Figure 147.
Object visible when expression is true.
34. Link the bright yellow (L2), bright green (L3), DON’T WALK (L4) and WALK
(L5) objects in a similar manner. The two text boxes will only show if their tag
is at logic state 1.
© Festo Didactic 20922-00
Exercise 3 —Traffic Light Application (HMI) # Procedure
35. (Optional) In the View menu, select the Show Grid and Snap On options to
help you with the positioning.
36. Copy and paste all eight objects (Figure 148). Each set of eight lights corresponds to an axis (North-South or East-West).
L10
Figure 148.
Two times eight objects.
37. Change the visibility links of the right-hand set of lights: bright red (L6), bright
yellow (L7), bright green (L8), DON’T WALK (L9), and WALK (L10).
38. Position
the
bright
colored
lights
exactly
over
their
darker
counterpart
(Figure 149).
DON'T
WALK’:
WALK
Figure 149.
112
- DON'T
:"):: WALK
‘ WALK
Two sets of five lights.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
39. We now want to create five HMI buttons to control the lights on the right side
(East-West axis). To do so, click the Multistate Push Button tool button
(Figure 150).
Click here
(POABSOCOC\VADOC
SS 88 om aes
A
(seh
| Explorer - MyTrafficLight HMI
(|
Figure 150.
40. Click
on the
display
area
a5,z
A
_2e,
“| Multistate Push Button
ROR R RRs
Click Multistate Push Button.
while
moving
the
cursor to draw
a square.
The
Properties window of Figure 151 opens automatically. Under the General tab,
reduce the border width to 1.
Change to a1
Appearance
Border style:
-
Border width:
“
Border uses back color
BB Highlight color
Back style:
Shape
Rectangle
*
State settings
Number of states:
Next state based on:
2
Current State
+
¥
Touch margins
Honzontal
0
margin:
Vertical margin:
0
Other
Audio
Figure 151.
© Festo Didactic 20922-00
Multistate push button properties.
113
Exercise 3 — Traffic Light Application (HMI) # Procedure
41. Click the States tab (Figure 152). With StateQ selected on the left, click
browse ((.)) to select an image. This image will be displayed when the logic
state is 0.
General | States | Timing Common
Select state:
State1
Error
| Connections
General
Value:
a
IB Back color
Border color
© Blink
Pattern style:
(Patten color
=
Font.
Arial
0
Hl
Caption color
Caption back style:
BB Caption back color
(7) Caption blink
] Word wrap
Insert State
©
3
Image settings
Image:
Image back. style:
Delete State
O
BB
Image color
Image back color
M1 Image blink
[Image scaled
(0K) [cancel |
Figure 152.
114
States tab.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
42. In the Image Browser window, click Launch Library (Figure 153).
Click here
Select image:
Arrow Down
Arrow Left
Add from
File...
Arrow Right
Ne
Arrow Up
Launch
Sho
Libr
Backspace
End
Enter
Home
Mini silver taggle {Lip}
Library
Paddle switch1 [Black Down]
| Delete |
Paddle switch 1 (Red Up)
[| deete
|
Paddle switch 2 (Green Down)
Paddle switch 2 (Green Up]
Page Down
Dene lie
Image attributes
Type:
Width » Height:
Format:
Figure 153.
Image Browser window.
43. In the Symbol Factory window, select the Standard toggle 3 symbol in the
Gadget Switches 1 category (Figure 154).
File
Edit
View
Options
Help
| Preview
(146 x 64 prxels)
-
_ Categories
Gadget Buttons1
Gadget Buttons2
Gadget Buttons3
Gadget Lights1
Gadget Lights2
Gadget Panel Piece]
Gadget Switches 1
Gadget Switches 2
Gadget Textures
iI] International Symbols
ISA Symbols.
ISA Symbols (3-D)
| ahoratons
Figure 154.
© Festo Didactic 20922-00
Standard toggle 3 in the Symbol Factory window.
115
Exercise 3 — Traffic Light Application (HMI) # Procedure
44. Before you do anything else, select Options ® Configure and select the Bitmap copying and exporting option called Use original bitmap size, as shown
in Figure 155. This option generates an undistorted image of the original resolution. Click OK.
Category File Path
[oT
Browse...
This is the location of the category (*.CAT) files. This can
be on your local hard
drive.or somewhere on your network. Leave blank to use the same directory as
this prograrn
When | click copy:
[7 Always on top
Copy as picture and bilmap
f# Automatically minimize after copying
FF Do not tile textures
¥
Mawimur optimization
Soften black lines
Thumbnail
a
=~
Picture optimization:
*
Smoothing:
size:
On [high quality)
Bitmap copying and exporting:
Peers
Export Options
[# Export transparent GIFs
TO
Use fringe reduction algorithm
JPG qualiy,
| Highest quality (100)
Figure 155.
=.
Use original bitmap size option.
45. Back to the Symbol Factory window,
(Figure 156).
click Copy in the upper-right corner
Click here
Figure 156.
116
Click Copy with Standard toggle 3 selected.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
46. Click Paste from Library in the Image Browser window. Click OK to keep the
default image name. The Standard toggle 3 (Down) image is added to the
Image Browser selection list (Figure 157). Click OK.
Select image
Add Filefrom
Backspace
End
Enter
i hexeane
Home
Librayy
Mini silver toggle (Up]
Paddle switch1 (Black Down)
Paddle switch1 [Red Up]
se
Paddle switch 2 (Green Down)
Paddle switch 2 (Green Up)
Page Down
| _
Library
Standard toggle 3 (Up)
Standard toggle 4 [Down]
Image attributes
Type:
True color
Width » Height: 64 « 64
Format:
Bitmap
Figure 157.
© Festo Didactic 20922-00
Image browser showing the toggle switch image.
117
Exercise 3 — Traffic Light Application (HMI) # Procedure
47. Back in the States tab of the Properties window, click State? and repeat the
previous steps to set Standard toggle 3 (Up) as the image displayed when
the logic state is 1 (Figure 158).
Gray toggle 1 (Down)
Home
Launch
Mini silver toggle [Up]
Libron
Paddle switch 1 (Black Down)
Paddle switch1 [Ried Up]
Paddle switch 2 (Green Down)
Paddle switch 2 [Green Up)
Page Down
Page Up
Standard t
oy.
5
3 (Down!
Standard taggle 4 [Down]
Image attributes
Type:
True color
\Wwidth # Height: 64 4 64
Format:
Bitmap
Inzert State
Delete State
()
|
C0 Image color
BB image back color
[7] Image blink
[J Image scaled
Lok}
[cance
Figure 158.
118
J { Aoniy
| [ele
|
Standard toggle (Up) image.
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
48. Under the Connections tab, link Value and Indicator parameters to tag Application\SW6 as shown in Figure 159. Value is a parameter that is written to
the destination. Indicator is the parameter that is read to update the appearance of the object. Click OK to exit the Properties.
General States | Timing
Common | Connections
|
Application SWE
Indicator
Tag / Expression
+ = Application. SWB
Select Tag
Falders
Contents of '/: Application’
fg} MyTrafficLightHMI
£3
Application
Name
Access Rig...
ReadWrite
ReadWrite
ReadWrite
ReadWrite
Retresh All Folders
Tag fiker:
Selected Tag
Applications
Ww6
Home area
Figure 159.
© Festo Didactic 20922-00
Connections to tag SW6.
119
Exercise 3 —Traffic Light Application (HMI) # Procedure
49. Copy and paste the same toggle switch four times and align the objects as in
Figure 160.
woe ee
SS oo
tee CHARESOORSSS
o) Meee
.
:
:
:
| [ General | States | Timing | Common | Connections
Name
|
Value
|
>
| | EE
Figure 160.
Tag / Expression
Application\ Sw?
Application Sw?
Aligning and changing the connections of the toggle switches.
50. Change the Value and /ndicator parameters of the four new toggle switches
to SW7,
SW8, SW9,
and SW10
respectively.
Testing the application in FactoryTalk View Studio
51. Select Application ® Test Application to start the HMI directly on your computer (instead of the touch screen). Click Yes when asked to save changes.
a
File
Edit
View
Objects
Arrange
Animation
iene neem
= aoe
WUS Oss
ef)s
[Ro AB
&
ens
eae
me fs if @
a
4h
acOe\ao00
Mobnhe¢
=a
[Explorer -MyTrafficLight HMI
Figure 161.
q
py
‘Help
:
counts Runtime kieanian =
Application Properties...
a¥2
OH
fal]: -
BnHaRA
2
Test Application command.
52. If all went well, you should be able to test all ten lights and five virtual toggle
switches as shown on Figure 162. Note that there can be a longer delay on
screen than with the real lights on the training system. If it is the case, right-
120
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Procedure
click the display area, select Display Settings (Figure 163), and adjust the
Maximum Tag Update Rate to 0.1 seconds (Figure 164).
ef
og
e® é 2
Ua
,)
e
oe
2
Sal
DON'T
WALK
rm)
a |
WALK
a
win
“55 |
a
|
Display Settings.
Key Assignments
:@
Property Panel
eo
ae
Object Explorer
=
:
ee
ei
Paste
Paste without localized strings
DON'T
¥ | Show Grid
WALK
¥ Snap On
Sere
Grid Settings...
- WALK 2)
Fe
Zoomin
Zoom Out
Cancel Zoom
ae
Pee
:
‘
:
| aa
seni
Emer
Figure 163.
© Festo Didactic 20922-00
ee
Opening the display settings.
121
Exercise 3 —Traffic Light Application (HMI) # Procedure
Display Type
©) Replace
Size
Use Current Size
© On Top
@
Cannot Be Replaced
Display Number:
Specify Size in Pls
‘width;
1
|634
Postion
seoutyCoie a]
Title Bar
Background Color
[|
[Use Gradient Style
Insert Variable
[Disable Initial Input Focus
sci
Maximum Tag Update Rate
Modify this value
Figure 164.
Adjusting the maximum tag update rate.
53. Click Shutdown. If you are satisfied with the result, you can proceed. If any
connection is not working, revise your program and test it again.
Transferring the HMI program to the touch screen
54. Create a runtime (.mer) application. Save it in a version that is compatible
with the touch screen.
55. Transfer
the
HMI
program
(.mer)
to
the
ME Transfer Utility, a FactoryTalk View Studio tool.
touch
screen
using
56. Load and run the HMI program on the touch screen. If errors show up on the
screen, check connectivity with the PLC and verify the tags you used in the
program.
Using the application
57. When you change the state of a physical or virtual button or toggle switch,
the corresponding HMI light should change color.
122
© Festo Didactic 20922-00
Exercise 3 — Traffic Light Application (HMI) # Conclusion
Troubleshooting
58. Insert the (right-most) fault number eight to the training system.
located inside the enclosure, just above the PLC (Figure 165).
Figure 165.
Faults are
Inserting fault number 8.
59. Observe how the system operates now. Describe what is different.
60. What could be the origin of the fault?
End of the procedure
61. Turn off the application, disconnect the leads and cables, and clean the work
surface.
CONCLUSION
In this exercise, you created a ladder-based PLC project from the beginning. This
program linked ten inputs to ten outputs, with five of the inputs being switches on
an HMI. After testing this program without the touch screen, you started a new
HMI project and entered HMI tags linked to the PLC. You developed the interface
so that various objects represent the lights and toggle switches in their on and off
states. You connected the objects to tags so that information circulates between
the
PLC
and
the interface.
Finally, you
tested
your
program
and
performed
a
short troubleshooting exercise.
© Festo Didactic 20922-00
123
Exercise 3 — Traffic Light Application (HMI) # Review Questions
REVIEW QUESTIONS
1
With the traffic light application, which part of the PLC
connected to?
are the street lights
Name two factors that influence the price of a touch screen.
What is the name of the interface screen that is a general view of the applica-
tion?
How does a normally-closed (NC) push-button behave in a ladder diagram
when it is linked to an Examine if Closed (XIC) instruction?
How can you link an HMI multistate push button object to a tag value in FactoryTalk View Studio?
124
© Festo Didactic 20922-00
Exercise 4
Traffic Light Application (LAD and SFC)
EXERCISE OBJECTIVE
DISCUSSION OUTLINE
In this exercise, you will:
e
Write a ladder program
e
Experiment with sequential function chart programming
e
Implement timer and counter instructions
«
Transfer program (local) tags to controller tags
e
Troubleshoot an application
The Discussion of this exercise covers the following points:
=
="
Programming a traffic light
Sequential function chart (SFC) programming
=
="
="
Timer On Delay instruction (Ladder)
Counter instruction (Ladder)
Reset instruction (Ladder)
Branching. Using ladder programming with a sequential function chart.
DISCUSSION
Programming a traffic light
Often,
you
will find
metal
cabinets
such
as the one
in Figure 166 standing
on
street corners. These cabinets are where the light controlling gear is located. The
circuits can
be of various
complexity
levels.
For example,
a proximity
detector
may detect the presence of vehicles, or pedestrian traffic can be managed using
push-buttons and dedicated lights. Some other elements that can complicate the
system further are priority lights, traffic signal preemption for emergency vehicles,
and coordinated signals with other street lights. A traffic light’s controller key
switch can also be mounted in the cabinet, thus permitting manual control of the
intersection by the police force. Of course, the traffic light control program grows
in complexity with a greater number of variables.
In this exercise, the metal cabinet standing
on the street corner with the control-
ling equipment is replaced by your advanced PLC training system.
© Festo Didactic 20922-00
125
Exercise 4 — Traffic Light Application (LAD and SFC) # Discussion
Figure 166.
Traffic light cabinet located on the Island of Orleans in Canada.
Sequential function chart (SFC) programming
In the first three exercises, we did our PLC programming exclusively using ladder
logic. Sequential function chart (or SFC) is another one of the five PLC languages defined by the IEC 61131-3 standard.
SFCs are characterized by steps separated by transitions. Therefore, they are
well-suited for batch processes or state machines. Figure 167 shows an example
of a simple traffic light. Each of the four steps represent a combination of lights.
In this case, step 3 is the current step during which the North-South axis green
light and East-West red light are on. The condition to transition to step four is that
a time delay of three seconds elapses.
126
© Festo Didactic 20922-00
Exercise 4 —-Traffic Light Application (LAD and SFC) # Discussion
Initial step
(double frame)
L
o™
a
NortvSouth : Red
&
| East/West: Green
Step1
@ | taniz
|}
Wait 3s
Tri_2
@
| NortWvSouth : Red|
East/West:
Amber
Step2
@|tecs
|
Trt3
Current step
(in green) “5
pa
Step3|
se
Desoription ol steps
(NorvSouth Green|, —~
| EastWest
: Red
Description of the condition
Next transition
NY
LG) | Tana
Tr3_4
eB
|
Watas
la togotostep 4
[NorthySouth : Amber]
East/West : Red
Step4
© | tana
=
Tra
Figure 167.
Example
of SFC with four steps and four transitions.
Branching
Of course, automated systems are not always that straightforward. For this reason, the SFC structure can include branches to give the choice between different options or permit several actions at the same time. To illustrate this concept,
let us take the small bottling application of Figure 168. In short, this system has a
rotating turntable (or carousel) with four stations, where:
© Festo Didactic 20922-00
1.
A distributor feeds the carousel with bottles.
2.
A second distributor places caps on top of the bottles.
3.
A pneumatic cylinder applies pressure to the caps to seal the bottles.
4.
Sealed bottles exit the carousel and end up in a
chute.
127
Exercise 4 - Traffic Light Application (LAD and SFC) # Discussion
Figure 168.
Bottling application (Model 8075-70).
The components of the model are described below:
1.
Bottle distributor
2.
Carousel (driven by stepper motor 1)
3.
Cap distributor
4.
Sensor 1 (normally-open limit switch)
5.
Rotary blade (driven by stepper motor 2)
6.
Sensor 2 (inductive)
7.
Capper (pneumatic cylinder)
8.
Chute
The logic behind this system can be boiled down to these three main steps:
0. IDLE. Default state when the system is powered but not in operation.
1. TURN. The carousel turns 90 degrees clockwise so that bottles transfer to
the next position.
2. CAP. Two actions happen simultaneously; a motor distributes a cap anda
pneumatic cylinder seals a bottle.
Figure 169 shows how this logic can be implemented in SFC format. Upon power
up, the system starts with the IDLE (0) step. If the START button is pressed and
STOP is not pressed, there is a transition to the TURN (1) step. When the motor
of the carousel rotates about 90 degrees clockwise, sensor PROX_DET activates
and brings the system to the CAP (2) step. At this moment, two actions happen
simultaneously: the pneumatic cylinder secures a cap to a bottle and the motor of
128
© Festo Didactic 20922-00
Exercise 4 —-Traffic Light Application (LAD and SFC) # Discussion
the cap distributor rotates 180 degrees to drop another cap on the following bottle. Sensor LIMIT_SW actuates when cap distribution is completed and marks
the end of the CAP step. The system then alternates between TURN and CAP
steps.
Initial step (IDLE)
oN
0
0:0/0
-—
1:0/0
Idling light on
(IDLING)
Transition condition(s)
(START_PB)
Transition
0.1: START_PB a STOP_PB
a
>
¥
1
0:0/2
——.
|
Motor 1 turning
1:0/2
(STH)
1.1: PROX_DET
(PROX_DET)
——
¥v
9
2.1: LIMIT_SW
0:0/8 is2)
Motor 2 tuming
1:0/3
O:0/4 (vay
Cylinder extending
(Linrt_swy
——
Figure 169.
Linear electro-pneumatic application.
Now, in Figure 170, step 2 is divided into two operations instead of just one: CAP
DISPENSING (2a) and CAP SEALING (2b). The double horizontal lines mean
that these operations are performed at the same time.
0
0:0/0
——
a
Idling light on
1:0/0
(IDLING)
0.1: START_PBaSTOP_PB
{START_PB)
—|—
7
1
|
0:0/2
.
1:0/2
Motor 1 turning
(871)
1.4: PROX_DET_
(PROX_DET)
Double line = parallel
operations
a
——
1
v
2a
|
0:0/3
(872)
Motor 2
turning
1:0/3
2b
|4
(LIMIT_sW)
O:0/4
avi)
Cylinder
y
extending
1:0/3
(LIMIT_SW),
[
2.1: LIMIT_SW
——
Figure 170.
Parallel branching (simultaneous actions).
Figure 171 shows a hypothetical example where a choice is made between steps
CAP DISPENSING (2a) and CAP SEALING (2b), depending on the condition of
the new
sensor Z. This sensor
indicates
if there
is a bottle under the cap
dis-
penser. If not, it is assumed that there is a bottle under the cylinder instead
(these conditions are mutually exclusive). In summary, step 2a is performed after
© Festo Didactic 20922-00
129
Exercise 4 - Traffic Light Application (LAD and SFC) # Discussion
step 1 if sensors PROX_DET and Z are actuated, and step 2b is executed if sensor PROX_DET is actuated but sensorZ is not actuated. Here, because there is
a choice of action, the branch
o
j-—
0:0/0
is a single horizontal line.
a
1:0/0
Idling light on
(IDLING)
(START_PB)
0.1: START_PB « STOP_PB
¥v
1
r—
0:0/2
.
1:0/2
Motor 1 turning
(sT1)
1.1a: PROX_DET azZ
+
(PROX_DET)
\
——
1.1b: PROX_DET AZ
Single line = choice
2
0:0/3
a
(sT2)
Motor 2
turning
10/3
2b
0:0/4
(LIMIT_SW)
(vay
Cylinder
extending
1:0/3
(LIMIT_SW)
<I
2.1: LIMIT_SW
Figure 171.
Alternate branching (selection).
Using ladder programming with a sequential function chart
The
logic of a state machine
can
be entirely contained
in a sequential function
chart or it can be partly in the SFC routine and partly in a ladder routine. In the
example of Figure 171, the actions performed by the system were attached directly to the steps and transitions on the sheet itself.
Another way of implementing the logic is to build the step and transition structure
of the SFC, but keeping the code on the SFC routine page to a minimum. Every
SFC step has a pre-defined data structure shown in Figure 172. Therefore, reference to the step can be made outside of the SFC routine by using an associated
tag.
130
© Festo Didactic 20922-00
Exercise 4 - Traffic Light Application (LAD and SFC) # Discussion
~ aX
Controller Organizer
(if) REAL
~ 3) REDUNDANT_INPUT
~~] REDUNDANT_OUTPUT
Name:
RA) SAFETV_MAT
fa]
~#]
-R)
8]
J)
(if)
2)
SFC_STEP
datatype >
Members:
‘Name
DINT
Description
*
a
-lff@] SFC_STOP
(3) SINT
fi] SPLIT_RANGE
~~) S_CURVE
pool] THRS_ENHANCED
FS
BOOL
SA
BOOL
LS
BOOL
DN
BOOL
OV
BOOL
AlarmEn
R) TIMER
-R) TOTALIZER
i] TWO_HAND_RUN_STATION
-B) UP_DOWN_ACCUM
&
Data Type
Status
“G2) SFC_STEP
1
Data Type Size: 28 bytes
Description:
SCALE
SEC_ORDER_CONTROLLER
SELECT
SELECTABLE_NEGATE
SELECTED_SUMMER
SELECT_ENHANCED
SERIAL_PORT_CONTROL
(fii) SEC_ACTION
4-4
SFC_STEP
Module-Defined
Trends
BOOL
AlarmLow
BOOL
AlarmHigh
BOOL
Reset
BOOL
PauseTimer
BOOL
PRE
DINT
T
DINT
TMax
DINT
Count
DINT
LimitLow
DINT
LimitHigh
DINT
yo Configuration
2-4] 1769 Bus
[0] 1769-L24ER-QBFC1B Exde_SFC_2
@3 Embedded /O
[1] Embedded Discrete IO
[2] Embedded Analog_IO
@ [3] Embedded Counters
| Expansion I/O:
O-as
Ethernet
Figure 172.
e
Structure of an SFC_STEP data type.
You can refer to the members of an SFC_STEP data object if the tag scope is
respected. For example, “Step7.xX” is the bit telling if step 1 is active.
Timer On Delay instruction (Ladder)
Timers can be programmed to delay PLC actions. Perhaps the simplest one to
understand is the Timer On Delay instruction (TON). The TON instruction
shown in Figure 173 starts to count when the rung in which it is contained goes
from false to true. As long as the rung remains true, the accumulated value increases until it reaches the preset value. If the rung becomes false, the accumulated value is reset to zero.
Timer Step 1
TON
Timer On Delay
Timer
Figure 173.
© Festo Didactic 20922-00
EN
TmrStep1
Preset
3000
Accum
1518
4(DN}—
Timer On Delay instruction
(ladder).
131
Exercise 4 - Traffic Light Application (LAD and SFC) # Discussion
Name
Value
‘= TmrStep1
© | Style
+ -TmrStep 1.PRE
3000
+) TmrStep1.ACC
1518
-—TmrStep 1.EN
—TmrStep1.1TT
L_|
Data Type | Description
{uaa}
TmrStep 1.DN
TIMER
|Decimal
Timer Step 1
DINT
Timer Step 1
|Decimal
DINT
Timer Step 1
1 |Decimal
BOOL
Timer Step 1
1
|Decimal
BOOL
Timer Step 1
6 | Decimal
BOOL
Timer Step 1
Figure 174.
Tags of a timer.
Figure 174 shows the tags for timer TmrStep7. The tags that you can use elsewhere in your program are:
Done bit (TmrStep7?.DN). Set to logic state 1 when the accumulated value becomes equal to the preset value, and reset to logic state 0 when
the rung becomes false.
Timer timing bit (TmrStep1.TT). Set to logic state 1 when the TON rung
is true and the accumulated value is less than the preset value.
Timer enable
bit (TmrStep7.EN).
Set to logic state value 1 when
the
rung is true.
Preset value (7mrStep1.PRE). This is the delay of the timer in milliseconds. When
the accumulated
value
reaches the preset value, the done
bit is set and the timer stops timing.
Accumulated
value
(7mrStep7.ACC).
creases as long as the rung
Value
in milliseconds
that
in-
remains true until it reaches the preset val-
ue.
Counter instruction (Ladder)
Counters ensure that a number of events occurs before something else happens. The Count Up instruction (CTU) of Figure 175 increases its accumulated value when the rung conditions make a false-to-true transition. The done bit is
enabled when the accumulated value reaches the preset value.
Counter Step 4
CTU
——j
Count Up
Counter
Preset
Accum
Figure 175.
Name
=-CinStep4
'+|-CinStep4. PRE
‘+ -CinStep4. ACC
Counter Up instruction (Ladder).
Value
©]
Style
oe}
3 |Decimal
3
|Decimal
Data Type | Description
COUNTER | Counter Step 4
DINT
Counter Step 4
DINT
Counter Step 4
BOOL
BOOL
Counter Step 4
Counter Step 4
|Decimal
BOOL
Counter Step 4
|Decimal
BOOL
Counter Step 4
0 | Decimal
BOOL
Counter Step 4
—CinStep4.cu
-CinStep4.CD
1 | Decimal
0 | Decimal
—CinStep4. DN
1
—CinStep4.0V
0
—CinStep4.UN
Figure 176.
132
CtnStep4
3
3
Tags of a counter.
© Festo Didactic 20922-00
Exercise 4 — Traffic Light Application (LAD and SFC) # Procedure Outtine
Figure 176 shows
program:
counter
CtnStep4 tags that you can use elsewhere
in your
Done bit (CinStep4.DN). Set to logic state 1 when the accumulated value is equal or greater than the preset value.
Count Up Enable (CtnStep4.CU). Set when the CTU instruction is enabled.
Overflow bit (CinStep4.0V).
2 147 483 647.
Underflow bit (CinStep4.UN).
der -2 147 483 647.
Set
Set
if the
if the
accumulated
value
accumulated
value
is over
is un-
Preset value (CtnStep4.PRE). This is the value to count. When the accumulated
value reaches the preset value, the done
bit is set.
Accumulated value (CinStep4.ACC). Value accumulated since the last
reset. Use the reset instruction to return this value to zero.
Reset instruction (Ladder)
To reinitialize the accumulated
value
you may use a reset instruction
step 5, counter CinStep4 is reset.
and
control status bits of a timer or counter,
(RES).
In Figure 177, we
see that, during
Pedestrian Cycle Counter Reset
S:FS : PLC First Scan Bit (True only on PLC first Scan)
Counter Step 4
SFS
E
NorthvSouth : Red
and Walk
CinStep4
RES,
East/West : Red and
Walk
Step5.x
Figure 177.
PROCEDURE OUTLINE
Resetting counter CtnStep4 during step 5.
The Procedure is divided into the following sections:
Preparation (tutorial)
Set up and connections
Ladder programming activity (no pedestrian)
PLC programming.
HMI transfer.
SFC programming activity A (no pedestrian)
Additional activity B (adding pedestrian lights)
Additional activity C (managing pedestrian demand)
Troubleshooting
End of the procedure
© Festo Didactic 20922-00
133
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
PROCEDURE
Preparation (tutorial)
1.
Open Logix Designer, go to Start Page ® Learning Center® How Do!»
Routines, and watch the video titled Enter a Sequential Function Chart. This
is a good introduction on how to create an SFC within Logix Designer.
fey Start Page
Tax
Tea eee
> What's New
How Do!
How
Do!
& General
Routines
&& Controller Projects
™ Modify the Main Routine
tm Tasks, Programs &
Phases
@&. Tags, Data Types & Other
Data
@
Enter Ladder Diagram Routine Logic
@
Enter a Function Block Diagram
m1,
»
@ Enter Structured Ted
@
Enter a Sequential Function Chart
“
Change
@& Routines
a Running Ladder Diagram
Routine
& 1/0 Configuration
Change a Running Function Block,
® Sequential Function Chart, or Structured
Text Routine
& Communications
@
Reference
a Tagin a Routine
@® Search for Components
™ Search by Cross Reference
Lae
colle g
Figure 178.
Starting the video explaining SFC programming.
2.
How can you hide a wire on an SFC window?
3.
Where are the errors shown after you verified the SFC routine?
Set up and connections
In this exercise, we will concentrate on the programming of the street lights at an
intersection.
We
will start by using only the red, amber,
and green lights.
Then,
we will incorporate the pedestrian lights to the programmed cycle. Finally, we will
add a pedestrian button and manage the demand for crossing the street. The
HMI can be either the one you devised in Exercise 3, minus the toggle switches,
or the one provided with the resource kit.
4.
Connect the equipment as shown in Figure 179 or Figure 180. The tags used
at the beginning of this exercise are shown in Figure 181. Note that the PLC
program and the tags are the same whether or not you are using the real application. The difference lies in the outputs that are connected to the real ap-
plication or to the indicator lights of the training system.
134
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
¥)
Due to the fact that only eight indicator lights are available on the training system, the DO
NOT
WALK
outputs are simply not connected if you use the virtu-
al application. However, the HMI will still display all ten lights.
3355
3294
Figure 179.
Traffic light setup (real application).
FESTO
‘systink
Ay
€
:
Figure 180.
© Festo Didactic 20922-00
ae
S
Traffic light setup (virtual application).
135
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
Name
Alias For
Base Tag
Da=s|2]
FALSE
BOOL
u
Description
ALWAYS
Local:1:0.Dats.0 | Local:1:0.Data.0 | BOOL
FALSE
Light 1- Red North/South
2
Local:1:0 Data.1 | Local:1:0.Data.1 | BOOL
Light 2 - Amber North/South
3
Local:1:0.Data.2 | Local:1:0.Data.2 | BOOL
Light
3 - Green North/South
L4
Local:1:0 Data.3 | Local:1:0 Data3 | BOOL
Light 4 - Amber No Walk Norlh/South
L5
Local:1:0.Data.4 | Local:10 Data 4 | BOOL
Light 5 - White Walk North/South
Lé
Local:1:0.Data.6 | Local:1:0.Data.5 | BOOL
Light 6 - Red East/West
L?
Local:1:0.Data.6 | Local:1:0.Data.6 | BOOL
Light 7 - Amber East/West
LB
Local:1:0 Data.? | Local:10 Data. 7 | BOOL
Lo
Local:1:0.Data.8 | Local:1:0.Data.8 | BOOL
Light 9 - Amber
No Walk East/West
Lio
Local:1:0.Data.9 | Local:1:0.Data.9 | BOOL
Light 10 - White Walk East/West
PBI
Local:1:|.Data.0 | Local:1:|.Data.0 | BOOL
Push-Button 1 - Pedestrian (NO)
Light
8 - Green East/West
Step1
Step2
BOOL
BOOL
North/South : Red East/West : Green
North/South : Red East/West : Amber
Step3
BOOL
North/South : Green East/West : Red
Step4
BOOL
North/South : Amber East/West : Red
TRUE
BOOL
ALWAYS TRUE
(}- TmrStep1
[+] TmrStep2
TIMER | Timer Step 1
TIMER =| Timer Step 2
(+) TmrStep3
TIMER
| Timer Step 3
(#]- TmrStep4
TIMER
| Timer Step 4
Figure 181.
£)
Tags and connections for the beginning of Exercise 4.
Four timers that will run between the four steps are added to the list.
Ladder programming activity (no pedestrian)
In this activity, you will program the PLC to turn the traffic lights on and off automatically, after predetermined time delays.
PLC programming
5.
Open
a new project in Logix Designer. When
selecting the project controller,
be sure to choose the product number indicated on the PLC (L24...). Then,
select a compatible controller revision.
6.
Create two new ladder routines in Tasks ® MainTask ® MainProgram called
LDO0_General and LD0O1_Traffic_Lights (Figure 182).
=~
Tasks
4
MainTask
®
Program Tags
ty MainRoutine
LDOO_General
LDO1_Traffic_Lights
Unscheduled Programs/ Phases
Figure 182.
136
Routines for the ladder programming activity.
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
7.
Open MainRoutine and add two Jump To Subroutine (JSR) instructions. Set
Routine Name to call routines LDOO_General and LDO1_Traffic_Lights as
shown in Figure 183. Get rid of the other parameters (/nput Par and Return
Par) by right-clicking them and selecting Remove Instruction Parameter.
MainTask / MainRoutine
Author: Festo
Rev : 2014-12-01
Revision History :
- 2014-12-01 : Original Release
“No Operation”
.
instruction to
Description : This function contains the call for all program Routines
0
add comments
{Ndr}
n
Call Routine LDOO - General
JSR:
Jump To Subroutine
Routine Name LOOO_General
41
Call Routine LDO1
t—J
- Traffic Lights
JSR:
2
Jump To Subroutine
Routine Name
Figure 183.
8.
Content of MainRoutine.
Enter all the tags of Figure 181 in Controller Tags.
<)
9.
|
LDO1_Traffic_Lights
Open
You could also create them while programming, as you will see later.
routine LDOOQ_General.
Program the routine according to Figure 184.
Having FALSE and TRUE tags is a common programming practice that is
used when we want a bit that is at logic state 0 or 1. For instance, the tag
FALSE will be used with an XIC instruction to include the pedestrian lights in
the PLC program. Although we want these lights to be off the whole time at
the moment, they will already exist when we need them in the future.
© Festo Didactic 20922-00
137
Exercise 4 — Traffic Light Application (LAD and SFC) # Procedure
Description
: This function contains general logic
0
fNoP}4
ALWAYS FALSE BIT
1
ALWAYS TRUE BIT
2
Figure 184.
138
ALWAYS FALSE
FALSE
u
ALWAYS TRUE
TRUE
—
—<—
Content of the LD00_General routine.
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
10. Open routine LDO1_Traffic_Lights. This is where the bulk of the programming
will take place. In short, we want the system to go through the sequence
shown in the flow chart of Figure 185.
y
First scan
Step 1
N/S Red, EW Green
Step 2
N/S Red, EW Amber
Step 3
N/S Green, EAW Red
s
Ne
>
Step 4
N/S Amber, EW Red
Figure 185.
© Festo Didactic 20922-00
Flow chart for the beginning of Exercise 4.
139
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
11. You may want to program the routine differently, but here is a suggestion.
Divide the routine into two sections: STEP LOGIC and ACTION LOGIC.
STEPLOGIC could have two rungs per step for a total of eight rungs.
Figure 186 shows how step4 is programmed. You can replicate the same
type of logic for step 3, step 2, and step 1. Notice that step 1 requires an additional first PLC scan condition so that the system starts at step1
(Figure 187).
J)
The time base for timers is 1 ms. Hence, a time-delay of3 s requires a Preset
of 3000.
STEP LOGICS
STEP 4
North/South : Amber
EastWest: Red
Condition for Step ACTIVATION : Wait 3s at Step 3
Conditon for Step DEACTIVATION : Wait 1s.
Timer Step 3
North’South : Amber
East/West : Red
TmrStep3.DN
Step4
I 6
kel
North/South: Amber
East/West
: Red
Steps
North/South: Red
North/South: Red
East/West: Green
East/West : Amber
Stept
Step2
re
= North/South : Green
East/West:
Red
Step3
)
STEP 4
Step Timer
North/South : Amber
East/West : Red
Step4
JE
Timer Step 4
TON
Timer On Delay
HC EN3—
Timer
Tmrsteps
Preset
1000 +-<DN}—
Accum
o¢
STEP3
North/South : Green
EastWest : Red
Figure 186.
Step 4 programming.
First scan bit
s get
Timer Step 4
TmrStep4.DN
North/South : Red
EastWest : Green
Step
Figure 187.
140
First PLC scan.
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
12. Program the ACTION LOGIC section. This section should consist of ten rung
in total, that is, one per light. Figure 188 shows how four of these rungs can
look. In short, there is an XIC instruction for each step where a light is lit. You
may refer to the timing diagram of Figure 189 if necessary.
&)
The ALWAYS FALSE bit on rung 12 ensures that the WALK light stays off.
ACTION LOGICS
Light 1 - Red North/South
Light 1 - Red
North/South
North/South : Red
East/West : Green
Step
9
4
<Local:1:0.Data.0>
+ F
aC
North/South : Red
East/West : Amber
Step?
Light 2 - Amber North/South
Light 2 - Amber
North/South
l2
<Local:1:0.Data.1>
North/South : Amber
East/West : Red
Steps
a
Light 3 - Green
North/South
Light 3 - Green
North/South
L3.
North/South : Green
East/West : Red
Step3
ih)
«Local:1:0.Data2>
a te
Jt
Light 4 - Amber No Walk North/South
12
ALWAYS FALSE
FALSE
aE
ac
Figure 188.
© Festo Didactic 20922-00
Light 4 - Amber No
‘Walk North/South
L4
<Local1:0.Data.3>
%
Part of the ACTION LOGIC section.
141
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
1)
0
1
|
+—(2)—4
2
3
|
(3)
4
5
|
“1
t+—(4)—4
6
|
7
|
8
|
|
|
L2
3
COSC
L6
J
=
L7
f=
is-ti‘a‘aiéOC..UOOOOOC*@d
Figure 189.
Timing diagram.
13. Check the controller for errors as shown in Figure 190 (Logic »
Controller). Make some modifications if required.
Verifying
Controller...
Verifying
Module
'Discrete_I0"
Verifying
Module
'Analog_I0”"
Verifying
Verifying
Module
'Counters'
routine "LDOO0_General'
Verifying
routine
of
program
"LDO1_Traffic_Lights'
of
Verifying routine "MainRoutine'
of program
Complete - 0 error(s),
0 warning(s)
fe)
Errors
Verify »
'MainProgram'
program
'MainProgram"
'MainProgram'
al Search Results}4e] Watch
Figure 190.
Checking for errors in the controller.
14. Save your program with a meaningful name.
15. Download the program to the PLC and put the controller to (Remote)
Run
mode.
16. Push the green button under the red emergency button on the trainer to acti-
vate the PLC outputs.
142
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
HMI transfer
17. If it is not already in the touch
Ex4_Full_ YYYYMMDD_Festo.mer
screen,
using
transfer the
HMI
program
ME Transfer Utility,
called
a FactoryTalk
View Studio tool. You may have to open the archived project, modify it, and
create a new runtime application if the PLC address or the version of the
touch screen does not match.
You may also use the HM! program you created in Exercise 3, minus the toggle switches on the right.
18. Load
and
run the
HMI
program
on the touch
screen.
The
program
should
resemble Figure 191. Street lights should go from green to yellow to red on
both sides. If errors show up on the screen, check connectivity with the PLC
and verify the tags you used in the PLC program and the HMI Communication Setup.
TRAFFIC LIGHTS
North-South
Figure 191.
reer
ed
East-West
Running the traffic light HMI program (step 1).
SFC programming activity A (no pedestrian)
In this activity, we will create an SFC routine to manage the transitions and modify the ladder routine that contains the rest of the logic.
19. Put the controller to Offline mode.
© Festo Didactic 20922-00
143
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
20. Return to Logix Designer and create
SFCO1_Traffic_Lights
under
Tasks ®
(Figure 192).
S BY
|
new SFC
MainTask®
routine called
MainProgram
Tasks
8 &
Poi
a
MainTask
g
MainProgram
nf
Program Tags
BB MainRoutine
i
LDOO_General
8
LDO1_Traffic_Lights
infil Sen
in
Me ee erie
Unscheduled Programs
/ Phases
Figure 192.
Adding an SFC routine.
21. If you do not call this new routine from the main routine, the SFC
not be used when
the PLC
operates.
Open
MainRoutine
and add
code will
a rung to
call this new routine.
£)
You can copy and paste rung 2 and change the Routine Name parameter and
comment.
22. Open the SFC routine. The routine should already contain a step and a transition (Figure 193).
Figure 193.
23. Now,
Step and transition in the new SFC routine.
if you open Program
Tags (Figure 194), you
can see that one tag was
automatically created for the step (Step_000) and another one for the transition (Tran_000). Tran_000 is just one bit. However, Step_000 is of the predefined data type SFC_STEP. If you click the plus sign, you can observe that
this data type is in fact made up of BOOL and DINT sub-elements.
J)
144
In this exercise, we will use the “X” bit. “X” is at logic state 1 when the step is
activated.
© Festo Didactic 20922-00
4
Exercise 4—Traffic Light Application (LAD and SFC) # Procedure
Step tag
(SFC_STEP type)
=
“x” bit
z
16#0020
&
oO
9
0
a
a
a
o
o
a
0
Qo
a
o
1
o
Q
Q
a
a
.
Transition tag
(boolean type)
a
Figure 194.
© Festo Didactic 20922-00
Tags created in Program Tags.
145
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
24. Back to the SFC routine, build a series of four steps separated by four transitions. Figure 195 shows how to add a step and a transition and connect them
to the existing ones.
(Step only)
Step and transition
6s
S
Offline
No Forces
}oB
on
Hl. & RUN
r ol
.
No Edis
a
ao
\
(Transition only)
\
Wim
9
¢
/92e
gh: [AG_ETHIPiy z
4
Ve]
EYP
AQ
0.
S—=
+
BS
2
6
(B)| « + \see/
<
Controller Organizer
3
~ AX
Controller Eda_Ladder_20:
A
Controller Tags
@
Controller Fault Handk
3
Power-Up Handler
A
&}-G5) Tasks
&-Gal MainTask
i
oe MainProgram
Program Tags
iD MainRoutine
{BB} LD00_General
LDO1_Traffic_Lic
|.)
SFCOL_Traffic_L
I _ Unscheduled Program:
©
Motion Groups
(9
e-
| Ungrouped Axes
Add-On Instructions
Data Types
i
a User-Defined
a ms
Green dot indicates connection
Figure 195.
146
Adding a step and a transition.
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
25. Close the loop by drawing a wire from the square at the bottom to the one at
the top (Figure 196).
Far
2. Drag until here
@ G | tran_o01
?
&
Step_002
@ G@ | tran_002
&
‘Step_003
& @ | Tran_003
?
Figure 196.
© Festo Didactic 20922-00
1. Click and hold from here
Closing the loop.
147
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
26. We want to use the names Step7, Step2, Step3, and Step4 for these four
SFC steps. Because these (Boolean) tags were already created in the ladder
version,
select
and
delete
them
from
the
Controller
Tags
as
shown
in
Figure 197.
fl) &e4a_ladder_2t
Name
+
Show: All Tags
|| ¥.
Data Ty
Oa
Extemal Access
sajyadoig
Step1
»
Scope
(eo)
[- eee]
Lg,
Controller Tags - Exta_Ladder_20141201_Festo(controller)
&
2 |
Cut
Ctrl+x
1
Read/Wrte
Copy
Ctrl+C
2
Read/Wrte
Paste
Ctri+V¥
3
Read/Write
=p4
Read/Write
TRUE
Set External Access
»
Figure 197.
1 - Pedestrian (NO)
Read/Write
Read/Whte
Deleting Boolean tags.
27. Open the LDO1_Traffic_Lights routine. What happens if you verify rung 1 as
in Figure 198? Explain what you observe in the Errors window.
148
© Festo Didactic 20922-00
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
M
|}? S868
Ss
ob.
=|
fab>
é
Bay
Copy Rung
Ctrl+C
a)
Paste
Ctrl+V
Delete Rung
Del
Add Rung
Ctrl+R
Edit Rung
Enter
Edit Rung Comment
Ctrl+D
Cut Rung
ION : Wait 3s at Step 3
TIVATION : Wait 1s
Step4
A
Import Rungs...
Export Rungs...
Start Pending Rung Edits
Ctrl+ Shift+S
Accept Pending Rung Edits
7
Cancel Pending Rung Edits
Timer Step 4
TON
Timer On Delay
r<EN>—
Timer
TmrStep4
Preset
1000 ++CDN}—
o€
Accum
Assemble Rung Edit
Cancel Rung Edit
Go To...
Ctrl+G
Add Ladder Element...
Alt+Ins
Figure 198.
Verifying rung 1.
28. Go back to the SFC routine. Change the name and enter a description for all
four steps by right-clicking the step box and selecting Edit “Step _XXX” Properties. This is shown in Figure 199 for Step_000 that becomes Step7.
¥)
© Festo Didactic 20922-00
Another way of editing a tag is by opening Controller Tags.
149
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
—_
Type:
|
Alias For:
-
SFC_STEP
Data Type
=|
Scope:
Edemal
Access:
Style:
Constant
Lok) [Cancel] | Aeeby] [
Figure 199.
150
Help]
Changing step tag names directly in the SFC routine.
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
29. The name and description of the transitions also need to be edited.
Figure 200 shows how Tran_000 becomes Tran1_2. Next, change Tran_007,
Tran_002, and Tran_003 for Tran2_3, Tran3_4, and Tran4_1 respectively.
Name:
Tran1_2
Description:
Wait 3s
-
Alias For:
Data Type
BOOL
Scope:
&
bcena
Read/Write
¥
Decimal
+
ee:
Style
=|
MainProgram
(Constant
[ok
Figure 200.
| [. Cancet.|
[Apply]
[Help
Changing transition tag names directly in the SFC routine.
30. You now need to configure the logic of the transitions. This is typically done
in structured text’ but we will keep it simple for now. The programming will be
limited to a single Boolean tag. The remainder of the logic will later be entered in the LD0O1_Traffic_lights routine. Click the question mark (?) under
Trant_2 and enter “Tr1_2” (Figure 201). Then, right-click the entered text
and select New Tag “Tr1_2”.
1 Structured text programming is the subject of Exercise 6.
© Festo Didactic 20922-00
151
Exercise 4 — Traffic Light Application (LAD and SFC) # Procedure
| North/South
: Red
EastWest : Green
|
Ctrl+Space
Alt+Ins
Cut
Ctrl+X
Copy
Ctrl+C
Paste...
Ctrl+V
Ba
Figure 201.
Browse Tags
Add ST Element...
Entering new tag Tr1_2.
31. Fill the Description, Data Type, and Scope fields according to Figure 202 and
click Create. Notice that “Tr7_2” then becomes red, meaning that it has become a recognized tag.
Tr1_2
Transition from Step
Ito Step 2
<nommal>
Boolean tag
Controller scope
Pak Soe
Tele ara
ea
a
se
[) Constant
Open Configuration
Figure 202.
New Tag window.
32. Similarly, configure the remaining three transitions by creating tags 7r2_3,
Tr3_4, and Tr4_7in the boxes under Tran2_3, Tran3_4, and Tran4_1.
152
© Festo Didactic 20922-00
Exercise 4—Traffic Light Application (LAD and SFC) # Procedure
33. If there is no double box around Step7, right-click and select Initial Step as
shown in Figure 203. An initial step (in a double box) must be configured for
each SFC routine.
We want a double
box here ™~\
A
|
Edit "Step" Properties
Find All "Step"
|
Go To Cross Reference For "Step"
Monitor "Step1"
ti
Sa}
ED gfe
Trend "Step1"
Cut Element
Copy El
Ctrl+X
it
Paste
Ctrl+C
Ctrl+V
Add Action
Delete Element
G1
Del
Delete Element but not Tag
2
2
Rename
®
=]
Step2
Edit Step
Enter
Edit Tag Description
Ctrl+D
Insert Element Defaults
Save Element Defaults
@ | tr
Clear Element Defaults
T
Temporarily Hide Actions
Figure 203.
© Festo Didactic 20922-00
Setting Step1 as the initial step.
153
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
34. Since this project is relatively small, it still makes sense to have only control
ler tags. Open Program Tags ® Edit Tags and select all the tags. Right-click
and choose Cut as shown in Figure 204.
Program Tags- MainProgram
Scope:
O3,Main Program
~
(o-)[-@
Show:
All Tags
7
(esa)
¥.
i
Name =3/é | Alias For | Base Tag | Data Type | Description
=
+|-Step1
=F
_
a
a
%
Cut
CtrleX
F
Copy
Ctrl+C
4
Paste
Ctrl+V
Delete
7
aa
,
Del
Set External Access
Figure 204.
154
|
b
Cutting from program tags.
© Festo Didactic 20922-00
Exercise 4—Traffic Light Application (LAD and SFC) # Procedure
35. Open
Controller Tags
®
Edit Tags.
Go to the bottom
line, right-click and
select Paste as shown in Figure 205. All your tags are now controller tags.
+ Show: All Tags
Name =] | Alias
For | Base
Name
Alias For
Show: All Tags
4
Scope: JBJExds_Ladder_20 ~
Data
8 | Base Ti
Data
TIMER
Tri_2
BOOL
Tr2_3.
BOOL
Tr3_4
BOOL
Tr4_1
BOOL
TRUE
BOOL
PBI
Timer Step 4
saiuadod
TmrStep4
by,
Scope: [5§MainProgram
ALWAYS TRUE
Local:1:1.Data.0
Push-Button 1 - Pedest
lI
Local:1:0.Data.0
2
Local:1:0 Data.1
Light 1 - Red
L3
Local:1:0 Data.2
- Green
L4
LS
Local:1:0.Data.3
- Amber No
L6
Local:1:0.Data.5
i
2- Amber
Local:1:0.Data.4
i
:
-Red
Local:1:0.Data.6
Local:1:0.Data.7
Local:1:0.0ata.8 | L
Local:1:0.Date.9
l?
LE]
u
10
- Amber
- Green
- Amber No
ae
[+ at)
Go To...
Ctri+G
Cut
Ctrl+X
Copy
Ctrl+C
Paste Pass-Through
Figure 205.
Pasting into controller tags.
36. Now that the SFC routine
LDO1_Traffic_Lights routine.
37. Instead
of a “STEP
LOGIC”
and
section,
the
we
tags
are
want
arranged,
to have
open
the
a “TRANSITION
LOGIC’ section in the first part of the program. For each of the four steps, the
two rungs need to be arranged in the manner depicted in Figure 206.
J)
Notice that using the SFC routine greatly simplifies the ladder routine. When
the SFC step 7 is on (in other words, when Boolean tag Step1.X is at logic
state 1),
timer
TmrStep1
starts.
After3
seconds,
the
timer
done
bit
TmrStep1.DN changes to logic state 1. As a consequence, transition bit Tr1_2
becomes true and the SFC routine jumps to step 2.
© Festo Didactic 20922-00
155
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
TRANSITION LOGIC
Transition Step 1 —> Step2 (Tr1_2)
Step1 Timer
1
North/South : Red
East/West : Green
Step1.<
JE
Timer Step1
TON:
Timer On Delay
Timer
TmrStep1
-CEN>—
Preset
3000 4
Accum
o#
DN}—
Transition Step 1 —> Step2 (Tr1_2)
Conditon for transition : Wait 3s
Timer Step 1
TmrStep1.0N
Tri2
I£
Figure 206.
Ladder modification for step 1.
38. Modify the other three transitions in a similar way. You may want to reorganize the order of the rungs to start with the transition from step 1 to step 2.
39. Should the second
same? Explain.
part of the ladder routine (ACTION LOGIC)
remain the
40. Make the necessary modifications.
M1. Check the controller for errors
them if necessary.
(Logic» Verify ® Controller)
and
correct
42. Save the program under a new name.
43. Download the program to the PLC
Mode.
and put the controller to (Remote) Run
. Verify that this new project version with SFC works the same way as the
ladder-only version.
156
© Festo Didactic 20922-00
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
Additional activity B (adding pedestrian lights)
In this activity, you will modify the SFC routine to incorporate pedestrian lights to
the automatic sequence.
45. Starting with the same PLC project, modify routine SFCO7
and LDO7 to cre-
ate a new version that incorporates these two new steps:
e
Step 5. The RED and WALK
lasts one second.
lights are activated on both axes. This step
e
Step 6. The RED lights remain on, the WALK lights are off, and the
DON'T WALK lights blink (0.5s of every second). This step lasts two
seconds before the system retums to step 1.
To force you to use a counter in the ladder and branching in the SFC
routine,
the system performs these two steps after step 4 only once every three cycles.
Otherwise,
it goes
directly from
step 4 to step 1. The
new
transitions
and steps of the SFC are shown in Figure 207.
| North’South : Amber |
East/West : Red
a
Steps
|
nas
5
Tr4_ 5
|
Sclaclicninanch
election brancl
ZL. diverge tool (choice)
Wait 1s *Pedestrian
Counter >=3
L
B|
went
Te4 1
Wait 1s * Pedestrian
Counter <3
J
North/South : Red
andWak
&
EastWest : Red and
Steps
© | trans.6
Walk
‘Wait 1
"
Trs_6
North/South : Red
andNo Walk Blinks
=)
Ea stWest : Red and
Steps
@
Tran6_|
No Walk Blinks
Wait 2s
Tr6 2
Hidden wire going
to Step 1
4
qiept
B41
Figure 207.
Adding pedestrian lights activity (part of the SFC routine).
46. Save the program under a new name.
© Festo Didactic 20922-00
157
Exercise 4 - Traffic Light Application (LAD and SFC) # Procedure
47. Download the program to the PLC
and put the controller to (Remote) Run
Mode.
48. Verify that this new project version uses the WALK and DON’T WALK lights
correctly.
Additional activity C (managing pedestrian demand)
This activity is a variation on the same theme in which the pedestrian sequence
starts only if a button is pressed.
49. If you are using the PLC project version from before the additional activity 1,
create these two steps:
e
Step 5. The
RED
and WALK
light are activated on both axes. This step
lasts one second.
«
Step 6. The RED lights remain on, the WALK lights are off, and the
DON’T WALK lights blink (0.5 s of every second). This step lasts two
seconds before the system retums to step 1.
50. Modify the SFCO7 and LDQ? routines so that:
e
e
The system goes from step 1 to step 2 to step 3 to step 4 and
step 1 if the button is not pressed in the meantime.
lf the button
is pressed
at some
point except
during
back to
step 5, the system
goes from step 4 to step 5 to step 6 before returning to step 1.
The new transitions and steps of the SFC are shown in Figure 208.
158
© Festo Didactic 20922-00
{Eop
North’South : Amber
East/West : Red
Bpo Bo
Exercise 4 —Traffic Light Application (LAD and SFC) # Procedure
Wait 1s *Pedestrian
(&) | Tran4_5
Tx4_5
Request=
L
|
Tran4_1
1 (TRUE)
Tr4_1
Pe oe
©) | Trans_6
Request=
0 (FALSE)
J
[NortwSouth : Red + |
Steps:
| Wait 1s * Pedestrian
Walk
| EastWest : Red +
Walk
‘Wait 1s
Trs_6
Steps
©) | Trané_1
Tré_1
NortvSouth : Red +
|
No Walk Blinks.
EastWest: Red+ No
Walk Blinks
Wait2s
tept
B41
Figure 208.
Managing pedestrian demand activity (part of the SFC routine).
51. Save the program under a new name.
52. Download the program to the PLC
and put the controller to (Remote) Run
Mode.
53. Verify that this new project version uses the push-button correctly.
Troubleshooting
54. Insert fault number two to the training system.
Fault switches are located
inside the enclosure, just above the PLC.
55. Observe how the system operates now. Describe what is different.
© Festo Didactic 20922-00
Exercise 4 - Traffic Light Application (LAD and SFC) # Conclusion
56. What could be the origin of the fault?
End of the procedure
57. Turn
off the application,
disconnect the leads and
cables,
and
clean the work
surface.
CONCLUSION
In this exercise, you designed a traffic light project in ladder logic using timers.
Then you converted the project to include an SFC routine. Later, you designed
two more
versions
of the
project to include the pedestrian
lights and
a button
while experimenting with counters. Finally, you did a short troubleshooting exercise.
REVIEW QUESTIONS
160
1.
How would you describe sequential function charts (SFCs)?
2.
Howis the initial step of an SFC represented?
3.
What does a set of double horizontal lines mean
4.
When does a Timer On
value?
5.
How can you return the accumulated value of a Count Up (CTU) instruction
to zero?
in an SFC?
Delay (TON) instruction
increase its accumulated
© Festo Didactic 20922-00
Exercise 5
Water Level Application (LAD and FB)
EXERCISE OBJECTIVE
DISCUSSION OUTLINE
In this exercise, you will:
e
Write ladder routines
e
Experiment with function block programming
e
Get familiar with analog inputs
*
Manipulate analog values
e
Touch the surface of process control
e¢
Troubleshoot an application
The Discussion of this exercise covers the following points:
=
=
Batch processes
The water level application
=
Analog devices and values
Float and capacitive switches. Analog level sensor (optional).
Example featuring a level sensor and a pump drive. Analog value
formats.
=
Analog values and the benefits of function blocks
Move instruction. Comparison instructions. Math instructions. Scaling.
DISCUSSION
Batch processes
Figure 209.
© Festo Didactic 20922-00
Batch process in a bakery.
161
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
A batch process is a production method where the system goes through a sequence of actions with given quantities of ingredients to obtain a final product.
Batch
processes, such as the dough preparation of Figure 209, are popular in the
food and chemical industries. Often, very specific conditions of temperature,
pressure, and/or ingredient relative quantities must be obtained to ensure proper
transformation.
PLCs
are particularly efficient in monitoring
and controlling these
conditions.
The water level application
Our level process control application is made of two modules. Figure 210 shows
the main module. A pump (1) brings liquid from the reservoir (9) to the water
cylinder (3). A check valve (2) prevents water from returning to the pump. A
manual (8) and a solenoid (7) valve allow the water to return to the reservoir. The
adjustable (4) and fixed (5) float switches, the capacitive (6) switch, and the optional level sensor provide feedback about the water level.
Figure 210.
J)
Level Process
The hand-operated valve is open
module,
Model
3295.
when the handle is in the direction of the tub-
ing. The solenoid-operated valve lets the water flow when powered.
162
© Festo Didactic 20922-00
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
The interface of Figure 211 controls the electrical components of the system.
They are the water pump, the solenoid valve, the capacitive switch, the float
switches,
and the level sensor. The interface also comprises its own power sup-
ply, two relays (labeled KA and KB), and three system status LEDs.
Figure 211.
om] an]
=
&B]} wl]
Level sensor MIN and MAX adjustment buttons
Pump enable terminal
nN]
Level sensor output terminals
Pump manual input knob
Oo, OP
Power supply terminals
Pump control toggle switch (3 positions)
Pump analog input terminals (4-20 mA or 0-5 V)
Pump MIN SP button
o
=
=
Solenoid valve terminals
Relay A terminals
Relay B terminals
=
© Festo Didactic 20922-00
Description
ry
Number |
Level Process Interface, Model 3215.
12
System status LEDs
A (red): Fault
B (yellow): Motor Enable
C (green): Ready
13
Interface program reset button
14
Electrical reset
15
Power cord
163
Exercise 5 — Water Level Application (LAD and FB) # Discussion
Number
Description
16
ON/OFF switch
17
Pump connector
18
Solenoid valve connector
19
(Optional) Analog level sensor connector
Float and capacitive switches
The water level application features three on/off level sensors. They can be connected to a PLC input, a control relay, or used directly to actuate the pump or the
solenoid valve.
One fixed, normally-closed (by default) float switch is located at the top of the
cylinder as shown in Figure 212. It serves as a security device to stop the pump
before water spills over the top of the cylinder.
Figure 212.
164
Alarm float switch (in blue).
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Discussion
A second float switch can be installed from the top of the cylinder. Both float
switches have a floating part that rises along a rod to actuate the switch. This
height-adjustable float switch can be used as a normally-closed or normally-open
switch by turning the floating part upside down if necessary (Figure 213). It must
be set to normally-open (NO) mode for this exercise.
Figure 213.
Changing float switch operation mode (NO or NC).
The third on/off level switch of the system is a normally-open capacitive switch
(Figure 214). It can be installed by inserting the two push-lock fasteners in holes
located near the cylinder. The capacitive proximity sensor detects the change
of dielectric constant caused by the presence or absence of water.
Figure 214.
Capacitive sensor.
Anatog level sensor (optional)
The optional analog level sensor, presented in Figure 215, connects to the interface. It provides a signal (0-5 V or 4-20 mA) proportional to the position of its
floating device on the rod. For instance, when the level is low, the floating device
is at the bottom of the rod and
higher level means a stronger
beled MIN and MAX, permit the
levels. When the MIN button is
© Festo Didactic 20922-00
a small analog signal is generated. Conversely, a
analog signal. Two buttons on the interface, lauser to adjust the minimum and maximum output
pressed, the output for the actual sensor position
165
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
is set to 0 V or 4 mA. When the MAX button is pressed, the output for this other
sensor position is set to 5 V or 20 mA.
Figure 215.
Level sensor,
Model
3214.
Analog devices and values
Example featuringa level sensor and a pump drive
Figure 216 shows a
typical process control setup involving an analog input and
an
In this example,
analog
output.
the level sensor
sends
a voltage
signal to
inform the PLC of the current liquid height in a column. In return, the PLC sends
a current signal to the pump drive that depends on the level reading. For instance, if the liquid level is low, the signal to the drive increases to obtain more
liquid from the pump.
Level sensor
-+
Pump drive
O10Vde
Figure 216.
166
Jaing
Be Aout 1.
4-20 mA __
20m
se
PLC connected to a level sensor and a pump drive.
© Festo Didactic 20922-00
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
Anatog value formats
When
a PLC analog input receives an electrical signal, an analog-to-digital con-
verter generates a number that can then be treated by the PLC.
You can config-
ure the embedded analog inputs and outputs of your CompactLogix controller to
the following value formats:
e
Raw/Proportional. This value is scaled to the maximum data range. For
a 16-bit integer, this means a value of +10 V dc is converted to a number
between -32 767 and +32 767.
e
Engineering Units (EU). The value follows the actual voltage or current
(x1000). For example, 4 V dc x 1000 lead to an EU of 4000.
e
Scaled for PID. Signed integer between -410 and 16 793 used for PID
equations (calculations made for process control).
«
Percent Range. Percentage of the user range (x100). If we take 4mA
to 20 mA signals, 4 mA equate 0 and 20 mA equate 10 000.
Table 5 and Table 6 show some examples for two types of signals that you may
use during the present exercise.
Table 5. Values for a given 0-10 V de signal.
Mea suien
value (V)
Re
! Bree che
tional
ene
units
Scaled for PID | Percent range
10.5 (max)
32 767
10 500
17 202
10 500
10.0
31 206
10 000
16 383
10 000
0.0
0
0
0
0
-0.5 (min)
-1560
-600
-819
-500
Table 6. Values for a given 4-20 mA signal.
wea
oe
ieee
Scaled for PID | Percent range
21.0 (max)
32767
21 000
17 407
10625
20.0
31206
20 000
16 383
10 000
4.0
6241
4000
0
0
3.2 (min)
4993
3200
-819
-500
Analog values and the benefits of function blocks
Tags containing analog values can be used
value can
in a variety of ways.
simply be copied to another tag, two values
For example,
can be compared,
a
or
mathematical operations may modify the values.
For many such operations, using function blocks is an intuitive way to program.
In Figure 217 we can easily see data “flow” from left to right. Input references
bring values to the sheet. Then, the values are manipulated
and sent to the out-
put references.
© Festo Didactic 20922-00
167
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
MUL_O1
Manipulation
MUL
Analog
Level sensor
GQ —
Multiply
SourceA
Level of2 coumns
10004.0
Dest
Cl
TotalHeg
ht
Sources
Input reference
Output reference
Figure 217.
Example of Function block programming (multiplication).
Move instruction
When programming in ladder, one way to make data “flow” like with function
block programming is to use the Move instruction (MOV). In Figure 218, when
the rung-in condition is true, the value “2” is written to tag “HmiStep”.
HM! Display Sequence
Step Number
MOV:
—
Move
Source
Dest
Figure 218.
-—
2
HmiStep
04
Ladder instruction MOV.
Comparison instructions
A variety of ladder and function
block comparison
instructions
(Figure 219)
checks if a value is greater, equal, or lesser than another one.
Compare
Instructions
Ladder logic
Function block
IB}
ene | tim| nea | cou | nea | Les | eat | veo | ceo |
oe
Lin]
MEQ | Eou | NEG Les
|
| GRT | Lea | see |
Not available
Structured text
Figure 219.
List of compare instructions (Online Help).
For example, the Less Than instruction (LES) of Figure 220 generates a Boolean TRUE
if the tag attached to parameter SourceA
has a lesser value than the
tag connected to SourceB.
Level of 2 colums
TotalHeight
LES_01
10004.0
Analog Levelsensor
[42 SpFe
LES
J
Less Than (A<B)
SourceA
—§$ 4 sasreat
—
Dest
True ifA<B
0
The dot and the dotted line
indicate a BOOL value.
Figure 220.
168
FB instruction LES.
© Festo Didactic 20922-00
Exercise 5 —- Water Level Application (LAD and FB) # Discussion
Math instructions
We saw in Figure 217 that an analog value can be multiplied. Figure 221 shows
the
other
mathematical
instructions
that
exist
in
ladder
logic,
function
block,
and structured text.
Compute/Math
Instructions
cet | eon | SUB | rut | or
noo | SOR | NEG | aes |
ADD | SUE | MUL | Oru | Hop | SOR | NEG | ABS
Ladder logic
sort] a6ABS |
Function block
Structured text
Figure 221.
List of math instructions (Online Help).
In ladder routines, you can use the Compute instruction (CPT) shown in
Figure 222 to implement a formula. CPT saves you from having to combine basic
math instructions and can be used for scaling.
Tank Liquid Level
(inches)
CPT—j
Compute
Dest
+—
TankLiquidLevel_inch
4.9921203 4
Expression
(AlI0-10)*Al0_Rate_Calc_inch+50
Figure 222.
Ladder instruction CPT.
Scaling
You just saw that analog
values
change
necessary.
of format
may
be
can take various formats.
You
may,
for instance,
In some
use
raw
cases,
a
values
during calculations and display the result on a touch screen in a format that the
user will understand. This process of taking values of a given range and converting them to another range is called scaling.
A handful of instructions can be used for scaling. In ladder logic, the CPT instruction is an option to consider.
However,
this instruction
requires that you enter a
proper formula, such as the one presented in Equation (1).
ScaledValue = (UnscaledValue — LowUnscaled) - Rate + LowScaled (1)
The Rate is defined in Equation (2).
HighScaled — LowScaled
Rate = ———
are
HighUnscaled — LowUnscaled
(2)
Beside the CPT instruction, the Scale instruction (SCL) exists exactly for this
purpose. However, it is only available in function block (Figure 223) and structured text versions. The minimum and maximum boundaries used for scaling
calculation are entered in the instruction tags.
© Festo Didactic 20922-00
169
Exercise 5 —- Water Level Application (LAD and FB) # Procedure Outline
J)
A SCALE (predefined data type) tag containing all the instruction parameters is
generated whenever an SCL instruction is added to the project.
sc._01
SCL
Analog Level sensor
&
Tank Liquid Level
Scale
(cm)
5002
12505
In
Out P+——_t
Figure 223.
TankLiquidLey el_cm|
SCL instruction.
Finally, an add-on instruction created by Rockwell and called Scale with Param-
eters (SCP) exists in ladder, function block (Figure 224), and structured text.
However, you need to import this instruction into the project to use it. The file
(SCP.L5X) is available on Rockwell's website and on the resource kit DVD.
Scale w/Parameters
ScP_02
SCP
oo
Scale w/Parameters
Analog Level sensor
5002
Tank Liquid Level
(cm)
12.505
Input
Output
C1
TankLiquidL ewel_cm
Input_Min
Input_Max
Scaled_Min
Scaled_Max
Figure 224.
PROCEDURE OUTLINE
170
SCP instruction (FB version).
The Procedure is divided into the following sections:
=
=
Preparation (tutorial)
Set up and connections
=
Ladder programming activity
PLC programming. HMI transfer.
=
Function block programming activity
=
Troubleshooting
=
End of the procedure
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
PROCEDURE
Preparation (tutorial)
1.
Open Logix Designer, go to Start Page ® Learning Center ® How Do!»
Routines, and watch the video titled Enter a Function Block Diagram. This is
a good introduction on how to create a function block diagram within Logix
Designer.
Teen
>» What's New
[mane
od |
How Dol
& General
Routines
&. Controller Projects
@ Modify the Main Routine
@
Enter Ladder Diagram
@, Tasks, Programs &
Phases
@ Enter Structured Text
@, 1ags, Data Types & Other
@
Data
&- Communications
Enter a Sequential Function Chart
wm Change a Running Ladder Diagram
Routine
& Routines
1/0 Configuration
Routine Logic
Mm.
,
Change a Running Function Block,
® Sequential Function Chart, or Structured
Text Routine
@
Reference a Tag ina Routine
@
Search for Components
™ Search by Cross Reference
» Did You Know
Figure 225.
2.
3.
Starting the video explaining FB programming.
How can you import the value of a tag in an FB diagram?
How
can you make
a parameter of an
FB instruction disappear from the
block?
© Festo Didactic 20922-00
171
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
Set up and connections
In this exercise, we will program a batch process in ladder and then use a function block routine to do the scaling of the analog values.
vided with the resource kit.
The HMI project is pro-
Connect the equipment as shown in Figure 226 or
4.
Figure 227 (more instructions follow if you are using the real application). The
tags used in the ladder version of this exercise are shown in Figure 228. Five
digital inputs, five digital outputs, and one analog input are configured. Note
that the PLC program and the tags are the same whether or not you are using the real application. The difference lies in the outputs that are connected
to the real application or to the indicator lights of the training system.
Figure 226.
172
Water level treatment setup (real application but without the analog sensor).
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Figure 227.
© Festo Didactic 20922-00
Water level treatment setup (virtual application).
173
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Name
Ll
Ajas For
Base Tag
| Data =2/ 4 | Description
Local:1:0.Data4 |Local:1:0 Data4 |BOOL
Alarm Level Indicator
M1
Local:1:0.Data3
|Local:1:0.Data.3
|BOOL
Mixer
Pi
PBI
Local:1:0.Data.2
Local:1:1.Data.0
|Local:1:0.Data.2
j|Local:1:.Data.0
|BOOL
|BOOL
Pump enable
Start Push-Button
PB2
Local:1:1.Data.1
|Local:11.Data.1
|BOOL
Stop Push-Button
Stepd
BOOL
Step 0 - Sequence Stopped
Step1
BOOL
Step 1 - Draining
Step2
BOOL
Step 2 - Filling
Step3
BOOL
Step 3 - Heating
Step4
BOOL
Step 4 - Maing
StopSequenceCmd
BOOL
Stop Sequence Condition
sw
Local:1:.Data.2
|Local11.Data2
|BOOL
Minimum level sensor (NO float)
sw2
Local:1:1.Data.3
|Local:11.Data3
|BOOL
Maximum level sensor (NO capacitive)
sw3.
Local:1:.Data.4
|Local:1.Data4
|BOOL
Maximum alarm level (NC float)
Trd_1
BOOL
Transition from Step Oto Step 1
TrO_2
BOOL
Transition from Step Oto Step 2
Tri_2
Tr2_3
BOOL
BOOL
Transition from Step 1 to Step 2
Transition from Step 2 to Step 3
Tr3_4
BOOL
Transition from Step 3to Step 4
Tr4_1
v1
Local:1:0.Data.0
BOOL
|Local:1:0.Data.0 |BOOL
Transition from Step 4to Step 1
Solenoid Drain Valve
v2
Local:1:0.Data.1
|Local:1:0.Data.1
|BOOL
Gas valve (heating)
DINT
HMI Display Sequence Step Number
EA-HmiStep
FA-AlD
Local:2:1.ChOData |Local:2:|.ChOData | INT
Analog Level sensor (0-10)
AID_Rate_Cale_cm
REAL
Analog Input Conversion to Scale Value - Rate (cm)
AID_Rate_Calc_inch
REAL
Analog Input Conversion to Scale Value - Rate (inches)
AlO_Rate_Calc_Perc
REAL
Analog Input Conversion to Scale Value - Rate (%)
TankLiquidLevel_cm
REAL
Tank Liquid Level (em)
TankLiquidLevel_inch
REAL
Tank Liquid Level inches)
Tank LiquidLevel_Pere
REAL
Tank Liquid Level (%)
TIMER
Timer Heating Step (Step 3)
TIMER
Timer Macng Step (Step 4)
[4)-TmrHeating
(4 -TmrMidng
Figure 228.
5.
Tags and connections for Exercise 5 (ladder).
If you are using the real application, you have to follow a few more steps.
The result is shown in Figure 229.
1.
Install the capacitive sensor at the second position from the top.
2.
Make sure that the adjustable float switch operates as normally-open
and install it with the float at the lowest possible position.
Make sure to close the hand-operated valve so that water can only
return to the reservoir through the solenoid valve.
£)
Due to the fact that there is no actual mixing motor or gas
valve on the physi-
cal application, indicator lights are connected instead.
174
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Figure 229.
6.
Location of the switches and hand valve position.
If you are also using the optional analog level sensor instead of the potentiometer, these additional steps must be carried out:
1:
Connect a lead between the 4-20 mA output on the level interface
and the / in 0+ PLC terminal.
(Important)
Connect
a lead between
the /in 0+ and
Vin0+
PLC
terminals.
Connect a lead between the V// in 0- and COM
© Festo Didactic 20922-00
PLC terminals.
175
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
J)
Later, you will have to configure the PLC input 0 to receive 4-20 mA and use a
different scaling equation.
Ladder programming activity
In this activity, you will program
cess. The water will be pumped,
the PLC to control a water treatment batch proheated, mixed, and evacuated.
PLC programming
7.
Open a new project in Logix Designer. When selecting the project controller,
be sure to choose the product number indicated on the PLC (L24...). Then,
select a compatible controller revision.
8.
Configure analog inputO0. Open the Module Properties of the embedded
analog module from the Controller Organizer. If you connected the 0-10 V
potentiometer, select the options shown in Figure 230 and click OK.
If you are using the optional analog level sensor, configure analog input 0
for 4-20 mA as shown in Figure 231 and click OK.
2. Select these options
{9 Controller Ex5_Ladder
(Ga
Tasks
G2 Motion Groups
-(@ Add-On Instructions
8 Data Types
_~ Gi
General | Connection Input Configuration | Input Alary Configuration | Output Configuration | Output Lints Configuration |
Channel| Enable
User-Defined
~~ Gi Strings
0
Of Add-On-Defined
| cyl Predefined
| -G Module-Defined
Trends
ody, Logical Model
1
2
3
eee
uate!
eee
©
iv] [OV to 10
ls
OV to TOV
[]_[=10V'te tov
“10V to 10V
[ell
m
A
rater
Data Format
oe oe
a
60Hz
|~]| Engineering Unts
i=l[Upscale
BOHz yl] RawiProporional
Lel/60Hz (ell Raw/Proportional
60HZ _ |e] Raw/Proportional
Disable
_w/|Disable
Disable
J
=|
wl
,
-A/O Configuration
Gf) 1769 Bus
[WD3
Eee Lahe GF CIB Eades
Embedded 0
[1] Embedded DiscreteJO
[3] EmbeddedfCounters
2a Expansion YO
Cold Junction Temperature Units:
© Fahrenheit
Enable Cold Junction Compensation Weighted Profile
Update Cold Junction Compensation every other scan
[Jenable Cydic Calibration
[Real Time Sample (RTS)
;
| 9
=|
ms
abs Ethernet
‘of 1769-L24ER-QBFCIB BS_Ladder
3. Click OK
1. Double-click here
Figure 230.
176
Configuring analog input 0 for 0-10 V.
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
2. Select these options
Controller Organizer
(3
Controller ExS_Ladder
(Tasks
&
General
| Connection | Inout Configuration” | input Ajdms Configuration | Output Configuration | Output Limits Configuration |
Motion Groups
_( Add-On Instructions
ae1
.
Input Ran
i
aes
Channel] Enable
Ty, Logical Model
5S] 0 Configuration
[20
[0] 1769-L24ER-QBFCIB
Ex5_Ladder
(ey
iv] [4m to 20mA,
~10V to 10¥
1
2-89) 1769 Bus:
Unis
2
Filer
Open Circuit
Respenss
Data Format
60Hz
60Hz
Engineering Unts
Rawi/Proportional
w|Upscale
Disable
wl
2
[] |-10V to 10v
bel]
we )/60HZ |w]| Rawi/Proportional
iw|Disabie
|
3
ry
a=
wzJ} 60HZ
_z]|
=)
-10V to 10V
|
GG EmbeddedYO
_~||
Raw/Proportional
Disable
.
if [L] Embedded Discrete JO
i
[2] Embedded
Io
:
ppemele
i
1769-L24ER-QBFCL#
@) Celsius
Cold Junction Temperature Units:
‘af [2] Embedded Counters
-—-«(©) Fahrenheit
Enable Cold Junction Compensation Weighted Profile
5-ds Ethernet
Ex5_Ladder
Update Cold Junction Compensation every other scan
(CJEnable Cydic Calibration
[Real Time Sample (RTS)
| 0
=|
ms,
Status: Offine
[ox]
[ Canc | [Amey | [Hel
hs
1. Double-click here
3. Click OK
Figure 231.
9.
Configuring analog input 0 for 4-20 mA.
Create two new ladder routines in Tasks ® MainTask ® MainProgram called
LDO2_Water_Treatment and LDO1_Liquid_Level_Scaling (Figure 232).
a Ay Tasks
a a MainTask
i
5S% MainProgram
{a
:
Parameters and Local Tags
BB MainRoutine
LDO1_Liquid_Level_Scaling
j]} LDO2_Water_Treatment
Unscheduled Programs/ Phases
Figure 232.
Routines for the ladder programming activity.
10. Open MainRoutine and add two Jump To Subroutine (JSR) instructions calling LD02_Water_Treatment and LDO1_Liquid_Level_Scaling. Get rid of the
other parameters (/nput Par and Return Par) by right-clicking them and selecting Remove Instruction Parameter.
11. Open routine LDO2_Water_Treatment. This is where most of the programming will take place. In short, we want the system to go through the sequence shown in Figure 233.
e
© Festo Didactic 20922-00
Stop (0). Stand-by step that occurs when the PLC program starts, when
the STOP button is pressed, or when the alarm level sensor is triggered.
177
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
e
Draining (1). Sequence during which the liquid is evacuated using the
drain valve. This step happens if the START button is pressed during the
Stop step, or after twelve seconds of mixing (step 4).
e
Filling (2). When the level is below the low level sensor, the drain valve
closes and the pump starts filling the reservoir.
e
Heating (3). When the level reaches the high sensor, the pump
and the gas valve opens to heat the liquid.
e
Mixing (4). After 20 seconds
stops
of heating, the gas valve closes and the
mixing motor starts.
J)
178
Since these operations are a sequence of steps and transitions, it would make
sense to use an SFC routine, although it is not an objective of this exercise.
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
First scan/
Stop PB/ —p|
oa e
Alarm
P
Low level
Start PB
Level not low
Step 1
Draining
Low level
sensor
Step 2
Filling
High level
sensor
:
Step 3
Heating
Timer
20s
Step 4
Mixing
Figure 233.
© Festo Didactic 20922-00
Flow chart for the beginning of Exercise 5.
1/9
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
12. Let us revise each step individually to help with the programming. The HMI of
the STOP step is depicted in Figure 234. Which outputs are triggered?
What are the three separate conditions leading to this step?
MR
PUMP (P41)
tees
en a
MIXER (11)
ed
SEQUENCE
[By Acar ceve (sws)
WB itch Lever (sw)
DRAIN
VALVE
LOW
LEVEL
(sw1)
v1)
TANK LEVEL (T1)
fiom)
Figure 234.
13. The
DRAINING
step
Va
STOP step (alarm level triggered).
is presented
in
Figure 235.
Which
outputs
are
trig-
gered?
What are the conditions leading to this step?
180
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
LIQUID TREATMENT
PUMP (P1)
PROCESS
MIXER (11)
3:36:08 PM
SEQUENCE
DRAINING
|) ALARM LEVEL (Sw3)
|
HIGH LEVEL (SW2)
TANK LEVEL (11)
Figure 235.
DRAINING step.
14. The FILLING step is presented in Figure 236. Which outputs are triggered?
What are the conditions leading to this step?
© Festo Didactic 20922-00
181
Exercise 5 — Water Level Application (LAD and FB) # Procedure
LIQUID TREATMENT
PUMP (P1)
PROCESS
3:43:42 PM
MIXER (M1)
SEQUENCE
eine
(0) atar Lever (sw3)
0) ticH LeveL (sw)
TANK LEVEL (11)
Figure 236.
205
%|
le
eu)
FILLING step.
15. The HEATING step is presented in Figure 237. Which outputs are actuated?
What are the conditions leading to this step?
182
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
LIQUID TREATMENT
PUMP (P1)
PROCESS
MIXER (N44)
3:47:52 PM
SEQUENCE
—
HEATING
i (0) avarm LeveL (sw)
]
1) HiGH LEVEL (swe)
TANK LEVEL (11)
Fed
%
| oe
Figure 237.
HEATING step.
16. The MIXING step is presented in Figure 238. Which outputs are activated?
What are the conditions leading to this step?
© Festo Didactic 20922-00
183
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
LIQUID TREATMENT
PUMP (P1)
PROCESS
3:51:07 PM
MIXER (1)
SEQUENCE
MIXING
(0) avar Lever (sw3)
WD hicd Lever (sw2)
Figure 238.
MIXING step.
17. Enter logic in the routine LD02_Water_Treatment. You may want to program
differently, but we suggest you divide the routine into these three sections:
e
fj
TRANSITION LOGIC. Define the rules governing step changes. Have
one OTE instruction for each transition tag. Figure 239 shows how to implement the transition between step 1 and step 2 (Tr1_2).
StopSequenceCmd
can
also
be
considered
a
transition
tag
because
it is
meant to take the system to step 0. Hence, you should define seven transition
tags in this section: StopSequenceCmd, Tr0_1, TrO_2, Tr1_2, Tr2_3, Tr3_4,
and Tr4_1.
Condition for Step1 —> Step2 : liquid level < low level
Minimum level sensor
Step 1 - Draining
Step?
{#-_-—_
Figure 239.
e
184
(NO float)
Transition from Step
Swi
1 to Step2
<Local:1'LData.2>
Tri_2
mmm
Defining the logic of transition Tr1_2.
STEP LOGIC. Use the transition tags to define when each of the five
steps is triggered. Figure 240 shows how Step2 is energized if TrO_2 or
Trt_2 is at logic state 1. On the other hand, rung continuity is broken and
Step2 de-energizes if Tr2_3 or StopSequenceCmd is activated. The
move (MOV) instruction updates the DINT tag HmiStep that the HMI uses to display the name of the current step on screen.
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Step 2 - Filling (Activate Pump)
Stop Sequence
Transition from Step
0 to Step 2
Condition
Step 2 - Filling
Tr0_2
StopSequenceCmd
Step2
JE
—_
Transition from Step
HM! Display Sequence
1 to Step 2
Step Number
Tr1_2
JE
MOV:
Move
see
Transition from Step
Step 2 - Filling
2 to Step 3
Step2
Tr2_3
SS _———
2
HmiStep
od
——
Figure 240.
«
Source
Dest
Defining the logic of step 2.
ACTIONS. Use this section of the code to configure when the five digital
outputs are energized. Figure 241 shows how the mixer (M1) and the
alarm indicator (L1) are set up.
Step 4 - Activate Mixer
Mixer
M41
<Local:1:0.Data.3>
Step 4 - Mixing
Step4
IC
at
Alarm Level Indicator
Maximum alarm level
Alarm Level
Sw3
<Local:1:1Data.4>
Lf
<Local:1:0.Data.4>
(NC float)
Indicator
——
Figure 241.
18. Open
value
Defining the logic of M1 and L1.
routine LDO1_Liquid_Level_Scaling. We want to be able to display a
in percentage,
in centimeters,
and
in inches.
Therefore,
three separate
rungs are necessary. Use the seven tags of Table 7 to implement these three
scalings. Figure 242 shows an example where a 0-10 V signal is scaled to
percentage.
You
can
consider
that
the
height
will
vary
between 0 cm
an 25 cm (0 in and 9.8 inch).
a
lf you are using the physical application, you can modify the scaling to obtain
values closer to your reality.
If you are using the optional analog level sensor, take into account that
the 4-20 mA signal will correspond to a 4000 to 20 000 range in engineering
units.
© Festo Didactic 20922-00
185
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
Table 7. Tags used for scaling.
Tag
Usage
Alo
Analog
input0 in Engineering
Units (EU)
AlO_Rate_Calc_Perc |
Rate to convert from EU to %
Al0_Rate_Calc_cm
Rate to convert from EU to cm
Al0_Rate_Calc_inch
Rate to convert from EU to inch
TankLiquidLevel_Perc | Value displayed in %
TankLiquidLevel_cm
Value displayed in cm
TankLiquidLevel_inch | Value displayed in inch
Tank Liquid Level (Analog Scaling) - Percentage (%)
Scaling
Analog input Channel 0 : 0...10'V
/ Engineering Unit Selected
Input Range : 0..10 ¥ corresponds to 0..10 000 EU corresponds to 0.100%
Scaling Equation :
Scaled Output Value = AFRate
where Rate = (%emax - %min) / (EUmax - EUmin)
Analog Input
Conversion to Scale
Tank Liquid Level
Value - Rate (%)
(%)
CPT-
CPT-
Compute
Dest
AlQ_Rate_Calc_Perc
Expression
0.014
(100-0(10000-0)
Figure 242.
Compute
Dest
Expression
TankLiquidLevel_Perc
50.94 4
Al0*AlI0_Rate_Calc_Perc
Scaling the 0-10 V input to percentage.
19. Save your program with a meaningful name.
20. Download the program to the PLC
mode.
and put the controller to (Remote)
Run
21. Push the green button under the red emergency button on the trainer to activate the PLC outputs. Turn on the level interface.
HAM! transfer
22. If it is not already in the touch screen, transfer the
Ex5_YYYYMMDD_Festo.mer using ME Transfer Utility,
Siudio tool. You may have to open the archived project,
a new runtime application if the PLC address or the
screen does not match.
186
HMI program called
a FactoryTalk View
modify it, and create
version of the touch
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
23. Load and run the HMI program on the touch screen. If errors show up on the
screen, check connectivity with the PLC and verify the tags you used in the
PLC program and the HMI Communication Setup.
24. Use the flow chart of Figure 233 as a guide and verify that the system goes
through the various steps when it receives the appropriate signals. For example, the starting step should be STOP. The system should go to the
DRAINING
or FILLING
step when
the start push-button
is pressed,
unless
the alarm level switch is triggered. Modify your program if necessary.
J)
lf you are using the physical application, you can vary the pump speed using
the rotary button.
25. Verify that turning the potentiometer changes the indicator level on the HMI
(Figure 243). If you are using the analog sensor instead, the blue bar should
follow the actual level.
MIXER (M1)
SEQUENCE
DRAINING
M0) ALARM LEVEL (sw3)
HIGH LEVEL (SW2)
Level
indicator
TANK LEVEL (T1)
31.5
Figure 243.
© Festo Didactic 20922-00
bi
Level indicator on the HMI.
187
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Function block programming activity
26. Create
a
new _ function
block
routine
FO1_Liquid_Level_ Scaling
and
delete
LDO01_Liquid_Level_Scaling (Figure 244).
=~
in
the
MainTask
old
called
routine
Tasks
| &- MainTask
i
!
(2%
MainProgram
~{B} Program Tags
Eb MainRoutine
i
Figure 244.
LDO2_Water_Treatment
FB routine replacing the ladder scaling routine.
27. Open MainRoutine and modify the JSR instruction to call the new FB routine
instead.
28. In the Controller Organizer, right-click Add-On Instructions and select Import
Add-On Instruction (Figure 245). Then, find file SCP.L5X and click Open
(Figure 246). The file is provided on the resource kit DVD and on Rockwell's
website.
-Sj Tasks
e-S
MainTask
Es MainProgram
(5 Unscheduled Programs/ Phases
aD i 2
=)}-&j Motion Groups
Cut
Ctrl+X
Copy
Ctrl+C
Paste
Ctrl+V
Paste With Configuration...
bs
© Ctrl+Shift+V
Print
>
e-4i7e98us SS *zi
Figure 245.
188
Importing an add-on instruction.
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
|
import Add-On Ins
‘©
@ -
|
Pre
Organize ¥
r
New folder
ie Favorites
BB Desktop
=
Search Add-On_Instruction
P
=
Name
Date modified
Type
| fe} SCP.L5X
11/02/2015 7:50AM
Logix Designer XML File
mt Downloads
Lt Projects
L) Runtime
(F@ Libraries
(@ Computer
~|
Gia Network
File name:
SCP.L5X
~
Figure 246.
29. Open
J+
Ms
a
| Logix Designer XML Files (*.L5X +
Adding SCP.L5X.
the FO1_Liquid_Level_Scaling routine. Go to the Language
Element
toolbar and click the SCP instruction under the Add-On tab (Figure 247). An
instruction is created on the sheet and a corresponding tag is automatically
added to the program tags (Figure 248).
ie
File Edit
OesHb
View
Search
S34
Logic
Communications
teBee
MoK
No Forces
p_|
No Edits
aie a
|
Window
Help
ys £&R
TE YR
St
a
L
SCP vL.2
Controller Organizer
1
Se
Scaled_Max
@-&@ MainTask
Scale w/Parameters.
5-88 MainProgran
A Program Tags
BA MainRoutine
Input
FOL_Liquid_Level_Scaling
1.) LD02_Water_Treatment
Unscheduled Programs/ Phases
Figure 247.
© Festo Didactic 20922-00
Fillers
Scaled_Min
29 Tasks
{J
¢
Input_Min
Input_Max
Controller Fault Handler
z
~G Power-Up Handler
/
fmes
ealewnnuens =
Input
Output
By Controller ExS_FED_20141208 Festo
-[B) Controller Tags
i
sccm
~| sl
7
~~
[
QQ)
168.0. 10\CompactBus\0
Path: | AB_ETHIP-1\1
92
f. M Run
Offline
Tools
Output =
Input_Min
Input_M ax
Scaled_Win
Scaled_blax
Adding an SCP instruction.
189
Exercise 5 — Water Level Application (LAD and FB) # Procedure
Name
Data Type | Description
[= SCP_04
scp
Scale w/Parameters
— SCP_04.Enablein
BOOL
Scale w/Parameters Enable Input - System Defined Parameter
— SCP_04.EnableOut
BOOL
Scale w/Paremeters Enable Output - System Defined Parameter
—SCP_04.input
REAL
Scale w/Paremeters
— SCP_04.input_Min
REAL
Scale w/Paremeters
—SCP_D4.input_Max
REAL
Scale w/Paremeters
-—SCP_04 Scaled_Min
REAL
Scale w/Parameters
—SCP_04.Scaled_Max
REAL
Scale w/Parameters
—SCP_04 Output
REAL
Scale w/Parameters
Figure 248.
Corresponding SCP tag.
30. Select the new SCP instruction and press F7 (or right-click and select Instruction Help). In what languages is the add-on instruction Scale with Parameters available?
31. Add five input references as shown in Figure 249.
4(ojqgeo0o
4
|
=
scp
»
( Process
A Drives 4 Filters 4
dna
Input Reference
» ©
+
5
A
[>ae”
re
Scale w/Parameters
7?
scp_04
Fe”
[2ac
Figure 249.
190
oss
Scale w/Parameters:
Input
Output Fe
0.0
Input_Min
Adding five input references.
© Festo Didactic 20922-00
Exercise 5 — Water Level Application (LAD and FB) # Procedure
32. Add one output reference as well (Figure 250).
1oMjoom ~
Output Reference
Scale wParameters
7
SCP_04
[7a
eo
[?
Gm
7
xs
@
Scale wParameters
9 Input
Output >
0.0
[? Qec Input_Min
1 Input_M ax
te
wm
Mn
<j Scaled_Max
Figure 250.
Adding an output reference.
33. Reorganize the input and output references and connect them
to the inputs
and output of the SCP block (Figure 251).
Scale w/Parameters
ScP_04
os
@
Scale wParameters
Input
Output b>
0.0
?|
Input_Min
Figure 251.
© Festo Didactic 20922-00
References connected to the SCP block.
191
Exercise 5 —- Water Level Application (LAD and FB) # Procedure
34. Enter a constant value or a tag for each reference. Figure 252 shows how
the value in centimeters is obtained and sent to tag TankLiquidLevel_cm.
Scaling:
Input Range
: 0 cm.25 cm corresponds to 0...10000
A
Scale w/Parameters.
ScP_02
&
scp
Analog Level sensor
(0-10)
Tank Liquid Level
Scale wParameters
Input
(cm)
Output
TankLiquidLevel_cm
fl
fl
TankLiquidLevel_inch
REAL
Tank Li...
TankLiquidLevel_Perc
REAL
Tank Li.
fl (+]- TmrHeating
TIMER
Timer
TIMER
Timer .
fl
[F}- TmrMicing
A
TrO_1
BOOL
Transit...
A
Tr0_2
BOOL
Transit...
Transit...
fl
Tri_2
BOOL
fl
23
BOOL
Transit...
fl
Tr3_4
BOOL
Transit...
fl
Tr4_A
fl
vw
BOOL
Soleno..
V2
BOoL
Gasv...
fl
Figure 252.
BOOL
twice
=
|
Transit... _
|||
SCP block that gives a height in centimeters.
35. Select the block, wires,
selection
| Descript|
Tank L...
REAL
because
and references.
you
need
Copy
three
(Figure 253) and
different
scalings
paste the
(in centimeter,
inch, and percentage).
Scale wParameters
ScP_o2
scp
Analog Level sensor
(0-10)
fe]
Tank Liquid Level
Scale w/Parameters
nut
(cm)
Output b-Targa
=o
eveL on]
12.505
Input_Min
input_Mex
Cut Element
Scaled_Mn
Scaled_Max
Ctrl+X
i
trl
C
Paste
Delete Element
Del
Delete Element but not Tag
Add Element...
Figure 253.
192
Alt+Ins
Copying the selection.
© Festo Didactic 20922-00
Exercise 5 —- Water Level Application (LAD and FB) # Conclusion
36. Configure the references of the two new SCP blocks.
37. If you wish, you can transfer the three SCP tags from Program Tags to Controller
Tags.
Also,
you
may
well
delete
tags
A/O_ Rate
Calc Perc,
Al0_Rate_Calc_cm, and AlO_Rate_Calc_inch since you don’t need them anymore.
38. Save this program and download it to the PLC.
39. Test that the application works correctly.
Troubleshooting
40. Insert fault number seven to the training system.
inside the enclosure, just above the PLC.
Fault switches are located
41. Observe how the system operates now. Describe what is different.
42. What could be the origin of the fault?
End of the procedure
43. Turn off the application, disconnect the leads and cables, and clean the work
surface.
CONCLUSION
In this exercise,
math
you
designed
a water treatment
instructions for scaling the analog
value.
project in ladder logic using
Then
you
converted
the scaling
portion to SFC language. Finally, you did a short troubleshooting exercise.
REVIEW QUESTIONS
© Festo Didactic 20922-00
1.
Name
PLC.
the analog value formats that are available with the CompactLogix
193
Exercise 5 —- Water Level Application (LAD and FB) # Review Questions
194
2.
What is the purpose
available?
of a move
(MOV)
instruction?
In what language
is it
3.
Which instruction compares two values and returns a (BOOL) logic 1 if these
values are not equal?
4.
Whatis scaling?
5.
Which function block instructions can you use for scaling?
© Festo Didactic 20922-00
Exercise 6
Box Filling Application (LAD and ST)
EXERCISE OBJECTIVE
DISCUSSION OUTLINE
In this exercise, you will:
e
Create ladder routines
e
Convert a ladder routine to structured text
e
Implement bit, timer, math, move, and comparison instructions
«
Utilize electro-pneumatic equipment
e
Troubleshoot the system
The Discussion of this exercise covers the following points:
=
=
The filling station
Structured text
Constructs. Expressions. Instructions.
DISCUSSION
The filling station
The
electro-pneumatic
application
that you
will use in this exercise
is the same
application you utilized in Exercise 2. This time, however, you will not use the
cylinders to clamp and stamp. Instead, each time that a cylinder extends, a colored
marble will drop into the
box
at the
bottom.
Figure 254
shows
the virtual
application right after the first marble of a recipe was dropped. The left cylinder is
already retracting and the counter under the box indicates one red marble. Three
recipe buttons (A, B, and C) output different combinations of marbles.
© Festo Didactic 20922-00
195
Exercise 6 — Box Filling Application (LAD and ST) # Discussion
System step
SMe CE AP WIle))
aye
PRODUCT SELECTION
START SEQUENCE
ro
2 Red
2 Green
a
macrem Os Lie
Cirle
PRODUCT 7
RED
GREEN
fs]
Red marble dropped in box
Content of the box
Figure 254.
Filling station virtual application.
Structured text
With Logix Designer, you can use structured text within SFC routine elements or
in separate routines.
If you are familiar with other programming
languages
such
as C, Pascal, or Basic, you will find your marks rapidly because of the similar
syntax. ST language is particularly useful to implement complex equations or
recursive loops, or to translate pseudocode.
Figure 255 shows a
typical structured text statement. Colors help you rapidly
identify the keywords,
tags,
and
comments.
Separate
lines and
tabs
make
the
code easier to read while having no effect on the program execution.
Keyword (blue)
Tag (red)
Operator (black)
Comment (green)
Ss
ii
HmiPB_A
ANC
NOT
RecipeSelected
HmiP_&
:=
AND
NOT
1;
//
Current
StartSequenceRequest
:=
1;
HmiPE_C
Recipe
THEN
//HMI
selection
Push-button
for
Sequence
: Recipe
A
Selection
-
A
(Recipe
Recipe
//
Start
Sequence
Flag
=
1,
Sequence
ENABLE
//f
Start
Sequence
Flag
=
0,
Sequence
not
1)
else
ENABLE
end_if;
Value (black)
Figure 255.
In the example
above,
Structured text statement.
the value “1” is assigned
to tags RecipeSelected and
StartSequenceRequest if the three conditions on the first line are fulfilled; that is,
if HmiPB_A
196
is true, HmiPB_B is false, and HmiPB_C is false. If any condition is
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Discussion
not respected (else), the value “O” is assigned to tag StartSequenceRequest.
Notice that the whole block represents one statement and that the punctuation is
very important.
For instance,
an assignment
requires a colon-equals (:=) opera-
tor as well as a semi-colon (;) at the end.
Constructs
The keywords IF and THEN used in Figure 255 form what is called a construct;
that is, a conditional
statement that comprises
other statements.
Constructs
must
all terminate with a semi-colon (;). Available constructs are listed in Table 8.
.
aS
For more information and examples concerning constructs and structured text
in general, please read the Logix5000 Controllers Structured Text manual from
Rockwell (Publication number: 1756-pm007_-en-p.pdf).
Table 8. Available structured text constructs.
Construct
Use
IF... THEN
Do something upon certain conditions
CASE...OF
Select something to do from a list depending on a numerical value
FOR...DO
Do something a given number of times
WHILE...DO
Do something as long as some conditions remain
REPEAT...UNTIL | Do something until a condition is fulfilled
Expressions
Expressions are other structured text components. In Figure 255, “HmiPB_A
AND NOT HmiPB_B AND NOT HmiPB_C”is an example of Boolean expression
including three tags and two types of operators (AND, NOT). Expressions may
also contain numbers (e.g., 7) and functions (e.g., ABS).
J
j
ABS (value) is a function that returns the absolute value of the operand.
Functions
and instructions are different,
although
they look similar. Expres-
sions can use functions but they cannot use instructions. However,
can include instructions, as you will see shortly.
constructs
Instructions
You have been using instructions for a couple of exercises now, whether in ladder or in function block routines. The good news: much of the same instructions
are also available in structured text. You just have to get used to the new format
and the operands that are passed between parentheses,
Let us take the ladder example
of Figure 256 where
separated by commas.
subroutine
LD04_Alarm
is
called if tag HmiPB_Abort is true. The same logic in structured text is shown in
Figure 257. We see that the instruction JSR is implemented within an IF...THEN
construct so that the instruction executes when tag HmiPB_Abort is true. The
name of the called routine is an operand between parentheses. Semi-colons (;)
terminate both the instruction and the construct.
© Festo Didactic 20922-00
197
Exercise 6 — Box Filling Application (LAD and ST) # Discussion
HMI Push-Button -
Abort Sequence
HmiPB_Abort
JSR.
Jump To Subroutine
AE
Routine Name LDO4 Alarm
Figure 256.
Jump to subroutine in ladder.
IE HmiPB_Abort THEN
TSR (LDO4_Alarm);
END_IF;
Figure 257.
As always,
Jump to subroutine in structured text.
do not hesitate to refer to the online help if, for example, you want to
know what the operands of an instruction are. Figure 258 shows part of the JSR
instruction help article. We see the details of the four possible operands, of which
we only use the routine name.
Structured Text
JSR(RoutineName,InputCount, InputPar,ReturnPar);
Structured Text
Operand
Type
Format
Description
JSR instruction:
Routine name
ROUTINE name
Input count
SINT
routine to execute (that is, subroutine)
immediate number of input parameters
INT
DINT
REAL
parameterinput parameter BOOL
SINT
INT
= immediate data from this routine that you want to copy to a tag in the subroutine
tag
e input parameters are optional
array tag.
=» enter multiple input parameters, if needed
DINT
REAL
structure
Return parameter
SINT
tag
INT
array tag
DINT
structure
tag in this routine to which you want to copy a result of the subroutine
e
return parameters are optional
enter multiple return parameters, if needed
REAL
structure
Figure 258.
198
Excerpt of the JSR instruction help article.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure Outline
PROCEDURE OUTLINE
The Procedure is divided into the following sections:
=
=
=
Preparation (tutorial)
Set up and connections
Ladder programming activity
Project creation. MainRoutine. LD02_Recipe_Selection. LD03_Reserved.
LDO1_Filling_Station (overview). LDO1_Filling_Station (GENERAL
section). LDO1_Filling_Station (TRANSITION LOGIC section).
LDO1_Filling_Station (STEP LOGIC section). LD01_Filling_Station
(ACTIONS section). HMI transfer.
=
=
=
PROCEDURE
Structured text programming activity
Troubleshooting
End of the procedure
Preparation (tutorial)
1.
Open Logix Designer, go to Start Page » Learning Center® How Do! »
Routines, and watch the video titled Enter Structured Text (Figure 259).
we HX
eee
ee
ag
+ How Dol
How Dol
&- General
Routines
&. Controller Projects
@ Modify the Main Routine
™
Enter Ladder Diagram
Routine Logic
@ Enter a Function Block Diagram
fm, Tasks, Programs &
Mm.
Phases
@. Tags, Data Types & Other
Data
@
Enter a Sequential Function Chart
& Routines
mw Change a Running Ladder Diagram
Routine
Change a Running Function Block,
&. |/0 Configuration
@
i. Communications
@
Reference a Tag in a Routine
@
Search for Components
™
Search by Cross Reference
Sequential Function Chart, or Structured
Text Routine
» Did You Know
Figure 259.
2.
© Festo Didactic 20922-00
Starting the video explaining ST programming.
In which situations is programming in structured text a good choice?
199
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
3.
What
default colors are the operators, the comments,
the tags, the instruc-
tions, the functions, and the keywords creating the constructs?
4.
In ST,
how
do you
check if bits SW7
and
SW2
are on,
and
bit SW3
is off
(write the code)?
5.
How do you assign the value “5” to tag HmiStep in ST (write the code)?
Set up and connections
In this exercise, we will write a program that controls the pneumatic application.
The system will deliver the exact number of marbles pertaining to the selected
recipe. The related HMI project is provided with the resource kit.
6.
Connect
the
equipment
as
shown
in
Figure 260
and
Figure 261
or
Fig-
ure 262. Three digital inputs and three digital outputs are used. The tags
used in the ladder version of this exercise are shown in Table 9. If you are
using
the
real
application,
adjust
the
air
pressure
between
200 kPa
and
275 kPa (30 psi and 40 psi).
£)
RecipeList is a user-defined data type that you need to specify. This will be
shown shortly in this procedure. You may enter tags now or later, as you enter
the instructions. The PLC program and the tags are the same whether or not
you are using the real application.
The difference lies in the inputs and outputs
that are connected to the real application or to the switches and indicator lights
of the training system.
200
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
a
os
e
ee
e&
e
@¢.66 66>
e
ee)
ee
©
A@
ong
é
p Oe
o*
®
00
On
€
©
eo]
«
Figure 260.
Box filling setup (real application).
Figure 261.
© Festo Didactic 20922-00
Pneumatic connections.
201
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
FESTO
2484
=
————_.,
-_
4) #s¢ —.
@©6¢6606586
e
&
omy =
a
Figure 262.
202
Box filling setup (virtual application).
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
Table 9. Tags and connections for Exercise 6 (exported CSV file).
Name
Description
Data Type
BatchTotal
Total Product Count in current Batch
DINT
(GreenBatchCount
Green Batch count
DINT
GreenRemaining
(Green marbles remaining to complete Recipe
DINT
HmiPB_A
Product A HMI push-button (2 Red + 2 Green)
BOOL
HmiPB_Abort
HMI Push-Button - Abort Sequence
BOOL
HmiPB_B
Product B HMI push-button (1 Red + 3 Green)
BOOL
HmiPB_C
Product C HMI push-button (3 Red + 1 Green)
BOOL
HmiStep
HMI Display Sequence Step Number
DINT
ons
One Shot
DINT
Recipelndex
Current Recipe Index
DINT
RedBatchCount
Red Batch count
DINT
RedRemaining
Remaining
RecipeList
RecipeList[10]
red marbles
to complete
Recipe
StartSequenceRequestStart Sequence Request
© Festo Didactic 20922-00
Specifier
DINT
BOOL
Step00
Step 0 - Sequence Stopped
BOOL
Step01
Step 1- Recipe Selection
BOOL
Step02
Step 2 - Red or Green Cycle selection
BOOL
Step03
Step 3 - Red Cylinder Extend
BOOL
Step04
Step 4 - Red Cylinder Retract
BOOL
Step05
Step 5 - Recipe Completion verification
BOOL
Step10
Step 10 - Green Cylinder Extend
BOOL
Step11
Step 11 - Green Cylinder Retract
BOOL
StopSequenceCmd
Stop Sequence Condition
BOOL
Sw
Red Cylinder extended limit switch
BOOL
Local:1:1.Data.0
Ssw2
Red Cylinder retracted limit switch
BOOL
Local:1:1.Data.1
SW3
Green cylinder extended limit switch
BOOL
Local:1:1.Data.2
Tm rOffX3
Timer X3 - Simulation when X3 is retracting
TIMER
TmrStep03
Timer Extended Red Cylinder
TIMER
TmrStep10
Timer Extended Green Cylinder
TIMER
TmrStep11
Timer Green Cylinder Retracted
TIMER
TrO_1
Transition Step 0 to Step 1: Start Sequence
BOOL
Tr10_11
Transition Step 10 to Step 11: Wait Green Cylinder Extended 1s |BOOL
Tr11_5
Transition Step 11 to Step 5: Wait Green Cylinder Retracted
BOOL
Tr1_2
Transition Step 1 to Step 2: Always True
BOOL
Tr2_10
Transition Step 2 to Step 10: Green Remaining
BOOL
Tr2_3
Transition Step 2 to Step 3: Red Remaining
BOOL
Tr3_4
Transition Step 3 to Step 4: Wait Red Cylinder Extended for 1s
|BOOL
Tr4_ 5
Transition Step 4 to Step 5: Wait Red Cylinder Retracted
BOOL
Tr5_0
Transition Step 5 to Step 0: Recipe Done - Stopping
BOOL
TS 2
Transition Step 5 to Step 2: Recipe not Done - next ingredients
|BOOL
x1
Red Cylinder pneumatic valve solenoid (Extend)
BOOL
Local:1:0.Data.0
x2
Red Cylinder pneumatic valve solenoid (Retract)
BOOL
Local:1:0.Data.1
x3
Green Cylinder pneumatic valve solenoid (Extend)
BOOL
Local:1:0.Data.2
203
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
Ladder programming activity
In this activity, you will program the PLC to control a box filling application. Three
preprogrammed recipes will ask for distinct marble contents.
Project creation
7.
Open a new project in Logix Designer. When selecting the project controller,
be sure to choose the product number indicated on the PLC (L24...). Then,
select a compatible controller revision.
8.
Create a new user-defined data type (Figure 263). Call this tag RecipeList
and add two DINT members, Red and Green, as shown in Figure 264. The
purpose of this data type is to specify different combinations of red and green
marbles.
Gl Controller Ex6_Ladder
© Motion Groups
(4 Add-On Instructions
3 Data Types
Import Data Type...
Cut
Ctrl+X
Copy
Ctrl+C
Paste
Ctrl+V
Paste With Configuration...
Ctrl+Shift+V
:
Data Type Size: 8
oF
Description:
bytes
me
Prope
Extended Properties...
© General
Data Type Size
Description
Name
Red
DINT
Quantity of red marbles
Green
DINT
Quantity of green marbles
» Add Member...
Figure 264.
204
RecipeList user-defined data type including the Red and Green members.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
9.
In our
case,
we
will use
three
distinct
recipes
(A,
B,
and
C).
In
Control-
ler Tags ® Edit Tags, add a tag that is also called RecipeList (like the new
data type). Specify the data type as the user-defined RecipeList. This is
shown in Figure 265. Set the dimension of the array to 10 and not just three.
This is in case we change our mind later and want to create more recipes.
Click OK.
Data type you created
Sele ect Data Typ
Data Types:
Recipe List{10]
Defined eee
Se
Module-Defined
Aray Dimensions
Dim 2
0
[7
>| \ Monitor Tags
YN Edit Tags /
7
Click here first
Figure 265.
© Festo Didactic 20922-00
S
Creating an array of three RecipeList objects.
205
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
10. Switch to the Monitor Tags tab. In the Value column,
set the number
of red
saadaig
bg
and green marbles for RecipeList{[1], RecipeList{2], and RecipeList[3] as
shown in Figure 266. These correspond to your three recipes (A, B, and C).
Recipe Red Marbles quantities
Recipe Green Marbles quantities
Recipe Red Marbles quantities
Recipe Green Marbles quantities
Recipe Red Marbles quantities
Recipe Green Marbles quantities
Recipe Red Marbles quantities
Recipe Green Marbles quantities
Decimal
|DINT
Current Recipe Selection
Decimal
|DINT
Curent Red marbles
Batch count
|< [
Figure 266.
im
-
r
Detailing the RecipeList array.
11. Create three new ladder routines in Tasks ® MainTask ® MainProgram
called LDO1_Filling_Station, LDO02_Recipe_Selection, and LDO3_Reserved
(Figure 267).
o-a MainProgram
Parameters and Local Tags
MainRoutine
LDO1_Filling_Station
j LDO2_Recipe_Selection
{) LDO3_Reserved
LZ
Figure 267.
206
Unscheduled Programs / Phases
Routines for the ladder programming activity.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
MainRoutine
12. Open MainRoutine and add two Jump To Subroutine (JSR) instructions calling LD01_Filling_Station and LDO3_Reserved. Get rid of the other parameters (Input Par and Return Par) by right-clicking them and selecting Remove
Instruction Parameter.
£)
LDO2_Recipe_Selection will be called from LDO1_Filling_Station.
LD02_Recipe_Selection
13. Open routine LD02_Recipe_Selection. Like the name suggests, this part of
the project is where a decision is taken as to what recipe (A, B, or C) is followed. Enter the code shown in Figure 268. We see that two things happen
while one of the three HMI
recipe buttons is pressed:
«
The Boolean tag StartSequenceRequest is set.
e
A number
corresponding
to the recipe is moved
to the
DINT
tag Reci-
pelndex. (Recipe A=1, B=2, C=3)
Product AHI
push-button (2 Red +
Start Sequence Push-Button with Recipe A, B or C (HM! push-button)
Product B HMI
Product
C HMI
push-button (1 Red +
push-button (3 Red +
2.Green)
1
HmiPB_A.
JE
Product B Hil
1 Green)
Request
HmiPB_8
HmiPB_C
StartSequenceRequest
S|
SS”
a
Product. HMI
Product C HMI
Product
4 HMI
push-button (1 Red*
push-button (2Red+
push-button (3 Red +
push-button (2 Red +
3 Green)
2 Green)
1 Green)
2 Green)
HmiPB_B
HmiPB_A
HmiPB_C
HmiPB_A
JE
A
ae
aE
Product C HMdl
Product AHMI
ProductB HMI
push-button (3Red+
push-button (2Red+
1Green)
2 Green)
2 Green)
HmiPB_C
HmiPB_A
HmiP8_B
| |$e]
Start Sequence
3 Green)
push-button (1 Red +
[a
Ss
—
Current Recipe index
WON
a
Gest
Feckeatnis
"
Product B HMI
push-button (1 Red +
3 Green)
HmiPB_8
45
ar al
—_
si a
al
Current Recipe index
WOW
Move
——
Source
Dest
2
Recipeindex
26
Product C HMI
push-button (3 Red +
1 Green)
HmiPB_C
ac
ae
Current Recipe index
1OVMove
Source
Dest
r—
3
Recipeindex
e'
(End)
Current recipe is B
Figure 268.
Content of the LD02_Recipe_Selection routine.
LD03_Reserved
14. Open routine LDO3_Reserved and enter the code shown in Figure 269. The
reason for this rung is that no sensor tells if the green cylinder is retracted or
© Festo Didactic 20922-00
207
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
not. The retraction is hence simulated with a Timer Off Delay (TOF) instruction called TmrOff€3. The timer starts counting when tag SW3 goes from logic state 1 to logic state 0. This timer will be useful in one of the transitions,
but also for the HMI.
Green cylinder
extended limit
switch
Timer X3 Simulation when X3
Sw3
is retacting
sLocal1:.Data2>
1
TOF-
4JF
Timer Off Delay
Timer
Preset
Accum
CEN
TmrO tfx3
300 ¢—( DN}—
300 4
(End)
1
Figure 269.
Content of the LD03_Reserved Routine.
Figure 270 is taken from the HMI project in FactoryTalk View Studio to show
how the timer is used. Three rectangles are superposed to represent the retracted, intermediate, and extended positions of the cylinder. Only one of the
rectangles is visible at a time. The expression shown concerns the middle
rectangle. We see that it is visible during extension, when x3 is activated but
not SW3 yet. It is also visible during retraction, when X3 and SW3 are not activated and TmrOffX3 is timing.
J)
The HMI tag Stamping\TmrOffx3 refers to the done bit of the Timer off delay
instruction. This bit is normally set and clears after timing is completed.
[-
HotizontalPostion
[
|
Fil
Wetical Position
T
YT
Horizontal Slider
Touch
Botation
I
|
Vewtical Sider)
Color
Width
I
OLE Verb
ill
]
Height
Expression
gene
ee =
:
:
1
NOT Stamping\Sw/3 AND ((Stamping\<3) OR (NOT Stamping’3 AND Stamping
\TmrQ#6¢3})
“
Expression true state
©Olnvsible
©) Visible
Figure 270.
208
Green cylinder visibility.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
LD01_Filling_Station (overview)
15. Open
routine LDO1_Filling_Station. This is where most of the programming
will take place.
In short, we want the system to go through the sequence
of
Figure 271.
Stop (0). Stand-by step that occurs when the PLC program starts, when
the ABORT button is pressed,
or after a recipe sequence is completed.
Recipe Selection (1). After one of the products (A, B, or C) is selected,
the required number of red and green marbles is written to the RedRemaining and GreenRemaining tags. Also, tags RedBatchCount and
GreenBatchCount are reset.
Red or Green Cycle (2). Intermediate step after which a red or green
marble distribution cycle starts depending if tag RedRemaining equals
zero.
Red Extend (3). The cylinder extends to deliver a red marble.
Red Retract (4). The red cylinder retracts one second after extension.
Verification (5). Intermediate step after a red or green cycle. If RedRemaining and GreenRemaining tags equal zero, the recipe is complete and the system returns to step 0 (Stop). If not, the system returns
to step 2 and another cycle starts.
Green Extend (10). The cylinder extends to deliver a green marble.
Green Retract (11). The green cylinder retracts one second after extension.
<)
Since
these operations are a sequence
of steps and transitions,
it would also
make sense to use an SFC routine, although it is not an objective of this exercise.
© Festo Didactic 20922-00
209
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
First scan/
Step 0
Abort PB
Stop
———_—o_
cx“
ma
Button A/B/C
Step 1
Recipe Selection
amar
ae
Step 2
Red/Green Cycle
XY
-
” Red
emaining?
Gisen
emaining? —
~
ves]
Step 3
Step 10
Red Extend
—T Extend
<eone
;
Red
Extended?
a
Step 4
Red ,
a 11
Green Retract
Yr
Red
ra
.a
Gian
Retracted?
5
4
5
Verification
a“
Y
ef patie
em
.
aining?
=~
No (DONE)
Yes
Figure 271.
210
Flow chart for Exercise 6.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
LD01_Filling_Station (GENERAL section)
J
j
lf you feel confident, you may program
the routine in a different manner.
How-
ever, it is important that the program follows the sequence of Figure 271.
Table 9 and Figure 271 are great references to keep close while programming.
16. Program the two rungs of Figure 272. The first rung sets the tag
StopSequenceCmd that returns the system to step 0. The second rung calls
routine LD02_Recipe_Selection.
Stop/Abort Sequence
Stop Sequence
Condition
StopSequenceCmd
SS
=
2
JC
HMI Push-Button Abort Sequence
HmiPB_Abort
Call routine - Recipe Selection
JSR:
3
Jump To Subroutine
Routine Name
Figure 272.
LDO2_Recipe_Selection
General rungs.
LD01_Filling_Station (TRANSITION LOGIC section)
17. Each of the ten transitions must be defined. Write the code for the first two
transitions (TrO_7 and Tr1_2) as shown in Figure 273. Transition between
step0 and step1 occurs when the StartSequenceRequest bit is at logic
state 1. Transition between step 1 and step 2 is automatic.
Condition for Step 0 —> Step 1: Start Sequence
Push-Button with
Recipe A, B or C (HMI
push-button)
Transition Step 0
Step 0 - Sequence
Stopped
Step00
‘Start Sequence
Request
StartSequenceRequest
aE
J2C
to Step 4 : Start
Sequence
Tr0_1
Condition for Step 1 —> Step 2: No condition - Always True
Step 1 - Recipe
Transition Step 1 to
Selection
Step 2 : Always True
Stepo1
ae
Tr1_2
aC
#
Figure 273.
© Festo Didactic 20922-00
Definition of transitions Tr0_1 and Tr1_2.
211
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
18. Where is the OTE instruction behind the StartSequenceRequest tag located
(routine and rung number)? Right-click the tag and select Go To Cross Reference For to generate a list of all the instances (Figure 274).
J)
Double-clicking the line in the table takes you to that location.
Step 0 - Sequence
Start Sequence
Stopped
Step00
Request
Edit "StartSequenceRequest” Properties
Find All "StartSequenceRequest"
Monitor "StartSequenceRequest"
Trend "StartSequenceRequest’
Condition for Step 1 —> Step
Step1 - Recipe
4
p99
fe
ee
————
,
Figure 274.
Cut Instruction
Ctrl+X
Copy Instruction
Ctri+C
Paste
Ct+V
Go to Cross Reference For.
19. Write the rung for Tr2_3 and Tr2_10, knowing that a choice is made (branching...) between these transitions depending
if tag RedRemaining equals 0 or
not. Suggestion: use the comparison instructions EQU and NEQ.
20. Write the conditions to set tag
Tr3_4.
A suggestion
is presented
in the two
rungs of Figure 275. A delay of 1s has to elapse during step 3 after the extended limit switch is on and the retracted limit switch is off.
Condition for Step 3 —> Step 4 : Red Cylinder extended for 1s
Red Cylinder
Red Cylinder
extended limit
retracted limit
switch
switch
Step 3 - Red
Cylinder Extend
swt
sw2
Step03.
«Local 1:.Data.0>
«<Local:1:|Data.1>
JE
JE
+E
Timer Extended Red
Cylinder
TON
Timer On Delay
<EN}—
Timer = TmrStep03
Preset
1000 4
Accum
o«
ON3—
Condition for Step 3 —> Step 4: Red Cylinder extended for is
Transition Step 3 to
Step 4: Wait Red
Timer Extended Red
Cylinder Extended
Cylinder
for 1s
TmrStep03.DN
Tr3_4
Ie
ak
*
Figure 275.
Definition of transition Tr3_4.
21. Write the conditions to set tag 7Tr4_5. In short, during step 4, the retracted
limit switch must be on and the extended limit switch must be off.
212
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
22. Write the conditions ruling tag 7r70_17. These rungs should be similar to
what you did for tag Tr3_4, except that there is no retracted limit switch to
check.
23. Write the conditions to set tag 7Tr71_5. Because there is no green cylinder
retracted limit switch, how do we know for sure that the cylinder has retract-
ed? We can’t. That is why we employ the strategy of Figure 276. Transition
occurs during step 11 if the extended
limit switch is not on and two time de-
lays have elapsed, one after another:
e
Delay simulating the retraction (0.3 s)
e
Additional delay to give enough time for retraction (1 s)
Condition for Step 11 —> Step 5 : Green Cylinder retracted
Green cylinder
Step 11 - Green
Cylinder Retract
Step11
SS
extended limit
Timer X3 -
switch
Sw3
<Local:1:|.Data.2>
Simulation when X3
retracting
TmrO ffX3.0N
a
| fe
Timer Green Cylinder
Retracted
TON.
Timer On Delay
Timer
<EN—
= TmrStepi1
Preset
1000 +~DN}-—
Accum
o#
Condition for Step 11 —> Step 5 : Green Cylinder retracted
Transition Step 11
Timer Green Cylinder
Retracted
to Step 5 : Wait
Green Cylinder
Retracted
TmrStep11.DN
THiS
If
ac
Figure 276.
Definition of transition.
24. Write the conditions that “close the loop” (i.e., for Tr5_O and Tr5_2). Tr5_0 is
set
when
Otherwise,
RedRemaining
and
GreenRemaining
Tr5_2 is set. Suggestion:
equal
zero
use the comparison
during
step 5.
instructions EQU
and NEQ.
© Festo Didactic 20922-00
213
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
LD01_Fitling_Station (STEP LOGIC section)
25. This section is where the actual change of step occurs. Enter eight rungs of
ladder, that is, one for each step. Two examples
are shown
in Figure 277. In
all cases, a MOV instruction must be added so that the HMI displays the actual sequence step.
Step 0 - Sequence stopped
Stop Sequence
Condition
Step 0 - Sequence
Stopped
StopSequenceCma
=
JC
Stepaa
Transition Step 5 to
HMI Display Sequence
Step Number
Step 0 : Recipe Done
~ Stopping
Tr5_O
Move
jE
Source
MO*N
Step0 - Sequence
Transition Step 0
to Step1: Start
Stepoo
Tr0_1
Stopped
0
Dest
HmiStep
o«
Sequence
‘Step 1 - Recipe selection and calculations
Transition Step 0
to Step 1: Start
Sequence
TrO_1
IF.
Step 1 - Recipe
Selection
StopSequenceCmd
Step01
a: fe
Jaf
Step 1 - Recipe
Stop Sequence
Condition
7 e
Transition Step 1 to
Selection
Step 2: Always True
Stepo1
Tri_2
HMI
Display Sequence
Step Number
MO
/
Move
Source
Dest
1
HmiStep
o+«
Figure 277.
214
Logic for steps 0 and 1.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
LD01_Filling_Station (ACTIONS section)
This section describes the actions that are performed during the steps. For one
thing, the state of the three pneumatic valves depends on the current step. Also,
the content of tags BatchTotal, GreenBatchCount, GreenRemaining, RedBatch-
Count, RedRemaining changes during steps.
26. Write a rung for tag BatchTotal that is the sum of RedBatchCount and
GreenBatchCount. Figure 278 shows that when there is one red and three
green marbles, BatchTota/ equals four. This total is displayed on the HMI.
Total Product Count (Batch Count)
Total Product Count
in current Batch
-ADDAdd
Source A
RedBatchCount
14
Source B
GreenBatchCount
3¢
BatchTotal
Dest
4¢
Figure 278.
Total product count.
27. Write the rung for step 1. This is when the number of red and green marbles
are written to tags
RedRemaining
and
GreenRemaining.
Additionally,
the
batch counts are reset. Figure 279 shows the result at the end of a recipe B
cycle (Recipelndex = 2). Remember that you stored the recipe information in
three RecipeList objects. The
choice of a specific recipe depends
on the
Recipelndex value. The syntax RecipeList{Recipelndex].Red refers to the
number of red marbles of RecipeList{1), RecipeList{2], or RecipeList[3].
£)
The Recipelndex value is determined in routine Recipe_Selection.
Remaining red
marbles to complete
Recipe
MOV-
Step 1 - Recipe
Selection
Step01
If
at
Green marbles.
remaining to
complete Recipe
MOV
Move
Source
Move
RecipeList[Recipeindex].Red
Source
RecipeList[Recipeindex].Green
1
Dest
3
RedRemaining
Dest
GreenRemaining
04
o¢
Current Red marbles
Batch count
MOY.
Move
Source
Dest
Current Green
marbles Batch count
MOVMove
Source
0
RedBatchCount
Dest
0
GreenBatchCount
14
Figure 279.
28. Write
the
with X1).
© Festo Didactic 20922-00
rung
34
Remaining marbles are set and counts are reset during step 1.
to
extend
the
red
cylinder
during
step3 (OTE
instruction
215
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
29. Write the
struction
you may
shown in
rung to retract the red cylinder during all the other steps (OTE inwith X2). Many branches will be in parallel. If they are not aligned,
get an error for “Too many nested branches”. Using the option
Figure 280 solves the alignment problem.
% © Cut branch level
Figure 280.
Ctrl+X
Copy branch level
Ctrl+C
Paste
Ctrl+V
Delete branch level
Del
Edit Branch Level
Enter
Add Ladder Element...
Alt+Ins
Use the Add Branch Level option to align branch levels.
30. Write the rung to manage the number of red marbles during step 4.
Figure 281 shows that “1” is added to RedBatchCount and subtracted from
RedRemaining when
the red cylinder retracts.
Use the ONS
instruction with
the storage bit ons. 0.
J)
The ONS instruction ensures that these operations happen only once.
Step 4- Red
Cylinder Retract
One Shot
Stepo4
JE
ons.0
{ons}
Current Red marbles.
Batch count
“ADD
Add
Source A
RedBatchCount
14
1
Source B
Dest
RedBatchCount
14
Remaining red
marbles to complete
Recipe
SUB
Subtract
SourceA
RedRemaining
Oo
Source B
Dest
1
RedRemaining
Oe
Figure 281.
Change of count and remaining red marbles during step 4.
31. Write the rung to extend the green cylinder during step 10 (OTE instruction
with X3).
J)
The cylinder will retract automatically during the other steps because
we are
using a spring-return pneumatic valve.
216
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
32. Write the rung to manage the number of green marbles during step 10. You
can take Figure 281 as a model. Use the ONS instruction with the storage bit
ons.1.
33. Save your program with a meaningful name.
. Download the program to the PLC
and put the controller to (Remote)
Run
mode.
35. Push the green button under the red emergency button on the trainer to activate the PLC outputs.
HMI transfer
36. If it is not already in the touch
Ex6_YYYYMMDD_Festo.mer
screen, transfer the HMI program called
using ME Transfer Utility, a FactoryTalk View
Studio tool. You may have to open the archived project, modify it, and create
a new runtime application if the PLC address or the version of the touch
screen does not match.
37. Load and run the HMI program on the touch screen. If errors show up on the
screen, check connectivity with the PLC and verify the tags you used in the
PLC program and the HMI Communication Setup.
38. (Test) Use the flow chart of Figure 271 as a guide and verify that the system
delivers the right amount of marbles when you ask for a recipe.
Structured text programming activity
39. Create a new ST routine in MainTask called ST02_Recipe_Selection.
40. Create a new program
grams/Phases folder.
© Festo Didactic 20922-00
called
Reference
in
the
Unscheduled
Pro-
217
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
41. Drag and drop routine LDO02_Recipe_Selection to Reference. That way, you
will still be able to refer to the ladder code,
but the routine will not execute.
The tasks of the Controller Organizer should now resemble Figure 282.
fem=s Tasks
a f MainTask
23 MainProgram
ie mF
Parameters and Local Tags
{BB L001 _Filling_Station
: A
i
~ &
o-4
LDO3_Reserved
$T02_Recipe_Selection
Unscheduled Programs / Phases
a aS Reference
: {A
{6
Parameters and Local Tags
LDO2_Recipe_Selection
‘] Motion Groups
Figure 282.
The ladder routine becomes unscheduled.
42. Open LDO1_Filling_Station and modify the JSR instruction to call the new
ST02_Recipe_Selection routine instead of LDO2_Recipe_Selection.
43. Open the STO02_Recipe_Selection routine. Use the LD02_Recipe_Selection
routine and Figure 283 as models while coding. The two “elsif’ sections of
the code are missing but resemble what is between the “if’ and the first “e/sif’. We suggest you create a new DINT local tag called RecipeSelected
(Figure 284 and Figure 285). This local tag will temporarily store the recipe
number
before it is transferred to the controller scoped
tag Recipeindex
us-
ing a CASE...OF construct.
Do not hesitate to watch the tutorial again to help you enter the structured text.
Cut and paste repeating parts of the code to save some time.
//
Recipe
it
HmiPBA
Selection
ANC
NOT
and
Start
HmiPBB
RecipeSelected
:=
Sequence
AND
NOT
Flag
HmiPBC
Recipe
THEN
//HMI
selection
Push-button
for
Sequence
:
Recipe
A
Selection
:
Recipe
A
(Recipe
1;
//
Current
StartSequenceRequest
:=
1;
//
Start
Sequence
Flag
=
1,
Sequence
ENABLE
:=
0;
//
Start
Sequence
Flag
=
0,
Sequence
not
1)
SLRS.
(missing code)
BLE35..
(missing code)
else
StartSequenceRequest
ENABLE
end if;
/f/
Recipe
case
Index
used
RecipeSelected
to
read
the
recipe
ingredients
of
1:
RecipeIndex
-:=
1
//
Recipe
ingredients
A
(1)
2:
3:
RecipeIndex
RecipeIndex
-:=
2
3 +
//
Recipe
ingredients
B
(2)
Selected
*#/
Recipe
ingredients
C
(3)
Selected
Selected
end case;
Figure 283.
218
Structured text code.
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Procedure
Controller Organizer
~aX
3 Controller Ex6_ST
ibe
Controller Tags
{ Controller Fault Handler
‘2 Power-Up Handler
//
Recipe
iz
HmiPB_A
4
i Tasks
e& fa MainTask
|
28 MainProgram
{@ Parameters and Local Tags
Selection
ANC
NOT
and
Start
HmiPE_B
a=
i
|
|
(+)
Flag
THEN //HMI
selection :
Browse Tags
Ctrl+ Space
Add ST Element...
Alt+Ins
Ctrl+X
MainRoutine
a
Sequence
AND NOT HmiPE_C
Current Reci
LDOL_Filling_Station
Ctrl+C
LDO3_Reserved
Ctrl+V
$T02_Recipe_ Selection
2 Unscheduled Programs/ Phases
Motion Groups
Ctrl+G
Watch Tags
Figure 284.
Alt+3
New tag RecipeSelected.
Enter description
Select Local Tag
DINT type
MainProgram scope
[) Constant
(7
Sequencing
{_] Open Configuration
(Open
Parameter Connections
Figure 285.
RecipeSelection tag definition.
44. In your code, what is the logic state of tag StartSequenceRequest if no HMI
button is actuated?
45. Save this program under a new name and download it to the PLC.
© Festo Didactic 20922-00
219
Exercise 6 — Box Filling Application (LAD and ST) # Conclusion
46. Test that the application works correctly.
Troubleshooting
47. Insert fault number 3 to the training system.
the enclosure, just above the PLC.
Fault switches are located inside
48. Observe how the system operates now. Describe what is different.
49. What could be the origin of the fault?
End of the procedure
50. Turn off the application, disconnect the leads and cables,
surface.
CONCLUSION
and clean the work
In this exercise, you designed a box filling application using three ladder routines
and a wide variety of instructions. Then you converted the recipe selection
tine to structured text. Finally, you did a short troubleshooting exercise.
REVIEW QUESTIONS
220
1.
Where in Logix Designer can you find structured text code?
2.
How can you make the structured text code easier to read?
3.
What do you need to add at the end of constructs and assignments?
rou-
© Festo Didactic 20922-00
Exercise 6 — Box Filling Application (LAD and ST) # Review Questions
4.
What is the use of a CASE...OF construct?
5.
Write the structured text equivalent of the ladder rung shown
in Figure 286.
Output 3 and 4 (HMI)
Toggle Switch 2
T2
«Local:1:1Data.1>
3
Output 3
Q3
«Local:1:0.Data.2>
=| =
Toggle Switch
3.
Output 4 (HMI)
T3
sLocal:1:1Data.2>
a4
___y
-H—4
Figure 286.
© Festo Didactic 20922-00
Ladder diagram for Question 5.
221
Test
1.
Which communication
System?
a.
b.
c.
d.
2.
protocol
is used
on
the
Advanced
PLC
Training
FOUNDATION Fieldbus
ProfiNet
Ethernet/IP
DeviceNet
Which part of a PLC is considered the “brain”?
ao ow
Power supply
Where in Logix Designer can you see the project I/O configuration?
aoop
3.
4.
Processor
Communication
Inputs and outputs
Logical Organizer
Controller Tags
Start Page
Controller Organizer
Which
PLC
programming
language
consists
of two
uprights
connected
by
separated
by
rungs?
a.
Function block
c.
d.
Structured text
Sequential function chart
Which
PLC
transitions?
aoc
5.
programming
language
consists
of
steps
Ladder logic
Function block
Structured text
Sequential function chart
Which ladder logic output instruction sets the data bit until it is cleared?
aoge
6.
Ladder logic
b.
© Festo Didactic 20922-00
One Shot Rising (OSR)
Output Energize (OTE)
Output Latch (OTL)
Output Unlatch (OUT)
223
aggn
Which file type is run by a Pane/View touch screen?
.MER
ACD
-APA
TXT
agg
Which timer instruction accumulates time when the rung condition is false?
Timer On Delay (TON)
Timer Off Delay (TOF)
Retentive Timer On (RTO)
Reset (RES)
Which
of the following PLC instructions cannot be used to scale an analog
value?
a.
b.
c.
SCL
CPT
LES
d.
SCP
apo
10. Which structured text construct does an operation a given number of times
(e.g., four times)?
224
IF... THEN
CASE...OF
WHILE...DO
FOR...DO
© Festo Didactic 20922-00
AppendixA
Equipment Utilization Chart
The following equipment is required to perform the exercises in this manual.
Equipment
Model
Description
Exercise
1/2/13
)4]/51/6
3214(1)
|Level Sensor
1
3215)
|Level Process Interface
1
3216") | Pressure Regulator with Gauge
1
1
3217) | Station Control Valve
3291") | Traffic Light Application
3292(') | Electro-Pneumatic Application
afafjoafo
oe
afjofjo]a
Computer
vem | ee | ce] ce
5937() | FactoryTalk View Studio (Rockwell Software)
afjoafafa
|Advanced PLC Training System
5935(2) | Studio 5000 (Rockwell Software)
N/A
1
|Level Process Application
afjoafa]fa
3355
afiafoaja
3295")
1/4
1
1) Optional equipment. Check with your instructor if this equipment is available.
2) This course was developed with version 24.00 of Logix Designer.
3) This course was developed with version 8.00.00 of FactoryTalk View Studio.
© Festo Didactic 20922-00
225
Appendix B
Glossary of New Terms
actuator
Device connected to a PLC output to create an action (e.g., a directional control
valve).
alias tag
An alias tag refers to another tag.
analog input
A PLC analog input connects to a variable voltage or current source (i.e., a sensor) and converts the signal to a digital value that the controller can manipulate.
analog output
A PLC
analog output converts a digital value to a voltage or current that is com-
patible with the device connected to it (e.g., a 4-20 mA motor drive input).
base tag
Tag that refers directly to the PLC data storage area.
controller tag
Acontroller tag can be used in the whole project.
counter instruction
When
enabled, this instruction increases or decreases its accumulated value by
one count until it reaches the preset value.
download
Program transfer from the computer
to the PLC memory.
EtherNet/IP
Communication
function block diagram
Graphical PLC programming language that uses blocks and wires.
instruction
Low-level PLC programming language that resembles the assembly language.
list
ladder logic
Graphical
PLC
protocol from Rockwell that uses Ethernet cables.
programming
language that uses rungs and uprights like relay
logic schematic diagrams.
local tag
normally-open
normally-closed
Tag that is typically used in a project program.
be used in the whole project.
contact
con-
In contrast, a controller tag can
An NO contact is open (there is no continuity) unless the device is actuated.
An NC contact is closed (there is continuity) unless the device is actuated.
tact
programmable
controller
logic
An industrial computer that reads its inputs, executes instructions,
its output values according to these calculations.
requested packet interval
Rate at which the input and output values are updated.
rung
In ladder logic, a rung is what contains the instructions. The
continuity of every rung.
© Festo Didactic 20922-00
PLC
and changes
evaluates the
227
Appendix B
sequential function
Glossary of New Terms
Flowchart-like PLC programming language that uses steps and transitions.
chart
structured text
High-level
PLC
programming
language
that
uses
statements
and
resembles
the C and Pascal languages.
Timer instruction
When enabled, this instruction changes its time values until it reaches the preset
value.
upload
228
Program transfer from the PLC memory to the computer.
© Festo Didactic 20922-00
Appendix C
Conversion Table
Table 10.
To convert
Conversion from Sl/Metric units to U.S. customary units.
from
to
Multiply by
kg/m?
Ib/ft?
6.243 x 10?
Heat transfer rate
Ww
BTU/h
3.412
Force
N
lbf
2.248 x 107
Length
m
ft
3.281
kg
Ib
2.205
Pa
in Hg (60°F)
2.961 x 104
Pa
Ibffin? (psi)
1.450 x 10+
Specific weight
N/m3
Ibf/ft
6.366 x 10%
Temperature
°C
°F
Tp = =
K
°F
Tr = = (Te — 273.15) + 32
Density
Mass
Pressure
Velocity
m/s.
Viscosity (dynamic) — N-s/m?
Volume flow rate
Limin
L/min
m/s
m/s
© Festo Didactic 20922-00
fils
lbf-s /ft?
fP/s
gal/min (gpm)
ft/s
gal/min (gpm)
+32
3.281
2.089 x 107
5.886 x 104
2.642 x 10
35.31
1.585 x 104
229
Appendix C
Conversion Table
Table 11.
To convert
Conversion from U.S. customary units to Si/Metric units.
from
to
Multiply by
Ib/ft?
kg/m$
16.02
BTU/h
Ww
0.293
Ibf
N
4.448
ft
m
3.048 x 10°!
Ib
kg
4.536 x 10°
in Hg (60°F)
Pa
3.377 « 10°
Ibffin? (psi)
Pa
6.895 x 10°
Specific weight
Ibf/ft®
Nim?
1.571 x 102
Temperature
Ee
°C
T=
°F
K
Tk = 3 (Tp — 32) + 273.15
m/s
3.048 x 101
N-s/m?
47.88
Density
Heat transfer rate
Force
Length
Mass
Pressure
Velocity
ft/s
Viscosity (dynamic) — Ibf-s /ft?
Volume flow rate
ft/s
gal/min (gpm)
ft/s
gal/min (gpm)
230
(Tp ae)
L/min
1.699 x 10°
Limin
3.785
m/s
2.832 x 102
mis
6.309 x 10°
© Festo Didactic 20922-00
Appendix D
Boolean Algebra and Digital Logic
As you may have seen already, PLCs have to deal with a lot of bits. For example,
the state of the digital sensor is perceived as aO or a1 at the PLC input. Then,
the PLC
performs some calculations and the output sent to an actuator may also
be a logical 0 or 1. The question is: how are the 0’s and 1’s handled within the
PLC? The answer lies in Boolean algebra.
Boolean algebra is a mathematical way of looking at logic problems. It is based
on problems which have only two outcomes, such as true or false, on or off, 0
or 1, and opened or closed. There are three basic operators in Boolean algebra.
They are the logical NOT, the logical AND, and the logical OR.
The logical NOT operator inverts a function or variable. The inverse of 1 is 0 and
the inverse of 0 is 1. The logical NOT can be denoted as:
A=AA
The logical AND operator is performed on two or more variables such as A or B.
The result of "ANDing" two or more variables is a logical 1 if every variable is a
logical 1. The
result is a logical 0 if any variable
is a logical 0. The logical AND
can be denoted as:
A'B=AAB
The logical OR operator is performed on two or more variables, such as A and B.
The result of "ORing" two or more variables is a logical 1 if any variable is a logical 1. The result is a logical 0 if every variable is a logical 0. The logical OR can
be denoted as:
A+B=AVB
A Boolean statement is a shorthand method
of describing a logic statement using
Boolean operators. The statement A-B+C=Y
is read “A ANDB, ORC
equals Y”. This means that the variable Y will be a logical 1 if both A and B are
logical 1's, or if C is a logical 1. In a Boolean statement, there is an order of precedence for the operators:
1.
Statements
within brackets and
under bars are performed
first. A bar
over two or more variables is considered the same as placing the variables within brackets. In this case, the statement under the bar is performed first, and then inverted.
2.
Perform all NOT (invert) functions on single variables.
3.
Perform all AND functions.
4.
Perform all OR functions.
Postulates are the basic assumptions from which the properties, rules, and theorems of a system can be deduced. These postulates of Boolean algebra are
listed in Table 12.
© Festo Didactic 20922-00
231
Appendix D
Boolean Algebra and Digital Logic
Table 12. Boolean algebra postulates.
#
Postulate
1
X=OorX=1
2
0-0=0
3
14+1=1
4
0+0=0
5
1i=1
6]
1:0=0-1=0
7)14+0=041=1
The theorems of Boolean algebra in Table 13 below are derived from these postulates:
Table 13. Boolean theorems.
Theorem
Examples
.
1. Commutative law
A+B=Bt+A
A-B=B-A
2. Associative law
(A+B) +C=A4(B4+0)
(A-B)-C =A-(B-C)
3. Distributive law
A:(B+C)=A-B+A°C
A+(B-C)=(A+B)-(AtC)
.
4. Identity law
A+tA=A
A-AZA
(A)=A
—_—_
5. Negation law
(AJ=A
6. Redundancy law
A+A-B=A
A(A+B)=A
O+A=A
1+A=1
r
0:-A=0
1-A=A
A+A=1
8.
A:A=0
9.
A: (A+B)=A°'B
A+A-B=A+4+B
j
10. De Morgan's law
232
A+B=A°B
WB HA+E
© Festo Didactic 20922-00
Appendix D
Boolean Algebra and Digital Logic
Digital logic is a method of implementing Boolean statements in a control circuit
or program. The Boolean operators (AND, OR, and NOT) are performed by logic
gates. A logic gate receives input signals and transmits an output
output signal will be a function of the input signal. Seven common
signal. The
logic gates
are: AND, OR, NOT, NOR, NAND, XOR, and XNOR.
The AND,
OR,
and NOT
gates perform the same function as the AND,
OR,
and
NOT operators in Boolean algebra. The NOR gate performs the inverse function
of an OR gate. A NAND gate performs the inverse function of an AND gate. The
XOR gate has two inputs; if one input or the other input, but not both, are logical 1s, then the output is a logical 1; otherwise the output is 0. The XNOR gate
performs the inverse function of an XOR gate. Figure 287 lists the types of gates,
gate symbols, and truth tables for each gate. The gate inputs are indicated as
either A or B, and the gate outputs are indicated by Y.
© Festo Didactic 20922-00
233
Appendix D
Boolean Algebra and Digital Logic
GATE
AND
SYMBOL
A
aT
TRUTH TABLE
ey
A
B
Me:
0
o
o
1
o
0
1
0
0
A
o
B
o
oY
o
1
1
Oo
1
4
4
1
A
B
1
4
Not | A—t>»—y]
A
0
1
A
a7)
A
o
o
1
1
BY
o
1
Oo
1
4
0
9
0
A
o
o
1
1
B
o
4
oOo
1
Y
f
4
4
0
A
0
BY
o
o
1
0
A
o
BY
o
4
1
1
oO
1
NOR
NAND |
XOR
ey
A
A
B “)
Yl
+
0
1
aioe | 2
B
Y|
oo
Y
1
0
1
+
i
1
1
0
0
90
4
Figure 287. Logic Gates.
234
© Festo Didactic 20922-00
Appendix D
Boolean Algebra and Digital Logic
Programmable Controllers use Boolean operators or logic gate functions as program instructions. These instructions are often used in combination with programmed NO and NC contacts.
The AND
instruction is used to connect programmed
contacts or ladder program
sections in series. The OR instruction is used to connect programmed contacts
or ladder program sections in parallel. The NOT instruction changes an NO programmed
contact to an NC programmed
contact.
Figure 288 through
Figure 291
show different combinations of contacts.
AH Ee
Figure 288. Two "ANDed" Contacts.
GA
GAcH
Figure 289. Two "ORed" contacts.
Figure 290. Two sets of “ORed” contacts "ANDed" together.
Figure 291. Two sets of "ANDed" contacts "ORed" together.
© Festo Didactic 20922-00
235
Index
£)
The bold page number indicates the main entry. Refer to the Glossary
of
New Terms for definitions of new terms.
ACIUBLONS bessniare meres mere nen
AllaS la eepsreeeees vee ey erene users ereee recon eereer eerie urease eam
ar ere nuemeE rags
ANAIOG INDUL..
eee
cee cee cee cee eee enae eee eneaeeeeeaeseeeeeaeeeeneaeeeeegeeeeeeeeeeeeee
analog level sensor..
SNalog Output ssc secceseecre arenes
ee
SARA'S sea sbcasice cease caaeauey aatctaade ee eatacine deh cistae tau natin ate a ate dlah aaa ea ey ean
a
a
assignment......
.
StOMIC data ty POS wesieewese sees vor esi ene eeneneereerernwenenermen
arene rrNecereeeTs
DASE TAQ oo... eee ceeesee cece ces eeee eee cree ceseeee cute eer eeeneneceneeeeeeeenues caeeeeeaessseesneeeeeeeeeeteeeeeneate 18
Batch: PrOC@SS
iscw ren ecrnemvcn e nmienm crani cenir ecir 162
DPaRGNES be cscteniereseenenrennennieaneemranreneenenenner mie
CaPACiliVe: PrOxiMIly SENSO vives
nT
communication
24,127
rete
165
networks ...
11
comparison instructions .
Compute instruction...
- 168
-169
construct.........
ws
continuous task ..
-197
.16, 17
controller tags........
Count Up instruction.
counters
eet
17
-132
anenany ener
eee
eT
Or
132
CPU vececcies
14, 16, 17, 27
CYCIE THM oo... eceecceececeeesceecnee cesses eee cneeseececeeeeceeeeeeeeeneeeeseceeeaeeceeensueesueeseseseneeen
sae 16
LEAD TY OS eer
see eee
cree
re reat
src eg
ee
a eae ea
19
directional Control VAIVES. ...........00cccc cee cee eee cee cece cee cece ee cues cee cesecceecescusecueessueees 68, 69
OWN
OR CIING esa cnessoensvecnsancenmarastennnensieavinsaienen cenasuienneanenceneshbTanenbsienh AHR cunasTeNaaviateneemarH 26
TUNCtION DIOCK GiagQ
Ma MS scei
TUNCHONS veisnsevewece:
sen eeeeeevvearee sere esnerannennecennienma reine
.197
NOXAPSCIMAl ss ccciivicriieriiewr anime
ntaneNmeea
NEI
21
IEC 61131-3 Standard oo... ccc cece cee cecceee ces eece eee cess cesses sees ceesseeaeeceeecseeeees 21, 126
INBUt GC GVICES seiictetcntianinmcmniontinnncnneineian
etn
eE 23
instruction
list .....
seek
25
INterfACE SCFESNS ........ ec cccccecccccseecesseecssesen
sees sees coesesesescseecesaecsssesnaeccseeenesesensecenae 92
KG YWONGS wesece ce seen nee eer
seem ores seers eo rae ensayo anaes
nena are eoun ar 196, 197
ADA ST LOGIG ccasssreretercsineeenenonmmrireie
ere
22
Fess Than INSWUCHON yreresrenweeerrneeeerrarmnearrer arrears 168
local taQS ......ccceeee
logical continuity
© Festo Didactic 20922-00
237
Index
Mathierhstical sSthicChons scence
mechanical limit SWHCH i wees
sven oven
mechatronic..............
169
rere: 66
.2,3,4
memory
...6, 26
card ..
MO Ve INS TUCHON
ss isssacc meres esmere rnin
anvernonn eT
168
Normally-closed CONLACHS
2... cee ceeceeeeee cere cer eeeeeeeeceeeeeeeeceseeceeneesaeecneeseeeentneetereeees 22
Hhormally“opSn: CONACES serene
nese
ET 22
OCHA eee
output
Output
Output
Quip
ccc cececcee eee cceeeaeeeeceseececenneseeceee aces cesuneeccseeeeecseceeeseenieeseeceneaeeceeraeeseesenees
devices
aaa
Energize instnictionscsascavacwaranenr
ee
70
Latch instruction .........ccccccccccceeccccseececeee
cece eee cess see ceeeceeseeeceseneesesecaeensecaeeees 71
Un ateh in SUCHIN se ccescecesneceruennresrnene
es ener seecnvennierearetemencremmneeccnmecnet 71
PLO project ...... ccc cccccecccseceee cece cee cece cee ceeeceeeaecesecaeeesecaeeceeseeecaesenesaeeeeesneeseeenates
pneumatic cylinder
power supply .........
i
PIOCESSOP ees eccsse eee socc seve eroneee cre earercemes ee cen aeons noun eer u ae ous mares
Programmable logic COntroller.........
ee ce ceeeceeseeeeeee creer ceeeseeceeeeesaeesaeeceaeeeseneneereeneere 2
PACKi secrreevserseeserusnvennasosvspemeronreyorespeneyoeraromranmey
one cean auras miareoune mane yeem ain aeuoS, 13
TAW VAIUCS ooo. cec ccc cceceeecceeee essence ceceeececsueeaecsceeaeeccseneeecseaeeeceaeeeseecaeeseeseeeseesueaes 169
reed switches.
66, 67
TOSSES TUCTON enc ccescsnccerercmssnenrem arene
nnrercennieenretN 133
TOUTINGS ooo eee ce cece cec ccc ccesceeeeee cece ceececeseesueesue sues eueseveeeeeeseeeuteeunens 15, 16, 25, 196, 197
TUINGS oo. cece ceecececeeeceeeecnecceeneecerereneceeeeesceeeeeeseeraeeceeeecseeeseeeenieecneneeeneecneeseeereneneeeenteees 22
Scale instruction .............ccccccccsceeceseces
cose coeeceeseeeeeeccseceseseceseeceensnsseccneeseaeeeeneseneees 169
Scale with Parameters instruction...
ccc ccc ccceseceseeceseseseecseeesesesee snes cntees 170
SCAMING cccwnesreros meinen acento
ann
169
SC ain UIM@wsseeewwe
ers were
sea
nena
16
SOQMSOMS .occccccccccccccccccccceecceeuseccecevecceceueeeuseeueeueeeceueesseeeeseseees 2, 3, 7, 8, 14, 23, 66, 164
sequential function Chart ...........eccccccceeccecceeceeeceeeeeeceneeee
sees seseeeesesaeeeseneeeeaenees 23, 126
structure data type ......
structured text .............
structured text statement
TASKS Sereeare renee enema ne een eeren
ranean
area
15,17
Timer On Delay instruction ..0.....0....cccccc ccc ce eee csee cee ceee ee ceeee cece see eeeeseeeeeeeseeeeeseeas 131
TRIOS seccesiseescssnewesmwceannsesenn wx sees MH:iiir au skies SUS RAE RAS 9S
UPlOAC. 20...
238
SR A
ASA RSS
VR
NS ES
131
eee cece eceeeneececenee ceca eae ates see aeseeeaeaeeeeseaeeeceeneeeceeneeeeeaneaeeseneaeeseeaeaees 26
© Festo Didactic 20922-00
Acronyms
The following acronyms are used in this manual:
ABS
Absolute Value (instruction)
ACD
PLC project (file name)
APA
HMI archived project (file name)
BOOL
Boolean (data type)
CPT
Compute (instruction)
CTU
Count Up (instruction)
DINT
Double integer (data type)
EQU
Equal To (instruction)
EU
Engineering Units
FB
Function block (programming)
HMI
Human-Machine Interface
JSR
Jump to Subroutine (instruction)
LAD, LD
Ladder logic (programming)
LES
Less Than (instruction)
MER
HMI runtime application (file name)
MOV
Move (instruction)
NEQ
Not Equal To (instruction)
OTE
Output Energize (instruction)
OTL
Output Latch (instruction)
OTU
Output Unlatch (instruction)
PID
Proportional Integral Derivative
PLC
Programmable
RES
Reset (instruction)
© Festo Didactic 20922-00
Logic Controller
239
Acronyms
240
SFC
Sequential function chart (programming)
ST
Structured text (programming)
TOF
Timer Off Delay (instruction)
TON
Timer On Delay (instruction)
XIC
Examine if Closed (also Examine On instruction)
xlO
Examine if Open (also Examine Off instruction)
© Festo Didactic 20922-00
Bibliography
Dunning, Gary, Introduction to the ControiLogix Programmable Automation Controller with
Labs,
2" ed.,
Clifton
Park,
NY:
Delmar,
Cengage
Learning,
2014,
ISBN 978-1-111-53929-0.
Rockwell
Automation,
CompactLogix
1769-UM021D-EN-P, December 2012.
Rockwell
Automation,
Logix5000
5370
Controller Design
Controllers,
publication
Considerations,
publication
1756-RM094H-EN-P, November 2012.
Rockwell
Automation,
Logix5000
Controllers
Ladder
Diagram,
publication
1756-PMO08E-EN-P, October 2014.
Rockwell
Automation,
Logix5000
Controllers
1756-PM007D-EN-P, November 2012.
Structured
Scott, Austin, Instant PLC Programming with RSLogix 5000,
Packt Publishing Ltd., 2013, ISBN 978-1-84969-844-3.
© Festo Didactic 20922-00
Text,
publication
Birmingham
(UK):
241
Download