We've broached a topic of max number of trains. Boskid, I'd like to hear about the complications with the system if you find the time.
For reference, my most recent post in the FFF about it (admittedly not the correct place to discuss it;) )
Feel free to join the discussion as to why it would be a good or bad idea. Boskid seems to have gone over it and identified serious issues with it already.I think you're overthinking it.
Each station would get a new field #maxNumberOfTrains and #TrainsCurrentlyIncoming
The player sets maxNumberOfTrains it to some amount. Say 1. TrainsCurrentlyIncoming is a hidden field used by the game to track how many trains are incoming to this station.
If there are for some reason 20 trains waiting to depart, the first train (procedural processing, there's always a first train) to make this station his destination. This will increase the TrainsCurrentlyIncoming field by 1. Now maxNumberOfTrains is equal to TrainsCurrentlyIncoming, so the other trains won't even attempt to leave.
If the train has departed the station, or changed it's destination for any reason, TrainsCurrentlyIncoming gets decremented by 1. Now any of those 19 trains (first to check) will claim that spot and depart.
There should be no reason why a train would be stranded in the wild (at least no new reason, outside currently existing reasons). They only depart as needed. You can set a higher amount of allowed trains if you want to create a buffer area for them.
As to your idea of "only X of those 100 trains are allowed to go to that station", well, I don't exactly know what you mean. If the station has a certain name, and the train has that station name in it's schedule, it should be a viable destination. If it's not, your schedule is wrong and should be changed. If you want to do some crazy magic, you can of course still recreate everything with dozens or hundreds of combinators, arcane mathemagics and blocking of rail signals and disabling of stations.
For most uses, a maximum amount of trains will be doing exactly what LTN is doing now. Have a number of stations with the same name requesting the same input. A number of stations with the same name offering the same output. The only thing this would not do is make trains "universals". You'd always need to have X trains dedicated to, say, the iron plate delivery. But that's certainly not a bad thing all things considered.
It feels like an incredibly easy feature for the player to handle. You just click on a station, and in the GUI you have a slider (with textbox perhaps for typing number?) to enter the number of trains that are allowed to come here at any one time.
It would be incredibly powerful, and to me be the last missing QOL change to make vanilla an equal experience to modded. As of now, trains are quite unwieldy as you expand, and using the same station name has unnecessary complications and limitions. Currently you can end up with stranded trains if you do it poorly. A maximum limit of trains per station would be foolproof and not require any complicated setup.
Edit: Also, maxNumberOfTrains should be able to be set via signal. Instead of closing/opening stations, just adjust the number of trains allowed. 0 would default to a closed station.
Think of it as now we have 2 states: Closed station and open station. Closed takes nothing. Open takes everything.
With the change we'd have 3 states: 0 for closed stations, 1-x for maximum number of trains allowed, infinite (no limit/current behavior/takes everything).
Edit: To clarify, this change would not change train pathing behavior or anything like that. It would merely alter the destination decision process, by prohibiting going to a station that already has the maximum number of trains inbound. It's just a change in this process.