The black line represents the track with direction of travel from left to right.. The tracks have main signals and most have distance signals also. The initial signals have distance signals on the same pole as the main signals, so the distance signals are dark (off) when the main signal on the same pole is at aspect zero (stop). In later tracks the distance signals are on their own poles some distance before the main signal and thus are always on.
Two routes are defined along the track and they are chained together. Initially a train (indicated by blue) is at the far left track. Track is then booked along the first route, and since there are no obstructions, also the second route is seamlessly booked, thus booking the track along all the tracks.
The main signal goes to aspect one, (green) and the train starts off. As the train reaches each main signal, the signal goes to aspect zero (red) and also sets the signal two tracks further along to come off aspect zero. As this happens the distance signals also indicate the new signal aspects. Towards the end of the trip, the main signals also use aspect 2 (slow) and this is also reflected in the respective distance signals.
As the train progresses, track behind it is released.
Multiple distance signals serving multiple main signals!
With complex track configurations at a station it is very possible that trains passing a distance signal may get to one of a number of main signals. i.e. there is more than one main signal for a distance signal. Similarly, it is also possible for trains to pass different distance signals to arrive at a main signal.
This video shows my train control software handling both these cases. It uses German colour light signal rules, in which a distant signal on the same pole as a main signal goes dark (off) if the aspect of the main signal is zero (stop).
A blue train travels past a main signal with a distant signal which reflects the aspect of the next main signal on the middle track on the right.
Then an orange train comes from another track and passes a different distance signal that also reflects the aspect of the same main signal that the blue train used. Two distant signals working with a single main signal.
The a third train (purple) passes the distant signal that the blue train used and goes onto the lower right hand track and thus passes a different main signal to the first two trains. Now the distance signal reflects the aspect of the lower main signal. One distance signal serving two different main signals.