Wiki source code of Textual SCCharts Description Language (SCT)
Version 14.1 by cmot on 2014/06/28 13:08
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | [[image:attach:450px-Xtext_logo.png]] | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | {{panel title="Project Overview" borderStyle="dashed"}} | ||
| 6 | Responsible: | ||
| 7 | |||
| 8 | * [[Christian Motika>>url:http://www.informatik.uni-kiel.de/rtsys/kontakt/cmot/||shape="rect"]], [[Steven Smyth>>url:http://www.informatik.uni-kiel.de/rtsys/kontakt/ssm/||shape="rect"]] | ||
| 9 | |||
| 10 | Formerly Responsible / Previous Projects: | ||
| 11 | |||
| 12 | * [[Christian Schneider>>url:http://www.informatik.uni-kiel.de/rtsys/kontakt/christian-schneider/||shape="rect"]] (Textual SyncCharts (KITS)) | ||
| 13 | |||
| 14 | Related Theses: | ||
| 15 | |||
| 16 | * Mirko Wischer, //Textuelle Darstellung und strukturbasiertes Editieren von Statecharts//, February 2006 ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/theses/miwi-dt.pdf||shape="rect"]]) | ||
| 17 | * Özgün Bayramoglu, //KIELER Infrastructure for Textual Modeling//, December 2009 ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/theses/oba-dt.pdf||shape="rect"]]) | ||
| 18 | * Christian Schneider, //Integrating Graphical and Textual Modeling//, February 2011 ([[pdf>>url:http://rtsys.informatik.uni-kiel.de/%7Ebiblio/downloads/theses/chsch-dt.pdf||shape="rect"]]) | ||
| 19 | {{/panel}} | ||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | SCCharts are typically modeled using the textual SCT language defined as an Xtext grammar in KIELER. Generally, if you do not know which elements can be placed at a certain cursor position you are assisted by a content-assist that can be called pressing <Ctrl>+<Space>. It will display all possible valid elements also considering scoping of variables. | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | In the following we will describe the basic elements using the famous ABRO example: | ||
| 28 | |||
| 29 | {{code linenumbers="true"}} | ||
| 30 | scchart ABRO { | ||
| 31 | input bool A; | ||
| 32 | input bool B; | ||
| 33 | input bool R; | ||
| 34 | output bool O = false; | ||
| 35 | region Main: | ||
| 36 | initial state ABO { | ||
| 37 | initial state WaitAB { | ||
| 38 | region HandleA: | ||
| 39 | initial state WA | ||
| 40 | --> DA with A; | ||
| 41 | final state DA; | ||
| 42 | region HandleB: | ||
| 43 | initial state WB | ||
| 44 | --> DB with B; | ||
| 45 | final state DB; | ||
| 46 | } | ||
| 47 | >-> Done with / O = true; | ||
| 48 | state Done; | ||
| 49 | } | ||
| 50 | o-> ABO with R; | ||
| 51 | } | ||
| 52 | {{/code}} | ||
| 53 | |||
| 54 | 1. In the first line you see how an SCChart is defined using the //scchart// keyword where the ID of the SCChart will be //ABRO//. An optional label can be inserted after //ABRO// using "<LABEL>". | ||
| 55 | 1. In the next three lines variables are declared, namely,// A//, //B//, //R// and //O//, where //O// is initialized with the value false.// A//, //B//, and //R// are inputs which must not be initialized and get there valued from the environment. | ||
| 56 | 1. An SCChart typically contains concurrent regions which are introduced with the keyword //region// as shown in Line 6. | ||
| 57 | 1. Every region must at least have one state, and every region must exactly have one initial state. An initial state //ABO// is defined for region //Main// in Line 7. | ||
| 58 | 1. Every state is terminated by a //;// as shown in line 11 for state //HandleA//. | ||
| 59 | 1. If you like to specify internal behavior of a state, you can add concurrent regions to a state in //{// <regions>// }// as done for state //ABO// or state //WaitAB//. | ||
| 60 | 1. Transitions outgoing from a state must be declared right before a state is terminated with// ;//. For example a transition from state //WA// to state //DA// is declared in Line 11. | ||
| 61 | 1. Transitions can have triggers and effects which are separated by a dash~:// <trigger>/<effects>//. Multiple sequential effects are separated by a //;//. The transition in Line 11 declares just a trigger //A// (a dash is not necessary in this case), while the transition from line 18 declares only an effect// O = true// (here the dash is mandatory). | ||
| 62 | 1. There are three types of transitions: 1. normal/weak abort transitions //~-~->//, 2. strong abort transitions //o->// and 3. termination/join transitions// >->//. | ||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | = Detailed Syntax of SCCharts Language Elements = | ||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | {{toc/}} | ||
| 71 | |||
| 72 | == SCCharts, Initial States, States, Transitions == | ||
| 73 | |||
| 74 | {{column width="50%"}} | ||
| 75 | {{code linenumbers="true"}} | ||
| 76 | scchart StateTransition { | ||
| 77 | initial state A | ||
| 78 | --> B; | ||
| 79 | state B | ||
| 80 | --> C; | ||
| 81 | state C | ||
| 82 | --> A immediate; | ||
| 83 | } | ||
| 84 | {{/code}} | ||
| 85 | {{/column}} | ||
| 86 | |||
| 87 | {{column width="50%"}} | ||
| 88 | [[image:attach:01statetransition.png]] | ||
| 89 | {{/column}} | ||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | == Variable == | ||
| 94 | |||
| 95 | {{column width="50%"}} | ||
| 96 | {{code linenumbers="true"}} | ||
| 97 | scchart Variable { | ||
| 98 | int var1; | ||
| 99 | bool var2; | ||
| 100 | int var3 = 3; | ||
| 101 | bool var4 = false; | ||
| 102 | input int var5; | ||
| 103 | output float var6; | ||
| 104 | input output bool var7; | ||
| 105 | initial state A | ||
| 106 | --> B; | ||
| 107 | state B; | ||
| 108 | } | ||
| 109 | {{/code}} | ||
| 110 | {{/column}} | ||
| 111 | |||
| 112 | {{column width="50%"}} | ||
| 113 | [[image:attach:02variable.png]] | ||
| 114 | {{/column}} | ||
| 115 | |||
| 116 | == Transition: Trigger & Effect == | ||
| 117 | |||
| 118 | {{column width="50%"}} | ||
| 119 | {{code linenumbers="true"}} | ||
| 120 | scchart TriggerEffect { | ||
| 121 | input int var1; | ||
| 122 | output bool var2; | ||
| 123 | initial state A | ||
| 124 | --> B with var1 == 3 / var2 = true; | ||
| 125 | state B; | ||
| 126 | } | ||
| 127 | {{/code}} | ||
| 128 | {{/column}} | ||
| 129 | |||
| 130 | {{column width="50%"}} | ||
| 131 | [[image:attach:03triggereffect.png]] | ||
| 132 | {{/column}} | ||
| 133 | |||
| 134 | == Super State == | ||
| 135 | |||
| 136 | {{column width="50%"}} | ||
| 137 | {{code linenumbers="true"}} | ||
| 138 | scchart SuperState { | ||
| 139 | initial state A | ||
| 140 | --> B; | ||
| 141 | state B { | ||
| 142 | initial state B1 | ||
| 143 | --> B2; | ||
| 144 | state B2; | ||
| 145 | }; | ||
| 146 | } | ||
| 147 | {{/code}} | ||
| 148 | {{/column}} | ||
| 149 | |||
| 150 | {{column width="50%"}} | ||
| 151 | [[image:attach:04superstate.png]] | ||
| 152 | {{/column}} | ||
| 153 | |||
| 154 | == SCCharts, Initial States, States, Transitions == | ||
| 155 | |||
| 156 | {{column width="50%"}} | ||
| 157 | {{code linenumbers="true"}} | ||
| 158 | scchart StateTransition { | ||
| 159 | initial state A | ||
| 160 | --> B; | ||
| 161 | state B | ||
| 162 | --> C; | ||
| 163 | state C | ||
| 164 | --> A immediate; | ||
| 165 | } | ||
| 166 | {{/code}} | ||
| 167 | {{/column}} | ||
| 168 | |||
| 169 | {{column width="50%"}} | ||
| 170 | [[image:attach:01statetransition.png]] | ||
| 171 | {{/column}} | ||
| 172 | |||
| 173 | == SCCharts, Initial States, States, Transitions == | ||
| 174 | |||
| 175 | {{column width="50%"}} | ||
| 176 | {{code linenumbers="true"}} | ||
| 177 | scchart StateTransition { | ||
| 178 | initial state A | ||
| 179 | --> B; | ||
| 180 | state B | ||
| 181 | --> C; | ||
| 182 | state C | ||
| 183 | --> A immediate; | ||
| 184 | } | ||
| 185 | {{/code}} | ||
| 186 | {{/column}} | ||
| 187 | |||
| 188 | {{column width="50%"}} | ||
| 189 | [[image:attach:01statetransition.png]] | ||
| 190 | {{/column}} | ||
| 191 | |||
| 192 | == SCCharts, Initial States, States, Transitions == | ||
| 193 | |||
| 194 | {{column width="50%"}} | ||
| 195 | {{code linenumbers="true"}} | ||
| 196 | scchart StateTransition { | ||
| 197 | initial state A | ||
| 198 | --> B; | ||
| 199 | state B | ||
| 200 | --> C; | ||
| 201 | state C | ||
| 202 | --> A immediate; | ||
| 203 | } | ||
| 204 | {{/code}} | ||
| 205 | {{/column}} | ||
| 206 | |||
| 207 | {{column width="50%"}} | ||
| 208 | [[image:attach:01statetransition.png]] | ||
| 209 | {{/column}} | ||
| 210 | |||
| 211 | == SCCharts, Initial States, States, Transitions == | ||
| 212 | |||
| 213 | {{column width="50%"}} | ||
| 214 | {{code linenumbers="true"}} | ||
| 215 | scchart StateTransition { | ||
| 216 | initial state A | ||
| 217 | --> B; | ||
| 218 | state B | ||
| 219 | --> C; | ||
| 220 | state C | ||
| 221 | --> A immediate; | ||
| 222 | } | ||
| 223 | {{/code}} | ||
| 224 | {{/column}} | ||
| 225 | |||
| 226 | {{column width="50%"}} | ||
| 227 | [[image:attach:01statetransition.png]] | ||
| 228 | {{/column}} | ||
| 229 | |||
| 230 | == SCCharts, Initial States, States, Transitions == | ||
| 231 | |||
| 232 | {{column width="50%"}} | ||
| 233 | {{code linenumbers="true"}} | ||
| 234 | scchart StateTransition { | ||
| 235 | initial state A | ||
| 236 | --> B; | ||
| 237 | state B | ||
| 238 | --> C; | ||
| 239 | state C | ||
| 240 | --> A immediate; | ||
| 241 | } | ||
| 242 | {{/code}} | ||
| 243 | {{/column}} | ||
| 244 | |||
| 245 | {{column width="50%"}} | ||
| 246 | [[image:attach:01statetransition.png]] | ||
| 247 | {{/column}} | ||
| 248 | |||
| 249 | == SCCharts, Initial States, States, Transitions == | ||
| 250 | |||
| 251 | {{column width="50%"}} | ||
| 252 | {{code linenumbers="true"}} | ||
| 253 | scchart StateTransition { | ||
| 254 | initial state A | ||
| 255 | --> B; | ||
| 256 | state B | ||
| 257 | --> C; | ||
| 258 | state C | ||
| 259 | --> A immediate; | ||
| 260 | } | ||
| 261 | {{/code}} | ||
| 262 | {{/column}} | ||
| 263 | |||
| 264 | {{column width="50%"}} | ||
| 265 | [[image:attach:01statetransition.png]] | ||
| 266 | {{/column}} | ||
| 267 | |||
| 268 | == SCCharts, Initial States, States, Transitions == | ||
| 269 | |||
| 270 | {{column width="50%"}} | ||
| 271 | {{code linenumbers="true"}} | ||
| 272 | scchart StateTransition { | ||
| 273 | initial state A | ||
| 274 | --> B; | ||
| 275 | state B | ||
| 276 | --> C; | ||
| 277 | state C | ||
| 278 | --> A immediate; | ||
| 279 | } | ||
| 280 | {{/code}} | ||
| 281 | {{/column}} | ||
| 282 | |||
| 283 | {{column width="50%"}} | ||
| 284 | [[image:attach:01statetransition.png]] | ||
| 285 | {{/column}} | ||
| 286 | |||
| 287 | == SCCharts, Initial States, States, Transitions == | ||
| 288 | |||
| 289 | {{column width="50%"}} | ||
| 290 | {{code linenumbers="true"}} | ||
| 291 | scchart StateTransition { | ||
| 292 | initial state A | ||
| 293 | --> B; | ||
| 294 | state B | ||
| 295 | --> C; | ||
| 296 | state C | ||
| 297 | --> A immediate; | ||
| 298 | } | ||
| 299 | {{/code}} | ||
| 300 | {{/column}} | ||
| 301 | |||
| 302 | {{column width="50%"}} | ||
| 303 | [[image:attach:01statetransition.png]] | ||
| 304 | {{/column}} | ||
| 305 | |||
| 306 | == SCCharts, Initial States, States, Transitions == | ||
| 307 | |||
| 308 | {{column width="50%"}} | ||
| 309 | {{code linenumbers="true"}} | ||
| 310 | scchart StateTransition { | ||
| 311 | initial state A | ||
| 312 | --> B; | ||
| 313 | state B | ||
| 314 | --> C; | ||
| 315 | state C | ||
| 316 | --> A immediate; | ||
| 317 | } | ||
| 318 | {{/code}} | ||
| 319 | {{/column}} | ||
| 320 | |||
| 321 | {{column width="50%"}} | ||
| 322 | [[image:attach:01statetransition.png]] | ||
| 323 | {{/column}} | ||
| 324 | |||
| 325 | == SCCharts, Initial States, States, Transitions == | ||
| 326 | |||
| 327 | {{column width="50%"}} | ||
| 328 | {{code linenumbers="true"}} | ||
| 329 | scchart StateTransition { | ||
| 330 | initial state A | ||
| 331 | --> B; | ||
| 332 | state B | ||
| 333 | --> C; | ||
| 334 | state C | ||
| 335 | --> A immediate; | ||
| 336 | } | ||
| 337 | {{/code}} | ||
| 338 | {{/column}} | ||
| 339 | |||
| 340 | {{column width="50%"}} | ||
| 341 | [[image:attach:01statetransition.png]] | ||
| 342 | {{/column}} | ||
| 343 | |||
| 344 | |||
| 345 | |||
| 346 | |||
| 347 | |||
| 348 | |||
| 349 | |||
| 350 | |||
| 351 | |||
| 352 | |||
| 353 | |||
| 354 | |||
| 355 | |||
| 356 | |||
| 357 | |||
| 358 | |||
| 359 | |||
| 360 | |||
| 361 | |||
| 362 | |||
| 363 | |||
| 364 | |||
| 365 | |||
| 366 | |||
| 367 | |||
| 368 | |||
| 369 | |||
| 370 | |||
| 371 | |||
| 372 | |||
| 373 | |||
| 374 |