I wanted to figure out my own method for a flexible refueling station (i.e. one that can handle multiple configurations of locomotives and cargo wagons without loading fuel into the wagons), but now that I've done so I'm ready to come here and have my design torn apart and be shown what the community considers best practice. Am I close? Am I way off? Is this concept even preferred over different refueling stations for different configurations or just giving every pickup and/or dropoff station refueling capability? (I poked around for a bit but didn't find anything on this precise topic.)
For each train section, Inserter A attempts to remove fuel. If it succeeds, it deactivates itself and activates Inserter B, which fills the presumed locomotive with fuel. After the train leaves the station, the system resets.
Weaknesses:
—Requires there to be at least 1 unburnt fuel left in locomotive. For nuclear fuel, that's up to half the total fuel capacity! (3 plus 1 being burned)
—
[edit: I was able to solve the latter weakness by using power switches instead of merely setting a condition on the inserter itself. If the inserter is conditionally disabled but still powered, it will stop swinging its arm but it will still drop something it's holding into a valid container if one happens to appear underneath its arm. If the power switch is conditionally disabled and the inserter is NOT POWERED, then the arm will not drop its contents, if any, even if a valid container appears underneath it. This adds to the size and complexity of the setup, but only for non-nuclear fuel, since the issue does not occur with nuclear fuel (with a natural stack size of 1, the arm cannot drop part but not all of its load and thus will never freeze extended over the track with fuel in its arm), and even if it did occur the original workaround (setting the inserter's stack size to 1) doesn't negatively impact nuclear fuel's refueling speed.]
Strength:
—Doesn't need to be built to match specific train configurations: can service any train configuration provided that the refueling station is physically large enough.