Wiki source code of Usage Hardware Controller
Last modified by stu115775 on 2025/01/30 12:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | === 1st Step === | ||
| 2 | |||
| 3 | Import and build Controller_SCTx in KIELER. | ||
| 4 | |||
| 5 | === 2nd Step === | ||
| 6 | |||
| 7 | Run run_manual.sh in code/girlsday | ||
| 8 | |||
| 9 | In the simulation this command also loads the train configuration and starts the controller with those positions. | ||
| 10 | |||
| 11 | Note: this uses any Controller.c file it finds in code/Controller_SCTx/ as tick file and accesses files in code/interface/ | ||
| 12 | |||
| 13 | === 3rd Step === | ||
| 14 | |||
| 15 | Run RailController in code/girlsday | ||
| 16 | |||
| 17 | = Options and Commands: = | ||
| 18 | |||
| 19 | Notes: | ||
| 20 | |||
| 21 | (% style="list-style-type: square;" %) | ||
| 22 | * Train 10 has special ICE-handling, so the ICE should always be assigned to this number, other Trains with this number stop for a while before parking. | ||
| 23 | * The home position of each train is hardcoded into the Controller | ||
| 24 | * The Controller tries to connect to a WebProvider on localhost:8089 | ||
| 25 | * The Clear-Mode by the WebProvider overrides any destination in each tick and can currently not be disabled by the console | ||
| 26 | * The JSON kivis file is in the current execution folder: 'json_output.simin' | ||
| 27 | * The Controller uses ANSI-Escape sequences to color the output and overwrite recived contact messages. | ||
| 28 | * The entered characteres are most likely not all visible since there may be quite some output while typing, so these commands are typed blind in this case | ||
| 29 | |||
| 30 | === Commandline options (order matters): === | ||
| 31 | |||
| 32 | {{{RailController [+] [s<fast_speed> [s<slow_speed>]] [<train1_pos> [<train2_pos> [...] | DEFAULT] | DEFAULT]}}} | ||
| 33 | |||
| 34 | \\ | ||
| 35 | |||
| 36 | (% class="wrapped" %) | ||
| 37 | |=((( | ||
| 38 | + | ||
| 39 | )))|((( | ||
| 40 | if present then there will be no startup hardware check which turns on the lamps and | ||
| 41 | switches each point twice and cycles thrue signal colors with some delay | ||
| 42 | ))) | ||
| 43 | |=((( | ||
| 44 | fast_speed | ||
| 45 | )))|((( | ||
| 46 | pre-sets the global driving speed for the trains. Default: 70 | ||
| 47 | ))) | ||
| 48 | |=((( | ||
| 49 | slow_speed | ||
| 50 | )))|((( | ||
| 51 | pre-sets the global parking speed for the trains. Default: 59 | ||
| 52 | ))) | ||
| 53 | |=((( | ||
| 54 | trainX_pos | ||
| 55 | )))|((( | ||
| 56 | sets the position of the train X, caseinsensitive, prefixed with '-' for reversed on bidirectional tracks, | ||
| 57 | valid only for segments (not for ex.: IC_JCT_0) | ||
| 58 | examples: KH_ST_2, K2, 26, -KH_LN_3, IC_ST_3, I3, 10, OC_LN_4 | ||
| 59 | ))) | ||
| 60 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 61 | ((( | ||
| 62 | DEFAULT | ||
| 63 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 64 | ((( | ||
| 65 | fills the remaining positions with the home Positons of each train | ||
| 66 | ))) | ||
| 67 | |||
| 68 | \\ | ||
| 69 | |||
| 70 | Valid track identifier are the Track names (IC_ST_2, OC_LN_4), their numbers (9, 38) and for stations the short versions (I1, I2, I3, O1, O2, O3, K1, K2, K3, K4, K5). | ||
| 71 | If reverse is a possible information then a preceeding '-' signals this. All Track inputs should be case insensitive. | ||
| 72 | |||
| 73 | The Program will ask for positions if there aren't enough positions provided. Invalid Positions count as "Not placed on the Track" | ||
| 74 | |||
| 75 | === Commands: === | ||
| 76 | |||
| 77 | There is a handful of debug and settings commands, each has to be submitted with enter, commands with spaces in them need exactly one space between their words. | ||
| 78 | |||
| 79 | (% class="relative-table wrapped" style="width: 69.6654%;" %) | ||
| 80 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 81 | ((( | ||
| 82 | <train_num> <target> | ||
| 83 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 84 | ((( | ||
| 85 | sets the target of a train | ||
| 86 | ))) | ||
| 87 | |=((( | ||
| 88 | sc | schedule | ||
| 89 | )))|((( | ||
| 90 | print requested locks for each train | ||
| 91 | ))) | ||
| 92 | |=((( | ||
| 93 | c | ||
| 94 | )))|((( | ||
| 95 | set destination of each train to their starting position | ||
| 96 | ))) | ||
| 97 | |=((( | ||
| 98 | reset trains | ||
| 99 | )))|((( | ||
| 100 | set destinbation of each train to their home position | ||
| 101 | ))) | ||
| 102 | |=((( | ||
| 103 | toggle bell | ||
| 104 | )))|((( | ||
| 105 | toggles the crossings-gate-bell On and Off | ||
| 106 | ))) | ||
| 107 | |=((( | ||
| 108 | toggle lamp <range> | ||
| 109 | )))|((( | ||
| 110 | toggles selected lamps On and Off | ||
| 111 | ))) | ||
| 112 | |=((( | ||
| 113 | enable lamp <range> | ||
| 114 | )))|((( | ||
| 115 | turns selected lamps On | ||
| 116 | ))) | ||
| 117 | |=((( | ||
| 118 | disable lamp <range> | ||
| 119 | )))|((( | ||
| 120 | turns selected löamps Off | ||
| 121 | ))) | ||
| 122 | |=((( | ||
| 123 | print tick | ||
| 124 | )))|((( | ||
| 125 | toggles the output of the current tick number each tick On and Off | ||
| 126 | ))) | ||
| 127 | |=((( | ||
| 128 | r | ||
| 129 | )))|((( | ||
| 130 | toggles randommode | ||
| 131 | ))) | ||
| 132 | |=((( | ||
| 133 | x | ||
| 134 | )))|((( | ||
| 135 | reconnects to the hardware | ||
| 136 | ))) | ||
| 137 | |=((( | ||
| 138 | t | ||
| 139 | )))|((( | ||
| 140 | prints positions of each train | ||
| 141 | ))) | ||
| 142 | |=((( | ||
| 143 | s | speeds | ||
| 144 | )))|((( | ||
| 145 | prints the speeds for each track | ||
| 146 | ))) | ||
| 147 | |=((( | ||
| 148 | st | " " | ||
| 149 | )))|((( | ||
| 150 | (second option is only a space) toggles stop mode, which sets all hardware speeds to 0 | ||
| 151 | ))) | ||
| 152 | |=((( | ||
| 153 | pt <point_num> | ||
| 154 | )))|((( | ||
| 155 | toggles a Point, only works when the point isn't locked | ||
| 156 | ))) | ||
| 157 | |=((( | ||
| 158 | ts | ||
| 159 | )))|((( | ||
| 160 | prints the 4 speeds of each train (2nd and 4th number are the used slow and fast speeds) | ||
| 161 | ))) | ||
| 162 | |=((( | ||
| 163 | setspeed [t<train_num>] <fast_speed> [slowspeed] | ||
| 164 | )))|((( | ||
| 165 | sets the global or train specific speeds | ||
| 166 | ))) | ||
| 167 | |=((( | ||
| 168 | reach_t <track> | ||
| 169 | )))|((( | ||
| 170 | (DEBUG)sends a reached signal from this track | ||
| 171 | ))) | ||
| 172 | |=((( | ||
| 173 | reach <train_num> | ||
| 174 | )))|((( | ||
| 175 | (DEBUG) sends a reached signal for given train | ||
| 176 | ))) | ||
| 177 | |=((( | ||
| 178 | sim [s|e]<track> | ||
| 179 | )))|((( | ||
| 180 | (DEBUG) simulates the contacts on a track. s: only the first contact, e: only the second contact (no space after s or e) | ||
| 181 | ))) | ||
| 182 | |=((( | ||
| 183 | dest | ||
| 184 | )))|((( | ||
| 185 | prints entered destination for each train | ||
| 186 | ))) | ||
| 187 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 188 | ((( | ||
| 189 | time | ||
| 190 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 191 | ((( | ||
| 192 | prints maximum and average time for different loop parts (stdin, input, tick, output), partition may not be fully accurate | ||
| 193 | ))) | ||
| 194 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 195 | ((( | ||
| 196 | trains | ||
| 197 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 198 | ((( | ||
| 199 | prints for each track the train ontop | ||
| 200 | ))) | ||
| 201 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 202 | ((( | ||
| 203 | move [on|off] | ||
| 204 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 205 | ((( | ||
| 206 | toggles or sets moveing mode, which sends some trains to two toggeling destinations, with some time waiting in a station | ||
| 207 | ))) | ||
| 208 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 209 | ((( | ||
| 210 | move_time <time> | ||
| 211 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 212 | ((( | ||
| 213 | sets waiting time in stations for moveing mode in ms (1000 = 1s) | ||
| 214 | ))) | ||
| 215 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 216 | ((( | ||
| 217 | clear | ||
| 218 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 219 | ((( | ||
| 220 | sets each destination to 0 (= IC_JCT_0 => Invalid, no Destination) | ||
| 221 | ))) | ||
| 222 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 223 | ((( | ||
| 224 | deb | ||
| 225 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 226 | ((( | ||
| 227 | currently has no effect, may be used for requested debug output | ||
| 228 | ))) | ||
| 229 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 230 | ((( | ||
| 231 | block <train_num> | ||
| 232 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 233 | ((( | ||
| 234 | toggles the 'dont_force_destination' input for the train. If enabled, this train would not start moveing to make space for another train | ||
| 235 | ))) | ||
| 236 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 237 | ((( | ||
| 238 | webprovider debug | ||
| 239 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 240 | ((( | ||
| 241 | toggles webprovider communication debug outputs | ||
| 242 | ))) | ||
| 243 | |=(% colspan="1" %)(% colspan="1" %) | ||
| 244 | ((( | ||
| 245 | json output | ||
| 246 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 247 | ((( | ||
| 248 | toggles the creation of a '.simin' JSON file for kivis every 2s | ||
| 249 | ))) | ||
| 250 | |||
| 251 | \\ | ||
| 252 | |||
| 253 | Examples for ranges: | ||
| 254 | 3 | ||
| 255 | 3-7 | ||
| 256 | 2-9,11,13-19 | ||
| 257 | |||
| 258 | \\ | ||
| 259 | |||
| 260 | \\ |