So first off, I want to be clear that I love this mod. I don't think I could play Factorio any more without it. That said, the serious lack of decent blueprints to go with it is rather painful. I spent probably an hour trying to find a decent loader and unloader, and ideally a hybrid blueprint too. At first I was looking for ones that would handle a mixed station, ideally even mixed storage chests; I was disappointed. Then I decided I'd settle for monotypic ones, as long as they actually load/unload the correct quantity. Once again, I was disappointed. Even the blueprints included in this forum simply fail to reliably deliver the proper amount of goods; supposedly they are tunable, but the tuning changes as your stack
inserter research progresses. Rather than settle for barely adequate solutions, I decided to make my own. It isn't perfect, and I would absolutely love feedback. So far I've only got the 1-
wagon loader done, but I'll post the rest as I get them properly working.
Also, to be able to truly handle any request, you need a way to grab the max signal. You can hardcode a bunch of checks, set up at each station, but I wanted it to be fully dynamic. I forked UsefulCombinators and made the Max Combinator operate without filters, and output the magnitude of the max signal. We'll see if its maintainers want to merge the pull request, but in the meantime, you can get my fork of it
here. A way to pull a single signal from the list (same signal from the station connection and the output connection) would be great, but I can't figure out how to do it without hardcoding or using the UsefulCombinator.
Anyway, the station...
The arithmetic combinators on the right cancel out the train encoding, and reduce the requested amount by the train's current cargo.
The blue combinator is the max-combinator, which selects the most missing thing (green wire) and outputs it. Note that the count output is 1 higher than the input value.
The decider combinator north of the max combinator shuts down the left most loader when the train has all its cargo.
The other decider combinator shuts down the rest of the loaders when the train is almost full.
The arithmetic combinators decrease the stack size as the cargo fills, to avoid over filling.
This works incredibly well for filling a single train, even if multiple types of items are requested and the chest contents are mixed. The unloader will work basically the same way, in reverse.
The major issue is if you scale it up to multiple cars, and have a mixed payload, the
wagon might be full, thereby blocking the
inserter. If there is only one type of stuff, it's not a problem, since the last
inserter tends to be a bit slower than the others, so the
wagon with it should fill last.