Grafcet examples

Here you will find Grafcet examples that could be useful for your daily work. Step chains can be created very easily in Grafcet. These examples also highlight other practical cases, such as manual operation. Here it becomes clear that Grafcet can be used very well not only for the realization of step chains.


The flashing light here is switched on over input I1.

Example No. Explanation
1 An effective example of how to quickly program a flashing light in Grafcet. The BlinkFlag symbol is assigned to the Data group in the table of symbols and serves as a buffer memory
2 The simplest way of creating a flashing light in Grafcet.
3 A flashing clock pulse is used here, which is supplied by the PLC. This example only works if the PLC (the device) specifies a flashing clock pulse. The ClockFromPLC symbol is assigned the Data group in the table of symbols and must be described in the PLC.

Manual/Automatic/Emergency stop

Operating states like manual, automatic or emergency stop are realised in the Grafcet chart using what are referred to as overriding commands. To this end, Grafcet charts are combined into groups (frameworks) and these can then be "activated" and "deactivated" using the overriding commands.

This example consists of 3 parts:

  • Main Grafcet: This is where the switch-over between manual, auto, emergency stop, etc. takes place. Forced control commands are used here (rectangle with double frames)
  • Grafcet for automatic operation
  • Grafcet for manual operation

States in the main Grafcet:

State What step is active?
Emergency stop Step 1
Control Off Step 2
Control On Step 3
Hand Step 4
Automatic Step 5

Main Grafcet:


The main Grafcet has the task of switching between the operating states. If automatic mode is active, manual operation is deactivated via forcing and vice versa. Since the emergency stop switch can be pressed in any state, it (S3EmergencyStop) is represented in every alternative branch.

Automatic mode:


Automatic mode is a simple step chain with a loop back jump.

Manual operation:


Manual operation is solved here by continuously active initial steps and an action on event. A step chain is not necessary here.

Doing two things at the same time

If you want to start two or more things simultaneously in a step sequence, you should use the parallel branch in the Grafcet chart. Alternatively, you can also draw a separate Grafcet with its own initial step. This variant would then be separate to a step sequence.

Case Study:


Two hydraulic cylinders are to be extended simultaneously. If both cylinders are fully extended, a pump should be switched on for 3 seconds and at the same time the cylinders should be retracted again. The speed of the two piston rods varies during retraction and extension. When both piston rods are retracted again, the system is ready for the next operation.

The retraction of the 2 cylinder rods takes different lengths of time. The extension of the piston rod must be switched off at the correct time (if extracted). Therefore, a parallel branch is used here. Synchronization is not necessary in this case.

Further explanations of the proposed solution:

  • The process is started when the start button is pressed. Both piston rods must be retracted.
  • After starting, both piston rods are extended at step 11.
  • If both piston rods are extended, steps 6,7 and 8 are activated simultaneously.
  • The pump is switched on via step 6 and switched off again after 3 seconds.
  • Step 8 switches off the extension of both cylinders and simultaneously activates the retraction of the piston rods from both cylinders.
  • Step 7 is deactivated when cylinder 1 is retracted again
  • Step 8 is deactivated when cylinder 2 is retracted.
  • After the time has elapsed and when both piston rods have been retracted, step 1 is reactivated and the system is ready for a new operation.


Why are parallel sequences necessary here? Because the two cylinders retract at different speeds, and therefore the switch-off of the retraction must be controlled separately for each cylinder.

Counter, comparator

You can realize a counter with an addition in an action and you can realise a comparator within a transition in square brackets.

In the Grafcet on the left, the value of the Counter symbol is incremented if step 2 is active and I0 is present as a rising edge. The value of the Counter symbol is reduced by 1 if step 2 is active and I1 is present as a rising edge.

After step 2, the transition condition consists of a comparison. If the value of the counter is larger than 5, step 3 is activated. Note: A comparison must always be set in square brackets.

In the right-hand Grafcet, I2 and I3 are evaluated at any time*. If the rising edge is I2, an increment takes place, and if the rising edge is I3**, a reduction takes place.

Evaluating selection switches

Two possible solutions for evaluating a selection switch are shown here. The figure on the left shows a step sequence with alternative branches and the figure on the right shows 3 separate initial steps, each of which has an action with an assignation condition.

The steps sequence would be used if the selection switch is used to activate a next step.

The individual selection switch positions (S1, S2, S3) are mutually locked. This may be dispensed with if the selector switch ensures that only one position is ever active at the same time.

