Pub. Date:
Principles of Object-Oriented Modeling and Simulation with Modelica 2.1 / Edition 1

Principles of Object-Oriented Modeling and Simulation with Modelica 2.1 / Edition 1

by Peter Fritzson


Current price is , Original price is $134.0. You

Temporarily Out of Stock Online

Please check back later for updated availability.

This item is available online through Marketplace sellers.

Product Details

ISBN-13: 9780471471639
Publisher: Wiley
Publication date: 01/09/2004
Pages: 944
Product dimensions: 6.99(w) x 10.00(h) x 1.89(d)

About the Author

PETER FRITZSON, PhD, is a professor and Director of the Programming Environment Laboratory (PELAB) at the Department of Computer and Information Science, Linköping University, Sweden. He currently holds the positions of president of MathCore Engineering AB; chairman of the Scandinavian Simulation Society; secretary of the European simulation organization, EuroSim; and vice chairman of the Modelica Association, an organization he helped to establish. Professor Fritzson has published ten books and over a hundred scientific papers.

Read an Excerpt

Principles of Object-Oriented Modeling and Simulation with Modelica 2.1

By Peter Fritzson

John Wiley & Sons

ISBN: 0-471-47163-1

Chapter One

Introduction to Modeling and Simulation

It is often said that computers are revolutionizing science and engineering. By using computers we are able to construct complex engineering designs such as space shuttles. We are able to compute the properties of the universe as it was fractions of a second after the big bang. Our ambitions are ever-increasing. We want to create even more complex designs such as better spaceships, cars, medicines, computerized cellular phone systems, etc. We want to understand deeper aspects of nature. These are just a few examples of computer-supported modeling and simulation. More powerful tools and concepts are needed to help us handle this increasing complexity, which is precisely what this book is about.

This text presents an object-oriented component-based approach to computer-supported mathematical modeling and simulation through the powerful Modelica language and its associated technology. Modelica can be viewed as an almost-universal approach to high-level computational modeling and simulation, by being able to represent a range of application areas and providing general notation as well as powerful abstractions and efficient implementations. The introductory part of this book consisting of the first two chapters gives a quick overview of the two main topics of this text:

Modeling and simulation.

The Modelica language.

The two subjects are presented together since they belong together. Throughout the text Modelica is used as a vehicle for explaining different aspects of modeling and simulation. Conversely, a number of concepts in the Modelica language are presented by modeling and simulation examples. This first chapter introduces basic concepts such as system, model, and simulation. The second chapter gives a quick tour of the Modelica language as well as a number of examples, interspersed with presentations of topics such as object-oriented mathematical modeling, declarative formalisms, methods for compilation of equation-based models, etc.

Subsequent chapters contain detailed presentations of object-oriented modeling principles and specific Modelica features, introductions of modeling methodology for continuous, discrete, and hybrid systems, as well as a thorough overview of a number of currently available Modelica model libraries for a range of application domains. Finally, in the last chapter, a few of the currently available Modelica environments are presented.

1.1 Systems and Experiments

What is a system? We have already mentioned some systems such as the universe, a space shuttle, etc. A system can be almost anything. A system can contain subsystems which are themselves systems. A possible definition of system might be:

A system is an object or collection of objects whose properties we want to study.

Our wish to study selected properties of objects is central in this definition. The "study" aspect is fine despite the fact that it is subjective. The selection and definition of what constitutes a system is somewhat arbitrary and must be guided by what the system is to be used for.

What reasons can there be to study a system? There are many answers to this question but we can discern two major motivations:

Study a system to understand it in order to build it. This is the engineering point of view.

Satisfy human curiosity, e.g. to understand more about nature-the natural science viewpoint.

1.1.1 Natural and Artificial Systems

A system according to our previous definition can occur naturally, e.g. the universe, it can be artificial such as a space shuttle, or a mix of both. For example, the house in Figure 1-1 with solar-heated tap warm water is an artificial system, i.e., manufactured by humans. If we also include the sun and clouds in the system it becomes a combination of natural and artificial components.

Even if a system occurs naturally its definition is always highly selective. This is made very apparent in the following quote from Ross Ashby [Ashby-56]:

At this point, we must be clear about how a system is to be defined. Our first impulse is to point at the pendulum and to say "the system is that thing there." This method, however, has a fundamental disadvantage: every material object contains no less than an infinity of variables, and therefore, of possible systems. The real pendulum, for instance, has not only length and position; it has also mass, temperature, electric conductivity, crystalline structure, chemical impurities, some radioactivity, velocity, reflecting power, tensile strength, a surface film of moisture, bacterial contamination, an optical absorption, elasticity, shape, specific gravity, and so on and on. Any suggestion that we should study all the facts is unrealistic, and actually the attempt is never made. What is necessary is that we should pick out and study the facts that are relevant to some main interest that is already given.

