Integrated Model-driven Development Environments for Equation-based Object-oriented Languages

НазваниеIntegrated Model-driven Development Environments for Equation-based Object-oriented Languages
Размер0.98 Mb.
  1   2   3   4   5   6   7   8   9   ...   55

Integrated Model-driven Development Environments
Equation-based Object-oriented Languages


Adrian Pop

June 2008

ISBN 978-91-7393-895-2

Thesis No. 1183

ISSN 0345-7524


Integrated development environments are essential for efficient realization of complex industrial products, typically consisting of both software and hardware components. Powerful equation-based object-oriented (EOO) languages such as Modelica are successfully used for modeling and virtual prototyping increasingly complex physical systems and components, whereas software modeling approaches like UML, especially in the form of domain specific language subsets, are increasingly used for software systems modeling.

A research hypothesis investigated to some extent in this thesis is if EOO languages can be successfully generalized also to support software modeling, thus addressing whole product modeling, and if integrated environments for such a generalized EOO language tool support can be created and effectively used on real-sized applications.

However, creating advanced development environments is still a resource-consuming error-prone process that is largely manual. One rather successful approach is to have a general framework kernel, and use meta-modeling and meta-programming techniques to provide tool support for specific languages. Thus, the main goal of this research is the development of a meta-modeling approach and its associated meta-programming methods for the synthesis of model-driven product development environments that includes support for modeling and simulation. Such environments include components like model editors, compilers, debuggers and simulators. This thesis presents several contributions towards this vision in the context of EOO languages, primarily the Modelica language.

Existing state-of-the art tools supporting EOO languages typically do not satisfy all user requirements with regards to analysis, management, querying, transformation, and configuration of models. Moreover, tools such as model-compilers tend to become large and monolithic. If instead it would be possible to model desired tool extensions with meta-modeling and meta-programming, within the application models themselves, the kernel tool could be made smaller, and better extensibility, modularity and flexibility could be achieved.

We argue that such user requirements could be satisfied if the equation-based object-oriented languages are extended with meta-modeling and meta-programming. This thesis presents a new language that unifies EOO languages with term pattern matching and transformation typically found in functional and logic programming languages. The development, implementation, and performance of the unified language are also presented.

The increased ease of use, the high abstraction, and the expressivity of the unified language are very attractive properties. However, these properties come with the drawback that programming and modeling errors are often hard to find. To overcome these issues, several methods and integrated frameworks for run-time debugging of the unified language have been designed, analyzed, implemented, and evaluated on non-trivial industrial applications.

To fully support development using the unified language, an integrated model-driven development environment based on the Eclipse platform is proposed, designed, implemented, and used extensively. The development environment integrates advanced textual modeling, code browsing, debugging, etc. Graphical modeling is also supported by the development environment based on a proposed ModelicaML Modelica/UML/SysML profile. Finally, serialization, composition, and transformation operations on models are investigated.

This work has been supported by the National Computer Science Graduate School (CUGS), the ProViking Graduate School, the Swedish Foundation for Strategic Research (SSF) financed research on Integrational Software Engineering (RISE), VISIMOD and Engineering and Computational Design (SECD) projects; the Vinnova financed Semantic Web for Products (SWEBPROD) and Safe and Secure Modeling and Simulation projects. Also, we acknowledge the cooperation with Reasoning on the Web with Rules and Semantics (REWERSE) "Network of Excellence" (NoE) funded by the EU Commission and Switzerland within the "6th Framework Programme" (FP6), Information Society Technologies (IST). We also acknowledge support from the Swedish Science Council (VR) in the project on High-Level Debugging of Equation-Based System Modeling & Simulation Languages and from MathCore Engineering AB.


A thesis cannot be finished; it has to be abandoned.
Finally, the deadline for this thesis has come!

