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
-
... ... @@ -63,9 +63,9 @@ 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; 66 66 67 - // Set of permission variables for all tracks 68 - 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; 68 + // Set of permission variables for all tracks 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,6 +78,7 @@ 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; 81 81 82 82 // Debug flag for additional output 83 83 bool debug = false; ... ... @@ -551,3 +551,185 @@ 551 551 final state reallyDone; 552 552 } 553 553 {{/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 -94717 461 +9471750 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/94717 46/Basic design1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471750/Basic design