Hide last authors
nfl 5.1 1 == Trains ==
nbw 4.1 2
nfl 5.1 3 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.
4 Each train has one home-track at each station.
5
6 === Train numbering ===
7
nbw 4.1 8 Variable **trainNum** is used to identify trains.
9
10 The assignment of numbers to trains is chosen as followed
11
12 |=(((
13 trainNum
14 )))|=(((
15 Starting track
16 )))
17 |(((
18 0
19 )))|(((
20 KH_ST_1
21 )))
22 |(((
23 1
24 )))|(((
25 KH_ST_2
26 )))
27 |(((
28 2
29 )))|(((
30 KH_ST_3 (r)
31 )))
32 |(((
33 3
34 )))|(((
35 KH_ST_4 (r)
36 )))
37 |(((
38 4
39 )))|(((
40 IC_ST_3
41 )))
42 |(((
43 5
44 )))|(((
45 IC_ST_2
46 )))
47 |(((
48 6
49 )))|(((
50 OC_ST_2
51 )))
52 |(((
53 7
54 )))|(((
55 OC_ST_1
56 )))
57 |(((
58 8
59 )))|(((
60 KH_ST_5
61 )))
62 |(((
63 9
64 )))|(((
65 IC_ST_1
66 )))
67 |(((
68 10
69 )))|(((
70 OC_ST_3
71 )))
72
Alexander Schulz-Rosengarten 3.1 73 == Logging ==
74
75 Variable **debug** indicates verbose logging.
76
77 Prefix of all log messages must be :** [trainnum][ST-ST]**
78
79 Use **println** function to produce textual output. Do not use printf or other io functions, because output may not be flushed correctly.
nfl 5.1 80
81 == Tracks ==
82
83 Stopping on tracks without contacts is permitted. Therefore they must be reserved and used with an adjacent track.
84 Each station has one drive-through track for each possible direction:
85
86 |=(((
87 station
88 )))|=(((
nfl 6.1 89 drive-through track
nfl 5.1 90 )))
91 |(((
92 IC_station
93 )))|(((
94 IC_ST_1
95 )))
96 |(((
97 OC_station
98 )))|(((
99 OC_ST_3
100 )))
101 |(((
102 KH_station
103 )))|(((
104 KH_ST_5
105 )))
106 |(% colspan="1" %)(% colspan="1" %)
107 (((
108 KH_station(r)
109 )))|(% colspan="1" %)(% colspan="1" %)
110 (((
111 KH_ST_1
112 )))
113
sna 11.1 114 === Station-to-Station ===
115
sna 12.1 116 Fuctions **void railArrival(int train, int station)** and **int railDeparture(int train)** should be used at the end of every Station-to-Station-Controller.
sna 11.1 117
sna 12.1 118 At the end of every Station-to-Station-Controller the trains should stand in one station, because every controller starts with the train in standstill.
sna 11.1 119
Alexander Schulz-Rosengarten 15.1 120 Contact reading in triggers should only used when it is clearly determined which train will fire the contact.
121
sna 11.1 122 === TrainController ===
123
124 Train-Schedules should be modelled by putting together the Station-to-Station-Controllers for every train in individual regions.
125
126 === Speed: ===
127
128 * SLOW: for the stations
csp 13.1 129 * CAUTION: for slowdown (and optional points)
sna 11.1 130 * NORMAL: for the other tracks
131
nfl 5.1 132 == Codestyle ==
133
134 Use entry-/exit-actions instead of actions on transitions, if possible.
nfl 7.1 135 If using hostcode, only use functions delivered by our own C-Interface and not the Höhrmann-API.
nfl 5.1 136
137 == Mutual Exclusion ==
138
nfl 8.1 139 bool <track>_req[<trainAmount>] contains the requests for each track and train. Before the availability of arrays, we used bool <train>_<track>_req.
nfl 5.1 140 int <track>_perm contains the trainnumber of the train, who is allowed to drive on <track>.
krat 9.1 141
Alexander Schulz-Rosengarten 15.1 142 == Deadlock Prevention ==
143
144 An example controller for deadlock prevention is located in// rail-repo: docs/deadlocks/resolve_deadlock.sct//
145
krat 16.1 146 Sidings should only be used in one direction.
147
148 Trains trying to leave a station in order to use KIO_LN_0 or KIO_LN_1 should, if they do not receive the locks for all segments, release them for two ticks.
149
Alexander Schulz-Rosengarten 14.1 150 = C Controller =
krat 9.1 151
Alexander Schulz-Rosengarten 14.1 152 The C controller wraps the basic railway interface and creates an correct environment to run the generated controller.
153
154 == Make Script ==
155
156 A make script written in Python is located in rail-repo: code/make.py
157
158 This script will compiel the whole controller for simulation or real railway and optionally executes it.//
159 //
160
161 Calling**// python// //make.py//** without further command-line arguments will print a help message with all available command line options.
162
163 Make Script Features:
164
165 * Header-file will be included automatically
166
167 Results are located in //rail-repo: code/build///
168
169 == Railway Interface ==
170
171 Provided functions are defined in// rail-repo: code/hostcode/controller.h//
172
173 == Interaction ==
174
175 === Quit, Pause and Cleanup ===
176
krat 9.1 177 Quit, pause and cleanup functionality is handled in the c interface.
178
Alexander Schulz-Rosengarten 10.1 179 **CTRL+C** (SIGINT)** **quits the controller
krat 9.1 180
Alexander Schulz-Rosengarten 10.1 181 **CTRL+\** (SIGQUIT)** **cleans up
krat 9.1 182
Alexander Schulz-Rosengarten 10.1 183 **CTRL+Z **(SIGSTP) pauses and continues
krat 9.1 184
185
186
187