Library Modelica_StateGraph2 is a free Modelica package providing components to model discrete event, reactive and hybrid systems in a convenient way with deterministic hierarchical state diagrams. For convenience, the abbreviation "StateGraph2" will be often used for this library. An example model constructed with this library is shown in the figure to the right.
This library is inspired by Grafcet/Sequential Function Charts (SFC), Statecharts, Safe State Machines (SSM) and Mode Automata, and utilizes Modelica as action language. It has a similar modeling power as these formalisms, e.g. synchronization of parallel executing branches as in SFC (not easy in Statecharts), or suspending a hierarchical subgraph with one transition and resuming at the same states afterwards when entering it again, as in Statechart (not possible in SFC). A StateGraph2 model is always deterministic due to Modelicas "single assignment rule". Via special blocks in subpackage "Blocks", actions can be defined in a graphical way depending on the active step.
In order to construct a new state machine, exactly one instance of either "Step" or of "Parallel" must have parameter "initialStep = true". The "Parallel" component is both used as "composite step" (so only one branch), as well as "parallel step" (so several execution branches). The branches can be synchronized (if parameter use_outPort = true) or can run unsynchronized to each other (if parameter use_outPort = false).
For an introduction, have especially a look at:
This library was implemented with Modelica 3.1, and utilizes non-standard extensions to Modelica 3.4 as summarized here.
Licensed by DLR and Dynasim under the Modelica License 2
Copyright © 2003-2013, DLR and 2007-2009, Dynasim AB
This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the Modelica license 2, see the license conditions (including the disclaimer of warranty) here or at http://www.Modelica.org/licenses/ModelicaLicense2.
|Examples to demonstrate the usage of the Modelica_StateGraph2 library
|Step (optionally with initial step and/or activePort)
|Transition between steps (optionally with delayed transition and/or condition input port)
|Transition to break loops by introducing an artificial time delay (immediately fire and then wait)
|Composite or parallel step
|Partial compont to construct a parallel submodel via inheritance
|Input/output blocks that are designed for StateGraph2 but shall be included in the Modelica Standard Library
|Internal utility models (should usually not be used by user)