Sign in to follow this  
Followers 0
lotuseater

Integer Array Search - Programming Help Needed

7 posts in this topic

In a nutshell - I have an array of SINTs that I am shifiting as a Lug Line is running for tracking. Basically, a "111" signifies an empty lug. A "1" through "13" signifies which of thirteen stations that a loaded lug came from. Stations look for a "111" to know that they can load at that postiton at that time. This array is shifted properly as the conveyor is running. Now, I need a way to tell when there is a group of 21 consecutive lugs empty for a line change downstream. I need to know where this group of array elements are in the array and load them with a filler number in those positions in order to keep them empty. I have not been able to create a very clean way of finding a group of 21 consecutive array positions with the number "111" in it. Any Ideas?

Share this post


Link to post
Share on other sites
Just wrote a quick Logix 5000 Ver 13 program for your situation. See what you think. Obviously it lack the loading logic of yours. Tracking_Test.ACD tracking_test.pdf The initvariables allows the load stations and such to be moved easily.

Share this post


Link to post
Share on other sites
Why not count the number of empty rungs as you put 111 in them. If the count gets to 21 then make that rung 112. The count gets reset when a lug has something in it. Then you can search for 112. This is much easier then search for 21 consecutive rungs. Edited by Peter Nachtwey

Share this post


Link to post
Share on other sites
lotuseater Assumptions on your lug chain layout - say there are 200 position that are usable Position 1 is the last lug on the chain before going over the head sprocket The load stations are located at positions over 170 eg load station 1 position 195, load station 2 position 192, load station 13 position 177 One unload station UL1 is at position is at location 50 (more than 21 lugs from the last load station) Another unload station UL2 is at position 160 (less than 21 lugs from the last unload station) To product change an Unload station you require 21 empty lugs Aim: to find 21 empty lugs in the chain UL1 have a counting station at position 160 when the count gets to 21 you mark lug 139 (160-21) as product change - Hmmm this does not work if the load stations keep on feeding Better method which works for both Have a virtual load station at position 196 (before all real load stations) called "product change" and "load" onto the lug chain 1 change product now followed by 20 consecutive "do not use lug" products Is this what you were after ?? Is the assumption (A$$-u-ME) correct ?

Share this post


Link to post
Share on other sites
Wow, thank you for the quick responses. Some more information on the system. This conveyor is at the beginning of the process and feeds two different lines. Each station loads the same type of product. As far as the stations are concerned, it does not differentiate between product 1 and product 2. The program will make an equal amount of product 1 and 2 downstream. In order to switch from product 1 to product 2, 21 empty spaces are required. It doesn't make much of a difference, but I am shifting my array 'up' through the positions, rather than down as mentioned. I have attached the logic I am using for shifting the array if you would like to see it. There is a photoeye at the beginning of the conveyor looking at the lugs. There are two arrays involved. The first position on Array_A currently always loads a "111". The loading stations look at Array_B. As you can see, Array_B only has values in it while the photo eye is blocked. This gives an exact positioning for when to load the conveyor. Array positions are as follows: Station 1 - Array_B[0] Station 2 - Array_B[3] Station 3 - Array_B[6] .. Station 13 - Array_B[36] Product Splitting Point - ~Array_B[48] BobLfoot: The program you created has the same basic idea as mine. However, it looks like you are counting empty lugs prior to the station locations. Since this line is at the beginning of the process, the lugs are always empty since station 1 right at the head of the conveyor. Please correct me if I am looking at it wrong. Others: I do have the ability to inhibit stations from loading. When a changeover is needed, one option would be to load 21 spaces with a "112" in Array_A[0]. This would keep the stations from loading on those lugs and the first "112" could be used to start the changeover at the splitting point. However, in a perfect world I would not want to do this if there were already 21 empty spaces on the conveyor. If the 21 empty spaces were not found after a period of time, then at that point I would use the inhibiting method. Initially, I was looking for a way to search the array. It looks like it may be easier to use counters as mentioned. One option would be to count empty lugs on the array at a few points. If a station downstream loaded I could reset the accumulated value appropriately. (i.e.: if a station 6 positions down loaded and .ACC > 6, reset the accumlated value to 6). Using a method similar to this I would always be counting empty spaces. Then when the changeover is needed and enough empty spaces were there, I would FLL them similar to BobLfoot's program. Does this still sound like the best option? ArrayShift.pdf

Share this post


Link to post
Share on other sites
lotuseater As you are on the controllogix/compaqlogix platforms, Searching and manipulating arrays is easier in structured text How about calling the following subroutine when you want to do a product change. It searches the array for 21 blanks if it cannot find then tells you how many blanks are required at position 0 for a product change If you really prefer ladder it could be translated using LBL and JMP (code would be clunky) gee i wish html would allow easier white space formatting than having to use a jpg

Share this post


Link to post
Share on other sites
Michael_G got me to thinking. I've used your logic the FOR Instruction and the AVE instruction to craft a neat search for your block of 21 empty lugs. The AVE of 21 empties will be 111 while since you load 1 thru 13 for loads the AVE will be less than 111 if there is a non empty. Check it out and see what you think. Lug_track.pdf

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
Sign in to follow this  
Followers 0