Engee documentation

State machines

Introduction

A State Machine (SM) is a representation of an event-driven system that transitions from one mode of operation to another when the condition that determines the change is true. MS can be used to design and develop supervisory control, task scheduling, fault management, communication protocols, user interfaces, and hybrid systems.

The MS Engee is implemented graphically inside the block Chart. To get started, place the Chart block on the Engee workspace and access it by double-clicking the mouse.

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

These elements form the basis of MS, but additional elements are used to realise the models more fully, e.g.:

stateflow all in one

For better understanding of MS operation it is recommended to switch on animation of transitions in settings window debug article icon 1:

image11

The animation is realised by highlighting the transitions. The transitions will be highlighted according to the order of execution:

image3

The Simulation Speed parameter in the Settings window of start settings 0 1 (outside the Chart block) allows you to slow down the model execution, which is useful for visualising plots and highlighting MS state transitions (see Model diagnostics for more details on the parameter).

settings speed simulation 1

Visualisation of state machine results

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

  • Create input/output port inside the Chart block;

  • In chart window stateflow graphs button, with record signals enabled, select the output signal (in our case Chart.a - output variable a from the Chart block):

    chart y

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

    sf no sa 1

    For more information about visualisation in Engee see Graphs.