Reading large block of data with OPCUA

Hello,
I was wondering about what is the best way to read large block of data from a plc, in my case Siemens s7-1500 (using integrated OPCUA Server).

I have an UDT definition on my PLC looking something similar to this :

MyUdt:

Id --> int
Name --> String(20)
Code --> String(20)
p1 --> Int
p2 --> Int
p3 --> long
p4 --> bool
p5 -->bool

The above UDT is instantiated 50 times in lets say DB5.
DB5 starting from byte 0 has inside 50 UDT, not inside an array, just single UDT one after the other like this :

DB5 :

MyUdt_1
MyUdt_2
MyUdt_3
...
MyUdt_50

It happens that I need to read all of them, to perform some logic and then write them back.
At the moment, in order to perform a read action, I prepare my array of single tags,
then i call the system.opc.readValues and i have, after few seconds, the values i was looking for.

I need to perform an OPC direct read as I can’t manage to subscribe to this tags, otherwise I will saturate the s7 Opcua Server.

I remember using opensource DotNet DLLs to interact with Siemens PLC, and i was able to perform a block read lets say from DB5 byte 0 - 20000, and then when i had that array of bytes , i had to parse them to recreate the desiderate structure of data.

From my understanding, this reading method should be more efficient.
Correct me if I’m wrong, but event if i send a system.opc.readValues instead of the system.opc.readValue, the request to the PLC is only one, but still the cpu has to search for every single tag i requested.(And i don’t find a way to register this Nodes on the Siemens OPCUA Server : Registered reading of OPCUA server)

Is there any way, and if there is could you point me at some docs, to accomplish the same task?
My aim is to read the DB5 data as quick as I possibly do, and give to Ignition the task to parse the data.

Thank you for your time

Hi,

what about the Siemens Driver ignition have?

Br,
Roland

Hi,
Thanks for your reply.

My aim was to understand if there is a way to that same thing using OPCUA.
Maybe something to do with XML files, or something like that.

When you read these 50 UDT instances are you requesting just the 50 top level UDT tags or are you requesting all of the member tags as well?

Hi Kevin,
Sorry I think I misunderstood your question.
At the moment I request all of the tags of each udt, so yes I’m requesting all members values.

That’s going to be much slower than requesting only each top level structured value instead, at least if you are using the OPC UA server built in to the S7-1500.

When reading a structured value it will be received in Ignition as a JSON object, containing all the member values and any member structs as embedded JSON objects modeled the same way.

Ok thanks,
I will try this approach instead.
I imagine I can write the udt back to plc by passing as a value to be written a JSON right?

Yes, you just have to make sure you maintain the same overall structure.

The UDT and every one of its members need to have Read Write permissions. If even a single member has Read Only permissions the write will fail.

Thank you very much Kevin, tomorrow I will try this out.