Skip to content

From modelling to execution – OPC UA Information Model Tutorial

Last updated on April 10, 2022

This tutorial is separated into multiple posts and provides a complete walkthrough from creating a custom OPC UA information model, compiling this model into an OPC UA NodeSet2.xml file, and then using the open62541 OPC UA Stack to create a running OPC UA server.


Structure of the Tutorial

The guide is organized in several articles. Each article covers a single step of all steps required to generate a custom UANodeSet and run it on an open62541 server. All steps are linked here:

  1. Setup open62541 on Linux & Build first server
  2. Setup UA-ModelCompiler with Visual Studio
  3. Setup Visual Studio as ModelDesign Editor
  4. ModelDesign Explained – An Overview on the Concepts
  5. OPC UA ModelDesign Best Practices
  6. Writing a ModelDesign file
  7. Compile ModelDesign to UANodeSet
  8. Connect Application Variables to open62541
  9. Compile open62541 server with custom UANodeSet
  10. Using UAExpert to connect to an OPC UA server

The articles are organized according to the following graph:

Tutorial Overview

All steps are assigned to different stages (DESIGN, EDITING & APPLICATION) of the complete process.

The steps in the top-half area (SETUP) describe initial setup procedures of all required software tools.

The dotted (...) paths in the guide mark an alternative workflow that substitutes the two-step process of editing ModelDesign files and compiling them to UANodeSet files with a single-step process of directly editing UANodeSet files. Pick either of both approaches. The result will be an UANodeSet file in both cases.

With all SETUP steps completed, you can start MODELING.

The steps in the bottom-half area (MODELING) are horizontally aligned to their matching SETUP steps. They describe how to use the respective tools to design, edit and apply a custom UANodeSet.

The dash-dotted (-*-) element in the MODELING area of the graph indicates the process of associating the variables of the ModelDesign with the variables of the application program. While this step is absolutely necessary for any application of OPC UA, it’s not required for editing and testing OPC UA models.


Once set up, this toolchain enables you to develop an OPC UA nodeset by frequently iterating on its design with little effort. If the target nodeset is already well defined, direct editing and compilation of the nodeset C99 source and header files may be more efficient. This is equal to omitting the DESIGN and EDITING stage and takeing the steps of the APPLICATION stage only. See and it’s open62541 source code pendant tutorial_server_variable.c for reference.


This walkthrough was implemented with the following tools:

  • Windows 10 with Hyper-V
  • Debian as Hyper-V guest
  • Visual Studio 2019 Community Edition
  • UAExpert
  • git, bash and PowerShell

Whenever applicable, alternative solutions and tools will be mentioned. They are visualized in the following image and explained below:

Overview of available workflows and repository dependencies

This tutorial presents a Windows- and a Linux-based approach for step 2 and step 3 each. Deciding on the right approach for you boils down to answering the following questions:

  1. Do you prefer to edit and compile the ModelDesign on Windows/Visual Studio or Linux/IntelliJ?
  2. Do you prefer to use the offical UA-ModelCompiler or the author’s fork of UA-ModelCompiler?

On question 1:
There are 3 ways to convert a ModelDesign.xml to UANodeSet2.xml

  • Docker:
    • Linux-only
    • The latest stable version of ModelCompiler
    • UA-ModelCompiler is already compiled for you and ready to use
  • Pro/UA-ModelCompiler:
    • Linux or Windows
    • the latest stable version of ModelCompiler
    • you have to compile UA-ModelCompiler yourself on Windows or Linux (with Mono)
  • OPCFoundation/UA-Modelcompiler:
    • Linux or Windows
    • the latest untested version of ModelCompiler
    • you have to compile UA-ModelCompiler yourself on Windows or Linux (with Mono)

The answer to this question is a matter of personal preference. This tutorial recommends the Docker-approach.

On question 2:
Why is the author maintaining the fork of ?

The author’s fork is set up with a CI/CD chain for Docker and will make sure that its UA-ModelCompiler will be functional at any time. The fork was necessary, because tends to introduce breaking commits to its master branch occasionally.

Commonly used Reference Material

The following links expose the main resources used in this guide. More specific links will be provided throughout the guide.


This tutorial is published with the kind permission of Harald Eschbach.

Published inInformation Modelingopen62541

Be First to Comment

Leave a Reply

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.