Custom OPC-UA DataTypes with UA-.NETStandard and UA-ModelCompiler

There are three UA Stacks available from the OPC Foundation. In our products we use the OPC UA ANSI C Stack. The Java SDK uses the Java Stack.

Moderator: Support Team

Post Reply
elijah-pass
Jr. Member
Jr. Member
Posts: 3
Joined: 30 Apr 2024, 15:04

Custom OPC-UA DataTypes with UA-.NETStandard and UA-ModelCompiler

Post by elijah-pass »

I am working on an OPC UA project where I need to use custom DataTypes. I defined a complex object in UaModeler and used UA-ModelCompiler tool to generate the model code in C# for my OPC-UA server made using UA-.NETStandard. However, when I read from it using UaExpert, I'm unsure how the encoding and decoding of this custom DataType should be handled. It appears the data needs to be sent as a serialized ExtensionObject, however I couldn't find much documentation on how exactly to encode the custom DataType to a byte array and wrap it with ExtensionObject.

Does anyone have any information on how this is supposed to work in a non-abstract way? It seems like specific information like this is hard to come by.

I've read that the automatically generated code from UA-ModelCompiler should include encode and decode functionality, but I'm not sure how to employ that to serialize the custom DataType.

User avatar
Support Team
Hero Member
Hero Member
Posts: 3137
Joined: 18 Mar 2011, 15:09

Re: Custom OPC-UA DataTypes with UA-.NETStandard and UA-ModelCompiler

Post by Support Team »

Hi,

the GPLv2 licensed open source .NET-Standard SDK from OPC Foundation uses the UA-ModelCompiler. This is not designed to create complex, custom UA DataTypes. You can implement, but it will be a hell lot of work and manual coding. We have many customers that switched to our commercial C# SDK for exactly this reason.

Our commercial C# SDK allows (in combination with UaModeler) to generate encoder/decoder routines AND the required dictionary, which enables implementation of custom/complex types with ease.
Best regards
Unified Automation Support Team

elijah-pass
Jr. Member
Jr. Member
Posts: 3
Joined: 30 Apr 2024, 15:04

Re: Custom OPC-UA DataTypes with UA-.NETStandard and UA-ModelCompiler

Post by elijah-pass »

Support Team wrote:
02 May 2024, 09:11
Our commercial C# SDK allows (in combination with UaModeler) to generate encoder/decoder routines AND the required dictionary, which enables implementation of custom/complex types with ease.
Thank you for the advice. I was hoping this wouldn't be the case but at least I know I'm not crazy.

EDIT: It looks like it does. I followed the example on the UA-.NETStandard-Samples repository that I wasn't aware of and was able to get it working.

Post Reply