Engee documentation

The Finite State Machine debugger

Page in progress.

Creating models based on finite automata is an effective way to describe complex discrete logic. To simplify the analysis of the operation of such machines and ensure control over their behavior, Engee provides a built-in debugger that allows step-by-step monitoring of the execution to identify errors in the finite state machine.

The debugger is available inside the block Chart and it is enabled if for states stateflow state and/or transition stateflow default transition set a breakpoint:

state machines breakpoint 1 en

Breakpoint They look like red markers. state machines breakpoint 1 (or grey state machines breakpoint 2 if disabled).

Breakpoint — a key tool of the finite state machine debugger, with which you can set conditions for stopping the execution of the model. This allows us to investigate the behavior of the model at a specific step in the execution of a finite automaton. So, using breakpoints, you can:

  • Step-by-step control of the finite state machine simulation;

  • View the values of variables at a specific step;

  • Analyze when and which states become active or terminate;

  • Check whether the following are being performed Groups of state machine operators (for entry, during, and exit groups);

  • Analyze the validity of transitions, including transitions with operators temporal logic, signal edge tracking and indicators of changes;

  • As well as diagnose hidden logical errors and unstable states that do not appear in the output of the model.

Working with breakpoints

Breakpoint can be set to:

  • State stateflow state — when entering, during execution and when exiting;

  • Transition stateflow default transition — when checking a condition or before making a transition.

To add a breakpoint to the state stateflow state or a transition stateflow default transition, left-click on the desired element and then on the breakpoint icon that appears. The active breakpoint will be marked with a red marker.:

sm breakpoints 1 en

state machines breakpoint 4 en

You can set different types of breakpoints for states and transitions. To do this, click on the breakpoint with the left mouse button:

In the states

At the crossings

state machines breakpoint 3 en

  • On State Entry — the simulation stops before executing the entry;

  • During State — the simulation stops before executing during on each clock cycle;

  • On State Exit — the simulation is suspended immediately after the execution of `exit' before switching to another state.

state machines breakpoint 11 en

  • When connection is valid — the simulation stops at the moment when the transition becomes acceptable and can be performed.;

  • When connection is testing — The simulation is suspended when the transition condition is checked. This parameter is not available if the transition does not contain a logical condition (for example, an unconditional transition).

The selected types will be displayed when the cursor hovers over the breakpoint.:

state machines breakpoint 4 en
state machines breakpoint 12 en

You can enable any combination of checkboxes, depending on which point of the state/transition you want to track. If you uncheck all the boxes, the breakpoint will be deleted.

To temporarily disable the breakpoint (leaving it on the status/transition, but not triggered), click on the breakpoint icon again.:

state machines breakpoint 3 en

List of breakpoints

To go to the list of breakpoints, left-click on the already created breakpoint and select Breakpoints list:

state machines breakpoint 5 en

This will open a list of all breakpoints of the finite state machine model.:

state machines breakpoint 6 en

Through the list of breakpoints, you can:

  • Track which breakpoints were triggered during the simulation of the model and the number of their triggers. The number of triggers is shown in the column "Number of operations". The triggered breakpoint will be highlighted in green:

    state machines breakpoint 14 x en

  • Delete a breakpoint by left-clicking on it in the list and clicking on the icon Remove breakpoint state machines breakpoint 7.

  • Add a breakpoint by left-clicking on it in the list and clicking on the icon Add Breakpoint: state machines breakpoint 8. In the window that opens, select the necessary parameters — the type of trigger and, if necessary, the condition:

    state machines breakpoint 9 en

  • Enable/disable a breakpoint by using the check boxes. state machines breakpoint 10 at the corresponding points.

  • Set a condition for a breakpoint by entering an expression in the column "Condition" opposite the desired line. For example, y > 5 or (y == 0) & (n > 5). The conditions can specify logical expressions supported by the logic of finite automata. They use the values of the inputs, outputs, and all variables available in the Chart block.

Managing model execution

Step-by-step execution is available only inside the Chart block and does not affect the global execution of the model in the workspace. When exiting the Chart block, the panel disappears and Engee returns to the normal simulation mode.
The active breakpoints of the Chart block do not conflict with breakpoints. models and scripts.

After setting the first breakpoint inside the Chart block, a step-by-step simulation control panel will appear in the upper-left corner of the canvas.:

state machines breakpoint 14

Three execution control commands are available:

  1. Step in state machines breakpoint 14 1 — proceeds to the next stage of execution inside the current state or transition. The command executes the details of the finite state machine element step by step. It can be:

    • Input to the finite state machine diagram;

    • Checking the transition conditions;

    • Performing transition actions;

    • State Activation;

    • Executing groups of entry, during, or exit statements;

    • Transition to child states or nested Transition graphs.

  2. Step over state machines breakpoint 14 2 — performs the current step in its entirety, without going to the internal details. The command is used to sequence the key execution steps of a finite state machine.:

    • Activating a finite state machine;

    • Transition to the state;

    • Checking available traffic;

    • Performing transition actions;

    • Performing status actions.

  3. Step out state machines breakpoint 14 3 — completes the execution of the current state, transition, child state, or nested transition graph and returns to the higher level of execution. The command allows you to exit the current nesting level and continue executing the machine at the level from which the input was performed.


To visually track the current stage of the machine model execution, a backlight is used — the active element is highlighted in green when executed both in the model itself and in the list of breakpoints.:

state machines breakpoint 14 4 en

In addition to highlighting with color, the system also provides hints in the form of icons, which, when you hover the cursor over them, pop up an auxiliary message about how exactly the model worked in the current step.:

  • sm before entering Before entering

  • sm during During

  • sm before exit Before exit

  • sm before testing transition Before testing transition

  • sm before transition Before taking transition

Viewing and editing variables

During a step-by-step simulation of a finite automaton, you can not only observe which states and transitions are activated, but also monitor the values of variables used inside the Chart block.

To do this, open settings window debug article icon 1 The Chart block — it displays all available variables.

state machines breakpoint 14 7 en

In this window you can:

  • View the current values of variables at each step;

  • To see changes in values — they are highlighted in green, similar to the list of breakpoints.;

  • Manually change the values of some variables right when the model is stopped.

    Variable values can only be edited during the simulation pause and when there is an active breakpoint.

To change the value of a variable:

  1. Move the cursor to the desired row in the column "Value»;

  2. Click on the current value;

  3. Enter a new value and press Enter.

You can change local variables and output signals. The values of the input signals are set from the external modeling environment (outside the Chart block).