Load big array triggered by an item

I have a numeric item "Measurement" in the PLC and whenever this changes I want to load 500 measured values (array).

In a Siemens training was said one should subscribe in such cases as little as possible. My approach would now be to subscribe to the item "Measurement" and thus trigger a load of the other values.

What is the best way to do this? With a script and system.opc.readValue?

I don't want to subscribe the array itself, because all changes in it are not relevant as long as the item "Measurement" doesn't change.

This, yes. You can use memory tags for the result if you want to distribute the data to clients efficiently. Or, perhaps, a document or dataset memory tag.

Ok. Then I would use the triggervalue "Measurement" as Tag in ignition. The script behind this trigger would use system.opc.readValue to load the array from the plc and would save it to memory tags?

And this is the best practise? There is no (gui) possibility to subscribe only one tigger value and make a sync. read of other values only after getting a trigger signal?

I'm comming from the old put/get world. So my consideration might not be compatible with OPC UA...

Ah. If you want this to happen only when a GUI is watching, make the trigger tag part of a leased tag group (slow pace = 0 to disable), and bind that trigger tag to something in your window/template/view. That something doesn't need to be visible, merely present, so the tag switches from idle to leased. The rest of my recommendation stands. You can think of system.opc.read...() as your get operation.

You definitely want the scripted OPC read to be in a gateway event, not a GUI event, so that it only executes once per trigger, regardless of how many clients are "watching".

That sounds good. I've played a bit with system.opc.readValue() and it worked good for a demo Tag:

system.opc.readValue("Ignition OPC UA Server", "[Sample_Device]_Meta:Random/RandomInteger1")

But how can I get for example one Tag inside of a siemens plc in this format? The OPC Quick Client shows me the following. But the readValue doesn't take that fomat. Or can I only reach the "Ignition OPC UA Server"?


I would expect that string to work, but in jython you will need to use alternate methods to get the double quotes embedded into the string properly. Possibly by using single quotes as your outer quotes, or by escaping the double quotes, or perhaps using jython's multi-line string constants.

Show your code.