'Accessing OPC UA ExtensionObject (Struct, Dict and Array) in Codesys

I'm using a Python OPC UA-server (asyncua) to provide data to a CODESYS (V3.5.17.10) program. In CODESYS I'm able to add 'Data Source Manager' and then a 'Data Source' which is the Python OPC UA-server. Now CODESYS connects as client to the server, scans and shows me variables which it can read/write to.

My problem is that it only shows variables of primitive data types like int, string or boolean but no arrays or structures. The structures are declared as a VariantType.ExtensionObject (OPC UA) in Python and they do show up in UaExpert (a relatively smart OPC UA-client), where I can read/write all variables.

Next I switched it and provided those data types through a CODESYS OPC UA-server and checked in UaExpert how they show up. Following shows an array of a struct which is provided by CODESYS OPC UA-server:

array variable in CODESYS OPC UA address space

My thought was that I can somehow declare these variables in Python in a way that is compatible with CODESYS. I'm able to declare an array but I can't add any specifications/attributes like 'Dimensions', 'IndexMax' and 'IndexMin' which (I assume) CODESYS needs.

For flexibility reasons in need the Python program to be the OPC UA-server. Is there any way to declare an ExtensionObject (or any custom data/variant type) so that the CODESYS OPC UA-client can read/write it.

Few notes/thoughts:

  • CODESYS has these data types
  • CODESYS has trouble handling arrays of changing size
  • CODESYS can provide ExtensionObject when it is the server but won't see it when acting as client

Best regards,

a German Alex



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source