Read here how to use the GRAFCET engine on the Siemens IOT2020/2040 and then download a GRAFCET chart into the device.
You need GRAFCET-Studio version 188.8.131.52 or newer!
As with the Raspberry Pi, a Python3 script is started and subsequently the IOT can be programmed via Grafcet-Studio using the Grafcet standard. The communication between Grafcet-Studio and the IOT is also realized via the MQTT protocol. See also the description for the Raspberry Pi.
The combination of IOT2020/IOT2040 and Grafcet Studio offers the following possibilities:
Further advantages of Grafcet Studio:
For the setup of the SIEMENS IOT there is also a PDF from Siemens: Link.
The IP address of the IOT is preset to 192.168.200.1. You should therefore set your network card to the same subnet, e.g. 192.168.200.10. Tip: Connect a USB network adapter. The IP address of this adapter can then be set independently of your standard network card.
If the connection with PuTTY is established, you can log in as "root". Then start the setup program by entering iot2000setup:
In the menu Software->Manage Autostart Options you can enable the option Auto start Mosquitto Broker:
After the reboot, the MQTT Broker is available. In Grafcet-Studio you can simply enter the IP address of the IOT2000 in the Device settings.
In the network settings you should set the new IP address to dhcp. Then the IOT receives a suitable IP address from the DHCP server in your local network. Via the log files of the router you can find out which IP address was assigned.
The Grafcet engine (Python3 script) communicates with Grafcet Studio via MQTT. Therefore the library "paho-mqtt" must be installed. This library is used by the Grafcet engine. Connect via PuTTY and enter the following command:
pip3 install paho-mqtt
Download the following ZIP file:
In the ZIP file you will find these files:
|1||Import the Grafcet engine.|
|2||Creating a Grafcet Engine Instance.|
|3||Set MQTT connection. The 2nd and 3rd parameters must match the setting in Grafcet Studio.|
|4||In the loop: Editing the Grafcet logic.|
Note: This example script lacks access to the hardware inputs and outputs. The Grafcet engine provides functions (read... and write...) to write the Grafcet inputs and read the Grafcet outputs. So that the Grafcet logic can use the hardware inputs and outputs, the states (values) of the inputs must be written cyclically to the Grafcet inputs. And the states of the Grafcet outputs must be written to the hardware outputs. The description of the functions can be found here.
How to add the device in Grafcet Studio:
|1||Display the Grafcet Engine window and press the Plus button.|
|2||Select as Device: "Grafcet Engine MQTT".|
|3||Enter a name of your choice. This name will then appear later in the selection list|
|4||Press OK button|
|5||IP address of the IOT2000. The MQTT Broker (Mosquitto) must then be started on the IOT.|
|6||Topic1 is any identifier that must be identical in the Python script.|
|7||Topic2 is any identifier that must be identical in the Python script.|
In case of connection problems please check the following: