Page History
...
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 a an Name,
- can be initialised (optional),
- can get a CombineOperator(optional) (-, +, *, max, min, or, and, host).
Info | ||||
---|---|---|---|---|
| ||||
{VariableDefinition} (isInput?='input')? (isOutput?='output')? (isStatic?='static')? type=[types::Type|FQN] name=ID |
...
- 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 '+'
Declarations
Within State Scopes there can be declarations of variables (and signals)?.
A Variable:
- has an optional (not direction for local variables) direction,
- can be static,
- has a datatype (integer, boolean, real, string, void)
- an optional initial value
- has a CombineOperator (-, +, *, max, min, or, and, host).
VariableDefinition:
{VariableDefinition} direction=VarDirection? (isStatic?='static')? type=[types::Type|FQN] name=ID ('=' varInitialValue=Expression)? ('with' varCombineOperator=CombineOperator)?;
Examples:
Signals
4 views to implement signals:
- don't use signals. Use only variables
- Boolean variables are interpreted as signals (no Boolean variables available)
- Yakindu events are interpreted as signals
- declare a new declarations type named signal
Signal Declarations
Yakindu events are interpreted as signals. A signal has a Direction and a Name.
Info | ||||
---|---|---|---|---|
| ||||
{EventDefinition} (isInput?='input')? (isOutput?='output')? 'signal' name=ID ';'; |
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
Entry
is A Local Reaction has a Trigger and an Effect.EntryAction returns sgraph::Effect:
{EntryAction} 'Entry' ''
Info | ||||
---|---|---|---|---|
| ||||
(trigger=(LocalReactionTrigger | ReactionTrigger))? ('/' effect=(ReactionEffect | SuspendEffect)) ';'; |
...
Inside
is an Effect.
...
LocalReactionTrigger
Info | ||||
---|---|---|---|---|
|
...
| |
{ |
...
Exit
is an Effect
...
ReactionTrigger} triggers+=LocalReactionType ('&&' (isImmediate?='#')? (delay=INT)? ((triggers+=RegularEventSpec) | ('[' guardExpression=Expression ']'))?)?; |
Examples:
- Entry && S
- During && S
- Exit && S
- Exit && [S1 &&S2]
- Entry && # S
- Entry && # 3 S
LocalReaction Effect
Info | ||||
---|---|---|---|---|
| ||||
{ |
...
Suspend
is a Trigger.
...
ReactionEffect} actions+=Expression (=> ',' actions+=Expression)*; |
Example:
- I / Suspend;
- / O=false;
- / I1=true, I2=false;
- / I1=true, I2=false;
- / O=true;
Transition
A Transition is defined by a Reaction, consisting of a Trigger and an Effect.
Transition Trigger
A trigger:
- can be a Signal,
- a boolean Variable
- an Expression
- can be immediate (optional)
- delay (optional)
Info | ||||
---|---|---|---|---|
| ||||
{ |
...
ReactionTrigger} |
...
Transition
...
(isImmediate?='#')? (delay=INT)? ((triggers+=RegularEventSpec) | ('[' guardExpression=Expression ']')); |
Examples:
- S
- [S1 && S2]
- #_S
- #_3 S
Transition Effect
Info | ||||
---|---|---|---|---|
| ||||
{ReactionEffect} actions+=Expression (=> ',' actions+=Expression)*; |
Examples:
- / S
- / I = false
- / I1 = false, I2 = I3 + 10