Skip to content

From modelling to execution – OPC UA Information Model Tutorial

Last updated on September 5, 2020


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.

Note

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 https://open62541.org/doc/current/tutorial_server_variable.html and it’s open62541 source code pendant tutorial_server_variable.c for reference.

Tools

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.

Commonly used Reference Material

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

Credit

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. Required fields are marked *

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