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.
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.
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.
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.
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. Finally, check that in the Settings tab that the OPCUA option is enabled and then click on the Build botton.
In order to work properly, Codesys shouldn't be in Simulation mode. You can click in Online tab and then uncheck the option Simulation if it is enabled.