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 6 Next »

Trains

Each train has a trainnumber. The trainnumber is 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.

Train numbering

Variable trainNum is used to identify trains.

The assignment of numbers to trains is chosen as followed

trainNumStarting track
0KH_ST_1
1KH_ST_2
2KH_ST_3 (r)
3KH_ST_4 (r)
4IC_ST_3
5IC_ST_2
6OC_ST_2
7OC_ST_1
8KH_ST_5
9IC_ST_1
10OC_ST_3

Logging

Variable debug indicates verbose logging.

Prefix of all log messages must be : [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.

Tracks

Stopping on tracks without contacts is permitted. Therefore they must be reserved and used with an adjacent track.
Each station has one drive-through track for each possible direction:

stationdrive-through track
IC_stationIC_ST_1
OC_stationOC_ST_3
KH_stationKH_ST_5
KH_station(r)KH_ST_1

Codestyle

Use entry-/exit-actions instead of actions on transitions, if possible.
If using hostcode, only use functions delivered by our own C-Interface and not the Höhrmann-API.

Mutual Exclusion

bool <track>_req[trainAmount] contains the requests for each track and train. Before the availability of arrays, we used bool <train>_<track>_req.
int <track>_perm contains the trainnumber of the train, who is allowed to drive on <track>.

  • No labels