This guide explains how to connect to a Rexroth MLC opcua server. The same procedure should work and has been test even with siemens S7 OPC UA server, however in this case the app behavior could vary depending on the Siemens side configuration and version.
This is just an example which must be modified and adapted by the user to match the application requirements.
Node-Red OPC UA client is very versatile and easy to use. Furthermore, can be used in a real huge variety of cases. Anyway, could happen that, due to versioning problems or its low efficiency cannot guarantee a consistent behavior.
It is then suggested to use the official boschrexroth OPC UA client in order to avoid problems in the long term usage.
The test has been done with:
- XM22 with Iindraworks Engineering 14v22P13 - IP address 192.168.1.60
- Opcua Client 1.16
- Node-Red 2.2.2 with boschrexroth node: node-red-contrib-ctrlx-automation 1.8.18
- ctrlX CORE software release 22.07 - IP address 192.168.1.1
1 - Setup a Basic MLC Project and Switch together the devices
We need to setup a server and some variables in exchange in order to interact with the MLC. The project is attached to the guide and it must be loaded to the XM control. This is how it looks like:
Fig. 1.: MLC project
From network point of view the setup is really simple. The ctrlX CORE XF10 port has the standard IP address: 192.168.1.1. The XM22 XF5 port IP address is 192.168.1.60. Both are in the same subnet with 255.255.255.0 as subnet mask.
Fig. 2.: Network configuration
2 - Setup and test OPC UA client connection
Starting with a ctrlX CORE with already the OPC UA client installed we just need to select it from the sidebar and click the "+" button (Fig 3). We need to: Inset the clientname, the MLC endpoint (in this case is opc.tcp://192.168.1.60:4840) and a random username and password (Fig 4). The configuration must be modified in order to meet the server configuration (Fig 5) which is used with anonymous access and no security. It's now then possible to try the configuration clicking on the connect button (Fig 6).
Fig. 3.: Add a client
Fig. 4.: Add endpoint and a username and password
Fig. 5.: Adjust configuration
Fig. 6.: Test connection
3 - Set connection to be persistent
If we want to keep the client configuration even after the reboot (which is usually what is needed) we need to set the right property inside the client datalayer node. We need then to access to the datalayer (Fig 7). Looking inside the "opcuaclient" node we find our client precedently created, we need to set its "persistent" attribute to True (Fig 8).
Fig. 7.: Datalayer
Fig. 8.: Persistent Setting
4 - Autoconnect client at boot
There are various ways to achieve this result. One of the easiest is to use node red with the datalayer node: we need to subscribe to the client state and write the connect bit when needed (Fig 9). (really thanks Maurus for your example)
Fig. 9.: Autoconnect Example
The example can be modified to achieve the wanted result (we may have more conditions to be satisfied). If we choose a clientname different from myClient we need to modify the flows to match the right path (Fig 10-11).
Fig. 10.: Setup clientname
Fig. 11.: Setup clientname
5 - Use the client
The client shares all the Server variables inside the datalayer. Choose your way to interact with it! 😎
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.