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