This is an old revision of the document!
The overall plan with the lines
mod is to have a timetable scheduling system which is integrated with the other advtrains functions, especially the stop rails. This is the concept for it.
This is currently a draft, and subject to discussion before I will start implementing it. Please bring in your ideas, suggestions or critics. Just add them under the relevant headline and sign them with your name (use the “signature” button in the editor toolbar)
A timetable is a structure consisting of multiple “timetable items”. Every timetable item belongs to a Location and an optional Track code, and identifies one stop rail that the train should stop at or pass.
The timetable item holds:
* The stop modes should get better names — orwell 2021/04/19 22:11
All arrival and departure times in the timetable are relative to the initial departure time of any given train. That means, the timetable only defines after how many minutes/seconds after its initial departure at the first location it should be where.
Every timetable has an unique name and is saved globally.
When a timetable is assigned to a train, the train forms a Service of the line the timetable belongs to. The train then gets an instance of the timetable.
In the timetable instance, the relative times are replaced by the actual absolute railway times by adding them to the planned initial departure of the train. The lines in the timetable instance gain additional “computed properties”:
The “ready time” is determined from the expected arrival time. For a normal stop, this is the arrival + stop time, for “wait for departure” just the arrival time. When guaranteed connections are involved, they might affect the ready time too. For pass-through items, for which the departure time is only an orientation and the train never stops, there is no “ready time”.
At arrival and departure at every place, the expected arrival/departure times for this place become known and are saved, they are then called “actual departure/arrival time”. Every arrival and departure cause the subsequent expected arr/dep times to be recalculated.
This expected/real times system forms the base for departure displays both in trains and in stations.
This could use a better name — orwell 2021/04/19 22:11
At the first station in the timetable, trains “enter” the timetable and get timetable instances. For this, the timetable defines a service interval by means of two times:
For example, interval 05;00 offset 02;00 would result in a train every 5 minutes at minutes 02,07,12,17…
We call such a possible initial departure time a slot.
When a train arrives at the timetable entry point, it picks the next slot and constructs its timetable instance from it. If the first timetable item has a minimum stop time, this is taken into account too.
It may be considered whether to add a “late departure threshold”, say the train arrives a few seconds after a slot has passed, instead of waiting for the next slot, it departs at the previous slot and carries an initial delay then.
The system must ensure that each slot for each timetable has maximum 1 train using it. Slots may however be missed, in this case a departure display could display “train cancelled”. So, advtrains must somehow keep a mapping which train is assigned to which slot.
A train can enter a timetable in one of two ways: either as follow-up to another service (another timetable), or initiated.
Follow-up service:
For such a follow-up service, the end point of the old timetable should obviously be the same as the start point of the new one.
Initiated:
… to be continued …