Vous êtes sur la page 1sur 6

GRAFCHART AND GRAFCET: A COMPARISON

BETWEEN TWO GRAPHICAL LANGUAGES AIMED


FOR SEQUENTIAL CONTROL APPLICATIONS

Charlotta Johnsson and Karl-Erik Årzén

Department of Automatic Control,


Lund Institute of Technology,
Box 118, S-221 00 Lund, Sweden,
E-mail: (lotta,karlerik)@control.lth.se

Abstract: This paper compares the language Grafcet with the language Grafchart.
Both are graphical languages aimed for sequential control applications. Grafcet
is aimed for specification of controller structures, i.e., for local level control
applications. Grafchart is based on Grafcet, Petri nets and ideas from object-
oriented programming and it can be used for any sequential control application,
both applications on a local level and on a supervisory level. In addition to this,
applications structured with Grafchart can be analyzed with respect to, e.g.,
deadlock situations, this is thanks to its foundation in Petri nets. In this paper,
the similarities and the differences that exit between Grafcet and Grafchart are
clarified and discussed.

Keywords: Discrete Event Systems, Sequential Control, Grafcet, Grafchart.

1. INTRODUCTION named IEC 848. In this standard Grafcet is


refered to under the name Sequential Function
Charts (SFC). Five years later, the standard,
The advantages of graphical programming lan-
IEC 1131-3, with Grafcet/SFC as essential part
guages are simplicity and declarativeness. They
arrived. Today, Grafcet/SFC is well accepted
often allow programming in a style that closely
in industry much thanks to its clear graphi-
mimics the style that people model problems.
cal interface. Grafcet has its roots the in the
Examples of mental models that are naturally
Petri nets formalism. Petri nets are a graphical
represented graphically include fault trees, or-
and mathematical model aimed for visualiza-
ganization charts, program flowcharts, and block
tion and simulation of discrete systems. Petri
diagrams. Graphical languages fit users’ exist-
nets are often used in the context of formal
ing perception of problem, making the appli-
methods for analysis of discrete event systems.
cation easier to build, debug, document, and
maintain. An added benefit is the possibility to Grafchart is the name of graphical language
use colour and animation to provide feedback as for sequential control applications. Grafchart is
the program executes. based on the graphical syntax of Grafcet. To
this it adds ideas from Petri nets, high-level
Grafcet is a graphical language that was pro-
Petri Nets and object-oriented programming.
posed in France in 1977 as a formal specification
Grafchart has been developed at Lund Institute
method for logical controllers, AFCET (1977).
of Technology since 1991, Årzén (1991); Johns-
In 1988, Grafcet, with minor changes, was
son (1997). The system is implemented in G2,
adopted by the International Electrotechnical
an object-oriented graphical programming en-
Commission (IEC) as an international standard
vironment for supervisory applications, Gen- Initial

sym Coorporation (1995). The primary aim of


step
or−divergence Alternative paths

Grafchart is to show how Grafcet/SFC can be Transition


and−divergence

modified from a rather low-level graphical lan- Token

guage into a high-level, object-oriented graphi- Parallel


cal language. The secondary aim is to be able paths

to use available analysis methods and tools de-


veloped for Petri nets also for Grafchart. In this and−convergence

way the same formalism may be used both for or−convergence


Step
execution and formal analysis.
This paper starts, in Section 1 and Section 2,
with a presentation of Grafchart and Grafcet, Fig. 1. Grafchart graphical syntax.
respectively. Thereafter follows a discussion
about the similarities and differences between once when the step becomes active (inactive).
the two languages. Abortive actions are executed once just before
the step becomes aborted. All actions can be con-
ditional or unconditional. In Figure 2 (bottom
2. GRAFCHART left) a step with an initially action is shown.
Grafchart is a graphical language aimed at se-
quential control applications. It is based on (1) Transitions: To each transition a receptivity
the industrially well-known and well-accepted is associated, each receptivity contains two at-
graphical syntax of Grafcet/SFC, (2) Petri nets, tributes: event and condition. When the re-
mainly an academically known modeling lan- ceptivity of an enabled transition becomes true
guage with means for formal analysis and for- the transition fires i.e., deactivates the steps
mal definitions, (3) object-oriented program- preceding it and activates the steps succeeding
ming constructs. Grafchart exists in two differ- it. A transition with a receptivity is shown in
ent versions, one basic version and one high- Figure 2 (bottom right).
level version. In this paper only the basic ver-
sion of Grafchart will be treated and compared 2.1.2. Grafchart Procedure: Sequences that
to Grafcet. are executed in more than one place in a func-
tion chart can be represented as Grafchart pro-
Grafchart has a graphical syntax similar to that
cedures, see Figure 2 (top right). The proce-
of Grafcet/SFC. The primary building blocks
dure body is stored on the subworkspace of the
are steps, representing states, and transitions,
Grafchart procedure object. Special enter-steps
representing the change of states. It also sup-
and exit-steps are used to indicate the first and
ports alternative and parallel branches, see Fig-
the last sub-step of a procedure. The Grafchart
ure 1. An active step is indicated by the pres-
procedures are reentrant and recursive proce-
ence of a token in the step.
dure calls are possible.

