Wiley-IEEE Press

Home Home About Wiley-IEEE Press Contact Us
Print this page Share

Introduction to Modeling and Simulation of Technical and Physical Systems with Modelica

ISBN: 978-1-118-01068-6
232 pages
September 2011, Wiley-IEEE Press
Introduction to Modeling and Simulation of Technical and Physical Systems with Modelica (111801068X) cover image

Description

Master modeling and simulation using Modelica, the new powerful, highly versatile object-based modeling language

Modelica, the new object-based software/hardware modeling language that is quickly gaining popularity around the world, offers an almost universal approach to high-level computational modeling and simulation. It handles a broad range of application domains, for example mechanics, electrical systems, control, and thermodynamics, and facilitates general notation as well as powerful abstractions and efficient implementations. Using the versatile Modelica language and its associated technology, this text presents an object-oriented, component-based approach that makes it possible for readers to quickly master the basics of computer-supported equation-based object-oriented (EOO) mathematical modeling and simulation.

Throughout the text, Modelica is used to illustrate the various aspects of modeling and simulation. At the same time, a number of key concepts underlying the Modelica language are explained with the use of modeling and simulation examples. This book:

  • Examines basic concepts such as systems, models, and simulations

  • Guides readers through the Modelica language with the aid of several step-by-step examples

  • Introduces the Modelica class concept and its use in graphical and textual modeling

  • Explores modeling methodology for continuous, discrete, and hybrid systems

  • Presents an overview of the Modelica Standard Library and key Modelica model libraries

Readers will find plenty of examples of models that simulate distinct application domains as well as examples that combine several domains. All the examples and exercises in the text are available via DrModelica. This electronic self-teaching program, freely available on the text's companion website, guides readers from simple, introductory examples and exercises to more advanced ones.

Written by the Director of the Open Source Modelica Consortium, Introduction to Modeling and Simulation of Technical and Physical Systems with Modelica is recommended for engineers and students interested in computer-aided design, modeling, simulation, and analysis of technical and natural systems. By building on basic concepts, the text is ideal for students who want to learn modeling, simulation, and object orientation.

See More

Table of Contents

Preface xi

1. Basic Concepts 1

1.1 Systems and Experiments, 2

1.1.1 Natural and Artificial Systems, 3

1.1.2 Experiments, 5

1.2 The Model Concept, 6

1.3 Simulation, 7

1.3.1 Reasons for Simulation, 8

1.3.2 Dangers of Simulation, 9

1.4 Building Models, 10

1.5 Analyzing Models, 12

1.5.1 Sensitivity Analysis, 12

1.5.2 Model-Based Diagnosis, 13

1.5.3 Model Verification and Validation, 13

1.6 Kinds of Mathematical Models, 14

1.6.1 Kinds of Equations, 15

1.6.2 Dynamic Versus Static Models, 16

1.6.3 Continuous-Time Versus Discrete-Time Dynamic Models, 17

1.6.4 Quantitative Versus Qualitative Models, 18

1.7 Using Modeling and Simulation in Product Design, 19

1.8 Examples of System Models, 21

1.9 Summary, 27

1.10 Literature, 27

2. A Quick Tour of Modelica 29

2.1 Getting Started with Modelica, 30

2.1.1 Variables and Predefined Types, 35

2.1.2 Comments, 37

2.1.3 Constants, 38

2.1.4 Variability, 38

2.1.5 Default start Values, 39

2.2 Object-Oriented Mathematical Modeling, 39

2.3 Classes and Instances, 41

2.3.1 Creating Instances, 42

2.3.2 Initialization, 43

2.3.3 Specialized Classes, 44

2.3.4 Reuse of Classes by Modifications, 45

2.3.5 Built-in Classes and Attributes, 46

2.4 Inheritance, 47

2.5 Generic Classes, 48

2.5.1 Class Parameters as Instances, 48

2.5.2 Class Parameters as Types, 50

2.6 Equations, 51

2.6.1 Repetitive Equation Structures, 53

2.6.2 Partial Differential Equations, 54

2.7 Acausal Physical Modeling, 54

2.7.1 Physical Modeling Versus Block-Oriented Modeling, 55

2.8 The Modelica Software Component Model, 57

2.8.1 Components, 58

2.8.2 Connection Diagrams, 58

2.8.3 Connectors and Connector Classes, 60

2.8.4 Connections, 61

2.8.5 Implicit Connections with Inner/Outer, 62

2.8.6 Expandable Connectors for Information Buses, 63

2.8.7 Stream Connectors, 64

2.9 Partial Classes, 65

2.9.1 Reuse of Partial Classes, 66

2.10 Component Library Design and Use, 67

2.11 Example: Electrical Component Library, 67

2.11.1 Resistor, 68

2.11.2 Capacitor, 68

2.11.3 Inductor, 68

