Codesys, Integration


This course explains the steps to create PLC tags and enable OPCUA communication between the Simumatik Gateway and Codesys ControlWin V3. This will allow you to run code programmed in Codesys against a Simumatik system.

In this example the data that will be transfered is:

  • ‘inputs’: A PLC input byte addressed to %IB10.

  • ‘outputs’: A PLC output byte addressed to %QB6.course


First of all, in your codesys project create a “Global Variable List” in order to define the variables of the PLC. Right-click on Application and click on Add Object.

Once the GVL is created, the next step is to create the I/O signals. The output variables uses a Q memory address and the input ones uses a M memory, due to a limitation of Codesys which doesn’t allow to modify the I memory addresses.

Moreover, make sure that the GVL is set to “Link always”, as shown in the figure below. Right-click on GVL, select Properties… and finally go to the Build tab.

Once the variables are defined, a “Symbol Configuration” object needs to be created in order to link the variables to the OPCUA server.

It is enough to just mark the “inputs” and “outputs” variables in Symbol Configuration. Finally, check that in the Settings tab that the OPCUA option is enabled and then click on the Build button.

In order to work properly, Codesys should not be in Simulation mode. You can click on the Online tab and uncheck the Simulation option if it is enabled.


Issue for Codesys V3 SP17 and higher

For the gateway to work with Codesys V3 SP17 or higher, the following settings regarding communication policy setting needs to be changed. Check the box Allow anonymous login in the window Change Communication Policy.

Time to play!

After going online in Codesys, the Gateway must be connected in Simumatik so that the connection between the two is possible.

Finally, you can click on play and the status of the PLC will change to ‘RUNNING’.

We hope you enjoyed this introductory tutorial. Being able to use the tools you normally work with is a huge strength in Simumatik. Head over to our Community Forum to discuss PLC programming, virtual commissioning or to get support from our technical support team!

Thank you!