« All blog posts

How to build and simulate OPC UA Data Models: a step-by-step guide


To get the most out of the Prosys OPC UA Simulation Server, it is essential to know how to build your simulated systems. In this article, you will learn how to create your information models, import external Namespaces, and use them to your advantage by creating your Objects and Variables with custom Values. Finally, we will discuss how you can test and monitor your system with a client application.


To follow this tutorial, you will need three products.

  • Prosys OPC UA Simulation Server

    • The Free Edition of the software can be used for adding folders, Objects, and Variables.
    • For importing and exporting Namespaces, the Professional Edition is required. You can get an evaluation license for this purpose.
  • Prosys OPC UA Browser

    • This free client application is used for connecting to the server and testing the system.
  • OPC UA Modeler

    • The application is used for creating an information model and exporting it in NodeSet format.

The big picture

The following Figure shows a process from having a physical system in need of a digital representation to getting that system up and running with a real-life server that uses OPC UA.

The most important thing you need for your system is an information model that represents the domain of your physical system. A model might already exist in the form of an OPC Foundation companion specification or another standard model. If this is not the case, you need to create your own model either on top of an existing one or a wholly new one.

An information model containing the Types you need can be imported to Simulation Server. With Simulation Server, you can create instances with simulated Values to test your system. If the Types of the information model are sufficient, you can test the simulated system using OPC UA Browser.

When everything seems to work correctly, you can export your instance Namespace as a NodeSet XML file from the Simulation Server and import it into a real-life OPC UA server. The following sections will explain these steps more in-depth. To make this tutorial more fun, let’s say that we here at Prosys OPC have new devices that we want to be able to track and identify on an OPC UA server. Now we will go through the process of creating sufficient information models for our new devices.

We use different terms when we talk about information models in this article. According to the OPC UA specification, an information model is an “organizational framework that defines, characterizes and relates information resources of a given system”. An information model exported in XML format is called “Information Model XML Schema”. These files are also referred to as NodeSet XML files. As you import a NodeSet into the Simulation Server, you can see that Namespaces can be created from NodeSet XML files.

Finding and creating needed information models (OPC UA Modeler)

When you have a new device or system that needs digital representation, companion specifications are a great place to start looking. These information models offer a variety of domains with ready-to-use types for various cases. Every model uses the same standards, so compatibility between different models is seamless. If you don’t find quite what you need, you can easily build on top of these companion specifications with additions that suit your case the best. See our blog post on the companion specifications.

In our example case, we have gone through OPC Foundation’s companion specifications we downloaded here, and found that we could build on top of the DI model. We will add a subtype for the DeviceType, and then add a string identifier for that subtype.

How to create your NodeSet using DI information model

  1. Create a new project.

  2. Choose the required models on top of which you are going to add. Opc.Ua.NodeSet2.ua and Opc.Ua.DI.NodeSet2.ua.

  3. Define the model’s name and Namespace URI. The URI will be visible on the server, so it should be descriptive.

  4. Browse the Information Model to find the type you want to extend.

  5. Go to Types > ObjectTypes >BaseObjectType > TopologyElementType > DeviceType. This is the Type for which we will add a new Subtype.

  6. Click the Add Subtype button.

  7. Give a name for your Subtype. We name the Subtype “ProsysDeviceType”.

  8. Click the Override button and select Identification on the dialog. Click OK. Now the device Subtype has an Identification folder.

  9. Click OK on the bottom right of the window. Now your Subtype has been added to the Information Model.

  10. Next, we will add an Variable into the “Identification” folder. Click on the “Identification” folder in the Information Model.

  11. Add a new child for the Identification Object.

    Use these attributes:

    • NodeClass: Variable
    • Name: ProsysOPCIdentifier
    • TypeDefinition: BaseDataVariableType
    • ModellingRule: Mandatory, DataType: String

  12. Click OK again.

  13. Check that your Information Model has a new variable called “ProsysOPCIdentifier” inside “Identification”.

  14. Go to the Project tree and find your model. Left-click and select Export XML.

  15. Check the Output log for the saving location.

If you would like to check out the files used ín the tutorial, proceed by this link.

Importing namespaces into Prosys OPC UA Simulation Server

Now that we have a NodeSet that meets our requirements, we can import it into the Prosys OPC UA Simulation Server to create instances of our new device Type. This is an important step because, with instances, we can give the devices simulated Values that can then be observed to see how the information model works. This all can be done digitally, without a need to include the physical system or devices into the testing.

