Brandon

Array of data

9 posts in this topic

Hello everybody I really need help on understanding an array of data in logix5000 everything from creating them,dimensions,how to use them ect...anything and everything will help I have read the Rockwell literature on it but their explanations are a little confusing to understand I have gone through this forum and I found good knowledge but a lot of you guys are using it at a higher level than I am.. I have never worked with an array and want to start so I can get in that next level...
Thank you for your time it will be much appreciated

Share this post


Link to post
Share on other sites

An array is a sequential block of tags.

Logix500, such as for SLC and most MicroLogix processors, is I/O-based.  Discrete inputs => I; discrete outputs => O; memory bits => B; Integers => N.

Logix/Studio5000 is tag-based.  Adding I/O modules automatically creates controller tags associated for that module.

In either package, you create tags that are dimensioned large enough for your range.  Logix500...B10[0-99] would be a block of memory bits B10/0 to B10/99.  Logix/Studio5000...Tag1.[0-99] would be a block of tags Tag1.0 to Tag1.99.

Keep in mind you need to understand the process you want to use the tag for, so that you can select the TYPE of tag/memory bit needed.  Numbers/Integers utilize different memory blocks (500)/tags (5000) than numbers/float or text/ASCII.

Arrays are amazing for programmers to utilize.  If you have processes that are very similar but different locations, such as a roller conveyor line (sections of conveyor that are essentially the same but have different locations), arrays are superb for making sure your code is the same for each section of conveyor AND giving you the ability to use one block of code in a loop to evaluate every section of conveyor.  

Example...conveyor line, 10 sections of conveyor, all have a sensor at the end and a motor drive.   One short section of code with an incrementing indexer for each section and code to execute the VFD can do the same work as 10 duplicates of code with different addresses, utilizing an array.

Share this post


Link to post
Share on other sites

If you have no concept of arrays they can be tricky to understand.  Kaiser has done a good job of explaining a one dimensional array.  In such you have a tag and you set the number of elements you need - ie, setup 100 elements and you have tag[0] through tag[99].  Multi dimensional arrays get a bit more tricky.  You can then have a tag:  tag[0][0] or tag[0][1].  It helps to understand these if you think of a table or spreadsheet.  If you think of the first dimension as the columns and the second as the rows then it helps to get your head wrapped around it.  So if I have a tag that has first dimension of 100 and second of 50 then we can have a tag such as:  tag[0][0] or tag[99][49].  If you think of it as a spreadsheet then we have 100 columns and 50 rows.  This can be useful for tracking items or storing information. We use arrays for some of our more complicated programs just for this purpose.  For example we may have a sequence that has 100 different steps and 10 setpoints for each step.  We could create a Real array with first dimension of 100 and second of 10.  If we need the 3rd setpoint for the tenth step then we could just program located it in a tag:  Setpoint[9][2]   keeping in mind that our count starts at 0.  Taking it further, we can also use another tag to point to that information.  So if our sequence is on step 10 then we can use an integer tag such as STEP and point to our information with that:  Setpoint[STEP][2]    That is very similar to indirect addressing in the SLC and so is very difficult to troubleshoot and follow later on - as I am sure you are finding out!  When we program with such logic, we make sure it is necessary and that either nobody will have to go into that logic to troubleshoot or that the staff maintaining the system is sufficiently trained to understand such logic. 

1 person likes this

Share this post


Link to post
Share on other sites

Add in User Defined Data types with arrays in them it gets real fun

Share this post


Link to post
Share on other sites
On 9/30/2016 at 8:00 AM, PLCMentor.com said:

If you have no concept of arrays they can be tricky to understand.  Kaiser has done a good job of explaining a one dimensional array.  In such you have a tag and you set the number of elements you need - ie, setup 100 elements and you have tag[0] through tag[99].  Multi dimensional arrays get a bit more tricky.  You can then have a tag:  tag[0][0] or tag[0][1].  It helps to understand these if you think of a table or spreadsheet.  If you think of the first dimension as the columns and the second as the rows then it helps to get your head wrapped around it.  So if I have a tag that has first dimension of 100 and second of 50 then we can have a tag such as:  tag[0][0] or tag[99][49].  If you think of it as a spreadsheet then we have 100 columns and 50 rows.  This can be useful for tracking items or storing information. We use arrays for some of our more complicated programs just for this purpose.  For example we may have a sequence that has 100 different steps and 10 setpoints for each step.  We could create a Real array with first dimension of 100 and second of 10.  If we need the 3rd setpoint for the tenth step then we could just program located it in a tag:  Setpoint[9][2]   keeping in mind that our count starts at 0.  Taking it further, we can also use another tag to point to that information.  So if our sequence is on step 10 then we can use an integer tag such as STEP and point to our information with that:  Setpoint[STEP][2]    That is very similar to indirect addressing in the SLC and so is very difficult to troubleshoot and follow later on - as I am sure you are finding out!  When we program with such logic, we make sure it is necessary and that either nobody will have to go into that logic to troubleshoot or that the staff maintaining the system is sufficiently trained to understand such logic. 

Thank you for the replies everybody much help.. now let's see if I understand you guys correctly say I use a mask with move for my input image and I move it into an array[0] and then I took a mask equals and I compared it to array[1] with a mask of whatever say the mask 15 so when source and compare is equal to mask its logically true so now when that is true I can use a move of 15 into my output image to turn on certain output now that if I had a certain sequence that had to be done I can use different arrays to compare to my source which is my input image to manipulate the output of what I need 

Thank you I hope this makes sense to you gays 

 

Share this post


Link to post
Share on other sites
Just now, Brandon said:

Thank you I hope this makes sense to you gays 

Sooooo what are you trying to say?  ;) 

Seriously, if I understand what you are suggesting then it sounds like it would work but just say no. First, arrays are something that should be used sparingly and there are much easier ways to do things than what you propose.  Simpler is better in a PLC. 

When you posted this originally, you inspired me to do a series on arrays.  Message me with your email and I will get you links to that material since you had the idea anyway.  I put together about 2 hours of material on arrays, indexes, usage and troubleshooting.  I think they should make things clearer for you.

Share this post


Link to post
Share on other sites

Akkkkkk!  Dont post your email in the forum or you will get spammed to death.  Use the messaging system. 

Share this post


Link to post
Share on other sites
5 hours ago, Brandon said:

Thank you for the replies everybody much help.. now let's see if I understand you guys correctly say I use a mask with move for my input image and I move it into an array[0] and then I took a mask equals and I compared it to array[1] with a mask of whatever say the mask 15 so when source and compare is equal to mask its logically true so now when that is true I can use a move of 15 into my output image to turn on certain output now that if I had a certain sequence that had to be done I can use different arrays to compare to my source which is my input image to manipulate the output of what I need 

Thank you I hope this makes sense to you gays 

 

Pattern recognition, perhaps??

Comparing an input bit pattern to a series of reference patterns stored in an array, resulting in different actions upon finding a match??

Look at the FSC (File Search & Compare) instruction.

 

Share this post


Link to post
Share on other sites

I just want to give a huge thanks to PLC mentor for taking the time and build a series of videos on arrays and letting me get access to them Im new to the programming world but I'm not new to the industry and it is hard to find good educational videos on programming from my experience the knowledge that I gained from the videos gave me the highest grade in my class for my midterm because I was able to take my project to that next level once again Thank you

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now