Hi, I am wondering if there is a way to read a UDT from an Allen Bradley PLC in the same way that it is possible with the S7-1500, using a document tag and the jsonGet and jsonSet functions.
Not with IA native drivers or my alternate driver. Have you tried using the OPC server in recent Logix firmware? It might do this.
(Be beware, that way lies performance miseries, and major issues with writeback. To be clear: accessing a Siemens that way is a kludge due to limitations in the Siemens platform. It isn't intended to be considered a best practice.)
I see, thanks Phil for the quick response.
This times 1000. Phil was being polite
From first-hand experience, using the document tag + derived tags with Siemens OPC-UA has significantly improved loading performance of our screens, compared to creating all tags as OPC tags. We have also not experienced any writeback issues.
Do either of you have any resources or threads to read as to why this method is not recommended?
Thank you for the help!
Don't worry, it is actually the recommended approach with the OPC UA server on the Siemens S7 PLCs.
The drawbacks are mostly that there's a lot of overhead in setting up all the tag configuration in Ignition, and that if you'll be writing to any of the tags in the structure, you need to have the Optimized Writes option enabled for the Tag Group they belong to. This is true in general for writing to tags within OPC UA structured values, because what actually has to happen is we need to modify the local value of the structure (document) and then write the entire structure.
When an OPC UA server models structures as both a single Variable Node with a structured value (or an Object Node), and then breaks out all the children into their own Variable/Object Nodes underneath, you don't have to do all the document / derived tag configuration because you can just bring every tag in.
Siemens actually does do this, but they have very strict Monitored Item limits on their servers, and if you subscribed to every Variable Node individually instead of just the parent with the structured value you will quickly hit your item limits and generally hurt the performance of the server.
This is not universally true for all OPC UA servers, but it is for many of the ones embedded into PLCs, where the hardware / resources are very limited.
Ergo, race. If the PLC is updating anything within the structure when Ignition constructs the write, the PLC update will be lost. In exactly the same way that modifying bits in words using any read-modify-write pattern on the whole word can stomp on other bits.
This was one of the inspirations for my new Divert*Write tag actions in my Integration Toolkit. Instead of writing back from the derived tag with jsonSet()
, write back to the individual node via the diversion. It gets you the best update performance on the subscription, while minimizing the monitored items limit, but completely avoiding the write race condition, too.
Yeah, the race condition still exists if the structured value changes on the server at the same time a client is writing to it.
The divert tag write action is clever. I've seen some servers that don't expose structure members as individual Nodes, and don't expose array elements as individual Nodes, but it seems like most of them are?
Wish we had better OPC UA support in the tag system
Woo hoo! I'm going to have to frame this!
For devices that do not expose the individual nodes, I strongly recommend using separate tags in each direction.
All of this is moot where the target device has a properly optimizable, high performance, native protocol (and Ignition is on the same LAN).
You speculated on adding system.opc.*
functions that would support OPC Node attribute read/write. I'd very much like to see that. It would solve all of the current unhappiness around return types in scripting support for OPC browse.
Yes, use Rockwell's FactoryTalk Linx Gateway. That will allow you to read the UDT as a Document and then parse out the tag properties.
@Luke_Reznecheck thank you. Do you have an example screenshot of how the UDT is structured in the PLC to do so?