3-dimensional matrix programming

coibarra

Member
Join Date
Oct 2018
Location
Grand Junction
Posts
4
Hello All!

I'm using an Allan-Bradley PLC (ControlLogix L61) and would like to know if its possible to make a 3 dimensional matrix. I want to populate each cell (i.e. 10x10x10 would have 100 cells with predefined values) and I would like the program to be able to pull the value from the cell depending on what the user input is.
Example: a 10x10x10 matrix is populated by me with 100 random values. I would like to pull the value from the [5,4,3] spot at my command.

This will get me basic functionality of my end goal but I might be able to finish it up if I know where to start.

Any ideas?
 
Welcome to the PLCTalk forum community !

The general answer is "yes, you can do that". ControlLogix tag arrays can contain up to three dimensions.

The syntax is exactly as you describe:

"MyDataArray[3,4,5]" is a reference to the data element with offset [3] in the first dimension, offset [4] in the second dimension, and offset [5] in the third dimension.

You can also use a Tag in place of any of the array index values;

XDim := 3 ;
YDim := 4;
ZDim := 5;

MyDataArray[XDim,YDim,ZDim] is the same as MyDataArray [3,4,5].


When using array tags, I always limit-check my index values to be sure they are in the range of the array, so that I don't inadvertently fault the controller by forgetting that a ten-element array has elements 0 through 9 and no element 10.
 
And because it's not totally intuitive; you create an array by entering a Data Type with the array dimensions in square brackets.

Create a tag and make the data type "DINT[10,10,10]" and you'll have a three-dimensional array with 1000 elements total.
 
This might be easier than I was expecting. My ultimate goal is to use 3 live values from three different processes to define the location in the multi-dimensional array. Pull that value and hold that value until the next reading.
 
This might be easier than I was expecting. My ultimate goal is to use 3 live values from three different processes to define the location in the multi-dimensional array. Pull that value and hold that value until the next reading.


As we say over here, "as easy as falling off a log".


You can have arrays of 1, 2, or 3 dimensions of any data-type, including structure UDT tags.


The only limitation is the maximum size of a single array tag cannot exceed 2MBytes !!


Just watch out for those indices, a 120 element array dimensions go from 0 to 199. I often create them 1 bigger than needed, and use 1 to 200, for example, wasting the "0" locations.



Having said that, they are sometimes very useful, eg. to hold "zero-filled" data that can easily be COP'd or CPS'd into another location to clear it.



I've even used the "0" location in a recipe array as en "edit buffer", so the operator never edits the source data, and only commits it once he's finished editing.
 

Similar Topics

I have a task that could easily be solved using a 2-dimensional array using a ControlLogix processor, V32+. Basically it will loop through two...
Replies
23
Views
4,335
Hello all, I am working on a project with an s7-1200 and I am controlling three stepper motors using this controller. I will be receiving input...
Replies
5
Views
2,392
Hi, Does anybody know how to pass a multi-dimensional ANY array into a DFB? I have some 2D arrays of REALs (e.g. Array[0..99,1..299] of REAL)...
Replies
9
Views
2,763
Will the same trigger value in different dimensions create multiple alarms Thank you for your time and attention
Replies
9
Views
2,184
Can Ignition Edge handle working with multidimensional structs/UDTs on the PLC? Say I have an array of UDTs each element represent an identical...
Replies
8
Views
2,982
Back
Top Bottom