I would like to thank the following people and organizations (in no particular order or classification) which were important to me:

  • Supervisors (Peter Fritzson, Uwe Aßmann).

  • Opponent (Hans Vangheluwe) and Committee (Görel Hedin, Petter Krus, Tommi Karhela)

  • PELAB (Bodil Mattsson Kihlström, Kristian Sandahl, Christoph Kessler, Mariam Kamkar, Mikhail Chalabine, Olof Johansson, David Broman, Kristian Stavåker, Håkan Lundval, Andreas Borg, Emma Larsdotter Nilsson, Mattias Eriksson, Levon Saldalmli, Kaj Nyström, Martin Fransson, Anders Sandholm, Andrzej Bednarski, John Wilander, Jon Edvardsson, Jesper Andersson, Mikael Pettersson, etc.).

  • Master thesis students: Simon Björklén, Emil Carlsson, Dynamic Loading Team (Kim Jansson, Joel Klinghed), Refactoring Team (Kristoffer Norling, Mikael Blom), MDT Team (Elmir Jagudin, Andreas Remar, David Akhvlediani, Vasile Băluţă), OMNotebook Team (Ingemar Axelsson, Anders Fernström, Henrik Eriksson, Henrik Magnusson).

  • MathCore (Katalin Bunuş, Peter Aronsson, Lucian Popescu, Daniel Hedberg, Björn Zachrisson, Vadim Engelson, Jan Brugård, etc.).

  • IDA (Lillemor Wallgren, Inger Emanuelsson, Petru Eleş, Gunilla Mellheden, Britt-Inger Karlsson, Inger Norén, etc.), DIG (Lisbeth Linge, Tommy Olsson, Henrik Edlund, Andreas Lange), TUS, ESLAB.

  • Family (Flore, ŢiŢi, Paul & Liana, Teodor & Letiţia, …) and Friends (Peter & Katalin Bunuş, Sorin Manolache, Călin Curescu & Njideka Andreea Udechukwu, Traian & Ruxandra Pop, Alexandru Andrei & Diana Szentiványi, Claudiu & Aurelia Duma, Ioan & Simona Chisaliţa, Şerban Stelian, Cristian & Cristina Tomoiagă, Adrian & Simona Ponoran, Dicu Ştefan, Ioan & Adela Pleşa, Andreea & Sorin Marian, Horia Bochiş, Ilie Savga, and many more).

  • Thesis reviewers (Peter Fritzson, Hans Vangheluwe, Görel Hedin, Petter Krus, Tommi Karhela, Jörn Guy Süß, Kristian Stavåker, Paul Pop)

  • All others that I might forgot to mention.

Adrian Pop

Linköping, June 5, 2008

Table of Contents

Part I

Motivation, Introduction, Background and Related Work 1

Chapter 1

Introduction 3

1.1Research Objective (Motivation) 4

1.2Contributions 5

1.3Thesis Structure 6

1.4Publications 8

Chapter 2

Background and Related Work 11

2.1Introduction 11

2.1.1Systems, Models, Meta-Models, and Meta-Programs 11

2.1.2Meta-Modeling and Meta-Programming Approaches 12

2.2The Modelica Language 14

2.2.1An Example Modelica Model 17

2.2.2Modelica as a Component Language 18

2.3Modelica Environments 19

2.3.1OpenModelica 19

2.3.2MathModelica, Dymola, SimulationX 21

2.4Related Equation-based languages: gProms, VHDL-AMS and the χ language 24

2.5Natural Semantics and the Relational Meta-Language (RML) 25

2.5.1An Example of Natural Semantics and RML 26

2.5.2Specification of Syntax 28

2.5.3Integrated Environment for RML 28

2.6The eXtensible Markup Language (XML) 29

2.7System Modeling Language (SysML) 31

2.7.1SysML Block Definitions 33

2.8Component Models for Invasive Software Composition 33

2.9Integrated Product Design and Development 36

Part II

Extending EOO Languages for Safe Symbolic Processing 39

Chapter 3

Extending Equation-Based Object-Oriented Languages 41

3.1Introduction 41

3.1.1Evaluator for the Exp1 Language in the Unified Language 43

3.1.2Examples of Pattern Matching 44

3.1.3Language Design 47

3.2Equations 48

3.2.1Mathematical Equations 48

3.2.2Conditional Equations and Events 48

3.2.3Single-Assignment Equations 49

3.2.4Pattern Equations in Match Expressions 49

