Examples of use:
1/2 yellow belt ratio

For this example I have set the fraction of yellow belt to numerator=1, denominator=2, or a ratio of 1/2 yellow belt (so 1 full lane). As you can see, the input belt only activates to release enough items to fill exactly 1/2 fully compressed yellow belt.
3/2 yellow belt ratio

As before, except 1.5 yellow belts instead of 1/2. It can accept any ratio, even less pretty ratios like 7/31, and will be count-perfect.
Design Principle:
The number average number of items on a fully compressed, unimpeded (free-flowing) belt is 7.1111 items/tile (or 64/9). This means that:
1. 9 tiles of contiguous compressed belt has exactly 64 items on it
2. If you count all the items on a compressed, unimpeded belt tile every tick, after 9 ticks, you'll have counted 64 items.
If you want to apply a fractional ratio N/D to a fully loaded belt:
1. Normally you'd expect 64 items every 9 ticks.
2. With the ratio, you'd expect to count 64 * N items every 9 * D ticks.
3. A flowing tile should have an average of (64 * N) / (9 * D) items per tick.
4. If you count more than this average, you need to stop the flow. If you’ve counted less than this average, you need to resume the flow.
[NOTE:] Major revision below, I now count pulses instead of entire belts. Measuring pulses, the ratio is (2 * N) / (9 * D), the rest of the mechanics work the same.
Implementation:
- Count (C) is an increasing sum of items measured per tick from the flow belt(s). Every tick, C increments by the number of items on all measured belts. (So, if you’re measuring one compressed unimpeded belt tile, C will increment by an average of 7.111 items/tick. Because we're measuring blue belts and our ratios are in terms of yellow belts, I'm measuring 3 blue belts. If my ratio was in terms of blue belts, I'd measure 1 blue belt.)
- User specifies numerator (N) and denominator (D) for the fraction to be applied to limit belt flow. N=1, D=2 represents 1/2 = 0.5.
- GREEN signal is a constant -64 * N, representing the expected number of items over a RED number of ticks. RED signal is a constant 9 * D, representing the number of ticks during which a GREEN number of items should be counted on the flow tile.
- Timer T increments 1 each second. After it reaches RED ticks, it resets to 1. Every time T = 1, pulse P=1 is sent out, so a pulse P occurs once every RED number of ticks.
- Every time pulse P occurs, a GREEN number of items is subtracted from count C. This means that for ratio 1/1, 64 items are subtracted every 9 ticks, for a perfect 7.111 average to offset a normal compressed belt.
- Flow reduction is achieved via a regulator belt tile. The regulator belt only turns ON if the number of items *expected* (subtracted) exceeds the number of items *counted* (added), meaning more items need to be added in. If too many items have been counted vs. the number expected, the belt turns OFF to limit the flow. As such, the limiter belt turns on if C < 0.
This will keep C in a constant state of fluctuation around 0. Because there is no decimal math, only items and tick counts, it will be count-perfect for whatever fraction you specify, forever.
Note for the above GIF: we're counting off of a blue belt. Since we’re expressing 1/2 in terms of a ratio of yellow belts, and blue belts have 3 times the throughput of yellow belts, we need to monitor 3 blue belts. If we want 1/2 of a blue belt, we only need to measure 1 flow blue belt. (I’m still fuzzy on the counterintuitive math on this one, I’ll figure it out later.)
Feedback:
This is by far the most complicated circuit I’ve ever made and I fumbled my way through it, so if some circuit experts could weigh in with suggestions on how to clean this thing up, I’d appreciate it.
Blueprints:
Fractional flow limiter
Handy belt compression checker, lights up if belt is compressed.