Skip to content

StateCharts

SysML state machine diagrams, drawn and simulated in OpenModelica.

StateCharts is an OpenModelica library to describe the control logic of a system with a state machine diagram, using the notation of the SysML stm diagram:

  • an initial pseudo-state (black dot) and a final state (bull's eye);
  • states with their entry, do and exit behaviors, each available as a Boolean output;
  • transitions labelled trigger [guard] / effect, whose effect is also a Boolean output;
  • a choice pseudo-state (diamond) to branch according to guards.

The diagram is drawn in the OMEdit diagram and drives the physical model around it directly (thermal, mechanical, electrical…). It is pure Modelica: nothing to install besides OpenModelica.

The diagram of the Sorting example in OMEdit: initial dot, states, choice, final state and labelled transitions

The elements

SysML element Block Boolean outputs
Initial pseudo-state ● Initial —
State State entry, do, exit
Transition trigger [guard] / effect Transition effect
Choice pseudo-state ◇ Choice —
Final state ◉ FinalState completed (variable)
State machine used as a block extends Chart those you add to it

Triggers of a transition: none (completion transition), signal (rising edge of a Boolean input), after(duration), when(condition). Details: The blocks.


This repository (library code, examples, verification scenarios and documentation) was generated with the help of artificial intelligence tools, under the direction of Benoit Delaup.