Read here how to install the GRAFCET Engine on a SIEMENS S7-300/S7-400 or a VIPA S7 controller.

The GRAFCET-Engine can be installed directly in the controller with GRAFCET-Studio. The IP address should already be configured and known.

  • SIEMENS S7-300 (>=CPU314) or S7-400
  • Ap. 64 KB of free RAM for the FBs and FCs in the GRAFCET Engine
  • Ap. 64 KB of free RAM for the DBs in the GRAFCET Engine
  • Min. memory of 71000 bytes
  • Min. remanence memory of 16000 bytes
  • The CPU must support the following number range: FC900-FC1024, FB900-FB1024, DB490-DB500

This ensures support for SIEMENS controllers from CPU 314 (128 KB RAM) and above. CPU312 is not supported, because it has only 32 KB of RAM. The PLC should support a max. block size of 64 KB. If your PLC is too old, this is unfortunately not the case and an error message will appear when downloading the Grafcet engine.

Recommendation: The MicroPLC and the SLIO from VIPA GmbH are best suited for the GRAFCET engine, as these CPUs achieve the shortest cycle times during our tests.

The following adapters are supported:

  • Network cable, if the S7-CPU is equipped with an Ethernet or PN connection.
  • SIEMENS MPI /DP adapter. The drivers (SIMATIC-NET) need to be installed on the PC. This is the case automatically if Siemens STEP7 V5.x or the TIA PORTAL is installed.
  • NETLink PRO adapter. Older CPUs can be connected to the PC via TCP/IP with this adapter.

A serial connection with a serial MPI adapter is not supported.

When you install the GRAFCET Engine, all user blocks are deleted before the GRAFCET Engine is transferred.

  1. Goto the GRAFCET-Engine window in GRAFCET Studio.
  2. Disconnect (if connected)
  3. Press the 'plus' icon
  4. Select an S7-300 or an S7-400 from the device list and define a name of your choice.
  5. Press the Ok button
  6. The settings dialog for the device is now displayed. Set the correct IP address and network card here
  7. Switch the PLC to Stop mode via the hardware operating mode switch.
  8. Press the Install GRAFCET Engine button. Now select the GRAFCET-Engine file and confirm the dialog.

An attempt is now made to establish a connection to the device. If this is successful, the GRAFCET engine is loaded into the controller. If problems occur, e. g. not enough memory available in the PLC, an error message appears. After download, switch the PLC state back to RUN mode.

The way to the 'Install GRAFCET Engine' button:

If you needed: You can now load the blocks of the Grafcet engine into your Step7 project with your programming system. In this way, you can continue to load the GRAFCET engine with your programming system into the PLC in the future. If required, you can supplement the GRAFCET with your own user program. It is important that the Grafcet engine in OB1 is called cyclically.

Once the GRAFCET engine has been transferred, it is immediately ready for use. There is already an OB1 and an OB100 that call the GRAFCET Engine correctly.

This section describes how to call the GRAFCET engine in OB1 if OB1 and OB100 do not yet exist.

Template for starting up the OB: In this case, the M0.0 flag is set to TRUE, so that you can recognise whether a start-up takes place in the OB1.

OB start-up (OB100) in instruction list (STL):

=     Set "CompleteRestart" //M0.0 to TRUE, so that start-up is recognized in the OB1

The GRAFCET Engine is called up in the OB1:

OB1 in instruction list (STL):

O     "CompleteRestart"   //M0.0
=     #InitGrafcet        //InitGrafcet is a temp variable, created in the OB1

 CALL "GrafcetStart"     //Call up the GRAFCET Engine (FC993) and transfer the information on whether to initialise
     Init :=#InitGrafcet

=     "CompleteRestart" //Set M0.0 to FALSE (very important!!!)

Please note: A bool operand needs to be transferred to the "Init" parameter, which is TRUE for the 1st cycle only (on start-up). The two lines after the CALL make sure of this. If the "Init" parameter is always TRUE, the GRAFCET Engine does not work.

You do not need to make any special settings in the CPU for the GRAFCET Engine to work.

A S7 controller now needs to be added as a device in the GRAFCET Engine window in GRAFCET Studio:

  • Select SIEMENS S7-300 from the list and assign it any choice of name.
  • Make the correct connection settings (e.g. IP address) and select the network adapter.
  • If you want to use a SIEMENS adapter, enable the appropriate option. This is only possible if a SIEMENS programming application is installed on the computer.
  • If you want to use NETLink PRO, then enable the appropriate option. Other settings appear afterwards, such as the MPI address.
  • Very important: Set the offset for the inputs and outputs (PLC address column) in the I/O settings. The default setting assumes that the digital input and outputs start at zero and the analog inputs and outputs at 256.

If your device has several modules for inputs/outputs, one type of modules (e.g. digital inputs) should be addressed in one range without gaps. Otherwise you can't access all signals with the Grafcet Engine.

After confirming the Settings for the S7-300... dialog, the new device appears in the list.

Select the new device in the list, and click on the Connect button in the GRAFCET Engine window.

If everything is correct, the window should now look as follows:

GRAFCET Engine Description
If the two counters are incremented, the GRAFCET Engine is correctly installed in the PLC and is called up in the OB1.

If the two values are not incremented, then check the following:

  • Are all the blocks for the GRAFCET Engine in the PLC?
  • Is the GRAFCET Engine called up in the OB1?
  • Is the PLC in RUN status)

If required, you can write your own code in STL, FBD, SCL, ... in addition to the Grafcet logic. The only important thing is that the Grafcet engine is still called in the OB1.

The following ZIP file contains a Siemens project (for Step7 V5.x) with read and write functions for Grafcet symbols: Download ZIP file with Siemens project

These functions require an address of the symbol. This address can be found in the Grafcet Studio symbol table in the DB address column.

With this function you can read and write any Grafcet symbol.

For the first test, you can write the following GRAFCET to the PLC. The GRAFCET makes the output "Q0" flash.

If you use the default settings, output "Q0" is connected to the output address "A0.0". As shown in the previous section, you can adjust the address freely with the I/O settings. If the PLC is correctly wired and the GRAFCET Engine is installed in the PLC, the output should now flash.

Check the following if problems occur:

  • Are the input cards/output cards correctly wired?
  • Are the I/O settings correct in GRAFCET studio?
  • Is the GRAFCET Engine installed and called up (see counter on the GRAFCET Engine panel)?
  • Is the PLC in RUN status?
  • Is the process image large enough? See section Cycle/Clock Memory in the hardware configuration of the CPU. If an input/output has the address 800, then the process image must cover this area. Otherwise Grafcet-Studio cannot access the input/output.

If required, you can write your own code in ST, FBD, LD or SCL in addition to the Grafcet logic. The only important thing is that the Grafcet-Engine is called in the OB1.

The following ZIP file contains a Siemens project (for Step7 V5.x) with read and write functions for Grafcet symbols: Download ZIP file with Siemens project

These functions require an address of the symbol. This address can be found in the Grafcet-Studio symbol table in the DB address column.

This makes it possible to read and write any Grafcet symbol.

For further interesting GRAFCET examples and "best practice" procedures go here.

This link provides you with examples of: