The Modelica_StateGraph2 library (called StateGraph2 below)
is based on the experience with the current
Modelica.StateGraph library (called StateGraph1 below) and is
a significantly further development of StateGraph1. Furthermore, it is heavily
based on the article (Malmheden et. al. 2008), see
literature,
but uses a different implementation
technique as described in this article. The StateGraph2
library has the following improvements with respect to the StateGraph1
library:
- 3 Basic Components (Step, Transition, Parallel)
All multiple versions of a component are
combined in only one version (e.g., one step and not 4 step components).
This is easier to understand and more convenient to use.
The "Parallel" component is both used as "composite step" (so only one branch),
as well as "parallel step" (so several execution branches).
- Conveniently connecting components
Connecting components of a state machine in Modelica means to provide
new vector dimensions and to provide a vector index to connect to.
In StateGraph2, the new "connectorSizing" annotation is used and
therefore all this is now performed automatically (from a users point
of view, these actions are hidden; this is not the case in
StateGraph1 and makes the usage of the StateGraph1 library clumsy).
- Safer state machines
It is no longer possible to construct a wrong state machine in the sense that properties
of the graph are violated (e.g. two initial steps, or branching wrongly out of a parallel
component). Contrary to StateGraph2, in StateGraph1 such wrong graphs do not lead to an
error but to unexpected simulation results. Still, other desirable properties
of a state machine, such as "no deadlock" or "lifeliness" or "every step reachable",
are not (yet) guaranteed with the current StateGraph2.
- Composite, autonomous, synchronized, preempted subgraphs
Composite steps and parallel steps are described in a much better and more powerful
way as in StateGraph1: Either by component "Parallel" or
by inheriting from "PartialParallel". The first alternative has the advantage that it
is simple to use (not necessary to construct a new class and instanciating this class, and
easy variable access since no new hierarchy is constructed), the second alternative
has the advantage that it introduces a Modelica hierarchy (useful for large subgraphs).
In both cases, various options are possible, such as
- autonomous subgraphs (branches are executed in parallel autonomously),
- synchronized subgraphs (branches are executed in parallel and are synchronized
before leaving the subgraph via the outPort),
- subgraphs with preemption and exception (a parallel step can be interrupted via
the suspend ports and can continue execution via the resume ports).
This is achieved by enabling/disabling the different ports.
- No infinite looping:
As in StateGraph1, there are two types of transitions: immediate transitions (during event
iteration all immediate transitions fire until no transition condition is true anymore) and
delayed transitions (a transition fires only after a delay). Contrary to StateGraph1,
in StateGraph2 every loop must have at least one delayed transition. If this is not the case
a translation error occurs which states that the model contains an algebraic loop
between Booleans with the name "checkOneDelayedTransitionPerLoop".
This property guarantees that an event
iteration over a StateGraph2 converges after a
finite number of iterations, provided the modeller does not introduce an unsafe construct
in the actions associated with a StateGraph2 (e.g. "i = pre(i) + 1" in the equation section
outside of a when-clause will give an event iteration that never stops).
It is possible to switch off this feature, by setting parameter
"loopCheck = false" in one transition of a loop, instead of using a "delayed transition"
at this place (in cases where immediate transitions are
important and the transition conditions are in a form that they cannot fire at the
same time instant).
Generated at 2024-12-17T19:26:02Z
by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos