OPC UA struct data type?

#1

Hello,

I am new to Ignition and to OPC UA so I have a bit of a n00b-ish question. I have read that OPC UA performance can be optimized by subscribing to arrays and structs rather than individual tags. I’ve created some arrays in my PLC (I’m using an S7-1500 with its built-in OPC UA Server, firmware V2.6) and created OPC tags for elements in that array, so I’m hoping that Ignition is creating subscriptions for arrays for those items. However, I am stumped when it comes to structs. I’ve defined a UDT in my Siemens PLC and created an array of that UDT. However, in Ignition designer the UDT doesn’t show up as an atomic tag itself, it shows up as a list of the elements inside the UDT (i.e. if the UDT had a string, a float, an int, and a bool, then Ignition’s OPC browser shows me a list of those items instead of the entire UDT as one item). But my question is whether Ignition is reading these values as an OPC UA struct (which should be more optimized from my understanding) or as individual elements (which would be less optimized)?

Again, I apologize if this is a stupid question or if I’ve posted in the wrong place. Any help or information that you can provide would be greatly appreciated.

0 Likes

#2

You can take advantage of reading whole structs in OPC UA servers as of Ignition 7.9.12 and 8.0.0.

When you bring the tag in you’ll notice Ignition presents a JSON value. The strategy here is a little involved but it works.

For each of the UDTs you’ll be subscribing to in the PLC you make a corresponding UDT in Ignition. It should have a “Source” OPC tag member that will correspond to the Node with the struct value in the server and as a result have a JSON value in Ignition. Then for each member of the UDT you have a Derived Tag member that references the “Source” tag using the jsonGet and jsonSet expression functions to get/set the member value out of the JSON value.

0 Likes

Connecting to integrated S7 1500 OPC server
How to map OPC UDT to Ignition template
[Question]How to access individual tags inside a UDT from OMRON NX PLC OPC server?
#3

Kevin, thank you so much for your helpful response. I think that answers my question perfectly.

0 Likes

Access UDT parameter in script
#4

Hi Kevin,

Where struggling with the same issues here. But we can’t find any documentation on how to a “sibling”-tag within the UDT for the derived tag.
E.G. We have a struct called CamPreset in de the PLC with pan, Tilt, zoom en focus integer values and float values.
We created a UDT called CamPreset and created a tag called “Source” in the UDT which is a OPC tag pointing to the PLC-struct. From here we thought to created derived tags Pan, Tilt, Zoom en Focus to delve into the Source-tag details… But how to reference the Source tag… Any suggestions?

0 Likes

#5

Derived tags have some “magic variables” you can access.

In the Read Expression it’s {source} and in the Write Expression it’s {source} and {value}.

https://docs.inductiveautomation.com/display/DOC80/Types+of+Tags#TypesofTags-DerivedTags

0 Likes

#6

I know, but I’m looking into the Source parameter of the derived tag. How to reference the UDT member with the OPC-configuration… Then when we have an exact copy, I can further specify the details I want to use in my derived tag with de Read-expression…

0 Likes

#7

Was this what you’re looking for?

2 Likes

#8

Exactly this!! So simple… :unamused:

0 Likes

#9

I am trying to use a derived tag in a UDT as well (Ignition 8.0.4). When the source tag is buried more than 1 level deep inside a folder it does not work. For example, if the source tag location is “[.]Folder/SubFolder/SourceTag”, the value comes back as blank. Same result if i browse the UDT tags to select the tag as the source, resulting in the path “[default]types/Ex1/Folder/SubFolder/SourceTag”. Maybe a bug, or is there something I am missing here?

0 Likes

#10

Where’s your derived tag in the tree?
If the derived tag is in a folder as well you may need […] for the sourcetag reference

0 Likes

#11

Thanks! I was having problems using the Sources/SourceTag as the source for DerivedTags/DerivedTag (in image below). Seeing your post made me look for the relative tag path documentation which explained that i need the following syntax in the source for DerivedTags/DerivedTag.

[.]…/Sources/SubFolder/SourceTag

image

https://docs.inductiveautomation.com/display/DOC80/Understanding+Tags

1 Like

#12

image

Image above shows the UDT instance with good values :slight_smile:

0 Likes

#13

image

Path is actually above. 2 dots instead of 3.

1 Like