2

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

Nando
  • 31
  • 1
  • My best guess, as you also thought, is that CODESYS has trouble with arrays as their size may be ambiguous or dynamic. It's just a guess though. The simplest workaround might be to declare the array as separate elements, i.e. instead of array[x], element0, element1 and etc. And if you want to have an array in CODESYS, define an array of POINTERs and combine those elements into the array inside CODESYS. – Guiorgy Feb 09 '22 at 11:21

0 Answers0