PLC programming
The new possibilities with Grafcet
Grafcet is a standard that has so far been used to describe the control function of a machine or represent a sequence control. New software now makes it possible to transfer the created Grafcet directly to any PLC platform.
The description of how a system works is one of the essential things in automation technology. The European standard 'Grafcet' with the identifier DIN EN 60848 was developed specifically for this purpose. The abbreviation stands for "Graphe Fonctionnel de Commande Etape Transition", which translates as: "Representation of the control function with steps and switching conditions". It is therefore ideal for describing step chains or sequence controls. Despite the advantages of creating a Grafcet for a system, the effort involved is often not put in. This is because after the planning phase, the Grafcet no longer has any use for many people. But what if the Grafcet could be transferred directly to a PLC?
Before answering this question and in order to understand the topic, an introduction to Grafcet is permitted at this point: those responsible for the standard have taken meticulous care to ensure that the necessary symbols are easy to draw and that the number of different elements is kept to a minimum. For these reasons, a Grafcet plan can also be implemented with little effort using pencil and paper. The essential elements are
- Steps (square):
A step can be active or inactive. If a step is active, the machine is currently in this state (e.g. a bottle is being filled). - Transitions (horizontal line that crosses the line of action):
The transition contains a condition. If this condition is fulfilled, the transition to the next step takes place, i.e. the next step becomes active. The previously active step is deactivated. - Actions (rectangle):
Actions are always assigned to a step. In an action, for example, an actuator is influenced. This could be a valve, for example. Several actions can be linked to this step. - Lines of action (horizontal and vertical lines):
The lines of action are used to connect the individual elements (steps, transitions, actions).

