Search code examples
c#opc-ua

Define custom ObjectTypes and VariableTypes by code (C#) in OPCUA


Related to the answer in How to define and use custom structure type?, in which the custom ObjectType and VariableType are created by XML.

Is there a way to do this by C# code?

Alternately, use a mixed way defining only the types in XML and then create instance by code?

Any example repositories?

Thanks.


Solution

  • Generally, it is a good idea to generate ObjectTypes and VariableTypes with a code generator and then create instance nodes. Especially when using Companion Specifications or predefined information models.

    There are different stacks for C# (⁣1) and each of the stack can deal with the generation and the types in different ways. Here is an example of this best practice for the UA-.NET Stack: Boiler Example

    If you use an other Stack you need to have a look to the examples or docs.