Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The Scheduler is used to route between segments with contact. Each train is scheduled individually without looking at the other trains. Other trains only influence this by the inputs route and train_on_track. Following inputs are used to achieve this:

  • initial_position: Send by Controller as input, only used in first tick, then never again, determines the starting position of a train. Has to be a segment
  • final_station: Send by Controller. Is influenced by deadlock avoidance if necessary (forces a destination on blocking trains that do not have a destination)
  • current_position: send by hardware abstraction to determine the current segment
  • reached: send by hardware abstraction to signal, that the segment specified by next_segment was reached
  • route: 0 or 1. From every station it is possible to take two different routes to an other station. If route is 0 the normal "shortest" (the path that passes less stations) is used. 1 is used to signal that an alternative route should be used. It is set by the deadlock prevention
  • train_on_track: send by hardware abstraction to check if some tracks are blocked. Only relevant for driving to an alternative platform if current platform is in use.
  • lock_XX: Set by deadlock prevention to lock specific segment transition in KH and to KIO

Relevant outputs of the scheduler (outputs that are relevant for other parts of the controller and not only for understand why a train drives a specific way):

  • (pre_)next_segment: Used by hardware abstraction to determine what tracks to reserve and what tracks to power. Also used by deadlock prevention to set route or set final_station
  • moving: Boolean that signals whether a train interns to move. May be true at not physically moving trains if way are blocked in any way (either by hardware abstraction or one of lock_XX

The Scheduler uses following internal variables to determine the location and state of each train:

  • station (output): The final_station the train is currently heading to. Only updated if the train reached a station. A train may not change station while not being in a station.
  • taken_route: The route the train is currently using. Only updated if the train reached a station. A train may not change station while not being in a station.
  • still_moving: Boolean used to signal that regardless whether next_segment = NO_DESTINATION, a train still has a destination he is heading to.
  • not_in_station: Only set in first tick, if initial position is no platform. Used to handle the special cases that can happen. Only used till a station was reached.
  • only_passing_by: Signals that a train does not want to enter a specific platform in a station. Mostly used if train has to pass a station to reach his final station
  • station_position (output): The last station a train has visited. Is set to possible previous station if initial_position is no platform
  • substation: next platform/station a train should head to. If substation is not equal to station the station is used instead of a specific platform.

The station_position, station and taken_route (and not_in_station till first station is reached) to determine the next substation. current_position and substation (and lock_XX, only_passing_by) are used  to determine the next_segment.

  • No labels