State Scope
State Scopes allow to define Variable Declarations, Signal Declarations, and Local Reactions:
Variable Declarations
Variable Declarations in a State Scope are visible in this state and its descendant states.
A Variable:
- has a Direction. It can be an input, an output, or both,
- can be Static (optional),
- has a Datatype (integer, boolean, real, string, void),
- has an Name,
- can be initialised (optional),
- can get a CombineOperator(optional) (-, +, *, max, min, or, and, host).
Examples:
- input boolean A;
- output boolean A;
- input output boolean A; // double direction (input and output))
- input static boolean A; //static variable
- boolean A; //local, without direction
- input integer I=10; //the variable I is initialised
- input integer I with '+' //the combine operator is '+'
Signal Declarations
Yakindu events are interpreted as signals. A signal has a Direction and a Name.
Examples:
- input signal I;
- output signal I;
- input output signal I;
- signal I;
advantage | disadvantage | ||
---|---|---|---|
Don't use signals |
|
| No |
Boolean variables as signals |
|
| No |
Yakindu events as signals |
Declaration: in signal I; |
| Yes |
New declaration type |
Declaration: in signal I; |
| no |
Local Reactions
A Local Reaction has a Trigger and an Effect.
LocalReactionTrigger
Examples:
- Entry && I / O=true;
- During && I /O=false;
- Exit && I1 / I1=true, I2=false;
- Exit && [I1 &&I2] / I1=true, I2=false;
- Entry && # I / O=true;
- Entry && # 3 I / O=true;
Transition
Question: use the commutativity of AND and OR? if(A!=null && A.val=1)?
Overview
Content Tools