Even if the system is completely artificial, such as the cellular phone system depicted in Figure 1-2, we must be highly selective in its definition depending on what aspects we want to study for the moment.

An important property of systems is that they should be observable. Some systems, but not large natural systems like the universe, are also controllable in the sense that we can influence their behavior through inputs, i.e.:

The inputs of a system are variables of the environment that influence the behavior of the system. These inputs may or may not be controllable by us. The outputs of a system are variables that are determined by the system and may influence the surrounding environment.

In many systems the same variables act as both inputs and outputs. We talk about acausal behavior if the relationships or influences between variables do not have a causal direction, which is the case for relationships described by equations. For example, in a mechanical system the forces from the environment influence the displacement of an object, but on the other hand the displacement of the object influences the forces between the object and environment. What is input and what is output in this case is primarily a choice by the observer, guided by what is interesting to study, rather than a property of the system itself.

1.1.2 Experiments

Observability is essential in order to study a system according to our definition of system. We must at least be able to observe some outputs of a system. We can learn even more if it is possible to exercise a system by controlling its inputs. This process is called experimentation, i.e.:

An experiment is the process of extracting information from a system by exercising its inputs.

To perform an experiment on a system it must be both controllable and observable. We apply a set of external conditions to the accessible inputs and observe the reaction of the system by measuring the accessible outputs.

One of the disadvantages of the experimental method is that for a large number of systems many inputs are not accessible and controllable. These systems are under the influence of inaccessible inputs, sometimes called disturbance inputs. Likewise, it is often the case that many really useful possible outputs are not accessible for measurements; these are sometimes called internal states of the system. There are also a number of practical problems associated with performing an experiment, e.g.:

The experiment might be too expensive: investigating ship durability by building ships and letting them collide is a very expensive method of gaining information.

The experiment might be too dangerous: training nuclear plant operators in handling dangerous situations by letting the nuclear reactor enter hazardous states is not advisable.

The system needed for the experiment might not yet exist. This is typical of systems to be designed or manufactured.

The shortcomings of the experimental method lead us over to the model concept. If we make a model of a system, this model can be investigated and may answer many questions regarding the real system if the model is realistic enough.

1.2 The Model Concept

Given the previous definitions of system and experiment, we can now attempt to define the notion of model:

A model of a system is anything an "experiment" can be applied to in order to answer questions about that system.

This implies that a model can be used to answer questions about a system without doing experiments on the real system. Instead we perform a kind of simplified "experiments" on the model, which in turn can be regarded as a kind of simplified system that reflects properties of the real system. In the simplest case a model can just be a piece of information that is used to answer questions about the system.

Given this definition, any model also qualifies as a system. Models, just like systems, are hierarchical in nature. We can cut out a piece of a model, which becomes a new model that is valid for a subset of the experiments for which the original model is valid. A model is always related to the system it models and the experiments it can be subject to. A statement such as "a model of a system is invalid" is meaningless without mentioning the associated system and the experiment. A model of a system might be valid for one experiment on the model and invalid for another. The term model validation, see Section 1.5.3 on page 10, always refers to an experiment or a class of experiment to be performed.

We talk about different kinds of models depending on how the model is represented:

Mental model-a statement like "a person is reliable" helps us answer questions about that person's behavior in various situations. Verbal model-this kind of model is expressed in words. For example, the sentence "More accidents will occur if the speed limit is increased" is an example of a verbal model. Expert systems is a technology for formalizing verbal models. Physical model-this is a physical object that mimics some properties of a real system, to help us answer questions about that system. For example, during design of artifacts such as buildings, airplanes, etc., it is common to construct small physical models with same shape and appearance as the real objects to be studied, e.g. with respect to their aerodynamic properties and aesthetics. Mathematical model-a description of a system where the relationships between variables of the system are expressed in mathematical form. Variables can be measurable quantities such as size, length, weight, temperature, unemployment level, information flow, bit rate, etc. Most laws of nature are mathematical models in this sense. For example, Ohm's law describes the relationship between current and voltage for a resistor; Newton's laws describe relationships between velocity, acceleration, mass, force, etc.

The kinds of models that we primarily deal with in this book are mathematical models represented in various ways, e.g. as equations, functions, computer programs, etc. Artifacts represented by mathematical models in a computer are often called virtual prototypes. The process of constructing and investigating such models is virtual prototyping. Sometimes the term physical modeling is used also for the process of building mathematical models of physical systems in the computer if the structuring and synthesis process is the same as when building real physical models.

