Engee documentation

Condition

State (State) stateflow 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.

stateflow actions

The state blocks obey logic of CA operation:

  1. 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);

  2. 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).

  • The state name can consist of:

    • Latin letters in any case.

    • Numeric.

    • Underscore.

  • The name must begin with a letter of the Latin alphabet.

  • The name must not be repeated at the same nesting level.

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:

stateflow cycles variables

You can leave comments in the state blocks as you would in any Julia code:

stateflow commentary 2