Adrian Pop
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, Linköping, Sweden
Martin Sjölund
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, Linköping, Sweden
Adeel Asghar
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, Linköping, Sweden
Peter Fritzson
Programming Environments Laboratory, Department of Computer and Information Science, Linköping University, Linköping, Sweden
Francesco Casella
Dipartimento di Elettronica e Informazione, Politecnico di Milano, Milano, Italy
Ladda ner artikelhttp://dx.doi.org/10.3384/ecp12076443Ingår i: Proceedings of the 9th International MODELICA Conference; September 3-5; 2012; Munich; Germany
Linköping Electronic Conference Proceedings 76:46, s. 443-454
Publicerad: 2012-11-19
ISBN: 978-91-7519-826-2
ISSN: 1650-3686 (tryckt), 1650-3740 (online)
The high abstraction level of equation-based object-oriented languages (EOO) such as Modelica has the drawback that programming and modeling errors are often hard to find. In this paper we present static and dynamic debugging methods for Modelica models and a debugger prototype that addresses several of those problems. The goal is an integrated debugging framework that combines classical debugging techniques with special techniques for equation-based languages partly based on graph visualization and interaction. The static transformational debugging functionality addresses the problem that model compilers are optimized so heavily that it is hard to tell the origin of an equation during runtime. This work proposes and implements a prototype of a method that is efficient with less than one percent overhead; yet manages to keep track of all the transformations/operations that the compiler performs on the model. Modelica models often contain functions and algorithm sections with algorithmic code. The fraction of algorithmic code is increasing since Modelica; in addition to equation-based modeling; is also used for embedded system control code as well as symbolic model transformations in applications using the MetaModelica language extension. Our earlier work in debuggers for the algorithmic subset of Modelica used high-level code instrumentation techniques which are portable but turned out to have too much overhead for large applications. The new dynamic algorithmic code debugger is the first Modelica debugger that can operate without high-level code instrumentation. Instead; it communicates with a low-level C-language symbolic debugger to directly extract information from a running executable; set and remove breakpoints; etc. This is made possible by the new bootstrapped OpenModelica compiler which keeps track of a detailed mapping from the high level Modelica code down to the generated C code compiled to machine code. The dynamic algorithmic code debugger is operational; supports both standard Modelica data structures and tree/list data structures; and operates efficiently on large applications such as the OpenModelica compiler with more than 100 000 lines of code. Moreover; an integrated debugging approach is proposed that combines static and dynamic debugging.
To our knowledge; this is the first Modelica debugger that supports both transformational and algorithmic code debugging.
Modelica; Debugging; Modeling and Simulation; Transformations; Equations; Algorithmic Code; Eclipse
[1] Adrian Pop and Peter Fritzson (2005). A Portable Debugger for Algorithmic Modelica Code. In Proceedings of the 4th International Modelica Conference; Hamburg; Germany.
[2] Adrian Pop; Peter Fritzson; Andreas Remar; Elmir Jagudin; and David Akhvlediani (2006). OpenModelica Development Environment with Eclipse Integration for Browsing; Modeling; and De-bugging. In Proc of the Modelica’2006; Vienna; Austria.
[3] Adrian Pop; David Akhvlediani; and Peter Fritzson (2007). Towards Run-time Debugging of Equation-based Object-oriented Languages. In Proceedings of the 48th Scandinavian Conference on Simulation and Modeling (SIMS’2007); see http://www.scan-sims.org; http://www.ep.liu.se. Göteborg; Sweden.
[4] Martin Sjölund; Peter Fritzson; and Adrian Pop (2011a). Bootstrapping a Modelica Compiler aiming at Modelica 4. In Proceedings of the 8th Internation-al Modelica Conference (Modelica’2011); Dresden; Germany.
[5] Martin Sjölund and Peter Fritzson (2011b). Debugging Symbolic Transformations in Equation Sys-tems. In Proceedings of the 4th International Work-shop on Equation-Based Object-Oriented Modeling Languages and Tools; (EOOLT’2011); Zürich; Switzerland.
[6] Peter Bunus and Peter Fritzson (2003). Semi-Automatic Fault Localization and Behavior Verification for Physical System Simulation Models. In Proceedings of the 18th IEEE International Conference on Automated Software Engineering; Montreal; Canada.
doi: 10.1109/ASE.2003.1240315.
[7] Peter Bunus (2004). Debugging Techniques for Equation-Based Languages. PhD Thesis. Department of Computer and Information Science; Linköping University.
[8] Peter Fritzson (2004). Principles of Object-Oriented Modeling and Simulation with Modelica 2.1; 940 pp.; ISBN 0-471-471631; Wiley-IEEE Press.
doi: 10.1109/9780470545669.
[9] Peter Fritzson; Peter Aronsson; Håkan Lundvall; Kaj Nyström; Adrian Pop; Levon Saldamli; and David Broman (2005). The OpenModelica Modeling; Simulation; and Software Development Environment. In Simulation News Europe; 44/45.
[10] Richard Stallman; Roland Pesch; Stan Shebs; et al. (2011). Debugging with GDB. Free Software Foundation. [online] Available at: http://unix.lsa.umich.edu/HPC201/refs/gdb.pdf [Accessed 30 October 2011].
[11] Open Source Modelica Consortium. OpenModelica System Documentation Version 1.8.1; April 2012. http://www.openmodelica.org
[12] Modelica Association. The Modelica Language Specification Version 3.2; March 24th 2010. http://www.modelica.org. Modelica Association. Modelica Standard Library 3.1. Aug. 2009. http://www.modelica.org.
[13] Uri Ascher and Linda Petzold. Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations. Society for Industrial and Applied Mathematics; 1998.
doi: 10.1137/1.9781611971392.
[14] Willi Braun; Lennart Ochel; and Bernhard Bach-mann. Symbolically derived Jacobians using automatic differentiation - enhancement of the OpenModelica compiler. In Modelica’2011.
[15] Sven Erik Mattsson and Gustaf Söderlind. Index reduction in differential algebraic equations using dummy derivatives. Siam Journal on Scientific Computing; 14:677-692; May 1993.
doi: 10.1137/0914043.
[16] Conal Elliott. Beautiful differentiation. In International Conference on Functional Programming (ICFP); 2009.
[17] Jens Frenkel; Christian Schubert; Günter Kunze; Peter Fritzson; and Adrian Pop. Towards a benchmark suite for Modelica compilers: Large models. In Modelica’ 2011.
[18] Roberto Parrotto; Johan Åkesson; and Francesco Casella. An XML representation of DAE systems obtained from continuous-time Modelica models. In Proceedings of the 3rd International Workshop on Equation-Based Object-Oriented Modeling Languages and Tools; pages 91-98. Linköping University Electronic Press; October 2010.