> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/opc-ua-da/opc-ua-gui-example.md).

# OPC UA GUI Example

## Description <a href="#description" id="description"></a>

The **OPC UA GUI** example can be created by starting a new RT‑LAB project. From the menu bar, select **File > New > RT‑LAB Project**. Enter a name and location for your project, then click **Next**. From the available templates list, navigate to **IO > \_Generic\_ > OPC\_UA\_Server** and select **OPC\_UA\_GUI**, then click **Finish**. This example model demonstrates how to instantiate and use an **OPC UA Server** within the **simulator**. The model illustrates bidirectional data communication between an external OPC UA client and the real‑time simulation.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-15d1efb075726e2f1459efaee4acec9c25a89e64%2FDR-rtlab-opc-ex.png?alt=media" alt="" width="383"><figcaption></figcaption></figure>

Configured datapoints allow:

* The OPC UA client to **write data** to the simulator in order to control the simulation.
* The OPC UA client to **read data** from the simulator to monitor simulation behavior in real time.

## Requirements <a href="#requirements" id="requirements"></a>

In addition to the requirements stated in the OPC UA/DA **Requirements, Features & Limitations** section, this example requires an external OPC UA client (e.g., SCADA, HMI, or test client).

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-d35a0c520d3a5fd296d0f2eb8fe3385a411f6b93%2FDR-rtlab-opc-ex2.png?alt=media" alt=""><figcaption></figcaption></figure>

## Detailed explanation <a href="#detailedexplanation" id="detailedexplanation"></a>

In this example:

* The network interface is set to **eth0**
* The TCP port is set to the default **4840**
* Default security and endpoint parameters are used

Advanced configuration options are not visible by default. These can be enabled by activating the **Advanced Configuration** option in the general configuration section of the driver.

Both **scalar** and **array** datapoints are configured with default settings to simplify communication between the OPC UA Server and the client.

### Model preparation and configuration <a href="#modelpreparationandconfiguration" id="modelpreparationandconfiguration"></a>

1. Adjust the OPC UA Server interface parameters (network interface, TCP port, etc.) if required.
2. Build the OPC\_UA\_GUI model.
3. Load and execute the model.
4. Then start the external OPC UA client.

### Using the free UaExpert OPC UA client application (optional)

1. **Download** UA client from the Unified Automation UaExpert’s website ([**https://www.unified-automation.com/downloads/opc-ua-clients.html**](https://www.unified-automation.com/downloads/opc-ua-clients.html)).
2. **Launch the UaExpert client** application.
3. From the menu, select **Server → Add**.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-bba77c9b2cf567f7176065a582ee06147c99809d%2FDR-rtlab-opc-ex3.png?alt=media" alt=""><figcaption></figcaption></figure>

4. **Enter a name** for the server configuration.
5. In the **Custom Discovery** section, double‑click **\<Double click to Add Server…>**.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-d07adcf666e28b22af6c5073374602d024670206%2FDR-rtlab-opc-ex4.png?alt=media" alt="" width="310"><figcaption></figcaption></figure>

6. In the **Enter URL** window, enter the OPC UA Server address in the following format:

`opc.tcp://<simulator_ip>:<port>`

Where:

* `<simulator_ip>` is the IP address of the simulator running the OPC UA Server
* `<port>` is the TCP port configured in the OPC UA Server settings (default: **4840**)

7. Click **OK** to close the **Enter URL** window.
8. Click **OK** again to confirm the **Add Server** configuration. The server appears in the left‑hand panel under: **Project → Servers → \<your\_configuration\_name>**
9. **Right‑click** the server and select **Connect**.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-b2918933e7185a887efbc912b069f19b110749cd%2FDR-rtlab-opc-ex5.png?alt=media" alt=""><figcaption></figcaption></figure>

10. Once connected:
    * The configured datapoints appear below the **Project** tree.
    * The folder hierarchy defined in the OPC UA Server configuration is displayed.
    * Expand the folders to locate the desired datapoints.
    * Select datapoints and **drag and drop** them into the main window (**Data Access View**).
11. You can now:

* **Read** datapoints configured as **Server to Client**
* **Write or modify** datapoints configured as **Client to Server**

## Simulation and results <a href="#simulationandresults" id="simulationandresults"></a>

Once the interface is configured and the model is running on the simulator, the **Simulink console** can be used to verify the following:

* The ability to **modify data values** that are read by the OPC UA client
* The ability to **modify the status code (quality)** associated with each datapoint
* The ability to **monitor data values written by the OPC UA client** to the simulator

To test communication, the user must connect an external OPC UA client to the server running on the simulator.

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-a8c3f78047ec79d01efaeb3ea5734f82d6d42795%2FDR-rtlab-opc-ex6.JPG?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/configure-ios/communication-protocol-ios/opc-ua-da/opc-ua-gui-example.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
