Unity Pro DDT array

M

Thread Starter

mCpg

There are several EFBs in unity to give you a length of an array. How can I find the length of an array that is composed of DDT's (basically, an array of structs). Is there any way to also get the bounds limits of an array of DDTs (meaning it runs index 1..3)?

Thanks
 
B
To view the components of any DDT, simply open the "VARIABLES and FB Instances" and then the "DDT" tab. Right click on any DDT and click on "EXPAND ALL" to expand its structure to the maximum.

As for "depth". Maximum nesting is 8 levels. I have not seen any developed beyond 3, which would be similar to an Excel Workbook (several pages of x and y data).

Remember, DDTs may be exported and imported between projects. Or, stored in a common library.
 
This isn't at all what I was asking. For anyone in the future, here is the answer

1) Make a subroutine

2) use the sizeof block to get the size of one element in the array

3) use another sizeof block to get the size of the array itself

4) divide the size of the array by the single element, this gives you the size

You can run it on the startup bit for just one scan. As far as getting the bounds, you can use the system bit for overflow and run through the array in a loop. Note the PLC must not be programmed for restart on overflow to use this technique (the default is to not restart anyway).
 
Top