You are on page 1of 30

GRAFCET: A Powerful Tool for Specification of Logic Controllers

OS3URV 2012

History
1975 Decision of the workgroup "Logical Systems" da AFCET (Association Franaise de Cyberntique Economique et Technique) on the creation of a committee to study a standard for the representation of logical systems and automation 1977 GRAFCET definition (Graphe Fonctionnel de Commande Etape-Transition). 1979 Dissemination in schools and adopted as research area for the implementation of solutions of automation in the industry. 1988 - GRAFCET becomes an international standard denominated as "Sequential Function Chart, IEC 60848, IEC 1131-3 GRAFCET is referred to as Sequential Function Charts (SFC).

Industry needs:
Describe the sequence of states of a discrete-event system which may contain a very large number of states Take into account the concurrency (for both simplicity and easy understanding), since some subsystems may be partially independent. Generally, given a state of the system, only a few inputs affect the state, and only a few outputs may change. Then, describe only the behavior corresponding to these input changes. Have a clear understanding of the input-output behavior of a logic controller, i.e., what is the control applied to the process to be controlled (output of the PLC) as a function of a change of the process or its environnment (input of the PLC).

Motivation tank filling

Motivation tank filling


A roman symbol represents a device (sensor or actuator) and an italic symbol the corresponding Boolean variable. Tank 1 is empty when the level is less than b1, i.e., b1 = 0, and is full when the level is greater than h1, i.e., h1 = 1. At the initial state, both tanks are empty. If push button m is pressed, both tanks are filled by opening valves V1 (V1=1 means that valve V1 is open) and V2. When a tank is full, e.g., tank 1, filling stops (by closing valve VI) and its contents start to be used (by opening valve W1). When tank 1 is empty, valve W1 is closed. Filling may only start up again when both tanks are empty and if the button m is pressed.

Example
Grafcet - The squares labeled 1 to 6 are steps, i.e., components of states. At initial time, the steps in the set {1, 4} are active. Then transition (1) which follows these steps can be fired as soon as the Boolean variable m, associated with (1), has the value 1. After this firing, steps 2 and 5 are active. When step 2 is active, the output V1 = 1 (represented by V1 written in a rectangle associated with step 2). When step 2 is active, transition (2) can be fired if h1 = 1. And so on

GRAFCET graphical syntax


Grafcet has a graphical syntax Steps - drawn as squares, Transitions - represented as bars The initial step is represented as a double square Grafcet has support for alternative and parallel branches

BASIC NOTIONS
A grafcet is a graph having two types of nodes:
Steps Transitions

Grafcet contains at least one step and one transition). Directed arcs either connect a step to a transition or a transition to a step.

Steps
A step is represented by a square A step may have two states:
active (this is represented by a token in the step) as is the case of step 2 inactive as is the case of step 1

Inactive Active Initial

1 2

The steps which should be active when the system is started and represented by a double square - initial steps (step 3). Actions are associated with the steps, and these are the outputs of the grafcet. To each step one or several actions can be associated. The actions are performed when the step is active.

Transitions
The transition symbol is a bar, but the latter must be preceded or/and followed by a double bar in some cases. It is preceded by a double bar when two or more arcs join this transition [transitions (2) and (4)]; this implies that it involves waiting for multiple input steps to be active before firing the transition. A transition is followed by a double bar when two or more arcs leave this transition [transitions (3) and (4)]; this implies that it involves activating multiple output steps when the transition is fired. A receptivity will be associated with each transition ( ).

Directed Links (or Arcs)


The representation of directed links (or arcs) is illustrated. A directed link must always run from a step to a transition or from a transition to a step. When two or more directed links join the same step, they are grouped together as is shown in figure for arcs (3) -> 2 and (4) -> 2. When two or more directed links leave the same step, they have a common departure point as is shown in figure for arcs 3 -> (5) and 3 -> (6). A vertical arc running from bottom to top must be marked by an arrow.

Firing of Transitions
A transition is firable if both the following conditions are met:
All the steps preceding the transition are active (the transition is said to be enabled) The receptivity of the transition is true.

These operations (activation and deactivation) are carried out simultaneously. Firing of (1) leads from the situation { 1 } to the situation {2,3}. Then firing of (2) leads to the situation {2, 4}, and firing of (3) leads back to the initial situation