Macro steps: Macro steps are used to represent


2.1 Building blocks steps that have an internal structure. The inter-
nal structure is placed on the subworkspace of
Grafchart supports eight different building blocks.
the macro step object, see Figure 3 (top right).
A subworkspace can be attached to each build-
Macro steps have enter-steps and exit-steps in
ing block.
the same way as the Grafchart procedures.
2.1.1. Grafchart Process: An entire function Subworkspace Subworkspace
chart can be encapsulated by a Grafchart pro- Grafchart Grafchart
process procedure
cess, i.e., the function chart can be placed on the
subworkspace of the Grafchart process object,
see Figure 2 (top left). A the function chart
always starts with an initial-step represented
by a double square.
Step Transition
Steps: Associated with the step are actions Initially
Open the valve
a transition

event
that are performed when the step is active. Four named B
condition

action types exist: always, initially, finally and


abortive. Always actions are executed cyclically
as long as the step they are associated with is Fig. 2. Grafchart process, Grafchart procedure,
active. Initially (finally) actions are executed Step and Transition
Procedure Subworkspace Subworkspace calling step. It is possible to let the value of a
step
parameter determine which procedure that will
Procedure
call Macro
step
be called, i.e., there is support for dynamical
Grafchart
procedure
binding.

Process
step
Subworkspace
Subworkspace
2.2.2. Methods and message passing: The
Exception

Process
transition
method feature denotes the possibility to have
creation

Grafchart procedures as methods of general ob-


