After discussing the creation of a model, some users have come across the need to add the OPC UA EngineeringUnits field. In this short article we are going to look at an example of how we can add this property to our variables in order to specify the engineering units.

OPC UA Model

To quickly get to the point, let us immediately define a model very similar to what we have already seen in the dedicated article:

Copy to Clipboard

In this scenario, we have first defined a data type called MotorConveyor (lines 7-13) in which a Speed variable of analogue type is defined (lines 10-11). This is followed by the definition of a MachineType object (lines 15-21) which consists of an instance of MotorConveyor called, precisely, Conveyor.

For more details on how to write and generate a model, please refer to the article on how to create a data model.

If you are a Linux or Mac user, take a look at how to cross-platform the ModelCompiler tool needed to compile your model.

OPC UA and EngineeringUnits

So, now that we have created our model, the objective is to add the EngineeringUnits property to the Speed variable of our Conveyor. Doing so is very simple, we just need to insert an attribute so that it is available to those who connect to our server.

Please refer to the article on how to develop an OPC UA server in .NET to find out how to write your own OPC UA server.

Similarly, you can learn more about client development in the article on creating an OPC UA client, again using the .NET libraries.

Copy to Clipboard

As you can see, it is enough to add a property of type EUInformation with the properties described in lines 2-4, to obtain the desired result.

To manipulate these attributes, once the model is compiled, you can use the generated C# classes of the ModelCompiler.

Copy to Clipboard

Again, for further details, please refer to the article where we discuss how to develop an OPC UA server with the .NET libraries.

Conclusions

In this article we have briefly discussed how to add an OPC UA property of type EUInformation to enrich our variables with additional details such as engineering units.

Take a look at the other articles in the series to learn more about the OPC UA protocol and leave a comment if you have any queries.