UDT Offset Documentation

I have had great success using UDTs and the basic operators for offsets in parameters (+,-,*,/). I would like to know what is supported as far as offsets.

Checking the user manual and forum has provided no luck:

[quote]To offset a value, use the form {ParameterName+offset}.
To format a value, use the form {ParameterName|format}. The format pattern is the same as that used for the numberFormat expression function. In short, “0” can be used to require a digit, and “#” can be used for optional digits.[/quote]

Has anyone discovered what is supported? A way to do both a * and a + in a single parameter? A way to do logic? A way to do additional operators?

1 Like

I see nobody replied to this question. I have the same need for simple calculations on tags inside UDTs. The reason is, our PLC is a Siemens S7-1500 and Ignition cannot browse tags by name for that PLC (when using the Ignition Ignition OPC-UA Server). We tried serving tags from the PLC, but that was a disaster as PLC performance degraded quickly when it had to serve even a few thousand tags. We get reasonable performance with the Ignition’s tag server. Under this situation, we addressing tags using datablocks, data types, and offsets. An example is:

[S7-Test]DB8,STRING6486.6

This addresses the 6 byte string at offset 6486 in datablock 8.

What we have is an array of structures in the datablock. Knowing the offset of the array in the datablock (it is not at address 0), size of the structure, the index of the structure, and the offset of the element I want to address inside the structure, I want to calculate the offset of data element I want to address in the UDT instance. The address above would translate as [S7-Test]DB8,STRING{Array Offset + Struct Size * Array Index + Element Offset}.6 . Note that the only one of these paramters that changes for each instance of the UDT is the Array Index - the rest are constant accross all instances of the array. The problem appears to be that parameter calculations are limited to a single operation, as the original poster implied.

Does anyone know of any way to do more sophisticated calculations with multiple paramters to make this addressing work? I was hoping to setup the UDT with the Array Offset, Struct Size, and Element Offset all as fixed parameters and create instances with the Array Index input as a parameter that is different for each instance. This would make it very easy to create large arrays of complex structures with only a few lines of XML per instance.

Thanks in advance for any advice anyone can offer on this topic.

Robert

1 Like