Grafchart
procedure jects. From the body of the Grafchart procedure
realizing the method it is possible to reference
the attributes of the object that the method
belongs to using a special self.attribute no-
Fig. 3. Procedure step, Macro step, Process step tation. A method is called through a procedure
and Exception transition. step. The method that will be called is deter-
Procedure step: The call to a Grafchart pro- mined by an object reference and a method
cedure is represented by a procedure step, see reference.
Figure 3 (top left). The procedure step contains
a procedure attribute that contains the name 3. GRAFCET
of the procedure that should be called.
Grafcet was developed in 1977 with the aim
2.1.3. Process steps: With a process step, see to be a formal specification method for logi-
Figure 3 (bottom left), it is possible to start a cal controllers. In industry Grafcet, with minor
procedure as a separate execution thread, i.e. as changes, is better known under the name Se-
a process. The transitions after a process step quential Function Charts (SFC). In this section
become enabled as soon as the execution has a brief overview of Grafcet is given. A more
started in the Grafchart procedure. An outlined thorough presentation of Grafcet can be found
circle token is shown in the process step as long in David (1995).
as the process is executing.
3.1 Building blocks
2.1.4. Exception transition: An exception tran-
sition may only be connected to macro steps Grafcet has a graphical syntax. It is built up
or procedure steps. An exception transition is by steps, drawn as squares, and transitions,
enabled all the time that the step is active. represented as bars. The initial step, i.e., the
If the exception transition fires, the execution step that should be active when the system
of the corresponding step will be aborted and is started, is represented as a double square.
abortive actions, if any, are executed. The steps Grafcet has support for both alternative and
remember their execution state and it is pos- parallel branches in the same way as shown in
sible to resume them from that state. An ex- Figure 1.
ception transition is shown in Figure 3 (bottom
right). Exception transitions was first proposed 3.1.1. Steps A step can be active or inactive.
in Årzén (1991). They have proved to be very An active step is marked with one token placed
useful when implementing error handling. in the step. The steps that are active define the
situation or the state of the system. To each step
one or several actions can be associated. The
2.2 Advanced features actions are performed when the step is active.
Grafchart includes two advanced features: pa-
rameterization, and methods and message pass- 3.1.2. Transitions Transitions are used to
ing. connect steps. Each transition has a receptivity.
A transition is enabled if all steps preceding
2.2.1. Parameterization: Grafchart processes, the transition are active. When the receptivity
macro steps, and steps may have attributes of an enabled transition becomes true the tran-
acting as parameters. The parameters can be sition is fireable. A fireable transition will fire
accessed from within the step actions and the immediately. When a transition fires the steps
transition receptivities using a special sup.att- preceding the transition are deactivated and the
ribute notation. It is also possible for Grafchart steps succeeding the transition are activated.
procedures to have parameters. The parameters
are given their actual values when the proce- 3.1.3. Actions There are two major categories
dure is called, i.e., in a procedure step or process of actions: level actions and impulse actions. A
step. A procedure may also return values to the level action is modeled by a binary variable and
has a finite duration. The level action remains 4. SIMILARITIES AND DIFFERENCES
set all the time while the step, to which the
action is associated, is active. A level action may Grafcet and Grafchart have many similarities.
be conditional or unconditional. An impulse This is natural since Grafchart is based upon
action is responsible for changing the value of Grafcet. However, there are also some impor-
a variable. The variable can, but must not, be a tant differences. These will be pointed out and
binary variable. An impulse action is carried out discussed in this section.
as soon as the step changes from being inactive
to active. A variable representing time may be 4.1 General aim
introduced to create time-delayed actions and
time-limited actions. A level action can always The language of Grafcet was developed with
be transformed into an impulse action. the focus on logical controllers (PLCs). The lan-
guage is most often used only as a specifica-
A situation can be stable or unstable. If the tion language, i.e., as a graphical description of
transition following a step is immediately fire- how the controller should work. The implemen-
able when the step becomes active, the situa- tation is then done in another language, e.g.,
tion is said to be unstable. An impulse action relay (ladder) logic diagrams. Grafchart has
is carried out even if the situation is unstable been developed without focus on any particular
whereas a level action is performed only if the application. Grafchart is also intended to be a
situation is stable. Between two different exter- language used, not only for specifications, but
nal events it is assumed that there is always also for the actual implementation. A Grafchart
enough time to reach a stable situation. In Fig- function chart is interpreted on-line.
ure 4 two steps are shown. A level action, A, is
associated with the upper step and an impulse 4.2 Interface
action, B*, is associated with the lower step.
Grafcet and Grafchart have different exter-
^
|x nal interfaces for actions and receptivities.
I
In Grafcet the interface consists mainly of
A
boolean variables whereas the interface in
y
M Action
Grafchart consists of everything that the under-
lying implementation language supports. Since
B*
Grafchart is implemented in G2 this means that
O
x .^
|z there are support for e.g., booleans, strings,
numbers, arrays, structures etc. In Figure 2
Fig. 4. Two actions and three receptivities (left). (lower left) a Grafchart step with an initially
A macro step (right). action is shown. This action can be compared
with the Grafcet impulse action shown in Fig-
3.1.4. Receptivities Each transition has a re- ure 4 (left, lower step). Both the Grafcet and the
ceptivity. A receptivity may either be a logical Grafchart action sends out a signal that should
condition, an event, or an event and a condition. open a valve named B.
In Figure 4 (left) three transitions and their
All four types of actions in Grafchart can
receptivities are shown. The receptivity of the
be compared to impulse actions in Grafcet.
first transition is an event, ↑ x . The receptivity
Grafchart does not support Grafcet level ac-
of the second transition is a condition, y, and
tions. The reason for this is that level ac-
the receptivity of the last transition is a combi-
tions are only of interest for boolean variables
nation of a condition and an event, x ⋅ ↑z .
(true/false, high/low) and Grafchart supports
a lot of different variable types. However, the
3.2 Macro Steps functionality of a level action can always be
To facilitate the description of large and com- expressed by one or more impulse actions.
plex systems macro steps can be used. A macro
step is a step with an internal representation 4.3 Execution
that facilitates the graphical representation and
makes it possible to detail certain parts sep- The firing rules that apply to Grafchart are
arately. A macro step has one input and one similar to those of Grafcet.
output step. When the transition preceding the Rule 1: All fireable transitions are immedi-
macro step fires the input step of the macro ately fired – this rule applies to Grafcet and
step is activated. The transition succeeding the Grafchart.
macro step does not become enabled until the Rule 2: Several simultaneously fireable tran-
execution of the macro step reaches its output sitions are simultaneously fired – for Grafcet
step. A macro step is shown in Figure 4 (right). this is true in all situations, for Grafchart
this is true for all situations except in an or- Special care has to be taken to firing rules
divergence situation. Grafchart treats this sit- interpreted differently in the two models.
uation by nondeterministically choosing one of
If the Grafchart contains only steps and transi-
the branches. In order to have an interpretation
tions, the structure of the corresponding Grafcet
algorithm without ambiguities, situations like
will be identical to that of the Grafchart.
this must be avoided. It is therefore required
that all branches are made mutually exclusive. If the Grafchart contains macro steps, the
Rule 3: When a step must be simultaneously Grafchart macro step icon must be changed to
activated and deactivated, it remains active – that of Grafcet. The enter step and the exit step
this rule apply to Grafcet but not to Grafchart. of the macro step must be replaced by an input
In Grafchart, the step will first be deactivated step and output step of Grafcet. Alternatively,
and then activated again. the macro step icon can be replaced by its inter-
nal structure in which the enter step and exit
For Grafcet, many different interpretation al-
steps are replaced by ordinary steps.
gorithms exists. A complete and unambiguous
algorithm is given by David (1995). This algo- If the Grafchart contains procedure steps these
rithm is global. A global interpretation algo- should be replaced by a Grafcet macro step. The
rithm does also exist for Grafchart, however, internal structure of the macro step should be
the algorithm currently implemented is local. that of the Grafchart procedure called by the
When a new external event occurs, the global procedure step, see Figure 5.
algorithm searches through all receptivities to
see which transitions that have become fire-
able. Since the implementation of Grafchart
T1
is based on activatable subworkspaces such a a procedurestep
T1
M1
search is not performed. When a new external name
parameters
I
T2 T2
event occurs or a condition becomes true the procedure gp1
M1
T5