3.3High-level Data Structures 51

3.3.1Union-types 51

3.3.2Lists, Tuples and Option Types 52

3.4Solution of Equations 53

3.5Pattern Matching 54

3.5.1Syntax 55

3.5.2Semantics 56

3.5.3Discussion on Type Systems 57

3.6Exception Handling 58

3.6.1Applications of Exceptions 59

3.6.2Exception Handling Syntax and Semantics 60

3.6.3Exception Values 64

3.6.4Typing Exceptions 67

3.6.5Further Discussion 68

3.7Related Work 69

3.8Conclusions and Future Work 69

Chapter 4

Efficient Implementation of Meta-Programming EOO Languages 71

4.1Introduction 71

4.2MetaModelica Compiler Prototype 71

4.2.1Performance Evaluation of the MetaModelica Compiler Prototype 72

4.3OpenModelica Bootstrapping 74

4.3.1OpenModelica Compiler Overview 74

4.4High-level Data Structures Implementation 77

4.5Pattern Matching Implementation 79

4.5.1Implementation Details 80

4.6Exception Handling Implementation 86

4.6.1Translation of Exception Values 88

4.6.2Translation of Exception Handling 90

4.7Garbage Collection 91

4.7.1 Layout of Data in Memory 92

4.7.2Performance Measurements 93

4.8Conclusions 95

Part III

Debugging of Equation-based Object Oriented Languages

Chapter 5

Portable Debugging of EOO Meta-Programs 99

5.1Introduction 99

5.2Debugging Method – Code Instrumentation 99

5.2.1Early Instrumentation 101

5.2.2Late Instrumentation 101

5.3Type Reconstruction 101

5.4Performance Evaluation 102

5.4.1The Test Machine 102

5.4.2The Test Files 103

5.4.3Compilation Performance 104

5.4.4Run-time Performance 104

5.5Tracing and Profiling 105

5.5.1Tracing 105

5.5.2Profiling 106

5.6The Eclipse-based Debugging Environment 106

5.6.1Starting the Modelica Debugging Perspective 107

5.6.2Setting the Debug Configuration 108

5.6.3Setting/Deleting Breakpoints 110

5.6.4The Debugging Session and the Debug Perspective 110

5.7Conclusions 112

Chapter 6

Run-time Debugging of EOO Languages 115

6.1Introduction 115

6.2Debugging Techniques for EOO Languages 115

6.3Proposed Debugging Method 116

6.3.1Run-time Debugging Method 117

6.4The Run-time Debugging Framework 119

6.4.1Translation in the Debugging Framework 119

6.4.2Debugging Framework Overview 122

6.4.3Debugging Framework Components 122

6.4.4Implementation Status 123

6.5Conclusions and Future Work 124

Chapter 7

Debugging Natural Semantics Specifications 125

7.1Introduction 125

7.2Related Work 126

7.3The rml2c Compiler and the Runtime System 126

7.4Debugger Design and Implementation 128

7.5Overview of the RML Integrated Environment 129

7.6Design Decisions 130

7.6.1Debugging Instrumentation 130

7.6.2External Program Database 130

7.6.3External Data Value Browser 130

7.6.4Why not an Interpreter? 131

7.7Instrumentation Function 131

7.8Type Reconstruction in the Runtime System 132

7.9Debugger Implementation 133

7.9.1The rml2c Compiler Addition 133

7.9.2The Debugging Runtime System 133

7.9.3The Data Value Browser 134

7.9.4 The Post-Mortem Analysis Tool 134

7.10Debugger Functionality 134

7.10.1Starting the RML Debugging Subprocess 135

7.10.2Setting/Deleting Breakpoints 136

7.10.3Stepping and Running 137

7.10.4Examining Data 137

7.10.5Additional Commands 140

7.11The Data Value Browser 140

7.12The Post-Mortem Analysis Tool 142

7.13Performance Evaluation 143

7.13.1Code Growth 143

7.13.2The Execution Time 144

7.13.3Stack Consumption 144

7.13.4Number of Relation Calls 145

7.14Conclusions and Future Work 145

Part IV

Advanced Integrated Environments 147

Chapter 8

