Controller - Train Scheduling 

Page / - last modified by stu115369 on 2023/07/06 14:52 

Train Scheduling 
last modified by stu115369
on 2023/07/06 14:52

Table of Contents
Train status
Section blocking
Destinations
Re-Routing

The scheduling gets interesting when two or more trains need to take the same tracks to get to their destination. The trains shall not have to wait too long nor take unnecessary detours.
Train status
A train can have one of the following four statuses:
 1.	Parking
 2.	Halting
 3.	Waiting
 4.	Moving
A parking train just sits around and has nothing to do. It can be moved if the section it occupies is needed by another train.
A halting train will start moving again after a period of time (maybe to let passengers get in and out).
A waiting train has a destination that it can not yet reach as the section it needs to use is occupied / blocked.
A moving train is on the way to its destination.
Section blocking
A section is a set of tracks between tow points that can only have multiple trains using it if they all drive in the same direction. Otherwise only one train at a time is allowed to be an a section. Tracks with points on them are a section by them self.
A section can take on of four possible statuses:
 1.	Not blocked
 2.	Blocked only in forward direction
 3.	Blocked only in backward direction
 4.	Blocked
If a section is not blocked the scheduling is trivial as a train can use the section without any problems.
If a section is blocked in one direction a second track is allowed to drive behind the train blocking the section while keeping a safe distance to the train in front.
If a section is blocked a not moving train occupies the section.
Destinations
A train can only have a train station as destination, but it can specify a favored platform. If the scheduler can not send the train easily (will be defined later) to the favored platform it will try to reroute it  to a different platform.
There are three train stations:
 1.	KH_ST_1 to KH_ST_5
 2.	KH_LN_3 to KH_LN_6
 3.	IC_ST_1 to IC_ST_3 and OC_ST_1 to OC_ST_3
Re-Routing
If a train has to be re-routed because it favored station can not be reached it shall get a platform that is as close as possible.