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
-
... ... @@ -46,11 +46,7 @@ 46 46 === Structure === 47 47 48 48 {{code linenumbers="true" language="sct"}} 49 -// 50 -// Structure of a train controller based on test case 2 51 -// 52 -scchart Test2 "Test of IC_JCT" { 53 - // Set of request variables for all tracks for 11 trains 49 +scchart Test2b "Test of IC_JCT" { 54 54 bool IC_JCT_0_req[11], IC_LN_0_req[11], IC_LN_1_req[11], IC_LN_2_req[11]; 55 55 bool IC_LN_3_req[11], IC_LN_4_req[11], IC_LN_5_req[11], IC_ST_0_req[11]; 56 56 bool IC_ST_1_req[11], IC_ST_2_req[11], IC_ST_3_req[11], IC_ST_4_req[11]; ... ... @@ -63,9 +63,7 @@ 63 63 bool OC_LN_2_req[11], OC_LN_3_req[11], OC_LN_4_req[11], OC_LN_5_req[11]; 64 64 bool OC_ST_0_req[11], OC_ST_1_req[11], OC_ST_2_req[11], OC_ST_3_req[11]; 65 65 bool OC_ST_4_req[11], OI_LN_0_req[11], OI_LN_1_req[11], OI_LN_2_req[11]; 66 - bool req_in_R, req_out_R, req_in_L, req_out_L; 67 - 68 - // Set of permission variables for all tracks 62 + bool req_in_R, req_out_R, req_in_L, req_out_L, perm_in_R, perm_out_R, perm_in_L, perm_out_L; 69 69 int IC_JCT_0_perm, IC_LN_0_perm, IC_LN_1_perm, IC_LN_2_perm; 70 70 int IC_LN_3_perm, IC_LN_4_perm, IC_LN_5_perm, IC_ST_0_perm; 71 71 int IC_ST_1_perm, IC_ST_2_perm, IC_ST_3_perm, IC_ST_4_perm; ... ... @@ -78,16 +78,11 @@ 78 78 int OC_LN_2_perm, OC_LN_3_perm, OC_LN_4_perm, OC_LN_5_perm; 79 79 int OC_ST_0_perm, OC_ST_1_perm, OC_ST_2_perm, OC_ST_3_perm; 80 80 int OC_ST_4_perm, OI_LN_0_perm, OI_LN_1_perm, OI_LN_2_perm; 81 - bool perm_in_R, perm_out_R, perm_in_L, perm_out_L; 82 - 83 - // Debug flag for additional output 75 + 84 84 bool debug = false; 85 - // Cleanup flag for halting the trains at home station tracks 86 - bool cleanup = false; 87 - // Variable, that gives the number of trains to C-Controller for stability check 77 + bool cleanup = false; 88 88 int trainCount; 89 - 90 - // Set of constants for binding to referenced SCCharts 79 + 91 91 const int c_EINS = 1; 92 92 const int c_ZWEI = 2; 93 93 const int c_DREI = 3; ... ... @@ -94,59 +94,37 @@ 94 94 const int c_VIER = 4; 95 95 const int c_FUENF = 5; 96 96 97 - // State initializing the trains on corresponding tracks 98 98 initial state init references initRailway11Trains 99 99 --> run; 100 100 101 - // State handling the train schedules 102 102 state run { 103 - // Regions handling the mutual exclusion on the track segments 104 104 region Mutexes: 105 - // State referenced to the MutexController for 11 Trains 106 106 initial state Mutexes references mutexRailway11Trains; 107 107 108 108 region KH_Mutexes: 109 - // State referenced to additional MutexController for KH 110 110 initial state KH_Mutexes references kh_mutex; 111 111 112 - // Regions that contain the schedules for individual trains 113 - //-------------------------------------------------------------------------------------- 114 - 115 - // Region with schedule for train 4 116 116 region Train4 : 117 - // State with the schedule for train 4 118 118 initial state train4 { 119 119 120 - // Annotation for replacing following constant in the hostcode of referenced SCChart 121 121 @alterHostcode 122 - // Number of the train for identifying on track segments 123 123 const int trainNum = 4; 124 - // Variable specifying the track, where the train arrives at, 125 - // and for transmitting the track number to next Station-2-Station controller 126 126 int arrivalTrack = 3; 127 127 128 - // Schedule of train 4: train drives only in the IC, should use station track 3 129 - // State Round referenced to ICIC Station-2-Station controller 130 130 initial state Round references ICIC 131 131 bind depTrack to arrivalTrack, 132 132 destTrack to c_DREI, 133 133 arrTrack to arrivalTrack 134 - // Transition to checking state 135 135 >-> Choice; 136 - 137 - // State for checking, when the train should halt and if the train is on corresponding track 108 + 138 138 state Choice 139 - // Transition for driving additional circle, if cleanup = false or wrong track used 140 140 --> Round with !cleanup | !(arrivalTrack == 3) 141 - // Transition to final state 142 142 --> Done; 143 143 144 - final state Done; 113 + final state Done; 114 + 145 145 }; 146 - 147 - 148 - // Region with schedule for train 5, identical to region above 149 - region Train5 : 116 + region Train5 : 150 150 initial state train5 { 151 151 152 152 @alterHostcode ... ... @@ -167,8 +167,6 @@ 167 167 168 168 }; 169 169 170 - 171 - // Region with schedule for train 9, identical to region above 172 172 region Train9 : 173 173 initial state train9 { 174 174 ... ... @@ -188,9 +188,7 @@ 188 188 189 189 final state Done; 190 190 }; 191 - 192 - 193 - // Region with schedule for train 7 156 + 194 194 region Train7 : 195 195 initial state train7 { 196 196 ... ... @@ -198,14 +198,10 @@ 198 198 const int trainNum = 7; 199 199 int arrivalTrack = 1; 200 200 201 - // Schedule of train 7: train drives from OC-Station track 1 to IC-Station track 2 and back 202 - // arrivalTrack used for transmitting the number of station track where train arrived on 203 - // to next controller where the train starts on 204 204 initial state OCtoIC references OCIC 205 205 bind depTrack to arrivalTrack, 206 206 destTrack to c_ZWEI, 207 207 arrTrack to arrivalTrack 208 - // Transition to next Station-2-Station controller 209 209 >-> ICtoOC; 210 210 211 211 state ICtoOC references ICOC ... ... @@ -212,14 +212,10 @@ 212 212 bind depTrack to arrivalTrack, 213 213 destTrack to c_EINS, 214 214 arrTrack to arrivalTrack 215 - // Transition to checking state because train at home station 216 216 >-> Choice; 217 217 218 - // State for checking, when the train should halt and if the train is on corresponding track 219 219 state Choice 220 - // Transition for driving additional circle, if cleanup = false or wrong track used 221 - --> OCtoIC with !cleanup | !(arrivalTrack == 1) 222 - // Transition to final state 177 + --> OCtoIC with !cleanup | !(arrivalTrack == 1) 223 223 --> Done; 224 224 225 225 final state Done; ... ... @@ -325,9 +325,9 @@ 325 325 326 326 327 327 328 - // ----------------------------------------------------------------------------------------------------------------283 + // ..................................................................................... 329 329 // Set of track segment controlling states such as follows 330 - // ----------------------------------------------------------------------------------------------------------------285 + // ..................................................................................... 331 331 332 332 // Transition to next track segment, if contact is triggered 333 333 state *_LN_0 { ... ... @@ -399,7 +399,7 @@ 399 399 // Transition to next track segment, if contact is triggered 400 400 --> *_LN_1 with 'railContact(*_LN_1,0)'; 401 401 402 - // ----------------------------------------------------------------------------------------------------------------357 + // .................................................................................. 403 403 404 404 405 405 ... ... @@ -552,185 +552,3 @@ 552 552 final state reallyDone; 553 553 } 554 554 {{/code}} 555 - 556 -== Dynamic Controller == 557 - 558 -The dynamic controller handles all 11 Trains. For each train the controller has a region with a referenced dynamic scheduling. Thereby each train can follow an arbitrary schedule. Additionally the controller has a region for stable cleanup function. 559 - 560 -{{code linenumbers="true" language="sct"}} 561 -// 562 -// Dynamic controller for 11 trains 563 -// 564 -scchart DynamicController11 { 565 - // Set of request variables for all tracks for 11 trains 566 - bool IC_JCT_0_req[11], IC_LN_0_req[11], IC_LN_1_req[11], IC_LN_2_req[11]; 567 - bool IC_LN_3_req[11], IC_LN_4_req[11], IC_LN_5_req[11], IC_ST_0_req[11]; 568 - bool IC_ST_1_req[11], IC_ST_2_req[11], IC_ST_3_req[11], IC_ST_4_req[11]; 569 - bool IO_LN_0_req[11], IO_LN_1_req[11], IO_LN_2_req[11], KH_LN_0_req[11]; 570 - bool KH_LN_1_req[11], KH_LN_2_req[11], KH_LN_3_req[11], KH_LN_4_req[11]; 571 - bool KH_LN_5_req[11], KH_LN_6_req[11], KH_LN_7_req[11], KH_LN_8_req[11]; 572 - bool KH_ST_0_req[11], KH_ST_1_req[11], KH_ST_2_req[11], KH_ST_3_req[11]; 573 - bool KH_ST_4_req[11], KH_ST_5_req[11], KH_ST_6_req[11], KIO_LN_0_req[11]; 574 - bool KIO_LN_1_req[11], OC_JCT_0_req[11], OC_LN_0_req[11], OC_LN_1_req[11]; 575 - bool OC_LN_2_req[11], OC_LN_3_req[11], OC_LN_4_req[11], OC_LN_5_req[11]; 576 - bool OC_ST_0_req[11], OC_ST_1_req[11], OC_ST_2_req[11], OC_ST_3_req[11]; 577 - bool OC_ST_4_req[11], OI_LN_0_req[11], OI_LN_1_req[11], OI_LN_2_req[11]; 578 - bool req_in_R , req_out_R , req_in_L , req_out_L; 579 - 580 - // Set of permission variables for all tracks 581 - int IC_JCT_0_perm, IC_LN_0_perm, IC_LN_1_perm, IC_LN_2_perm; 582 - int IC_LN_3_perm, IC_LN_4_perm, IC_LN_5_perm, IC_ST_0_perm; 583 - int IC_ST_1_perm, IC_ST_2_perm, IC_ST_3_perm, IC_ST_4_perm; 584 - int IO_LN_0_perm, IO_LN_1_perm, IO_LN_2_perm, KH_LN_0_perm; 585 - int KH_LN_1_perm, KH_LN_2_perm, KH_LN_3_perm, KH_LN_4_perm; 586 - int KH_LN_5_perm, KH_LN_6_perm, KH_LN_7_perm, KH_LN_8_perm; 587 - int KH_ST_0_perm, KH_ST_1_perm, KH_ST_2_perm, KH_ST_3_perm; 588 - int KH_ST_4_perm, KH_ST_5_perm, KH_ST_6_perm, KIO_LN_0_perm; 589 - int KIO_LN_1_perm, OC_JCT_0_perm, OC_LN_0_perm, OC_LN_1_perm; 590 - int OC_LN_2_perm, OC_LN_3_perm, OC_LN_4_perm, OC_LN_5_perm; 591 - int OC_ST_0_perm, OC_ST_1_perm, OC_ST_2_perm, OC_ST_3_perm; 592 - int OC_ST_4_perm, OI_LN_0_perm, OI_LN_1_perm, OI_LN_2_perm; 593 - bool perm_in_R , perm_out_R , perm_in_L , perm_out_L; 594 - 595 - // Flags needed for stable cleanup function 596 - //---------------------------------------------------------------------------------------- 597 - // Flags for trains are ready and back at home 598 - bool trainDone[11]; 599 - // Flags for trains are on their home circle 600 - bool circle[11]; 601 - // Flag for trains 0 to 7 are back at home and trains 8 to 10 are on their home circle 602 - bool mainDone; 603 - // Flag for all trains are back at home 604 - bool allDone; 605 - //---------------------------------------------------------------------------------------- 606 - 607 - // Debug flag for additional output 608 - bool debug; 609 - // Cleanup flag for halting the trains at home station tracks 610 - bool cleanup; 611 - // Variable, that gives the number of trains to C-Controller for stability check 612 - int trainCount; 613 - // Constant needed for binding to referenced SCCharts 614 - const bool c_TRUE = true; 615 - 616 - 617 - // State initializing the trains on corresponding tracks 618 - initial state init references initRailway11Trains 619 - >-> run; 620 - 621 - 622 - // State handling the train schedules 623 - state run { 624 - 625 - // Region handling the cleanup function 626 - region Abort: 627 - initial state notDone 628 - // Transition when trains 0 to 7 are back at home and trains 8 to 10 are on their home circle 629 - --> mainDone with trainDone[0] & trainDone[1] & trainDone[2] 630 - & trainDone[3] & trainDone[4] & trainDone[5] 631 - & trainDone[6] & trainDone[7] 632 - & circle[8] & circle[9] & circle[10]; 633 - 634 - // State for allowing trains 8 to 10 to halt on the home track 635 - state mainDone 636 - --> quitCircle with / mainDone = true; 637 - 638 - // State waiting for trains 8 to 10 halt and setting flag for terminate the controller 639 - state quitCircle 640 - --> done with trainDone[8] & trainDone[9] & trainDone[10] / allDone = true; 641 - 642 - final state done; 643 - 644 - // Regions handling the mutual exclusion on the track segments 645 - region Mutexes: 646 - initial state Mutexes references mutexRailway11Trains 647 - // terminates with a strong abort when all trains are at home 648 - o-> done with allDone; 649 - 650 - final state done; 651 - 652 - region KH_Mutexes: 653 - initial state KH_Mutexes references kh_mutex 654 - // terminates with a strong abort when all trains are at home 655 - o-> done with allDone; 656 - 657 - final state done; 658 - 659 - // Regions that contain the dynamic schedules for trains 0 to 7 660 - //-------------------------------------------------------------------------------------- 661 - 662 - // Region with the dynamic schedule for train 0 663 - region Train0: 664 - initial state Train0 { 665 - @alterHostcode 666 - const int trainNum = 0 667 - // Variable for saving the home track 668 - int homeTrack = 1; 669 - // Variable for saving the home station 670 - int homeStation = 1; 671 - 672 - // State referenced to dynamic scheduling 673 - initial state drive 674 - references DynamicSheduling 675 - // Binding circleDone to true for halting at home if cleanup is set 676 - bind circleDone to c_TRUE 677 - // Set a flag and a light for train at home 678 - >-> done with / 'railLight(10,1)'; trainDone[0] = true; 679 - 680 - final state done; 681 - } 682 - >-> done; 683 - 684 - final state done; 685 - 686 - // ... (other regions for trains 1 to 7 such as before) 687 - 688 - //-------------------------------------------------------------------------------------- 689 - 690 - 691 - 692 - 693 - // Regions that contain the dynamic schedules for trains 8 to 10 694 - // Differences to regions above is that the trains 8 to 10 circle at home station circle 695 - // until trains 0 to 7 are back at home station and track 696 - // For this circleDone binds mainDone flag 697 - //-------------------------------------------------------------------------------------- 698 - 699 - // Region with the dynamic schedule for train 8 700 - region Train8: 701 - initial state Train8 { 702 - @alterHostcode 703 - const int trainNum = 8 704 - // Variable for saving the home track 705 - int homeTrack = 5; 706 - // Variable for saving the home station 707 - int homeStation = 1; 708 - 709 - // State referenced to dynamic scheduling 710 - initial state drive 711 - references DynamicSheduling 712 - // Binding circleDone to mainDone for halting at home only if cleanup is set 713 - // and trains 0 to 7 are at home and 8 to 10 on home circle 714 - bind circleDone to mainDone 715 - // Set a flag and a light for train at home 716 - >-> done with / 'railLight(6,1)'; trainDone[8] = true; 717 - 718 - final state done; 719 - } 720 - >-> done; 721 - 722 - final state done; 723 - 724 - // ... (other regions for trains 9 and 10 such as before) 725 - //-------------------------------------------------------------------------------------- 726 - 727 - } 728 - >-> flash; 729 - 730 - // State for flashing the lights at the end of the controller 731 - state flash 732 - --> done with / 'railFlashLight()'; 733 - 734 - final state done; 735 -} 736 -{{/code}}
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -9471 7501 +9471666 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471 750/Basic design1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471666/Basic design