How-to Register a input to read an OPC UA value
Prerequisites
These steps need to be completed before continuing
Instructions
Open up the menu: Hardware \ OPC server
Select the OPC server and then click on the Open button
On the left side of the dialog select the: Inputs alternative and the click on the Create button and select OPC server value input
OPC Input address configuration
In order to build the correct address, we need to know some information about the OPC server setup.
An OPC UA tag address is defined by two components:
Namespace
Item Identifier
In RS production the complete address is built up by the following definition:
nsu=[Full namespace name];[identifier type]=[Identifier]
Identifier type
The identifier type can either be of type string or numeric, meaning it defines how the identifier will be stated. this gives either of these two constructs
For string (s):
nsu=[Full namespace name];s=[Identifier]
The identifier is defined by a string/text: s=Engine.Temperature
For numeric (i):
nsu=[Full namespace name];i=[Identifier]
The identifier is given by a numeric id: i=2048
Namespaces
The namespaces are defined in the OPC Server and you can find the namespace array in the Server section in the OPC server definition.
Connect with an external OPC UA Client to the OPC server and browse the definitions.
In the example below the OPC Client, UaExpert is used to browse the Server folder to find the NamespaceArray.
The Namespace array holds all defined namespaces in the OPC server.
At this server, there are five different namespaces defined.
The namespace array contains five positions and each position contains a full namespace, for example at the position with index 4 the namespace definition is:
That is the complete nsu string so if we start to define an OPC server address that is defined by using index 4 then the OPC Tag address would start with:
nsu=http://www.unifiedautomation.com/DemoServer/;[Identifier type]=[Identifier]
Item definition
Using the UaExpert client again to browse for a value that we want to register and start listening to in RS Production.
The details of the NodeId state that it is defined in the namespace with index 4 and the identifier is Demo.Dynamic.Scalar.Double.
Use the NamespaceIndex: 4 to check the complete namespace (nsu) using the namespace array:
At index 4 the namespace is: http://www.unifiedautomation.com/DemoServer/
Building the complete address that will be used in RS Production
nsu=http://www.unifiedautomation.com/DemoServer/;[Identifier type]=[Identifier]
The identifier type is String
nsu=http://www.unifiedautomation.com/DemoServer/;s=[Identifier]
The Identifier is Demo.Dynamic.Scalar.Double
nsu=http://www.unifiedautomation.com/DemoServer/;s=Demo.Dynamic.Scalar.Double
This gives the full address (NodeId) to the OPC server tag/item:
nsu=http://www.unifiedautomation.com/DemoServer/;s=Demo.Dynamic.Scalar.Double
Adding the OPC Value in RS Production
Field | Value | Field description |
---|---|---|
Name | Double value | A good readable name what the value is about. |
OPC server | Demo OPC server | |
OPC Address | nsu=http://www.unifiedautomation.com/DemoServer/;s=Demo.Dynamic.Scalar.Double | The complete address to the OPC tag / item |
Input mode | Subscription | The subscription mode updates automatically when the value is changes at the server. |
Save and close