Management of railway components

Trains

  • Each train has a trainnumber.
    • Apart from identification the trainnumber is used for prioritization, when multiple trains compete for the same track.
    • Lower numbers mean higher priorities, e.g. train 0 has the highest priority.
    • Priorities can't be changed dynamicly.
  • Each train has one home-track at each station.
  • For binding purposes the variable should have the name trainNum.

The numbering is derived from the initial positions of the trains.

trainNum

Starting track

0

KH_ST_1

1

KH_ST_2

2

KH_ST_3 (r)

3

KH_ST_4 (r)

4

IC_ST_3

5

IC_ST_2

6

OC_ST_2

7

OC_ST_1

8

KH_ST_5

9

IC_ST_1

10

OC_ST_3

Tracks

  • Stopping on tracks without contacts is permitted.
  • Tracks without contacts must be reserved and used with an adjacent "safe" track.
  • When requesting multiple locks, deadlocks must be prevented
  • Three different speed settings are available, adjusted to the individual trains:
    • NORMAL - Normal driving speed
    • CAUTION - Speed when slowing down while waiting for permissions (and optionally for branch points)
    • SLOW - Driving into a station

Contacts

  • Contact events should only be read when it is clearly determined which train will trigger this event.
  • Subsequently contact events should only be read while holding the corresponding lock.

Stations

  • Each station has one drive-through track for each possible direction:

station

drive-through track

IC_station

IC_ST_1

OC_station

OC_ST_3

KH_station

KH_ST_5

KH_station(r)

KH_ST_1

Rulesets

Logging

  • The variable debug indicates verbose logging.
  • All log messages must be prefixed: [trainnum][ST-ST]

Use println function to produce textual output. Do not use printf or other io functions, because output may not be flushed correctly.

Tags: