QUOTE(brisutterfield @ Sep 28 2006, 10:52 PM) [snapback]40974[/snapback]
I am an electrician employed by a large clothing retailer. I want to be able to diagnose problems and track efficiency of our sorters. I actualy would eventualy like to track all the various reasons why a carton diverted or not (reason codes for each carton). Im just starting with whether or not it diverted.
I actually already track and count the # of cartons diverted in each lane by using an add instruction when each divert fires. But I want to be able to do it using the reason codes so eventually I can track all 9 different reason codes that could be assigned to each carton.
What instructions are used to make a "for next loop". I could set the trigger to scan every 1 second. Not sure how taxing that would be on the processor though.
Okay let's talk Sorter Basics Then.1. What I am about to say applies to almost every sorter in one form or another.
2. Your sorter has an Entrance. At the entrance your parcel is identified uniquely and in your case assigned a reference # between 1 and 999.
3. Next Every Sorter has some form of Data Tracking method or array. This in PLC5 is usually a bit or integer file which is FIFO'd or COP'd to move Integers as the sorter moves. THis file may contain all the data about the parcel or only it's reference number.
4. If tracking is done by reference number you will then find other integer files which contain the data for that parcel usually index by the reference number. YOu have determined N88 to be sortation history file. There are probably other files holding the bar code and possibly weight.
5. Every Sorter has destinations. You've found the logic to assign sortation result to N88 and added 40 add instruction to your program already. A lot of decisions and math can be done at each destination, but it is not usually the most efficient place. If you are going to do your math at each destination I'd advise writng one math subroutine and calling it from each destination logic section rathe than writing the same code 40 times.
6. Finally every sorter has an Ultimate Exit. Whether this is the recirculaton loop or a catch all divert. Somewhere in time shortly after this Ultimate Exit is usually where Reference Numbers are cleared and Data Tables Initialized. If you can decipher your tracking schema well enough to locate the data in the tracking array just after Ultimate Exit, you need only examine the Reference nUmber reaching this "math analysis point" and process your nine adds on that number.
In Conclusion.I see you having 3 options.
1. Add 9 times 40 or 360 add instructions to your program. WHile this might be the easiest to explain and troubleshoot. It is the most difficult to implement and burns up a lot of memory.
2. Convert your 40 existing Adds to JSR's and move the add instruction to a New SBR. Then add eight more adds to that SBR. THis is probably almost as easy to understand as number 1 and only slightly less difficult to implement.
3. Locate the Ultimate Exit or Reset of Tracking for your sorter and write your math logic to act on the parcel or data which was a parcel at that location. This is the best solution for elegance and still being understandable.
Hope this helps.