Changes for page Basic design

Last modified by nfl on 2025/01/30 12:05

From version 15.1
edited by sna
on 2014/08/13 02:39
Change comment: There is no comment for this version
To version 18.1
edited by sna
on 2014/08/13 03:55
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -43,6 +43,192 @@
43 43  
44 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 +=== Structure ===
47 +
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
54 + bool IC_JCT_0_req[11], IC_LN_0_req[11], IC_LN_1_req[11], IC_LN_2_req[11];
55 + bool IC_LN_3_req[11], IC_LN_4_req[11], IC_LN_5_req[11], IC_ST_0_req[11];
56 + bool IC_ST_1_req[11], IC_ST_2_req[11], IC_ST_3_req[11], IC_ST_4_req[11];
57 + bool IO_LN_0_req[11], IO_LN_1_req[11], IO_LN_2_req[11], KH_LN_0_req[11];
58 + bool KH_LN_1_req[11], KH_LN_2_req[11], KH_LN_3_req[11], KH_LN_4_req[11];
59 + bool KH_LN_5_req[11], KH_LN_6_req[11], KH_LN_7_req[11], KH_LN_8_req[11];
60 + bool KH_ST_0_req[11], KH_ST_1_req[11], KH_ST_2_req[11], KH_ST_3_req[11];
61 + bool KH_ST_4_req[11], KH_ST_5_req[11], KH_ST_6_req[11], KIO_LN_0_req[11];
62 + bool KIO_LN_1_req[11], OC_JCT_0_req[11], OC_LN_0_req[11], OC_LN_1_req[11];
63 + bool OC_LN_2_req[11], OC_LN_3_req[11], OC_LN_4_req[11], OC_LN_5_req[11];
64 + bool OC_ST_0_req[11], OC_ST_1_req[11], OC_ST_2_req[11], OC_ST_3_req[11];
65 + bool OC_ST_4_req[11], OI_LN_0_req[11], OI_LN_1_req[11], OI_LN_2_req[11];
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;
69 + int IC_JCT_0_perm, IC_LN_0_perm, IC_LN_1_perm, IC_LN_2_perm;
70 + int IC_LN_3_perm, IC_LN_4_perm, IC_LN_5_perm, IC_ST_0_perm;
71 + int IC_ST_1_perm, IC_ST_2_perm, IC_ST_3_perm, IC_ST_4_perm;
72 + int IO_LN_0_perm, IO_LN_1_perm, IO_LN_2_perm, KH_LN_0_perm;
73 + int KH_LN_1_perm, KH_LN_2_perm, KH_LN_3_perm, KH_LN_4_perm;
74 + int KH_LN_5_perm, KH_LN_6_perm, KH_LN_7_perm, KH_LN_8_perm;
75 + int KH_ST_0_perm, KH_ST_1_perm, KH_ST_2_perm, KH_ST_3_perm;
76 + int KH_ST_4_perm, KH_ST_5_perm, KH_ST_6_perm, KIO_LN_0_perm;
77 + int KIO_LN_1_perm, OC_JCT_0_perm, OC_LN_0_perm, OC_LN_1_perm;
78 + int OC_LN_2_perm, OC_LN_3_perm, OC_LN_4_perm, OC_LN_5_perm;
79 + int OC_ST_0_perm, OC_ST_1_perm, OC_ST_2_perm, OC_ST_3_perm;
80 + int OC_ST_4_perm, OI_LN_0_perm, OI_LN_1_perm, OI_LN_2_perm;
81 +
82 + // Debug flag for additional output
83 + bool debug = false;
84 + // Cleanup flag for halting the trains at home station tracks
85 +  bool cleanup = false;
86 +  // Variable, that gives the number of trains to C-Controller for stability check
87 + int trainCount;
88 +
89 + // Set of constants for binding to referenced SCCharts
90 + const int c_EINS = 1;
91 + const int c_ZWEI = 2;
92 + const int c_DREI = 3;
93 + const int c_VIER = 4;
94 + const int c_FUENF = 5;
95 +
96 + // State initializing the trains on corresponding tracks
97 + initial state init references initRailway11Trains
98 + --> run;
99 +
100 + // State handling the train schedules
101 + state run {
102 + // Regions handling the mutual exclusion on the track segments
103 + region Mutexes:
104 +  // State referenced to the MutexController for 11 Trains
105 + initial state Mutexes references mutexRailway11Trains;
106 +
107 + region KH_Mutexes:
108 +  // State referenced to additional MutexController for KH
109 + initial state KH_Mutexes references kh_mutex;
110 +
111 + // Regions that contain the schedules for individual trains
112 + //--------------------------------------------------------------------------------------
113 +
114 + // Region with schedule for train 4
115 + region Train4 :
116 +  // State with the schedule for train 4
117 + initial state train4 {
118 +
119 + // Annotation for replacing following constant in the hostcode of referenced SCChart
120 + @alterHostcode
121 + // Number of the train for identifying on track segments
122 + const int trainNum = 4;
123 +  // Variable specifying the track, where the train arrives at,
124 + // and for transmitting the track number to next Station-2-Station controller
125 + int arrivalTrack = 3;
126 +
127 + // Schedule of train 4: train drives only in the IC, should use station track 3
128 + // State Round referenced to ICIC Station-2-Station controller
129 + initial state Round references ICIC
130 + bind depTrack to arrivalTrack,
131 + destTrack to c_DREI,
132 + arrTrack to arrivalTrack
133 +  // Transition to checking state
134 + >-> Choice;
135 +
136 + // State for checking, when the train should halt and if the train is on corresponding track
137 + state Choice
138 + // Transition for driving additional circle, if cleanup = false or wrong track used
139 + --> Round with !cleanup | !(arrivalTrack == 3)
140 + // Transition to final state
141 + --> Done;
142 +
143 + final state Done;
144 + };
145 +
146 +
147 + // Region with schedule for train 5, identical to region above
148 +  region Train5 :
149 + initial state train5 {
150 +
151 + @alterHostcode
152 + const int trainNum = 5;
153 + int arrivalTrack = 2;
154 +
155 + initial state Round references ICIC
156 + bind depTrack to arrivalTrack,
157 + destTrack to c_ZWEI,
158 + arrTrack to arrivalTrack
159 + >-> Choice;
160 +
161 + state Choice
162 + --> Round with !cleanup | !(arrivalTrack == 2)
163 + --> Done;
164 +
165 + final state Done;
166 +
167 + };
168 +
169 +
170 + // Region with schedule for train 9, identical to region above
171 + region Train9 :
172 + initial state train9 {
173 +
174 + @alterHostcode
175 + const int trainNum = 9;
176 + int arrivalTrack = 1;
177 +
178 + initial state Round references ICIC
179 + bind depTrack to arrivalTrack,
180 + destTrack to c_EINS,
181 + arrTrack to arrivalTrack
182 + >-> Choice;
183 +
184 + state Choice
185 + --> Round with !cleanup | !(arrivalTrack == 1)
186 + --> Done;
187 +
188 + final state Done;
189 + };
190 +
191 +
192 + // Region with schedule for train 7
193 + region Train7 :
194 + initial state train7 {
195 +
196 + @alterHostcode
197 + const int trainNum = 7;
198 + int arrivalTrack = 1;
199 +
200 + // Schedule of train 7: train drives from OC-Station track 1 to IC-Station track 2 and back
201 + // arrivalTrack used for transmitting the number of station track where train arrived on
202 + // to next controller where the train starts on
203 + initial state OCtoIC references OCIC
204 + bind depTrack to arrivalTrack,
205 + destTrack to c_ZWEI,
206 + arrTrack to arrivalTrack
207 +  // Transition to next Station-2-Station controller
208 + >-> ICtoOC;
209 +
210 + state ICtoOC references ICOC
211 + bind depTrack to arrivalTrack,
212 + destTrack to c_EINS,
213 + arrTrack to arrivalTrack
214 +  // Transition to checking state because train at home station
215 + >-> Choice;
216 +
217 + // State for checking, when the train should halt and if the train is on corresponding track
218 + state Choice
219 + // Transition for driving additional circle, if cleanup = false or wrong track used
220 +  --> OCtoIC with !cleanup | !(arrivalTrack == 1)
221 + // Transition to final state
222 + --> Done;
223 +
224 + final state Done;
225 + };
226 + };
227 +}
228 +{{/code}}
229 +
230 +
231 +
46 46  == Station-2-Station controller ==
47 47  
48 48  Each Station-2-Station controller realizes the movement from one of the stations (IC,OC,KH) to another 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.
... ... @@ -138,9 +138,9 @@
138 138  
139 139  
140 140  
141 - // .....................................................................................
327 + // ----------------------------------------------------------------------------------------------------------------
142 142   // Set of track segment controlling states such as follows
143 - // .....................................................................................
329 + // ----------------------------------------------------------------------------------------------------------------
144 144  
145 145   // Transition to next track segment, if contact is triggered
146 146   state *_LN_0 {
... ... @@ -212,7 +212,7 @@
212 212   // Transition to next track segment, if contact is triggered
213 213   --> *_LN_1 with 'railContact(*_LN_1,0)';
214 214  
215 - // ..................................................................................
401 + // ----------------------------------------------------------------------------------------------------------------
216 216  
217 217  
218 218  
... ... @@ -315,7 +315,7 @@
315 315   // State waiting for station entry
316 316   state *_LN_5_*_ST
317 317   --> Arr_*_ST with i_arrOnTrack == 1 & 'railContact(*_ST_1,0)'
318 - --> Arr_*_ST with i_arrOnTrack == 2 & 'railContact(*_ST_2,0)'
504 +  --> Arr_*_ST with i_arrOnTrack == 2 & 'railContact(*_ST_2,0)'
319 319   --> Arr_*_ST with i_arrOnTrack == 3 & 'railContact(*_ST_3,0)';
320 320  
321 321   // State for setting tracks, points and signals according to i_arrOnTrack
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -9471662
1 +9471746
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471662/Basic design
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/SS14Railway/pages/9471746/Basic design