Understanding GRAFCET in Automation
Understanding GRAFCET in Automation
The GRAFCET
Chapter 1 The GRAFCET
The GRAFCET
1.1 Introduction
The Grafcet, invented in 1977 in France by AFCET (French Association for the
Economic and Technical Cybernetics) is the abbreviation of the expression 'Functional Graph'
of Command Step/Transition". It allows to describe all the expected behaviors of a
control automation in response to events or information from a process
automated. In other words, it is a graphical model for representing the specifications of
charges of a logical automation.
GRAFCET is disseminated by ADEPA (National Agency for Development of
Applied Productive Engineering in the Industry.
1.2 Contextualization
The development of flexible workshops and robotization has imposed a simple graphical tool
which allows, based on a well-defined specifications document, to solve a problem
of automation and establish the operating cycle of the process, this tool is the Grafcet.
Grafcet particularly meets the needs of the industry in automation.
sequential tasks whose breakdown into steps is possible. It allows us not only
to analyze the problem presented but also to design a programmable solution whatever
such is the technology of the automaton. This tool is based on a very graphical representation
detailed system and this, before making its synthesis.
Our choice was made on this tool because it is a clear, strict language that allows for the description of a
unambiguous operation.
1.2.1 Normalisation
- NFC (French Standard for Electricity): This standard applies to any logical system
of industrial automation orders regardless of the complexity or the technology used
(electric, electronic wired or programmed, mechanical, pneumatic, etc.). The diagram
The functional "Grafcet" describes any system whose evolutions can be expressed.
sequentially, meaning that its breakdown into steps is possible. The Grafcet can be
also used for the description of combinatorial processes when it allows to give,
the control automation, a more easily analyzable sequential description and
understandable.
The present standard has been in effect since June 19, 1982, under the name NFC 03-190 of 1982, and
since the International Electrotechnical Commission: IEC 848 (1988), IEC: IEC 1131.3 (March
1993).
There is documentation and graphical symbols, functional diagram 'Grafcet' published
by the Technical Union of Electricity, UTE C03-190 November 1990.
1.2.2 Scope of Application
The functional diagram is independent of the 'all or nothing' sequential techniques.
pneumatic, electric or electronic, wired or programmed, which can be used for
implement the control automation. But the use of sequencers, on one hand, and
step instruction automata, on the other hand, allows for a direct transcription of the diagram
functional.
This concise and easy-to-read graphic representation is readily understandable by everyone.
person in connection with the automated system, from the designer to the user without forgetting
the maintenance agent.
Used industrially, Grafcet is also taught in technical options and
higher education.
Note well:
The Grafcet only focuses on the normal operation of the automation and does not take into account
count the various modes of operation and stop, as well as the failures;
The GEMMA will introduce us to these modes later.
1.3 Grafcet Levels
The Grafcet language includes two levels, here are their characteristics.
Level 1 (specification):
Only deals with the logical behavior of the application;
Ignore the specific constraints of sensors and actuators;
Actions and receptivities are described by sentences.
Level 2 (implementation):
Describes the actual functioning of the automation;
Takes into account the technology of sensors and actuators;
Actions and receptivities are given by logical equations on real signals.
Given the advantages that Level 2 Grafcet brings us, we will use it for the
modeling of our future processes.
1.4 Basic elements of a Grafcet
The Grafcet is a succession of transitions, consisting of (see Figure 1.1):
- Initial step: represents a step that is active at the beginning of operation, it
differentiate from other steps by doubling the sides of the square;
- Step:associated with actions,each step is represented by a labeled square
numerically
- Transition: associated with a Receptivity, the transition is represented by a line.
horizontal
- Receptivity: the conditions of receptivity are written to the right of the transition;
- Action: they are described literally or symbolically within one or more
rectangles connected by a line to the right side of the step;
- Directed links: connecting the steps to transitions and the transitions to the steps. These links
will be marked only when they do not respect the general direction of the route from top to
They indicate the direction of the path.
In the example of Figure 1.10, the dosing task (GT1) is executed 2 times in the cycle and the
Grafcet dosing describes this task. The initiation of this dosing task is done by activation.
from step X2 or the activation of step X5.
When the task is completed, a status information (end of task) is returned to the Grafcet.
the principal that can then evolve. It is desirable to complete the Grafcet of the task with the
verification that the launch step of the main Grafcet is indeed disabled before it
to loop.
There are other possible functional descriptions: example using the concepts of
transitions sources and sinks with simultaneous crossings of transitions (*) (see Figure 1.13).
In conclusion, there are multiple possible functional representations to describe
the use of the same resource in a sequence, at different times.
The problem can be much more complex in some cases (subroutine calls
parameterized or multiplexed, the management of multiple calls, etc.
1.9 Forcing
The forcing is a continuous action, noted in a double frame, that acts on the graph Gi,
hierarchically inferior or 'slave' by configuring this Grafcet, from anywhere
situation, in a given state.
The activation of step 10 of GrafcetG1 forces grafcetG2 to its step 21 (forced to 1), the
other steps of the grafcet G2 are deactivated (forced to 0) as shown in Figure 1.16.
CA XnXn‐[Link].
2thRule: crossing a transition triggers the activation of all stages.
immediately following and the deactivation of all the immediately preceding steps.
The translation of this rule provides the condition for deactivating the step:
1 0 1 0 Deactivation of step Xn
1 1 0 1 The step remains Active
CA(Xn).CD(Xn) 00 01 11 10
0 0 0 1 1
Xn
1 1 0 1 1
Or also, the expression of the generalized transfer equation of any given step of a
The GRAFCET is as follows:
Xn . . .
Methods of
programming of
programmable automations
industrial
Chapter 2 API programming methods
2.1 Introduction
The Programmable Logic Controller (PLC) is a programmable electronic device, suitable
to the industrial environment, which performs automation functions to ensure control
of pre-actuators and actuators based on logical, analog, or digital information.
The same type of programmable industrial controller can be used for different
applications, the difference is made with the program installed in it. To achieve these
programs use different languages depending on the system, the user, and the
designer.
Previously: using electromagnetic relays and pneumatic systems for the
implementation of the control parts Wired logic.
Disadvantages: expensive, no flexibility, no possible communication.
Solution: use of microprocessor-based systems allowing a modification
automated systems expert Programmed logic.
2.2 Main types of elementary data
In automated systems, the concepts of bit, byte, word, or double word
The word is often used. It is therefore necessary to know the meaning of these terms.
A bit corresponds to a position or a binary character. It is the smallest unit.
in terms of information and it only admits one of the two states: '0' or '1'.
Several bits can be grouped together into larger units.
Octet (or byte): a byte is a unit of 8 bits. It is used, for example, to group the
logical states of 8 inputs or 8 outputs (see Figure 2.1).
A word consists of 2 bytes, that is, 16 bits. A word allows for grouping.
16 entries or 16 exits.
Double word: a double word consists of 2 words, or 4 bytes, or 32 bits.
the double word is the largest unit that an automaton is capable of processing except for
some APIs that handle the long word (64 bits).
In summary:
-1 Byte = 8 bits ;
-1 Word = 2 Bytes = 16 bits ;
-1 Double word = 2 words = 4 Bytes = 32 bits (see Table 2.1).
Table 2.1 - Table of Elementary Data Types
Type of Description Size or Etendue
Data number of bits
BOOL Boolean (bit) 1 0 or 1
BYTE 8-bit cord 8 No extent
WORD String of length 16 16 digital for
DWORD String of length 32 32 this type of
LWORD String of length 64 64 data
INT Signed integer n=16 -2 to + (2n+1– 1)
n-1
Prefix Meaning
I Placement of an automated entrance
Q Location of an automated exit
M Location of memo or internal memory
X Size of a single bit
B Size of a byte or octet
W Word size: 16-bit word
D Size of a double word: double word of 32 bits
L Length of a long word: 64-bit word
Example:
%IW125: Location of the input word at address 125;
%QB17: Location of the output byte at address 17;
%MD48: Location of the double memory word at address 48.
Table 2.4 offers several modes of memory area distribution ranging from M0.0 to
This distribution is made according to the needs and we pay attention to overlaps.
Table 2.4 - Symbolic representations of variables
Symbolic addressing
Pour donner de la clarté au programme, on utilise l’adressage symbolique. Cela revient à
replace each physical address with a symbolic address that best represents it
function as shown in Figure 2.3.
Its geographical address on the automaton (its position) for example 0.5: 0 being the number
of the module and 5 being the path on the module.
All programmable controllers operate according to the same operating mode as the
show Figure 2.4.
We call the scrutiny the set of the four operations carried out by the automaton and the time of
scrutinizes the time taken by the automaton to process the same part of the program. This time
is on the order of tens of milliseconds for standard applications.
The type conversion function: REAL / INT, this function allows the conversion of a
input variable of real type into an output variable of integer type.
The numerical function: SQRT, this function allows you to calculate the square root of a
input variable.
Bit cord functions: SHL, this function allows the left shift of N bits of a
input variable and the filling of zeros to the right.
Logical functions: AND, this function performs the Boolean AND.
Selection and comparison functions:
MAX: this function determines the maximum value among three input variables;
- SEL: this function allows you to select one of the two input variables depending on
variable G ;
GT: this function performs a superiority comparison between two input variables.
(IN1>IN2).
il
LD 000.01 WR
OUT TIM 01 WR
50 WR
LD TIM 01 WR
OUT 100.05 WR
END. "FUNC 01 WR"
To change the timer value, simply turn the key to the Program position and tap
CLEAR then point the arrow↓ to change the time. Press SHIFT + CONT and
give the new value and finally type WR.
To see if the changes are validated or not, you need to turn the key to RUNet and check.
the operational result on the model of the automaton.
Programming the EXCLUSIVE OR function: it involves translating the contact network.
following, in List program intended for an OMRON type API.
Solution of application 1:
LD 000.01 WR
OR NOT 000.03 WR
LD NOT 000.02 WR
OR 000.04 WR
AND LD WR
OUT 100.01 WR
END.
Application 2 :
Write the List program for the following contact diagram:
Solution of application 2:
To facilitate the program, we can use the AND LD instruction as follows:
LD 000.01 WR
OR NOT 000.03 WR
LD NOT 000.02 WR
OR 000.04 WR
AND LD WR
LD NOT 000.05 WR
OR 000.06 WR
AND LD WR
OUT 100.01 WR
END.
Application 3 :
Write the equivalent List program for the following contact scheme:
Q2:
LD 000.01 WR
AND NOT 000.02 WR
LD NOT 000.01 WR
AND 000.03 WR
OR LD WR
LD 000.06 WR
AND 000.05 WR
OR LD WR
LD NOT 000.03 WR
OR 000.09 WR
AND LD WR
LD NOT 000.04 WR
AND LD WR
OUT 100.06 WR
END.
2.9.2 ST Language (Structured Text or structured literal language)
This language, rarely used by automation engineers, is composed of literal expressions made up of
of operators and operands and statements. This language is close to a programming language.
like PASCAL. It uses instructions like if, then, else.
Example 1: Order of a solenoid valve
Electrovalve command
IF (%I0.0 OR %Q4.0) AND %I0.1 AND NOT %I0.2 THEN SET %Q4.0
END_IF;
Example 2: From a demonstration program "Dosage and mixing machine of a
products" by the PL7 software from Schneider.
The content of this block written in ST language is as follows:
(*** Simulation routine of a first-order process for PID Output ***)
IF Trs THEN
Sortie : = Tri ;
ELSE
Te := INT_TO_REAL(%SW0) / 1000.0 ;
Output : = (Filtering / (Filtering + Te)) * Output + (Gain * Te) / (Filtering + Te) * Input ;
END_IF ;
With:
Polling period of the master task. Allows to modify the period of the task.
master defined in configuration, by the user program or by the terminal. The period is
expressed in ms (1 255ms). %SW0=0 in cyclic operation.
Memory :=Tri;
Sortie := Tri;
Pos := 0;
ELSE
Sortie := Memoire[Pos];
Memoire[Pos]:= Entree;
Pos := Pos + 1;
IF (Pos>= Nb) THEN
Pos := 0;
END_IF;
2.9.3 FBD Language (Function Block Diagram) or functional block language
It is a graphical language used by automation engineers where the blocks are programmed.
(libraries) or programmable ones are represented by rectangles with the inputs on the left
and the outputs to the right. This language consists of networks of functional blocks that are
connected to each other by lines, the flow of signals going from the output of a function to
the entry of the connected function.
Examples of standard functional blocks:
Functional block meters;
Functional block timers;
Functional block PID controller...
Application: Description of the SFB 2 counter
CU: Counting input, when the logic state of the CU input changes from state 0 to
In state 1 (front rising), the meter is incremented by 1.
CD: Counting input, when the logical state of the CD input changes from state 0
In state 1 (rising front), the counter is decremented by 1.
R: Reset input, when the logical state of the R input changes from state 0 to state 1, the
the counter value is forced to 0 regardless of the state of the CU input.
PV: Setting the meter value. (in the example above 10).
LD: Input "loaded", when the logical state of the LD input changes from state 0 to state
1, the counter value (CV) is forced to the value set at the PV input regardless of what
consider the state of the CD input.
Instruction lines are connected by at least one condition. The execution of a scheme is done
always from left to right.
The conditions (contacts) are represented by two vertical lines or by two lines.
Verticals crossed by a diagonal. In the first case, the condition is initially open.
it is transcribed by a mnemonic such as (LD, AND, OR); in the second case it is a
initially closed condition (closed at rest) it is transcribed by a mnemonic of the type
(LDNOT, ORNOT, ANDNOT).
The vertical starting line placed at the left end of the network is the starting point of this
last.
The vertical lines parallel to this one represent subroutines by
relative to the main line.
The conditions are represented by two vertical lines.
Fundamental terminology: in relay diagrams, each condition is assigned a bit.
bit is at (one) when the condition is true, the condition is then in the ON position. A condition
initially closed is initially in the OFF position, it will switch to the ON position with a state
complementary to that of an initially open condition.
The execution conditions: in a relay scheme, the execution of an instruction is done at
from the moment when the combination of the conditions that precedes it is true.
Operand bits: input/output bit; flag (status bit); working bit; timer or
counter.
-Logical blocks and instruction blocks: the logical block is a group of instructions that generates a
logical result. Decomposing a program into several logical blocks simplifies the
synthesis and testing of applications. A block of instructions includes all the instructions.
linked together in the same diagram.
2.9.5 Programming using GRAFCET (SFC: Sequential Function Chart)
GRAFCET, a specification language, is used by some automation manufacturers.
(Schneider, Siemens) for programming. Sometimes associated with a programming language,
it allows for easy programming of sequential systems while facilitating debugging
programs as well as system troubleshooting (see Figure 2.9).
One can also translate a Grafcet into contact language and implement it on any type.
of the automaton.
- ∗ ∗
The translation of its equations using the transfer equations method results in
Figure 2.11.
This method is essentially based on the exploitation of the functions set to 1 memorized and
reset stored (Set/Reset) and their holding functions which are:
Set: The logical set to 1 function;
Reset: The reset function (Reset to Zero).
For the application of this method, the steps of Figure 2.10 will be represented by the networks
from Figure 2.12.
STOP/RUN
Yellow continuous indicates the STOP state;
A continuous green light indicates the ON state;
Green and yellow flashing alternately indicate that the CPU is in the ON state.
ROUTE.
ERROR
The flashing red light indicates an error, such as an internal error in the CPU.
error with the memory card or a configuration error (modules not
concordants) ;
Continuous red signals defective equipment;
All the LEDs blink if a failure is detected in the Firmware.
The LED MAINT (Maintenance) flashes as soon as you insert a memory card.
The CPU then goes to the STOP state. Once the CPU has entered the STOP state,
execute one of the following actions to trigger the memory card evaluation:
Turn the CPU to the ON state;
Perform a general erasure (MRES);
Power off the CPU and then power it back on.
The CPU also provides two LEDs that indicate the communication status. Open the cache.
the lower terminal to see them:
The green link light illuminates to indicate that a connection has been successfully established.
Configuration version of
the unknown CPU or On (yellow) Turn signal Turn signal
incompatible
Management of modes of
operation of an S.A.P
Chapter 3 Management of the operating modes of an S.A.P
To carry out a functional partition of the control part, it is necessary to respect the architecture.
from the operational part, functional architecture in relation to the development of added value.
3.3 Hierarchization of functions
The functions of a Control Unit can be classified by levels of intervention of the
PC on the PO.
The three main functions, command, control, safety, can be organized, at
level of the internal structure of the PC, in hierarchical levels. This type of structure leads to
generally to a three-level Global Grafcet, and therefore composed of at least three grafcets
partials (see Figure 3.3).
Security level: gathers the safety stop conditions as well as monitoring of
sensitive point of the process.
Driving level: manages the modes of starting and stopping, excluding safety.
Order level: manages the production cycle of the system under the conditions of
normal marches.
System operation
GFC
Production in Mode
Manual Mode Production
Automatic
...
GFP_Manu GFP_Auto
The surveillance level is hierarchically superior to the other two, it will therefore issue
forcing orders to lower levels but also direct orders to the PO:
The first emergency securities will be ensured by a wired logic;
The lower emergency safeties will be handled by the programmed logic (API).
In most cases of security incidents, the main difficulty is the handling of recovery.
after stopping, this may lead the designer to implement special recovery grafcet
after a stop. The EN 1131-1 standard defines three types of resumption.
3.4.1 Cold Restart
Restoration of the API configuration and its application program after all the
dynamic data (variables such as I/O image, internal memories, timers,
counters, etc. and contexts of the program) have been brought back to a predetermined state. A
Cold restart can be automatic (for example, after a power outage, a loss
information in the dynamic parts of the memory, etc.) or manual (by
example reset button, etc.).
3.4.2 Immediate resumption
Resumption after a power outage occurring during the maximum time interval
function of the process allocated to the configuration of an API to restore its operation
as if there had been no power cut. All the I/O information and all
the other dynamic data as well as the context of the application program are restored
you remain unchanged. The ability for immediate recovery requires a real-time clock or
a separately powered timer to determine the elapsed time since detection.
the power cut is an accessible way for the user to program the duration
maximum allowed based on the process.
3.4.3 Hot Reprise
Resumption after a power outage, with a set of dynamic data
predetermined and programmed by the user and an application program context
predetermined by the system. A hot restart is characterized by a status indication or
any other related means made available to the application program indicating that
The power interruption of the API configuration has been detected in RUN mode.
Security is a component of the safety of an automated system The achievement of a level of
high availability may be incompatible with security, which is why safety must be
an overall analysis to reach the best compromise. Security must be considered under
the dual aspect of risk analysis (severity and probability of occurrence) and the
applicable regulations.
3.4.4 Security actions
After detecting a failure, the PC may be tasked with different security actions.
types :
Alarm and signaling: control of lights, flashing beacons, siren, message editing
or/history of defeats;
Direct command of actuators: generally absolute and direct prohibitions of
movements (output equation);
Evolution of the system: the PC causes changes in the system states towards a shutdown.
a degraded step or a safety step.
The representation of the monitoring level will include at least a safety Grafcet.
(GFS) but more often associated with one or more monitoring Grafcets (GFSUR).
3.5 Emergency Stop Handling
Two solutions can be proposed:
Without an emergency sequence: the system stops its evolution;
With emergency sequence: the appearance of an emergency stop triggers a procedure
particular.
3.5.1 Stop without emergency sequence
Fixing the automation: it is assumed in this case that the term "AU" is an implicit factor.
in all receptivities. From the occurrence of the emergency stop, no receptivity can
take the logical value 1: the situation cannot evolve. The disappearance of the emergency stop.
re-authorize the evolution of the cycle (see Figure 3.4).
He will describe the cycle of the Operative Part (one or several Grafcets) to produce value.
added. In the case where a state rectangle calls for a complex procedure, it will be executed.
by a procedure Grafcet.
Processing of quantities
analogous by an API
Chapter 4 Traitement des grandeurs analogiques par un API
4.1 Introduction
All physical quantities (voltage, temperature, pressure, positioning, speed,
etc.) are analog quantities. In order to be able to process these quantities in an API, it
it is necessary to:
Convert the physical quantity into an electrical analog quantity;
Convert the analog electrical quantity into a digital quantity.
The objective of processing analog quantities through an API is, based on the basic principles
from analog technique, characteristics of analog input and output modules.
4.2 Analog and binary signals
Binary signals can only take two logical states: logical state 1 (voltage
logical state 1 (presence of voltage) and logical state 0 (no voltage is present). In automation technology,
signals that are not only binary but also analog often need to be read, processed and
transmission. Unlike binary signals, analog signals can take any
the values contained within a defined range.
4.3 The analog inputs
In contrast to digital or logical inputs, an analog input allows for the collection of a
variable electric signal that can take an infinite number of values over a range
defined. The value of an analog input changes continuously over time depending
of the physical quantity measured by the sensor.
- Voltage type signals: Voltage type signals are generated by certain types of
analog sensors. The most common operating ranges are from 0 to 5 V/DC and from 0 to 10
V/DC.
- Current type signals: The 4 signal 20 mA has become the standard current signal
In the industry, sometimes we can also encounter type 0 sensors. 20 mA.
Resistance type signals: Resistance type signals are most of the time
used with temperature sensors like thermocouples.
To convert the physical quantity into an electrical signal, it is sufficient to carry out
a rule of three:
Example No. 1: Temperature sensor capable of measuring temperatures between 0 and 500°C.
Example No. 2: Three-phase motor with a speed ranging from 0 to 4000 rpm.
This programmable controller has eight (8) analog inputs, the address of the first input
The analog would be in this case %IW64 and that of the eighth analog input is %IW78.
Since it has four (4) analog outputs, the address of the first analog output
in this case is %QW64 and that of the fourth analog output is %QW70.
4.6 Normalization of analog values
If an analog input value is present as a digitized value within a range
bipolar 27648 (see Table 4.1 and Figure 4.2), it usually needs to be normalized for
that the numerical values correspond to physical values of the process. The output
analog is also achieved by the transmission of a standardized value that must then be
scaled to the value of the bipolar output 27648 as shown in Table 4.1.
Tableau 4.1 – Processing of analog quantities by an API
The entries
Input voltage 27648
∗
10
Current entry 27648
∗
20
The outings
Output voltage 10
∗
27648
Current output 20
∗
27648
To adapt the analog signal, normalization and scaling conversion are used.
two predefined functions by the Step7 software.
The functional block "NORM_X" normalizes the value of the variable at the input
VALUE by reproducing it on a linear scale. We define it with the parameters MIN and
MAX, the limits of a range of values that is reflected on the scale. The result is calculated in
function of the position of the value to be normalized in this range and it is stored in the form of
real floating-point number at the OUT output (see Figure 4.3).
When the value to be normalized is equal to the input MIN value, the output OUT provides the
value 0.0.
When the value to be normalized is equal to the input value MAX, the output OUT provides the
value 1.0.
U K.(N - N0)
At: U = 0V when N = 500 rpm and U = 10V when N = 1500 rpm, from which:
10
10
1500 500
This analog quantity will be processed by the analog input of the API so that it can be read.
then converted into a digital information (Analog to digital conversion) this means
that the voltage value of 3.65V will be stored as digital information in the
entry register Reg10.
27648 27648
*U *3.65 10091
10 10
Application 2: tank level control
The level of a liquid in a tank is converted into a voltage ranging from [0 +10V] by a
sensor associated with a measurement transducer.
The transducer is connected to the first analog input of the Simatic S7-1200 at the level of
what the analog signal must be converted, normalized, and scaled.
Propose a Step7 program that meets the following conditions:
-0V corresponds to a level of 100 liters and +10V corresponds to a level of 1000 liters;
The maximum permissible level is 990 liters and the minimum permissible level is 110.
litres.
Solution of application 2:
The local variables required for this application are:
It is especially important that the correct data types are used, since in
the rest of the program, they must be compatible with the conversion functions used.
After declaring the local variables, the program is written in symbolic addressing of the
variables.