corresponding receptivities becomes true and a Procedure call


T5
T6
T3 T3
procedure called fire is automatically started. O
T6
This procedure takes care of the deactivation Grafchart
procedure
T4 T4
and activation of steps and the enabling and gp1

de-enabling of transitions. The local algorithm


is more efficient and less time demanding than Fig. 5. A Grafchartand an identical Grafcet.
the global algorithm.
If the Grafchart contains process steps, these
should be replaced by a parallel construct (and-
divergence) with two branches. One branch con-
4.4 Graphical elements
tains an empty step followed by the transition
The Grafchart language contains more graphi- succeeding the process step. The second branch
cal elements (building blocks) than Grafcet. The contains an empty step followed by an alterna-
new building blocks introduced in Grafchart tive structure (or-divergence) where each path
are: Grafchart process, Grafchart procedure, contains a macro step followed by a sink transi-
process step, Procedure step and exception tion. The macro steps are all identical and their
transition. However, the new building blocks internal structure is that of the Grafchart pro-
does not extend the functionality of Grafchart cedure called by the process step. The number
compared to Grafcet, but they facilitates the of paths in the alternative structure are equal
implementation of more advanced sequence to the number of processes that can run at the
structure. The development of Grafchart from same time. This number has to be finite. The
Grafcet can be compared to the evolution of as- transformation is shown in Figure 6.
sembler languages to a high-level programming M1, M2, ... , MK

language like e.g., Java. T5 I

T5
T1 T6 T1
Grafchart
procedure T6
gp1 O
T2 T2

4.5 Grafchart to Grafcet transformation a process step

name
T3 parameters T3
procedure M1 M1. M2 M1.M2....MK
gp1

A Grafchart and a Grafcet are identical if, ap- T4 T4


M1 M2 MK

plied to the same input sequence, their output


