Wiki source code of Interfaces and Rulesets
Version 1.1 by nbw on 2014/06/20 09:36
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | |
2 | |||
3 | {{toc/}} | ||
4 | |||
5 | == Management of railway components == | ||
6 | |||
7 | === Trains === | ||
8 | |||
9 | * Each train has a trainnumber.\\ | ||
10 | ** Apart from identification the trainnumber is used for prioritization, when multiple trains compete for the same track. | ||
11 | ** Lower numbers mean higher priorities, e.g. train 0 has the highest priority. | ||
12 | ** Priorities can't be changed dynamicly. | ||
13 | * Each train has one home-track at each station. | ||
14 | * For binding purposes the variable should have the name **trainNum**. | ||
15 | |||
16 | The numbering is derived from the initial positions of the trains. | ||
17 | |||
18 | |=((( | ||
19 | trainNum | ||
20 | )))|=((( | ||
21 | Starting track | ||
22 | ))) | ||
23 | |((( | ||
24 | 0 | ||
25 | )))|((( | ||
26 | KH_ST_1 | ||
27 | ))) | ||
28 | |((( | ||
29 | 1 | ||
30 | )))|((( | ||
31 | KH_ST_2 | ||
32 | ))) | ||
33 | |((( | ||
34 | 2 | ||
35 | )))|((( | ||
36 | KH_ST_3 (r) | ||
37 | ))) | ||
38 | |((( | ||
39 | 3 | ||
40 | )))|((( | ||
41 | KH_ST_4 (r) | ||
42 | ))) | ||
43 | |((( | ||
44 | 4 | ||
45 | )))|((( | ||
46 | IC_ST_3 | ||
47 | ))) | ||
48 | |((( | ||
49 | 5 | ||
50 | )))|((( | ||
51 | IC_ST_2 | ||
52 | ))) | ||
53 | |((( | ||
54 | 6 | ||
55 | )))|((( | ||
56 | OC_ST_2 | ||
57 | ))) | ||
58 | |((( | ||
59 | 7 | ||
60 | )))|((( | ||
61 | OC_ST_1 | ||
62 | ))) | ||
63 | |((( | ||
64 | 8 | ||
65 | )))|((( | ||
66 | KH_ST_5 | ||
67 | ))) | ||
68 | |((( | ||
69 | 9 | ||
70 | )))|((( | ||
71 | IC_ST_1 | ||
72 | ))) | ||
73 | |((( | ||
74 | 10 | ||
75 | )))|((( | ||
76 | OC_ST_3 | ||
77 | ))) | ||
78 | |||
79 | === Tracks === | ||
80 | |||
81 | * Stopping on tracks without contacts is permitted. | ||
82 | * Tracks without contacts must be reserved and used with an adjacent "safe" track. | ||
83 | * When requesting multiple locks, deadlocks must be prevented | ||
84 | * Three different speed settings are available, adjusted to the individual trains: | ||
85 | ** NORMAL - Normal driving speed | ||
86 | ** CAUTION - Speed when slowing down while waiting for permissions (and optionally for branch points) | ||
87 | ** SLOW - Driving into a station | ||
88 | |||
89 | === Contacts === | ||
90 | |||
91 | * Contact events should only be read when it is clearly determined which train will trigger this event. | ||
92 | * Subsequently contact events should only be read while holding the corresponding lock. | ||
93 | |||
94 | === Stations === | ||
95 | |||
96 | * Each station has one drive-through track for each possible direction: | ||
97 | |||
98 | |=(% style="margin-left: 60.0px;" %)(% style="margin-left: 60.0px;" %) | ||
99 | ((( | ||
100 | station | ||
101 | )))|=(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
102 | ((( | ||
103 | drive-through track | ||
104 | ))) | ||
105 | (% style="margin-left: 30.0px;" %)|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
106 | ((( | ||
107 | IC_station | ||
108 | )))|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
109 | ((( | ||
110 | IC_ST_1 | ||
111 | ))) | ||
112 | (% style="margin-left: 30.0px;" %)|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
113 | ((( | ||
114 | OC_station | ||
115 | )))|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
116 | ((( | ||
117 | OC_ST_3 | ||
118 | ))) | ||
119 | (% style="margin-left: 30.0px;" %)|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
120 | ((( | ||
121 | KH_station | ||
122 | )))|(% style="margin-left: 30.0px;" %)(% style="margin-left: 30.0px;" %) | ||
123 | ((( | ||
124 | KH_ST_5 | ||
125 | ))) | ||
126 | (% style="margin-left: 30.0px;" %)|(% colspan="1" style="margin-left: 30.0px;" %)(% colspan="1" style="margin-left: 30.0px;" %) | ||
127 | ((( | ||
128 | KH_station(r) | ||
129 | )))|(% colspan="1" style="margin-left: 30.0px;" %)(% colspan="1" style="margin-left: 30.0px;" %) | ||
130 | ((( | ||
131 | KH_ST_1 | ||
132 | ))) | ||
133 | |||
134 | == Rulesets == | ||
135 | |||
136 | === Logging === | ||
137 | |||
138 | * The variable **debug** indicates verbose logging. | ||
139 | * All log messages must be prefixed:** [trainnum][ST-ST]** | ||
140 | |||
141 | Use **println** function to produce textual output. Do not use printf or other io functions, because output may not be flushed correctly. |