Posted 26 Apr 2015 I'm new to rslogix 5000, this is my second project and I need some advice from some of the experienced programmers out there. Sorry if this is a little long. I have a project that will drill and tap holes in a manifold, the manifold can be 3' to 10' in length and 1" to 4" in diameter. There a four rows of holes to be drilled, the number, row degree and size of hole can all be varied by the operator input to the recipe entry. I set this up to let each set of holes or hole to be a segment (just a label). I created an array 2 d for position and hole size. Which I was going to step through the array, one element at a time, no problem. Well, half way through the project the boss wanted to be able to sort the holes by the largest of the same size to the least in number and size. The reason for this is to keep from changing tools so often and make the system more efficient. I have done the motion with no problem, electronic gearing, ratio, computing the move distances. So I was surprised when this sorting issue kicked my back side. Any advice would be welcomed. Share this post Link to post Share on other sites
Posted 27 Apr 2015 Yeah, that's tricky. I don't suppose you could convince whoever does the data entry to enter the holes already in the required order? The problem is that the SRT instruction only works on a single dimension. It doesn't sort the entire multi-dimensional array together, so while the data is sorted by hole size, the rest of the data doesn't get sorted along with it. So, you'll have to roll your own. If you have a small number of holes, you could brute force it. But if you have a large number, it would be nice to have an algorithm to do the sortation for you. Either way, you're in for some code writing. What I would probably do is create a second array that matches the original in size. Then, starting with the smallest hole size, search the original array for the first entry that matches it, copy the entire row (hole size, position, etc.) into the second array. Repeat until you've found all entries of that size. Then do it all over again for each hole size. Check out the FSC instruction. It's a pretty flexible search instruction that let's you use an expression to find a piece of data in an array, and returns the position. It returns the first matching value, then clearing the IN bit finds the next, and so on until the DN bit comes on. Just vary the expression for each tool size. I've used this in combination with FOR loops to do similar functionality to what you've described. It's not as simple as sorting data in Excel, but it works. Share this post Link to post Share on other sites
Posted 27 Apr 2015 JRoss thanks I will give this a shot. I will see if creating an array for hole size, number of holes of the same size, tap size, position and tap pitch will get me what I need. Share this post Link to post Share on other sites
Posted 28 Apr 2015 (edited) I would agree with JRoss as the FSC is great tool for doing the search/sort your needing. Let us know how it turns out! Edited 28 Apr 2015 by a062549 Share this post Link to post Share on other sites
Posted 3 Jul 2015 Just wanted to follow up and let you know have the recipe down pat. The problem was how the HMI would write and read, and of course this dumb ole country boy had to learn some new tricks. Thanks for the help it came in most handy. Now I'm working on why my tap servo stops when it goes to reverse after it has already tapped six holes. Six holes every time???? I get Feedback Error past Factory Limit and notice it dropes 6 data packets each time this happens. I will keep digging if you know anything let me know. HAVE A GREAT FOURTH OF JULY. oldnerd Share this post Link to post Share on other sites