Wiki source code of Yakindu-SCCharts textual desciption language
Last modified by wah on 2023/09/11 16:17
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | |||
| 2 | |||
| 3 | {{toc/}} | ||
| 4 | |||
| 5 | = State Scope = | ||
| 6 | |||
| 7 | State Scopes allow to define (% style="color: rgb(0,51,102);" %)**Variable Declarations**(%%),(% style="color: rgb(0,51,102);" %)** Signal Declarations**(%%), and (% style="color: rgb(0,51,102);" %)**Local Reactions:** | ||
| 8 | |||
| 9 | |||
| 10 | |||
| 11 | {{info icon="false" title="StateScope:"}} | ||
| 12 | (% style="font-size: 10.0pt;line-height: 13.0pt;" %){SimpleScope} declarations+=(VariableDeclaration | SignalDeclaration | LocalReaction)*; | ||
| 13 | {{/info}} | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | === Variable Declarations === | ||
| 18 | |||
| 19 | Variable Declarations in a State Scope are visible in this state and its descendant states. | ||
| 20 | |||
| 21 | A Variable: | ||
| 22 | |||
| 23 | * has a Direction. It can be an input, an output, or both, | ||
| 24 | * can be Static (optional), | ||
| 25 | * has a Datatype (integer, boolean, real, string, void), | ||
| 26 | * has an Name, | ||
| 27 | * can be initialised (optional), | ||
| 28 | * can get a CombineOperator(optional) (-, +, *, max, min, or, and, host). | ||
| 29 | \\ | ||
| 30 | |||
| 31 | {{info icon="false" title="VariableDefinition:"}} | ||
| 32 | {VariableDefinition} (isInput?='input')? (isOutput?='output')? (isStatic?='static')? type=[types::Type|FQN] name=ID | ||
| 33 | ('=' varInitialValue=Expression)? ('with' varCombineOperator=CombineOperator)? ';'; | ||
| 34 | {{/info}} | ||
| 35 | |||
| 36 | **Examples:** | ||
| 37 | |||
| 38 | * input boolean A; | ||
| 39 | * output boolean A; | ||
| 40 | * input output boolean A; ~/~/ double direction (input and output)) | ||
| 41 | * input static boolean A; ~/~/static variable | ||
| 42 | * boolean A; ~/~/local, without direction | ||
| 43 | * input integer I=10; ~/~/the variable I is initialised | ||
| 44 | * input integer I with '+' ~/~/the combine operator is '+' | ||
| 45 | |||
| 46 | [[image:attach:image2012-12-5 22:52:55.png]] | ||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | === Signal Declarations === | ||
| 53 | |||
| 54 | Yakindu events are interpreted as signals. A signal has a Direction and a Name. | ||
| 55 | |||
| 56 | {{info icon="false" title="SignalDefinition:"}} | ||
| 57 | {EventDefinition} (isInput?='input')? (isOutput?='output')? 'signal' name=ID ';'; | ||
| 58 | {{/info}} | ||
| 59 | |||
| 60 | **Examples:** | ||
| 61 | |||
| 62 | * input signal I; | ||
| 63 | * output signal I; | ||
| 64 | * input output signal I; | ||
| 65 | * signal I; | ||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | |=((( | ||
| 72 | |||
| 73 | )))|=((( | ||
| 74 | advantage | ||
| 75 | )))|=((( | ||
| 76 | disadvantage | ||
| 77 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
| 78 | ((( | ||
| 79 | |||
| 80 | ))) | ||
| 81 | |((( | ||
| 82 | Don't use signals | ||
| 83 | )))|((( | ||
| 84 | * no need to be implemented | ||
| 85 | )))|((( | ||
| 86 | * no signals | ||
| 87 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 88 | ((( | ||
| 89 | No | ||
| 90 | ))) | ||
| 91 | |((( | ||
| 92 | Boolean variables as signals | ||
| 93 | )))|((( | ||
| 94 | * implementation in a short time | ||
| 95 | * a short form declaration:((( | ||
| 96 | **//in I//** instead of **//in I:boolean//** | ||
| 97 | ))) | ||
| 98 | * a short form of use: | ||
| 99 | //**I / O**// instead of //**[I==true] / O = false**// | ||
| 100 | )))|((( | ||
| 101 | * no more possible to use of Boolean variables | ||
| 102 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 103 | ((( | ||
| 104 | No | ||
| 105 | ))) | ||
| 106 | |((( | ||
| 107 | Yakindu events as signals | ||
| 108 | )))|((( | ||
| 109 | * use of already implemented features | ||
| 110 | * differ between Signals and Boolean Variables | ||
| 111 | |||
| 112 | Declaration: //**in** //(% style="font-style: italic;" %)**signal I;** | ||
| 113 | )))|((( | ||
| 114 | * signals are implemented as events | ||
| 115 | * (% style="color: rgb(255,0,0);" %)**Question**(%%): How to mix Signals and variables? | ||
| 116 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 117 | ((( | ||
| 118 | Yes | ||
| 119 | ))) | ||
| 120 | |((( | ||
| 121 | New declaration type | ||
| 122 | )))|((( | ||
| 123 | * differ between Signals and Boolean Variables | ||
| 124 | |||
| 125 | Declaration: //**in** //**signal I;** | ||
| 126 | )))|((( | ||
| 127 | * expensive | ||
| 128 | )))|(% colspan="1" %)(% colspan="1" %) | ||
| 129 | ((( | ||
| 130 | no | ||
| 131 | ))) | ||
| 132 | |||
| 133 | [[image:attach:image2013-1-24 13:11:18.png]] | ||
| 134 | |||
| 135 | === Local Reactions === | ||
| 136 | |||
| 137 | A Local Reaction has a Trigger and an Effect. | ||
| 138 | |||
| 139 | {{info icon="false" title="LocalReaction:"}} | ||
| 140 | (trigger=(LocalReactionTrigger | ReactionTrigger))? ('/' effect=(ReactionEffect | SuspendEffect)) ';'; | ||
| 141 | {{/info}} | ||
| 142 | |||
| 143 | ===== LocalReactionTrigger ===== | ||
| 144 | |||
| 145 | {{info icon="false" title="LocalReactionTrigger returns sgraph::Trigger:"}} | ||
| 146 | {ReactionTrigger} triggers+=LocalReactionType ('&&' (isImmediate?='#')? (delay=INT)? ((triggers+=RegularEventSpec) | ('[' guardExpression=Expression ']'))?)?; | ||
| 147 | {{/info}} | ||
| 148 | |||
| 149 | (% style="font-size: 10.0pt;line-height: 13.0pt;" %)**Examples**: | ||
| 150 | |||
| 151 | * Entry && S | ||
| 152 | * During && S | ||
| 153 | * Exit && S | ||
| 154 | * Exit && [S1 &&S2] | ||
| 155 | * Entry && # S | ||
| 156 | * Entry && # 3 S | ||
| 157 | |||
| 158 | ===== LocalReaction Effect ===== | ||
| 159 | |||
| 160 | {{info icon="false" title="ReactionEffect returns sgraph::Effect:"}} | ||
| 161 | {ReactionEffect} actions+=Expression (=> ',' actions+=Expression)*; | ||
| 162 | {{/info}} | ||
| 163 | |||
| 164 | (% style="font-size: 10.0pt;line-height: 13.0pt;" %)**Example**: | ||
| 165 | |||
| 166 | * I / Suspend; | ||
| 167 | * / O=false; | ||
| 168 | * / I1=true, I2=false; | ||
| 169 | * / I1=true, I2=false; | ||
| 170 | * / O=true; | ||
| 171 | |||
| 172 | // | ||
| 173 | // | ||
| 174 | |||
| 175 | = //Transition// = | ||
| 176 | |||
| 177 | A Transition is defined by a Reaction, consisting of a Trigger and an Effect. | ||
| 178 | |||
| 179 | [[image:attach:image2013-1-24 13:22:48.png]] | ||
| 180 | |||
| 181 | === Transition Trigger === | ||
| 182 | |||
| 183 | A trigger: | ||
| 184 | |||
| 185 | * can be a Signal, | ||
| 186 | * a boolean Variable | ||
| 187 | * an Expression | ||
| 188 | * can be immediate (optional) | ||
| 189 | * delay (optional) | ||
| 190 | |||
| 191 | {{info icon="false" title="ReactionTrigger returns sgraph::Trigger:"}} | ||
| 192 | {ReactionTrigger} (isImmediate?='#')? (delay=INT)? ((triggers+=RegularEventSpec) | ('[' guardExpression=Expression ']')); | ||
| 193 | {{/info}} | ||
| 194 | |||
| 195 | **Examples:** | ||
| 196 | |||
| 197 | * S | ||
| 198 | * [S1 && S2] | ||
| 199 | * #_S | ||
| 200 | * #_3 S | ||
| 201 | |||
| 202 | === Transition Effect === | ||
| 203 | |||
| 204 | {{info icon="false" title="ReactionEffect returns sgraph::Effect:"}} | ||
| 205 | {ReactionEffect} actions+=Expression (=> ',' actions+=Expression)*; | ||
| 206 | {{/info}} | ||
| 207 | |||
| 208 | **Examples:** | ||
| 209 | |||
| 210 | * / S | ||
| 211 | * / I = false | ||
| 212 | * / I1 = false, I2 = I3 + 10 | ||
| 213 | |||
| 214 | = Extending the Validator = |