Use the version linked above. Do not use any older version in 0.13 (it won't work). For 0.12 maps you can still use the published version 2.
The information below is outdated but I'll leave it here for the moment since it's still valuable for those who want to learn how to make such a system.
What does it do?
Your trains will dynamically react to supply and demand and mostly do "the right thing" by themselves. Rail capacity is used efficiently and management is made easy.
It's a Logistic Network of Trains. Trains are sent from a central depot (roboport), go to outposts to pick up resources (providers), drop them off where they are needed (requesters), then return to the depot. There's only one train line (logistic network), and the trains can go anywhere, like robots.
- Only one supply line: Run all trains on a single logical line, out of a single train depot (hub). Adding trains to the network is trivial: just plop down the train anywhere, preferably in the correct driving direction, assign it to the supply line, and start it. Done.
- Dynamic train assignment: Trains don't have to be assigned to certain outposts or certain resources. Every train on the line can service any outpost. It's not necessary anymore to figure out how many trains to assign to each outpost, and you won't have to reassign trains all the time when outposts run dry or new ones are opened.
- Supply detection: Outposts are not visited unless they're offering enough resources. No more half empty trains clogging up your railway. Use your own combinator logic to set the resource condition (it can be as simple as "> 1k ore" or as complex as you want).
- No more train monkey business! While an outpost is being serviced, i.e. has a train en route to pick up resources, no other trains will visit that outpost. The common problem of two trains arriving at an outpost in short succession is completely avoided!
- Demand detection: Demand from your factory is taken into consideration. A resource is not even eligible for pickup unless your factory requests it. For example, while your coal bunkers are full, your trains won't waste time making roundtrips to your coal mines. You also won't have trains full of coal sitting around at the coal unload.
- Easy refueling, since all trains run through the same hub (Smart Trains does have a great refueling solution, but you won't even need it).
- Flexible: the system is not limited to ore, it can be used to ferry intermediate products, too, even on the same logical line with the ore trains.
- Practical, easy setup: no rewiring shenanigans necessary, combinator knowledge is not required. Two values need to be changed at each new outpost, and you're good to go. The station number can be taken verbatim from the Smart Trains UI, no desktop calculator required.
- No outpost limit: the circuit handles as many outposts as you need (no limit at 31 bits or anything like that).
My smart train controller requires the "Smart Train" mod by Choumiko; no other mods are needed, but FARL is a practical requirement because you need signal wire to connect all your outposts with the main depot.
Here's an animation that shows off some trains running:
Here's how the depot looks in game:
How does it work?
The system requires a combinator setup at the depot and at each outpost. It also requires red signal wire to connect all outposts and the depot.
All train stations need to be "smart train stations" as provided by the Smart Trains mod.
I'm now going in great detail over the workings of the outpost circuit and the depot circuit. Keep in mind that most of the signals that are processed are exactly 1 tick wide. Some of the contraptions only work because of this.
Before I go on, let me thank users Lupoviridae and XKnight for giving me various ideas in their forum postings. I could not have come up with some of that stuff on my own...
You should know how combinators and signals work and you should be familiar with the Smart Trains mod.
Update 23.05.2016: Improved the demo map, demand from the unload is now calculated and used as input for the depot circuit. The dummy demand combinator has been removed. I've also streamlined the loading and unloading a little.
A demo map is attached to this post, and a collection of mods (only Smart Trains and Test Mode are required for the demo map, the others are for convenience).
The demand flags from the unload are transmitted with green wire and used as input for the depot circuit. The lights at the unload indicate if the unload is running low (the threshold is set to 7k ore, you can change this value as you see fit).
The combinator at the depot powerpole (north of the rail) can be used to suppress polling and reset the flags at the outposts (it will practically suspend all delivery and the trains will return to the depot). If you want to activate it, just connect it with red wire to the power pole right next to it.
Update: There's a new version here. It's much better than this one, but might still contain bugs. Edit: The new version seems to work fine, if you use the latest pre-release of SmartTrains (don't use the version from the mod pack). I've found no issues so far and I'm currently using it in a real game.
The stuff below is OBSOLETE. Only here for archival purposes. It will work in 0.12 though with the provided mods.