A Priority System

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
YourTypicalZac
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Nov 29, 2020 1:22 am
Contact:

A Priority System

Post by YourTypicalZac »

part.png
part.png (182.02 KiB) Viewed 1487 times
This is a node in my system. Using the constant combinator below the block of 12 combinators on the right the signal P (for priority) can be configured. When connecting multiple nodes together only the nodes with the largest values of P will be active.

I originally designed this to be used in a city block type base where there are multiple train pickups and drop offs for a variety of items spread around the base. To control whether or not a station was active an SR latch was hooked up such that trains would only come if the latch was "set." However problems arose when secondary outputs overflowed. The entire base would lock up once a critical item was produced as a secondary output but not be picked up by trains since all the drop offs were already full. If trains would prioritize picking up these critical items from areas where they were a secondary output, then the base would continue as normal.

Here is a simplified version of the base's rail network using the priority system. (The green lamp below the rail indicates a station is on)
simple.png
simple.png (201.57 KiB) Viewed 1487 times
The train will go to the bottom station to drop off iron plates, then go to the stations above it to pick them up. Each station has a node hooked up to it with priorities top to bottom: 500, 500, 100, 250. The top two stations have the highest priority and therefore are active. After the train goes to the top two stations their SR latches will reset temporarily removing them from the priority system. After the top two stations disable the bottom station will be active since it has the second highest priority.
simple2.png
simple2.png (197.44 KiB) Viewed 1487 times
If a higher priority station activates again, then any lower priority stations will disable regardless of the lower priority stations' contents.
simple3.png
simple3.png (169.52 KiB) Viewed 1487 times
This system works by using the average priority of all active stations. If a station's priority is greater than the average priority, then it adds it's priority to the average calculation. If a station's priority is less than the average priority, then it removes it's priority from the calculation. Since stations remove their priority if it's less than the average, the average converges to the highest priority. To prevent stations from flashing on and off while the average converges I have a clock that resets upon a station's activation to delay the actual activation of the train station. To calculate the average I just have the sum of all priorities on green and the count of priorities on red then dividing the sum by the count.
part_annotate.png
part_annotate.png (243.49 KiB) Viewed 1487 times
Blueprints:
node

station
Post Reply

Return to “Combinator Creations”