Engee documentation

State Machines

Introduction

A State machine (MS) is a representation of an event—driven system that switches from one mode of operation to another when the condition determining the change is true. MS can be used to design and develop dispatch control systems, task planning, fault management, communication protocols, user interfaces, and hybrid systems.

MS Engee is implemented graphically inside the block Chart. To get started, place the Chart block on the Engee workspace and double-click into it.

Inside the Chart block library Engee stateflow button library It consists of four elements:

These elements form the basis of the MS, but additional elements are used for a more complete implementation of the models, for example:

stateflow all in one en

For a better understanding of the MS operation, it is recommended to include animation of transitions in settings window debug article icon 1:

image11 en

Animation is implemented by highlighting transitions. Transitions will be highlighted according to the order of execution.:

image3

Parameter Simulation speed in the window Settings start settings 0 1 (outside the Chart block) allows you to slow down the execution of the model, which is useful for visualizing graphs and highlighting state transitions of MS (for more information about the parameter, see Model diagnostics).

settings speed simulation 1 en

You can also disable states and transitions to temporarily exclude them from model execution. Use this to conduct testing., debugging and configuring alternative scenarios for the state machine without deleting elements:

Visualization of state machine results

The MS visualization process has no major differences from the visualization of classical Engee models*:

  • Create entrance/output port inside the Chart block;

  • In the window signal visualization stateflow graphs button, when enabled recording signals select the output signal (in our case Chart.a is the output variable a from the Chart block):

    chart y en

  • Run a simulation of the model start simulation button. The simulation result will be shown on the coordinate plane of the visualization window.:

    sf no sa 1 en

    For more information about visualization in Engee, see the article Signal visualization.