Changes for page Basic design
Last modified by nfl on 2025/01/30 12:05
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -34,7 +34,7 @@ 34 34 35 35 == Train controller == 36 36 37 -Each train controller is set in a separate region with a referenced state. This state has the following interface :37 +Each train controller is set in a separate region with a referenced state. This state has the following interface 38 38 39 39 40 40 \\\\\\\\ ... ... @@ -41,13 +41,13 @@ 41 41 42 42 {{{   input int *_perm;        # All permission variables (Tracks) input bool *_perm # KH permission variables  input int trainNum;   input bool cleanup; input bool debug; output bool *_req[]; # All request variables}}} 43 43 44 -The train controller is composed of several //Station-2-Station// controllers. These are combined to form a complete schedule. Additionally ,the cleanup signal has to be watched to abort the schedule and return back to the initial position.44 +The train controller is composed of several //Station-2-Station// controllers. These are combined to form a complete schedule. Additionally the cleanup signal has to be watched to abort the schedule and return back to the initial position. 45 45 46 46 == Station-2-Station controller == 47 47 48 -Each Station-2-Station controller realizes the movement from one of the stations (IC,OC,KH) to anotherstation. All controllers using IC or OC parts have to respect the traveling directions. For the Kicking Horse Pass two separate controllers, forwards and backwards, are used.48 +Each station-2-station controller realizes the movement from one of the stations (IC,OC,KH) to a second station. All controllers using IC or OC parts have to respect the traveling directions. For the Kicking Horse Pass two separate controllers, forwards and backwards, are used. 49 49 50 -The controllers starting from Kicking Horse Pass Station make an assumption of the direction of the train. These are dependent o nthe directions of the inner or outer circle, e.g. the KHIC controller starts backwards because this is the only valid direction to travel this path. To drive a train from the Kicking Horse Station (facing forward) to the Inner Circle we have to combine the KHOC and OCIC controllers.50 +The controllers starting from Kicking Horse Pass Station make an assumption of the direction of the train. These are dependent of the directions of the inner or outer circle, e.g. the KHIC controller starts backwards because this is the only valid direction to travel this path. To drive a train from the Kicking Horse Station (facing forward) to the Inner Circle we have to combine the KHOC and OCIC controllers. 51 51 52 52 [[image:attach:ICIC.png]] 53 53 ... ... @@ -55,313 +55,874 @@ 55 55 Next the train **must** wait for// int railDeparture(int train)// to return 1. 56 56 After the waiting has finished the controller can reach a final state and pass the control back to the train controller. 57 57 58 -=== Structure Â===58 +=== Structure === 59 59 60 -{{code linenumbers="true" language="sct"}} 61 -// 62 -// Structure of a Station-2-Station controller from Station * to Station * 63 -// 64 -scchart STST " * to * Controller " { 60 +---- 65 65 66 - // Set of permission variables for required tracks 67 - input int *_perm; 68 68 69 - // Set of request variables for required tracks for 11 trains 70 - output bool *_req[11]; 63 + 71 71 72 - // Train number73 - input inttrainNum;65 +|=((( 66 +{{{input int *_perm;}}} 74 74 75 - // Number of the departure track in a station 76 - input int depTrack; 68 +{{{output bool *_req[11];}}} 77 77 78 - // Number of the destination track in a station 79 - input int destTrack; 70 +{{{input int trainNum;}}} 80 80 81 - // Cleanup flag for selecting the destination track 82 - input bool cleanup; 72 +{{{input int depTrack;}}} 83 83 84 - // Debug flag for additional output 85 - input bool debug; 74 +{{{input int destTrack;}}} 86 86 87 - // Arrival track 88 - output int arrTrack; 76 +{{{input bool cleanup;}}} 89 89 90 - // Variable with value for arrTrack for selecting correct station elements 91 - int i_arrOnTrack; 78 +{{{input bool debug;}}} 79 + 80 +{{{output int arrTrack;}}} 81 + 82 +{{{int i_arrOnTrack;}}} 83 + 84 +{{{ }}} 85 + 86 +{{{initial state *_ST {}}} 87 + 88 +{{{   entry debug / 'println([trainNum][ST-ST] ... )';}}} 89 + 90 +{{{ }}} 91 + 92 +{{{   initial state waitForPerm {}}} 93 + 94 +{{{       entry / *_ST_4_req[trainNum] = true;}}} 95 + 96 +{{{       entry / *_LN_0_req[trainNum] = true;}}} 97 + 98 +{{{   }}}} 99 + 100 +{{{   --> gotPerm with (*_ST_4_perm == trainNum) & (*_LN_0_perm == trainNum)}}} 101 + 102 +{{{   --> backOff with (*_ST_4_perm == trainNum) | (*_LN_0_perm == trainNum);}}} 103 + 104 +{{{ }}} 105 + 106 +{{{   state backOff}}} 107 + 108 +{{{   --> backOff1;}}} 109 + 110 +{{{ }}} 111 + 112 +{{{   state backOff1 {}}} 113 + 114 +{{{entry / *_ST_4_req[trainNum] = false;}}} 115 + 116 +{{{entry / *_LN_0_req[trainNum] = false;}}} 117 + 118 +{{{   }}}} 119 + 120 +{{{   --> waitForPerm;}}} 121 + 122 +{{{ }}} 123 + 124 +{{{final state gotPerm;}}} 125 + 126 +{{{}}}} 127 + 128 +{{{>-> Dep_*_ST;}}} 129 + 130 +{{{ }}} 131 + 132 +{{{state Dep_IC_ST {}}} 133 + 134 +{{{   entry / 'railPoint(*,STRAIGHT)';}}} 135 + 136 +{{{   entry / 'railSignal(*_LN_0, FWD, RED)';}}} 137 + 138 +{{{   entry / 'railTrack(*_LN_0,FWD,trainNum,NORMAL)';}}} 139 + 140 +{{{   entry / 'railTrack(*_ST_4,FWD,trainNum,NORMAL)';}}} 141 + 142 +{{{   entry depTrack == 1 / 'railSignal(*_ST_1, FWD, GREEN)';}}} 143 + 144 +{{{   entry depTrack == 2 / 'railSignal(*_ST_2, FWD, GREEN)';}}} 145 + 146 +{{{   entry depTrack == 3 / 'railSignal(*_ST_3, FWD, GREEN)';}}} 147 + 148 +{{{   ..........}}} 149 + 150 +{{{ } --> *_LN_0 with 'railContact(*_LN_0,0)';}}} 151 + 152 +{{{ }}} 153 + 154 +{{{ state *_LN_0 {}}} 155 + 156 +{{{   entry / 'println("[trainNum][ST-ST] Entering *_LN_0")';}}} 157 + 158 +{{{   entry debug / 'println("[trainNum][ST-ST] Requesting permission for *_LN_1")';}}} 159 + 160 +{{{   entry depTrack == 1 / 'railSignal(*_ST_1, FWD, RED)';}}} 161 + 162 +{{{   entry depTrack == 2 / 'railSignal(*_ST_2, FWD, RED)';}}} 163 + 164 +{{{   entry depTrack == 3 / 'railSignal(*_ST_3, FWD, RED)';}}} 165 + 166 +{{{   entry / *_LN_1_req[trainNum] = true;}}} 167 + 168 +{{{ }}} 169 + 170 +{{{   region Travel:}}} 171 + 172 +{{{     initial state Entry}}} 173 + 174 +{{{     --> Continue with 'railContact(*_LN_0,0)' & (*_LN_1_perm == trainNum)}}} 175 + 176 +{{{     --> Slowdown with 'railContact(*_LN_0,0)';}}} 177 + 178 +{{{ }}} 179 + 180 +{{{     state Slowdown {}}} 181 + 182 +{{{       entry debug / 'println("[trainNum][ST-ST] Slowing down on *_LN_0")';}}} 183 + 184 +{{{       entry / 'railTrack(*_LN_0,FWD,trainNum,CAUTION)';}}} 185 + 186 +{{{     }}}} 187 + 188 +{{{     --> Waiting with 'railContact(*_LN_0,1)'}}} 189 + 190 +{{{     --> Continue with *_LN_1_perm == trainNum;}}} 191 + 192 +{{{ }}} 193 + 194 +{{{     state Waiting {}}} 195 + 196 +{{{       entry debug / 'println("[trainNum][ST-ST] Stopping on *_LN_0")';}}} 197 + 198 +{{{       entry / 'railTrackBrake(*_LN_0)';}}} 199 + 200 +{{{     }}}} 201 + 202 +{{{     --> Continue with *_LN_1_perm == trainNum;}}} 203 + 204 +{{{ }}} 205 + 206 +{{{     final state Continue {}}} 207 + 208 +{{{       entry debug / 'println("[trainNum][ST-ST] Continuing on *_LN_0")';}}} 209 + 210 +{{{       entry / 'railSignal(*_LN_0,FWD,GREEN)';}}} 211 + 212 +{{{       entry / 'railTrack(*_LN_0,FWD,trainNum,NORMAL)';}}} 213 + 214 +{{{       entry / 'railTrack(*_LN_1,FWD,trainNum,NORMAL)';}}} 215 + 216 +{{{       entry / 'railSignal(*_LN_1, FWD, RED)';}}} 217 + 218 +{{{     };}}} 219 + 220 +{{{ }}} 221 + 222 +{{{   region Cleanup:}}} 223 + 224 +{{{     initial state Entry}}} 225 + 226 +{{{     --> cleanup with 'railContact(*_LN_0,0)';}}} 227 + 228 +{{{ }}} 229 + 230 +{{{     final state cleanup {}}} 231 + 232 +{{{     entry debug / 'println("[trainNum][ST-ST] Entered *_LN_0 completely")';}}} 233 + 234 +{{{     entry / 'railTrackOff(*_ST_4)';}}} 235 + 236 +{{{     entry / *_ST_4_req[trainNum] = false;}}} 237 + 238 +{{{     };}}} 239 + 240 +{{{ }>-> *_LN_0_*_LN_1;}}} 241 + 242 +{{{ }}} 243 + 244 +{{{ state IC_LN_0_IC_LN_1}}} 245 + 246 +{{{ --> IC_LN_1 with 'railContact(IC_LN_1,0)';}}} 247 + 248 +{{{ }}} 249 + 250 +{{{// ...................}}} 251 + 252 +{{{// Set of track segment controlling states such as before}}} 253 + 254 +{{{// ...................}}} 255 + 256 +{{{ }}} 257 + 258 +{{{state *_LN_5 {}}} 259 + 260 +{{{   int perm_all_next_segments = false;}}} 261 + 262 +{{{   entry / 'println("[trainNum][ST-ST] Entering *_LN_5")';}}} 263 + 264 +{{{   entry / 'railSignal(*_LN_4, FWD, RED)';}}} 265 + 266 +{{{ }}} 267 + 268 +{{{   region Travel:}}} 269 + 270 +{{{     initial state Entry}}} 271 + 272 +{{{     --> Continue with 'railContact(*_LN_5,0)' & perm_all_next_segments}}} 273 + 274 +{{{     --> Slowdown with 'railContact(*_LN_5,0)';}}} 275 + 276 +{{{ }}} 277 + 278 +{{{     state Slowdown {}}} 279 + 280 +{{{       entry debug / 'println("[trainNum][ST-ST] Slowing down on *_LN_5")';}}} 281 + 282 +{{{       entry / 'railTrack(*_LN_5,FWD,trainNum,CAUTION)';}}} 283 + 284 +{{{     }}}} 285 + 286 +{{{     --> Waiting with 'railContact(*_LN_5,1)'}}} 287 + 288 +{{{     --> Continue with perm_all_next_segments;}}} 289 + 290 +{{{ }}} 291 + 292 +{{{     state Waiting {}}} 293 + 294 +{{{       entry debug / 'println("[trainNum][ST-ST] Stopping on *_LN_5")';}}} 295 + 296 +{{{       entry / 'railTrackBrake(*_LN_5)';}}} 297 + 298 +{{{     }}}} 299 + 300 +{{{     --> Continue with perm_all_next_segments;}}} 301 + 302 +{{{ }}} 303 + 304 +{{{     final state Continue {}}} 305 + 306 +{{{       entry debug / 'println("[trainNum][ST-ST] Continuing on *_LN_5")';       }}} 307 + 308 +{{{       entry i_arrOnTrack == 1 / 'railTrack(*_ST_1,FWD,trainNum,NORMAL)';}}} 309 + 310 +{{{       entry i_arrOnTrack == 2 / 'railTrack(*_ST_2,FWD,trainNum,NORMAL)';}}} 311 + 312 +{{{       entry i_arrOnTrack == 3 / 'railTrack(*_ST_3,FWD,trainNum,NORMAL)';}}} 313 + 314 +{{{       ----------}}} 315 + 316 +{{{       entry / arrTrack = i_arrOnTrack;}}} 317 + 318 +{{{     };}}} 319 + 320 +{{{ }}} 321 + 322 +{{{   region Cleanup:}}} 323 + 324 +{{{     initial state Entry}}} 325 + 326 +{{{     --> cleanup with 'railContact(*_LN_5,0)';}}} 327 + 328 +{{{ }}} 329 + 330 +{{{     final state cleanup {}}} 331 + 332 +{{{       entry debug / 'println("[trainNum][ST-ST] Entered *_LN_5 completely")';}}} 333 + 334 +{{{       entry / 'railTrackOff(*_LN_4)';}}} 335 + 336 +{{{       entry / *_LN_4_req[trainNum] = false;}}} 337 + 338 +{{{     };}}} 339 + 340 +{{{ }}} 341 + 342 +{{{   region Permissions:}}} 343 + 344 +{{{     initial state checking {}}} 345 + 346 +{{{       entry / *_ST_0_req[trainNum] = true;}}} 347 + 348 +{{{       entry destTrack == 1 | !cleanup / *_ST_1_req[trainNum] = true;}}} 349 + 350 +{{{       entry destTrack == 2 | !cleanup / *_ST_2_req[trainNum] = true;}}} 351 + 352 +{{{       entry destTrack == 3 | !cleanup / *_ST_3_req[trainNum] = true;}}} 353 + 354 +{{{     }}}} 355 + 356 +{{{     --> success with destTrack == 1 & *_ST_0_perm == trainNum & *_ST_1_perm == trainNum / i_arrOnTrack = 1}}} 357 + 358 +{{{     --> success with destTrack == 2 & *_ST_0_perm == trainNum & *_ST_2_perm == trainNum / i_arrOnTrack = 2}}} 359 + 360 +{{{     --> success with destTrack == 3 & *_ST_0_perm == trainNum & *_ST_3_perm == trainNum / i_arrOnTrack = 3}}} 361 + 362 +{{{     --> success with *_ST_0_perm == trainNum & *_ST_1_perm == trainNum / i_arrOnTrack = 1}}} 363 + 364 +{{{     --> success with *_ST_0_perm == trainNum & *_ST_2_perm == trainNum / i_arrOnTrack = 2}}} 365 + 366 +{{{     --> success with *_ST_0_perm == trainNum & *_ST_3_perm == trainNum / i_arrOnTrack = 3}}} 367 + 368 +{{{     --> resolving with *_ST_0_perm == trainNum | *_ST_3_perm == trainNum | *_ST_2_perm == trainNum | *_ST_1_perm == trainNum;}}} 369 + 370 +{{{ }}} 371 + 372 +{{{     state resolving}}} 373 + 374 +{{{     --> resolving1;}}} 375 + 376 +{{{ }}} 377 + 378 +{{{     state resolving1 {}}} 379 + 380 +{{{       entry / *_ST_0_req[trainNum] = false;}}} 381 + 382 +{{{       entry / *_ST_1_req[trainNum] = false;}}} 383 + 384 +{{{       entry / *_ST_2_req[trainNum] = false;}}} 385 + 386 +{{{       entry / *_ST_3_req[trainNum] = false;}}} 387 + 388 +{{{     }}}} 389 + 390 +{{{     --> checking;}}} 391 + 392 +{{{ }}} 393 + 394 +{{{     state success}}} 395 + 396 +{{{     --> success1;}}} 397 + 398 +{{{ }}} 399 + 400 +{{{     final state success1 {}}} 401 + 402 +{{{       entry !(i_arrOnTrack == 1) / *_ST_1_req[trainNum] = false;     }}} 403 + 404 +{{{       entry !(i_arrOnTrack == 2) / *_ST_2_req[trainNum] = false;}}} 405 + 406 +{{{       entry !(i_arrOnTrack == 3) / *_ST_3_req[trainNum] = false;}}} 407 + 408 +{{{       entry / perm_all_next_segments = true;}}} 409 + 410 +{{{     };}}} 411 + 412 +{{{ }>-> *_LN_5_*_ST;}}} 413 + 414 +{{{ }}} 415 + 416 +{{{ state *_LN_5_*_ST}}} 417 + 418 +{{{ --> Arr_*_ST with i_arrOnTrack == 1 & 'railContact(*_ST_1,0)'}}} 419 + 420 +{{{ --> Arr_*_ST with i_arrOnTrack == 2 & 'railContact(*_ST_2,0)'}}} 421 + 422 +{{{ --> Arr_*_ST with i_arrOnTrack == 3 & 'railContact(*_ST_3,0)';}}} 423 + 424 +{{{ }}} 425 + 426 +{{{ state Arr_*_ST {}}} 427 + 428 +{{{   entry / 'railSignal(*_LN_5, FWD, RED)';}}} 429 + 430 +{{{   entry / 'railTrackOff(*C_LN_5)';}}} 431 + 432 +{{{   entry / 'railTrack(*_ST_0,FWD,trainNum,SLOW)';}}} 433 + 434 +{{{   entry i_arrOnTrack == 1 / 'railTrack(*_ST_1,FWD,trainNum,SLOW)';}}} 435 + 436 +{{{   entry i_arrOnTrack == 2 / 'railTrack(*_ST_2,FWD,trainNum,SLOW)';}}} 437 + 438 +{{{   entry i_arrOnTrack == 3 / 'railTrack(*_ST_3,FWD,trainNum,SLOW)';}}} 439 + 440 +{{{   entry / *_LN_5_req[trainNum] = false;}}} 441 + 442 +{{{ }}} 443 + 444 +{{{   initial state SlowEntry}}} 445 + 446 +{{{   --> Slow with i_arrOnTrack == 1 & 'railContact(*_ST_1,0)'}}} 447 + 448 +{{{   --> Slow with i_arrOnTrack == 2 & 'railContact(*_ST_2,0)'}}} 449 + 450 +{{{   --> Slow with i_arrOnTrack == 3 & 'railContact(*_ST_3,0)';}}} 451 + 452 +{{{ }}} 453 + 454 +{{{   state Slow {}}} 455 + 456 +{{{     entry / 'railTrackOff(*_ST_0)';}}} 457 + 458 +{{{     entry / *_ST_0_req[trainNum] = false;}}} 459 + 460 +{{{   }}}} 461 + 462 +{{{   --> Halt with i_arrOnTrack == 1 & 'railContact(*_ST_1,1)'}}} 463 + 464 +{{{   --> Halt with i_arrOnTrack == 2 & 'railContact(*_ST_2,1)'}}} 465 + 466 +{{{   --> Halt with i_arrOnTrack == 3 & 'railContact(*_ST_3,1)';}}} 467 + 468 +{{{ }}} 469 + 470 +{{{   final state Halt {}}} 471 + 472 +{{{     entry i_arrOnTrack == 1 / 'railTrackBrake(*_ST_1)';}}} 473 + 474 +{{{     entry i_arrOnTrack == 2 / 'railTrackBrake(*_ST_2)';}}} 475 + 476 +{{{     entry i_arrOnTrack == 3 / 'railTrackBrake(*_ST_3)';}}} 477 + 478 +{{{     entry i_arrOnTrack == 1 / 'railArrival(trainNum, *_ST_1)';}}} 479 + 480 +{{{     entry i_arrOnTrack == 2 / 'railArrival(trainNum, *_ST_2)';}}} 481 + 482 +{{{     entry i_arrOnTrack == 3 / 'railArrival(trainNum, *_ST_3)';}}} 483 + 484 +{{{   };}}} 485 + 486 +{{{ }}}} 487 + 488 +{{{ >-> done;}}} 489 + 490 +{{{ }}} 491 + 492 +{{{ state done}}} 493 + 494 +{{{ --> reallyDone with 'railDeparture(trainNum)';}}} 495 + 496 +{{{ }}} 497 + 498 +{{{ final state reallyDone;}}} 499 +)))|=((( 500 +~/~/ All permissiions variables 501 + 502 +~/~/ All request variables 503 + 504 +~/~/ Train number 505 + 506 +~/~/ Departure track number 507 + 508 +~/~/ Destination track number 509 + 510 +~/~/ Cleanup flag for selecting the track of destination 511 + 512 +~/~/ Debug flag for additional output 513 + 514 +~/~/ Arrival track 515 + 516 +~/~/ Variable (arrival track) for selecting correct station elements 517 + 92 92 93 - // Handles departing from a station * 94 - initial state *_ST { 95 - // hostcode call for additional output when debug 96 - entry debug / 'println([trainNum][ST-ST] ... )'; 519 + 520 +~/~/ Handles departing from a station 521 + 522 +~/~/ Additional output for debugging 523 + 97 97 98 - // State, which sets requests for needed tracks 99 - initial state waitForPerm { 100 - entry / *_ST_4_req[trainNum] = true; 101 - entry / *_LN_0_req[trainNum] = true; 102 - } 103 - // Transition is taken, if all permissions are received 104 - --> gotPerm with (*_ST_4_perm == trainNum) & (*_LN_0_perm == trainNum) 105 - // Transition is taken, if some (not all) permissions are received 106 - --> backOff with (*_ST_4_perm == trainNum) | (*_LN_0_perm == trainNum); 525 + 526 +~/~/ State, which set requests for needed tracks 527 + 107 107 108 - // State for waiting an additional tick when not all permissions are received 109 - state backOff 110 - --> backOff1; 529 + 111 111 112 - // State, which releases the requests for needed tracks 113 - state backOff1 { 114 - entry / *_ST_4_req[trainNum] = false; 115 - entry / *_LN_0_req[trainNum] = false; 116 - } 117 - // Transition to repeat requesting permissions procedure 118 - --> waitForPerm; 531 + 119 119 120 - final state gotPerm; 121 - } 122 - // Transition to the departure state 123 - >-> Dep_*_ST; 533 + 534 +~/~/ Transition for received **all** needed permissions 535 + 536 +~/~/ Tranisition for received **some** needed permissions 537 + 124 124 125 - // State, which handles the departure of a train 126 - state Dep_*_ST { 127 - // Set of entry-Actions with hostcode calls to set tracks, points and signals according to depTrack 128 - entry / 'railPoint(*,STRAIGHT)'; 129 - entry / 'railSignal(*_LN_0, FWD, RED)'; 130 - entry / 'railTrack(*_LN_0,FWD,trainNum,NORMAL)'; 131 - entry / 'railTrack(*_ST_4,FWD,trainNum,NORMAL)'; 132 - entry depTrack == 1 / 'railSignal(*_ST_1, FWD, GREEN)'; 133 - entry depTrack == 2 / 'railSignal(*_ST_2, FWD, GREEN)'; 134 - entry depTrack == 3 / 'railSignal(*_ST_3, FWD, GREEN)'; 135 - //... 136 - // Transition to next track segment, if contact is triggered 137 - } --> *_LN_0 with 'railContact(*_LN_0,0)'; 539 + 540 +~/~/ State for waiting an additional Tick 541 + 138 138 139 139 544 + 140 140 141 - // ..................................................................................... 142 - // Set of track segment controlling states such as follows 143 - // ..................................................................................... 546 +~/~/ State, which releases the requests for needed tracks 547 + 144 144 145 - // Transition to next track segment, if contact is triggered 146 - state *_LN_0 { 147 - // Hostcode calls for outputs 148 - entry / 'println("[trainNum][ST-ST] Entering *_LN_0")'; 149 - entry debug / 'println("[trainNum][ST-ST] Requesting permission for *_LN_1")'; 150 - // Entry-Actions with hostcode calls to set previous signal according to depTrack to RED 151 - entry depTrack == 1 / 'railSignal(*_ST_1, FWD, RED)'; 152 - entry depTrack == 2 / 'railSignal(*_ST_2, FWD, RED)'; 153 - entry depTrack == 3 / 'railSignal(*_ST_3, FWD, RED)'; 154 - // Requesting the next track segment 155 - entry / *_LN_1_req[trainNum] = true; 549 + 156 156 157 - // Region for handling train driving 158 - region Travel: 159 - initial state Entry 160 - // Transition to continuing state, if permitted 161 - --> Continue with 'railContact(*_LN_0,0)' & (*_LN_1_perm == trainNum) 162 - // Transition to slowing down else 163 - --> Slowdown with 'railContact(*_LN_0,0)'; 551 + 164 164 165 - // State for slowing down the train 166 - state Slowdown { 167 - entry debug / 'println("[trainNum][ST-ST] Slowing down on *_LN_0")'; 168 - // Entry-Action with hostcode calls for slowing down the train 169 - entry / 'railTrack(*_LN_0,FWD,trainNum,CAUTION)'; 170 - } 171 - // Transition to waiting state 172 - --> Waiting with 'railContact(*_LN_0,1)' 173 - // Transition to continuing state, if permitted 174 - --> Continue with *_LN_1_perm == trainNum; 553 + 554 +~/~/ Transition to trying the requesting again 555 + 175 175 176 - // State for train waiting on permission 177 - state Waiting { 178 - entry debug / 'println("[trainNum][ST-ST] Stopping on *_LN_0")'; 179 - // Entry-Action with hostcode call for stopping the train 180 - entry / 'railTrackBrake(*_LN_0)'; 181 - } 182 - --> Continue with *_LN_1_perm == trainNum; 557 + 183 183 184 - // State to continuing driving on the track 185 - final state Continue { 186 - entry debug / 'println("[trainNum][ST-ST] Continuing on *_LN_0")'; 187 - // Entry-Actions with hostcode calls to set tracks and signals for driving 188 - entry / 'railSignal(*_LN_0,FWD,GREEN)'; 189 - entry / 'railTrack(*_LN_0,FWD,trainNum,NORMAL)'; 190 - entry / 'railTrack(*_LN_1,FWD,trainNum,NORMAL)'; 191 - entry / 'railSignal(*_LN_1, FWD, RED)'; 192 - }; 559 + 193 193 194 - // Region for handling cleanup functionalities 195 - region Cleanup: 196 - initial state Entry 197 - // Transition to cleanup state 198 - --> cleanup with 'railContact(*_LN_0,0)'; 561 + 562 +~/~/ Transition to the departure state 563 + 199 199 200 - // State for cleaning up the previous track segments 201 - final state cleanup { 202 - entry debug / 'println("[trainNum][ST-ST] Entered *_LN_0 completely")'; 203 - // Entry-Action with hostcode call to switching off the previous track 204 - entry / 'railTrackOff(*_ST_4)'; 205 - // Entry-Action to release the previous track 206 - entry / *_ST_4_req[trainNum] = false; 207 - }; 208 - // Transition to transitional state 209 - }>-> *_LN_0_*_LN_1; 565 + 566 +~/~/ State, which handles the train departure 567 + 568 +~/~/ Set of entry-Actions to set tracks, points and signals according to depTrack 569 + 210 210 211 - state *_LN_0_*_LN_1 212 - // Transition to next track segment, if contact is triggered 213 - --> *_LN_1 with 'railContact(*_LN_1,0)'; 571 + 572 + 214 214 215 - // .................................................................................. 216 216 575 + 217 217 577 + 218 218 219 - // State for entering a station 220 - state *_LN_5 { 221 - // Variable for checking all needed permissions 222 - int perm_all_next_segments = false; 223 - entry / 'println("[trainNum][ST-ST] Entering *_LN_5")'; 224 - entry / 'railSignal(*_LN_4, FWD, RED)'; 225 225 226 - // Region for handling train driving such as above, 227 - // only with perm_all_next_segments for permitting more than one track 228 - region Travel: 229 - initial state Entry 230 - --> Continue with 'railContact(*_LN_5,0)' & perm_all_next_segments 231 - --> Slowdown with 'railContact(*_LN_5,0)'; 580 + 232 232 233 - state Slowdown { 234 - entry debug / 'println("[trainNum][ST-ST] Slowing down on *_LN_5")'; 235 - entry / 'railTrack(*_LN_5,FWD,trainNum,CAUTION)'; 236 - } 237 - --> Waiting with 'railContact(*_LN_5,1)' 238 - --> Continue with perm_all_next_segments; 582 + 583 +~/~/ Transition to next track segment, if contact is readed 584 + 239 239 240 - state Waiting {241 - entry debug/ 'println("[trainNum][ST-ST]Stoppingon*_LN_5")';242 - entry / 'railTrackBrake(*_LN_5)';243 - }244 - --> Continue with perm_all_next_segments;586 + 587 +~/~/ State for handling the train on track *_LN_0 588 + 589 +~/~/ Outputs for debugging 590 + 245 245 246 - final state Continue { 247 - entry debug / 'println("[trainNum][ST-ST] Continuing on *_LN_5")'; 248 - entry i_arrOnTrack == 1 / 'railTrack(*_ST_1,FWD,trainNum,NORMAL)'; 249 - entry i_arrOnTrack == 2 / 'railTrack(*_ST_2,FWD,trainNum,NORMAL)'; 250 - entry i_arrOnTrack == 3 / 'railTrack(*_ST_3,FWD,trainNum,NORMAL)'; 251 - //... 252 - entry / arrTrack = i_arrOnTrack; 253 - }; 592 + 593 +~/~/ Entry-Actions to set the previous signals to RED 594 + 254 254 255 - // Region for handling cleanup-functionalities such as above 256 - region Cleanup: 257 - initial state Entry 258 - --> cleanup with 'railContact(*_LN_5,0)'; 596 + 259 259 260 - final state cleanup { 261 - entry debug / 'println("[trainNum][ST-ST] Entered *_LN_5 completely")'; 262 - entry / 'railTrackOff(*_LN_4)'; 263 - entry / *_LN_4_req[trainNum] = false; 264 - }; 598 + 599 +~/~/ Requesting the next segment 600 + 265 265 266 - // Region for handling permissions of all needed tracks 267 - region Permissions: 268 - // State for requesting all needed tracks according to destination track and cleanup-Flag 269 - initial state checking { 270 - entry / *_ST_0_req[trainNum] = true; 271 - entry destTrack == 1 | !cleanup / *_ST_1_req[trainNum] = true; 272 - entry destTrack == 2 | !cleanup / *_ST_2_req[trainNum] = true; 273 - entry destTrack == 3 | !cleanup / *_ST_3_req[trainNum] = true; 274 - } 275 - // Transitions for permitted tracks match wished tracks 276 - --> success with destTrack == 1 & *_ST_0_perm == trainNum & *_ST_1_perm == trainNum / i_arrOnTrack = 1 277 - --> success with destTrack == 2 & *_ST_0_perm == trainNum & *_ST_2_perm == trainNum / i_arrOnTrack = 2 278 - --> success with destTrack == 3 & *_ST_0_perm == trainNum & *_ST_3_perm == trainNum / i_arrOnTrack = 3 279 - // Transitions for permitted tracks don't match wished tracks 280 - --> success with *_ST_0_perm == trainNum & *_ST_1_perm == trainNum / i_arrOnTrack = 1 281 - --> success with *_ST_0_perm == trainNum & *_ST_2_perm == trainNum / i_arrOnTrack = 2 282 - --> success with *_ST_0_perm == trainNum & *_ST_3_perm == trainNum / i_arrOnTrack = 3 283 - // Transition for not all tracks permitted 284 - --> resolving with *_ST_0_perm == trainNum | *_ST_3_perm == trainNum | *_ST_2_perm == trainNum | *_ST_1_perm == trainNum; 602 + 603 +~/~/ Region for handling train driving 604 + 285 285 286 - // State for waiting an additional tick 287 - state resolving 288 - --> resolving1; 289 - 290 - // State for releasing track requests 291 - state resolving1 { 292 - entry / *_ST_0_req[trainNum] = false; 293 - entry / *_ST_1_req[trainNum] = false; 294 - entry / *_ST_2_req[trainNum] = false; 295 - entry / *_ST_3_req[trainNum] = false; 296 - } 297 - // Transition for trying the requesting again 298 - --> checking; 606 + 607 +~/~/ Transition to continuing state, if permitted 608 + 609 +~/~/ Transition to slowing down else 610 + 299 299 300 - // State for waiting an additional tick 301 - state success 302 - --> success1; 303 303 304 - // State for releasing not used track requests 305 - final state success1 { 306 - entry !(i_arrOnTrack == 1) / *_ST_1_req[trainNum] = false; 307 - entry !(i_arrOnTrack == 2) / *_ST_2_req[trainNum] = false; 308 - entry !(i_arrOnTrack == 3) / *_ST_3_req[trainNum] = false; 309 - // Settting perm_all_next_segments to true 310 - entry / perm_all_next_segments = true; 311 - }; 312 - // Transition to station entry states 313 - }>-> *_LN_5_*_ST; 613 +~/~/ State for slowing down 614 + 615 +~/~/ Addtitional output for debugging 616 + 617 +~/~/ Entry-Action for slowing down the train 618 + 314 314 315 - // State waiting for station entry316 - state *_LN_5_*_ST317 - --> Arr_*_ST with i_arrOnTrack == 1 & 'railContact(*_ST_1,0)'318 - --> Arr_*_STwithi_arrOnTrack==2 & 'railContact(*_ST_2,0)'319 - --> Arr_*_ST with i_arrOnTrack == 3 & 'railContact(*_ST_3,0)';620 + 621 +~/~/ Transition to waiting state 622 + 623 +~/~/ Transition to continuing state, if permitted 624 + 320 320 321 - // State for setting tracks, points and signals according to i_arrOnTrack 322 - // and releasing previous track request 323 - state Arr_*_ST { 324 - entry / 'railSignal(*_LN_5, FWD, RED)'; 325 - entry / 'railTrackOff(*_LN_5)'; 326 - entry / 'railTrack(*_ST_0,FWD,trainNum,SLOW)'; 327 - entry i_arrOnTrack == 1 / 'railTrack(*_ST_1,FWD,trainNum,SLOW)'; 328 - entry i_arrOnTrack == 2 / 'railTrack(*_ST_2,FWD,trainNum,SLOW)'; 329 - entry i_arrOnTrack == 3 / 'railTrack(*_ST_3,FWD,trainNum,SLOW)'; 330 - entry / *_LN_5_req[trainNum] = false; 626 + 627 +~/~/ Waiting state 628 + 629 +~/~/ Addtitional output for debugging 630 + 631 +~/~/ Entry-Action for stopping the train 632 + 331 331 332 - initial state SlowEntry 333 - --> Slow with i_arrOnTrack == 1 & 'railContact(*_ST_1,0)' 334 - --> Slow with i_arrOnTrack == 2 & 'railContact(*_ST_2,0)' 335 - --> Slow with i_arrOnTrack == 3 & 'railContact(*_ST_3,0)'; 634 + 635 +~/~/ Tranisition to continuing state 636 + 336 336 337 - // State for switching off previous track and releasing the request 338 - state Slow { 339 - entry / 'railTrackOff(*_ST_0)'; 340 - entry / *_ST_0_req[trainNum] = false; 341 - } 342 - // Transitions to halt state, when train is at second contact of a track segment 343 - --> Halt with i_arrOnTrack == 1 & 'railContact(*_ST_1,1)' 344 - --> Halt with i_arrOnTrack == 2 & 'railContact(*_ST_2,1)' 345 - --> Halt with i_arrOnTrack == 3 & 'railContact(*_ST_3,1)'; 638 + 639 +~/~/ State to continuing driving on the track 640 + 641 +~/~/ Addtitional output for debugging 642 + 643 +~/~/ Entry-Actions to set tracks and signals for driving 644 + 346 346 347 - 348 - final state Halt { 349 - // Entry-Actions for braking the train on correct track 350 - entry i_arrOnTrack == 1 / 'railTrackBrake(*_ST_1)'; 351 - entry i_arrOnTrack == 2 / 'railTrackBrake(*_ST_2)'; 352 - entry i_arrOnTrack == 3 / 'railTrackBrake(*_ST_3)'; 353 - // Entry-Actions for waiting for timer on correct track 354 - entry i_arrOnTrack == 1 / 'railArrival(trainNum, *_ST_1)'; 355 - entry i_arrOnTrack == 2 / 'railArrival(trainNum, *_ST_2)'; 356 - entry i_arrOnTrack == 3 / 'railArrival(trainNum, *_ST_3)'; 357 - }; 358 - } 359 - >-> done; 646 + 360 360 361 - state done 362 - // Transition to final state, if timer is ready 363 - --> reallyDone with 'railDeparture(trainNum)'; 648 + 364 364 365 - final state reallyDone; 366 -} 367 -{{/code}} 650 + 651 + 652 + 653 + 654 + 655 +~/~/ Region for handling cleanup-functionalities 656 + 657 + 658 + 659 +~/~/ Transition to cleanup state 660 + 661 + 662 + 663 +~/~/ Cleanup state 664 + 665 +~/~/ Addtitional output for debugging 666 + 667 +~/~/ Entry-Action to switching off the previous track 668 + 669 +~/~/ Entry-Action to release the previous track 670 + 671 + 672 + 673 +~/~/ Transition to transitional state 674 + 675 + 676 + 677 +~/~/ Transitional state 678 + 679 +~/~/ Transition to next track segment, if contact is readed 680 + 681 + 682 + 683 + 684 + 685 + 686 + 687 + 688 + 689 + 690 + 691 +~/~/ State for entering a station 692 + 693 +~/~/ Variable for checking all needed permissions 694 + 695 +~/~/ Output 696 + 697 +~/~/ Setting signal to RED 698 + 699 + 700 + 701 +~/~/ Region for handling train driving 702 + 703 + 704 + 705 +~/~/ Transition to continuing state, if permitted 706 + 707 +~/~/ Transition to slowing down else 708 + 709 + 710 + 711 +~/~/ State for slowing down 712 + 713 +~/~/ Addtitional output for debugging 714 + 715 +~/~/ Entry-Action for slowing down the train 716 + 717 + 718 + 719 +~/~/ Transition to waiting state 720 + 721 +~/~/ Transition to continuing state, if permitted 722 + 723 + 724 + 725 +~/~/ Waiting state 726 + 727 +~/~/ Addtitional output for debugging 728 + 729 +~/~/ Entry-Action for stopping the train 730 + 731 + 732 + 733 +~/~/ Tranisition to continuing state 734 + 735 + 736 + 737 +~/~/ State to continuing driving on the track 738 + 739 +~/~/ Addtitional output for debugging 740 + 741 +~/~/ Set of entry-Actions for setting tracks, points and signals according to i_arrOnTrack 742 + 743 + 744 + 745 + 746 + 747 + 748 + 749 +~/~/ Setting the arrival track (output) 750 + 751 + 752 + 753 + 754 + 755 +~/~/ Region for handling cleanup-functionalities 756 + 757 + 758 + 759 +~/~/ Transition to cleanup state 760 + 761 + 762 + 763 +~/~/ Cleanup state 764 + 765 +~/~/ Addtitional output for debugging 766 + 767 +~/~/ Entry-Action to switching off the previous tracks 768 + 769 +~/~/ Entry-Action to release the previous tracks 770 + 771 + 772 + 773 + 774 + 775 +~/~/ Region for handling permissions of all needed tracks 776 + 777 +~/~/ State for requesting all needed tracks according to destination track and cleanup-Flag 778 + 779 + 780 + 781 + 782 + 783 + 784 + 785 + 786 + 787 + 788 + 789 +~/~/ Transitions for permitted tracks match wished tracks 790 + 791 + 792 + 793 + 794 + 795 +~/~/ Transitions for permitted tracks don't match wished tracks 796 + 797 + 798 + 799 + 800 + 801 +~/~/ Transition for not all tracks permitted 802 + 803 + 804 + 805 +~/~/ State for waiting an additional tick 806 + 807 + 808 + 809 + 810 + 811 +~/~/ State for releasing track requests 812 + 813 + 814 + 815 + 816 + 817 + 818 + 819 + 820 + 821 + 822 + 823 +~/~/ Transition for trying the requesting again 824 + 825 + 826 + 827 +~/~/ State for waiting an additional tick 828 + 829 + 830 + 831 + 832 + 833 +~/~/ State for releasing not used track requests and 834 + 835 + 836 + 837 + 838 + 839 + 840 + 841 +~/~/ Settting perm_all_next_segments to true 842 + 843 + 844 + 845 +~/~/ Transition to station entry states 846 + 847 + 848 + 849 +~/~/ State waiting for station entry 850 + 851 + 852 + 853 + 854 + 855 + 856 + 857 + 858 + 859 +~/~/ State for setting tracks, points and signals according to i_arrOnTrack 860 + 861 +~/~/ and releasing previous track request 862 + 863 + 864 + 865 + 866 + 867 + 868 + 869 + 870 + 871 + 872 + 873 + 874 + 875 + 876 + 877 +~/~/ State for slowing down, if train completely on track 878 + 879 + 880 + 881 + 882 + 883 + 884 + 885 + 886 + 887 +~/~/ State for switching off previous track and releasing the request 888 + 889 + 890 + 891 + 892 + 893 + 894 + 895 +~/~/ Transitions to halt states, if train at second contact of a track 896 + 897 + 898 + 899 + 900 + 901 + 902 + 903 + 904 + 905 +~/~/ Entry-Actions for braking the train on correct track 906 + 907 + 908 + 909 + 910 + 911 +~/~/ Entry-Actions for waiting for timer on correct track 912 + 913 + 914 + 915 + 916 + 917 + 918 + 919 + 920 + 921 + 922 + 923 + 924 + 925 + 926 + 927 +~/~/ Transition to final state, if timer is ready 928 +)))
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -94716 621 +9471639 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/94716 62/Basic design1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471639/Basic design