Condition
State (State) is one of the blocks of a finite automaton (CA). Within the block, actions describing the behaviour of the system in this state are defined as program code in Julia, transition graph or a nested CA and can be configured using operator groups.
The state blocks obey logic of CA operation:
-
In a KA model, one or more states may be active at any given time, if a state hierarchy is used. In this case, the states from the most nested state to its outermost parent state are active (see State machine hierarchy);
-
A state is activated if the condition for a transition to it is met. If a state is the only one in the model or the only one among nested states, it can be activated without an incoming transition.
States support hierarchy (see State machine hierarchy). |
State syntax
Rule | Error if condition is violated |
---|---|
Each state must have a name. |
Router loop error: ErrorException('model_name/Chart': state name ' ' is incorrect). |
|
Error of result loop in router: ErrorException('model_name/Chart': state name 'example of invalid name' is incorrect). |
Operator groups only support Julia language operations. |
Model Initialisation Error: [EXEC] Model initialisation error id_model id_simulation: UndefVarError(:incorrect syntax) |
Code written in a state without specifying the prefixes entry:
, during:
, exit:
, and on
is executed both when the state is activated and at each step of the model as long as the state remains active and is called code with an anonymous operator group. Such a group of operators combines the behaviour of the entry:
and during:
prefixes. For example, a state block with a for
loop looks like this:
You can leave comments in the state blocks as you would in any Julia code: |