Staircase Light

The staircase light function shown here should function as follows: If button S1 or button S2 is pressed, then a light should be switched on. The light should then be switched off again after 30 seconds. This is what a possible solution in Grafcet would look like:

If you would like to switch a second light separately, you simply need to draw the same Grafcet with other symbols on the right adjacent to it.

Impulse relay (Eltako)

Here is a simple example of how to map a impulse relay function. The rising edges for S1 and S2 are evaluated here:

The output can be switched on and off again by pressing S1 or S2. S1 and S2 are manipulated with buttons.

Another very simple solution (Grafcet Studio or newer required):

Implementing manual mode

Manual mode does not usually consist of a step sequence. If manual mode is switched on, certain outputs should be switched when certain buttons are pressed. This can be implemented relatively easily in the Grafcet.

The recipe for a manual mode: You use an action on event and connect it to an initial step. This means that the action is always executed when the condition for the event is true. Example:

In this example, there are three initial steps with one action on event each. The event definition always contains the manual operation (P2ManualOn) in an AND operation. This ensures that the action is only active in manual mode.


This example is also a proof that Grafcet can be used very well not only for step sequences.

Normalising an analog value

This example shows how to define constants and continuously normalize an analog value.

The initial step "8" (always active) is connected to actions (Stored action on activation) which are written once. Values are written to the symbols "K2","K1",... here. These symbols (constants) are used in the scaling at step "7". An action on event is connected to the initial step "7". Since a "1" has been entered in the condition of the event, the action is executed with each cycle. The term in the action is therefore processed again and again. The symbol "AnalogNormiert" is used to store the current standardised analog value.


Note to "1" as definition of an event: Normally the specification of "1" as event does not make sense. This has a special meaning in Grafcet Studio. In this case, the action is executed in every Grafcet cycle.

Working with the time (RTC)

In order to evaluate the time in the Grafcet, the current time must be written to Grafcet symbols in the PLC program. In Grafcet-Studio, the following symbols (names are random) are created in the Data area:

It is important that the group "Data" is set up correctly and that the data types are created correctly (here UInt8 and UInt16).

Here's the Grafcet to turn on a lamp at 10. Dec. 2018 8:10 p.m. and turn it off again at 10. Dec. 2018 8:15 p.m.:

In this Grafcet the time is checked every 3 seconds to save cyclic time. If both actions were linked to an initial step, the time would be checked in each cycle, but this would unnecessarily stress the PLC-CPU.

In the PLC program, the current time must be written to the Grafcet symbols. Use the provided function SetGrafcetSymbolUInt8 and SetGrafcetSymbolUInt16. These functions expect the Offset in the first parameter (see symbol table column DB address) and in the second parameter the value to be written.

Using clock memory bytes

To be able to use the clock memory byte of the PLC, it must first be switched on in the PLC via the hardware configuration. With the provided function SetGrafcetSymbolBool the desired bit can now be written into the Grafcet symbol. Here's the symbol definition in Grafcet Studio:

In the PLC program, use the function SetGrafcetSymbolBool:

CALL  "SetGrafcetSymbolBool"
       Offset :=150
       Value  :="PLC_TICK"

The offset 150 was taken from the symbol table (DB address column). To let a lamp flash when the I5 symbol is true, the following Grafcet is required:

Two-hand triggering

Two-hand triggering: An action should be performed when the operator presses two buttons simultaneously (within 200ms). This is to ensure that both hands of the operator are outside the danger zone. After some deliberation, the following solution has been found:

The condition "Condition1" is fulfilled if the operator presses the push-buttons S1 and S2 simultaneously (tolerance=200ms). This was realized by a source and final transition. Step "7" is active for 200ms when push-button S1 (Hi-Edge of S1) is pressed. Step "8" is active for 200ms when button S2 (Hi-Edge of S2) is pressed. If both steps "7" and "8" are active at the same time, then the two-hand triggering is fulfilled. X7 and X8 are contained in the "Codition1" as AND operation.

Filling level control (Min, Max)

The filling level of a container is to be continuously checked. If the level meter returns '0', then the output MinLevel should be TRUE. and if the level meter returns '9' then the output MaxLevel should be TRUE. The 1. solution is based on three alternative branches and the 2. solution on comparisons within the actions. As you can see, the 2nd variant is much shorter than the 1st solution.

1st solution:

2st solution: