Modelica.StateGraph

Library of hierarchical state machine components to model discrete event and reactive systems

Information

Note, there is a much improved version of this library called "Modelica_StateGraph2". If this library is not yet distributed with your Modelica tool, you can download it from https://github.com/modelica/Modelica_StateGraph2. In the Users Guide a detailed comparison is given. It is highly recommended to use Modelica_StateGraph2 instead of Modelica.StateGraph.

Library StateGraph is a free Modelica package providing components to model discrete event and reactive systems in a convenient way. It is based on the JGrafchart method and takes advantage of Modelica features for the "action" language. JGrafchart is a further development of Grafcet to include elements of StateCharts that are not present in Grafcet/Sequential Function Charts. Therefore, the StateGraph library has a similar modeling power as StateCharts but avoids some deficiencies of StateCharts.

For an introduction, have especially a look at:

A typical model generated with this library is shown in the next figure where on the left hand side a two-tank system with a tank controller and on the right hand side the top-level part of the tank controller as a StateGraph is shown:

The unique feature of the StateGraph library with respect to JGrafcharts, Grafcet, Sequential Function Charts, and StateCharts, is Modelica's "single assignment rule" that requires that every variable is defined by exactly one equation. This leads to a different "action" definition as in these formalisms. The advantage is that the translator can either determine a useful evaluation sequence by equation sorting or reports an error if this is not possible, e.g., because a model would lead to a non-determinism or to a dead-lock. As a side effect, this leads also to simpler and more easier to understand models and global variables are no longer needed (whereas in JGrafcharts, Grafcet, Sequential Function Charts and StateCharts global variables are nearly always needed).

Copyright © 1998-2020, Modelica Association and contributors

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Modelica.StateGraph.UsersGuide UsersGuide User's Guide of StateGraph Library
Modelica.StateGraph.Examples Examples Examples to demonstrate the usage of the components of the StateGraph library
Modelica.StateGraph.Interfaces Interfaces Connectors and partial models
Modelica.StateGraph.InitialStep InitialStep Initial step (= step that is active when simulation starts)
Modelica.StateGraph.InitialStepWithSignal InitialStepWithSignal Initial step (= step that is active when simulation starts). Connector 'active' is true when the step is active
Modelica.StateGraph.Step Step Ordinary step (= step that is not active when simulation starts)
Modelica.StateGraph.StepWithSignal StepWithSignal Ordinary step (= step that is not active when simulation starts). Connector 'active' is true when the step is active
Modelica.StateGraph.Transition Transition Transition where the fire condition is set by a modification of variable condition
Modelica.StateGraph.TransitionWithSignal TransitionWithSignal Transition where the fire condition is set by a Boolean input signal
Modelica.StateGraph.Alternative Alternative Alternative splitting of execution path (use component between two steps)
Modelica.StateGraph.Parallel Parallel Parallel splitting of execution path (use component between two transitions)
Modelica.StateGraph.PartialCompositeStep PartialCompositeStep Superclass of a subgraph, i.e., a composite step that has internally a StateGraph
Modelica.StateGraph.StateGraphRoot StateGraphRoot Root of a StateGraph (has to be present on the highest level of a StateGraph)

Modelica.StateGraph.InitialStep Modelica.StateGraph.InitialStep

Initial step (= step that is active when simulation starts)

Information

Extends from Interfaces.PartialStep (Partial step with one input and one output transition port).

Connectors

NameDescription
inPort[nIn]Vector of step input connectors
outPort[nOut]Vector of step output connectors

Modelica.StateGraph.InitialStepWithSignal Modelica.StateGraph.InitialStepWithSignal

Initial step (= step that is active when simulation starts). Connector 'active' is true when the step is active

Information

Extends from Interfaces.PartialStep (Partial step with one input and one output transition port).

Connectors

NameDescription
inPort[nIn]Vector of step input connectors
outPort[nOut]Vector of step output connectors
active 

Modelica.StateGraph.Step Modelica.StateGraph.Step

Ordinary step (= step that is not active when simulation starts)

Information

Extends from Interfaces.PartialStep (Partial step with one input and one output transition port).

Connectors

NameDescription
inPort[nIn]Vector of step input connectors
outPort[nOut]Vector of step output connectors

Modelica.StateGraph.StepWithSignal Modelica.StateGraph.StepWithSignal

Ordinary step (= step that is not active when simulation starts). Connector 'active' is true when the step is active

Information

Extends from Interfaces.PartialStep (Partial step with one input and one output transition port).

Connectors

NameDescription
inPort[nIn]Vector of step input connectors
outPort[nOut]Vector of step output connectors
active 

Modelica.StateGraph.Transition Modelica.StateGraph.Transition

Transition where the fire condition is set by a modification of variable condition

Information

Extends from Interfaces.PartialTransition (Partial transition with input and output connections).

Parameters

NameDescription
Fire condition
condition= true, if transition may fire (time varying expression)
Custom Parameters
localCondition= true, if transition may fire
Timer
enableTimer= true, if timer is enabled
waitTimeWait time before transition fires [s]

Connectors

NameDescription
inPortVector of transition input connectors
outPortVector of transition output connectors

Modelica.StateGraph.TransitionWithSignal Modelica.StateGraph.TransitionWithSignal

Transition where the fire condition is set by a Boolean input signal

Information

Extends from Interfaces.PartialTransition (Partial transition with input and output connections).

Parameters

NameDescription
Custom Parameters
localCondition= true, if transition may fire
Timer
enableTimer= true, if timer is enabled
waitTimeWait time before transition fires [s]

Connectors

NameDescription
condition 
inPortVector of transition input connectors
outPortVector of transition output connectors

Modelica.StateGraph.Alternative Modelica.StateGraph.Alternative

Alternative splitting of execution path (use component between two steps)

Parameters

NameDescription
nBranchesNumber of alternative branches

Connectors

NameDescription
inPort 
outPort 
join[nBranches] 
split[nBranches] 

Modelica.StateGraph.Parallel Modelica.StateGraph.Parallel

Parallel splitting of execution path (use component between two transitions)

Parameters

NameDescription
nBranchesNumber of parallel branches that are executed in parallel

Connectors

NameDescription
inPort 
outPort 
join[nBranches] 
split[nBranches] 

Modelica.StateGraph.PartialCompositeStep Modelica.StateGraph.PartialCompositeStep

Superclass of a subgraph, i.e., a composite step that has internally a StateGraph

Parameters

NameDescription
Exception connections
nSuspendNumber of suspend ports
nResumeNumber of resume ports

Connectors

NameDescription
inPort 
outPort 
suspend[nSuspend] 
resume[nResume] 

Modelica.StateGraph.StateGraphRoot Modelica.StateGraph.StateGraphRoot

Root of a StateGraph (has to be present on the highest level of a StateGraph)

Information

On the highest level of a StateGraph, an instance of StateGraphRoot has to be present.

The StateGraphRoot object is needed, since all Step objects have an "outer" reference to communicate with the "nearest" CompositeStep (which inherits from PartialCompositeStep), especially to abort a CompositeStep via the "suspend" port. Even if no "CompositeStep" is present, on highest level a corresponding "inner" definition is needed and is provided by the StateGraphRoot object.

Extends from StateGraph.Interfaces.CompositeStepState (Communication channel between CompositeSteps and steps in the CompositeStep).

Connectors

NameDescription
subgraphStatePort 
Automatically generated Thu Oct 1 16:07:37 2020.