Attached is an example simulation of a rail hump yard.
Trains in this hump yard are processed in three stages:
- Arrival - A train engine delivers an arriving train into the arrival area of the yard and then leaves
- Classification - The shunt engine takes trains from the arrival area to the hump. From there the train is uncoupled into sets of cars for classification, and each set of cars 'falls' to its designated departure train and couples to it.
- Departure - Once a train has been composed, it is transferred to the departure area, where it waits a random time until departure.
I've tried to keep the logic as simple as possible so you can understand the process flow. I've implemented no traffic control between train engines/shunt engine, so they will occasionally run over each other. However, I have used AGV routing constraints to dynamically block off sections of track that are filled by trains, so the engines will move around them.