It's well-known that filter inserter may have at most 5 filters (picking any of the five items listed), and stack filter inserter may have at most 1 filter at a time.
By setting filter inserters to "set filters" circuit network operation mode, and feeding them N possible filters one-by-one in a loop (for one tick each), it's possible to go far beyond the limit by sacrificing a bit of inserting speed.
Once picking up an item, the inserter would proceed to put it to the destination tile regardless of changed filters. So for N filters, we sacrifice at most (N-1) game tick (around (N/2) on average) per item (or per stack of items) of speed.
The trick requires (N+2) combinators to perform; you can re-use those for multiple inserters though. 2 combinators are necessary to produce a timer signal T that loops from 1 to N, incrementing on every game frame, and N combinators perform "if signal T is equal to constant n, output n'th item signal".
The output mode for these N inserters may either be 1, or "input count". In the former case, the inserters under control of these combinators operate as statically configured inserters with a fixed set of filters. In the latter case, you can additionally pass item signals to the combinators (signals similar to what you'd pass to a normal inserter to configure filters), and then the whole system would also have dynamically configurable filters.
On the screenshot, N is equal to 4, and i'm programming stack filter inserters (those in white boxes on the left) to take the necessary goods from a train, as long as the station requests them. The station then sorts incoming goods through a "baggage carousel" pattern, and sees how many goods has in its temporary buffer and requests more if necessary, with an additional latch (a pair of combinators per kind of goods, not in the white box). Signals from these latches configure filter inserters again, and additionally request trains to actually come to the station. Stack filter inserters definitely outperform regular filter inserters with 4 continuous signals in this setup, so i'm quite happy with those.
I did not try to program regular filter inserters this way, so that to feed them with a moving window of 5 signals out of N on each frame; it should still be O(N) inserters though.
A blueprint of the combinators in the white box. The red input is enabling or disabling particular goods, and the green output is what you plug into your inserters.
Code: Select all
H4sIAAAAAAAA/8WWb2+bMBDGv0rEazOFf9mkzt9i76rJovalOw186DBVI8R3n4FUSro4hajL8orofM+dfw+HbWhTkS6rjZI9WIcOoZV9b8saZKTJtq60LtZU
P6EtHXEkGmr9KrKyf5VxKg5yOwi/0DFV6gl+lS9ILPs9Vg54lGrx2ZaV7N2h8ZIvyK4rq0jMFeZg/CMaNTrrZCLQGniVyTBMshb0WMwLPUZJ9FP2zwzga8/N
HhQamQqNrDt0059h/InjBgxoNMDh/hPff7z9UlzawjFZ+YjBYxN75Nap5Vua+cncP9ZNyWMHMvoeCepc060Rag5qAqT2TLVC67Ol4w5upSROQvlpaAL/GKUL
VJIzlWQV+TuBT8/AywB4dFC/qXjUje+bGG7hzmDOeOVhXrt31MXftFdkX/EsDzu/u310tvcxMFltIDLZz7IvCxvw7aJjV+YjW+5Ydrst2f/4oC2bK6/4CZYs
GJsVs7ELz8bXVdzT+3DPVnNvHdl/PQvFx56syL5iVxG268rMeHT6dzzfSGK0LbB/OLevCN1j3kRrMqBor8gfDuWUlSw9eYtwZzUY7OoYKq/CqOOGKnh3Q8l9
Z4FSHxw2cyXUU0offkMuvNrDyS3sgcF1bDfqAaz5A6lm+r0vCgAA