Connecting to a real PLC

Connect to a real PLC

This chapter shows how a real PLC on the same local network can be used to execute the code and connect to the digital twin in Simumatik. First click on the PLC in the project and then on the Download to device button in the toolbar.

This will open a window with communication settings. Select the Ethernet card to be used in the list for PG/PC interface.

Click Start search and wait for the PLC to be added to the list. Continue by clicking Load at the bottom right, then Load without synchronization and select Stop all in the following boxes.

Settings in Simumatik

Load a system to the Simumatik Workspace, or create a new system, that contains a PLC component, either one of the generic types (such as PLC 8DIO, PLC 16DIO 4AIO and PLC Rack Logic Module Generic) that can select driver_type or one that is predefined for Siemens (such as s1200 controller).

Click on the PLC component in Simumatik, select the s7protocol as driver_type in the variables pane and make sure that the setup_params includes the correct IP address, rack and slot for the PLC.

Rack and slot

Select according to PLC type:

  • S7-300: Rack 0, slot 2
  • S7-400: Rack 0, slot 2 or from HWConfig
  • S7-1200/S71500: Rack 0, slot 1

Set the variable names to match the tag defined in the PLC. S7_protocol uses the tag address as variable name. For instance to access input byte 3 the variable name needs to be IB3. Currently supported data types is as follows.

Now the emulation can be started. Make sure the gateway is connected. Then click the Play button on the toolbar to start the emulation.