In part 2 of this tutorial, you complete the following tasks:

  • Constructing an address space
  • Reading and writing the value of a node
  • Registering and unregistering an OPC UA server with the UA Local Discovery Server (LDS)
  • Reading, updating, and deleting the history data of a node
  • Reading the history events of a condition
  • Updating and deleting the history events of a condition

Constructing an Address Space

You can use the OPC UA server VIs to construct an OPC UA server address space. You can use the address space to store data. An address space consists of nodes that an OPC UA server allows an OPC UA client to browse. Nodes include the following elements:
  • Folders
  • Items
  • Properties
  • Notifiers
  • Conditions

Constructing an address space includes the following tasks:

  • Creating a folder in an address space
  • Adding a notifier as a child to the folder
  • Adding a source node to a notifier
  • Adding a condition node to the notifier
  • Adding an item as a child to the folder
  • Adding a property to an item

What to Use

To create a folder in an address space, use the following objects:

Add Folder VI Add Notifier VI Add Item VI Add Condition VI Add Property VI

What to Do

To construct an address space for an OPC UA server, create the following block diagram:

The following list describes important details about the previous diagram:

  1. The Add Folder VI creates a folder named Folder1.
  2. The Add Notifier VI adds a notifier named Dialog Notifier. The Add Item VI adds an item named Source Node to Dialog Notifier.
  3. The Add Condition VI adds a dialog condition node to the address space.
  4. The Add Item VI creates an item named Item at the top level of the address space. The Add Property VI adds a property named Property to Item.
  5. (Optional) The Delete Node VI deletes the following nodes:
    • The Dialog Notifier node.
    • Source Node, which is the child source node of the Dialog Notifier node.
    • Dialog Condition, which is the child condition node of the Dialog Notifier node.
    Before you delete the node, you can use the Stop VI to stop the OPC UA server. After the OPC UA server stops, you can do the following actions:
    • Add nodes to the UPC UA server
    • Change the locations of nodes
    After you delete the node, you can use the Start VI to restart the OPC UA server.

Reading and Writing the Value of a Node

You can use the OPC UA server VIs to do the following actions on an OPC UA server:
  • Read the value of a node.
  • Write a value to a node.

What to Use

To read and to write the value of a node on an OPC UA server, use the following objects:

Add Folder VI Add Item VI Add Property VI Read VI Write VI

What to Do

Reading and writing the value of a node on an OPC UA server allows you to do the following actions:
  • Read the value of a node.
  • Read the timestamp of a node.
  • Read the status of a node.
  • Write a value to the node.

The following list describes important details about the previous diagram:

  1. The Read VI reads the value, timestamp, and status of Item1.
  2. The Write VI writes the 1234 value and the Good status to the item that the Add Item VI created.

Registering and Unregistering an OPC UA Server with the LDS

You can use the OPC UA server VIs to register an OPC UA server with the LDS. You can also unregister the OPC UA server with the LDS.

What to Use

To register or unregister an OPC UA server with the LDS, use the following objects:

Register Server VI Unregister Server VI

What to Do

To register or unregister the OPC UA server with the LDS, create the following block diagram:

The following list describes important details about the previous diagram:

  1. The server only trusts a valid LDS certificate file. local discovery server certificate file specifies the file path of the certificate file that the LDS uses. You must ensure that the OPC UA server and LDS trust each other. Place the server certificate file in a folder that the LDS public key infrastructure trusts.
  2. The Register Server VI registers the OPC UA server with the LDS. You must use this VI before the server starts. This VI registers the server to LDS after the server starts.
  3. The Unregister Server VI unregisters the OPC UA server with the LDS. This VI sends the offline registration to the LDS after the server stops. To register the server with the LDS after the server starts again, you must use the Register Server VI.

Reading, Updating, and Deleting History Data

You can use the Historical Access VIs of the OPC UA server VIs to read, update, and delete history data. History data refers to the time series data that is stored for a node that supports historical access. The following examples are considered history data:
  • Device data
  • Calculated data
  • Status information
  • Dynamically changing system data
  • Diagnostic data

What to Use

To read, update, and delete history data, use the following objects:

Table 5.
Add Folder VI Add Item VI Write VI History Data Read VI History Data Update VI History Data Delete VI

What to Do

To read, update, and delete history data, create the following block diagram:

The following list describes important details about the previous diagram:

  1. The History Data Read VI reads the history data of Item1 within a time range.
  2. The History Data Update VI updates the history data of Item1 at a specific timestamp.
  3. The History Data Delete VI deletes the history data of Item1.

Reading History Events

You can use the Historical Access VIs of the OPC UA server VIs to read history events. History events refer to the time series events that are stored in some historical system. The following examples are considered history events:
  • Notifications
  • System alarms
  • Operator action events
  • System triggers

What to Use

To read history events, use the following objects:

Table 6.
Add Notifier VI Add Item VI Write VI Add Condition VI History Event Read VI

What to Do

To read history events, create the following block diagram:

The following list describes important details about the previous diagram:

  1. The Add Notifier VI adds a notifier to the OPC UA server. To establish an event hierarchy, you can add a condition node and a source node as child nodes to a notifier.
  2. The Write VI writes a FALSE value to the Source Node. This action triggers an off-normal alarm, because the updated value of the Source Node does not match the value of the Normal State Node.
  3. The History Event Read VI reads history events from the notifier.

Updating and Deleting History Events

You can use the Historical Access VIs of the OPC UA server VIs to update and to delete history events. History events refer to the time series events that are stored in some historical system. The following examples are considered history events:
  • Notifications
  • System alarms
  • Operator action events
  • System triggers

What to Use

To update and to delete history events, use the following objects:

Table 7.
Add Notifier VI Add Item VI Write VI Add Condition VI History Event Update VI History Event Delete VI

What to Do

To update and to delete history events, create the following block diagram:

The following list describes important details about the previous diagram:

  1. The History Event Update VI updates history events from the notifier.
  2. The History Event Delete VI deletes history events from the notifier.