Modelica Development Tooling (MDT) 149

8.1Introduction 149

8.1.1Integrated Interactive Programming Environments 149

8.1.2The Eclipse Framework 151

8.1.3Eclipse Platform Architecture 151

8.1.4OpenModelica MDT Eclipse Plugin 152

8.2OpenModelica Environment Architecture 153

8.3Modelica Development Tooling (MDT) Eclipse Plugin 154

8.3.1Using the Modelica Perspective 155

8.3.2Creating a Project 155

8.3.3Creating a Package 155

8.3.4Creating a Class 155

8.3.5Syntax Checking 157

8.3.6Code Completion 157

8.3.7Automatic Indentation 158

8.4The OpenModelica Debugger Integrated in Eclipse 160

8.5Simulation and Plotting from MDT 160

8.6Conclusions 161

Chapter 9

Parsing-Unparsing and Refactoring 163

9.1Introduction 163

9.2Comments and Indentation 164

9.3Refactorings 164

9.3.1The Principle of Minimal Replacement 164

9.3.2Some Examples of Refactorings 165

9.3.3Representing Comments and User-Defined Indentation 165

9.4Implementation 166

9.4.1Base Program representation 167

9.4.2The Parser 167

9.4.3The Scanner 167

9.4.4The New Unparser 167

9.5Refactoring Process 168

9.5.1Example of Function Name Refactoring 168

9.5.2Calculation of the Additional Overhead 171

9.5.3Unparsers/Prettyprinters versus Indenters 171

9.6Further Discussion 173

9.7Related Work 174

9.8Conclusions 175

9.9Appendix 175

Chapter 10

UML and Modelica System Modeling with ModelicaML 179

10.1Introduction 179

10.2SysML vs. Modelica 180

10.3ModelicaML: a UML profile for Modelica 181

10.3.1Modelica Class Diagrams 182

10.4The ModelicaML Integrated Design Environment 188

10.4.1Integrated Design and Development Environment 189

10.4.2The ModelicaML GMF Model 190

10.4.3Modeling with Requirements 192

10.5Representing Requirements in Modelica 193

10.5.1Using Modelica Annotations 193

10.5.2Creating a new Restricted Class: requirement 193

10.6Conclusion and Future Work 194

10.7Appendix 195

Chapter 11

An Integrated Framework for Model-driven Product Design and Development Using Modelica 197

11.1Introduction 197

11.2Architecture overview 199

11.3Detailed framework description 200

11.3.1ModelicaXML 200

11.3.2Modelica Database (ModelicaDB) 201

11.3.3FMDesign 202

11.3.4The Selection and Configuration Tool 203

11.3.5The Automatic Model Generator Tool 204

11.4Conclusions and Future Work 204

11.5Appendix 206

Part V

Meta-programming and Composition of EOO Languages 209

Chapter 12

ModelicaXML: A ModelicaXML Representation with Applications 211

12.1Introduction 211

12.2Related Work 213

12.3Modelica XML Representation 213

12.3.1ModelicaXML Example 213

12.3.2ModelicaXML Schema (DTD/XML-Schema) 216

12.4ModelicaXML and XML Tools 221

12.4.1The Stylesheet Language for Transformation (XSLT) 221

12.4.2The Query Language for XML (XQuery) 223

12.4.3Document Object Model (DOM) 224

12.5Towards an Ontology for the Modelica Language 224

12.5.1The Semantic Web Languages 225

12.5.2The roadmap to a Modelica representation using Semantic Web Languages 228

12.6Conclusions and Future work 229

Chapter 13

Composition of XML dialects: A ModelicaXML case study 231

13.1Introduction 231

13.2Background 232

13.2.1Modelica and ModelicaXML 232

13.2.2The Compost Framework 234

13.3COMPOST extension for Modelica 237

13.3.1Overview 237

13.3.2Modelica Box Hierarchy 238

13.3.3Modelica Hook Hierarchy 239

13.3.4Examples of Composition and Transformation Programs 241

13.4Conclusions and Future work 244

13.5Appendix 244

Part VI

Conclusions and Future Work 247

Chapter 14

