Content area

Abstract

Equation-based object-oriented (EOO) modeling languages such as Modelica provide a convenient, declarative method for describing models of cyber-physical systems. Because of the ease of use of EOO languages, large and complex models can be built with limited effort. However, current state-of-the-art tools do not provide the user with enough information when errors appear or simulation results are wrong. It is of paramount importance that such tools should give the user enough information to correct errors or understand where the problems that lead to wrong simulation results are located. However, understanding the model translation process of an EOO compiler is a daunting task that not only requires knowledge of the numerical algorithms that the tool executes during simulation, but also the complex symbolic transformations being performed.

As part of this work, methods have been developed and explored where the EOO tool, an enhanced Modelica compiler, records the transformations during the translation process in order to provide better diagnostics, explanations, and analysis. This information is used to generate better error-messages during translation. It is also used to provide better debugging for a simulation that produces unexpected results or where numerical methods fail.

Meeting deadlines is particularly important for real-time applications. It is usually essential to identify possible bottlenecks and either simplify the model or give hints to the compiler that enable it to generate faster code. When profiling and measuring execution times of parts of the model the recorded information can also be used to find out why a particular system model executes slowly.

Combined with debugging information, it is possible to find out why this system of equations is slow to solve, which helps understanding what can be done to simplify the model. A tool with a graphical user interface has been developed to make debugging and performance profiling easier. Both debugging and profiling have been combined into a single view so that performance metrics are mapped to equations, which are mapped to debugging information.

The algorithmic part of Modelica was extended with meta-modeling constructs (MetaModelica) for language modeling. In this context a quite general approach to debugging and compilation from (extended) Modelica to C code was developed. That makes it possible to use the same executable format for simulation executables as for compiler bootstrapping when the compiler written in MetaModelica compiles itself.

Finally, a method and tool prototype suitable for speeding up simulations has been developed. It works by partitioning the model at appropriate places and compiling a simulation executable for a suitable parallel platform.

Alternate abstract:

Som ingenjör lär man sig att förstå världen genom ekvationer. För att beskriva eller modellera ett fysikaliskt system, till exempel vid utveckling av en produkt, vill ingenjören använda sig av de ekvationer som han eller hon lärt sig från böcker eller föreläsningar. Vid produkt- utveckling kan ett av målen med modellen vara att hitta de bästa parametrarna för att få den snabbaste, mest hållfasta eller billigaste lösningen.

Man vill således använda en dator för att göra en simulering av modellen, men de instruktioner en dator tar körs i sekvens och gör i grund och botten bara en massa beräkningar och tilldelningar till olika minnespositioner. De klassiska programmeringsparadigmerna, exempelvis imperativ programmering, fungerar på liknande sätt man skriver en algoritm som körs på uppifrån och ner.

Den här avhandlingen fokuserar på ekvationsbaserade program- meringsspråk. I ekvationsbaserade programmeringsspråk, till exem- pel Modelica, översätts ekvationer till imperativ kod, som lätt kan översättas till maskinkod. Detta gör alltså att en ingenjör som är duktig på modellering och ekvationer kan simulera sina modeller på ett effektivt sätt utan att vara datavetare och ha en djup kunskap om programmering. Problemet är att man vid översättning från ek- vationer till maskinkod tappar en massa användbar information.

Om ett fel inträffar vid simulering av modellen så vill man få reda på var felet kommer ifrån. Tidigare har detta varit inte varit möjligt, men i avhandlingen introduceras en metod som sparar tillräckligt med information för att visa vilken ekvation felet inträffade i och alla de symboliska operationer som utförts på ekvationen. Informationen kan

sedan visas i en grafisk debugger.

För att kunna simulera i realtid, till exempel en körsimulator där en människa kör en simulerad bil, så måste datorn kunna lösa ekva- tioner runt 100 gånger i sekunden för att illusionen av att det är en simulering inte ska förstöras. Om ett ekvationssystem är alldeles för detaljerat så tar det för lång tid att köra det. I avhandlingen kom- bineras möjligheten att mäta körtid av ekvationer med den grafiska debuggern. Då ser man inte enbart vilka ekvationer som tar lång tid att köra, utan även varför de tar lång tid att köra. Ekvationerna kan sedan förenklas för att kunna köra simuleringen i realtid.

Details

Title
Tools and Methods for Analysis, Debugging, and Performance Improvement of Equation-Based Models
Author
Sjölund, Martin  VIAFID ORCID Logo 
Publication year
2015
Publisher
ProQuest Dissertations & Theses
ISBN
9798382282015
Source type
Dissertation or Thesis
Language of publication
English
ProQuest document ID
3076842916
Copyright
Database copyright ProQuest LLC; ProQuest does not claim copyright in the individual underlying works.