Artificial intelligence in production
BMWi project 'OPAK' completed
Software that largely programs itself - this is the goal that Lemgo scientists have been pursuing together with companies from the automation industry as part of the 'OPAK' project. After three years of research, the project has now been completed.
Grafcet also offers elements to create hierarchies and structures. These include, for example, the force-controlling commands with which, among other things, the conditions for the operating states (manual/automatic) of a system can be realized.
Figure 1 shows a simple Grafcet plan. What happens here? First, the so-called initial step with the designation '1' is activated. This means that the action to the right of it is also activated and the binary output 'Q0' is switched on. The condition of the subsequent transition is defined by the term '1s/X1'. This means that the transition is triggered as soon as step '1' is active for one second. During the transition, step '2' becomes active and step '1' becomes inactive. When step '2' is activated, output 'Q1' is also switched on. After step '2' has been active for one second, step '3' is activated and then after one second the return to step '1' takes place. Outputs Q0 to Q2 are therefore switched on one after the other for one second.
The power of Grafcet
Grafcet provides several variants of steps and actions with different properties. A binary link (AND, OR) can be formulated in the transition condition; edge evaluations, comparators and time behavior can also be implemented. Not only binary operands can be used within an action; the use of digital operands including arithmetic operations is also possible. All of this results in a powerful and easy-to-learn description language (a detailed description can be found in the Grafcet workbook - see 'Book tip').
When a new system is developed, the designers can describe the system sequence using Grafcet. Specialists from the fields of mechanics and electrical engineering thus have a basis for discussion that can be used to identify and solve the first problems as early as the planning stage. The need for actuators and sensors can also be estimated very easily. The machine's actuators and sensors are linked in a control program, which usually runs in a programmable logic controller. A PLC programmer must therefore create the control program, using the Grafcet as the basis for programming. The machine must then be put into operation. Here too, the Grafcet plays an important role: does the machine really work as the designers imagined?
The machine operator also has advantages if he knows exactly how his machine works. For example, it is not always necessary to call the service personnel in the event of a malfunction. The conclusion so far: If a Grafcet plan is available and up to date, it can be used very effectively.
Use in practice
Everyone knows that detailed machine documentation is necessary to ensure that a system can be successfully built, programmed, commissioned and maintained. The important thing is that the documentation must be up to date. This means that if changes are made to the system - regardless of their scope - the documentation must be updated accordingly. And this is where the problems usually start: When a system is modified, the programming must inevitably be adapted. If the Grafcet plan is not also changed meticulously, the programming and the documentation will diverge to such an extent that the original documentation cannot be used.
This is the reason why Grafcet has not become established everywhere in practice. A certain amount of effort is required to ensure that the actual state of the programming matches the plan. Ergo, the desire quickly arises here: If the effort is made and a Grafcet plan is created at the beginning, then the machine builder would also like to use it in the control system - programming and documentation would then no longer diverge.
Wishful thinking: Load Grafcet directly into the control unit
The desire to transfer a Grafcet to a controller is as old as the standard itself. The following scenario would be ideal: A Grafcet plan is created and its logic is transferred to a device - regardless of the manufacturer of the device. However, since Grafcet is not a programming language, but a description language, the question inevitably arises: How could something like this be realized?
Since manufacturers generally use different hardware and different programming systems, the solution would be a kind of 'Grafcet engine' - i.e. a manufacturer-dependent intermediate layer that is fed with manufacturer-independent Grafcet logic. In this way, a corresponding plan could be created and transferred directly to such a device - for example to a PLC. The resulting application scenarios or advantages would be:
- For smaller machines and systems (drilling device, sheet metal bending system and the like), the complete control program could be created with Grafcet.
- For larger machines and systems, sub-areas such as the step chains could be implemented in Grafcet. Applications such as PID controllers or motion control would continue to be programmed for specific control systems (e.g. in FBD, LD, SCL).
- In systems, certain processes could be changed or reprogrammed by the end customer (system operator). The end customer would then not need the PLC manufacturer's extensive programming tool, but could do this with a small, simple tool. The end customer's specialist personnel 'only' need knowledge of Grafcet and no PLC programming skills.
- Maintenance support: In addition to the 'normal' control program, a Grafcet specially developed for troubleshooting is stored in the PLC, which supports the maintenance staff if required. Here too, the PLC manufacturer's programming software would not be necessary.
- Documentation and programming are standardized.
- The PLC from manufacturer A is replaced by a PLC from manufacturer B: If the programming was done via Grafcet, the same Grafcet is transferred to PLC B without modification. Adjustments would only be necessary in the address assignment (symbolism).
- Use in training: Training devices could, for example, be equipped with an Arduino or Raspberry Pi and programmed with Grafcet.
From theory to implementation
The concept behind Grafcet-Studio: A Grafcet engine on the device ensures platform independence. Once the engine is installed on the device, it can be programmed with Grafcet-Studio.
© MHJ softwareWith this in mind, MHJ-Software has developed Grafcet-Studio, a Windows-based software program with the aim of putting the theory described above into practice. This software includes the following features, among others:
- Creation of a Grafcet according to DIN EN 60848;
- Simulation of the Grafcet on the PC (Grafcet engine runs on the PC);
- Transfer of the Grafcet logic to the device;
- Monitoring the Grafcet: The status of the transition conditions (True, False, time delay) is displayed as well as the status of the individual steps.
- Loading an existing Grafcet logic from a device.
- The following target devices are planned: Siemens S7-1200/1500/ 300/400 controllers, Arduino boards and the IoT gateway IOT2000 from Siemens.
In view of the features listed, the question may arise: Can Grafcet completely replace the device manufacturer's programming software? The answer to this is 'no', as the first step is to prepare the controller to be used for Grafcet Studio. This means that the engine must be installed on the device using the device manufacturer's programming software. Furthermore, the inputs/outputs must be parameterized (addressing, measuring ranges of the analogue inputs, output ranges of the analogue outputs). Only then can the device be used with Grafcet-Studio. If these settings are constant for a system type (e.g. for series machines) and a device can accept this data by inserting an external storage medium (e.g. a memory card), then the preparation process is only necessary once for each system type. Another limitation: Grafcet-Studio currently supports a maximum of 255 steps.
The platform independence of the Grafcet engine also has a disadvantage: a sequence chain processed by it is not as performant as a step chain developed in the native programming languages (SCL, AWL). However, this is only relevant for time-critical applications.
In a nutshell: Grafcet is not a programming language, but a description language for sequence controls. Therefore, there will always be cases where a Grafcet plan only makes limited sense. However, there are also applications where a Grafcet programming system is a very elegant solution. All small and medium-sized sequence controls without control, motion and communication tasks are ideally suited for this - for example:
- drilling rigs
- machining stations
- Sheet metal bending devices
- Extraction systems
Less suitable or not fully feasible are extensive machines and systems with distributed control systems or very time-critical processes where every millisecond of cycle time counts. Here, the Grafcet can only take over part of the system control.
Author:
Matthias Habermann is Managing Director of MHJ-Software.
Book tip: Grafcet-Workbook
The book Grafcet-Workbook (ISBN number: 978-3-9816720-7-7) deals with the description language Grafcet DIN EN 60848 on 120 pages. The most important elements and facts of the standard valid in Europe are presented in ten learning phases. The book includes two software products without runtime restrictions: Grafcet-Studio Starter and PLC-Lab-Runtime. With Grafcet-Studio, the reader can draw the numerous exercises in the book and also simulate them on the PC. A virtual 2D system is provided for all exercises via PLC-Lab-Runtime. A total of 30 virtual systems are included.












