0% found this document useful (0 votes)
2 views128 pages

Overview of Programmable Logic Controllers

Programmable Logic Controllers (PLCs) are electronic devices designed to automate industrial processes, replacing traditional control systems with more flexible and adaptable solutions. They are integrated into automated production systems to improve quality and reduce costs, while being subject to various industrial constraints. PLCs process information of different types (digital, analog, on/off) and can be modular or compact, depending on the system's needs.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views128 pages

Overview of Programmable Logic Controllers

Programmable Logic Controllers (PLCs) are electronic devices designed to automate industrial processes, replacing traditional control systems with more flexible and adaptable solutions. They are integrated into automated production systems to improve quality and reduce costs, while being subject to various industrial constraints. PLCs process information of different types (digital, analog, on/off) and can be modular or compact, depending on the system's needs.

Translated by

ScribdTranslations
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

I.

History:

Industrial programmable controllers appeared at the end


in the 1960s, at the request of the automobile industry
American (GM), which was calling for more adaptability in their systems.
of order.
The costs of electronics thus allowing to replace
advantageously current technologies.

Before: use of electromagnetic relays and systems


pneumatics for the realization of control parts
⇒ wired logic

Disadvantages: expensive, no flexibility, no communication possible

Solution : use of microprocessor-based systems allowing for easy modification of


automated systems⇒ programmed logic

The computers of the time were expensive and not suited to the constraints of the industrial world, the automated machines
were supposed to meet the expectations of the industry.

Contraintes du monde industriel :

external influences:
-dust,
temperature
humidity
vibrations
-electromagnetic parasites, ...

Personnel:
easy implementation of the material (no language of
complex programming
repair possible by trained technicians
electromechanics
possibility to modify the system while it is operating

Material:
evolutionary
modular
easy implantation

The Programmable Logic Controller (PLC) is a programmable electronic device, suitable for
the industrial environment, which performs automation functions to ensure the control of
pre-actuators and actuators from logical, analog or digital information.

2 / 17
II. The role of the API in the automated production system (A.P.S.):

a. Automated production systems:

The objective of system automation is to produce with minimal reliance on


the man, quality products and this for the lowest possible cost.

An automated system is a set of interacting elements, organized for a purpose.


precise: to act on a raw material to give it added value.
The automated system is subject to constraints: energy, configuration, adjustment and
of operation that occur in all modes of operation and shutdown of the system.

CONSTRAINTS

Raw material
Material of work SYSTEM +
AUTOMATE Value added

b. Structure of an automated system:

Any automated system can be broken down according to the diagram below:

Other parties ENERGY


orders

COMMUNICATION PREACTIONERS ACTUATORS

TREATMENT
DES
INFORMATION

DESK OF SENSORS PART


ORDER AND OF MECHANICS
SIGNALISATION DETECTORS
(Effectors)

CONTROL POST ORDER PART OPERATIVE PART

3 / 17
Operational part:

It acts on the raw material to give it its added value.


The actuators (motors, cylinders) act on the mechanical part of the system which in turn acts on the
material of work.
Sensors / detectors allow for the acquisition of the various states of the system.

Order party:

She gives the operating orders to the operational part.


The actuators allow the control of the actuators; they ensure the transfer of energy between
the power source (electric network, pneumatic, etc.) and the actuators. Example: contactor,
distributor ...
These pre-actuators are controlled in turn by the information block processing.
He receives the instructions from the control panel (operator) and the information from the part.
Operative transmitted by the sensors / detectors.
Based on these instructions and its task management program (implemented in an automaton
programmable or realized by relays (we talk about wired logic), it will control the
pre-action actuators and send information to the signaling desk or to other systems
command and/or supervision using a network and a communication protocol.

Control post:

Composed of control and signaling desks, it allows the operator to control the
system (start, stop, cycle start ...).
It also allows you to visualize the different states of the system using indicators, terminal.
dialogue or human-machine interface (HMI).

c. Areas of application of automation:

APIs are used in all industrial sectors for machine control (conveying, ...
packaging ...) or production lines (automotive, agri-food ...) or it can also
ensure process regulation functions (metallurgy, chemistry ...).
It is increasingly used in the building sector (tertiary and industrial) for control of
heating, lighting, security or alarms.

d. Nature of the information processed by the automated system:

The information can be of the type:

All or nothing (A.O.N.): information can only take two states (true/false, 0 or 1 …).
This is the type of information provided by a detector, a push button...

Analog: the information is continuous and can take a value within a range
well determined. It is the type of information provided by a sensor (pressure, temperature …)

Digital: information is contained in coded words in binary form or


hexadecimal. It is the type of information delivered by a computer or an intelligent module.

4 / 17
III. Architecture of automata:

a. Exterior aspect:

Automata can be of compact or modular type.


From the type compact, we will distinguish programming modules (Siemens LOGO, ZELIO of
Schneider, MILLENIUM from Crouzet ...) microautomata.
It integrates the processor, the power supply, the inputs and the outputs. Depending on the models and manufacturers, it
can perform certain additional functions (quick counting, analog I/O ...) and receive
limited number of extensions.
These simple-functioning automata are generally intended for the control of small
automatisms.
The modular type, the processor, the power supply, and the input/output interfaces reside in a
separate units (modules) and are mounted on one or more racks containing the 'basket bottom' (bus plus
connectors).
These automata are integrated into complex automation where power, processing capacity and
flexibility is necessary.

Automate compact (Allen-Bradley) Modular automation (Modicon)

Modular automation (Siemens)

1 Power module 6 memory cards


2 Backup pile 7 Multipoint Interface (MPI)
3 Connection to 24V DC 8 Front connector
4 Mode switch (key) 9 Front panel
5 status and fault indicator LEDs

5 / 17
Main functions:

Input/output cards: In quantities of 4, 8, 16, or 32, they can also perform functions
of entries, exits or both.
These are the most used and the available voltages are standardized (24, 48, 110 or 230V direct current or
alternative ...).
The routes can be independent or have "commons".
Input cards collect information from sensors, buttons ... that are assigned to them.
connected and to materialize it with an image of the state of the sensor.
Output cards offer two types of technologies: electromagnetic relay outputs
(coil plus contact) and static outputs (based on transistors or triacs).

Quick counting cards: they allow for the acquisition of high-frequency information
incompatible with the processing time of the automaton.
Example: signal from a position encoder.

Axis control cards: They ensure precise positioning of elements.


mechanics according to one or more axes. The card allows, for example, to control a servomotor and to
receive positioning information from an encoder. The position control can be
done in a closed loop.

Analog input/output cards: They allow for the acquisition of an analog signal.
and its essential digital conversion (ADC) to ensure processing by the microprocessor.
The inverse function (analog output) is also implemented.
Analog quantities are standardized: 0-10V or 4-20mA.

Other cards:

PID regulation cards


Weighing cards
Communication cards (Ethernet ...)
Remote input/output cards

IV. Wiring of an automaton's inputs/outputs:

a. Supply of the machine (see diagram below):

The automation is generally powered by the single-phase network 230V; 50 Hz but other
power supplies are possible (110V etc ...).
The protection will be of the magneto-thermal type (see the characteristics of the automatic device and the
manufacturer's recommendations.

It is advisable to control the power supply of the automaton with a specific control circuit.
(contactor KM1).

Likewise, the outputs will be controlled by the control circuit and powered after validation of the dog.
guard (see paragraph VII).

7 / 17
PE N L1

Q1
2 x F2 T1 F3
230 / 24V
1 2 1 2

1 2
S1

KM1

S2
Towards automated outputs
- KA1
13 14

Dog of
Q2 S3 - KM1 guard

I> A1 A1

KM1 KA1
A2 A2

PE N L C0 0 C1 1 C234 2 3 4

Power supply of the machine Automated Outputs

AUTOMATE
Sensor power supply Automated entries

0V 24V 0 1 2 3 4 5 6 7

8 / 17
b. Feeding the inputs of the automat:
The automatic device is generally equipped with a power supply for sensors/detectors (pay attention to the type of
logic used: positive or negative logic.
The inputs are connected to the common OV of this power supply.
The information from sensors/detectors is processed by input interfaces.

AUTOMATE

Interface
0 1 2 3 4 5 6 7
starter

0V 24V 0 1 2 3 4 5 6 7

- b5
S8 S9 S4 F1
B2 S5
KA1

15 s

c. Powering the outputs of the automation:

Output interfaces allow powering various pre-actuators.


It is desirable to equip each pre-actuator based on RC circuit relays (not shown).

AUTOMATE

Interface
outgoing 0 1 2 3 4

C0 0 C1 1 C234 2 3 4

KA1
13 14

Since circuit H1 H4 KM2

of order

9 / 17
V. Processing of the automation program:

All the automata operate according to the same operating procedure:

INTERNAL TREATMENT

READING OF ENTRIES

EXECUTION OF THE PROGRAM

WRITING OF OUTPUTS

Internal processing: The machine performs control operations and updates certain parameters.
systems (detection of transitions to RUN / STOP, updates of the timestamp values, ...).

Reading the inputs: The automaton reads the inputs (synchronously) and copies them into memory.
image of the inputs.
Execution of the program: The automaton executes the program instruction by instruction and writes the
outputs in the image memory of the outputs.
Output writing: The automaton toggles the different outputs (synchronously) to the positions
defined in the output image memory.

These four operations are carried out continuously by the automaton (cyclic operation).

We call polling the set of the four operations performed by the automated system and the polling time.
is the time taken by the automated system to process the same part of the program. This time is on the order of
tens of milliseconds for standard applications.

The total response time (TRT) is the time that elapses between the change of state of an input and the
change of state of the corresponding output:

Scanning time

I E T S I E T S

Triggering of a detector Taking into account the Switching of the


entry change sortie

Total response time

The total response time is at most twice the polling time (without special processing).

10 / 17
CHAPTER 2. THE A.P.I.s 19

2.2 Design of a sequential automation

For a given process, one must consider


account : Study and implementation
of the constraints industrial of an automatic
(profitability, security)
of the nature and types of sensors
Establish the specifications
therefore signals delivered by the sensors,
of the nature of the actuators therefore of the
accepted control signals by the Draw the level 1 GRAFCET
actuators.
This part is the most important especially
for the arrangement of the sensors! (The Operational analysis and
Will the sensor placed at this location deliver? technological
a relevant answer?). It determines
also :
Draw the level 2 grafcet
the choice of I/O interfaces,
the number and type of I/O
the usefulness or not of a field bus. Analyze the modes of
marches and stops
The establishment of sequences of
the automation is what we call the
yes
level 1 GRAFCET. It is the diagram of Problem?
actions to be taken based on the
received information. no
Choose the control technology

This analysis takes into account the constraints


imposed by the sensors and actuators, thus Establish the diagram
that the modes of operation of
the automation (run, stop, manual,
automatic, security). Wiring - to develop
This is called the level 2 GRAFCET
which represents the complete automation to be achieved. A
at this stage, depending on the issues encountered, we FIN
may be required to return to the specifications
and/or at Level 1 GRAFCET.

the different automation equipment


the control technology (if needed).
VI. Programming:

a. Programming languages :

There are 4 programming languages for automata that are globally standardized by the norm.
IEC 61131-3.
Each automation is programmed via a proprietary programming console or by a computer.
equipped with specific manufacturer software.

Instruction list (IL): Language


text of the same nature as the assembler
(microcontroller programming).
Very little used by automation engineers.

Structured Text (ST):


Computer language of the same nature as the
Pascal uses functions like if ... then ...
else ...(if ... then ... else ...)
Little used by automation engineers.

Contact language (LD: Ladder diagram):


Graphical language developed for the
electricians. He uses symbols such as:
contacts, relays and functional blocks and organizes
in networks (labels).
It is the most used.

Function Blocks (FBD: Function Block Diagram):


Graphical language or functions are represented
by rectangles with the entries on the left and the
right exits. The blocks are programmed
(library) or programmable.
Used by automation engineers.

12 / 17
b. Programming using GRAFCET (SFC: Sequential Function Chart):

GRAFCET, specification language, is used by


certain manufacturers of automation (Schneider, Siemens)
for programming. Sometimes associated with a programming language.
programming, it allows for easy programming of
sequential systems while facilitating the development of
programs as well as system troubleshooting.
A grafcet can also be translated into language in
contacts and implant it on any type of automaton.

Some software allows full programming in GRAFCET language and allows adaptation.
to most existing controllers (CADEPA or AUTOMGEN software).

VII. Security:

Automated systems are, by nature, a source of many hazards (used voltages, movements
mechanics, jets of matter under pressure ...
Placed at the heart of the automated system, the automaton must be a reliable element because:

A malfunction of this could have serious repercussions on safety.


people,

the repair costs of the production tool are generally very high,

A halt in production can have serious financial consequences.

Additionally, the system is subject to numerous provisions to ensure safety:

External constraints: the robot is designed to withstand the various stresses of the world
industrial and has undergone numerous standardized tests (vibration resistance, EMC ...)

Power outages: the machine is designed to withstand power outages and allows,
per program, ensure correct operation during refeeding (cold restarts or at
warm)

RUN/STOP mode: Only a technician can start or stop an automation and the reset in
the process is carried out by an initialization procedure (scheduled)

Cyclic controls:

Self-monitoring procedures for memory, clock, battery, voltage


of power supply and input/output
Verification of the polling time at each cycle called Watchdog.
Triggering of an alarm procedure in case of exceeding this (set by
the user)

13 / 17
Description of PL7 languages

II

Presentation

Object of this This intercalary describes the programming languages of Micro automata and
interleaf Premium.

Content of this This interleaved section contains the following chapters:


interleaf
Chapter Chapter Title Page
6 Contact language 111
7 Language instruction list 125
8 Structured literal language 141
9 Grafcet 165
10 DFB function blocks 209

TLX DR PL7 xx 109


PL7 languages

110 TLXDRPL7xx
Contact languages

Presentation

Content of this This chapter describes programming in contact language.


chapter

Content of this This chapter contains the following topics:


chapter
Subject Page
General presentation of contact languages 112
Structure of a network of contacts 113
Etiquette of a network of contacts 114
Comment from a contact network 115
Graphic elements of the contact language 116
Programming rules for a network of contacts 119
Programming rule for function blocks 120
Operation block programming rules 121
Execution of a network of contacts 122

TLX DR PL7 xx 111


Contact languages

General presentation of contact languages

Generalities A section of a program written in contact language consists of a sequence of


sequentially executed contact networks by the automaton.

The representation of a contact network is similar to that of a diagram.


electric.

Illustration of a The following screen presents a PL7 contact network.


network of 1 2 3
contacts
LD:MAST-CHART
*(Dyrnig
m
it e*)
%L100
%1
I0
.%M12 %1
I7
. %
Q
52
.

%TM
Q
4. %
M1
7

%1
I1
.0%Q23
.%M27 %T
M0 %
M5
2%M
W
X.0 OPERATE
%MW15:=%MW18+500
IN TM Q
M O D
EY
O U
R
TB:1m
ni
TMP
99:99
MODIF:Y
%
M2 %1
I4
. S
R2
C

P N X S R OP
ER C
OHP C
OH
P F
B F(..)
H V
F2 F
3 F
4 F5 F6 F
7 F8 F9 F10 F1 F12 SF
.1 SF
.2 F
3S
. SF
.4 F
5S
. SF
.6 F
7S
. SF
.8

Composition This table describes the components of a contact network.


of a network of
Marker Element Function
contacts
1 Etiquette Identify a network of contacts (optional).
2 Comment Provide a network of contacts (optional).
3 Elements They represent:
graphics the inputs/outputs of the automaton (push buttons,
detectors, relays, indicators...)
the automation functions (timers,
counters...,)
arithmetic, logical, and specific operations,
the internal variables of the automaton.

112 TLXDRPL7xx
Contact language

Structure of a network of contacts

Introduction A circuit is connected between two potential bars. The direction of current flow
It is established from the left potential bar to the right potential bar.

Illustration The following drawing describes the structure of a contact network.


1 2 3 4 5 6 7 8 9 10 11

1
2
3
4
5
6
Potential barrier
7
8
9
10
11
.
Zone action

Zone test

Description of a A network of contacts is composed of a set of graphic elements.


network of arranged on a grid of :
contacts Maximum 16 rows and 11 columns (for Premium automata),
7 rows maximum and 11 columns (for Micro automata).
It is divided into two areas:
the test zone, which includes the necessary conditions for an action
the action zone, which applies the result following a sequence of tests.

TLX DR PL7 xx 113


Contact languages

Etiquette of a network of contacts

Generalities The label allows you to identify a network within a program entity (program)
main, sub-program, ...). It is optional.

Syntax This label has the following syntax: %Li with i ranging from 0 to 999.
She is positioned at the upper left part in front of the potential bar.

Illustration The following contact networks illustrate the use of a label.

%M20 %L245

Etiquette

%L245

%Q2.3 %M155
S

Rules A label marker can only be assigned to a single network within the same
program entity.

It is necessary to label a network in order to allow for a connection after a


program jump (see illustration above).

The order of the label markers is arbitrary, (it is the order of entry of
networks that are taken into account by the system during the polling).

114 TLXDRPL7xx
Contact language

Commentary from a network of contacts

Generalities The comment facilitates the interpretation of the network it is attached to, but is not
mandatory.

Syntax The comment is integrated into the network and consists of 222 alphanumeric characters.
maximum widths, framed on either side by the characters (* and *).

Illustration The drawing below indicates the position of the comment.

Comment zone

Rules The comments are displayed in the reserved area at the top of the
network of contacts.

In case of deletion of a network, the associated comment is


also removed.

Comments are stored in the automaton and are accessible to everyone


moment by the user. In this regard, they consume program memory.

TLX DR PL7 xx 115


Contact language

Graphical elements of contact language

Generalities The graphic elements are the instructions of the language with contacts.

Contacts The graphic elements of the contacts are programmed in the test zone and occupy
a cell (1 row high and 1 column wide).
Designation Graphics Functions
Contact at Contact passes when the bit object that controls it is in state 1.
closure

Contact at Contact passes when the bit object that controls it is in the state 0.
opening

Contact at Front rising: detection of the transition from 0 to 1 of the bit object
detection of who is the pilot.
P
front amount
Contact à Front descendant: detection of the transition from 1 to 0 of the object
detection of N a bit of the pilot.
front
descendant

Elements of The linking graphic elements allow connecting the graphic elements of
liaison test and action.
Designation Graphic design Functions
Connection Allows to connect the graphical test elements in series
horizontal and action between the two potential bars.

Connection Allows connecting the graphic elements in parallel of


vertical of test and action.
potential
Derivation Allows to connect 2 objects through several
short circuit connections.

116 TLXDRPL7xx
Contact language

Coils The graphic elements of the reels are programmed in the action zone and occupy
a cell (1 row high and 1 column wide).
Designation Graphic design Functions
Direct coil The associated bit object takes the value of the result of the area
test.

Coil The associated bit object takes the inverse value of the result of the
inverse zone test.

Bobbin The associated bit object is set to 1 when the result of the area
of trigger S test is at 1.
ent
Reel of The associated bit object is set to 0 when the result of the area
trigger R test is at 1.
t
Jump Allows connection to a labeled network, upstream or
conditional to aval.
->>%Li
another Jumps are only effective within the same entity of
network programming (main program, sub-
(SAUTER) program,...). The execution of a jump causes:
the suspension of the ongoing network scrutiny,
the execution of the requested labeled network,
the non-scrutiny of the part of the program located
between the jump action and the designated network.

B sharp Proposed in Grafcet language, used during the hashtag the


programming of the receptivities associated with transitions
#
provokes the transition to the next step.

Call coil Allows a connection at the beginning of the subroutine


to a sub- lorsque le résultat de la zone de test sous-programme est
program C to 1.
(CALL) The execution of a call to a subroutine causes:
the suspension of the ongoing network polling,
the execution of the subprogram,
the resumption of the interrupted network monitoring.
Return of Reserved for the SR sub-program, allows the return to
under- module calling when the test zone result is
program
<RETURN> at 1.

Stop Causes the program execution to stop when the


programme the test area result is at 1.
HALT

TLX DR PL7 xx 117


Contact language

Function blocks The graphical elements of standard function blocks are programmed in the test area.
standard and occupy a dimension of a height of 16 lines maximum and a width of 3
columns.
Designation Graphic design Functions
Timer Blocks, Each of the standard function blocks uses a
Counter, inputs, outputs, input/outputs allowing
Monostable, of those related to other graphic elements.
Register,
Programmer
cyclic

Function blocks The graphical elements of the function blocks DFB are programmed in the test area and
DFB occupy a dimension of a maximum height of 16 lines and a width of 3
columns.
Designation Graphic design Functions
Blocks Each DFB function block uses
programmables inputs, outputs, input/outputs allowing
of the ones related to other graphic elements for
objects of type bits or that can be assigned to
digital objects or paintings

Operation blocks The graphical elements of the operation blocks are programmed in the test area and
occupy the dimensions mentioned below.
Designation Graphic design Functions
Comparison block Allows the comparison of 2 operands, according to the
vertical As a result, the corresponding output becomes 1.
Dimension: 2 columns/4 rows

Comparison block Allows the comparison of 2 operands, the output


horizontal set to 1 when the result is verified (a block can
contain up to 4096 characters).
Dimension: 2 columns/1 row
Operation Block Perform arithmetic, logical operations... done
call to the syntax of structured literal language.
(A block can contain up to 4096 characters).
Dimension: 4 columns/1 row

118 TLXDRPL7xx
Contact language

Rules for programming a contact network

Generalities The scheduling of a contact network is carried out using elements


graphics, while respecting the following programming rules.

Rules of The simple graphic elements for testing and action each occupy a cell.
programming being of a network.

Each contact line starts on the left potential line and must be
end on the straight potential line.

The tests are always located in columns 1 to 10.


The actions are always located in column 11.

The direction of current flow is as follows:


for horizontal connections, from left to right,
for vertical connections, in both directions.

Example of The next screen presents an example of a contact network.


network of
contacts

TLX DR PL7 xx 119


Contact language

Functional Block Programming Rule

Generalities Standard function blocks are positioned in the test area of networks.
contacts.

Rules of Whatever type of functional block is used, it must necessarily be connected in


programming input to the left potential bar, live or through other elements
blocks graphics.
function outputs "in the air": it is not necessary to connect to other elements
graphics the outputs of functional blocks,
testable outputs: the outputs of the functional blocks are accessible to the user
in the form of a bit object.
The internal block variables and graphical outputs are exploitable objects.
remotely from another part of the program.

The unconnected inputs of standard function blocks are set to 0.

As for graphic elements like contacts, it is possible to create


functional block combinations.

Example of a The following illustration presents an example of a contact network containing 2


network of functional blocks.
contacts

120 TLXDRPL7xx
Contact language

Operation Block Programming Rules

Generalities The comparison blocks are positioned in the test area and the operation blocks are
position themselves in the action zone.

Rules of Whatever type of operational block is used, it must necessarily be connected in


programming entry to the left potential bar, live or through other elements
blocks graphics.
operation
As for graphic elements such as contacts, it is possible to create
combinations of functional and operational blocks.

Example of The following illustration presents an example of a contact network containing 2


operation blocks comparison blocks and an operation block.

%I3.6 %TM10 %Q6.3


%MW1>100 IN Q
TYP:TP
%I1.2 TB:100ms %TM2.P:=3450
%MW2>500 TM.P:200
MODIFY: Y

TLX DR PL7 xx 121


Contact language

Execution of a network of contacts

Connected network A connected network contains graphic elements all linked to each other by
linking elements (excluding potential bar), but independent of the others
graphic elements of the network (no vertical connections upwards or to the
based on the limit of connected network.

Illustration of The following contact network consists of 3 connected networks.


networks Network Network
connected connected 2 attached 1

Network
connection 3

Rule The first assessed connected network is the one whose left corner is located the highest.
execution of top left.
networks
connected A connected network is assessed in the sense of the equation: network assessment of
top to bottom, line by line, and in each line from left to right.

In the case where a convergent vertical link is encountered, the subnet


which is associated with it is evaluated (according to the same logic) before continuing the evaluation
of the network that encompasses it.

122 TLXDRPL7xx
Contact language

Execution of The following table describes the execution order of the elements in a network.
elements in related..
a network
Phase Description
connected
1 The system evaluates the logical state of each contact based on:
the current value of the application's internal objects,
the status of the input of the input/output modules acquired at the beginning of the cycle

2 The system executes the processes associated with functions, blocks


functions, and to subprograms,
3 The system updates the bit objects associated with the coils (the update of
output from input/output modules occurs at the end of the cycle,
4 The system switches to another network labeled with the same module
program (jump to another network ->>%Li), return to the calling module
, or program stop <HALT>,

Example 1: The following drawing visualizes the order of execution of the graphical elements.
illustration

Example 1: The following table describes the execution of graphical elements in the illustrated network.
operation above.
Phase Description
1 Network evaluation until the first vertical link is encountered
convergence: contacts A, B, C.
2 Evaluation of the first subnet: contact D,
3 Continuation of the network assessment until the meeting of the second link
convergence vertical: contact E,
4 Evaluation of the 2nd subnet: contacts F and G,
5 Evaluation of the H coil.

TLX DR PL7 xx 123


Contact language

Example 2: The following drawing visualizes the order of execution of graphical elements.
illustration

Example 2: The following table describes the execution of graphic elements in the illustrated network
functioning above.
Phase Description
1 coil 1: INIT, %M5, %M7, %Q2.1,
2 coil 2 : %M4, %MW2:X1,AUTO, UP_1,
3 Operation block.

124 TLXDRPL7xx
Language instruction list

Presentation

Generalities This chapter describes the programming rules in instruction list language.

Content of this This chapter includes the following topics:


chapter
Subject Page
General presentation of the language instruction list 126
Structure of a program list of instructions 127
Etiquette of a sentence in instruction list language 128
Comment on a phrase in instruction list language 129
Presentation of instructions in instruction list language 130
Rule of using parentheses in instruction list language 133
Description of MPS, MRD, and MPP instructions 135
Principles of programming predefined function blocks 137
Execution rules of a program instruction list 139

TLX DR PL7 xx 125


Language instruction list

General presentation of the instruction list language

Generalities A section written in instruction list language consists of a sequence


instructions executed sequentially by the automaton.

Illustration of a The following illustration presents a list of instructions program PL7 and the details.
program of an instruction..
!%L0:
LD %I1.0
ANDN %M12
OR( %TM4.Q
LD %I1.0
AND %M17
)
AND %I3.7
ST %Q2.5 Code Operand
!%L2: instruction
LD %I3.5

Composition This table describes the components of an instruction.


of an instruction
Element Function
Code instruction The instruction code determines the operation to be executed. There are 2 types of
codes instructions :
test, which includes the necessary conditions for an action
(ex: LD, AND, OR...)
action, which punishes the result following a sequence of
test. (ex: ST, STN, R, ...).
Operand An instruction acts on an operand. This operand can be:
an input/output of the control system (push buttons, sensors,
relays, indicators...)
an automation function (timers, counters...)
an arithmetic and logical operation or a transfer operation,
an internal variable of the automation.

126 TLXDRPL7xx
Language instruction list

Structure of a program list of instructions

Generalities As in contact languages, the instructions are organized in sequence.


Instructions (equivalent to a network of contacts) called phrase.

Example of The following illustration presents a PL7 instruction list phrase.


phrase
(Drying in progress) 1
%L2 : 2
LD %I1.0
AND %M10 3
ST %Q2.5

Description Each sentence starts with an exclamation point (automatically generated).


of a sentence it includes the following elements.
Reference Element Function
1 Comment Provide a sentence (optional).
2 Etiquette Mark a sentence (optional).
3 Instructions One or more test instructions, the result of these
instructions being applied to one or more instructions
of action.
A statement occupies a maximum of one line

TLX DR PL7 xx 127


Language list of instructions

Etiquette of a sentence in instruction list language

Generalities The label allows you to locate a phrase within a program entity.
(main program, subprogram, ...). It is optional.

Syntax This label has the following syntax: %Li with i ranging from 0 to 999. It is
positions at the beginning of a sentence.

Illustration The following program illustrates the use of a label.

%L0 :
LD %M40
JMPC %L10

(*Drying waiting*)
%L2 :
LD %I1.0
AND %M10
ST %Q2.5
...
%L10 : Etiquette
LD %I3.5
ANDN %Q4.3
OR %M20
ST %Q2.5

Rules The same label can only be assigned to a single sentence within a
same program entity.

It is necessary to label a phrase in order to allow a connection afterwards.


program jump.

The order of the label markers is arbitrary, it follows the order of entry of
phrases that are taken into account by the system during the scanning.

128 TLXDRPL7xx
Language instruction list

Commentary of a phrase in instruction list language

Generalities The comment aids in the interpretation of a sentence to which it is attached. It is


optional.

Syntax The comment can be integrated at the beginning of a sentence and can occupy 3 lines.
maximum (up to 222 alphanumeric characters), framed on both sides by
les caractères (* et *).

Illustration The following illustration identifies the position of the comment in a sentence.
(Waiting for drying) Comment
%L2 :
LD %I1.0
AND %M10
ST %Q2.5

Rules Comments only appear from the first line of the sentence.

In case of deletion of a sentence, the associated comment is


also deleted.

The comments are stored in the automaton and are accessible to everyone.
Moment by the user. As such, they consume program memory.

TLX DR PL7 xx 129


Language list of instructions

Presentation of instructions in instruction list language

Generalities The instruction list language includes instructions:


the test
of action
on function block
digital

Instructions from The following table describes the test instructions of the instruction list language.
test
Designation Graphics Functions
equivalent
LD The boolean result is equal to the state of the operand.

LDN The boolean result is equal to the inverse state of the operand.

LDR The boolean result switches to 1 upon detection of the passage of


P 0 to 1 of the operand (rising edge).

LDF The boolean result changes to 1 upon detecting the passage of


N 1 to 0 of the operand (descending front).

AND The boolean result is equal to the logical And between the result
boolean of the previous instruction and the state of the operand.

ANDN The boolean result is equal to the logical AND between the result
boolean of the previous instruction and the inverse state of
the operand.
ANDR The boolean result is equal to the logical AND between the result
P boolean of the previous instruction, and the detection of a
front amount of the operation (1=front amount).
ANDF Le résultat booléen est égal au Et logique entre le résultat
N booléen de l’instruction précédente, et la détection d’un
front descendant of the operand (1=front descendant).
OR The boolean result is equal to the logical Or between the result
Boolean from the previous instruction and the state of the operand.

ORN The boolean result is equal to the logical Or between the result
boolean of the previous instruction and the inverse state of
the operand.

130 TLXDRPL7xx
Language instruction list

Designation Graphic design Functions


equivalent
ORR The boolean result is equal to the logical OR between the result
boolean from the previous instruction, and the detection of a
P front amount of the operand (1=front amount).

ORF The boolean result is equal to the logical And between the result
boolean of the previous instruction and the state of the operand.
N and the detection of a descending edge of the operand
(1=front descendant).
AND( And logic (8 levels of parentheses)

OR( Or logic (8 levels of parentheses)

XOR, XORN - Or exclusive


XORR, XORF
MPS Switching to reels.
MRD
MPP

N - Negation

Instructions The following table describes the test instructions for the instruction list language.
action
Designation Graphic design Functions
ST The associated operand takes the value of the result of the area
test.

STN The associated operand takes the inverse value of the result of
the test zone.

S The associated operand is set to 1 when the result of the


S the zone test is at 1.

R The associated operand is set to 0 when the result of the


R zone test is at 1.

JMP - Allows an unconditional connection to a sentence


labeled, upstream or downstream.

TLX DR PL7 xx 131


Language instruction list

Designation Graphic design Functions


JMPC - Allows a connection conditioned on a boolean result
to 1, to a sentence labeled upstream or downstream.

JMPCN - Allows for a connection conditioned on a boolean result


to 0, to a sentence labeled upstream or downstream.

SRn - Branching at the beginning of the subprogram.

RET - Subprogram return.


RETC - Return from subprogram conditioned on a result
boolean to 1.
RETCN - Return from subroutine conditioned on a result
boolean to 0.
END - End of program.
ENDC - End of program conditioned on a boolean result of 1.
ENDCN - End of program conditioned on a boolean result of 0.

Instruction on The following table describes the test instructions of the instruction list language.
function block
Designation Graphic design Functions
Timer Blocks, For each of the standard functional blocks, there exists
Counter, instructions to control the block.
Monostable, A structured form allows for direct cabling
Register, the inputs/outputs of the blocks.
Programmer
cyclic

Instructions The following table describes the test instructions of the instruction list language.
digital
Designation Instructions Functions
Test element LD[.....] Allows the comparison of 2 operands, the output
AND[.....] switch to 1 when the result is verified.
OR[.....] Example: LD[%MW10<1000]
Result is 1 when %MW10<1000.
Element of action [.....] Perform arithmetic, logical operations...
Use the syntax of the structured literal language.
Example: [%MW10:=%MW0+100]
The result of the operation %MW0+100 is placed
in the internal word %MW10.

132 TLXDRPL7xx
Language instruction list

Rules for using parentheses in instruction list language

Generalities The AND and OR instructions can use parentheses.


These parentheses allow for the creation of contact diagrams in a simple way.

Principle The opening of parentheses is associated with the AND or OR instruction.


The closing parenthesis is an instruction, it is mandatory for each
open parenthesis.

Example : AND( The following 2 programs illustrate the use of parentheses.


LD %I1.0
AND %I1.1
OR %I1.2
ST %Q2.0

LD %I1.0
AND(%I1.1
OR %I1.2
)
ST %Q2.0

Example: OR( The following program illustrates the use of parentheses.


LD %I1.0
AND %I1.1
OR(N%I1.2
AND %I1.3
)
ST %Q2.0

TLX DR PL7 xx 133


Language instruction list

Association of The following 'modifiers' can be associated with parentheses.


parentheses to
Code Role Example
of the
modifiers N Negation AND(N
F Front descendant (Falling edge) AND(F
R Front montant (Rising edge) OR(R
[ Comparison OR([%MW0>100]

Imbrication of It is possible to nest up to 8 levels of parentheses.


parentheses The following rules must be followed:
Each open parenthesis must be closed.
The %Li:ne labels should not be placed in expressions between
parentheses, as well as jump instructions JMP and subroutine call
SRi,
The assignment instructions ST, STN, SetRne must not be programmed.
in parentheses.
Example:
Les programmes suivants illustrent l’utilisation de l’imbrication des parenthèses.
LD %I1.0
AND(%I1.1
OR(N%I1.2
AND %M3
)
)
ST %Q2.0

LD %I1.1
AND(%I1.2
AND %I1.3
OR(N%I1.5
AND %I1.6
)
AND %I1.4
OR(N%I1.7
AND %I1.8
)
)
ST %Q2.0

134 TLXDRPL7xx
Language instruction list

Description of the MPS, MRD, and MPP instructions

Generalities The 3 types of instructions allow for the processing of switches to the coils.

These instructions use an intermediate memory called a stack that can store
up to 3 boolean information...

Note: These instructions cannot be used within an expression.


in parentheses

Role The following table describes the role of each instruction


Instruction Role
MPS (Memory Push) This instruction has the effect of storing the result of the
last test instruction at the top of the stack and shift
the other values towards the bottom of the stack.

MRD (Memory ReaD) This instruction reads the top of the stack.
MPP (Memory PoP) This instruction serves to read and unload the top of
the pile and shift the other values towards the top of the
pile.

Example 1 This example illustrates the use of the MPS, MRD, and MPP instructions.

LD %I1.0
AND %M0
MPS
AND %I1.1
ST %Q2.0
MRD
AND %I1.2
ST %Q2.1
MRD
AND %I1.3
ST %Q2.2
MPP
AND %I1.4
ST %Q2.3

TLX DR PL7 xx 135


Language instruction list

Example 2 This example illustrates the functioning of the MPS, MRD, and MPP instructions.
LD %I1.0
MPS
AND %I1.1
MPS
AND( %I1.3
OR %M0
)
ST %Q2.0
MPP
AND %M1
ST %Q2.1
MRD
AND %I1.4
ST %Q2.2
MPP
AND %M10
ST %Q2.3

136 TLXDRPL7xx
Language instruction list

Principles of programming predefined function blocks

Generalities Automation function blocks can be programmed in 2 ways


different:
with specific instructions for each functional block (e.g., CU %Ci), this way
is the simplest and most direct,
with block structuring instructions BLK, OUT_BLK, END_BLK.

Principle of The instructions control the inputs of the blocks (e.g., CU). The outputs are accessible.
programming in the form of bits (e.g.: %C8.D).
direct
Example:
This example illustrates the direct programming of a function block counter.

Treatment
some entries

Treatment
outings

TLX DR PL7 xx 137


Language list of instructions

Principle of This type of programming uses a sequence of instructions framed by the


programming instructions :
structured BLKindique the beginning of the block
OUT_BLK allows you to directly connect the outputs of the block
END_BLKindique the end of the block

Example:
This example illustrates the structured programming of a function block counter.

BLK 8
LD %I1.1 Treatment
R entrances
LDN %I1.2
ANDN %M0
See you
OUT_BLK Treatment
LDD outings
ST %Q2.0
END_BLK

Note: This principle of structured programming requires the instructions


supplementary BLK, OUT_BLK and END_BLK request memory volumes
superior to direct programming. It should however be used, if
you want to maintain similarity with reversible programs for nano-
automates TSX 07.

138 TLXDRPL7xx
Language instruction list

Execution rules of a program list of instructions

Prince The execution of a program list of instructions is done sequentially.


instruction by instruction.

The first instruction in a sequence of instructions must always be either a


LD is an unconditional instruction (e.g., JMP).

Each instruction (except for the unconditional instructions) uses the


boolean result of the previous instruction.

Example 1 The following program describes the complete execution of a sentence.


LD %I1.1 résultat = état du bit %I1.1
AND %M0 result = AND of the previous boolean result and the status of the bit %M0
OR %M10 result = OR of the previous boolean result and the state of the bit %M10
ST %Q2.0 %Q2.0 takes the state of the previous boolean result

Example 2 The parentheses allow for modifying the order of consideration of the results.
booleans :
LD %I1.1 résultat = état du bit %I1.1
AND %M0 result = AND the previous boolean result and the state of bit %M0
OR( %M10 result = state of the bit %M10
AND %I1.2 result = AND of the previous boolean result and the state of bit %M10
)
ST %Q2.0 %Q2.0 takes the state of the previous boolean result

TLX DR PL7 xx 139


Language instruction list

Example 3 The sequencing of instructions can be altered by jump instructions.


call for sub-program.
! LD %M0
JMPC %L10
! LD %I1.1
AND %M10 Jump to label %L10 if %M0=1
ST %Q2.0
! %L10:
LD %I1.3
AND %M20
......

140 TLXDRPL7xx
Structured literal language

Presentation

Subject of this This chapter describes the programming rules in structured literal language.
chapter

Content of this This chapter contains the following topics:


chapter
Subject Page
Presentation of the structured literal language 142
Structure of a program in structured literal language 143
Etiquette of a phrase in structured literal language 144
Commentary on a sentence in structured literal language 145
Instructions on bits objects 146
Arithmetic and logical instructions 147
Instructions on Arrays and Strings 149
Instructions for digital conversions 152
Instructions on program and specific instructions 153
Conditional control structure IF...THEN 155
Conditional control structure WHILE...END_WHILE 157
Conditional control structure REPEAT...END_REPEAT 158
Conditional control structure FOR...END_FOR 159
Loop exit instruction EXIT 160
Rules for executing a structured literal program 161

TLX DR PL7 xx 141


Structured literal language

Presentation of the structured literal language

Generalities Structured literal language is an advanced algorithmic type language.


adapted framework for programming complex arithmetic functions,
array manipulations and message management.

It allows the creation of programs by writing lines of code.


composed of alphanumeric characters.

Limit This language is usable with the PL7 Micro, PL7 Junior, and PL7 Pro software on the
of use automates Premium and Micro.
In the PL7 Pro version, this language allows the creation of user-defined function blocks.
DFB on the Premium automata.

Illustration of a The following illustration presents a program in the structured language PL7.
program
! (* Search for the first non-zero element in a
table of 32 words, determination of its value
(%MW10), of its rank (%MW11). This research
is done if %M0 is at 1, %M1 is set to 1 if
a non-null element exists, otherwise it is set to 0*)

IF %M0 THEN
FOR %MW99:=0 TO 31 DO
IF %MW100[%MW99]<>0 THEN
%MW10:=%MW100[%MW99];
%MW11:=%MW99;
%M1:=TRUE;
EXIT; (*Sortie de la boucle*)
ELSE
%M1:=FALSE;
END_IF;
END_FOR;
ELSE
%M1:=FALSE;
END_IF;

142 TLXDRPL7xx
Structured literal language

Structure of a program in structured literal language

Generalities A section of the literal program is organized into sentences.


A literal phrase is equivalent to a network of contacts in contact language.

Example of The following illustration presents a sentence in structured language PL7.


phrase
1 ! (Drying in progress) 2
SET %M0;
%MW4:=%MW2 + %MW9; 3
(*pressure calculation*)
%MF12:=SQRT (%MF14);

Description Each sentence begins with an exclamation point (automatically generated),


of a sentence it includes the following elements.
Marker Element Function
1 Etiquette Identify a sentence.
2 Comment provides a sentence.
3 Instructions one or more instructions separated by ";".

Note: Each of these elements is optional, meaning that it is possible to have


une phrase vide, une phrase constituée uniquement de commentaires ou
only a label.

TLX DR PL7 xx 143


Structured literal language

Etiquette of a sentence in structured literal language

Role The label allows you to locate a sentence within a program entity.
(main program, subprogram, ...). It is optional.

Syntax This label has the following syntax: %Li: with i ranging from 0 to 999. It is
position at the beginning of a sentence.

Illustration The following program illustrates the use of a label.

! %L20 : Etiquette
(Drying wait)
SET %M0;
%MW4:=%MW2 + %MW9;
(*pressure calculation*)
%MF12:=SQRT (%MF14);

Rules A single label can only be assigned to one sentence within a


same program entity.

It is necessary to label a sentence in order to allow a connection afterwards.


program jump.

The order of the label markers is arbitrary; it is the order of entry of


phrases that are taken into account by the system during scanning.

144 TLXDRPL7xx
Structured literal language

Commentary on a sentence in structured literal language

Role The comment facilitates the interpretation of a sentence to which it is attached. It is


optional.

Syntax The comment can be integrated anywhere in the sentence and the number of
comments per sentence are not limited.

A comment is framed on either side by the characters (* and *).

Illustration The illustration below identifies the position of the comment in a sentence.

! Drying waiting
SET %M0;
Comments
%MW4:=%MW2 + %MW9;
(*pressure calculation*)
%MF12:=SQRT (%MF14);

Rules All characters are allowed in a comment.


The number of characters is limited to 256 per comment.
Nested comments are prohibited.
A comment can span multiple lines.
Comments are stored in the system and are accessible to everyone.
moment by the user. As such, they consume program memory.

TLX DR PL7 xx 145


Structured literal language

Instructions on bit objects

Instructions on The following instructions apply to bit objects.


bits
Designation Function
:= Bit assignment
OR OR boolean
AND AND boolean
XOR Exclusive OR boolean
NOT Inversion
RE Front post
FE Front descendant
SET Set to 1
RESET Reset

Instructions on The following instructions apply to bit array type objects.


bitmaps
Designation Function
Tableau := Tableau Affection between two tables
Tableau := Mot Assignment of a word to a table
Word := Table Assignment of an array to a word
Tableau := Double word Assignment of a double word to a table
Double word := Table Assignment of an array to a double word
COPY_BIT Copy of a bit array into a bit array
AND_ARX AND between two tables
OR_ARX OR between two tables
XOR_ARX Exclusive OR between two arrays
NOT_ARX Negation on a table
BIT_W Copy of a bit array into a word array
BIT_D Copy of a bit array into a double word array
W_BIT Copy of a word array into a bit array
D_BIT Copy of a double word array into a bit array
LENGTH_ARX Calculation of the length of an array in number of elements

146 TLXDRPL7xx
Structured literal language

Instructions arithmétiques et logiques

Arithmetic The following instructions apply to word and double word objects.
whole on words
Designation Function
and doubles words
+, -, *, / Addition, Soustraction, Multiplication, Division entière
REM Remainder of the integer division

SQRT Integer square root


ABS Absolute value
INC Increment
DEC Decrementing

Arithmetic on The following instructions apply to floating objects.


floating
Designation Function
+, -, *, / Addition, Soustraction, Multiplication, Division
SQRT Square root
ABS Absolute value
TRUNC Whole part
LOG Base 10 logarithm
LN Natural logarithm
EXP Natural exponential
EXPT Exponentiation of a real number by a real number

COS Cosine of a value in radians


SIN Sine of a value in radians
TAN Tangent of a value in radians
ACOS Arc cosine (result between 0 and 2π)
ASIN Arcsine (result between -π/2 and +π/2)
ATAN Arc tangent (result between -π/2 and +π/2)
DEG_TO_RAD Conversion degrees to radians
RAD_TO_DEG Conversion from radians to degrees

TLX DR PL7 xx 147


Structured literal language

Instructions The following instructions apply to word and double word objects.
logics on
Designation Function
words and doubles
words AND ET logic
OR OU logic
XOR Exclusive OR logic
NOT Logical complement
SHL Logical left shift
SHR Logical right shift
ROL Logical circular shift to the left
ROR Logical circular shift to the right

Comparisons The following instructions apply to word objects, double words and
digital on floating.
words, doubles
Designation Function
words and floats
< Strictly less than
> Strictly greater than
<= Less than or equal to
>= Greater than or equal to

= Equal to
<> Different from

148 TLXDRPL7xx
Structured literal language

Instructions on arrays and strings

Instructions on The following instructions apply to word and double word tables.
word boards
Designation Function
and double words
Tableau := Tableau Allocation between two tables
Table: Word Initialization of an array
+, -, *, /, REM Arithmetic operations between arrays
+, -, *, /, REM Arithmetic operations between expressions and arrays
SUM Summation of the elements of an array
EQUAL Comparison of two tables
NOT Logical complement of a table
AND, OR, XOR Logical operations between two arrays
AND, OR, XOR Logical operations between expressions and arrays
FIND_EQW, FIND_EQD Search for the first element equal to a value
FIND_GTW, FIND_GTD Search for the first element greater than a value
FIND_LTW, FIND_LTD Search for the first element less than a value
MAX_ARW, MAX_ARD Searching for the maximum value in an array
MIN_ARW, MIN_ARD Search for the minimum value in an array
OCCUR_ARW, OCCUR_ARD Number of occurrences of a value in an array
SORT_ARW, SORT_ARD Sort in ascending or descending order of an array
ROL_ARW, ROL_ARD Left circular shift of an array
ROR_ARW, ROR_ARD Right circular shift of an array
FIND_EQWP, FIND_EQDP Search for the first element equal to a value from
a rank
LENGTH_ARW, LENGTH_ARD Calcul de longueur d'un tableau

TLX DR PL7 xx 149


Structured literal language

Instructions on The following instructions apply to arrays of floats.


tableaux de
Designation Function
floating
Tableau := Tableau Affection between two tables
Floating Initialization of an array
SUM_ARR Summation of the elements of an array
EQUAL_ARR Comparison of two tables
FIND_EQR Search for the first element equal to a value
FIND_GTR Search for the first element greater than a value
FIND_LTR Search for the first element less than a value
MAX_ARR Searching for the maximum value in an array
MIN_ARR Search for the minimum value in an array
OCCUR_ARR Number of occurrences of a value in an array
SORT_ARR Sort in ascending or descending order of an array
ROL_ARR Circular left shift of an array
ROR_ARR Circular shift to the right of an array
LENGTH_ARR Calculation of the length of an array

150 TLXDRPL7xx
Structured literal language

Instructions on The following instructions apply to strings.


chains of
Designation Function
characters
STRING_TO_INT ASCII to Binary Conversion (simple word format)
STRING_TO_DINT ASCII to Binary Conversion (double word format)
INT_TO_STRING Binary Conversion in simple word format ASCII
DINT_TO_STRING Binary Conversion to ASCII (double format)
STRING_TO_REAL Conversion ASCII to Float
REAL_TO_STRING Floating Point in ASCII
<, >, <=, >=, =, <> Alphanumeric comparison
FIND Position of a substring
EQUAL_STR Position of the first different character
LEN Length of a string
MID Extraction of a substring
INSERT Insertion of a substring
DELETE Deletion of a substring
CONCAT Concatenation of two strings
REPLACE Replacement of a string
LEFT Start of string
RIGHT End of the chain

TLX DR PL7 xx 151


Structured literal language

Instructions for digital conversions

Instructions from The instructions perform conversions of bits, words, double words, and floats.
conversions
Designation Function
digital
BCD_TO_INT BCD to Binary conversion
INT_TO_BCD Binary to BCD Conversion
GRAY_TO_INT Conversion Gray to Binary
INT_TO_REAL Conversion of a simple integer format to floating point

DINT_TO_REAL Conversion of a double integer format to float


REAL_TO_INT Conversion of a floating point to a simple integer format

REAL_TO_DINT Conversion of a floating point to double integer format

DBCD_TO_DINT Conversion of a 32-bit BCD number to a 32-bit integer


DINT_TO_DBCD Conversion of a 32-bit integer to a 32-bit BCD number
DBCD_TO_INT Conversion of a 32-bit BCD number to a 16-bit integer
INT_TO_DBCD Conversion of a 16-bit integer to a 32-bit BCD number
LW Extraction of the low-weight word from a double word
HW Extraction of the strong weight word from a double word

CONCATW Concatenation of 2 simple words

152 TLXDRPL7xx
Structured literal language

Program instructions and specific instructions

Instructions on The following instructions do not act on language objects but on


program program schedule..
Designation Function
STOP Stopping the execution of the program
JUMP Jump to a label
SRi Subroutine call
RETURN Return from subprogram
MASKET Masking events in the automaton
UNMASKED Unmasking events in the automaton

Instructions from The following instructions perform operations on dates, times, and on
time management durations..
Designation Function
SCHEDULE Hordator function
RRTC Reading date system
WRTC Update of the system date
PTC Date of ruling and stop code
ADD_TOD Adding a duration to a time of day
ADD_DT Adding a duration to a date and time
DELTA_TOD Measure of deviation between hours of the day

DELTA_D Difference measurement between dates (without time)

DELTA_DT Measure of difference between dates (with time)

SUB_TOD Time travel at the hour


SUB_DT Time travel to date and time
DAY_OF_WEEK Current day of the week reading
TRANS_TIME Conversion duration into date

DATE_TO_STRING Conversion of a date to a string


TOD_TO_STRING Conversion of an hour into a string
DT_TO_STRING Conversion of a complete date into a string
TIME_TO_STRING Conversion of a duration into a string

TLX DR PL7 xx 153


Structured literal language

Instructions The following instructions are specific instructions of the Orpheus language.
Orpheus
Designation Function
WSHL_RBIT, DSHL_RBIT Left shift on word with bit recovery
shifted
WSHR_RBIT, DSHR_RBIT Right shift on word with sign extension and
recovery of shifted bits
WSHRZ_C, DSHRZ_C Right shift on word with filling by 0 and
recovery of shifted bits
SCOUNT Counting/decoupling with signaling of
exceeding
ROLW, ROLD Left circular shift
RORW, RORD Circular right shift

Instructions for These instructions are timing functions intended to be used for
timing the programming of the DFB code..
Designation Function
FTON Triggering delay
FTOF Timing on triggering
FTP Pulse timing
FPULSOR Square wave generator

154 TLXDRPL7xx
Structured literal language

Conditional control structure IF...THEN

Role This control structure performs one or more actions if a condition is true.
In its general form, the conditions can be multiple.

Simple form In its simple form, the control structure has the syntax and the functioning
next.
Syntax Operation

Beginning ofIF

IF condition THEN
unverified
Condition
actions;
verified
END_IF; Action

End ofIF

Example:

! (IF conditional action (simple form))


IF %M0 AND %M12 THEN
RESET %M0;
INC %MW4;
%MW10:=%MW8+%MW9;
END_IF;

TLX DR PL7 xx 155


Structured literal language

General form In its general form, the control structure has the syntax and operation
next.
Syntax Operation

Beginning ofIF
IF condition 1 THEN

actions1 verified
Condition 1

ELSE IF condition 2 THEN unverified


Actions 1
verified
actions2; Condition 2
not verified
ELSE Actions 2 Actions 3

actions3;
End ofIF
END_IF;

Example:

! (IF conditional action (simple form))


IF %M0 AND %M1 THEN
%MW5:=%MW3+%MW4;
SET %M10;
ELSEIF M0 OR M1 THEN
%MW5:=%MW3-%MW4;
SET %M11;
ELSE
RESET %M10;
RESET %M11;
END_IF;

Rule of The conditions can be multiple.


programming Each action represents a list of instructions.
Several IF control structures can be nested.
The number of ELSIF is unlimited.
There is at most one part ELSE

156 TLXDRPL7xx
Structured literal language

Conditional control structure WHILE...END_WHILE

Role This control structure performs a repetitive action as long as a condition is met.
verified.

Description The control structure has the following syntax and operation.
Syntax Operation
Start ofWHILE
WHILE condition DO

action ; unverified
Condition

END_WHILE; verified
Action

End ofWHILE

Example:

! (*Iterative conditional action WHILE*)


WHILE MW4 < 12 DO
INC %MW4;
SET %M25[%MW4];
END_WHILE;

Rule of The condition can be multiple.


programming The action represents a list of instructions.
The condition test is performed before executing the action. If during the
first condition assessment, its value is false, so the action is not
never executed
Several WHILE control structures can be nested.

Note: The EXIT instruction (See Role, p. 160) allows stopping the execution
from the loop and to continue with the instruction following the END_WHILE.

TLX DR PL7 xx 157


Structured literal language

Conditional control structure REPEAT...END_REPEAT

Role This control structure performs a repetitive action until a condition is met.
is verified.

Description The control structure has the following syntax and functioning.
Syntax Operation
Start ofREPEAT
REPEAT

action; Action

UNTILconditionEND_REPEAT; Condition
unverified
verified
End ofREPEAT

Example:

! (*Conditional iterative action REPEAT*)


REPEAT
INC %MW4;
SET %M25[%MW4];
UNTIL%MW4>12END_REPEAT;

Rule of The condition can be multiple.


programming The action represents a list of instructions.
The condition test is performed after the action has been executed. If during the
first evaluation of the condition, its value is false, then the action is
executed once.
Several REPEAT control structures can be nested.

Note: The EXIT instruction (See Role, p. 160) allows to stop the execution.
from the loop and continue with the instruction following END_REPEAT.

158 TLXDRPL7xx
Structured literal language

Conditional control structure FOR...END_FOR

Role This control structure performs a process a certain number of times in


incrementing an index by 1 in each loop.

Description The control structure has the following syntax and functioning.
Syntax Operation
Start ofFOR
FOR index := initial value TO
final value DO Valeur initiale --> Indice

action;
Index > verified
END_FOR; Final value

unverified
Action
End ofFOR
Index +1 --> Index

Example:

! (REPEATED Action FOR)


FOR %MW4 = 0 TO %MW23 + 12 DO
SET %M25[%MW4];
END_FOR;

Rule of When the index is strictly greater than the final value, the execution stops.
programming continues with the instruction following END_FOR.
The increment of the index is done automatically and is therefore not to be
your charge.
The action represents a list of instructions.
The initial value and the final value are necessarily numerical expressions.
of type word.
The index must be an object of type word that is writable.
Several FOR control structures can be nested.

Note: The EXIT instruction (See Role, p. 160) allows stopping the execution.
from the loop and continue on the instruction following the END_FOR.

TLX DR PL7 xx 159


Structured literal language

Loop exit instruction EXIT

Role This instruction allows to stop the execution of the loop and to continue on
the instruction following the loop end instruction.

Rule of This instruction can only be used in the actions of one of the 3 WHILE loops.
programming REPEAT you FOR.
This instruction is linked to the nearest encompassing loop, that is to say
that it does not stop the execution of all the loops that encompass it.

Example In this example, the EXIT instruction allows to stop the REPEAT loop but in
no case for the WHILE loop.

! (Loop exit instruction EXIT)


WHILE %MW1<124 DO
%MW2:=0;
%MW3:=%MW100[%MW1];
REPEAT
%MW500[%MW2]:=%MW3+%MW500[%MW2];
IF(%MW500[%MW2]>32700) THEN
EXIT;
END_IF;
INC %MW2;
UNTIL %MW2>25 END_REPEAT;
INC %MW1;
END_WHILE;

160 TLXDRPL7xx
Structured literal language

Rules for executing a structured literal program

Generalities The execution of a literal program is done sequentially, instruction by instruction.


instructions while respecting control structures.

In the case of arithmetic or boolean expressions composed of several


operators, priority rules are defined among the different operators.

Priority rule The table below gives the priority for evaluating an expression from the most
of operators priority or less priority.
Operator Symbol Priorité
Parentheses expression Stronger
Logical complement NOT
Inversion NOT
on operand -
+ on operand +
Multiplication *
Division /
Module REM
Addition +
Subtraction -
Comparisons <,>,<=,>=
Equality comparison =
Comparison inequality <>
ET logic AND
AND boolean AND
Exclusive logical OU XOR
Exclusive OR boolean XOR
OR logic OR Less strong
OR boolean OR

Note: When there is a conflict between two operators of the same level of priority, it is
the first operator that prevails (the evaluation is done from left to right).

TLX DR PL7 xx 161


Structured literal language

Example 1 In the following example, the NO Test applied on %MW3 then the result is
multiplied by 25. The sum of %MW10 and %MW12 is then calculated, and then the AND
logic between the result of multiplication and addition.
NOT %MW3 * 25 AND %MW10 + %MW12

Exemple 2 In this example, the multiplication of %MW34 by 2 is first performed, then the
result is used to perform the modulo.
%MW34 * 2 REM 6

Use of The parentheses are used to modify the order of evaluation of operators.
parentheses to allow, for example, to prioritize an addition over a multiplication.

You can nest parentheses and the level of nesting is not limited.

Parentheses can also be used to avoid any misunderstanding.


interpretation of the program.

Example 1 In this example, addition is performed first and then multiplication:

(%MW10+%MW11)*%MW12

Example 2 This example shows that parentheses can be used to avoid any
misinterpretation of the program.

NOT %MW2 <> %MW4 + %MW6

Using the rules of operator precedence, the interpretation is as follows:

((NOT %MW2) <> (%MW4 + %MW6))

But you may think that the operation is as follows:

NOT (%MW2 <> (%MW4 + %MW6))

The parentheses help clarify the program.

162 TLXDRPL7xx
Structured Literal Language

Conversions Implicit conversions concern words and double words.


implicit The operators you use in arithmetic expressions, in the
comparisons and the assignment operator perform these implicit conversions (which do not
are therefore not the user's responsibility).

For an instruction of the form: <operand 1> <operator> <operand 2>, the cases
possible conversions are:
Operand 1 Operand 2 Conversion Conversion Operation
of type of type Operand 1 Operand 2 in the type
Word Word No No Word
Word Double word Double motive No Double motive
Double word Word No Double word Double word
Double word Double word No No Double word

For an assignment of the form <left operand> := <right operand>, it is


the left operand which imposes the expected type to perform the operation, which
means that the right operand must be converted if necessary according to the table:
Operand type Operand type Conversion
left right right operand
Motive Word No
Word Double word Word
Double word Word Double word
Double word Double word No

Note: Any operation between two immediate values is performed in double.


length.

TLX DR PL7 xx 163


Chapter 3

The GRAFCET or GRAph


Command Function
Śtep/Transition or Sequential
Function Chart

Norme internationale : [3] et [2], Norme fran¸caise : [1]

In 1975, the Logical Systems working group of AFCET decided,


under the impetus of Michel BLANCHARD who was its facilitator,
Create a commission for the standardization of the representation of the specifications.
of a logical automaticity.
The academics and industry professionals gathered in this group then
This is a tough problem: trying to define a simple, accepted formalism.
by all, adapted to the representation of the sequential evolutions of a system,
intelligible both to the designers and the operators, and providing po-
potentially facilities for transitioning to an implementation, based on material and/or
software of the automation as specified. At the beginning, the work consisted of drawing up
being a state of the art of the different approaches to modeling behavior
statement of such automatons. Three major classes of modeling tools
were thus recorded:
the organizational charts;
– representations of logical systems with simultaneous evolutions (of which
Petri Nets) [8] ;
– the tools derived from state graphs.
The analysis of the advantages and disadvantages of these tools led to it in 1977,
to the definition of GRAFCET, so named to mark both the origin
come from this new tool of modeling GRAFCET and its identity GRAPH

20
CHAPTER 3. THE GRAFCET 21

Command Functional Stages–Transitions). The results of these tr-


Vaux made it the subject, on one hand, of an internal report to the AFCET, dated August
1977, and on the other hand from an official publication in the journal "Automatique"
and Industrial Computing" in December 1977, a date that the community
considered today as corresponding to the actual date of birth
the GRAFCET.” excerpt from ”Générations Grafcet” by Pascal LHOSTE, 1
Animateur du Groupe ”GRAFCET”, Novembre 1997.
The GRAFCET allows for the establishment of descriptions of the function.
tion and the behavior of control systems by establishing a
independent graphical representation of the technological realization...
(norm [3]).
The GRAFCET is intended to represent logical automatons.
discrete), that is to say discrete event systems in which the
Informations are of boolean type or can be reduced to it (for example.
the comparison of a temperature with a threshold). The GRAFCET is used
Generally to specify and design the desired behavior of the par-
command of a system, but it can also be used to specify
the expected behavior of the operational part or indeed of the entire system
of order.

3.1 Purpose of GRAFCET


When the word GRAFCET (in capital letters) is used, it refers to
´ When the word grafcet is written in lowercase, it means
the modeling tool.
So reference a model obtained using the GRAFCET rules. Presented
in the form of a flowchart, its purpose is to describe the operation of
the automation controlling the process. It is primarily a graphical tool,
powerful, directly usable, as it is also a language for the most part
existing APIs on the market.
It includes:
steps associated with actions;
associated transitions with receptivities;
oriented links connecting steps and transitions.

1 http ://[Link]–[Link]/grafcet/groupe/gen g7/[Link]


CHAPTER 3. THE GRAFCET 22

Command: two simultaneous buttons,


g d
it is a security for
the operator.
AU Security: high resting position,
h
emergency stop
m stop if there is relaxation of
b two buttons of
order.

Manuel : interview

Operation:

repos: high position (and h at 1)

action on g and d?

descent punch

up to b?

punch ascent

until h?

repos

Initial conditions
1
punch h = 1

g and d to 1
if g is equal to 1

descent
Steps 2 Actions

b to 1
if g is equal to 1

ascent
3

h to 1

Directed liaison

Fig. 3.1 - Example of the stamping press


CHAPTER 3. THE GRAFCET 23

Attention! This grafcet is not complete, it is missing the emergency stop and the
manual command. It should be noted that:
depending on the sensors, the transition conditions change (open or
closed at rest;
Depending on the actuators, the actions are different;
the operator security is carried out by an action, if the condition g and d
.uert si1

3.2 Description of GRAFCET


3.2.1 The steps
The step symbolizes a state or a part of the state of the system. The step
has two possible states: active represented by a token in the step or
inactive. The step i, numerically identified, thus has a state variable,
stage variable XI This variable is a boolean variable with a value of
1 if the step is active, 0 otherwise.

´
Initial step
It represents the system at rest initial state. It is
activated at the beginning of the cycle.

´
Step
Each step is associated with one or more actions, it is
to give an order to the operational part or to others
grafcets.

3.2.2 The transitions

i A transition indicates the possibility of evolution that


exists between two stages and therefore the succession of two
activities in the operational part. During its fran-
Tr a
i It will allow the evolution of the system.
each transition is associated with a receptivity that expresses
i+1 the necessary condition to move from one stage to another.
CHAPTER 3. THE GRAFCET 24

This condition is written in the form of a logical proposition, a function-


combinatorial calculation based on:
input variables representing the state of the sensors, push buttons
evenings, etc.,
the time,
– of the current state of the steps of the grafcet (the Xi ).
If the receptivity is not specified, then it means that it is always true.
Rule: if step i is inactive, XI= 0, the transition Triis without ef-
fate. However, beware, validating a transition for no reason can have
serious consequences, disrupting the cycle in some cases!

i If step i is active, Xi= 1, the transition a is validated,


so:
a If a = 0, then wait
If a = 1, then step i is invalidated XI= 0 and the step
next i+1 is activated, X i+11.
i+1

3.2.3 Directed connections


A directed link is the connection that ties a step to a transition or the in-
Verse. By convention, stages and transitions are placed along an axis.
The directed links are simple vertical lines when the connection
is oriented from top to bottom, and is equipped with an arrow pointing upwards when
the connection is oriented upwards.

3.2.4 Notation of inputs/outputs


During the establishment of the specification grafcet (level 1 grafcet),
we use explicit names for the inputs of the modeled system as well as
for the outputs. When transitioning to the realization grafcet, we rather use
logical names: Eifor the inputs and Sifor outings.
CHAPTER 3. THE GRAFCET 25

3.2.5 The actions


The action associated with the step can be of 3 types: continuous, conditional
you memory

Actions continues

weather

Order A X:i active step


i

A: action (exit at 1)

The outputs corresponding to order A are set to 1 as long as the step


the associated is active. When the step becomes inactive, the output(s) are
mises`a 0.

Conditional actions
A conditional action is only executed if the associated step is active.
and if the associated condition is true. They can be broken down into 3 cases.
individuals:

Simple conditional action: Type C

weather

Condition X
i
i C Order A Condition.

A = Cond . X
i
CHAPTER 3. THE GRAFCET 26

Delayed action: Type D (delay)

weather

5s 5s
X
i
i The Order A D

A = t/X /D . X
i i

D is the duration of the delay, that is to say the time taken to switch to 1.
after XIlet it be passed to 1.

Time-limited action: Type L (limited)

weather

2s 2s
X
i
i L Order A L

A = t/X /L . X
i i

Memorable actions

n Start Order A theyps

X
n
X
m
m R Stop Order A
A
CHAPTER 3. THE GRAFCET 27

One can thus give the equation of order A as a function of the states of
m
[Link],nsitocndieblipso,pests

3.2.6 The receptivities


A receptivity is associated with each transition. It is a boolean function.
calculated from the graph inputs, states of the steps or the tem-
porisations. A receptivity is thus written using the AND operators.
OR, NO and front. The rising or falling front of a variable allows
to position in time the change in value of this sensor. We note them
respectivementEetE. Les ¯ fronts ne sont`a 1 que durant un d´elai d, qui
corresponds to the time taken to account for the event, that is to say the time
crossing a transition.

Sensor C1

C1

C1

weather

3.2.7 The delays


The timers used in GRAFCET refer to the variables
of steps (Xn ) A timing variable Snis a boolean variable whose
the evaluation mode takes into account time. It can be written
in general waysn=t1 /Xn /t2ou`
–E ndesign the input variable,
–t 1designates the delay in changing the logical state 0→1
of the input variable En Sit1= 0, then the timing is written
Sn=Xn /t2 .
–t 2designates the delay brought to the change of logical state 1→0
from the input variable En . Sit2= 0, then the timing is written
Sn=t1 /Xn .
CHAPTER 3. THE GRAFCET 28

En Sn
t1 t2

En
Weather
Sn

t1 t2

VariableXn(the associated step) must be active for a period of time


greater than or equal to1for whatn may be evaluated.

3.3 The evolution rules of GRAFCET


Rule No. 1 - Initial condition
At the initial moment, only the initial steps are active.

Rule No. 2 – Crossing a transition


For a transition to be validated, all its upstream steps must be completed.
(immediately preceding related to this transition) are active. The fran-
the change of a transition occurs when the transition is validated, AND
only if the associated receptivity is true.

´
Rule N°3 – Evolution of active stages
Crossing a transition necessarily leads to this order
the deactivation of all these upstream steps and the activation of its downstream steps.

Rule No. 4 – Simultaneous Crossing


All simultaneously traversable transitions at a given moment are
simultaneously crossed.

Rule N˚5 – Activation Conflict


If a step must be simultaneously deactivated by crossing a
transition available, and activated by crossing an upstream transition, then
she stays active. This way we avoid transitional orders (which are detrimental to
undesired proceedings.
CHAPTER 3. THE GRAFCET 29

Duration of crossing a transition or activity of a


pets
The duration of crossing a transition is theoretically considered.
as small as we want, but not null, even if, in practice, this
duration may be imposed by the technology used for the realization of the
Tomatism. Similarly, the duration of activity of a stage cannot be zero.
mais suffisante, si besoin est, pour effectuer une action fugitive`a la vitesse
from the order part.

3.4 Basic structures


3.4.1 Step Jump and Sequence Resumption

2 20

a b a b g

3 21
h i
c hi

4 22

Leapfrog Takeover
sequence
Structured literal language

Loop exit instruction EXIT

Role This instruction allows to stop the execution of the loop and to continue on
the instruction following the loop end instruction.

Rule of This instruction can only be used in the actions of one of the 3 WHILE loops.
programming
This instruction is linked to the nearest encompassing loop, that is to say
that it does not stop the execution of all the loops that encompass it.

Example In this example, the EXIT instruction allows to stop the REPEAT loop but in
no case for the WHILE loop.

160 TLXDRPL7xx
CHAPTER 3. THE GRAFCET 31

1 After crossing A, we...


Divergence ET we thus have two simultaneous activities
a or you are talking.

Synchronization allows to wait


2 the end of several activities taking place
in parallel, to continue with a
alone. We then speak of synchronization-
b 4
since, the activity of step 4
which ends before that of 3 must
3 wait and synchronize with her.
Synchronization
Thus, for the understanding of
GRAFCET, a step referred to as syn-
c synchronization can be added in the
the fastest branch of divergence.
5

3.4.4 Sub-grafcet or repeated sequence


In an automated system, certain sequences can return in a way
repetitive in the cycle. To avoid repeating these same actions, it is
possible to use a subprogram. It is written in the form of a
independent grafcet, connected to the main grafcet.
CHAPTER 3. THE GRAFCET 32

4 S 30 30

X 32 X4

5 31

6 32 End of the slave

X4
GRAFCET GRAFCET
Master Slave

At the start, the initial steps of the two Grafcets are activated. In the
Master, the activation of step 4, X4= 1, will activate the execution of the grafcet
slave by validating the first transition, and trigger the
receptivity X32In the slave, the activation of step 32, X32= 1, provoke
the emergence of receptivity X in the master32who authorizes the unfolding
from the main program, by devalidating X4 This step 32 'hands over to
master
There is another method to return control to the master grafcet, which
by the way is the most used. It is illustrated below and uses a tem-
activation to keep variable X32 at 1 for 1 second in order to make the
hand to master.
CHAPTER 3. THE GRAFCET 33

4 S 30 30

X 32 X4

5 31

GRAFCET 32 X32 t = 1s X12


Master
X12

GRAFCET
Slave

Slave grafcets are very useful for repeated sequences, stop


emergency, manual control. They allow to control several to-
automatism on the same API.

3.4.5 Conflict management


Depending on the chosen programming structure, and for automatons
Given, there are conflicting situations that can have consequences.
graves. How to remedy this?

Switching

If the switching conditions are all validated simultaneously, the automatic


hundred is facing a precedence problem, which is resolved by doubling one of the
switching conditions (see 3.4.2).

Parallelism where 3 types of conflicts can occur

the simultaneous unfolding of sequences with common waiting. This


occurs if the durations of the actions of the simultaneous sequences are
different! We then add a synchronization step without action.
This is what is called duration synchronization.
CHAPTER 3. THE GRAFCET 34

- the progress of several simultaneous sequences. A sequence has


the unfolding is dependent on the progress of another sequence.
The user then needs a tempo offset synchronization.
rel that can occur at the level of a transition or a slave grafcet
active according to synchronization constraints.
– the memorization of the availability of a part of the machine. A sequence
Particular is only used alternatively by several sequences. It
One must then make a choice of priority or use waiting steps if
the common sequence is already in use.
Note: on some APIs, convergence in ET is followed by a trans-
a position that is always validated at 1. To solve this, we therefore replace:

Synchronization step
without action
by
a 1

3.5 GRAFCET levels 1 and 2


3.5.1 Level 1 GRAFCET from the perspective of the
operative part
It is generally the description of the automation alone, that is to say the en-
linking of actions and transitions enabling control of the process.
When approaching the analysis and description of a system, one does not know
which technology will be chosen for the actuators, sensors, and communication
We will write in this GRAFCET the actions and events in terms.
generals.

3.5.2 GRAFCET level 2 from the perspective of the


order party
This is the complete description of the automation that takes into account everything.
the constraints of the process. The key points of the level 2 GRAFCET
are:
CHAPTER 3. THE GRAFCET 35

the simplification of GRAFCET level 1, that is to say the parallelisms


and the repeated sequences;

– the operating modes of the automation, that is to say the taking


taking into account automatic walking, cycle walking and the
manual operation useful for maintenance and settings;

emergency cuts leading to power shutdown, the use


of a variable AU (if emergency stop AU = 1) to be added in the conditions
logical conditions for the different actions, a disengagement procedure
if AU = 0 ;

– the operator securities, that is to say the implementation of protections,


two-handed commands, which must be activated for the start of
cycle and during the cycle;

– the security procedures, that is to say the stopping of the automation if a condition
An abnormal detection is made, for example, the detection of an incorrect object.
right or poorly positioned;

– the initial conditions, that is to say the different resting positions (at
departure from the cycle), the state of the food supply and all the tests of-
You need to verify the initial conditions.

The complexity of this task can be great! The GRAFCET of level


2 must be studied with the greatest care. This may eventually lead to
y!rasecnfi sortuatcandasornseshetym
foditnda ,edureocprhetym
fodit
In some cases, one may be led (after study) to seek others
solutions that sequential automation, for example fuzzy logic. These cases
limits are:
– a logical indeterminacy at the level of the procedure;
- an unsuitable logical description;
– a scanning or acquisition cycle duration that is too long;
the difficulty of defining a disengagement sequence for the emergency stop
gence.

Attention !!! In an industrial environment, trial and error can be dange-


grievous or catastrophic: hence the interest in studying the grafcet of
level 2 very detailed !!!
CHAPTER 3. THE GRAFCET 36

3.6 Modes of walking and stopping


We consider an operational part - autonomous control part,
possibly with a malfunctioning operating part, but a part com-
always sends in marching order.

3.6.1 Unique cycle or cycle by cycle

dcy·CI

End of cycle

Here is the GRAFCET type for a single cycle, with the condition of
validation : dcy·CI
- dcy being the starting order given by the operator;
CI represents the variable for the initial conditions.

To this grafcet, we can add:


A control light activated during the initialization step;

1 Seeing if CI
CHAPTER 3. THE GRAFCET 37

An anti-repetition cycle test.

1 1

dcy↑CI dcy·CI

Front detection OU Anti-repetition step


End

n+1
X1
dcy

3.6.2 Cycle by cycle or continuous


There are two solutions to implement this type of grafcet. These two solutions
calls upon the two variables associated with the cycle: dcy for the start of the cycle,
and acy for the stopping of the cycle.

20 1

dcy⋅ acy⋅ CI X21·CI

21 2

acy

This is the end of this cycle that


allows the launch of it
to the right.

End
CHAPTER 3. THE GRAFCET 38

Solution No. 1

20 1

dcy⋅ acy⋅ CI X21·CI

21 2

acy

This is the end of this cycle that


allows the launch of it
to the right.

End

Solution No. 2: a switch allows you to choose between automatic mode


or that cycle by cycle.

3.6.3 Intervention settings and disengagement


Manual transmission

m→ manual
1 a→ car
m

m⋅a a a

11 MAN 12 CAR Cde de A · Security


Cde de B · ...
m a 11 A B C
CHAPTER 3. THE GRAFCET 39

Proceed step by step or stage by stage

i i

e ⋅ (E E+ S) or a waiting step
e⋅ E E e⋅ E E

E/E: variable indicating step-by-step mode i+1


S: continuation

We add, if possible, a transition allowing either to self-select.


a sequence, either to stop at a given step. This is very diff-
easy to implement.
Attention: all these modes present great material danger and
operator!
CHAPTER 3. THE GRAFCET 40

3.6.4 Stops
– Temporary stop
X11

10 n

market X11

11 Valid actions n+1

stop

master grafcet
slave grafcet:
temporary stop

Emergency stop
X31

30 n

AU X31

31 Valid actions n+1

master grafcet
slave grafcet :
emergency stop
CHAPTER 3. THE GRAFCET 41

Emergency stop + defects + commitment

40 Σd = def1 + def2 + ... sum of defects


degtdisengagement
AU⋅ Σd

41 Valid actions

AU Σd

42 Wait 45 In default

degt (AU) degt degt

43 Action 46 Action X40


find yout find yout

44 ? 47 Condition

end end

X40
5. Implementation of the GRAFCET

1. FORMULATION OF GRAFCET

1.1. objective

Let the part of the grafcet represented by the figure on the right. To describe n-1
for the activity of step n, we will use the following notation:
tn-1
Xn= 1 if the step n is active:
Xn= 0 if the step n is inactive, n

The receptivity tn, being a binary variable, has a value:


tn
tn= 0 if the receptivity is false,
tn= 1 if the receptivity is true. n+1

The evolution rules of GRAFCET (see chapter rules) are the starting point of
logical equations.

BUT: Determine the variables involved in


the activity of step n: Xn= f ( ? )

1.2. equation of a step

• 2thrule:

A transition is either validated or not validated. It is validated when all the


the immediately preceding steps are active. It can only be crossed by:
when it is validated,
-AND that the receptivity associated with the transition is TRUE

The translation of this rule gives the Activation Condition of step n:

CAXn= [Link]-1

5. Implementation of GRAFCET, D. DUBOIS Page 1 /12


• 3thrule :

The crossing of a transition triggers the activation of all stages.


immediately following and the deactivation of all steps immediately
previous.

The translation of this rule gives the Deactivation Condition of step n:

CDXn= [Link]= Xn+1

• If the CA and CD of step n are false, step n remains in its state. This is what we
call the memory effect (see sequential logic chapter). That is to say that the state of Xn at
the instant t+δit depends on the previous state of Xn at time t

According to these three previous points, we can therefore write: Xn= f ( CAXn, Xn , CDXn)

It is then possible to write the truth table of the activity of step n: Xn

XnCAXnCDXn Xn (T+δT) Remark


0 0 0 0 The step remains inactive (memory effect)
0 0 1 0 The step remains inactive.
0 1 0 1 Activation of the step
0 1 1 1 Activation and deactivation = activation
1 0 0 1 The step remains active (memory effect)
1 0 1 0 Deactivation of the step
1 1 0 1 The step remains active
1 1 1 1 Activation and deactivation = activation

Karnaugh map associated:

CAXnCDXn
00 01 11 10
Xn
0 0 0 1 1
1 1 0 1 1

Equation of Xn :
X n = CAXn+ CDXn .Xn

or Xn= [Link]−1
+ X−1n .X n +1

5. Implementation of GRAFCET, D. DUBOIS Page 2 /12


1.3 Choice of sequence

6 30 47

a b c

7 31 48

d e
x z

10 20 6

y w f

11 21 7

Divergence in OU Convergence in OU

Step CAXn CDXn Step CAXn CDXn


7 X6 . a X10 + X20 31 X30 . b
X6
10 X7 . x X11 48 X47 . c
20 X7 . z X21 6 X31 . d + X48 . e X7

1.4 Parallel sequences

6 30 47

a b c

7 31 48

x
d

10 20 6

y w f

11 21 7

Start of ET End of ET

Step CAXn CDXn Step CAXn CDXn


7 X6 . a X10 . X20 31 X30 . b
X6
10 X11 48 X47 . c
X7 . x
20 X21 6 X31 . X48 . d X7

5. Implementation of GRAFCET, D. DUBOIS Page 3 /12


1.5 Management of the On/Off modes and emergency stops

Upon initializing the GRAFCET, all steps other than the initial steps are
deactivated. Only the initial steps are activated.

Let the variable Init such that:

• Init = 1initialization of the GRAFCET: ModeSTOP


• Init = 0course of the cycle: ModeMARCH

Let the variables Emergency Stop (AUdur and AUdoux) be such that:

• AUDur = 1 : Deactivation of all steps,


• AUDoux = 1 Deactivation of actions, the remaining steps are active.

Generalization:

• Equation of an initial step i:

i-1
ti-1
i CAXi CDXi Equation of Xi
ti X i−1 .tI−1+ Init X i+1 .Init (
XI= CAX+ CDX.X
i i+ Init.
i AUdur )
i+1

• Equation of a non-initial step i:


i-1
ti-1
CAXi CDXi Equation of Xi
i
tI
X i−1 .tI−1 .Init +
X I+1 .Init X i= (CAX+ CDX.X ).Init .AUdur
i
I
i

i+1

• Equation of actions

3 A A = [Link]

5. Implementation of GRAFCET, D. DUBOIS Page 4 /12


2. IMPLEMENTATION BY CABLING

2.1. Elements of combinatorial logic (logic gates)

Equation of a step:Xn = X n .tn + X n .X


−1n −1 +1

The wiring of a stage is done using 4 logic gates.

Xn-1
&
≥1 Xn
tn-1

Xn + 1
1
&

A GRAFCET step is then represented in the form of a phase module:

Towards the actions associated with step Xn

State of the step ≥1 Towards activation


&
Xn-1 from step Xn+1
&

1
Towards deactivation
State of the step
from step Xn-1
Xn+1

tn-1 Associated transition


at step Xn-1

Phase module of a step

5. Implementation of GRAFCET, D. DUBOIS Page 5 /12


Example: case of a GRAFCET with a single sequence

Each step of the GRAFCET will be wired as described in the phase module.
Previously. An electric sequencer is then made using logic gates.

A B
0

m
Step Step Step
1 A
0 1 2
a
2 B
b b m a

In order to take into account the operating and stopping modes of the GRAFCET, the module of a
The step must include the initialization and emergency stop hard as indicated by the
logical equations of the steps of the previous GRAFCET:

Step equations:

( )
X 0 = X2.b + X 1 .X 0 + Init .AUdur

X1 = (X .m + X .X ).[Link]
0 2 1

X2 = (X .a + X .X ).[Link]
1 0 2

2.2. Elements of sequential logic (RS flip-flops)

R S Qt+1 R Q
0 0 Qt
0 1 1
1 0 0 S
1 1 -

RemarkFor the state S=R=1, the output value of the flip-flop is indeterminate. It
depends only on the manufacturing components. If the RS flip-flop is manufactured
technologically with NOR gates, there will be priority-disable memory and in
the case of implementing RS flip-flops with gates NANDthere will be memory activation
priority (solution chosen to adapt RS toggles to GRAFCET).

5. Implementation of GRAFCET, D. DUBOIS Page 6 /12


2.2.1. Application to GRAFCET:

Theactivation conditiona step is then wired to theSETfrom the balance,


Thedeactivation conditionof a step is wired to theRESETof the seesaw,

CDXn R Q Step Xn

CAXn S

The following wiring does not take emergency stops (Audur & Audoux) into account.

‰ wiring of an initial step:


CAXi = X i−1t.i − 1 + Init
CDXI = X i+.1Init

Qi-1 ti-1
Action associated with
Step Xi
&
≥1 Si Qi Validation of the transition
Init
(vers Si+1)
& Ri Ri-1 condition of
deactivation of the step
previous Xi-1
Init Qi+1

‰ Wiring of a NON-initial stage:


CAXI = X i−1t.i − 1I. nit
CDXi = X I+1 + Init

Init Qi-1 ti-1 Associated action to


Step Xi
& Si Qi
Validation of the transition
(verse Si+1)
≥1 Ri Ri-1 condition of
deactivation of the step
Xi-1
Init Qi+1

5. Implementation of GRAFCET, D. DUBOIS Page 7 /12


2.2.2. Example: GRAFCET with a single sequence:

0
m
1 A
a
2 B
b

Table of activation and deactivation conditions for the steps:

Xn CAXn CDXn
0 X 2.b + Init X 1 . Init
1 X [Link] X2+ Init
2 X 1 .a . Init X 0 + Init

Wiring of GRAFCET:

A B
b m a
&
≥1 S0 Q0 & S1 Q1 & S2 Q2

R0 ≥1 R1 ≥1 R2
&

init

1 init

5. Implementation of GRAFCET, D. DUBOIS Page 8 / 12


3. GRAFCET PROGRAMMING IN A LANGUAGE

3.1. Contact Language (Ladder)

‰ application on TELEMECANIC TSX-17 (PL7-2) automation

• Initial step:

CAXnAudur Xn
S
Init

CDXnInit Xn
R
Audur

• StepNOinitial

CAXnInit AUdur Xn
S
CDXn
Xn
Init R

Durable

• Action associated with the step:

Xn AUdoux Action

5. Implementation of GRAFCET, D. DUBOIS Page 9 / 12


Exercise: Translate the following GRAFCET into Ladder

2 B 5 A
b a
3 C 6 D
c
d1 d2
7 E 9 F
e f

4 8

=1

Table of sales and costs of the stages:

Xi CAXi CDXi
1 +
X4 . X 8Init X2. X [Link]
2 m.
X [Link] X 3 + Init
3 .b.
X2Init X4 + Init
4 X 3 .[Link] X 1+ Init
5 X 1 .[Link] X 6 + Init
6 X [Link] X 7 + X 9 + Init
7 X [Link] X 8 + init
8 ( X 7.e + X 9. f).Init X 1+ Init
9 X 6.d [Link] +
X 8init

5. Implementation of GRAFCET, D. DUBOIS Page 10 /12


X4 X8 Audur X1 X1 a Init Audur X6
S S
Init X7 X6
R
X2 X5 Init X1 X9
R
Audur Init

Audur
X1 m Init Audur X2
S
X3 X2 X6 d1 Init Audur X7
R S
Init X8 X7
R
Audur Init

Audur
X2 b Init Audur X3
S
X4 X3 X7 e Init Audur X8
R S
Init X9 f

Audur X1 X8
R
Init
X3 c Init Audur X4
S Audur
X1 X4
R
Init X6 d2 Init Audur X9
S
Audur X8 X9
R
Init
X1 m Init Audur X5
S Audur
X6 X5
R
Init X5 Audoux A

Odor X2 Audoux B

X3 Audoux C

X6 Audoux D

X7 Audoux E

X9 Audoux F

5. Implementation of GRAFCET, D. DUBOIS Page 11 / 12


3.2. Boolean language

‰ application on SIEMENS Series 300/400 (Step 7)

cf. TP

3.3. GRAFCET language

‰ application on TELEMECANIC TSX-47 (PL7-2) automation

cf. TP

3.4. advanced language

‰ in Pascal, assembly, C...

see 5emeyear

5. Implementation of GRAFCET, D. DUBOIS Page 12 / 12


Visualization: The automata offer a visualization screen where one can see the evolution of
inputs / outputs

The failure of a programmable controller can have serious consequences in terms of


safety, the standards prohibit the management of emergency stops by the automated system; this must be
made in wired technology.

We can also add safety modules to the machine (machine safety).

There are finally so-called safety automata (APIdS) that integrate monitoring functions and
increased redundancy and ensure the safety of the equipment.

VIII. Automata and communication:

With the development of automated systems and electronics (ASIC circuits), the search for
reduction of costs and the current necessity to manage production as best as possible, that is to say:

to receive the data related to an application as quickly as possible,


to consult, control, or modify the settings of an application remotely;

new wiring and communication technologies have emerged between the various components
automatism.

a. The field buses:

To reduce the wiring costs of input/output for controllers (extended systems), are
appeared the field buses. The use of remote input/output blocks allowed initially to
respond to this requirement.

A
C E E E E
Before: L U
O / / / /
I C
M S S S S
The sensors / pre-actuators M
distant involved large
cable lengths.
Machine 2

Machine 1 Machine 2

Machine 1

14 / 17
9. Industrial networks 9.4 Network technologies

9.4 Network technologies


The concepts are described in brief; for further reading, there are many
works devoted to this subject.

bNetwork topology
An industrial network is made up of PLCs, human-machine interfaces,
computers and I/O devices linked together by communication links such
as electric cables, optical fibers, radio links, and interface elements such as
network cards and gateways. The physical layout of a network is the
hardware topology or network architecture.
For the circulation of information, the term used is software topology.
Topologies are usually divided as follows:
bus
star
tree
ring
Fig. 4 Network topology hub.
Bus topology
This is one of the simplest layouts; all the elements are wired together
along the same transmission line. The word bus refers to the physical line.
This topology is easily implemented and the failure of a node or element
does not prevent the other devices from working.
Machine and sensor level networks, otherwise known as field buses,
use this system.
The bus topology is implemented by linking devices together in a chain.
or to the main cable via a connection box (TAP)(CFig.4).
Star topology
This is the Ethernet topology, the most common in management and the shop.
floor levels(CFig.5)It has the advantage of being very flexible to run and
repair. The end stations are linked together via an intermediate device
(repeater, switch). Failure of a node does not prevent the network as a
whole from working, though the intermediate device linking the nodes
AFig. 5 Star network topology
together is a point of weakness.
Other topologies(CFig.6)
The ring topology uses the same hardware layout as the star.
topology but ensures greater network availability.
The hub topology is not very widespread in industry and has 9
the disadvantage of a large number of links.

Ring Hub

The ring topology uses the same hard- The hub topology is not very widespread
The layout is like the star topology but in industry and has the disadvantage of
ensures greater network availability. a large number of links.

AFig. 6 Other network topologies

203
A
C B E E
L U
era
1 évolution : O U / /
I C
M S S S
M
Input interfaces/
outputs are shifted at most
near the sensors. Machine 2

I/O

Machine 1 I/O Machine 2

Machine 1

With the advent of ASICs, sensors, detectors ... have become 'smart' and have allowed for...
connect directly to the bus (medium).

A
C B
L U
O U
I C Interface
M S
M
Today:

The sensors and the


Machine 2
"smart" preactuators
(HMI, variators, distributors ...)
allow direct connection
at the bus.

Machine 1 Machine 2

Machine 1

To ensure the 'multiplexing' of all information coming from the sensors/pre-actuators


several communication protocols have been developed and standards have emerged (either standardized or
de facto standards.

Example:

The ASi (Actuators Sensors interface) bus is a Master/Slave type sensor/actuator bus that
allows the connection of 31 slaves (sensors or pre-actuators) on a specific cable (two wires)
transporting data and power.
This bus is totally standardized and allows the use of technologies from several manufacturers.
(interoperability). The device is therefore equipped with an ASi coupler.

15 / 17
Advantages of field buses:

Cost reduction in cabling and the possibility of reusing existing equipment


Reduction of maintenance costs
Communication possibilities

Disadvantages of field buses:

Limited network size


Adaptability to real-time applications
Total cost

Other field buses: Batibus (EIB standard), Interbus-S, CANopen

b. The field networks:

The emergence of these new technologies has led to the definition of several categories of
industrial local networks (CIM pyramid):

- the field networks,


- cell networks,
- supervision and control networks

The need for communication between cells (communication between automata) has allowed us to see
numerous communication standards (Profibus, Fip ...) appear.
The necessary determinism for certain applications leads to the use of Master/Slave networks.
At the company level, time is no longer critical and the Ethernet standard has been able to develop quickly.
thus allowing the visualization and control of processes via the Internet.

The current trend is towards the introduction of Ethernet networks as close as possible to the automation systems (for example:
Profinet standards.

16 / 17
IX. Criteria for choosing an automatic device:

The choice of a programmable logic controller is primarily the choice of a company or a group and
Business contacts and lived experiences are already a starting point.
The large companies will favor two manufacturers to create competition and be able to '...
"return" in case of "loss of speed" of one of them.
However, maintenance personnel must be trained on this equipment and too great a diversity of
equipment can have serious repercussions. An automated system using programming languages of
GRAFCET type is also preferable for ensuring adjustments and troubleshooting in the
best conditions.
The possession of programming software is also a source of savings (purchase of the software and
staff training). Tools allowing for program simulation are also
desirable.

Next, it is necessary to quantify the needs:

Number of inputs/outputs: the number of cards can impact the number of racks from
that the number of required inputs/outputs becomes high.
Processor type: memory size, processing speed and the special functions offered by
the processor will allow for choice in the often very extensive range.
Special functions or modules: certain cards (axis control, weighing ...) will allow for
relieve the processor and will need to provide the desired features (resolution, ...).
Communication functions: the automated system must be able to communicate with other systems.
command (API, supervision ...) and provide communication capabilities with standards
standardized (Profibus ...).

17 / 17

You might also like