In my last base I used the new train limits to connect my suppliers and requesters - i.e. I had a train line for each good (like iron plates) picking those up whereever these were available and delivering those to any station where it was needed. That worked pretty well. And I thought - why not take this one step further.
So - a train might pick up Iron plates and deliver those to a station where it is needed, e.g. to green circuits. Once empty, it would drive to another pick-up station - but not necessarily iron plates. It could drive to my pick up-station for green circuits instead and deliver those to e.g. my blue circuit production instead. I mean - that is how real life logistics work.
Of course, there will be some massiv challenges if trying to implement something like that in Factorio. Somehow I need to make sure:
- loaded trains will go to a station fitting to their cargo.
- trains already on the way to the correct station should not reroute to somewhere else.
- emptied trains will leave the station and not wait for any empty pickup place
- Offloading stations have to be robust against occasional wrong trains arriving
- Both starvation and overloading of stations with trains (both pickup and offload) must be prevented
The first issue looks really tricky, but for that I have an idea. Along my railway lines I'll have a whole network of green and red wires to exchange signals - this is obviously necessary to pull anything like that of. Along that I'll send a "rotating" signal. For one tick I'll send Iron Plates with the value one, in the next tick this value is set to 0, but Copper plates is set to 1, etc. This will go through the whole list of goods I send via train. The condition for leaving a pickup station is set to full cargo and the signal for this good is 1. The train limits for offloading stations is multuplied with the value of the good it receives. So in theory - a train fully loaded with iron plates will only leave the station once it's the turn for iron plate trains to start. At the point only stations which want to offload iron plates are able to receive that train, so it will pick a free one of those.
A potential problem I see here - what happens if all possible offload stations are already fully satsified? As far as I understand the system the train would be already set to have "left" the station even it is standing there, and will start driving off as soon as a station is free. And that might happen in a tick in which a different good is "active". I might solve this by having an additional signal after the station which I only allow to be set to green if the good of the station is the "active" one.
The rerouting while on travel should be not such a big issue as long as my train network is robust enough I think. Trains should only wait for longer time in stackers close to their actual target station. Or would trains parked in stackers already set for a specific station possibly reroute? Or do they stick to their target? I'm not sure about this point.
In case no empty pickup place is available I might just send trains to a waiting station which is inactive normally - this should also be no big issue.
Making offloading stations robust should be straight forward - use filtered stack inserters to unload the wagons and set the leaving condition to expected good in train = 0 - in that case even if somehow a wrong train arrives it should just rush through.
The starvation or overloading issue is the hardest to judge for me. Trains typically prefer targets nearby, so a mining outpost far away could wait ages until a train arrives. In the mean time stations in the center might be overcrowed. I hope this should be prevented by setting clever train limits for both picking up and offloading stations and have the right number of trains. Enough but not too many. But that is something I'll actually have to see if it works...
So my question to the crowd wisdom out here is: Did I oversee something fundamental here? Did someone perhaps even already try something like that and has some experience and hints?
I know it's not the easiest and most straight forward approach, but that's exactly the reason I try to do this challenge.
