OPCUA integration with Codesys and ControlWin V3

This chapter 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 the code programed in Codesys against a Simumatik system.

Warning

In order to have OPCUA connectivity with Codesys, you need to download the program to a real compatible PLC or the Codesys ControlWin V3 soft-PLC. Simulation needs to be disabled.

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.

Codesys

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.

alt text

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.

alt text

Warning

Don't forget to set the I/O bytes names to the same ones as in Simumatik (by default inputs / outputs).

Moreover, make sure that the GVL is set to "Link always", as shown in the figure below by right-clicking in GVL and selecting the tab properties/build.

alt text

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

alt text

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

alt text