Skip to content

Step 6: Writing a OPC UA ModelDesign File

Last updated on September 1, 2020

This post shows how to write the model by editing a ModelDesign file with a suitable editor

This Post is part of the OPC UA Information Model Tutorial.


It is recommended that you also read through the following page to get an overview on OPC UA Information modeling:

How to create custom OPC UA Information Models

In this tutorial we are using the example files provided in the following repository:

Especially the file FooFltModel.xml

A more complete example with heavy use of heavy usage of ModelDesign files and dependencies between them is shown in this project (look into subfolders with the name opcua):


If you are using Visual Studio, make sure that you set up Visual Studio as mentioned here:

Step 3: Setup Visual Studio as ModelDesign Editor


Namespaces help to avoid naming conflicts by prefixing them to variable names. Apart from that, they also split the whole address space in the server into multiple groups.

The following code shows the minimum code required for an empty ModelDesign with comments indicating the designated model components. A lot of the boiler-plate code is concerned with namespaces, which are discussed in this section.

<?xml version="1.0" encoding="utf-8"?>


    <!--No space allowed at the beginning of the namespace URL!
      Prefix sets the filenames of the generated files. -->
    <Namespace Name="FooZbrFlt" Prefix="FooFlt"></Namespace>
    <Namespace Name="OpcUa" Version="1.03" PublicationDate="2013-12-02T00:00:00Z"></Namespace>
  <!-- ObjectType -->
  <!-- ReferenceType -->
  <!-- VariableType -->
  <!-- DataType -->
  <!-- Object -->
  <!-- Variable -->
  <!-- Property -->
  <!-- Dictionary -->
  <!-- Method -->
  <!-- View -->

The XML element ModelDesign has the following attributes:

  • xmlns:uax=""
    • The link leads to a schema file that defines various complexTypes used by OPCFoundation.
  • xmlns:xsi=""
    • required
  • xmlns:ua=""
    • Namespace of all OPCFoundation
  • xmlns:FooZbrFlt=""
    • this document may use elements of namespace FooZbrFlt. In combination with TargetNamespace this document may define ObjectType elements in that namespace as well as use them from that namespace, as long as their names are correctly prefixed with FooZbrFlt:.
  • xmlns:xsd=""
  • TargetNamespace=""
    • this document defines elements in this namespace
  • TargetVersion="0.9.0"
    • optional, used as auxiliary release meta-information
  • TargetPublicationDate="2020-05-01T00:00:00Z"
    • optional, used as auxiliary release meta-information
  • xmlns=""
    • Default namespace of this document


Define method types explicitly (grey box) and use them via TypeDefinition for method nodes as shown for method MyMethod. Defining methods in-places like MyMethodInPlace will not expose Input- and OutputArguments to the OPC UA client.

Note: In comparison to Object/ObjectType and Variable/VariableType, Method do not have MethodType.

Published inInformation Modeling

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.