2.11.4 Voltage Source, 69

2.11.5 Ground, 70

2.12 Simple Circuit Model, 70

2.13 Arrays, 72

2.14 Algorithmic Constructs, 74

2.14.1 Algorithm Sections and Assignment Statements, 75

2.14.2 Statements, 76

2.14.3 Functions, 77

2.14.4 Operator Overloading and Complex Numbers, 79

2.14.5 External Functions, 81

2.14.6 Algorithms Viewed as Functions, 82

2.15 Discrete Event and Hybrid Modeling, 83

2.16 Packages, 87

2.17 Annotations, 89

2.18 Naming Conventions, 91

2.19 Modelica Standard Libraries, 91

2.20 Implementation and Execution of Modelica, 94

2.20.1 Hand Translation of the Simple Circuit Model, 96

2.20.2 Transformation to State Space Form, 98

2.20.3 Solution Method, 99

2.21 History, 103

2.22 Summary, 107

2.23 Literature, 108

2.24 Exercises, 110

3. Classes and Inheritance 113

3.1 Contract Between Class Designer and User, 113

3.2 A Class Example, 114

3.3 Variables, 115

3.3.1 Duplicate Variable Names, 116

3.3.2 Identical Variable Names and Type Names, 116

3.3.3 Initialization of Variables, 117

3.4 Behavior as Equations, 117

3.5 Access Control, 119

3.6 Simulating the Moon Landing Example, 120

3.7 Inheritance, 123

3.7.1 Inheritance of Equations, 124

3.7.2 Multiple Inheritance, 124

3.7.3 Processing Declaration Elements and Use Before Declare, 126

3.7.4 Declaration Order of extends Clauses, 127

3.7.5 The MoonLanding Example Using Inheritance, 128

3.8 Summary, 130

3.9 Literature, 130

4. System Modeling Methodology 131

4.1 Building System Models, 131

4.1.1 Deductive Modeling Versus Inductive Modeling, 132

4.1.2 Traditional Approach, 133

4.1.3 Object-Oriented Component-Based Approach, 134

4.1.4 Top-Down Versus Bottom-Up Modeling, 136

4.1.5 Simplification of Models, 136

4.2 Modeling a Tank System, 138

4.2.1 Using the Traditional Approach, 138

4.2.2 Using the Object-Oriented Component-Based Approach, 139

4.2.3 Tank System with a Continuous PI Controller, 141

4.2.4 Tank with Continuous PID Controller, 144

4.2.5 Two Tanks Connected Together, 147

4.3 Top-Down Modeling of a DC Motor from Predefined Components, 148

4.3.1 Defining the System, 149

4.3.2 Decomposing into Subsystems and Sketching Communication, 149

4.3.3 Modeling the Subsystems, 150

4.3.4 Modeling Parts in the Subsystems, 151

4.3.5 Defining the Interfaces and Connections, 153

4.4 Designing Interfaces–Connector Classes, 153

4.5 Summary, 155

4.6 Literature, 155

5. The Modelica Standard Library 157

5.1 Summary, 168

5.2 Literature, 168

A. Glossary 169

Literature, 174

B. OpenModelica and OMNotebook Commands 175

B.1 OMNotebook Interactive Electronic Book, 175

B.2 Common Commands and Small Examples, 178

B.3 Complete List of Commands, 179

B.4 OMShell and Dymola, 185

OMShell, 185

Dymola Scripting, 185

Literature, 186

C. Textual Modeling with OMNotebook and DrModelica 187

C.1 HelloWorld, 188

C.2 Try DrModelica with VanDerPol and DAEExample Models, 189

C.3 Simple Equation System, 189

C.4 Hybrid Modeling with BouncingBall, 189

C.5 Hybrid Modeling with Sample, 190

C.6 Functions and Algorithm Sections, 190

C.7 Adding a Connected Component to an Existing Circuit, 190

C.8 Detailed Modeling of an Electric Circuit, 191

C.8.1 Equations, 191

C.8.2 Implementation, 192

C.8.3 Putting the Circuit Together, 195

C.8.4 Simulation of the Circuit, 195

D. Graphical Modeling Exercises 197

D.1 Simple DC Motor, 197

D.2 DC Motor with Spring and Inertia, 198

D.3 DC Motor with Controller, 198

D.4 DC Motor as a Generator, 199

References 201

Index 207

See More

Author Information

Peter Fritzson, PhD, is Professor and Research Director of the Programming Environment Laboratory at Linköping University. Dr. Fritzson is also Director of the Open Source Modelica Consortium, Director of the MODPROD Center for Model-Based Product Development, and Vice Chairman of the Modelica Association, all organizations he helped to establish. Previously, he served as chairman of the Scandinavian Simulation Society, secretary of EuroSim, and a project leader at Sun MicroSystems.
See More

Related Titles

Learn more about