When a receptivity is true?


Lets consider three cases: the receptivity is a:
condition (i.e., a Boolean function), an event, or both a condition and an event.

Actions and Outputs


There are two major categories of actions,
Level action is modeled by a binary variable and has a finite duration. Action remains set all the time while the step, to which the action is associated, is active.
Unconditional Conditional

Impulse actions is responsible for changing the value of a variable. An impulse action is carried out as soon as the step changes from being inactive to active.

Actions and Outputs


Action B* is an impulse action. The asterisk was recommended at the origin of Grafcet to indicate the impulse character of an action. It does not always, however, serve a purpose. For example, incrementing a counter C can be written as (C <- C + 1)* or simply (C <- C + 1) since there is no ambiguity concerning the impulse character of this action.

Stable/unstable situations
A situation can be If the transition following a step is immediately fireable when the step becomes active, the situation is said to be unstable. An impulse action is carried out even if the situation is unstable A level action is performed only if the situation is stable. Between two different external events it is assumed that there is always enough time to reach a stable situation.
stable or unstable.

Unconditional/Conditional
Unconditional Conditional

Concurrency and Synchronization


From the situation {1}, the situation {2, 3} is reached by firing transition (1) as soon as a <- 1. From this time, there is a concurrency between what happens in the part {step 2, transition (2), step 4} on the one hand, and in the part {step 3, transition (3), step 5} on the other hand, Transition (4) corresponds to a synchronization since both steps 4 and 5 must be active before it is fired

Dynamic behavior
The dynamic behavior of Grafcet is defined by five rules 1. The initial situation of a Grafcet is determined by its initial steps. 2. A transition is enabled if all of its previous steps are active. A enabled transition is fireable if its associated receptivity is true. A fireable transition is immediately fired. 3. Firing of a transition results in deactivation of its previous step and a simultaneous activation of its following steps. 4. Simultaneously fireable transitions are simultaneously fired. 5. If a step is to be simultaneously activated and deactivated it remains active.

Example tank filling

The controlled system is the same. The control specifications are modified:

Tank Filling Modified

The filling process is no longer allowed if the button m is pressed (i.e., if m = 1) but it is triggered by pressing push button m (i.e., by m). A counter is added: the value C in the counter represents the number of cycles (emptying and filling of Tank 2).

Example

A system consisting of a tank is shown. The tank has an inlet valve V1 and an outlet valve V2. There are two level sensors L0 and L1, one temperature sensor T and one heater Q.

Example
When the system is started, valve V1 should open and the filling should start. When the level in the tank reaches L0, the heating should start. The tank is now heated and filled in parallel. When the level in the tank reaches L1 the filling is stopped and when the temperature reaches T the heating is stopped. When both the right level and the right temperature are reached, the tank is emptied. This is done by opening the outlet valve V2. When the system is empty, the sequence can be restarted.

Example (Algorithm)
1. 2. Initialization: activate the initial steps and execute the associated impulse actions. Go to Step 5 When a new external event occurs, determine the set T1 of transitions fireable on occurrence of this event. If T1 is not empty, go to Step 3. If T1 is empty, modify, if necessary, the state of the conditional actions associated with the active steps. Go to Step 2 and wait for a new external event. Fire all the fireable transitions. Go to Step 6 if the situation remains unchanged after this firing. Execute the impulse actions associated with the steps that became active at Step 3. Determine the set of transitions, T2, that are fireable on the occurrence of the event e, i.e., the transitions that have a receptivity that is always true. Go to Step 3 if T2 is not empty. A stable situation is reached
Determine the set A0 of the level actions which should be deactivated. Determine the set A of the level actions that should activated. Set all the actions that belong to A but not to A to 0. Set all the actions that both belong to A and to A to 1. Go to Step 2.
1 0 1 0 1

3. 4. 5. 6.

a) b) c)

A Grafcet can be defined as a 5-tuple = { , , , , } where:

Formal Definition

Example

Example: modeling a control/automation system

Example of the control of a press


A press for compressed powders works as shown on the grafcet of figure. When the press is in stand-by at step 1, the stamp and the die are in high position and a "ready" signal is lighted to indicate to the operator to put in a new charge. The actions are successively performed as shown on the grafcet.

You might also like