Goal
-Sushi belt for uneven products (sushi for equal products is relatively simple)
-No loops (Loops to recycle products back in is the ez way out)
Sushi belt logic
A good recipe to test with this experiment is blue circuit which requires 20 green and 2 red. First, the sushi belt needed to be created that provides the proper 20 to 2 ratio. The problem I initially had tho was that the counter I used in my initial design was too slow to stop the belt fast enough to send the proper amount. With the help of u/Caps_errors, the quick solution was to connect both the memory cell AND the read line to the enable/disable belt so that without having to have go through the memory cell to load the proper count, the belt could disable the tick immediately right after the desired circuit amount was reached. This was the simple part.
Inserter logic
Starting with just one line of assemblers, the first issue I had is sometimes the assembler requires red but has green in front of its inserter. So I double up on inserters. But then the problem was sometimes red or green circuits built up on the end when the filter inserter though could only pick up the other. This was fixed by mirroring the design and putting alternating filter inserters.
The problem now is that even with the proper ratios provided to the assemblers, sometimes the assembler syncs so that the top assemblers have red and don't have green but the bottom assemblers have green but no red stopping the whole thing. The first thing I tried was to fix the inserters to a clock. But the problem with this implementation was you can set the max stack size but not the min stack size. Even with a clock this messed up the distribution of ingredients.
So the required fix was to make sure that the assemblers took an equal amount of red and green. The same circuit from the sushi belt logic was utilized to pick up the proper ratio. This increased the delay before the system locked up but alas did not fix it. The problem still was syncing between the assemblers. Therefore, instead of each assembler resetting independently with the proper ratio, I synced all of them together to reset when all of them reached the proper ratio once. Now, the assemblers didn't starve each other.
Now here was the most difficult part. 64x speed, it lasted quite a while but it still came to a deadlock. I added counters to the design to diagnose the source of the problem and I found a very annoying problem. To explain how the system works, the system counts until 30 green and 3 red before resetting. This should work theoretically but sometimes the count went to 31.
Scenario:
Inserter is set to enable when total <30 so should disable when count is 30.
Code: Select all
Tick 0: Memory cell = 29. Total = 29. Inserter enabled.
Tick 1: Memory cell = 29. Inserter pick up = 1. Total = 30. Inserter enabled.
Code: Select all
Tick 2: Memory cell = 30. Inserter pick up = 1. Total = 31. Inserter disabled.
The first solution I came up was to create a 2 tick clock that disabled the inserters every other tick hoping to slow down the logic a bit. This just gave the inserters seizures and destroyed all functionality.
The next solution I came up was to create a combinator that added 1 fake count to the count until the count reached 29 and 2. This properly disabled the inserter for one tick for a moment.
New Scenarios:
Inserter is set to enable when total <30. Fake count enable when memory < 29.
The case where the inserter is lucky and picks up an item the same tick it's disabled.
Code: Select all
Tick 0: Memory cell = 28. Fake count = 1. Inserter hand = 0. Total = 29. Inserter enabled.
Tick 1: Memory cell = 28. Fake count = 1. Inserter hand = 1. Total = 30. Inserter enabled.
Tick 2: Memory cell = 29. Fake count = 1. Inserter hand = 1. Total = 31. Inserter disabled.
Tick 3: Memory cell = 30. Fake count = 0. Inserter hand = 0. Total = 30. Inserter disabled.
Code: Select all
Tick 0: Memory cell = 28. Fake count = 1. Inserter hand = 0. Total = 29. Inserter enabled.
Tick 1: Memory cell = 28. Fake count = 1. Inserter hand = 1. Total = 30. Inserter enabled.
Tick 2: Memory cell = 29. Fake count = 1. Inserter hand = 0. Total = 30. Inserter disabled
Tick 3: Memory cell = 29. Fake count = 0. Inserter hand = 0. Total = 29. Inserter disabled.
Tick 4: Memory cell = 29. Fake count = 0. Inserter hand = 1. Total = 30. Inserter enabled.
Tick 5: Memory cell = 30. Fake count = 0. Inserter hand = 0. Total = 30. Inserter disabled.
There. The system was fixed, and now the system works indefinitely.
Limitations
-No full beacon coverage
-Overly complex inserter logic
-Assemblers have some downtime.
Conclusion
I think I came up with A solution to the inserter logic. I'm pretty sure there's a much simpler solution out there. I think I can already simplify the current design by 8 combinators. But a completely new approach is needed for a more elegant solution.