Industrial Automation Tech Note 57 - TNIA57
This document describes using the OPC UA Client Driver.
CR Series HMI / DA Series Data Station / Graphite Controllers and HMIs
Use Case: Using the OPC UA Client Driver
The OPC UA Client in Crimson 3.1 is largely the same as any other TCP/IP communications.
Referring to Figure 1, create a new database and select one of the Protocol slots under Network in the Communications category.
Referring to Figure 1, press the Pick button and select the OPC UA Client driver, as shown in Figure 2.
Click on the device created by clicking the OK button in Figure 2. The options shown in Figure 3 will be available.
In this example, we are going to configure our OPC UA client to talk to an Ignition OPC UA Server running on the PC with IP address 192.168.1.217 and listening on port 4096. (This is not the port 4840 used as standard by OPC UA Servers, but it is the default for Ignition.) In the window shown above, perform the following actions.
- In the Host Name box, enter 192.168.1.217
- In the TCP/IP Port box, enter 4096
- Leave the User Name and Password fields empty.
If you want to follow along with this example using your own Ignition installation, you must make two changes to the default OPC Server settings via the Ignition web interface. First, select the checkbox labelled Allow Anonymous Access, and second, select the checkbox labelled Expose Tag Providers. If you do not wish to enable anonymous access, ensure you have created a suitable OPC UA user via Ignition’s security system and enter the username and password into your Crimson 3.1 configuration. You might also want to create some tags within Ignition for Crimson to access. In this example, we have tags called Bob, Fred and Jim.
Browsing from Crimson
Since our configuration PC is running on the same network as the Ignition OPC UA Server, we can use the Crimson 3.1 configuration package to automatically create the browse file and thereby enumerate the data items contained in the server. To do this, in the window shown above press on the link labelled Download Data Model from Device and enter a suitable filename in the dialog box that appears. After a short delay, a message will appear indicating that the browse operation completed, and letting you know how many data items were discovered. If an error occurs, recheck your Host Name and TCP/IP Port, and ensure that the Ignition OPC UA Server is configured to allow anonymous access.
* Note that there is a 1-minute timeout in Crimson, so if it takes longer than one minute to gather all of the tags, the import will fail. Please refer to the Browsing from the Command Line section for details on using the OpcBrowse utility.
The data model will now have been saved to a text file at the location you specified, and the device settings updated to reference this file. Referring to Figure 4, look at the Devices section of the Resource Pane, you will ee that the DEV1 node has been populated with the data model that was discovered…
In this example, the server is exposing tags called Bob, Fred and Jim, plus a wide variety of diagnostic and performance information. The data items can be dragged from the Resource Pane into gateway blocks, or can be mapped to tags in the usual way by selecting the device name from the button next to the tag’s source.
The browser shown in Figure 5 can be used to select the tag source from the OPC UA Data Model. Tags shown in red are writable, while those shown in the green are read-only. The icon represents the data type in the usual way, with all the tags in this example being integers.
Browsing from the Command Line
It is possible that your OPC UA Server will not be reachable from the PC on which you are running your configuration software. In this case, you must create a browse file by running a simple command line utility on a PC that has network access to your device. The utility is called OpcBrowse and it is installed in the Utils subdirectory under the Crimson 3.1 installation folder.
An example invocation of the utility is shown below…
OpcBrowse -u user -p pass opc.tcp://192.168.1.217:4096 server.opc-ua-browse
The -u and -p options are used to provide the user name and password and may be omitted. The next element is the URI of the OPC UA Server and contains both the hostname and the TCP/IP port. The opc.tcp:// portion can be omitted, as can the port number. If the port number is not provided, it will default to 4840. The final element is the name of the file to which the Data Model information should be saved. You may use any name, but the extension opc-ua-browse is recommended. A single period will route the output to stdout.
Once this file has been created, return to Crimson 3.1 and select the Pick button next to the Browse File box in the OPC UA Client device configuration. You will be prompted for the path to the browse file, and after the file has been imported, the appropriate data items will be created.
Debugging OpcBrowse Problems (requires Crimson 3.1 Build 3116 or later)
The -d switch is provided for debugging purposes. Use the same arguments as the previous attempt, but add the -d switch and specify the location to store the OPC tag file:
OpcBrowse -d 192.168.1.217 C:\users\dany\desktop\server.opc-ua-browse
Copy all of the debug text from the command-line (right-clicking in the command-line, choosing Select All, and then pressing the Enter key will copy all of the text in the window) and paste it into a text file. Sending this debug file to email@example.com will allow our support team to assist in getting OPC UA communications functional.
Importing an XML File
Another option to pull in tags from the other device is via an XML file exported from the device. The format is rather complex, Annex F (normative) Information Model XML Schema explains the format.
It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system. Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk. Red Lion standard product warranty applies.
Red Lion Technical Support
If you have any questions or trouble contact Red Lion Technical Support by clicking here or calling 1-877-432-9908.
For more information: http://www.redlion.net/support/policies-statements/warranty-statement