Array, controllogix

dhirenkumar

Member
Join Date
Aug 2009
Location
Australia
Posts
4
How can i create a storage array which is having 3 variables means it consists three data which i will get from another array like time, level,pressure, Again i want only one array in which i can see this three variable for 100 elements.

Can u help me in this mattero_O
 
Create a User Defined Data Type (UDT). Under Data Types, User Defined, add a new one. Call it something that's descriptive. Let's say MyDataType for now. In this new type create your different elements. Eg Level DINT, Pressure REAL, Time STRING.

Once you do that, create a tag (example MyDataTag) and assign it of type MyDataType (instead of the normal INT or REAL, etc.). Dimension the tag to 100.

Now you have an array called MyDataTag that can be accessed as such: MyDataTag[0] to MyDataTag[99]. Each Tag also has your individual elements and can be accessed as such:

MyDataTag[0].Level
MyDataTag[0].Pressure
MyDataTag[0].Time

and so forth.
 
Thanks Rob , yes it works as u said,
but i want the store data in the form of raw means
Time[0]:Level[0]:pressure[0]
and i have made pointer to increment the array
have u got any idea?
Thanks
 
Thanks Rob , yes it works as u said,
but i want the store data in the form of raw means
Time[0]:Level[0]:pressure[0]
and i have made pointer to increment the array
have u got any idea?
Thanks

You can create your UDT elements as 3 arrays, like this

Time DINT[100]
Level DINT[100]
Pressure DINT[100]

Then the tag you create of that type (let's call it MyData), will be addressable as :-

MyData.Time[nn]
MyData.Level[nn]
MyData.Pressure[nn]

where nn is your index variable, 0 to 99
 
Or if you want to be mean to the next programmer ...



DataSet DINT 100,100,100

Then your data could be addressed as follows

Dataset[nn,nn,nn]
 
Or if you want to be mean to the next programmer ...



DataSet DINT 100,100,100

Then your data could be addressed as follows

Dataset[nn,nn,nn]

Quite, but that takes away the meaningful names of the data elements.....
 
Quite, but that takes away the meaningful names of the data elements.....


That's why it would be mean to the next programmer and give the original programmer a bad rep.

Personally, I wouldn't do it. I document the heck out my programs ... that way I can figure out what I did.
 
You can create a 2-dimensioned array, ie. DaTable[100,3]

Then, Time[n] is DaTable[n,0]
Level[n] is DaTable[n,1]
and Pressure[n] is DaTable[n,2]

This presents all kinds of possibilities for confusing the next guy.
 
To the OP....That's why we led off with the UDT solution....All the alternatives are possibilities but as everyone rightfully pointed out, it'll be confusing to the next guy. Using UDTs is more straightforward and provides a level of self documentation.
 

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,284
Hello All, I am currently working on a Project that retrieves data from a SQL table and stores in a PLC. This data is an array with multiple rows...
Replies
2
Views
2,901
All Working on a new program and I am using several strings that are arrayed. I am now trying to enter my initial data into them in the data...
Replies
4
Views
2,052
Thought this would be a built in instruction but can only find SWAPB that only works on one word at a time.
Replies
5
Views
2,360
Hi Thanks for reading this post. I Having trouble writing Wonderware array values to a compactlogix PAC. I can read the values through a...
Replies
1
Views
4,119
Back
Top Bottom