sequences are identical. The transformation of
a Grafchart to a Grafcet consists of two steps. Fig. 6. A Grafchart(left) and an identical
First, the graphical elements must be changed Grafcet.
to those of Grafcet. Secondly, the action types of If the macro step or procedure step has an
Grafchart must be changed to those of Grafcet. exception transition connected to it, the macro
step icon or procedure step icon has to be re- traces from the object-oriented programming in-
placed by its internal structure. To each of the fluence. The parameterization feature can only
internal steps an extra transition has to be be reconstructed by having one Grafcet for each
added containing the events and conditions of parameter setup, which is of course a bad re-
the exception transition. placement. The method feature can be recon-
structed by having ordinary macro steps as re-
4.6 Action transformation placements for the methods. This will give the
same functionality but it will not allow the ap-
Each step in Grafchart, that contains actions plication to be as well structured and organized.
can be replaced by one or several steps with ac-
tions in Grafcet, see Figure 7. The transforma-
4.9 Analysis
tion of a macro step with actions, or procedure
step or process step for which the corresponding A Grafchart can be transformed into a Petri
Grafchart procedure has actions, is possible but net and the analysis methods that exist for
results in a huge and messy Grafcet. Petri nets can be applied. This means that the
structure of a Grafchart can be analyzed with
a
respect to e.g., deadlock situations, Johnsson
Impulse A and Årzén (1998).
1
a scaninterval
Initially A
Always B
Finally C
Impulse B
5. CONCLUSIONS
b 1
b

Impulse C The two languages Grafcet and Grafchart have


c
1
been compared. Both languages are graphical
c
sequential languages. Grafcet was developed
with the aim to be a specification languages for
logical controllers, i.e., for local control applica-
Fig. 7. A Grafchart and an identical Grafcet.
tions. Grafchart is mainly based upon Grafcet
but it was developed to suit any sequential
4.7 Firing rules control application, i.e., both applications on
The firing rules are not exactly identical in the local and on the supervisory control level.
Grafchart and in Grafcet. A step that has to Grafchart and Grafcet have many similarities.
be simultaneously activated and deactivated There are also some important differences, e.g.,
remains active in Grafcet. This means that an the execution models and the transition firing
impulse action associated with such a step in rules are not identical and in order to facilitate
Grafcet will not be executed whereas an initially for the user Grafchart includes more graphi-
action associated with such a step in Grafchart cal elements and more advanced features. In
will be executed. Some Grafchart structures the paper the differences between the two lan-
therefore has to be extended with an extra step guages are pointed out and discussed.
in the corresponding Grafcet, see Figure 8.
6. REFERENCES

AFCET (1977): “Normalisation de la representation du


a
T1
cahier des charges d’un automatisme logique.” J. Au-
Initially A T1 a A*

T2 1
tomatique et Informatique Industrielle.
ÅRZÉN, K.-E. (1991): “Sequential function charts for
knowledge-based, real-time applications.” In Proc.
Third IFAC Workshop on AI in Real-Time Control.
Rohnert Park, California.
Fig. 8. A Grafchart and an identical Grafcet. DAVID, R. (1995): “Grafcet: A powerful tool for specification
The activation of the extra step assures that of logic controllers.” IEEE Transactions on Control
the step containing the impulse action is de- Systems Technology, 3:3, pp. 253–268.
GENSYM COORPORATION (1995): G2 Reference Manual, Ver-
activated. A transition with a receptivity that
sion 4.0. Gensym Coorporation, 125 Cambridge Park
is always true follows the extra step. When Drive, Cambridge, MA 02140, USA.
this transition fires the step with the impulse JOHNSSON, C. (1997): “Recipe-Based Batch Control Us-
action is activated again and its impulse action ing High-Level Grafchart.” Licentiate thesis ISRN
is executed. LUTFD2/TFRT--3217--SE. Dept. of Automatic Control,
Sweden. Available at http:://www.control.lth.se/ ˜lotta/pa-
pers.html.
4.8 Advanced features JOHNSSON, C. and K.-E. ÅRZÉN (1998): “Formal analysis
of batch recipes structured with Grafchart.” In FO-
The two features in Grafchart, parameteriza- CAPO’98 — Foundations of Computer Aided Process
tion and methods, cannot conveniently be re- Operations. Accepted for.
constructed in Grafcet. These two features are

Vous aimerez peut-être aussi