Conclusions and Future Work 249

14.1Conclusions 249

14.2Future Work Directions 250

Bibliography 253

Table of Figures

Figure 1 1. Thesis structure. 7

Figure 2 2. The Object Management Group (OMG) 4-Layered
Model Driven Architecture (MDA). 13

Figure 2 3. Meta-Modeling and Meta-Programming dimensions. 14

Figure 2 4. Hierarchical model of an industrial robot, including components such as motors, bearings, control software, etc. At the lowest (class) level, equations are typically found. 17

Figure 2 5. Number of rabbits – prey animals, and foxes – predators, as a function of time simulated from the predator-prey LotkaVolterra model. 17

Figure 2 6. Connecting two components that have electrical pins. 18

Figure 2 7. OMShell 20

Figure 2 8. OMNotebook 20

Figure 2 9. Modelica Development Tooling (MDT). 21

Figure 2 10. MathModelica modeling and simulation environment. (courtesy of MathCore AB) 22

Figure 2 11. Dymola Modeling and Simulation Environment
(courtesy of Dynasim AB). 23

Figure 2 12. SimulationX modeling and simulation environment
(courtesy of ITI GmbH) 23

Figure 2 13. SOSDT Eclipse Plugin for RML Development. 28

Figure 2 14. SysML diagram taxonomy. 31

Figure 2 15. SysML block definitions. 32

Figure 2 16. Black-box vs. Gray-box (invasive) composition. Instead of
generating glue code, composers invasively change the components. 34

Figure 2 17. Invasive composition applied to hooks result
in transformation of the underlying abstract syntax tree. 35

Figure 2 18. Integrated model-driven product design and development framework. 36

Figure 3 19. A discrete-time variable z changes value only at event instants, whereas continuous-time variables like y may change both between and at events. 49

Figure 3 20. Abstract syntax tree of the expression 12+5*13 51

Figure 4 21. MetaModelica Compiler Prototype – compilation phases. 72

Figure 4 22. The stages of translation and execution of a MetaModelica model. 75

Figure 4 23. OpenModelica compiler packages and their connection. 76

Figure 4 24. Pattern Matching Translation Strategy. 81

Figure 4 25. Code Example Generated DFA. 84

Figure 4 26. Exception handling translation strategy. 87

Figure 4 27. OpenModelica implementation. 88

Figure 4 28. Garbage Collection time (s) vs. Execution time (s) 92

Figure 4 29. Garbage Collection time (s). 93

Figure 5 30. Early vs. Late Debugging Instrumentation in MetaModelica compiler. 100

Figure 5 31. Variable value display during debugging using type reconstruction. 102

Figure 5 32. Advanced debugging functionality in MDT. 107

Figure 5 33. Accessing the debug configuration dialog. 108

Figure 5 34. Creating the Debug Configuration. 109

Figure 5 35. Specifying the executable to be run in debug mode. 109

Figure 5 36. Setting/deleting breakpoints. 110

Figure 5 37. Starting the debugging session. 110

Figure 5 38. Eclipse will ask if the user wants to switch to the debugging perspective. 111

Figure 5 39. The debugging perspective. 112

Figure 5 40. Switching between perspectives. 112

Figure 6 41. Debugging approach overview. 117

Figure 6 42. Translation stages from Modelica code to executing simulation. 119

Figure 6 43. Translation stages from Modelica code to executing simulation with additional debugging steps. 121

Figure 6 44. Run-time debugging framework overview. 122

Figure 7 45. The rml2c compiler phases. 127

Figure 7 46. Tool coupling within the RML integrated environment with debugging. 129

Figure 7 47. Using breakpoints. 135

Figure 7 48. Stepping and running. 136

Figure 7 49. Examining data. 138

Figure 7 50. Additional debugging commands. 139

Figure 7 51. Browser for variable values showing the current
execution point (bottom) and the variable value (top). 141

Figure 7 52. When datatype constructors are selected, the bottom part presents
their source code definitions for easy understanding of the displayed values. 142

Figure 8 53. The architecture of Eclipse, with possible plugin positions marked. 152

Figure 8 54. The architecture of the OpenModelica environment. 153

Figure 8 55. The client-server architecture of the OpenModelica environment. 154

Figure 8 56. Creating a new package. 155

Figure 8 57. Creating a new class. 156

Figure 8 58. Syntax checking. 156

Figure 8 59. Code completion using a popup menu after a dot 157

Figure 8 60. Code completion showing a popup function signature after typing a left parenthesis. 158

Figure 8 61. Example of code before indentation. 158

Figure 8 62. Example of code after automatic indentation. 159

Figure 8 63. Plot of the Influenza model. 161

Figure 9 64. AST of the file. 169

Figure 9 65. Syntax checking. 173

Figure 10 66. ModelicaML diagrams overview. 181

Figure 10 67. ModelicaML class definitions. 183

Figure 10 68. ModelicaML Internal Class vs. Modelica Connection Diagram. 184

Figure 10 69. Package hierarchy modeling. 185

Figure 10 70. Equation modeling example with a Modelica Class Diagram. 186

Figure 10 71. Simulation diagram example. 187

Figure 10 72. ModelicaML Eclipse based design environment with a Class diagram. 190

Figure 10 73. ModelicaML GMF Model (Requirements) 191

Figure 10 74. Modeling with Requirement Diagrams. 192

Figure 10 75. Modeling with requirements (Requirements palette). 195

Figure 10 76. Modeling with requirements (Connections). 196

Figure 11 77. Design framework for product development. 199

Figure 11 78. Modelica and the corresponding ModelicaXML representation. 201

Figure 11 79. FMDesign – a tool for conceptual design of products. 202

Figure 11 80. FMDesign information model. 206

Figure 11 81. ModelicaDB meta-model. 207

Figure 12 82. The program (root) element of the ModelicaXML Schema. 217

Figure 12 83. The definition element from the ModelicaXML Schema. 218

Figure 12 84. The component element from the ModelicaXML Schema. 218

Figure 12 85. The equation element from the ModelicaXML Schema. 219

Figure 12 86. The algorithm element from the ModelicaXML Schema. 220

Figure 12 87. The expressions from ModelicaXML schema. 221

Figure 12 88. The Semantic Web Layers. 224

Figure 13 89. The layers of COMPOST. 235

Figure 13 90. The XML composition. System Architecture Overview. 238

Figure 13 91. The Modelica Box Hierarchy defines
a set of templates for each language structure. 239

Figure 13 92. The Modelica Hook Hierarchy. 240

Index of tables

Table 4 1. Execution time in seconds. The – sign represents out of memory. 73

Table 4 2. Garbage Collection Performance. 94

Table 5 3. Compilation performance (no debugging vs. early vs. late instrumentation) 104

Table 5 4. Running performance of script RRLargeModel2.mos. 105

Table 5 5. Running performance of script BouncingBall.mos. 105

Table 5 6. The impact of tracing on execution time. 105

Table 7 7. RML premise types. These constructs are swept for
variables to be registered with the debugging runtime system. 131

Table 7 8. Size (#lines) without and with instrumentation. 144

Table 7 9. Running time without and with debugging. 144

Table 7 10. Used stack without and with debugging. 144

Table 7 11. Number of performed relation calls. 145
  1   2   3   4   5   6   7   8   9   ...   55


Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconThe Domain Analysis Integrated in an Object Oriented Development Methodology

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconHypergraph-based Object-oriented Model for gis application

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconObject-Oriented Object-Oriented Languages

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconApplying uml and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconModel Development of a Total Integrated Maintenance System

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconAn integrated framework for model-based flow assurance in deep-water oil and gas production

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconThis paper introduces the basic concepts of Agile Database Techniques, and effective ways to go about the Data-Oriented aspects of Object Oriented software

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconObject-Oriented Metrics: an Annotated Bibliography

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconAn Introduction and Brief Examination of Object-Oriented Data Modeling

Integrated Model-driven Development Environments for Equation-based Object-oriented Languages iconAn Object-Oriented Support Tool for the Design of Casting Procedures

Разместите кнопку на своём сайте:

База данных защищена авторским правом © 2014
обратиться к администрации
Главная страница