MauroRiboniMX_1-1661329487966.png

Connect OPC UA client to MLC and Siemens S7 OPC UA server

MauroRiboniMX
New Contributor
Disclaimer

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.

Use Case

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.

Equipment used

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:

MauroRiboniMX_0-1661329158628.png

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.

MauroRiboniMX_2-1661329523710.png

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).

MauroRiboniMX_0-1661329806952.png

Fig. 3.: Add a client

MauroRiboniMX_1-1661329973913.png

Fig. 4.: Add endpoint and a username and password

 

MauroRiboniMX_0-1661330832703.png

Fig. 5.: Adjust configuration

ctrlX client connected

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).

 

ctrlX datalayer

Fig. 7.: Datalayer

opc client presistant

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)

MauroRiboniMX_0-1661332071001.png

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).

 

MauroRiboniMX_2-1661332323059.png

Fig. 10.: Setup clientname

opc client autoconnect

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! 😎

MauroRiboniMX_0-1661332678320.png

 

 

 

Must Read

Trending

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist