That should be easy with one bit indicator: If BOTH photosensors for the exit queue are OFF(empty exit points), then turn on the indicator bit for "EXITS AVAILABLE". The 2-unit Exit Queue is your worst bottleneck, so ony do the Exit mode or Empty step when both exit points are empty.I need to know if there is a unit in either of these [exit] queue spots...
(1) For efficient traffic control, divide your program into two rough steps or modes: Fill Workstations, and Empty Workstations. During FILL, all empty workstations are filled with units, highest empty workstation number filled first, then second highest. Then you switch to the EMPTY mode, and wait until TWO units are processed ("WAITING TO EXIT" bits are ON), allow those units to move to the exit queue in reverse order, then switch back to FILL mode. This two-step process allows the maximum movement of units with the least chance of a collision between entering and exiting units....and/or if there is one or two units currently exiting and enroute to fill these spots. If this is true, I need to prevent any other unit from exiting until there is an open queue.
(2) Set up two 24-bit memory areas for all workstations (N7:1/1 to N7:2/9 for Workstations 1 to 24 in process mode). If a workstation is "processing" turn the "PROCESSING" bit for that workstation ON.
(3) After some T maximum time (longest possible processing time for that workstation) with that bit ON, set another bit in another memory area (N7:3/1 to N7:4/9) for "WAITING TO EXIT".
(4) When the "EXITS AVAILABLE" bit is ON, find the first two units allowed to exit by searching the "WAITING TO EXIT" bit locations in reverse order (highest bit first, then next highest). The reason for this is to avoid traffic jams. If you let the farthest-downstream finished unit exit first, then the next upstream, and so on, you will avoid collisions on the main conveyor. When two units Waiting to Exit are allowed onto the main conveyor, then you reset the "EXITS AVAILABLE" bit and also the "PROCESSING" bit for that workstation so that no more exiting units are allowed, and the FILL mode is restarted.
(5) You will need some time delay between EMPTY and FILL mode, to make sure that the last exiting unit is out of the way. The length of this time delay will depend on the time for a unit to travel from one station to the next. Set the timer delay to T, where T is the time for a unit to travel from one station to the next. Because the workstations are being filled highest to lowest, an exiting unit only has to about 1 workstation down the conveyor before another entering unprocessed unit can be started.
Last edited: