Part 2: Using an OPC UA Server (OPC UA Toolkit)
- Updated2023-02-21
- 10 minute(s) read
Part 2: Using an OPC UA Server (OPC UA Toolkit)
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 before you 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 folders, items, properties, notifiers, and 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
Use the following objects to create a folder in an address space:
Add Folder VI | Add Notifier VI | Add Item VI | Add Condition VI | Add Property VI | |||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||||||||
|
|
|
|
|
What to Do
Create the following block diagram to construct an address space for an OPC UA server.

The following list describes important details about the previous diagram:
![]() | The Add Folder VI creates a folder named Folder1. |
![]() | The Add Notifier VI adds a notifier named Dialog Notifier. The Add Item VI adds an item named Source Node to Dialog Notifier. |
![]() | The Add Condition VI adds a dialog condition node to the address space. |
![]() | 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. |
![]() | (Optional) The Delete Node VI deletes Dialog Notifier and its child source node Source Node and child condition node Dialog Condition. When you use the Delete Node VI to delete a node, you also delete all of the child nodes of this node. Before you delete the node, you can use the Stop VI to stop the OPC UA server. You can also add nodes to the OPC UA server or change the locations of nodes after the OPC UA server stops. 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 read the value of a node and write a value to a node on an OPC UA server.
What to Use
Use the following objects to read the value of a node and write a value to a node on an OPC UA server:
Add Folder VI | Add Item VI | Add Property VI | Read VI | Write VI | ||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||
|
|
|
|
|
What to Do
Create the following block diagram to read the value, timestamp, and status of a node, and writes a value and status to a node on an OPC UA server.

The following list describes important details about the previous diagram:
![]() | The Read VI reads the value, timestamp, and status of Item1. |
![]() | The Write VI writes a value, 1234, and status, Good, 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 and unregister the OPC UA server with the LDS.
What to Use
Use the following objects to register an OPC UA server with the LDS and unregister the OPC UA server with the LDS:
What to Do
Create the following block diagram to register an OPC UA server with the LDS and unregisters the OPC UA server with the LDS.

The following list describes important details about the previous diagram:
![]() | 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. The server trusts a valid LDS certificate file. To ensure LDS trust the server, you can put the server certificate file to a folder that LDS public key infrastructure trusts. |
![]() | 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. |
![]() | The Unregister Server VI unregisters the OPC UA server with the LDS. This VI sends the offline registration to LDS after the server stops. To register the server with the LDS after the server starts again, you must use 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 stored for a node that supports historical access. Examples of history data include device data, calculated data, status information, dynamically changing system data, and diagnostic data.
What to Use
Use the following objects to read, update, and delete history data:
Add Folder VI | Add Item VI | Write VI | History Data Read VI | History Data Update VI | History Data Delete VI | |||||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||||||||||
|
|
|
|
|
|
What to Do
Create the following block diagram to read, update, and delete history data.

The following list describes important details about the previous diagram:
![]() | The History Data Read VI reads the history data of Item1 within a time range. |
![]() | The History Data Update VI updates the history data of Item1 at a specific timestamp. |
![]() | 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 stored in some historical system. Examples of such data include notifications, system alarms, operator action events, and system triggers.
What to Use
Use the following objects to read history events:
Add Notifier VI | Add Item VI | Write VI | Add Condition VI | History Event Read VI | ||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||
|
|
|
|
|
What to Do
Create the following block diagram to read history events.

The following list describes important details about the previous diagram:
![]() | 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. |
![]() | The Write VI writes FALSE to the Source Node. An off-normal alarm is triggered because the value that the Write VI writes to the Source Node does not equal the value of the Normal State Node. |
![]() | 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 delete history events. History events refer to the time series events stored in some historical system. Examples of such data include notifications, system alarms, operator action events, and system triggers.
What to Use
Use the following objects to update and delete history events:
Add Notifier VI | Add Item VI | Write VI | Add Condition VI | History Event Update VI | History Event Delete VI | |||||||||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||||||||||
|
|
|
|
|
|
What to Do
Create the following block diagram to update and delete history events.

The following list describes important details about the previous diagram:
![]() | The History Event Update VI updates history events from the notifier. |
![]() | The History Event Delete VI deletes history events from the notifier. |
![]() |
Previous Creating an OPC UA Server |
Next Establishing Connections between an OPC UA Server and an OPC UA Client |
![]() |