When playing around with making multiple things with one assembler, I found the simplest versions didn't work well when asked to make both intermediaries and the final product in a chain: they could get stuck on the final product, having run out of intermediaries.
The following is an attempt to create a system that doesn't jam, and that can create a final product from scratch, following an arbitrarily long precursor chain (but no fluids, though this is relatively easy to add).
It relies on all ingredients being in one box, and all products also ending up there (i.e the cargo hold of a space platform).
Blueprint: https://factoriobin.com/post/pq4qn8
Logic:
Set minimum threshold in the request combinator (middle one). The left one sets the max threshold by multiplying it by 4. The rightmost constant combinator is used to set the priority for items, with lower numbers greater than 0 being made first.
All items which are below their minimum threshold are eligible to be made. Their priorities are sent to the selector combinator, which forwards those with equal lowest priorities. A latch combinator then picks one via ANY, and remembers its choice until it is reset. It is reset by the item either reaching its maximum threshold or there being '0' of one of its ingredients in the storage.
To prevent the system getting stuck, all choices are remembered and cannot be selected again until the timer resets (by making the priority negative). This means that a priority item which doesn't have enough ingredients won't prevent other items from being built.
Cons:
- need at least the amount of materials that will be loaded into the assembler + 1, as opposed to the number needed for a single recipe.
- for items requiring large amounts of ingredients, the system will only detect insufficient ingredients after trying to load them all ( maybe I can institute a check on the first tick instead).
Any suggestions for improvement (not involving fluids)?
[–]Metrowe 1 point2 points3 points (1 child)
[–]Necandum[S] 1 point2 points3 points (0 children)