1.3 Simulation

In the previous section we mentioned the possibility of performing "experiments" on models instead of on the real systems corresponding to the models. This is actually one of the main uses of models, and is denoted by the term simulation, from the Latin simulare, which means to pretend. We define a simulation as follows:

A simulation is an experiment performed on a model.

In analogy with our previous definition of model, this definition of simulation does not require the model to be represented in mathematical or computer program form. However, in the rest of this text we will concentrate on mathematical models, primarily those which have a computer representable form. The following are a few examples of such experiments or simulations:

A simulation of an industrial process such as steel or pulp manufacturing, to learn about the behavior under different operating conditions in order to improve the process. A simulation of vehicle behavior, e.g. of a car or an airplane, for the purpose of providing realistic operator training. A simulation of a simplified model of a packet-switched computer network, to learn about its behavior under different loads in order to improve performance.

It is important to realize that the experiment description and model description parts of a simulation are conceptually separate entities. On the other hand, these two aspects of a simulation belong together even if they are separate. For example, a model is valid only for a certain class of experiments. It can be useful to define an experimental frame associated with the model, which defines the conditions that need to be fulfilled by valid experiments.

If the mathematical model is represented in executable form in a computer, simulations can be performed by numerical experiments, or in nonnumerical cases by computed experiments. This is a simple and safe way of performing experiments, with the added advantage that essentially all variables of the model are observable and controllable. However, the value of the simulation results is completely dependent on how well the model represents the real system regarding the questions to be answered by the simulation.

Except for experimentation, simulation is the only technique that is generally applicable for analysis of the behavior of arbitrary systems. Analytical techniques are better than simulation, but usually apply only under a set of simplifying assumptions, which often cannot be justified. On the other hand, it is not uncommon to combine analytical techniques with simulations, i.e., simulation is used not alone but in an interplay with analytical or semianalytical techniques.

1.3.1 Reasons for Simulation

There are a number of good reasons to perform simulations instead of performing experiments on real systems:

Experiments are too expensive, too dangerous, or the system to be investigated does not yet exist. These are the main difficulties of experimentation with real systems, previously mentioned in Section 1.1.2, page 5. The time scale of the dynamics of the system is not compatible with that of the experimenter. For example, it takes millions of years to observe small changes in the development of the universe, whereas similar changes can be quickly observed in a computer simulation of the universe. Variables may be inaccessible. In a simulation all variables can be studied and controlled, even those that are inaccessible in the real system. Easy manipulation of models. Using simulation, it is easy to manipulate the parameters of a system model, even outside the feasible range of a particular physical system. For example, the mass of a body in a computer-based simulation model can be increased from 40 to 500 kg at a keystroke, whereas this change might be hard to realize in the physical system. Suppression of disturbances. In a simulation of a model it is possible to suppress disturbances that might be unavoidable in measurements of the real system. This can allow us to isolate particular effects and thereby gain a better understanding of those effects. Suppression of second-order effects. Often, simulations are performed since they allow suppression of second-order effects such as small nonlinearities or other details of certain system components, which can help us to better understand the primary effects.


Excerpted from Principles of Object-Oriented Modeling and Simulation with Modelica 2.1 by Peter Fritzson Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Table of Contents

Part I: Introduction.

Chapter 1: Introduction to Modeling and Simulation.

Chapter 2: A Quick Tour of Modelica.

Part II: The Modelica Language.

Chapter 3: Classes, Types, and Declarations.

Chapter 4: Inheritance, Modifications, and Generics.

Chapter 5: Components, Connectors, and Connections.

Chapter 6: Literals, Operators, and Expressions.

Chapter 7: Arrays.

Chapter 8: Equations.

Chapter 9: Algorithms and Functions.

Chapter 10: Packages.

Chapter 11: Annotations, Units, and Quantities.

Part III: Modeling and Applications.

Chapter 12: System Modeling Methodology and Continuous Model Representation.

Chapter 13: Discrete Event, Hybrid, and Concurrency Modeling.

Chapter 14: Basic Laws of Nature.

Chapter 15: Application Examples.

Chapter 16: Modelica Library Overview.

Part IV: Technology and Tools.

Chapter 17: A Mathematical Representation for Modelica Models.

Chapter 18: Techniques and Research.

Chapter 19: Environments.

Appendix A: Modelica Formal Syntax.

Appendix B: Mathematica-style Modelica Syntax.

Appendix C: Solutions for Exercises.

Appendix D: Modelica Standard Library.

Appendix E: Modelica Scripting Commands.

Appendix F: Related Object-Oriented Modeling Languages.

Appendix G: A Modelica XML Representation.



Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews