Read and Write of multiple items
The application of the data access use case can be divided into three phases:
-
Preperation
-
The function block UA_Connect is used to create a transport connection of an OPC UA session between the Client PLC application and any OPC UA Server. The UA_NamespaceGetIndexList is to be performed once to get the namespace index, where the nodes to be accessed are hosted. Also the NodeHdl for a specific node is to be retrieved once. It can be done with the UA_NodeGetHandleList functionblock for several nodes concurrent.
-
-
Data access operation
-
Read and write can be performed as frequent as necessary with the UA_ReadList and UA_WriteList function block.The Client supports up to 4k of data per request.
-
-
Clean up
-
Once the communication is done, the node handle is not required anymore and shall be released via the use of UA_NodeReleaseHandleList for all relevant handles. The connection handle shall be released using UA_Disconnect.
It-s possible to manage multiple sessions (max. 6) with the same function blocks. For this purpose, a handle for the connection, NodeID, and so on is used.
-
For the first steps, to programm an OPC UA Client application, it is possible to connect the Lenze OPC UA Server on the same Controller. For this purpose, the ServerEndpointUrl "opc.tcp://localhost:4840" can be used.