OPC Write Document

Hi everyone,

I was wondering if there is a way to write a partial document to a OPC Server without set to default value the part of the document not being considered.

In my case I’m using a Siemens S7-1500 as OPCUA Server.
Lets say for example that i have a data struct in my DB1 looking like this :

a -> int 
b -> int
c -> int

When i perform an OPC.Read on DB1, i get back a document with the information i need.
Now my question is, let’s assume i’d like to change at some point, only the value of C, leaving A,B unchanged.

I tried to pop out A and B from the dict but as result i see that the OPC Write is performed correctly for C, while A and B are being set to 0 (guessing is the default value for the data type).

Is there a way to read a document and store it for future use, while popping out every time tags that are not supposed to change for a write request?

Thanks for the support

OPC UA structures must be written entirely, there is no concept of partial structure writes.

If the server exposes individual nodes for each structure member in the address space (I think the Siemens server does) you may be able to write directly to that Node but you’d have to know its NodeId.

1 Like

OK i see.
So it is expected for tags not being included in the OPC Write document, to eventually being set to default value.

Thank you Kevin,
have a great day

I’m not actually sure what the expected behavior there is. It might depend on whether or not the member is defined as being optional in the structure definition on the server.

Right, we could say is the default behavior, out of the box, for Siemens Opcua Server, at least without some configuration i don’t know yet.