How to import your NodeSet into the Prosys OPC UA Simulation Server

  1. Run Prosys OPC UA Simulation Server and go to the Namespaces tab.

  2. Since we used the DI information model to make our new NodeSet, we first must import the DI model. Click on the + button and select Import NodeSet.

  3. Find and select the correct NodeSet file. Click OK to add the model to the namespaces.

  4. Click on the + and select Import NodeSet again. Now find and add the new NodeSet.

  5. As you can see from the lock icons on the left, we cannot modify these namespaces. Let’s add one more namespace for our instances. Click on the + button again, but this time select Add Namespace.

  6. Give a URI for your new namespace. Select a descriptive name. We will use http://www.prosysopc.com/OPCUA/ProsysDeviceInstances, which follows our naming practices.

Adding folders, Objects, and Variables to the simulated system

We have successfully imported our NodeSet into the Simulation Server. Next, we will create instances and give the identifiers some initial values.

How to create instances from your NodeSet on Prosys OPC UA Simulation Server

  1. Go to the Objects tab to create instances of our ProsysOPCDeviceType. Let’s add a new folder for our instances first.

  2. Select the newly added namespace as the correct namespace for the new folder. Name your folder. We will use ProsysDevices.

  3. Now we will add some Objects into the folder. Right-click the folder and select Add Node > Add Object.

  4. Make sure you have the correct Namespace selected and give the Object a name.

  5. Click on the Type field to get a dialog where you can select the Type for the Object. Now find your own device Type. The easiest way to find your Type is to type the name of the Type into the search bar on top of the dialog. Select the correct Type and click OK.

  6. We want to add the identifier for the Objects as well, so click on the Select Optional Members button to open a new dialog. This dialog shows every optional member the Type can have. Find the identifier and click OK.

  7. Click OK on the Object creation dialog. Now you should have your first device listed inside the folder created in step 2.

  8. Now, we will give an Initial Value for the identifier. Select the identifier and open the Value tab. Disable Value inheritance from the switch on top of the Value tab.

  9. The Data Type of the identifier is String, so Value Type should remain constant. Write the identifier’s value to the Initial Value field.

  10. Follow steps 3-9 to create more instances of your device Type.

  11. When you are finished with your instances, go back to the Namespaces tab. Right-click on the Namespace that was created for the instances and select Export Namespace.

  12. Select a location and file name for your new NodeSet. Then click Save.

  13. Now you can find your new instance NodeSet file from the folder you saved it to. Before importing it elsewhere, let’s test it using Prosys OPC UA Browser.

Monitoring and testing the simulated system

We have now arrived at the testing stage of our process. We will connect our Prosys OPC UA Browser to the Prosys OPC UA Simulation Server and find our new instances from the Address Space. We can then read the values of the devices’ identifiers.

How to connect a client application to a server and find your instances

  1. Run the Prosys OPC UA Browser and connect to the Simulation Server.

    (You can copy the server’s connection address from the Status tab of the Prosys OPC UA Simulation Server).

  2. Browse the Address Space on the left of the window. Go to Objects > ProsysDevices to find your devices.

  3. Go deeper into one of your devices: FirstDevice > Identification > ProsysOPCIdentifier. Select the Identifier to see its value on the Attributes and References tab.

  4. Right-click on the identifier and select Monitor Data to open a Data View tab where you can monitor your values.

  5. Add the identifiers of all your devices to be monitored.

Next Steps

Keep in mind that this article presents a relatively simple case that is supposed to help you get started, and give you an idea how you can get the most out of the Prosys OPC UA Simulation Server. You can always come up with even more complicated systems and Types to create and test. If you have any questions while building your own systems and models, contact us at sales@prosysopc.com.

If you now want to do your implementation following this tutorial, place download requests for the following products:

You might be wondering, what is next? Where to go from here with your newly exported instance NodeSet XML? Stay tuned for our future posts to find out. You can subscribe to the RSS feed.

Kaisa Voutilainen

Kaisa Voutilainen

Software Engineer


Tags: OPC UA, Information Models, NodeSet, Simulation Server

comments powered by Disqus

About Prosys OPC Ltd

Prosys OPC is a leading provider of professional OPC software and services with over 20 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.

Read more about us »

Newest blog posts

OPC UA and Open Industry 4.0

Learn how OPC UA and Open Industry 4.0 complement each other.

OPC UA PubSub to Cloud via MQTT Demo at Hannover Messe 2022

Combining Raspberry Pi 4 and Prosys SDK for Java for Cloud Demo

OPC Day International 2022 - All Presentations

The whole program and all presentations of the largest OPC Day ever.

View all blog posts »