Flattening of Modelica State Machines: A Practical Symbolic Representation

Bernhard Thiele
PELAB, Linköping University, Sweden

Adrian Pop
PELAB, Linköping University, Sweden

Peter Fritzson
PELAB, Linköping University, Sweden

Ladda ner artikelhttp://dx.doi.org/10.3384/ecp15118255

Ingår i: Proceedings of the 11th International Modelica Conference, Versailles, France, September 21-23, 2015

Linköping Electronic Conference Proceedings 118:27, s. 255-263

Visa mer +

Publicerad: 2015-09-18

ISBN: 978-91-7685-955-1

ISSN: 1650-3686 (tryckt), 1650-3740 (online)


Modelica 3.3 introduced dedicated built-in language support for state machines that was inspired by semantics known from Statechart and mode automata formalisms. The specification describes the semantics of these constructs in terms of data-flow equations that allows to relate it to the Modelica DAE representation which is the conceptual intermediate format of Modelica code after instance creation (flattening). However, a complete transformation of state machine constructs into data-flow equations at the stage of flattening requires an early commitment to implementation details that potentially hinders model optimizations at subsequent translation phases. Also, due to the required substantial model transformation the semantic distance between the original source model and the flattened representation is rather large. Hence, this paper proposes a more versatile symbolic representation for flattened state machine constructs that preserves the state machine’s composition structure and allows postponing optimizations to subsequent compiler phases.


state machine; mode automata; flattening; compilation


R. Alur, C. Courcoubetis, T. Henzinger, and P. Ho. Hybrid automata: An algorithmic approach to the specification and verification of hybrid systems. Hybrid systems, 736:209–229, 1993.

Marc Bouissou, Hilding Elmqvist, Martin Otter, and Albert Benveniste. Efficient Monte Carlo simulation of stochastic hybrid systems. In Hubertus Tummescheit and Karl-Erik Årzén, editors, 10th Int. Modelica Conference, Lund, Sweden, March 2014. doi: 10.3384/ecp14096715.

Jean-Louis Colaço, Bruno Pagano, and Marc Pouzet. A conservative extension of synchronous data-flow with state machines. In Proceedings of the 5th ACM International Conference on Embedded Software, EMSOFT ’05, pages 173–182, New York, NY, USA, 2005. ACM. ISBN 1-59593-091-4. doi: 10.1145/1086228.1086261.

Hilding Elmqvist, Fabien Gaucher, Sven Erik Mattsson, and Francois Dupont. State Machines in Modelica. In Martin Otter and Dirk Zimmer, editors, 9th Int. Mod- elica Conference, Munich, Germany, September 2012. doi: 10.3384/ecp1207637.

Hilding Elmqvist, Sven Erik Mattsson, and Martin Otter. Modelica extensions for Multi-Mode DAE Systems. In Hubertus Tummescheit and Karl-Erik Årzén, editors, 10th Int. Modelica Conference, Lund, Sweden, May 2014. doi: 10.3384/ECP14096183.

Peter Fritzson. Principles of Object Oriented Modeling and Simulation with Modelica 3.3: A Cyber-Physical Approach. Wiley IEEE Press, 2014. ISBN 9781-118-859124.

David Harel. Statecharts: a visual formalism for complex systems. Science of Computer Programming, 8(3):231–274, 1987. ISSN 0167-6423. doi: 10.1016/0167-6423(87)90035-9.

Florence Maraninchi and Yann Rémond. Mode-Automata: a new domain-specific construct for the development of safe critical systems. Science of Computer Programming, 46:219–254, 2003.

Modelica Association. Modelica – A Unified Object-Oriented Language for Systems Modeling v3.3. Standard Specification, May 2012. Available at http://www.modelica.org/. Marc Pouzet. Lucid Synchrone Tutorial and Reference Manual, 2006.

Paulo Tabuada. Verification and Control of Hybrid Systems A Symbolic Approach. Springer US, 2009. doi: 10.1007/978-1-4419-0224-5.

Bernhard Thiele. State Machines in OpenModelica - Current Status and Further Development. In OpenModelica Annual Workshop, Linköping, Sweden, 2. February 2015.

Open Source Modelica Consortium (OSMC) and Linköping University (LiU). URL http://www.modprod.liu.se/openmodelica-2015?l=en.

Citeringar i Crossref