OPCua Subscribe to specific item / index of array

423 views Asked by At

I have a OPCua server that consists of an array[1000] of objects (4 x reals, 2 x int, 2 x Enumerators).

I am trying to subscribe to Object[104].real2

I can subscribe currently to object and receive all 1000 objects every time there is an update. But this is way to much information.

I would happily settle for a subscription to object[104] if I could find a easy way to receive the data directly into my own class. Currently all data comes back as a series of bytes.

1

There are 1 answers

0
Fred On

One thing you could try (it works under our environment) is to leave the elements in your array (i.e. not have an array of pointers), declare a variable as a reference, make it available under OPC-UA, and set that reference to point to your variable.

VAR
  ref_to_real: REFERENCE TO REAL;
END_VAR

Then, one line of code to be executed once when your application starts :

ref_re_real REF= Object[104].real2;