Mechatroby BG
Mechatroby BG
Mechatroby BG
Mechatronics
by Bond
Graphs
An Object-Oriented Approach to
Modelling and Simulation
Second Edition
Mechatronics by Bond
Graphs
An Object-Oriented Approach to Modelling
and Simulation
Second Edition
123
John Montgomery
formerly The Nottingham Trent University
Nottingham
Great Britain
Vjekoslav Dami
University of Dubrovnik
Dubrovnik
Croatia
and
Pulheim-Brauweiler
Germany
ISBN 978-3-662-49002-0
DOI 10.1007/978-3-662-49004-4
ISBN 978-3-662-49004-4
(eBook)
The present edition continues with the approach to bond graph modelling used in
the rst edition. There are also some improvements that are mostly the result of
developments of BondSim program taking place over the last more than ten years.
Its appearance is now quite different, and we hope more user-friendly. There were
some other important changes as well. One is the use of .NET technology for
efcient model solving during the simulation phase.
Also there is a range of new modelling components, in particular for digital
signal processing, which enable modelling and simulation of mechatronics systems
in its entity including the embedded digital signal processing. This was illustrated
on an example of Coriolis mass flowmeter in Chap. 10. There is also support for 3D
visualization and inter-process communications. It is now possible to visualize
motion of complex mechanical system in space and their interactions with its
surrounding.
The version of the modelling and simulation program environment that was used
in the book is BondSim 2014. It is freely available to the readers. We recommend
the readers to download it and use while reading the book. We also encourage the
reads to try to solve their own problems using the approaches described in this
book.
We would also like to thank Dr. Christoph Baumann of Springer-Verlag,
Heidelberg, for his help, kindness, and patience during the preparation of the
manuscript. We are also grateful to Ms. Petra Jantzen and Ms. Carmen Wolf for
their help.
Dubrovnik
June 2015
Vjekoslav Dami
John Montgomery
ix
xi
xii
issues. Strict inputoutput relationships in the models are not supported. Thus,
instead of mathematical models in state-space equation form, differential-algebraic
equation models are used. This enables separation of modelling and model solving
tasks. We believe that, taken together, this extends the applicability of methods to
solving real engineering problems.
The rst implementation of this methodology was made in the beginning of the
1980s with the release of Simulex. This program was implemented using
FORTRAN and run on Digital VAX-750 computers. Simulex models were
described with SPICE-like scripts. The resulting equations were solved with a
version of Gear's DIFSUB. Simulex was applied successfully to a range of practical
problems in servo-systems and robotics.
The revolutionary appearance of PCs in the mid-1980s, followed by development of operating systems that supported user-friendly visual interfaces in the
1990s, spurred the next phase of development. This was also influenced by the
paradigm shift in programming languages: The truly object-oriented languages
were replacing the procedural languagessuch as FORTRAN and Cthat we had
all been using. Another important technological development became available
around the same timesymbolic computational algebra.
In the beginning of the 1990s, the shift to object-oriented modelling paradigm
was made. Class hierarchies were developed that enabled representing component
models as objects. Also, computational algebra methods were developed that, as
explained in the present book, simplied some important user interface problems
and the solution of model equations. Methods for solving differential-algebraic
equations were further developed to support model solving during simulation.
These all were implemented in a visual modelling and simulation program,
BondSim, the rst version of which appeared in the mid-1990s. It fully automated
many important operations. Thus, there was no need for the developer to use any
traditional programming; rather, models were developed and solved simply by
mouse clicks.
In 1995, the authors met at The Nottingham Trent University and started collaborative work on Dynamic System Simulations Using Bond Graphs, a project
funded partially through an ALIS (Academic Links and Interchange Scheme) award
(19951998), sponsored jointly by the Croatian Ministry of Science and
Technology and the British Council. This cooperation continued via e-mail and
reciprocal visits to Nottingham (England) and Dubrovnik (Croatia). One result of
this fruitful joint work is this book that we here offer to the reader.
What is this book about?
The title suggests that this book is about mechatronics; this is, indeed, one of its
central themes. It is not, however, another book on what mechatronics is; rather, it
is about how mechatronic problems can be solved by a systematic approach
employing bond graphs. Why bond graphs? Because they offer an efcient means
of modelling interdisciplinary problems, such as those commonly found in
mechatronics. (The book, by the way, assumes no previous experience with bond
graphs, though it certainly would be useful.)
xiii
The book shows, in step-by-step fashion, how models are developed systematically and then simulated in a way that permits thorough analysis of the problem
under study. Every chapter that deals with an engineering application starts with the
exposition and solution of a simple problem relevant to that chapter. Then, the
solution of relatedthough much more difcultproblems is explained.
The book is divided into two parts: Fundamentals and Applications.
Part I, Fundamentals, consists of ve chapters on bond graph modelling. It starts
with an introduction to the subject and then proceeds with describing a systematic
object-oriented approach to modelling; implementation of object-oriented modelling in a visual environment; and the numerical and symbolic solution of the
underlying model equations.
Part II, Applications, consists of ve chapters that apply bond graphs and
component model techniques to mechanical systems, electrical systems, control
systems, multibody dynamics, and continuous systems. Great attention is given to
modelling electrical components and systems, including semiconductors. The same
holds for multibody systems, both rigid and deformable, such as found in various
mechanisms and robots.
What readers can gain from the book?
There are several ways in which this book can be used, depending mainly upon the
background and interests of the reader.
Researchers in mechatronics and micro-mechanics design, for example, can use
it to nd out how difcult problems in their disciplines can be solved using a
combination of bond graphs and component model techniques.
For the reader interested in simulation technology, the book provides an introductory description of the object-oriented visual approach to modelling and
simulation.
The reader whose background is in one of the applied disciplines covered herein
can gain valuable insight into how bond graphs may be used to solve problems
particular to his area of interest.
We also think that the book can be useful as a textbook, or as a supplementary
text, in courses on physical modelling of engineering systems in general. We
believe that it can help students learn the system way of solving a problem in
electrical and mechanical engineering, as well as coupled problems that span
disciplines.
Finally, it is our sincere wish that the text and software will aid the reader in his
work. We invite, and will appreciate, all constructive feedback.
BondSim Research Pack
A special version of BondSimBondSim Research Pack (beta version)is bundled with this book. It provides a visual development environment for the modelling and simulation of engineering and mechatronics systems based on bond
graphs. The problems presented in the book are solved using the BondSim Research
Pack.
xiv
It runs on the Windows 2000 Professional operating system, but can be used on
other Windows platforms, too. The reader can use this version of BondSim to
analyse all of the problems presented in the book. (These are found in BondSims
program library.) The projects that a reader might develop on his or her own are
somewhat more restricted. The interested reader can order the complete version of
BondSim from the rst author. (See Appendix for details.)
Acknowledgements
A number of people have reviewed the initial outline (and the drafts) of this book.
We are most grateful to them for their time and expertise.
Our special thanks go to the following people and institutions:
The Polytechnic of Dubrovnik (Veleuilite u DubrovnikuCollegium
Ragusinum, now University of Dubrovnik) for facilities provided to both authors.
We are especially grateful to the rector, Professor Dr. Mateo Milkovi, for his
encouragement and support.
Vlado Jaram, Mr. Sc., for initiating the whole publishing project and his help on
getting the book published, as well as on his suggestions during writing the book.
Professor Barry Hull of the Department of Mechanical Engineering of the
Nottingham Trent University for his support.
The Croatian Ministry of Science and Technology and the British Council for
the funds provided through the ALIS award.
Dr. Nick Staresinic, EcoMar Mariculture, for his careful reading of the manuscript and his helpful editing suggestions.
We would also like to thank Dr. Dieter Merkel of Springer-Verlag, Heidelberg,
for his help, kindness, and patience during the preparation of the manuscript. We
are also grateful to Ms. Petra Jantzen and Ms. Gaby Mass for their help.
And last, but in no way least, we wish to express our deep appreciation and love
to our wivesMira and Helgafor their love, support, patience, and sacrice
during the long period over which this book was produced.
Dubrovnik
June 2002
Vjekoslav Dami
John Montgomery
Contents
Part I
Fundamentals
Bond
2.1
2.2
2.3
2.4
2.5
2.6
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
5
6
10
11
12
15
19
21
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
23
23
23
24
26
28
28
29
30
31
32
33
34
35
37
37
38
40
xv
xvi
Contents
2.7
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. 77
. 77
. 77
. 78
. 79
. 83
. 85
. 89
. 90
. 92
. 95
. 97
. 100
. 102
Object
4.1
4.2
4.3
4.4
4.5
4.6
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4.7
4.8
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
43
43
48
53
63
63
64
67
69
72
75
105
105
106
110
112
112
118
118
121
126
129
131
131
134
135
135
138
Contents
xvii
4.9
Library Operations . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9.1
Library Projects . . . . . . . . . . . . . . . . . . . . .
4.9.2
Library Components . . . . . . . . . . . . . . . . . .
4.10 Important Operations at the Document Level . . . . . . . .
4.10.1 Open, Close and Save Commands. . . . . . . . .
4.10.2 Page Layout and Print Commands . . . . . . . .
4.10.3 The Delete, Copy, Cut, and Insert Operations .
4.11 Inter-process Communications . . . . . . . . . . . . . . . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
141
142
143
146
147
148
149
151
155
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
157
157
158
158
162
166
173
173
177
177
180
182
185
186
189
Mechanical Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2
The Body Spring Damper Problem . . . . . . . . . . . . . . . . .
6.2.1
The Problem . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.2
The Bond Graph Model. . . . . . . . . . . . . . . . . .
6.2.3
Analysis of the System Behaviour by Simulation
6.3
Effect of Dry Friction . . . . . . . . . . . . . . . . . . . . . . . . . .
6.3.1
The Model of Dry Friction. . . . . . . . . . . . . . . .
6.3.2
Free Vibration of a Body with Dry Friction . . . .
6.3.3
Stick-Slip Motion . . . . . . . . . . . . . . . . . . . . . .
6.3.4
The Stick-Slip Oscillator . . . . . . . . . . . . . . . . .
6.4
Bouncing Ball Problems . . . . . . . . . . . . . . . . . . . . . . . .
6.4.1
Simple Model of Impact . . . . . . . . . . . . . . . . .
6.4.2
A Ball Bouncing on a Table. . . . . . . . . . . . . . .
6.4.3
A Ball Bouncing on a Vibrating Table . . . . . . .
6.5
The Pendulum Problem . . . . . . . . . . . . . . . . . . . . . . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
193
193
194
194
194
208
222
222
229
231
234
237
237
241
243
245
251
Part II
6
Applications
xviii
Contents
Electrical Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2
Electrical Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.1
The Problem . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.2
The Bond Graph Model. . . . . . . . . . . . . . . . . .
7.2.3
Analysis of the System Behaviour by Simulation
7.3
Models of Circuit Elements . . . . . . . . . . . . . . . . . . . . . .
7.3.1
Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.2
Capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.3
Inductors . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.4
Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.5
Switches . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4
Modelling Semiconductor Components . . . . . . . . . . . . . .
7.4.1
Diodes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4.2
Transistors . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4.3
Operational Ampliers. . . . . . . . . . . . . . . . . . .
7.5
Electromagnetic Systems . . . . . . . . . . . . . . . . . . . . . . . .
7.5.1
Electromagnetic Actuator Problem . . . . . . . . . .
7.5.2
System Bond Graph Model . . . . . . . . . . . . . . .
7.5.3
Electromagnetic Flux and Force Expressions . . .
7.5.4
Magnetic Actuator Component Model . . . . . . . .
7.5.5
Simulation of Magnetic Actuator Behaviour . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
253
253
254
254
255
263
266
266
267
269
272
279
282
283
298
317
324
324
325
326
328
330
332
Control Systems . . . . . . . . . . . . . . . . . . . .
8.1
Introduction . . . . . . . . . . . . . . . . . .
8.2
A Simple Control System . . . . . . . .
8.3
PID Control System Modelling . . . .
8.4
Permanent Magnet DC Servo System
References . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
333
333
334
343
347
355
Multibody Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2
Modelling of Rigid Multibody Systems in Plane. . . . . . .
9.2.1
The Component Model of a Rigid Body
in Planar Motion. . . . . . . . . . . . . . . . . . . . . .
9.2.2
Joints . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.2.3
Modelling and Simulation of a Planar
Mechanism . . . . . . . . . . . . . . . . . . . . . . . . .
9.3
Andrews Squeezer Mechanism . . . . . . . . . . . . . . . . . .
9.4
Engine Torsional Vibrations. . . . . . . . . . . . . . . . . . . . .
9.5
Motion of Constrained Rigid Bodies in Space . . . . . . . .
9.5.1
Basic Kinematics . . . . . . . . . . . . . . . . . . . . .
9.5.2
Bond Graph Representation of a Body Moving
in Space . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . 357
. . . . 357
. . . . 358
. . . . 358
. . . . 363
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
368
373
383
391
391
. . . . 396
Contents
xix
9.5.3
Rigid Body Dynamics . . . . . . . . . . . . . . . . .
9.5.4
Modelling of Body Interconnections in Space.
9.6
Dynamics of Puma 560 Robot . . . . . . . . . . . . . . . . . .
9.6.1
Problem Formulation . . . . . . . . . . . . . . . . . .
9.6.2
Model of the Robot. . . . . . . . . . . . . . . . . . .
9.6.3
Simulation of PUMA 560 . . . . . . . . . . . . . .
9.7
3D Visualization of Robots . . . . . . . . . . . . . . . . . . . .
9.7.1
Concept of 3D Visualization . . . . . . . . . . . .
9.7.2
Generating 3D Virtual Scene . . . . . . . . . . . .
9.7.3
Visualization of Robot Dynamics . . . . . . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10 Continuous Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2 Spatial Discretisation of Continuous Systems . . . . . . .
10.3 Model of Electric Transmission Line. . . . . . . . . . . . .
10.4 Bond Graph Model of a Beam . . . . . . . . . . . . . . . . .
10.5 A Packaging System Analysis . . . . . . . . . . . . . . . . .
10.5.1 Description of the Problem. . . . . . . . . . . . .
10.5.2 Bond Graph Model Development . . . . . . . .
10.5.3 Evaluation of Vibration Test Characteristics .
10.6 Coriolis Mass Flowmeters . . . . . . . . . . . . . . . . . . . .
10.6.1 Problem Statement . . . . . . . . . . . . . . . . . .
10.6.2 Principle of Operations . . . . . . . . . . . . . . .
10.6.3 Dynamics of Curved CMF Tubes . . . . . . . .
10.6.4 Bond Graph Model of CMF Transducer . . .
10.6.5 Control of CMF Transducer . . . . . . . . . . . .
10.6.6 Simulation of CMF Control Loop . . . . . . . .
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
401
404
413
413
419
428
434
434
436
445
447
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
449
449
450
452
459
465
465
466
474
477
477
478
480
490
494
501
503
Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
Part I
Fundamentals
Chapter 1
1.1
Objectives
models can be used at various stages of design, from the early stages of conceptual
design to nal prototype testing. There are many elds in which this technique has
been applied protably.
The fundamental question that naturally arises is: How are such models best
constructed? A well-known adage suggests that modelling is more art than science.
It is, in fact, a bit of both. On the scientic side, there are a number of approaches,
methods, and tools that can be mastered, and then applied, to develop effective
models; the art, perhaps, is the insight that a modeller accumulates through
practice and familiarity with the system being studied.
This chapter reviews some of the more promising approaches and methods at the
foundation of modelling. The perspective adopted is motivated mainly by problems
in mechatronics. There are many denitions of mechatronics.1 One that we choose
states that mechatronics is a synergistic combination of precision mechanics,
electronic control, and system thinking.
Perhaps the best-known examples of mechatronic design are found in robotics.
There are also other, no-less-important applications of this design philosophy.
In todays highly competitive and demanding development environment, classical solutions without embedded microprocessors have little chance of success.
Modelling and simulation play an even greater role in product design. To promote
efcient solutions, the computer modelling and simulation environments should
relieve designers of many routine, low-level tasks [1], as well as support collaborative work.
1.2
The concept of system plays a central role in model building. An efcient model
need not embrace the entire universe to design just a part of it. This is not only an
impossible task, but also an unnecessary one. We thus pay attention only to that part
of the problem in which we are interested. This is termed the system for the given
problem. Everything not included in the system constitutes its environment
(Fig. 1.2).
The system might consist of the engineering equipment that is the subject of the
problem, but it can include other parts, as well. In this system-centred approach it is
tacitly assumed that the environment determines the behaviour of the system. Thus,
the environment influences the system and can change its behaviour.
It is, of course, also of interest to study the influence of the system on its
environment, e.g. the current drawn by a system from an external source. In the case
in which the system can change its environment in a way that there is a backwards
influence on its own behaviour, the system should, in most cases, be enlarged to
include this part of its environment.
It is often useful to decompose a system into components. For example, the
simple actuator illustrated in Fig. 1.3 consists of an electric motor driven by a
controller. The motor shaft is connected to a nut. The shaft rotation is transformed
by the nut into a translation of an actuator shaft, which moves a load. The position
information of the load is fed back via a sensor to the controller.
Every part of such a system, i.e. the electronic drive unit, motor, shaft, etc., may
be modelled as a separate component. The complete model of the drive thus may be
depicted as a system of interconnected components.
Decomposition of the complete system into its components generally simplies
the modelling task and gives a sharper insight into the systems structure. Such a
representation is a great help in interpreting model behaviour in terms of the real
engineering system.
System decomposition can proceed to ever-lower levelsessentially treating
each component as another system that, in turn, consists of even simpler components. At some point a level of detail will be reached at which the components may
be considered as elementary, i.e. not admitting any further useful decomposition.
Such elementary components are modelled as entities and dene the limit of detail
of the model in question.
It should perhaps be pointed out again that a model is an abstraction of the real
world: It is not necessaryor even possiblethat the structure of the model represents the original physical system in all of its complexity. Model development,
however, generally is an iterative process: Additional details may be added as the
model matures, or expands to address additional problems.
Decomposing an engineering system into components also suggests a natural
decomposition of tasks among members of a modelling team. Each group might be
assigned development of one component. The overall model can then be built up by
combining the separate sub-models.
Yet another advantage of this approach is that the component models can be
reused, e.g. components developed for one particular application might serve as
building blocks for another, unrelated, application.
1.3
Effort
Flow
Momentum
Displacement
Mechanical
translation
Mechanical
rotation
Electrical
Hydraulic
Force
Velocity
Momentum
Displacement
Torque
Temperature
Angular
momentum
Flux linkage
Pressure
momentum
Angle
Thermal
Angular
velocity
Current
Volume flow
rate
Heat flow
Voltage
Pressure
Charge
Volume
Heat energy
Bond graphs corresponding to variables having this property are usually termed
pseudo-bond graphs [10, 13].
All physical processes are described using several elementary components, or
elements:
forces acting on the body. This diagram, taken together with the corresponding
component constitutive relations, completely denes the mathematical model of the
system; it can thus be used as a basis for simulating the system. The bond graph
also shows the structure of the model in a way that resembles the structure of the
real system. This proves useful in efciently communicating details of the model to
interested parties outside of the modelling team.
There is also another analogy, introduced by Firestone [7, 14] and based on
across- and through-variables, that can be used. A variable dened at a point in
space with respect to another point in space is termed an across variable. For
example, velocity, voltage, pressure, and temperature all may be interpreted as
across-variables. On the other hand, a variable dened at a single point without
respect to any other point is termed a through variable. Examples of
through-variables include force, current, and fluid flow. The across- and
through-variable analogy naturally leads to representation of a model in terms of
linear graphs.
There is no general agreement on which analogy is preferable. The effort-flow
analogy corresponds to the force-voltage electromechanical analogy; and the
across-through analogy corresponds to the force-current electromechanical analogy.
We use the effort-flow analogy, as it perhaps better explains efforts as intensities
and flows as extensities.
It should be stressed that system decomposition combined with the bond graph
modelling method readily leads to a lumped-parameter model. For the case in which
variables inside a component change continuously over some region of space, it is
necessary to apply discretization; that is, to represent the model by a nite number
of components. This can be done in various ways, such as using the well-known
nite-element discretization method.
In spite of the attention this approach has attracted, the bond graph method has
not received the widespread acceptance expected by its proponents. In the opinion
of the authors, one of the drawbacks of the classical bond graph modelling technique is its flat structure. That is, the model is constrained to be represented as a
single-level structure. This leads to quite complicated diagrams even for relatively
simple systems, and these can be difcult to interpret. One remedy for this is to pay
more attention to the modelling of components in general, as well as to their ports.
This enables more systematic model development.
There is another important concept embedded in bond graph theory. This is the
concept of causality. This refers to cause (input) and effect (output) relationships [10].
Thus, as part of the bond graph modelling process, a causality assignment is
implicitly introduced. This leads to the description of bond graphs in the form of
state-space equations. The problem that arises is that such a model is restrictive.
Furthermore, as pointed out in [15], there is no true notion of causality in physical
laws. For example, there are no purely physical reasons to interpret a force on a
body as the cause of its motion; or to interpret a voltage on electrical terminals of a
component as the cause of the current flowing through it. Thus, causality will not be
part of our focus. The point of view taken is that modelling canand shouldbe
treated as separate from the mathematical model developed and the solution derived
10
thereof. Used in this way, and together with the general modelling technique
mentioned in the immediately previous section, bond graphs can be used as a
powerful visual modelling language.
1.4
Block Diagrams
Block diagrams are often used to denote input-output relations (Fig. 1.6). They have
been used traditionally in control engineering, but also have found popular application in other elds, such as computer science, economics, and ecology.
Block diagrams depict operations on signals (information). The symbol inside
the block represents a process applied to an input signal to generate an output. By
connecting the output of one block to the input of another block, we can illustrate a
procedure for the calculation of some quantity in which we are interested.
This approach can be used for modelling and simulating systems, too [2]. As an
illustration, Fig. 1.7 shows a block diagram model of the simple mechanical system
introduced earlier (Fig. 1.5a). The block diagram shows how to evaluate model
variables given the time-history of the applied force and values of position and
velocity of the body at the start of the motion.
Many simulation programs are based on a modelling approach of this type (e.g.
Matlab-SIMULINK). Unfortunately, many practical systems cannot be treated this
way, except at some simplied conceptual level. In addition, modelling the system
by block diagrams can be complicated and error prone, and also more difcult to
11
1.5
12
discontinuities. Symbolic manipulation also can be used for post-processing and the
control of the complete problem-solving task.
This procedure can be accomplished without using the complete machinery of
computational algebra. Simple arithmetical and logical operations plus symbolic
differentiation is usually sufcient. What is really important is that the computational algebra should be seamlessly integrated with the other parts of the modelling
and simulation environment.
It should also be pointed out that another technique for the evaluation of differentials has attracted much attention: automatic differentiation [19]. Automatic
differentiation is a numerical technique for the evaluation of a differential based on
an algorithmic approach using the rules of differentiation. This technique is often
confused with symbol manipulation. It is usually argued that this technique is
superior in terms of efciency and memory usage; but symbolic manipulation is
constantly being improved and can be applied to problems other than those that
require the evaluation of a differential.
The approach taken here is based partly on the symbolic manipulation technique
described in [20]. The constitutive relations for modelling the elements described in
the last section are held in symbolic form, together with parameter expressions and
model structure data. Before the start of a simulation, the model is assembled in the
form of byte codes that can be evaluated efciently during simulation. The
implementation of the method may be based on a combination of the interpretative
and compiled approaches. A very powerful technique that can be also used is based
on .NET assembly technology. Thus, it is not necessary to recompile the model and
relink it.
1.6
The object-oriented paradigm represents a major achievement in software engineering that facilitates modelling complex real-world problems [17, 21]. When
properly applied, it yields robust models consisting of reusable, easy-to-maintain
components. Only a very brief introduction is provided here. More information on
object-oriented programming (OOP) can be found in [22, 23].
The focus of this approach is an object. An object is an abstraction of reality
described by attributes and methods (Fig. 1.8).
Attributes dene an objects state and can be represented as variables of the
fundamental types (such as integers, Booleans, characters, or real numbers), other
objects, or collections of various types.
Methods describe an objects behaviour. From a related perspective, methods
represent the services that an object provides.
Both attributes and methods are members of an object. Attributes sometimes are
referred to as data-members, and methods as member-functions. An object is said to
encapsulate its members.
13
One of the key concepts of the OO approach is information hiding. This means
that an object exposes only those of its members that are required for use by other
objects; all other attributes and methods are hidden within the object, inaccessible
to the outside world.
To enable interaction with other objects in its environment, an object must
provide an interface. An object interacts with its environment only via its interfaces. The interfaces expose the access methods.
Most real-world objects cannot be modelled adequately with only a single
fundamental data type. The OO paradigm thus introduces the concept of a class.
A class is a generalised data type that denes the attributes and methods shared by
all objects of that class. The terms object and class are sometimes (improperly) used
interchangeably; strictly, an object is an instance of a class. In practice, an object is
created in the computer memory (constructed) at run time using the class denition
as a template; and removed from memory (destructed) when no longer required.
Yet another fundamental principle of the object-oriented approach is inheritance.
The inheritance mechanism permits classes to be organised in a logical hierarchy
that describes their interrelationships. Thus, a class derived from an existing class
inherits the members of its parent. The derived class may dene additional attributes and functionality, as well as modify those inherited from its parent.
Relative to the derived (child) class, the parent class is a generalization, a super
class, or, in the terminology of C++, a base class.
Viewed from the complementary perspective, the derived class is a specialization of the parent class; it is a kind of the base class. At the head of the hierarchy
there is usually a class that does nothing more than dene the interfaces of all lower
level classes in a consistent way. Such a class is an abstract base class. We treat the
elementary component of Fig. 1.4 as a kind of general component, which likewise
is a kind of more abstract object class (Fig. 1.9).
Another OO principle is polymorphism. Polymorphism enables methods with
the same name to exhibit different functionalities. For example, methods in the
lineage of a class hierarchy can have the same function headerthat is, the same
name, argument list, and return typebut different behaviour. Such methods are
14
declared virtual in the base class. The particular method invoked by a function call
depends on the objects class and is implemented through a mechanism termed
dynamic binding. The decision on which method to call thus is made at run time.
A consequence of polymorphism is also that two methods may share the same
name, but have different argument (parameter) types and return types. The specic
method executed depends on the type of the arguments passed by the calling
function. This is an example of the so-called function overloading. In contrast to the
previous example, these functions are not virtual: They have a unique signature
(parameter list), so the decision on which version of an over-loaded function to call
is decided at compile time.
The general modelling approach set out in Sect. 1.2 cannot be supported using
class hierarchies alone, as components generally contain other components; this is
how real devices are built. To represent a model of a component we use two
objects: a component and its accompanying document.
A component is represented by a component object. Such an object is compounded and contains port objects that serve as interfaces to other components
(Fig. 1.10, component Platform). If the component is simple and hence doesnt
contain other components, then it is just an elementary component. But, if it does
contain other components, we use another object to dene its internal structure.
Such an object is not a kind of any other component, but a separate entitya
document (Fig. 1.10, bottom-right box).
The document object has external ports that correspond exactly to the component objects ports and provide access to the component internals. In this way, the
component model representation is based on two associated classesthe component class and the document class. These classes are designed in a way that supports
access to the document through its accompanying component object, or by its ports.
This is very close to the way in which we deal with real components. That is, to
see what is inside a component, we rst have to nd a component by its name or
manufacturers designation, or maybe how it is connected to other components;
only then we can open it to look at what is inside. The component is usually
contained in another component, this again in yet another component, etc. The set
of all components constitutes the system. In this way a model of a system can be
represented as a tree of components.
Elementary components are treated somewhat differently, as they do not contain
other components. Ports of such components provide access to the component
15
constitutive relations that describe the mathematical model of the particular elementary component (Sect. 1.3). Thus, the elementary components can be looked at
as leaves of the model tree.
1.7
One of the rst computer programs developed for modelling and simulation of
practical engineering systems was SPICE [24], which was developed at the
University of California, Berkeley at the beginning of the 1970s for integrated
electronic circuits. The program was accepted quickly by leading semiconductor
manufacturers. Since that time, SPICE has undergone continuous development to
follow technological advances in semiconductors. Today, it is the de facto standard
for electrical simulations. All of the main semiconductor manufacturers offer SPICE
models of their components.
The success of SPICEand of similar products that emerged shortly afterwards
was owed partly to the fact that, in electrical engineering, and particularly in electronics, systems and devices normally are modelled using electrical schemes. SPICE
16
Originally the SABER was product of Analogy, Inc., Beaverton, USA. Currently it is distributed
by Synopsys, Inc., http://www.synopys.com.
6
The NETLIB is web based public library repository that can be accessed at http://netlib.org.
7
Lorenz Simulation SA, http://www.lorsim.be.
17
18
The BondSim supports, for documentation purposes, print of screen images into a le in emf
(Enhanced Windows Metale) format, which is supported by main word or graphic programs
including MS Word, Corel Draw, etc.
1.8
19
This book consists of two parts. The rst partFundamentalsdescribes the basics
of the design of the visual object oriented environment for the modelling and
simulation of general engineering systems, with emphasis on mechatronics systems.
This part contains ve chapters.
This chapter gives a short overview of the approaches and methods used for model
representation. After a short discussion of the objectives, the general modelling
approach is described which lies at the root of the modelling philosophymodel
development by systematic decomposition. The concepts of system, environment
and of component are discussed. Then physical modelling, analogies and bond
graphs are described as well as an alternative approach to modelling based on the
through/across variables approach. The block diagram approach is described next as
a model representation method on its own or in combination with bond graphs.
A short introduction to symbolic model solving is also given and its potential for use
in combination with numerical methods. The next important technique described is
object-oriented programming with an emphasis on a component-based approach to
the modelling of engineering systems. Finally computer aided modelling is described
together with the concept of modelling and simulation in a visual environment.
Chapter 2 gives an overview of the bond graph modelling technique. The perspective taken is an extension of conventional bond graphs to multilevel modelling.
Starting from the concept of word models, ports, bonds, and power variables, the
component model development approach is described. The elementary bond graph
components used for modelling of the basic physical processes are dened. Also the
components corresponding to basic block diagram operations are introduced, both
for continuous-time and discrete-times models. The systematic decomposition
approach to bond graph model development is illustrated on examples of
mechanical and electrical systems. Finally the notion of causality in bond graphs is
discussed.
Chapter 3 deals with the systematic object-oriented approach to modelling. The
basic idea is to do the modelling visually, i.e. without any coding, but solely by
interacting with the modelling system in a suitably designed visual environment.
The concept of the component model is introduced as the basic mechanism for
systematic simulation models development. The special class hierarchies are
designed to support creation of models for given problems as trees of linked objects
in the computer memory. The models are represented visually as bond graphs and
are stored as a set of linked les. Underlying physical processes are represented in
terms of elementary bond graph components, which constitutive relations are
described symbolically using a simple specially designed language. The design of a
suitable modelling environment to support the modeller is outlined.
Chapter 4 describes an implementation of the object-oriented approach of
Chap. 3. A program BondSim is described that offers a visual environment for the
modelling and simulation of engineering and mechatronics systems. The program
implements several services that are accessible to a user through a window system.
20
The two basic services are Modelling and Simulation. The program also supports
model database maintenance, library support, as well as collaborative support for
models exports and imports.
Chapter 5 closes the rst part of the book and describes the methods used for
automatically generation of the mathematical model equations and their solution.
This is divided into two distinctive phasesthe model building and the execution
of simulation runs. During the rst the mathematical model equations are generated
based on the model object tree. The methods for generating the mathematical
models implied by the components structure are described. The model equations
are machine generated in the form of differential-algebraic equations (DAEs).
During the simulation phase such equations have to be solved. The well-known
backward differentiation formula (BDF) is used. A special implementation of the
method is described based on the variable coefcient formula. Also the problem of
starting values and of discontinuities in the model equations are also discussed. The
methods developed depend to a great extent on computational algebra support
implemented in the program. This also adds to flexibility in the modelling.
The second part of the book deals with Applications to mechatronics of the bond
graph modelling technique. It is divided into Chaps. 610.
Chapter 6 deals with simple mechanical problems. The intention is to familiarize
the reader with using the BondSim program on relatively simple problems. These
problems are also of interest on their own right. Thus, the well-known Body Spring
Damper problem is used as the introduction to the bond graph modelling and
simulation of mechanical systems. It is also shown that it is possible to visually
represent mechanical components by mechanical schemes. After that the effects of
dry friction are studied. Next another class of discontinuous problems is studied
impact. Using a simple model of impact the classical problem of a ball bouncing on
a vibrating table is studied. The problem is better known for its chaotic behaviour.
The chapter ends with a description of a see-saw problem. It is a pendulum, but it
can be looked at as a multibody problem. It is shown that such problemsof
interest in Mechatronicscan be readily solved by bond graphs.
Chapter 7 is devoted to the modelling of electrical systems. It is shown that the
component models approach can be readily used for the modelling of electrical and
electromechanical components and systems. This is important for this enables both
the mechanical and electrical part of a system can be modelled and analysed on the
same basis, i.e. from the bond graph point of view. Models of the most important
electrical components are developed in terms of bond graphs such as resistors,
inductors, capacitors etc., and also fundamental semiconductor components such as
the diodes and the transistors, using SPICE like models. An important feature of the
approach is the visual representation of bond graph electrical component models as
electrical schemes. The chapter ends with analysing an electro-magnetic system.
Chapter 8 describes modelling of control systems in terms of block diagrams.
The approach is very popular in other elds as well. It is shown how block diagram
models can be developed and is illustrated on a simple control system problem.
Some details of modelling that are specic to block diagram components are given.
Then a short overview of the modelling approach to control systems is given
21
concentrated mostly on the modelling of PID controllers in servo loops. Finally the
modelling and simulation of a DC motor servo is given.
Chapter 9 is devoted to multibody systems. The models of planar rigid bodies
and the basic joints are developed and applied to some practical multibody problems. The approach is then extended to multibody systems in space. The components developed are used for solving control and 3D visualization of robots. This
demonstrates that the component model approach developed in this book can be
used for solving complex problems in mechatronics.
Chapter 10 is the last chapter of the book and deals with the modelling and
simulation of continuous systems. Continuous systems are important in many
engineering disciplines, mechatronics included. The approach used here is based on
the method of lines. The system is discretized and represented as an assemblage of
nite elements in the form of bond graph component models. The model equations
are then generated and solved using the DAEs solver. The approach is applied rst
to a problem of the modelling of electric transmission lines. Then a bond graph
component model of a beam element based on the classical Euler-Lagrange and
Timoshenko theory is developed and applied to the solution of two practical
problemsa package vibration testing system and the analysis of a Coriolis mass
flow meter.
References
1. Damic V, Montgomery J (1998) Bond graph based automated modelling approach to
functional design of engineering systems. In: Gentle GR, Hull JB (eds) Mechanics in design
international conference. The Nottingham Trent University, Nottingham, pp 377386
2. Ljung L, Glad T (1994) Modelling of dynamic systems. PTR Prentice Hall, Englewood Cliffs
3. Paynter HM (1961) Analysis and design of engineering systems. MIT Press, Boston
4. Blundell AJ (1982) Bond graphs for modelling engineering systems. Ellis Horwood Limited,
Chichester
5. Breedveld PC (1984) Physical systems theory in terms of bond graphs, PhD thesis, Technische
Hochschool Twente, Entschede
6. Gawthrop P, Smith L (1996) Metamodelling: bond graphs and dynamic systems. Prentice
Hall, Hemel
7. Hezemans PMAL, van Geffen LCMM (1991) Analogy theory for a systems approach to
physical and technical systems. In: Fishwick PA, Luker PA (eds) Qualitative simulation
modeling and analysis. Springer, New York, pp 170216
8. Karnopp DC, Rosenberg RC (1975) System dynamics: a unied approach. Wiley, New York
9. Karnopp DC, Margolis DL, Rosenberg RC (1990) System dynamics: a unied approach, 2nd
edn. Wiley, New York
10. Karnopp DC, Margolis DL, Rosenberg RC (2000) System dynamics: modeling and simulation
of mechatronic systems, 3rd edn. Wiley, New York
11. Thoma JU (1975) Introduction to bond graphs and their applications. Pergamon Press, Oxford
12. Thoma JU (1990) Simulation by bondgraphs. Springer, Berlin Heidelberg
13. Thoma J, Bousmsma BO (2000) Modelling and simulation in thermal and chemical
engineering. A bond graph approach. Springer, Berlin Heidelberg
14. Firestone FA (1933) A new analogy between mechanical and electrical systems. J Accoustical
Soc 4:249267
22
15. Celier FE, Elmqvist H, Otter M (1995) Modelling from physical principles. In: Levine WS
(ed) The control handbook. CRC Press, Boca Raton, pp 99108
16. Shei TK, Steeb WH (1998) Symbolic C++: an introduction to computer algebra using
object-oriented programming. Springer, Singapore
17. Cellier FE (1996) Object-oriented modeling: means for dealing with system complexity. In:
Proceedings of the 15th Benelux meeting on systems and control, Mierlo, pp 5364
18. Kreuter EJ (1994) Generation of symbolic equations of motion of multibody systems. In:
Kreuzer E (ed) Computerized symbolic manipulation in mechanics. Springer, Wien, New
York, pp 166
19. Iri M (1991) History of automatic differentiation and rounding error estimation. In:
Griewank A, Corliss GF (eds) Automatic differentiation of algorithms: theory,
implementation and applications, proceedings. of rst SIAM workshop on automatic
differentiation, pp 316
20. Reverchon A, Ducamp M (1993) Mathematical software tools in C++. Wiley, Chichester
21. Schroeder W, Martin K, Lorensen B (1998) The visualization toolkit, 2nd edn. Prentice-Hall
PTR, Upper Saddle River
22. Rumbaugh J, Blacha M, Premerlani W, Eddy F, Lorenson W (1991) Object-oriented modeling
and design. Prentice Hall
23. Stroustrup B (1998) C++ programming language, 3rd edn. Addison-Wesley, Reading
24. Vladimirescu A (1994) The spice book. Wiley, New York
25. Christen E, Bakalar K, Dewey AM, Moser E (1999) Analog and mixed signal modeling using
VHDL-AMS Language (tutorial). The 36th Design Automation Conference, New Orleans
26. Rosenberg RC (1974) A users guide to ENPORT-4. Wiley, New York
27. Broenink JF (1990) Computer-aided physical systems modelling and simulation: a bond graph
approach. PhD thesis, University of Twente, Enschede, Netherlands
28. Breunese APJ, Broenink JF (1997) Modeling mechatronic systems using the SIDOPS+
language. In: Cellier FE, Granda JJ (eds) 1997 International conference on bond graph
modeling and simulation, Phoenix, Arizona, pp 301306
29. Broenink JF, Kleijn C (1999) Computer-aided design of mechatronic systems using 20-SIM
3.0. In: Roberts GN, Tubb CAJ (eds) Proceedings of 2nd workshop on European scientic and
industrial cooperation, Newport, UK, pp 2734
30. Granda JJ (1982) Computer-Aided Modelling Program (CAMP): a bond graph processor for
computer aided design and simulation of physical systems using digital simulation languages.
Ph.D. Dissertation, Department of Mechanical Engineering, University of California, Davis
31. Fritzon P, Engelson V (1997) Modelicaa unied object-oriented language for system
modeling and simulation. In: Modelica home page http://Dynasim.se/Modelica
32. Frizon P (2014) Principles of object-oriented modeling and simulation with Modelica 3.3: a
cyber-physical approach, 2nd edn. Wiley-IEEE Press
Chapter 2
2.1
Introduction
2.2
Word Models
23
24
A component represented by its word description (its name) and its ports is
taken as the most fundamental representation of a component model and is termed
the word model. The word model is used as the starting point of component model
development.
2.3
Ports, as noted in Sect. 2.2, are places where interactions between components take
place. These interactions can be looked on as power or information transfer. Thus,
two types of ports are dened.
Ports characterised by power flow into or out of a component are termed power
ports. Such ports are depicted by a half arrow (Fig. 2.2). The half arrow pointing to
the component describes power inflow. It is assumed that at such a port there is
positive power transfer into the component. Similarly, a half arrow pointing away
from the component depicts power outflow from the component and the corresponding power transfer is then taken as negative.
Another type of port is characterised by negligible power transfer, but high
information content. These are termed control ports and are depicted by a full
arrow. The arrow pointing to the component denotes transfer of information into
the component (control input). Similarly the port arrow pointing away from the
component denotes information extracted from the component (control output).
The word model, i.e. the component represented by the name and the ports, is
taken as the lowest level of component abstraction (Fig. 2.2). Components interact
with other components through their ports. These interactions are looked on as
power or information transfer between components and are depicted by lines
connecting corresponding component ports (Fig. 2.3a). The lines that connect
power ports are termed bond lines, or bonds for short. A bond line joins a power
Fig. 2.2 Component word
model with the ports dened
25
Fig. 2.3 Connecting components: a connecting ports by bond lines, b line and connected ports
represented by bond line only
outflow port of one component and a power inflow port of the other and clearly
shows the assumed direction of power transfer between components. Similarly,
lines connecting control output ports and control input ports are termed active or
control bonds. These lines show the direction of information transfer between
components. When a bond line is drawn, ports and connecting lines appear as a
single line with a half or full arrow at one of its ends (Fig. 2.3b). In the bond graph
literature emphasis is put on the bonds, with ports playing a minor role. In our
approach just the opposite point of view is taken: Ports, the places where
inter-component actions take place, receive the emphasis.
Power or information exchange between component ports can be quite complex.
It generally depends on the processes taking place in the components. In the
simplest case the process in the component as seen at a power port can be described
by a pair of power variables, the effort and flow variables. Their product is the
power through the port (Sect. 1.3). Connecting such ports by a bond simply implies
that effort and flow variables of interconnected ports are equal. Similarly, information at component control ports can be described by a single control variable
(signal). Connecting an output port of a component to an input port of the other just
means that these two control variables are equal.
In general, the situation is not this simple. Thus, the revolute joint illustrated
schematically in Fig. 2.4a may be used to connect robot links or, a door in a
door-frame. The joint can be represented by a word model (Fig. 2.4b), with ports
representing the parts of the joint provided for the connection.
The function of the joint is to enable rotation of the connected bodies about the
joint axis. To describe the interactions at the joint connection properly, pairs of
effort and flow vectors are used. The effort vector can be represented by three
rectangular components of the forces and torques, and likewise the flow vector by
the rectangular components of linear and angular velocities. The meaning of these
Fig. 2.4 Revolute joint:
a scheme of joint, b word
model representation
26
variables can be explained by dening a detailed model of the joint and the bodies
in question. Hence the connection of a body to the joint can be represented by a
bond, which denotes again that the efforts and flows of connected parts are equal.
This time the power variables are not simple one-dimensional variables, but vector
quantities.
Complex interactions at the ports can also be represented using multidimensional
bond notation known as multibonds [4, 5]. We do not use this approach here, but
instead treat the component ports as compounded. This means that the component
ports are not simply objects, but dene the structure of the mathematical quantities
that describe the processes taking place inside the component. The bond lines
simply dene which port is connected to which, and hence which mathematical
quantities should be equal. To dene the structure of the ports the component model
is developed in more detail.
2.4
The detailed model of a component represented by the word model (Fig. 2.5,
top-left) can be described in a document framed by a rectangle (Fig. 2.5, on the
right). We call it a document because it will be represented on the computer screen
in a document window and saved in a le (Chap. 3). The document title uses the
name of the component that it models. The document contains ports represented by
short strips placed just outside of the frame rectangle. These document ports correspond to the ports of the component: Every component port has a document port.
The component Comp A in Fig. 2.5 has three ports: a power-in port, a power-out
port, and a control-out port. Thus, there are exactly three document ports of the
same type. The document ports are depicted in the positions around frame rectangle
that corresponds to the position of the component ports around the component text
(name). This way it is easy to see which port corresponds to which.
27
28
2.5
2.5.1
The notion of elementary components has already been introduced in Sects. 1.2 and
1.3. These have a simple structure and serve as the building blocks of complex
component models. In the bond graph method such components represent basic
physical processes. Sometimes such components can be used as simplied representations of real components, such as bodies, springs, resistors, coils, or
transformers.
There are, altogether, nine such components that represent underlying physical
processes in a unique way. These are
The standard symbols used for the components are given in the parentheses.
In this way multi-domain physical processes, typical of mechatronics and other
engineering systems, can be modelled in a unied and consistent way. A review of
all the elementary components is given in Fig. 2.6. Components are described by
their constitutive relations in terms of variables and physical parameters.
The components can have one or more power ports. The processes seen at these
ports are described by pairs of power variables: effort e and flow f. In addition,
Fig. 2.6 Elementary components: a inertial, b capacitive, c resistive, d source effort, e source
flow, f transformer, g gyrator, h effort junction, i flow junction
29
certain components have internal state variables. The next sub-sections give a
detailed description of each component (Sects. 2.5.22.5.7). In Sect. 2.5.8 the
controlled elementary components are described, i.e. common components with
added control ports. At the control ports a control variable c is dened that is used
for supplying information to, or extracting information from, the component.
2.5.2
The inertial component is identied by the symbol I and has at least one power port
(Fig. 2.6a). This component is used to describe the inertia of a body in translation or
rotation, or the inductivity of an electrical coil.
The port variables are effort e and flow f. In addition, there is an energy variable,
generalised momentum p, dened by the relationship
e p_
2:1
e dt
2:2
2:3
where I is a parameter. The constitutive relation also can be non-linear, of the form
p Uf ; par
2:4
f U1 p; par
2:5
or, alternatively,
2:6
30
or, alternatively,
fi U1
pj ; par ; i; j 1; . . .; n
i
2:7
e f dt
0
f dp
2:8
2.5.3
The capacitive component is identied by the symbol C and has at least one power
port (Fig. 2.6b). This component is used to model mechanical springs, electrical
capacitors, and similar processes.
The port variables are effort e and flow f. In addition, there is an energy variable,
generalised displacement q, dened by relation
f q_
2:9
Thus, generalised displacement can be viewed as the accumulation of the flow in the
component,
Zt
q q0
f dt
2:10
2:11
2:12
31
or, alternatively,
e U1 q; par
2:13
i; j 1; . . .; n
2:14
ei Ui qj ; par ;
i; j 1; . . .; n
2:15
or, alternatively,
e f dt
0
or by (2.9)
Zt
E q E q0
e dq
2:16
2.5.4
The resistive component is identied by the symbol R and, like the inertial and
capacitive components, has at least one port (Fig. 2.6c). This component models
friction in mechanical systems, or electrical resistors.
The port variables are effort e and flow f. The component constitutive relation is
given by
eRf
2:17
2:18
32
or, alternatively,
f U1 e; par
2:19
i; j 1; . . .; n
2:20
or,
fi U1
ej ; par ;
i
i; j 1; . . .; n
2:21
2.5.5
The Sources
Sources are components that represent power generation (or power sinks) such as
voltage and current sources, certain types of forces (e.g. gravity), volume flow
sources (such as pumps) etc. In these sources efforts or flows are almost independent of the other power variable. It is possible to dene two types of source
components: source efforts, designated by SE; and source flows, designated by SF
(Fig. 2.6d, e). These are, basically, single port components. Denoting the port effort
by e and port flow by f, the corresponding constitutive relations are given by the
following relationships depending on the source type.
2.5.5.1
Source Efforts SE
e E0
2:22
e Ut; par
2:23
f F0
2:24
2.5.5.2
Source Flows SF
33
2:25
In the relationships above, E0, F0, and par are suitable parameters, and U is a
function of time t.
2.5.6
The transformer TF and the gyrator GY are two important components that represent transformations of the power variables between their ports (Fig. 2.6f, g).
Both have two ports; power is directed into the component at one port, and out of
the component at the other. Thus, power is assumed to flow through the component.
An important characteristic of these components is the conservation of power
flow, i.e. power inflow is equal to power outflow. If we denote the corresponding
power ports effort-flow variables by ei and fi (i = 0,1), this fact can be expressed by
the relationship
e0 f 0 e1 f 1
2.5.6.1
2:26
Transformer TF
The transformer models the levers, gears, electrical transformers, and similar
devices. In robotics and multi-body mechanics, transformers are extensively used
for the transformation of power variables between body frames.
In the transformer there is a linear relationship between the same types of port
variables, i.e. effort to effort and flow to flow. Denoting the transformation ratio by
m, we have
e1 m e0
)
2:27
f0 m f1
)
2:28
34
The transformation ratio k in the last pair of the equations is just the reciprocal of
ratio m in the former equations, i.e. k = 1/m. The form to use is left to the discretion
of the modeller.
2.5.6.2
Gyrators GY
The gyrator is similar to the transformer, but relates the different types of ports
variables, i.e. the efforts to flows. Denoting the gyrator ratios by m and k, the
corresponding equations are
e0 m f 1
)
2:29
e1 m f 0
and alternatively,
f 0 k e1
f 1 k e0
2:30
The gyrators have their roots in the gyration effects well known from mechanics.
Their use is essential in rigid-body dynamics. The gyrator is a more fundamental
component than the transformer [1]. Two connected gyrators are equivalent to a
transformer. A gyrator and an inertial component are equivalent to a capacitive
element. Similarly, a source effort connected to a gyrator is equivalent to a source
flow. Using such combinations makes it possible to reduce the set of elementary
components necessary for physical modelling. We do not follow this approach here;
there is little to be gained by using a smaller number of elementary components, as
the resulting model would be more complicated and more abstract than necessary.
2.5.7
Physical processes interact in such a way that there are restrictions on the possible
values that efforts and flows can attain. Many physical laws express such constraints. In mechanics, forces and momentsincluding inertial effectsare governed by the momentum and the moment-of-momentum laws. In electricity, there is
the Kirchhoff voltage law, and there are similar laws in other elds. Similar constraints on flows in rigid body mechanics are governed by the kinematical relative
velocity laws, by the law of continuity of fluid flow in fluid mechanics, the
Kirchhoff current law in electricity, etc. To satisfy such laws elementary components dened previously are connected to the junctions that impose constraints on
efforts or flows. Such junctions are known as effort and flow junctions (Fig. 2.6h, i).
2.5.7.1
35
Effort Junctions
The effort junction is a multi-port component into which power flows in or out. The
traditional symbol for this junction is 1. This junction also is called a common flow
junction because the flows at all junction ports are the same, i.e.
f0 f1 fn1
2:31
2:32
In this equation the plus sign is used for the ports pointing towards the junction
(positive power) and the minus sign for ports pointing away from the junction
(negative power). Using (2.31) we get equation of effort balance at the junction
e0 e1 en1 0
2.5.7.2
2:33
Flow Junctions
The flow junction is similar to the effort junction, with the roles of efforts and flows
exchanged. The flow junction is a multi-port component traditionally denoted by
the symbol 0. This junction is also known as a common effort junction, as the efforts
at all ports are the same, i.e.
e0 e1 en1
2:34
There also holds the conservation of power of flows through the junction (2.32).
Thus, by (2.34) we get an equation of balance of flows at the junction
f0 f1 fn1 0
2.5.8
2:35
Controlled Components
The component constitutive relations introduced so far depend on port and internal
variables only (and time which is the global variable). In many instances it is also
necessary to permit dependence on some external variables. This is the case when
modelling controlled hydraulic restrictions in valves, variable resistors; capacitors,
sources and other controlled components in electronics; and coordinate transformations in multi-body mechanics. For this purpose bond graphs use so called
modulated componentsmodulated source efforts MSE and sources flows MSF,
36
modulated transformers MTF and gyrators MGY. Some authors introduce other
modulated components as well. We do not introduce such special components, but
allow components to have control ports in addition to power ports.
Figure 2.7 shows components with added control ports. The most elementary
components in Fig. 2.6 can have can have an input port. The only components that
cannot have control input ports are effort and flow junctions. The components with
control input ports are called controlled and their constitutive relations (see
Sects. 2.5.22.5.6) depend also on the corresponding control variables. The
transformers and gyrators must satisfy also the power conservation requirement.
But this is not a problem because it is satised not only by constant transformer and
gyrator ratios, but also by the ratios that dependent on a control variable c. Thus,
e.g. the corresponding constitutive relations for controlled transformer and gyrators
can have the same forms as given by (2.27)(2.30), but with variable transformer
and gyration ratios, e.g.
)
e1 mc e0
f0 mc f1
2:36
and,
e0 m c f 1
)
2:37
e1 m c f 0
respectively.
In addition we may dene one specic component called the switch, denoted by
Sw (Fig. 2.7b). This component has one power port and one control input port. The
constitutive relation for the component is
e 0; c [ 0
f 0; c 0
)
2:38
37
where e and f are the power port effort and flow variables of, and c is the control
variable. This component can be viewed as a controlled source that imposes zero
effort or zero flow condition, depending on the sign of the control variable. This
component models hard stops and clearances in machines, switches and relays in
electronics, and possibly other discontinuous processes. The component can be
generalised to allow effort or flow expressions, such as in sources (2.22)(2.25) and
in systems with more complex switching logic than in (2.38).
Finally, control output ports are used to access the component variables that
cannot be accessed other way (Fig. 2.7c). Control output ports are commonly used
for extraction of information on junction variables (efforts or flows). We also use
such ports for access to the internal variables of inertial and capacitive components
(momenta and displacements) and for extraction of information from other components, too.
2.6
2.6.1
38
2.6.2
Continuous-Time Components
2.6.2.1
Input Components
The input components (Fig. 2.10a) generates control input action. These components can have only single control output port. This component generates the output
in the general form
cout Ut; par
2:39
2.6.2.2
Output Components
The output components (Fig. 2.10b) display output signals. They can have one or
more input ports. Typically such components are used for collecting signal for
displaying as x-t and x-y plots. These components can be also represented by
graphical symbols which resemble x-y plotters. Such a component is called
Display.
Fig. 2.10 Basic block diagram components: a input, b output, c function, d integrator,
e differentiator, f summator, g node
2.6.2.3
39
Function Component
2:40
where c0, c1,, cn1 are the inputs, and par are the parameters.
Such a function can be used to represent linear gains, multiplications of the
inputs, or other non-linear operation on the inputs. Often instead of generic symbol
FUN more specic words can be used, which better describe the function, such as k
for k-gains, Limiter for functions that limits the output, etc.
2.6.2.4
Integrator
As its name implies, this component evaluates the time integral of its input
(Fig. 2.10d), i.e.
Zt
cout cout 0
cin tdt
2:41
2.6.2.5
Differentiator
dcin
dt
2:42
40
2.6.2.6
Summator
The summator (Fig. 2.10f) gives the sum of its inputs, with optional positive or
negative signs, i.e.
cout c0 c1 cn1
2:43
At every input port there is associated a plus or minus sign, which indicates
whether the corresponding input is added or subtracted when evaluating the output.
Often instead of s (for summation), more common symbols such as , , or are
used.
2.6.2.7
Node
The node (Fig. 2.10g) serves for branching signals. This component has a single
input and one or more outputs. Usually, instead of symbol n (for node), a large dot
is used.
2.6.3
Discrete-Time Components
Many continuous-time input-output components have their discrete-time counterparts. This is the case with the Input, Output, Function, Summator and Node
components. However, there are components that are specic to discrete-time
processes, in particular digital ones. These are Analog to Digital Converters (ADC),
Digital to Analog Converters (DAC), Clocks and Memory (delay) components
(Fig. 2.11).
The A/D component in Fig. 2.11a describes the quantization of the input signal,
which can be described by the relationship.1
cout q round cin =q
2:44
41
Fig. 2.11 Basic discrete components and ports: a analog to digital converter, b digital to analog
converter, c clock with activation port, d delay, e triggered component
where cin is the analog input signal and cout is the quantized output signal, and q is
the quantization interval (Fig. 2.12). Function round converts the ratio of input
signal and the quantization interval to the lower integer value.
A clock component (Fig. 2.11c) can be used to synchronize the discrete operations in the system. It can be created in the form of a unit integrator, i.e.
Zt
1dt
0
which generates the outputs every sampling interval Ts (Sect. 2.6.3). Note that the
clock has a special port called the activation port which activates the part of the
system following the point of connection of the clock.
As an illustration of the application of the last two components consider the
model of the A/D conversion in Fig. 2.13. The input to the A/D conversion is the
analog signal, and the output is a digital number. If the range of the input is
cinH cinL than the linear gain of M-bit converter is given by [6]
K
2M 1
cinH cinL
2:45
42
Thus, if the input range of 24 bit converter is 2.5 V the linear gain is
3355443 1/V. This gain is represented in Fig. 2.13 by continuous-time function K.
The A/D component converts the scaled output to a discrete value using a
suitable quantization interval. Ideally, the quantization interval should be based on a
number of possible binary values, i.e. q = 1 bit. However, due to noise such low
resolution cannot be achieved. The minimum change in input voltage required to
guarantee a change in the discrete output value is called the least signicant bit
(LSB). Thus in the above example if the LSB is 5 V (ideally it is 1/K 0.3 V) the
corresponding quantization interval q = 5 V 3355443 V1 17 bits. The
Limiter limits the converter output to a maximum and minimum binary values
that the converter can generate. Finally, there is a clock connected to the corresponding node. The clock denes the sampling rate of the converter and the starting
and ending activation times.
The D/A component in Fig. 2.11b converts a discrete-time signal to the corresponding continuous-time one. There are various possible ways how to do this. The
most popular way to generate the signal values over the next sampling interval is to
hold the value of the signal at the constant value. Because the constant is zero-order
polynomial this method is known as zero-order hold. Sometimes a linear interpolation is used (rst-order hold), but it is generally accepted that zero-order hold is
satisfying and is widely used. Note that there is a scaling involved between the
digital input and analog output, and a similar gain function should be applied as in
Fig. 2.13.
An important component that is often used in digital systems is the delay or D
component (Fig. 2.11d). This component stores the current input value into a
corresponding memory location. Because this value is available at the next sampling interval it is described by the relationship
cout k cin k 1;
cout 1 cin 0 c0
k[1
)
2:46
Therefore, the output of the component at the current sampling instance is equal
to the value of the input at the previous instance. This function is, therefore, a unit
delay function. In order to be dened at the rst sample instance, i.e. when k = 1, it
is necessary to dene the initial value of the input, cin[0]. The D function is analogous to the integrator in continuous-time processes (2.41).
The discrete components discussed so far are fundamental to modelling discrete
(digital) processes. It is possible of course to dene additional more specic
43
2.7
The approach outlined in the previous sections can be used for the systematic
computer-aided model development of engineering problems. We apply this
approach to two simple, well-known problems, one from mechanical engineering
and the other from electrical engineering. The technique is compared with the
common bond graph modelling technique as given e.g. in [1]. We also consider a
more complicated practical example from mechanical engineering (the See-saw
problem).
2.7.1
44
Fig. 2.14 Body spring damper system: a schematic representation, b free body diagram
corresponding Body port by a bond. There is also a control-out port on the Body
which is used to extract information on the body position. This port is connected to
the Out(put) port for display of body position during the simulation.
The model at this level of abstraction has a structure that closely corresponds to
the scheme of the system in Fig. 2.14a. The direction of power flow in the model is
taken from the SE through the body, then through the spring and damper, and
nally to the wall.
45
This corresponds to the physical situation in Fig. 2.14b. If the sense of the
external force and the body velocity are as shown, the power at the external force
port is positive; i.e., it is directed into the body. Assuming that the spring and
damper resist the movement of the bodyi.e., the sense of their forces is opposite
to that of the body velocitythe powers at the corresponding ports are negative,
and the power port arrows are directed out of the body. At the spring and damper
ports, power again is positive, flowing into these components. Because of the
direction of the bodys force, according to Newtons Third Law their forces act in
the opposite sense. A similar conclusion can be drawn regarding the wall side ports.
Hence, by joining mechanical ports Newtons Third law is satised. Thus, to
construct the bond graph model it is not necessary to draw the free-body diagram at
all.
Next we develop the component models (Fig. 2.15). The force generated by the
spring depends on the relative displacement (extension) of the spring. Thus, the
model of the spring can be represented by a flow junction with three ports, two for
connecting internally to the spring end ports and the third for the connection of the
capacitive element that models the elasticity of the spring (Fig. 2.15 Spring). The
junction variable is the force Fs in the spring; and the extension of the spring xs is
the generalized displacement of the capacitive element, with spring stiffness k taken
as the element parameter. Thus, the constitutive relations for the capacitive element
are (see (2.9) and (2.11))
vs x_ s
2:47
Fs k xs
2:48
and
2:49
The third component of the system is the body of mass m (Fig. 2.15 Body). This
component uses an effort junction to describe the balance of forces applied to the
body including the inertial force of the body. This junction has four power ports:
three for internal connections to the body ports and fourth for the connection of an
inertial element. Denoting the body velocity taken as the junction variable by v (see
Fig. 2.14a) and the inertial force of the body of mass m taken as parameter by Fb,
the constitutive relations of the inertial element are (see (2.1) and (2.3))
46
Fb p_ b
2:50
pb mv
2:51
and
To calculate the body position, a control output port is added to the junction, and
the junction variable is fed to an integrator that outputs the body position x. The
corresponding equation can be written as
x_ v
2:52
The next component is simply the source effort element SE, which generates the
driving force on the body
F Ut
2:53
The spring and damper are connected to the xed wall. The model of the wall is
given in Fig. 2.15 Wall. The component uses an effort junction with three ports,
which describes the force balance at the wall. Two ports serve for the internal
connection to the wall ports, where the spring and damper are connected, and the
third is for connecting to the source flow, which imposes a zero wall velocity
condition. The junction velocity is vw. Thus, the relation for the source flow is
vw 0
2:54
To complete the mathematical model of the system the equations of the effort and
flow junctions are added. Corresponding variables can be found by following the
bonds connected to junction ports until some elementary component is found that
completes the bond. Thus, for the body effort junction in Fig. 2.15 Body, the port
effort variables are the spring force Fs, damper force Fd, inertia force Fb and driving
force F, respectively. The equation of the effort balance at the junction thus reads
Fs Fd Fb F 0
2:55
If we denote by Fw the total force at the wall, the equation of effort balance at the
wall junction reads (Fig. 2.15 Wall)
Fs Fd Fw 0
2:56
A similar equation can be written for the flow junctions. This time the summation is on the flows. Thus, we have (Fig. 2.15 Spring)
vw vs v 0
2:57
47
2:58
We, therefore, may describe the motion of the system by eight equations of
elements that describe the physical processes in the system, i.e. (2.47)(2.53), and
four equations which involve the junctions (2.54)(2.58). There are, altogether,
twelve differential and algebraic equations that have to be satised by twelve
variables: Fs, vs, xs, Fd, vd, Fb, v, pb, F, Fw, vw and x. Although we have arrived at a
relatively large number of equations of motion for this simple problem, the equations are very simple, having on average only 27/12 = 2.25 variables per equation.
The structure of the matrix of these equations is very sparse; this simplies the
solution process. We can simplify these equations further. Direct processing can be
used to eliminate some, or all, of the algebraic variables (i.e., variables that are not
differentiated). We can also simplify the bond graph rst, and then write the corresponding equations. We consider the second approach in more detail, as it leads
to the sort of bond graphs usually found in the literature.
We can simplify the model by substituting every component at the top of
Fig. 2.15 by its corresponding model, given at the bottom part of the same gure.
The resulting bond graph is shown in Fig. 2.16a.
The source flow on the left imposes zero wall velocity; thus, we can remove the
effort junction and the source flow, as well as the two bonds connecting to the flow
junctions. We also remove the corresponding ports at the junctions. This yields a
bond graph represented by Fig. 2.16b. We should also eliminate these flow junctions, for they are trivial, having only one power input port and one power output
port. Thus, the C and R element ports can be connected directly to the effort junction
ports on the right. This results in the bond graph of Fig. 2.16c.
The model in Fig. 2.16c is much simpler than that in Fig. 2.15. The resulting
equations now consist of
9
v x_ s
>
>
>
>
>
>
F s k xs
>
>
>
>
>
Fd b v
>
>
>
=
Fb p_ b
2:59
>
pb m v
>
>
>
>
>
F Ut
>
>
>
>
Fs Fd Fb F 0 >
>
>
>
;
x_ v
We have reduced the system to eight equations with eight variables Fs, xs, Fd,
Fb, v, pb, F, and x. This was achieved, however, by eliminating some variables that
can be of interest, e.g. total force transmitted to the wall. This bond graph can be
48
developed directly from Fig. 2.16a by the application of classical methods of bond
graph modelling, as explained in [1].
Using this form of bond graph model, the equations of motion of the system can be
developed in an even simpler form than that given above. It should be noted, however, that this is not true in general for engineering systems of practical interest. We
address this matter in more detail in Sects. 2.9 and 2.10. The reduced model is, on the
other hand, much more abstract. This makes it more difcult to understand and
interpret: Unlike the component model of Fig. 2.15, there is no topological similarity
to the system represented in Fig. 2.14a. A change in any part of the model affects the
complete model. On the other hand, in the model of Fig. 2.15 we can change some of
the components, leaving the others unchanged. Such a model can be rened much
more easily, thereby retaining the overall topological similarity to the physical model.
2.7.2
The second example considers the electrical Resistor Inductor Capacitor circuit
(RLC circuit) shown in Fig. 2.17. The circuit consists of a series connection of a
49
50
In the case of the resistor, the junction variable is the current iR flowing through
the component, and the voltage drop is VR. Thus, the constitutive relation for the
resistor is given by (2.17)
VR R iR
2:60
2:61
51
and
pL L i L
2:62
2:63
Finally, for the capacitor, the junction variable is the current iC through the
component and the voltage drop is VC. If we denote the capacitor charge by qC, the
constitutive relations can be written as (see (2.9) and (2.11))
iC q_ C
2:64
VC qC =C
2:65
and
2:66
If we start from any of the component effort junctions and follow the bonds
connected internally to the port, then out of the component to the next component
port, and again into the component, we nd that all effort junctions are interconnected. We, thus, can treat all these junctions as a single junction, the result being
that all junction variables are, in essence, the same variable, i.e.
i iR iL iC
2:67
Counting only ports connected to other components, the balance of efforts reads
as follows
VG E VR VL VC VG 0
2:68
2:69
52
Finally, if we denote the current drawn by the ground by iG, the balance of flows
at the node reads
i iG i 0
2:70
2:71
This lengthy derivation shows that we arrive at the circuit equation by using the
constitutive equations for elementary components and symbolically simplifying the
junction equations. Thus, the mathematical model of the circuit consists of nine
differential-algebraic equations (2.60)(2.66), (2.69), and (2.71) with nine variables
E, VR, i, VL, pL, VC, qC, VG and iG. Equations (2.66) and (2.71) are trivial and could
be eliminated from the system.
As in the previous example, we can simplify the bond graph instead of the
equations. We rst substitute the bond graph model of the components from the
lower part of Fig. 2.18 into the system bond graph at the top. Also the node is
changed to the flow junction and the ground to source effort. We thus obtain bond
graph shown in Fig. 2.19a.
53
We again see that the four effort junctions are interconnected and can be condensed into a single junction, retaining only the ports connected to other components. In addition, we see that this junction is connected to the same flow junction
by two ports of opposite power-flow sense. Hence, such ports can be disconnected,
and then removed. The corresponding ports of the flow junction must be removed,
too. This yields the bond graph shown in Fig. 2.19b. We now have a flow junction
connected only to a ground source effort. These can be removed, too. This results in
the nal simplied system bond graph (Fig. 2.19c). The last bond graph can be
described by the same equations as before, but without (2.66) and (2.71).
The above procedure shows that, instead of the simplication of junction (2.68)
and (2.70), we could directly arrive at (2.69) and (2.71) by noting that interconnected effort junctions are connected to the same flow junction. Corresponding
junction ports then could be treated as internal, and not taken into account when
writing the junction equations.
Comparing bond graphs in Figs. 2.18 and 2.19c, we draw similar conclusions as
in the previous example: The model in Fig. 2.18 is much easier to interpret and
upgrade. Even people who are not too familiar with bond graphs could understand
such a model. On the other hand, it retains the advantages that bond graphs enjoy
over other modelling methods.
2.7.3
A See-Saw Problem
54
55
The inertial effects of the bodies in the x- and y-directions are represented by the
inertial elements I connected to the corresponding effort junctions, with power flow
directed into the inertial elements. The weights of the bodies, acting in the y direction only, are represented by source efforts connected to the y component
junctions, with power flow directed into the junctions. The equations of motion of
the bodies can be obtained directly from the bond graphs of Fig. 2.22. The masses
of the bodies are m1 and m2, and g is the gravitational acceleration. The relevant
variables are also shown in the gure.
Body 1:
p_ b1x Fb1x
p_ b1y Fb1y
pb1x m1 v1x
pb1y m1 v1y
G1y m1 g
F1x Fb1x 0
F1y Fb1y G1y 0
9
>
>
>
>
>
>
>
>
>
>
>
=
>
>
>
>
>
>
>
>
>
>
>
;
2:72
Body 2:
p_ b2x Fb2x
p_ b2y Fb2y
pb2x m2 v2x
pb2y m2 v2y
G2y m2 g
F2x Fb2x 0
F2y Fb2y G2y 0
9
>
>
>
>
>
>
>
>
>
>
>
=
>
>
>
>
>
>
>
>
>
>
>
;
2:73
56
The Frame simply xes the pivot, about which the platform rotates, against
translation and rotation (Fig. 2.23). The equations are:
Frame:
9
vPx 0 >
=
vPy 0
>
;
xP 0
2:74
The Pivot allows rotation only about the pin (Fig. 2.24). Two flow junctions
are inserted to extract information on pin force components. Rotation is assumed
frictionless, but friction can be added if required, e.g. by a resistive component R
used instead of the source effort. The relative angular velocity of the platform is
denoted by r.The signal taken from the effort junction is integrated to get the
platform rotation angle /. The governing equations are again very simple:
57
Pivot:
9
v3x vPx 0 >
>
>
>
v3y vPy 0 >
>
>
>
>
x xP xr 0 =
MP MR 0 >
>
>
>
>
MR 0 >
>
>
>
_/ xr ;
2:75
xC
!
2:76
yC
Orientation of the body is dened by the rotation matrix (see e.g. [7])
R
cos u
sin u
sin u
cos u
2:77
58
The vector of the position of a point P in the body with respect to the origin of
the body frame can be expressed in the body frame by a vector of its coordinates
rCP
xCP
yCP
!
2:78
The position of the same point P with respect to the global frame is dened by
the vector of its global co-ordinates
rP
xP
!
2:79
yP
2:80
Note that vector rCP is the relative vector expressed in the global frame, i.e.
rCP
xCP
!
2:81
yCP
The relationship between the vectors of (2.78) and (2.81) is given by the
co-ordinate transformation
rCP RrCP
2:82
Substituting the rotation matrix of (2.77) and evaluating the resulting expression
yields
xCP
yCP
2:83
The velocity of a point P in the body can be found by taking the time derivative
of (2.80), i.e.
vP vC vCP
2:84
which relates the velocity of the point P to the velocity of the origin C of the body
frame and to the relative velocity of the point P with respect to the point C. These
velocity vectors are expressed by their components in the global frame as
vP
vPx
!
vC
vPy
59
vCx
vCy
vCP
vCPx
vCPy
!
2:85
drP
;
dt
vC
drC
;
dt
vCP
drCP
dt
2:86
Taking the time derivative of (2.82), and noting that rCP is a constant vector, we
arrive at the expression for the relative velocity of point P:
vCP
dR
rCP
dt
2:87
dt
sin u
cos u
cos u
sin u
du
dt
2:88
The time derivative of the body rotation angle is the body angular velocity
x
du
dt
2:89
2:90
!
2:91
yCP
xCP
!
2:92
Equations (2.84) and (2.89)(2.91) are the basic relations describing the kinematics of rigid body motion in a plane. Next, we consider the kinetic relationships
relating the forces and moments applied to the platform.
A force F applied to the platform can be described by a vector of its rectangular
components in the global frame, i.e.
60
Fx
Fy
2:93
The power delivered at point P is given by vTPF, where the superscript T denotes
matrix transposition. From (2.84) and (2.90) we get
vTP F vTC F TT Fx
2:94
Evaluating the leading part of the second term on the right of (2.94) yields
TT F yCP Fx xCP Fy
2:95
2:96
2:97
This equation can be read as a statement of force equivalents, well known from
Engineering Mechanics (see e.g. [8]). That is, a force applied at a point P is equivalent
to the same force applied at a different point C plus the moment of force about C. If at
point P a torque also acts, its moment MP should be added, too. Equations (2.96) and
(2.97), jointly with (2.84) and (2.89)(2.91), constitute the fundamental equations of
rigid-body motion in a plane. To complete the dynamical equations we need to add
the inertias of translation and rotation. These equations clearly show how to represent
the dynamics of the platform (see Fig. 2.26 Platform).
At every point of application of a force (platform ports) we introduce a component 0 corresponding to summation of the velocities, as given by (2.84). These
components contain two flow junctions. The corresponding junction variables are
the x and y components of the force at the port (Fig. 2.26 0). The effort junction 1 is
used to represent the angular velocity of the body, and the component CM
describing the motion of the mass centre (Fig. 2.26 Platform and CM). We
connect the junctions 0 to the angular velocity junction 1 by the components
LinRot, and to the mass centre motion component CM.3
The LinRot components represent the linear to rotation transformations given
by (2.90) and (2.96). The components consist of two transformers, which implement the transformations by matrix given by (2.91), and an effort junction that sum
up the moments according to (2.96) (see Fig. 2.21 LinRot). The necessary
Because of space limitation, only one of the 0 and LinRot components are shown. The others
have a similar structure.
3
61
information on the angle of rotation of the see-saw platform is taken from the input
port. In addition to these force effects, any moment at a port is transmitted directly
to the rotation effort junction 1. An inertial element added to the junction represents
the rotational inertia of the platform with respect to mass center. The body translation inertia with mass center is represented by component CM which consists of
two effort junctions that add inertial elements corresponding to the x and y motion
(Fig. 2.26 CM). The platform gravity is also added there.
The mathematical model of the platform can be written directly from the
Fig. 2.26. Respective variables are given in the gure and parameters a, b, and c are
dimensions shown in Fig. 2.25; m is the platform mass, and IC is its mass moment
of inertia about its mass centre.
The equations read:
Platformleft side:
v1x vC1x vCx 0
v1y vC1y vCy 0
vC1x a sin u c cos u x
vC1y a cos u c sin u x
M1x a sin u c cos u F1x
9
>
>
>
>
>
>
>
>
>
>
>
=
>
>
>
>
>
>
>
>
M1y a cos u c sin u F1y >
>
>
;
MC1 M1x M1y 0
2:98
62
Platformright side:
9
>
>
>
>
>
>
>
>
>
vC2x a sin u c cos u x >
>
=
vC2y a cos u c sin u x
>
>
M2x a sin c cos u F2x >
>
>
>
>
>
M2y a cos u c sin u F2y >
>
>
;
MC2 M2x M2y 0
2:99
Platformupper side:
9
v3x vC3x vCx 0 >
>
>
>
v3y vC3y vCy 0 >
>
>
>
>
vC3x b cos u x >
>
=
vC3y b sin u x
>
>
M3x b cos u FPx >
>
>
>
>
>
M3y b sin u FPy >
>
>
;
MC3 M3x M3y 0
2:100
9
>
>
>
>
>
>
>
>
>
>
>
=
>
>
>
>
>
>
>
>
>
>
>
;
2:101
Platformrotation:
K_ C MC
9
>
=
KC IC x
>
;
MC1 MC2 MC3 MP MC 0
2:102
63
2.8
2.8.1
64
Fig. 2.28 Causality assignment: a and c possible stroke attachments, b and d meaning of the
attachments
the cause, and currents in circuits as effects. The assignment of causality can be
looked on as a convenientbut not an essentialpart of the modelling task.
Further it is arguable that it is convenient at all, in particular when using the
object-oriented paradigm in simulation model building. We nevertheless briefly
describe causality and its consequences in bond graphs because of their close
connection with bond graph theory (see e.g. [1, 2]).
Causality means that, at every port of an elementary component, one of the
power variables is the input (cause) and the other is the output (effect). Because
bond lines in bond graphs connect the ports, the same variable is the input variable
at one port and the output variable at the other connected port. Causal relationships
between connected port variables are depicted in the bond graph literature by causal
strokes. These are short lines drawn at one bond end (port) perpendicular to the
bond (Fig. 2.28). This stroke denotes that the effort at the port is the input to the
element and the flow variable is the output (Fig. 2.28a, b). At the other port just the
opposite relation is valid; that is, the flow variable is the input and the effort variable
is the output. Causal stroke assignment is independent of the power flow direction
(Fig. 2.28a, c).
2.8.2
65
Zt
p p0
edt
0
f U1 p; par
9
>
>
>
=
>
>
>
;
2:103
)
2:104
This type of causality is known as differentiation causality because differentiation is used to calculate the output.
Analogous causal forms exist for capacitive ports. If we take the flow variable as
input and the effort variable as output (Fig. 2.29e), by (2.10) and (2.13) we have
Zt
q q0
fdt
0
e U1 q; par
9
>
>
>
=
>
>
>
;
2:105
In this case we have integrating causality. On the other hand, if effort is the input
and flow is the output (Fig. 2.24f), the calculation proceeds by (2.12) and (2.9), i.e.
66
q Ue; par
f q_
)
2:106
2:107
On other hand, if the effort is input (Fig. 2.29h) and the flow is output, calculation is implemented by (2.19), i.e.
f U1 e; par
2:108
The rst one is sometimes called resistive causality, and the other conductive
causality. Preference of one over the other depends on which form is better dened,
as some non-linear constitutive relationships are not invertible.
Transformers can also have two possible types of causality. If the effort at one
port is the input, then at the other port the effort has to be the output; the same
applies to the flows. For causality as expressed in Fig. 2.29i, the constitutive
relations are given by (2.27), i.e.
e1 m e 0
f0 m f1
)
2:109
On other hand, if causality is as in Fig. 2.29j, the constitutive relations are given
by (2.28), i.e.
e0 k e1
f1 k f0
)
2:110
Two possible causalities for gyrators are shown in Fig. 2.29k, l, respectively.
Inputs at the gyrator ports can represent either the efforts or the flows. For the case
in which inputs are efforts, output flows are given by (2.30), i.e.
f 0 k e1
f 1 k e0
)
2:111
67
Similarly, if the inputs are flows, the output efforts are given by (2.29), i.e.
e0 m f 1
e1 m f 0
2:112
Effort junctions represent the balance of efforts at the junction ports. Hence, one
effort can only be the output at one port; all others must be inputs. For the effort
junction in Fig. 2.29m, the effort at port 2 is taken as the output and all others are
inputs. Thus, output effort e2 is given by
e2 e0 e1
A similar statement holds for the flow junctions: Flow can only be the output at
one port; all other flows must be inputs. For the flow junction in Fig. 2.24n, the
output flow f1 is given by
f1 f0 f2
In the expression for output effort or flow, the sign of all input efforts or flows
should be positive if the sense of the power flow is opposite to the sense of the
output power flow. Otherwise, the sign is negative.
2.8.3
The causalities of junction, transformer, and gyrator ports are interrelated and thus
imply constraints on the causalities of connected elements. The causalities of the
complete bond graph can be assigned in a systematic way. The usual procedure is
known generally as the sequential causal assignment procedure (SCAP) [1]. This
procedure is summarised as follows:
1. Choose a source effort or source flow and assign causality to it. Extend the
causality assignment, if possible, to the connected effort and flow junctions, the
transformers, and the gyrators. Proceed in a like fashion until the causality of all
sources has been assigned.
2. Choose an inertial or a capacitive element and assign to it the preferred (integrating) causality. Extend the causality assignment as in 1. Proceed until the
causality of all such elements has been assigned. Otherwise, if the causality
assignment of the all bonds is not achieved, go to the next step.
3. Assign causality to an unassigned resistor using any acceptable causality.
Extend the assignment to the connected effort and flow junctions, transformers,
and gyrators. Proceed until the causality of all resistors has been assigned.
Otherwise, if the causality of all bonds is not already assigned, go to the next
step.
68
69
is the input to the capacitor and the resistor used to calculate their outputs. These,
together with the source effort output, are used to calculate the output of the effort
junction, hence the inertial element input. Independently, it is used as input to the
integrator to calculate body position.
2.9
The bond graph of a system completely denes its mathematical model. In Sect. 2.7 it
was shown that the model could be generated directly from the bond graph by
describing the elementary components, including junctions, in terms of their constitutive relations. This way of representing mathematical models is known as the
descriptor form [9] and is widely used in electrical circuits. This is a non-minimum
form because the equations are not expressed using the minimal number of variables.
Some variables could be eliminated, e.g. by substituting into the equations of flow and
effort junctions. This approach is in effect used in modied nodal analysis (MNA) of
electrical circuits [10, 11]. This also is the case with certain approaches used in
multi-body dynamics [7]. In Sect. 2.7 it was shown that the matrix of the equations is
typically very sparse, and this can be used to advantage in their solution.
The descriptor form of equation formulation leads to the model in the form of
systems of differential-algebraic equations (DAEs). The success or failure of the
descriptor formalism depends to a large extent on the possibility of solving equations in DAE form efciently and reliably. Solving such equations has a relatively
long history and started with the famous DIFSUB routine of CW Gear [12] for stiff
systems. The work reported in this book also has its roots in software that solves
DAEs in a way that is based on the DIFSUB routine. From that time signicant
advances have been achieved in the theory of DAEs and their application [13, 14].
Today this is a viable approach to solving simulation models. We return to this
again in Chap. 5.
Another common approach is to formulate the system in state space form. This
technique uses a minimal set of independent variables to formulate the governing
equations. It has its roots in the generalised coordinate methods of Analytical
Mechanics [15], but it also is used widely, and is perhaps better known, from
70
Control Theory. The theory of state-space equations has been a topic of research for
a long time and is well understood. This approach is followed not only in bond
graph theory, but is also used in many continuous system simulation languages
(Sect. 1.7).
The usual approach in continuous system simulation languages is to create a
system of sorted equations that is solved sequentially. Such systems can be solved
relatively easily. Unfortunately, in many engineering problems of practical interest
it is not easy to put the equations in such a form.
The sequential causal assignment procedure of Sect. 2.8.3 was really designed as
an aid to the generation of mathematical model equations in sorted form. From that
the equations can be reduced to the state space form. The bond graphs with
completed causality assignment can be put in such a form if inertial and capacitive
elements have integrating causality, and if there are no algebraic loops [1, 16]. We
illustrate this with the body-spring-damper system represented by the causal bond
graph of Fig. 2.30d (or, equivalently, by the block diagram of Fig. 2.31). More
elaborate examples can be found elsewhere [1].
We start with the source effort (sixth of (2.59)), following the order of causal
assignment of Sect. 2.8,
F Ut
2:113
The output of the inertial element I is given by (see (2.103) and fth (2.59))
v pb =m
2:114
The variable v (by the effort junction) is used as the input to the capacitor C,
resistor R, and the integrator. The order of evaluation of these elements is immaterial. From the rst (2.105), written in derivative form, or rst (2.59), we get
x_ s v
2:115
Output of the capacitor is given by the equation (see (2.105) and second (2.59))
Fs k xs
2:116
2:117
Hence, all the inputs to the summator are found and we can calculate its output
as
Fb F Fs Fd
2:118
71
The output of the summator is the input to the inertial element. Thus, from the
rst equation of (2.103), written in differential form, or fourth (2.59), we get
p_ b Fb
2:119
To these equations we add the output of the integrator written as (the last (2.59))
x_ v
2:120
b
pb
m
2:121
Finally, substituting from (2.113), (2.116), and (2.121) into (2.118) we obtain
Fb Ut k xs
b
pb
m
2:122
We now substitute these expressions into the differential equations (2.115), (2.119),
and (2.120). We, thus, obtain
x_ s pb =m
p_ b Ut k xm
x_ pb =m
2:123
b
pb
m
2:124
2:125
Note that (2.123) and (2.125) has the same form, but generally different initial
conditions, because the rst refers to the spring extension, and the second to the
body position.
Equations (2.123)(2.125) represent the model in the state-space form. Variables
xs, pb and x constitute a minimal set of independent variables that completely dene
the state of the system. Solving these equations with suitable initial conditions, the
all other variables can be found from (2.113), (2.114), (2.116)(2.118).
72
In general, if all capacitive and inertial ports have integrating causality, then the
corresponding differentiated variables, i.e. generalised moments and displacements
of Sects. 2.5.2 and 2.5.3 can be looked upon as independent variables where
accumulation of past histories of the efforts and flows take place. Such variables
completely determine the future state of the system and usually are called state
variables. All other variables can then be determined if the state of the system is
known. If, in addition, there are no algebraic loopsthat is, there are no implicit
algebraic equations between variablesthen all other variables can be eliminated
from the governing equations. Thus, if all state variables are represented by a vector
p and all external inputs (represented by the sources) by a vector u, then a change of
system state can be described by a vector equation
p_ Up; u; t
2:126
where U is a suitable vector-function of the state, inputs, and eventually time. This
is an ordinary differential equation that can be solved given the initial state of the
system. Such an equation is termed the state-space equation of the system.
2.10
The sequential causal assignment procedure (SCAP) of Sect. 2.8.3, in many cases
of practical interest, leads to a causally augmented graph that cannot be described
by equations in state space form [1, 17, 18, 19]. We illustrate this using the
examples of Sect. 2.7.
We rst analyse the electrical circuit of Fig. 2.18, but with the resistor replaced
by a diode (Fig. 2.32a).
If we model the diode as a non-linear resistor, we get the equivalent causally
augmented bond graph shown in Fig. 2.32b (see Fig. 2.19c). The problem here is
that the diode is a non-linear element normally described in conductive form, i.e.
the diode current is a function of the voltage across the diode. It is thus in conflict
with the assigned causality that implies resistive causality. In order to resolve
conflicts caused by non-linear elements, the relaxed causal assignment procedure
was proposed in [20] and its modication in [21]. This procedure requires that, at
step 2 of the SCAP (Sect. 2.8.3), propagation of causalities over junctions may not
violate the xed causality of non-linear elements. Thus, applying the causal
assignment procedure again results in the augmented bond graph of Fig. 2.32c. The
conflict caused by the xed causality of the diode disappears, but a causal conflict
appears at the effort junction because there is more than one output. Thus, the
equation corresponding to the effort junction constitutes an algebraic constraint that
the variables have to satisfy. The procedure permits casual conflicts at effort or flow
junctions as an indication that the mathematical model is of the
differential-algebraic equations (DAE) form, rather than of the state space form.
2.10
73
In the see-saw problem (Sect. 2.7.3) there also is a causality problem. The
see-saw is a single-degree-of-freedom mechanical system. The motions of the
bodies depend on the motion (rotation) of the platform, which is represented in
Fig. 2.26 by the LinRot transformers. To show this we apply the SCAP to the
bond graph of Fig. 2.27. The resulting causally augmented bond graph is shown in
Fig. 2.33. There is only one inertial element with integrating causality. All others
have differential causalities.
This bond graph is rather complicated, so numbers are used to indicate the order
of the causality assignments. Selection of the preferred (integrating) causality for
one inertial element, e.g. the platform rotation, implies derivative causalities for all
other inertial elements. Hence, there is only one state variable and all other generalized variables are non-state variables. The model again is a system of
differential-algebraic equations.
There have been attempts to resolve causality conflicts by, for example, adding
parasitic compliances or inertias [22, 23]. This is not an acceptable approach,
however, because, in the rst instance, it is not clear how to do this without
adversely changing the model behaviour. On the other hand, such modied models
are not much easier to solve numerically than the corresponding DAE models
because they are very stiff.
The causality assignment denes the models computational scheme based only
on the models structure. In cases in which the model changes sufciently, such a
priori schemes can lead easily to a loss of efciency and even failure of the equation
solving routines. This is the case with models that have discontinuities.
Discontinuities are present in engineering systems in various forms, e.g.
switches in electrical circuits, hard stops, clearances, and dry friction. For example,
74
2.10
75
References
1. Karnopp DC, Margolis DL, Rosenberg RC (2000) System dynamics: modeling and simulation
of mechatronic systems, 3rd edn. Wiley, New York
2. Thoma J, Bousmsma BO (2000) Modelling and simulation in thermal and chemical
engineering, a bond graph approach. Springer, Heidelberg
3. Borutzky W (2010) Bond graph methodology: development and analysis of multidisciplinary
dynamic system models. Springer, Berlin
4. Breedveld PC (1982) Proposition for an unambiguous vector bond graph notation. J Dyn Syst
Measure Control 104:267270
5. Fahrenthold EP, Wargo JD (1991) Vector and tensor based bond graphs for physical systems
modeling. J Franklin Inst 328:833853
6. Analog-to digital converter. http://en.wikipedia.org/w/index.php. Accessed 22 Apr 2014
76
7. Haug EJ (1989) Computer-aided kinematics and dynamics of mechanical systems, Vol I: basic
methods. Allyn and Bacon, Needham Heights
8. Beer FP, Johnson ER (1990) Vector mechanics for engineers, 2nd SI edn. McGraw-Hill Book
Co., Singapore
9. Newcomb RW (1981) Semistate description of nonlinear and time variable circuits. IEEE
Trans Circuit Syst CAS-26:6271
10. Mrtz R, Tischendorf K (1997) Recent results in solving index-2 differential-algebraic
equation in circuit simulation. SIAM J Sci Comput 18:135159
11. Vladimirescu A (1994) The spice book. Wiley, New York
12. Gear CW (1971) Numerical initial-value problems in ordinary differential equations. Prentice
Hall, Englewood Cliffs
13. Brenan KE, Cambell SL, Petzold LR (1996) Numerical solution of initial-value problems in
differential-algebraic equations, classics in applied mathematics. SIAM, Philadelphia
14. Hairer E, Wanner G (1996) Solving ordinary differential equations II, stiff and
differential-algebraic problems, 2nd Revisited edn. Springer, Heidelberg
15. Goldstein H (1981) Classical mechanics, 2nd edn. Addison-Wesley Publishing Co., Reading
16. Rosenberg RC (1971) State-space formulation of bond graph models of multiport systems.
Trans ASME J Dyn Syst Measure Control 93:3540
17. Van Dijk J, Breedveld PC (1991) Simulation of system models containing zero-order causal
pathsI. Classication of zero-order causal paths. J Franklin Inst 328:959979
18. Van Dijk J, Breedveld PC (1991) Simulation of system models containing zero-order causal
pathsII. Numerical implications of class 1 zero-order causal paths. J Franklin Inst 328:981
1004
19. Gawthrop P, Smith L (1996) Metamodelling: bond graphs and dynamic systems. Prentice
Hall, Hemel
20. Joseph BJ, Martens HR (1974) The method of relaxed causality in the bond graph analysis of
nonlinear systems. Trans ASME J Dyn Syst Measure Control 96:9599
21. Van Dijk J, Breedveld PC (1995) Relaxed causality a bond graph oriented perspective on
DAE-modelling. In: Cellier FE, Granda JJ (eds) International conference on bond graph
modeling and simulation. Las Vegas, Nevada, pp 225231
22. Margolis D, Karnopp D (1979) Analysis and simulation of planar mechanisms using bond
graphs. ASME J Mech Des 101:187191
23. Zeid A, Chung CH (1992) Bond graph modelling of multibody systems: a library of
three-dimensional joints. J Franklin Inst 329:605636
24. Borutzky W (1995) Representing discontinuities by sinks of xed causality. In: Cellier FE,
Granda JJ (eds) International conference on bond graph modeling and simulation. Las Vegas,
Nevada, pp 6572
25. Cellier FE, Otter M, Elmqvist H (1995) Bond graph modeling of variable structure systems.
In: Cellier FE, Granda JJ (eds) 1995 International Conference on Bond Graph Modeling and
Simulation. Las Vegas, Nevada, pp 4955
26. Lorentz IF, Haffaf H (1995) Combination of discontinuities in bond graphs. In: Cellier FE,
Granda JJ (eds) International conference on bond graph modeling and simulation. Las Vegas,
Nevada, pp 5664
27. Mosterman PJ, Biswas G (1998) A theory of discontinuities in physical systems models.
J Franklin Inst 335B:401439
28. Soderman U, Stromberg JE (1995) Switched bond graphs: towards systematic composition of
computational models. In: Cellier FE, Granda JJ (eds) International conference on bond graph
modeling and simulation. Las Vegas, Nevada, pp 7379
Chapter 3
An Object-Oriented Approach
to Modelling
3.1
Introduction
This Section describes the principles of object-oriented design based on the bond
graph technique. The idea is to perform the modelling visually, without any coding;
all the interaction between the modeller and the model will be through a visual
development environment.
We do not develop a new modelling language, but instead design the classes that
are used to create a structured model as a tree of linked objects. This will be stored
as a set of linked les. It is not necessary to have the complete model in memory, as
parts are loaded as required.
It is very important during the development phase to relieve the user of certain
implementation details, such as how to create components, where and how to store
data, etc. These operations are automated. The user communicates with the model
in familiar terms, e.g. by the names of a project and of its components, how they are
connected, and by dening component constitutive relations in terms of variables
meaningful to the user. The developer thus concentrates on the problem. The
modelling environment (framework) provides as much support as possible to full
this task.
3.2
The concept of component model plays a central role in our approach to modelling
[1].1 The model of a component is created in two steps (Sect. 2.2). First, a component object is created as a word model. Next, by opening the component, the
associated document object is created. The document describes the component
1
This is not to be confused with Microsofts Component Object Model (COM) [2].
77
78
model in terms of a bond graph. It contains lists of the word model components and
interconnecting bonds that constitute a bond graph model of the component. The
component and its associated document are intimately related and are used as the
engine for systematic model development either by the top-down (decomposition)
or bottom-up (composition) approach, or by a combination of both.
3.2.1
CComponent is the base class used for the creation of the component word model
(Fig. 3.1). It holds textual information, including its name, ports that interconnect to
other components, as well as information that dene its position on the screen.
Visually, the component is designed as a rectangle with a strip surrounding its name
(Fig. 3.2). This strip is used to place the ports.
Creation of a word model component typically consists of
79
3.2.2
80
81
in the document. Their positions correspond to the positions of the word model
component ports. In this way it is visually clear which port correspond to which.
The document and its corresponding word model constitute the complete model
of a component. Such an object typically is accessed through the corresponding
word model. Hence, a word model serves as the interface to the document that
contains its model. Important parts of this interface are the ports (Sect. 3.4). A new
document object typically is created as follows:
1. Assuming that a document object (the current document) that contains a word
model has already been created, a component for which the accompanying
document is created is selected and a message is sent to the document to create a
new document object.
2. The document method creates a new document object. This method uses a
pointer to the word model object, from which the necessary data are taken, such
as the name of the component, the lename where the new document object is to
be saved, and the component ports.
3. A new document is created and its corresponding attributes are set. Document
ports also are created. These correspond to the word model object ports
(Sect. 3.4) and are added to the list of document ports. Otherwise, a new
document is empty, i.e. without any component or bonds. The new document
also creates links to the previous (lower level) document.
A new document object is not created if the ports of the corresponding word
model component are not already dened. Such a document object would make no
sense.
Once a document object is created, new word model objects of the contained
components can be created inside the document working area. The creation process
is managed by the document as already described (Sect. 3.2.1). The components
created are added to the list of components that the document contains. In the same
vein, the document manages the creation of the bonds that are used to interconnect
components contained in the document, or to connect them to the document ports
(Sect. 3.4). Model development can continue by creating a new document object for
every word model in the document, thus developing higher levels of abstraction of
the component model.
The document class manages saving the document objects to the document le.
Before any a new document object is created, the current object is saved. All objects
that the document contains are saved to the document le by calling the corresponding method. During this operation a copy of its word model object also is
saved as a header, as well as the lename of the previous document and other
pertinent data.
This saves the model as a tree of interconnected document les. All the les that
make up the model are double-linked, i.e. forward through the components contained in the document, and backward by the lenames of the previous document.
We return to this problem again in Sect. 3.9.
82
Document objects are persistent [3] because they exist even after they are closed
and deleted from memory. To remove a component completely from a document it
is not enough to remove it from the list of the components that the document object
maintains and to destroy it. The accompanying document le has to be removed,
too. Removing a component only creates dangling documents, i.e. documents of
which nobody is aware. This means that it is necessary to open documents until the
leaf documents are reached; then move backward by removing the document les
until the component that is to be removed is reached. Only then can the component
be disconnected from the container document and destroyed.
The document class is complex and supports many operations of the automated
modelling framework. The drawing operations are executed in a visual environment
in which the modelling system is implemented, e.g. the Windows system. During
its execution the objects contained in the document are called to draw themselves,
e.g. the document ports, the components and their ports and the bonds. Similar
actions are performed when printing a document to an external printer or to a
graphic le.
One important and much used operation that the document class supports is
copying. This creates a copy not only of the document, but also of all documents in
the tree. This operation starts from the document root and proceeds toward the
document tree leaves. In this process the ids and lenames of all contained components are changed. This causes a new document tree to be created that does not
share any component or document with the original tree. Document copying is
implemented in the following way:
1. Open the document object from a le and set the new lename and path where
the copy is to be saved.
2. For components contained in the document:
Get the original document lename
Create a new component id and document lename
Reset the component id and lename to the new values, saving the original
lename to a temporary location. In the process, component ids are changed
in the component ports, as well as in the bonds connected to these ports.
3. Save the document under the new lename
4. For every component contained in the document:
If there is an existing document le repeat step 1
5. Close the document
This operation is called when a copy of a component model is needed. In this
case a copy of the word model component is made rst as explained in Sect. 3.2.1,
and then a copy of its accompanying document is performed as described above.
When this operation is called directly (Sect. 3.9), a copy of the word model
component stored in the document header is made rst, then a copy of the document is made, as explained above.
83
The document class also supports many other operations, such as creation of the
mathematical model parameters dened at the level of a document object. These
parameters are visible to all components contained in the document. Linkage of
these parameters is designed so that a parameter dened in a document overrides
(hides) a parameter of the same name that is dened in a lower-level document. The
document class also has methods for mathematical model generation. This is
addressed in Chap. 5.
3.3
The Component class is the base class from which more specialised component
classes are derived. Figure 3.5 illustrates the hierarchy of the component classes.
One type of specialisation is visual appearance. The component can be depicted,
for example, by graphical symbols, not only by its name. In electrical engineering
such practise is widely used and has been standardised (e.g. by ANSI, DIN). It is
also used in mechanical engineering, but not to such an extent or with such versatility. Hence, to simplify modelling with bond graphs, several derived classes are
dened that partly support such schemes.
In the rst branch on the left of the hierarchy tree of Fig. 3.5 shows classes that
represent some of the more common electrical components. These, of course, dont
imply any specic model, for they are really word model classes represented differently. The model should be dened in the accompanying document object (see
e.g. Fig. 2.18). Using these components and connecting them by bonds gives the
bond graph an appearance very close to the usual electrical schemes. An important
difference from the latter is the half-arrows used to indicate power flow directions in
the circuit.
Mechanical engineering uses various schematics to depict, for example, systems
in vibrations, hydraulics, and pneumatics. Here there are dened classes to represent simple mechanical components only, such as bodies in translation and rotation,
springs, dampers, etc. (the second branch of the tree of Fig. 3.5).
Classes of fundamental importance involve derived classes that represent the
elementary components discussed in Sect. 2.5. These are the classes in the third
branch of the hierarchy tree of Fig. 3.4. In accordance with bond graph practise,
these components use predened textual symbols that can readily be changed.
It should be noted that some simple electrical and mechanical components can
be dened as a specialisation of certain elementary components, such as ground
potential, and electrical or mechanical junctions.
Elementary components differ fundamentally from the base class component in
that they do not have an accompanying document; they are entities in themselves.
The question, then, is where to put the variables and constitutive relations of these
components. The natural answer is: in their ports. Derived elementary classes
84
support editing of the constitutive relations in the form given in Sect. 2.5. The
elementary component classes also support creation of locally dened model
parameters; that is, those valid only in the component.
85
Elementary component classes dene various class-specic methods that override the base class methods. They also have an important role during mathematical
model creation, and in simulations, too.
The last group of components deals with the block diagram operations of Sect. 2.
6. Components in this group are shown as the last branch of the hierarchy in Fig. 3.
5. They are similar to the elementary components discussed previously, but support
only control ports. These components also use their ports to store the variables and
input-output relations. An exception is the COutput class that serves for collecting
the simulation output and displaying it on the screen.
There are two specializations of this last class: CDisplay and CNumericDisplay.
The rst serves to represent the output component in the form of the familiar xy plotter symbol as has already been discussed in Chap. 2 (see e.g. Figs. 2.18 and 2.
21), and the other displays the output in form of a numeric counter.
The components in this last group describe both the continuous- and
discrete-time components. While continuous-time components can be freely mixed
with components having power ports, the discrete components are an exception to
this rule. Therefore, to support development of discrete models a discrete subclass
of word model component the CDComponent is dened as shown at the top of 3.5.
Some of discrete components are just specialization of the corresponding continuous time components, e.g. input, function, node, summator. The same holds for
the pseudo random number generator classes CPrng and CDPrng. On the other
hand there are also classes used for modelling intrinsically discrete (digital) processes such as A/D and D/A conversions, digital clock, unit delay components, and
others which do not have continuous-time counterparts.
There is one other interesting component class: CIpcPipe. This is a class that
supports creation of anonymous or named pipe components used for inter-processes communication (IPC) between the BondSim program environment and an
external program.
Finally, there is a derived class that differs from the classes discussed above.
This is the CCompSet class, a container class for a group of component objects. It is
described in Sect. 3.8.
The Document class, as previously described (Sect. 3.2.1), manages creation of
component objects. Because there are no virtual constructors, the technique of the
object factory is employed [4] to construct objects of the correct type. Similarly,
every derived class overrides the method for creating a copy of a component,
insuring that a copy of the object of the correct type is created.
3.4
The component model introduced in the last two sections doesnt specify completely the interconnections between components. It is necessary to work out the
port interconnections, too. One approach is based on the notion of multibonds [5,
6], a generalisation of the concept of bonds to the multidimensional case. We accept
86
that another approach, based on the concept of compound ports, better ts the
object-oriented philosophy. Thus, bonds are taken as simple objects that dene only
which port is connected to which; everything else is the responsibility of the ports.
We dene the necessary port classes, but rst describe what we ask of them.
Looking at the component object and its accompanying document object
(Fig. 3.6), we identify two types of ports: component ports and document ports.
The rst type connects external components. Such a port knows that it belongs
to a certain component and that it is, or it is not, connected by a bond. The port
doesnt need to know what is on the other side of the bond. This is the responsibility
of the bond. The document port, on the other hand, belongs to the document object
and serves for the internal connection of the documents components. This kind of
port knows what, and how many, bonds are connected to it.
These two types of ports are used to describe connections looking from two sides
of the same component, from outside and inside. Looking from the outsidethat is,
at the component port sideit would be helpful to know how many bonds are
connected inside. This we call the dimension of the port. On the other hand, looking
from the inside, it would be useful to know if the port is connected on the outside by
a bond or not.
To simplify the interchange of information between these two types of ports, we
dene the component port class CPort as the base class and the document port class
CDocPort as a derived class (Fig. 3.7).
Creation of these objects is the responsibility of their containers, CComponent
and CBondSimDoc, respectively. A possible scenario is as described below:
1. When a user issues a command to the component object to insert a port, the
component method responsible for port creation is called. It, in turn, calls the
base class constructor, which supplies the port type requested, and its position
87
on the component boundary. The port constructor creates a port object and
assigns to it the component and the port ids, as well as the port type. The object
initially is unconnected, both externally and internally (dimension 0).
Depending on its type and position on the component boundary, the necessary
visual data are created that are used for drawing. The object subsequently is
added to the list of the ports that the component maintains.
2. The document object is responsible for the creation of document ports. These
are created during document object creation, based on the component object
ports (Sect. 3.2.2). The base class part of the document port object is just a copy
of the accompanying component port object translated to a position on the
outside of the document drawing area (Fig. 3.6). The position is calculated such
that it corresponds to the position of the accompanying component port in the
strip surrounding the component name. Thus, they share the same information.
3. When a bond is connected to a component port, its id is sent to the port and
stored there. The accompanying document port is updated at the same time.
Similarly, when a bond is internally connected to the document port, the bond id
is inserted in the list of bonds that the document port maintains. The position in
the list corresponds to the position of the connected bond line in the connection
rectangle. The dimension of the port is changed, as well as that of the corresponding component port. Thus, every change at one side of the interface affects
the other side.
The ports belonging to elementary components are different because they have
no document port counterparts. These ports serve mainly for storing data about the
component model constitutive relations as seen at those ports. The necessary
information is different for the power and control ports. Thus, two port classes,
CPowerPort and CCtrlPort, are dened that are derived from the CPort base class
(Fig. 3.7).
The power port class denes the port effort and flow variables, as well as the
element constitutive relations. Similarly, the control port class denes the control
port variables (signal). The constitutive relations are dened only at the output
ports.
88
There are two other classes, CICPort and CIntegPort, derived from the
CPowerPort and CCtrlPort classes, respectively (Fig. 3.7). These dene differentiated (state) variables that the Inertial, Capacitor, and Integrator components need
(Sects. 2.5 and 2.6).
Port object creation is managed by the corresponding elementary component
objects in a similar way to the creation of ports of the base components, as
described above. The variables are dened with default names and default constitutive relations. These depend on the type of the elementary component.
Subsequent to creation, the names of the variables and the specic form of the
constitutive relations can be changed. Details of the syntax used for the description
of the constitutive relations are given in the next section.
Port classes, like component classes, dene methods for operations on the port
objects, such as construction and deletion of the object, copying, saving, loading,
and drawing.
The nal object required to close the bond graph is the bond itself. onds are
simple objects that indicate which port is connected to which. A CBond class is
dened with attributes that hold the bond identifying label (id), the starting and the
ending component, and the port ids, as well as data necessary for the visual representation of the bonds. The bond class denes methods necessary for the creation
and destruction of bond objects, copying, saving, loading, and drawing. Bonds, as
objects, are contained in documents. The procedure for the creation of bonds is as
follows (Fig. 3.8):
1. Select a starting component port by clicking it. Drag the mouse cursor with the
left mouse pressed to the next intermediate point and release it. Move the mouse
cursor with the key released it until it is over a port of the other component we
wish connect to and click the mouse. The starting or ending ports could be the
document ports as well.
2. The document class is called to create a CBond object. The ids of the starting
and ending components and ports are set to the object. The coordinates of the
starting and ending points of the bond line are stored into the bond object as
well. Add the bond object to the list of bonds in the document object.
89
3. We can modify the bond drawn by simply picking a point on the bond line and
dragging it (similarly as we can drag a rubber string) and release the mouse.
When the mouse is released the additional points are added to the collection of
the points stored in the bond object, which dene the bond line, and the bond is
redrawn.
3.5
Operator
Meaning
()
!
+
^
*/%
+
<>
&|
?:
Function call
Logical not
Unary plus and minus
Exponentiation
Product, division and mod
Addition and subtraction
Relational operators
Logical AND and OR
Arithmetic if (conditional)
90
elements, the if-else type of control statement can be expressed by C/C++ like
operators ? and :. These can be nested. Table 3.1 lists the supported operators.
The operators follow the common priority rules, as implemented in C/C++.
All common elementary mathematical functions are supported, such as sin, cos,
tan, log (natural base), etc. Sometimes the functions are not known in analytical
form but as tabular data. For example, tables might result from nite element
analysis or experiments. Such data can be interpolated by polynomials and used in
the expressions. The BondSim program supports an interface that accepts one- and
two-dimensional tabular functions. Functions are interpolated by B-splines [7] and
are referred to in an expression by a user-assigned name, e.g. flux(i,x).
3.6
91
of which points to the elementary ports where the component effort-flow pairs are
dened. Hence, such a port represents a pair of effort and flow vectors
e e1
e2
e3 T
3:1
f f1
f2
f3 T
3:2
and
where superscript T denotes vector transposition. This approach can be used for 3D
representation of a force applied at a body point and the corresponding velocity (for
2D representation, see Fig. 2.22).
The dimension assigned to a port indicates the number of ports connected
internally. In the case shown in Fig. 3.9, the port dimension is 3; but it could, of
course, be any number. The connected ports are the ports of contained components.
These also can be of higher dimension than 1. Quite complex structures of port
effort-flow variables can, thus, be constructed.
As an example, Fig. 3.10a shows a component port to which two other ports are
connected internally. These are the ports of another component that contains seven
elementary components. Two groups of three and four components, respectively,
out of these seven elementary components are internally connected to the corresponding document ports.
The port of Component A thus can be viewed as representing a pair of block
(partioned) matrix containing two row blocks (Fig. 3.10b), i.e.
92
e
e1
;
e2
f
f1
f2
3:3
e12
e13 T ;
e2 e21
e22
e23
e24 T
3:4
3.7
93
Fig. 3.11 The proper connection of the component ports. a Symmetrical structure.
b Unsymmetrical structure
94
95
3.8
In addition to the component and document classes of Sect. 3.2, two other classes
are useful for operations on a group of components. During model development, for
example, it can be useful to copy, move, or delete not only single components, but
also a set of components and their interconnecting bonds (Fig. 3.13). The set can
even be unconnected. To support such operations we introduce a helper class
CSelSet (Fig. 3.14).
CSelSet denes a list of components that makes up the set and a list that contains
their internal bonds (i.e., the bonds that interconnect the components in the set.)
There also is a list of external bonds to components not contained in the set. We use
this class to create an object that contains a list of a documents components and
their bonds. This is done in the following way (Fig. 3.13):
Create a rectangle encompassing a group of components
Find all the components enclosed in the rectangle and add them to the list.
Check the bonds connecting the ports of selected components
If the bond connects the components from the set, add it to the list of internal
bonds; otherwise, add it to the list of external bonds.
96
We also can add a component to the set and check its bonds. If the component
already is in the set, it is then removed from the set. In this case, any bond of the
component already contained in the list of internal bonds will be removed and
stored in the list of external bonds.
The set of components is free if its list of external bonds is empty. Such a set can
be moved or deleted. Otherwise, it is xed and can only be copied (if it is not
opened). Moving the set means that every object in the seti.e. the components
and their bondsis displaced by the same amount.
Delete and copy operations involve creation of an object of the other type that
contains all information on the components and bonds in the set. CSelSet objects are
lightweight components that contain only pointers to the components and bonds in
a document. They are not persistent objects, but can be used to create persistent
objects. When an object is destroyed, the lists only are destroyed, not the component and bond objects
We dene a class that is used for creation of a persistent object using information
from CSelSet. This is the CCompSet class we met when discussing the component
class hierarchy in Sect. 3.3 (Figs. 3.5 and 3.15).
97
CCompSet is a kind of CComponent, but it differs from the latter in that it does
not have a separate document to hold its model. It is a container for a set of
components and their interconnecting bonds. It doesnt have a separate visual
representation, as other components, because it is not used for model building.
CCompSet has one thing in common with CComponent: It can be stored and
loaded like other component objects. The main use of this class is to create objects
that contain a set of components and their bonds that are deleted or copied from a
document. Such objects can be held in buffers, from which they can be reused
(Sect. 3.9). In performing these operations, there is a close co-operation between
CSelSet and CCompSet.
The components contained in a CCompSet object can be inserted into a document using Create from method (Fig. 3.15), which creates a copy of all components, bonds, and associated documents, attaches them to the document where they
should be inserted, and creates a corresponding CSelSet object.
3.9
The previous Sections described the concept of the component model, the concept
that lies at the core of the systematic top/down modelling philosophy developed for
complex engineering and mechatronics systems. This Section describes an
object-oriented environment that implements this modelling philosophy.
Physical model development normally begins at the system level (Fig. 1.2), a
step that identies the system and denes its interaction with its environment. The
model at this level represents a world-view of the problem under study and is
represented by a document object without the ports. That is, this is the system
model root document.
We use the term project to mean the model development. We introduce a
separate project class CProject (Fig. 3.16) to serve as the starting point of model
development. Every project has a project object with a unique identication label
(id) and lename that indicates where the projects root document is to be saved.
This class is, in essence, a reduced version of the component class (Fig. 3.1).
98
99
100
3.10
The idea of code reuse is very old and very appealing, but well known not to be an
easy problem to solve. Code reuse signicantly improves the efciency and quality
of development and, hence, of problem solving. There are many approaches and
techniques developed and are in wide use today that are based on code reuse, such
as COM and DCOM technology. OOP languages are developed with code reuse as
a goal. The following four fundamental reuse problems can be identied [8, 9]:
Finding components
Understanding components
Modifying components
Composing components
3.10
101
As used in this sense, a component is any output of the solution process, e.g.
code components, on-line documentation, specications, etc.
Here we are interested in reuse of component models and projects. The concept
of component oriented modelling, as discussed at the beginning (Sects. 1.2 and 1.6
), is introduced not only to enable systematic model development, but also to
support reuse of components for building system models. Component reuse can
signicantly improve the quality and efciency of model building. Similarly this
applies to projects as well. Here we describe approaches and methods used to that
goal.
Component and project les are held in the library, a separate section of the
workspace. The library is divided into two segments
Project repository
Component libraries
The project repository serves as a convenient storage place of complete projects.
Any project can be moved into the project repository and removed from the main
workspace section (models section). Such a project can be reused at any time. To
simplify the search for a particular project, the repository can be hierarchically
organised according to application areas, or by some other criterion. This is not
considered further here, for it is a separate problem. Currently, only the basic
mechanisms of project managment is provided.
Component libraries are divided into three sets:
Word model components
Electrical components
Mechanical components
The rst serves for components represented by word models and are for general
use. The electrical library stores electrical components represented by electrical
circuit symbols. This library can store models of, for example, electrical resistors,
coils, semiconductors, and electrical motors. The third is a library of mechanical
components represented by suitable graphical symbols, e.g. springs, bodies in
translation or rotation, connectors, etc. These libraries can be further specialised.
It is relatively easy to organise components into libraries. Project and component
les of interest are put from the model section into a library section of the workspace simply by copying. The application object maintains an index of project and
component les put into libraries. In this way, storing important components and
project models separately from the model workspace is more secure; there is less
chance that they will be accidentally modied or removed.
Projects or components of interest can be found by searching library indexes. To
reuse a particular project it needs simply to be copied back into the model workspace. After that it can be opened and used as any other project.
Components from the library are inserted into the model workspace. It can be
done as follows:
102
References
1. Damic V, Montgomery J (2003) Mechatronics by bond graphs: an object-oriented approach to
modelling and simulation. Springer, Heidelberg
2. Williams S, Kindel C (1994) The component object model: a technical overview. http://msdn.
microsoft.com/library/techart/msdn_comppr.htm
3. Booch G (1991) Object-oriented design with applications. Benjamin Cummings, New York
4. Stroustrup B (1998) C++ Programming Language, 3rd edn. Addison-Wesley, Reading
References
103
5. Breedveld PC (1982) Proposition for an unambiguous vector bond graph notation. J Dyn Syst
Measure Control 104:267270
6. Fahrenthold EP, Wargo JD (1991) Vector and tensor based bond graphs for physical systems
modeling. J Franklin Inst 328:833853
7. de Boor C (1998) A practical guide to splines. Springer, New York
8. Biggerstaff T, Richter C (1989) Reusability framework, assessment, and directions. In:
Biggerstaff TJ, Perlis AJ (eds) Software reusability: concept and models, vol 1.
Addison-Wesley, Reading
9. Walpole RA, Burnett MM (1997) Supporting reuse of evolving visual code. In: Proceedings of
1997 IEEE symposium on visual languages, Capri, Italy, pp. 6875
Chapter 4
4.1
Introduction
This section describes BondSim, a program which offers a visual environment for
the modelling and simulation of engineering and mechatronics systems, based on
bond graphs. The general concept of the program is shown in Fig. 4.1.
It offers several services to a user. The two basic services are Modelling and
Simulation. The rst supports model development tasks and represents implementation of the ideas and methods of Chap. 3. The program also supports model
data base maintenance and library support. It also supports collaboration using
model import and export as well as inter-process communications (IPC).
The simulation subsystem uses models developed by the modelling subsystem to
study system behaviour. This chapter focuses mostly on the modelling part of the
program. The simulation part is the topic of Chap. 5.
The operating system for which the application has been developed is Microsoft
Windows 7 and later. The program has been developed using the Microsoft integrated development environment Visual Studio 2012, the VisualC++ and Microsoft
Foundation Class Library (MFC) [1]. The program BondSims 2014 version is an
extension of the program described and included in Ref. [2]. Use was also made of
the Zlib library for exported data compression.1 We greatly appreciate the permission of Zlibs authors for the free use of the library. BondSim 2014 is freely
available through the authors web site. Readers are encouraged to use it in conjunction with the text.
ZLib is a free data-compression library developed by Jean-Loup Gailly and Mark Adler, http://
www.info-zip.org/pub/infozip/zlib/.
Springer-Verlag Berlin Heidelberg 2015
V. Dami and J. Montgomery, Mechatronics by Bond Graphs,
DOI 10.1007/978-3-662-49004-4_4
105
106
4.2
The main application class CBondSimApp was derived from the MFC class
CWinAppEx and is used to construct a Windows application object, which in turn
is used to implement a modelling and simulation environment (Sect. 3.9). The
application object is declared as global and is constructed at the start of BondSim.
During its initialisation the main application window is created and appears on the
screen as shown in Fig. 4.2.
107
The main window follows the MS VisualStudio form. It is divided into several
parts. The upper part contains the Program title, menu bar and tools bar, which are
typical for a Window program. The area below these bars is divided into four main
parts. In the middle is a large window which plays a central role in the model
development. On the left is a window which contains two tabs: Models view and
Models library. The rst serves to show the structure of the model currently under
the work in the main window. The models library tab enables easy access to the
models library (see Sect. 4.9). Similarly, to the right of the main window is another
tabbed window, which contains Editing and Template tool boxes. These boxes
contain tools that are used during model development (Sects. 4.6 and 4.7). Finally,
at the bottom is an area which is used for messages sent during model building,
simulation run or the program repair phases.
The main application window is based on the CMainFrame class. This class is
derived from the MFC Librarys CMDIFrameWndEx class, which provides the
functionality for a multi-document interface (Sect. 4.5). The class also denes some
specic methods needed by the modelling and simulation environments. These
belong to two groups. The rst controls messages sent to the main window and
gives information on the current status of the operations. Such messages are displayed in the status bar at the bottom of the main window, e.g. Ready, Create a new
project, etc. Attributes and methods are also provided for the creation and operation
of a progress control bar located to the right of the status bar. This provides the
developer with feedback on the completion percentage of some lengthy operations,
such as are encountered during simulation runs. The other methods are used for the
distribution of messages sent to the window during various phases of modelling and
simulation, such as during the creation of bond graphs, operations on libraries, etc.
The methods accessible at the application level are organised in the Project,
View, Tools and Help menus. There is also a row of toolbar buttons for the most
important commands. Some of the most often used commands can also be accessed
by keyboard shortcuts.
The Project menu contains commands for modelling operations implemented
along guidelines given in Sect. 3.9. The rst two are New and Open.
The New command is used to create a new project. When this command is
chosen, a dialogue window appears with an edit box into which the user inputs the
name of the new project (Fig. 4.3).
The dialogue window also contains a list box with the names of projects that
already exist. This information is held in the project index maintained by the
application. The name of the new project is accepted, provided it is unique. The
new project document is then opened in a suitable window. This is the starting point
of the model development process (Sect. 4.6).
The Open command is used in a similar way. This command opens a modelling
project already in the projects list. It uses a similar dialogue window as the New
command (Fig. 4.4). The name of the project can be selected from the
108
accompanying list box. It is possible to open a project in the Edit or Read only
mode by selecting one or the other from the Mode box. The Edit mode is the normal
mode for opening projects, in which models are created or modied. The Read only
mode, on the other hand, can be used only for reviewing. In this mode, project
109
documents cannot be changed, thus protecting the models original form. The
document project is read from the project root document le and displayed in the
central window.
The next group of commands contains project manipulation routines, such as
Delete, Copy, and Rename, each of which uses a similar dialogue. The Delete
command removes the project from the project data base and puts it into the Waste
Bin. It is also possible to delete the project completely by bypassing the Waste Bin.
The Copy command creates a copy of an existing project under a new name. This
command invokes the copy operations of all documents that make up the project, as
described in Sect. 3.9. The Rename command changes a projects name.
The other useful command is Copy to Library, which moves a copy of a project
to the projects library. Once copied to the library, the project can be removed from
the project workspace.
The commands Export or Import serve for exporting and importing a project
respectively to or from another BondSim application. The Export command generates a le in compressed form having the le extension .ept, which contains a
project data that the user wishes to export from the current program environment.
The le is stored in a place selected by the user using standard Windows Save as
le dialog. Similarly, the Import command uses a similar Open le dialog to access
a BondsSim exported project le, which we are importing. At the end of the
operation the program asks for the name under which it will be stored in the
program workspace.
The Repair Projects command repairs the model database in case of corruption.
During this operation all projects that are not correctly linked are collected and
could be restored into the database or rejected.
The Waste Bin command provides access to the buffer that stores information on
previously removed or repaired projects or components. These can be completely
deleted from the application workspace, or restored back into the workspace. It
plays a similar role as Recycle Bin in Windows. At the end there is the standard Exit
command. The View menu contains commands that the user can apply to change
the toolbars, docking widows, status bar or the application look.
The Tools menu contains commands that can be useful during the work. Thus, it
is possible to access the Component Buffer, (which has similar role as windows
Clipboard2), to inspect its contents or to remove components that are not needed
anymore. There is also a Functions sub menu, which contains the commands for
creating a new user function, opening an existing one, their deleting or exporting. In
addition there is a Symbolic Operations submenu with currently only one command
Note, however, that the components stored in the Component Buffer are retained between the
BondSim sessions.
110
4.3
The component classes discussed in Sects. 3.2 and 3.3 are derived ultimately from
CObject, the MFCs base class. This provides basic support for dynamic creation of
the objects and object persistence (serialization), as well as other services [1].
Objects derived from the CObject class are responsible for their storing to, and
loading from, a persistent medium (typically a hard disc).
The hierarchy tree for the model classes of Sect. 3.3 is given in Fig. 4.5. In
addition to the functionality already discussed in Sect. 3.2.1, the base class,
CComponent, also denes an internal state attribute and methods, which change the
visual appearance of the component objects in the development environment.
The possible states are:
Normal
Select
Open
Text
111
112
Fig. 4.6 The port and the bond classes hierarchy as extension of MFC library
4.4
Similar to the component classes, the port and bond classes of Sect. 3.4 are also
derived from the CObject class. These also use CObjects dynamic creation and
serialization support. The complete class hierarchy is given in Fig. 4.6.
The CPort and CBond classes also dene its internal state similarly to the
CComponent. Thus, when created they are in the Selected mode, which is shown by
the ports and bonds drawn in red. When we deselected them, by e.g. clicking
outside of these objects, they assume the Normal mode in which they appear in the
normal colour, typically black. There are also other modes often used in logical
combinations.
Power In and Power Out modes are used by power ports, and are inherited by
the corresponding document ports, to visually represent the ports by half arrows
directed into, or out of, the corresponding component, respectively. Similarly,
Control In and Control Out modes are used by the control ports, and also inherited
by the corresponding document, to visually represent them as full arrows directed
into, or out of, the corresponding component, respectively. In the same vein
Discrete Port mode is assigned to the ports belonging to the discrete components,
and similarly, the trigger and activation ports are normal control ports to which it
was assigned Trigger Port and Activate Port modes when they were created.
4.5
MFC supports the creation of document windows based on three associated classes:
CDocument, CView, and CFrameWnd, or the classes derived from them [1]. The
process is coordinated by a class derived from the CDocTemplate.
113
The frame class is used to display documents, and has a title bar and a border
within which the view class displays the contents of the document. The view class
handles events generated by keyboard input and mouse actions. Typically, the
document template object is constructed in the global application object at initialization (Sect. 4.2). When a command to create a new document is issued, the
document template object dynamically creates document and frame objects. The
latter creates a view object that displays an empty document. When opening a
document that exists in a le, the procedure is similar, but this time the document is
read from the le and displayed inside a window frame. Reading, as well as storing,
a document is done by an archive object that supports serialization. Details of this
and of related processes can be found in [1].
We accepted this architecture but use the CScrollView derived class, a view class
that supports scrolling large documents, and CMIDIChildWndEx multi-document
child window derived class. They are coordinated by the CMultiDocTemplate class.
In this way we can open multiple document windows on the same project.
However, these classes do not satisfy completely our needs and we thus introduce
classes derived from these classes as shown in Fig. 4.7.
We dene two derived document classes: CBondSimDoc, and CBondSimSSDoc.
These are necessary because we wish to radically change the document architecture
of the program.
Windows documents, as implemented in the MFC library, are single-level
documents, i.e. they are all created at the modelling project level. Because we wish
to support hierarchical multilevel model development, only the project root document, which describes the basic system level model, should be opened at the project
level. All others need to be opened within the previous document using word model
objects as the interfaces. In addition, all the documents should be linked backwards
as well. This is the main task of the CBondSimDoc class.
Another important change is the use of a structured storage le system. This is a
storage scheme introduced by Microsoft for dealing with the OLE (Object Linking
and Embedding) technique. Thus, instead describing the model of a project by a
multitude of the les, a single compound (structured storage) le is used. The
compound les contain storages, which correspond to directories in the common
le system. The storages may contain other storages and the streams, which are
114
115
up or down. No operations that change the model appearance are permitted in the
Scale to Fit mode.
This class manages drawing the document in response to the paint commands
from the Windows system. The corresponding drawing method forces all objects
contained in the document to draw themselves. It also denes methods for handling
commands forwarded to the view in response to the mouse or keyboard. The
response depends on the mode chosen. Thus, the class implements an internal state
attribute used to determine which action to execute.
The most important states are:
1. Normal
2. Create component
116
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Move component
Insert component
Insert library component
Edit text
Create port
Drag port
Move port
Create bond
Connect ports
Change bond
Size document
Size port
Set selection
Move selection
We explain here some of the actions that deal mostly with selecting and moving
model objects. Those concerned with the creation and editing of model objects are
explained in Sect. 4.6.
In the Normal mode the view is not set to any specic editing mode; it is ready to
accept commands. A component can be selected simply by clicking it.3 The
component reacts by changing its visual appearance. The selected component can
be opened using the command from the menu (Sect. 4.6.2). The component can also
be opened simply by double-clicking it, or by the keyboard shortcut. Other commands can be executed on the selected component, as well. The component is
deselected by clicking anywhere outside of the component rectangle and returns to
the Normal mode.
We can drag a component around the document drawing area provided it is not
connected to other objects by the bonds. This is accomplished by pressing the left
mouse button when the cursor is within the component name. This changes the
editing state to Move Component. By dragging the mouse with the left button
pressed, we can move a component rectangle around the document. When the
mouse button is released, the component reappears in the new position and the view
mode changes to the Normal mode, and its component state to Selected.
A component port can be selected by clicking the port. In a similar way as with
components, we can move a port around the component periphery, provided it is
not joined by a bond. Simply put the cursor over a port, then press and hold the left
mouse button. This changes the editing state to Move Port, and the cursor changes
to the shape of the port. As we drag the cursor around the component periphery, the
cursor shape changes to reflect the correct port shape. For example, a power-in port
should point every time into the component. When the mouse button is released, the
editing mode returns to Normal and the port reappears in the new position in the
selected mode. Again, the port is deselected by clicking outside its boundary.
3
We will use terms like clicking or pressing mouse to mean using the left mouse button. Otherwise
the button used will be stated.
117
118
4.6
Editing Models
4.6.1
The Editing Box (Fig. 4.9) tools consist of three main branches: Bond Graph
Components, Continuous and Discrete Signal Components, which are used to
create the corresponding components. The Port branch serves to add the ports to the
components. The Font is used to select the size of the component text, for component name editing, and the Text orientation to set either to horizontal (default) or
vertical. The Bond Line Type enables selection of the visual representation of the
bonds either as a Single bond (default) or Multi bond. Note that this is only the bond
visual appearance. As discussed in Sect. 2.3 the multi-bond technique is not
119
Fig. 4.10 Editing Box with expanded Bond Graph editing tools
applied, and thus it may be used to indicate only that the connected ports are not
simple. Figure 4.10 shows the main Bond Graph model development tools.
To create a component the drag and drop technique is used. Thus, to create a
word model component in an empty document window Fig. 4.9 we can proceed as
given bellow (Fig. 4.11):
Drag the General Word Model Component from the Bond Graph Components
tools (Fig. 4.10 left) and drop it into the rectangular area in the Example Project
window, but not too close to its borders.
A caret appears and we may type in the title, e.g. CompA and click outside of
it to end the text editing of the component title.
The CompA appears having two power ports bounded by a red rectangle (denoting that it is selected). Note that when a component is created it already has
the default ports pre-created. We can retain them, remove some or add new
ones.
To add a control-in port, e.g., drag it from the Port tools and drop it at the
component boundary. Note that when we drag the port over the component a red
bounding rectangle appears. We need to drop the port in the space between the
component title and the boundary rectangle. When we drop it a control-in port
appears at the component boundary in the selected state.
120
Note in Fig. 4.11 on the left that the model structure is lled in. Thus, it shows
that it is model of the project Example Project, which is the root of the model
tree, and that it contains CompA as a child. Note that the icon in front of the
CompA branch is in the form of an empty page because the component is empty;
there is no document contained, just the word model component alone.
We may add other components as well. Thus by dragging and dropping we add a
Source Effort (SE) component (Fig. 4.12). This component appears also as a leaf in
the model tree as can be seen in Fig. 4.12 on the left.
Note that the component is not created if it is placed too close to the rectangle
boundaries. Thus the best way is to create it somewhere away from the rectangle
boundaries and then drag it and put in a suitable place.
Every created component is a different object in the computer memory, or in the
persistent medium, even if two have the same names. The component name is for
user convenience and is not used by the program to identify a component. To
uniquely identify every component object the program assigns to it a unique
identier (ID).4 Thus, we can freely select the component name (title). There cannot
be a name clash. We can even change standard Bond Graph element names, e.g. we
may rename the I component name as Inertia. The components created are
unique by its design.
The component ID is based on Microsoft GUID, a globally unique identier. Each generated
GUID is not guaranteed to be unique, but the number of possible GUIDs are so large (2128 or
3.4 1038) that the probability of generating the same number twice is very low. It is used in many
software products not only by Microsoft, but also by Oracle, Novel, Intel and others [3].
121
Fig. 4.12 Adding SE component and connecting its port to the component port by the bond
Now we may connect the power-out port of SE and the power-in port of the
CompA by a bond. The procedure is:
Pick the power port of SE.
Move (with the key pressed) mouse cursor to the right and click, then move up
and click again, then move to the left and click, and continue until it is over the
port of the correct power sense (power-in in this case) of CompA. This is
signaled by the port becoming selected.
End drawing the bond by clicking on the port below the mouse cursor and the
bond line appears.
If we wish to correct a bond line we can put the mouse over the bond, pick it and
drag it like an elastic string, and drop it in a new position.
4.6.2
The rst step in the project development is editing the bond graph model at the system
level. If the model at this level contains word model components, such as CompA in
Fig. 4.12, we need to dene its model. This is done by opening the component.
We may open a component in several different ways, as is the usual approach in
windows programs. The easiest way to do it is by double-clicking the component
title in the document window, or in the model tree. We may expand the component
branch in the model tree, or click using the right mouse button the component title
in the model tree and select the Open command from a dropped down menu. Or, we
can select the component in its document window and click the corresponding
toolbar button. To see which one to choose we may move the mouse cursor over the
toolbar buttons until the tooltip windows that appear shows Open Component. We
122
can also choose the Open Next command in the Document menu, or simply press
the PGUP (Page up) short-cut key.
If the model of the component has not been dened already, as the case is in
Fig. 4.12, this operation tries to create a new document object. The program, rst,
asks the modeler if she or he wishes to edit a new model of the component. If the
answer is yes the program creates a new document object and shows it in the
corresponding frame window that has the same title as the component. Figure 4.13
shows this window as a tabbed window. The document is empty. There are,
however, three document ports corresponding to the ports of the component
(Fig. 4.12).
We can proceed with component model development similarly as earlier by
constructing new components by dragging and dropping the corresponding component tools from the toolbox (Fig. 4.10).
Thus, we can drag a 1 junction and drop it near the left document port
(Fig. 4.14). This operation creates a 1-junction with three ports. We will pick the
bottom port and drag it around the component and drop it at the top. Next, we will
pick the I (Inertial) component and drop it above the 1-junction. After clicking
outside of the component, the component appears on the screen with the predened
I symbol and the power-out port on the left. We will again pick this port and move
it to the bottom (against the corresponding 1-junction port). Now we can connect
these two ports. If the line is not ne looking, we may reposition the I component
and its port. Firstly, we must disconnect the ports, by selecting bond and pressing
the Delete key to remove it. Then, we may pick the component by the title and drag
to a suitable place. We may also select the component and use the cursor keys to
ne-position it. Then we reconnect the ports again. We can next create a CompB,
add to it a control-in port and interconnect its ports as shown in Fig. 4.14.
Now we may close the CompA document and store it in the previous document,
within the CompA storage. We can close the document simply by clicking its x
123
Fig. 4.15 The project model structure after the CompA document was closed and stored
button. (We can also do it in other ways, which parallels that of Open operation.)
When the program asks we may save the document. Now the model structure of the
project changes as Fig. 4.15 shows.
Comparing with Fig. 4.12 we see that the icon in front of the CompA branch
changes to a folder form and + connector. This indicates now that CompA storage
contains its model. By clicking + we can expand the branch, which effectively
opens the component model document using the contained model data.
Finally, we nish the project model development by closing the project window.
The program again asks if we wish to store the document. This time this amounts to
storing the model documents to the disk as a compound le. If we decide to say no
all changes made after the last storing of the project document are lost.
124
Returning to Fig. 4.14 we see that there are two types of port connections. One
correspond to internal connections between the components in the model, such as
between the right and top ports of 1-junction and corresponding ports of CompB
and I, respectively. The other is between the ports of the components, which
constitute the model, and the document ports, such as the connection between the
left port of 1-junction and the left document port, the right port of CompB and the
right document port, etc. These really connect the inside components through the
ports of CompA to the outside of the components. In Fig. 4.12 we see that the left
power port of CompA is further connected to the SE power port, and the other two
are unconnected. We can see that the connection is proper because both have the
correct typesone is a power-out and other the power-in port, and both have the
same dimensions. The elementary ports has dimension one, by the construction.
The port of CompA internally has only one connected bond, and this is inside
connected to a 1-junction, i.e. to a port of dimension 1. Thus, the port of CompA
has also the dimension one.
Great care should be taken when connecting ports by bonds. The rules discussed
in detail in Sect. 3.7 should be followed closely; otherwise, the model can easily be
incorrect. It is relatively easy to connect the ports of elementary components
properly when these are contained in the same document. As a rule, however,
systematic model development generally results in elementary components connected over several levels of documents. It is then of paramount importance to
insure the symmetry of port connections, as shown in Sect. 3.7. The Show Joined
command on the View menu aids in this important task by invoking the search-out
and search-in procedures (Fig. 3.12). If during the search an error is found, the
search is stopped with an error message.
Thus, to nd a port that is connected to some other port, the port is selected, then
the Show Joined command is chosen. Alternatively you may press the toolbar
button depicted by two ports connected by a bond, or use the Ctrl+J shortcut. The
search displays all ports and connecting bond lines, starting with the selected port
and ending at the other port. During the search the states of the ports and connecting
bonds are set and coloured. We illustrate the procedure with the example of the Seesaw model of Sect. 2.7.3 (See Fig. 2.21).
We open the Body1 component and select the power-out port of the left
junction as shown in Fig. 4.16 (indicated by the circle), i.e., the x-force junction
port. We wish to nd the other port connected to it. By clicking the Joined Ports
toolbar button we start the search procedure, the result of which is shown in
Fig. 4.17. The search starts at the selected port, go out of the Body1 component
continue along the bond to the Platform, then go inside the Platform (Fig. 2.26,
see also the model tree on the left in the Fig. 4.17). It follows then the bond until the
component 0 is reached, goes inside, and nally ends at the x-force component of
the flow junction (denoted by the oval). Thus, the connection is valid, i.e. the
x-force component applied at the Body1 really is the x-component of the reaction
force of the Platform. The port connections are symmetrical.
125
Fig. 4.17 The search ends at the port of x-force 0-junction of the Platform (denoted by an
oval)
126
4.6.3
Block diagrams are traditionally used for developing models in different elds as
was already discussed in Sect. 1.4. The BondSim programming environment supports also developing and using models in such a form. The main reason for the
inclusion of this type of model here is to supplement the Bond Graph models by
continuous-time and discrete-time block diagrams when complex physical model
are developed in mechatronics.
Figure 4.18 shows the expanded Continuous Signal Component (on the left) and
the Discrete Signal Component (on the right) branches of the Editing Box tab.
The continuous-time component tools support the creation of components that
implement block-diagram operations discussed in Sects. 2.6.2 and 3.3. Following
common practice the Node is implemented as a component depicted as a dot. There
are two types of output component. One is in the form of an X-Y Display, which
collects data during the simulation to present them as x-y or x-t plots in separate
tabbed documents in the central part of the screen. The other, Numeric Display, is
Fig. 4.18 Editing Box with expanded Continuous and Discrete signal components tools
127
implemented as a running counter. There is also a tool for generating noise in the
system by a pseudo random number generator. The tool in the form of a ring, or a
pipe cross-section, IPC pipe, serves for creating of an object based on the named
pipes [4, 5] for inter-process communication with an external program.
The discrete-time signal component tool box is shown in Fig. 4.18 on the right
and will be discussed shortly.
The development of block diagram models is very similar to that of Bond
Graphs given in the previous sections. To illustrate this we will show a typical use
of such components in Bond Graph models. We often add a control-out port to a
flow (0) or effort (1) junction to pick up the common signals. In the rst case it is an
effort signal, and in the second a flow signal. These signals can be used for monitoring change in the corresponding variables over time during the simulation.
We will start the BondSim program and open the Example Project. We open the
CompA, e.g. by expanding its branch in the model tree. The CompA document
opens and appears in the central part of the screen (Fig. 4.19). We will add a control
out port at the bottom of the 1-junction. To do this we may open the Ports branch in
the Editing Box tab on the right of the main window, pick the Control-out port tool,
and drag it over the CompA document window. Finally, we will drop it at the
bottom of the 1-junction. The control-out port appears now as shown in Fig. 4.19.
Now we have created an access to the junction common flow (the body velocity
if the I represents body inertia). But, we cannot take the signal out of the component because there is no the corresponding control-out document port. To create
one we must add the corresponding port to the component object. Thus, we can
click the Example Project document tab to activate the previous document
(Fig. 4.15), and add a control-out port at the left-bottom of the CompA periphery
(but inside the bounding rectangle) in a similar way as we did with 1-junction.
128
When we return back to the CompA document (by clicking on the corresponding
tab) we see that we now have the document port we need.5
If the port is not positioned at the periphery of the document as we would like,
e.g. just opposite of the 1-junction control port, we can adjust it before connecting.
However, we must do it at the component side, by dragging the port by mouse, or
moving it by the cursor arrows keys. We can also widen the document port by
moving the cursor over the port. When the port becomes selected and the cursor
changes shape to a two-side arrow, we may press the left mouse button and drag the
port edge.
After connection the signal line appears as in Fig. 4.20.
Now we can close the CompA document and save it (Fig. 4.21). We will next
add a node into the system level document below the CompA. To do this we will
expand the Continuous Signal Component branch in the Editing Box, pick the
Node, drag it into the Example Project document window and drop it below the
CompA and near (but not too close) to the document bounding rectangle. After we
click outside of the node it appears on the screen. It has one input and two
control-out ports (we may add more control-out ports if we wish). The node input
port we will connect to the output port of CompA. This way we establish branching
of the signal taken out of the component.
We may integrate this flow signal to obtain e.g. the displacement. Thus we may
pick the Integrator () and drag it and drop it to the right of the node. We can adjust
its position so that its input port is on same level as the nodes right output port, and
connect them. Note that the connecting of the signal ports is done in the same way
as explained previously for power ports (Sect. 4.6.1). The only difference is that the
Note that this operation silently, in the background, saves the component document in order to
ensure the correspondence between the component and document ports just created.
129
connecting line is the signal line and not the bond line; a signal line basically
transfers a single signal, and a bond line a pair of the signals.
The nal component that we will create is the X-Y Display at the right of the
Integrator. It has two input ports predened (we may remove one or add more if we
wish). We may adjust their positions so that the left port is at the level of the
integrator output. Finally we connect the left port of the display to the output port of
the integrator, and the bottom port to that of the node. The nal form of the model is
shown in Fig. 4.21 (at the right). The Model structure tab shows now the structure
of the Test project model. Now we can close and save the model.
4.6.4
We return now to the Discrete Signal Component tools (Fig. 4.18 right). The rst
entry in the tool serves to create a General Component, which parallels the General
Word Model Component in the Bond Graph Components branch (Fig. 4.10 left).
However, this one supports only discrete control input and output ports and can
contain only discrete-time components. Thus, continuous-time and discrete-time
models are separate, but can communicate. The same is valid in the physical world
as well. An embedded microprocessor cannot directly acts on a motor. They work
in different physical domains. It is, thus, necessary to convert the signals from one
domain to the other and scale them appropriately.
The conversion can be achieved by A/D and D/A converters described in Sect. 2.
6.3. These components can be created by the drag and drop technique as any other
component using the corresponding tools. These two components, however, have to
be created in the main project root document.
In the same way we can create other components. These components can be put
in the system level document or inside a discrete component. There are many tools,
130
Fig. 4.22 Some special discrete components: a lookup table function, b PRNG, c buffer
generation, d reset operation, e buffer size, f buffer element, g buffer summation, h element wise
buffers multiplication
which serve to purpose. The next six components were already discussed in Sect. 2.
6.3. We explain the others.
The Table lookup function tool serves to create a corresponding discrete component (Fig. 4.22a). Currently, the lookup table function supports evaluation of sine
and cosine functions using a table of pre-calculated sine and cosine values. The
value generated by such a function uses linear interpolation of the input value
between the nearby table values. It is often used when a great number of such
calculations are taking place in a processor. Using such a model function it is
possible to closely simulate the behavior of such equipment both in terms of the
efciency and accuracy.
The Pseudo random number generator (PRNG), is similar to its continuous-time
counterpart (Fig. 4.18). It is a component, which is often used to simulate the noise
present in digital systems. Its graphical representation is shown in Fig. 4.22b.
The last six tools serve to create the corresponding components that model the
buffered operations in digital systems. Their graphical representations are shown in
Fig. 4.22ch.
The rst of these components the Buffer (Fig. 4.22c) generates a storage buffer in
the form of an array, whose size may grow. There is also an internal index pointing to
the rst free position in the buffer, which is initially set to zero. At every sampling
instant the value received at the left input port is stored in the next free position in the
buffer and the index is incremented. The port at the top serves to reset the Buffer by
setting the buffer index to zero. The buffer is reset when this port receives a nonzero
signal. The third, the output port, gives the value of the buffer handle. It is a number
indicating the position of the buffer in the list of buffers that the program internally
manages and is used to access the buffer to apply the operations on its elements by the
other components. It, thus, plays a role of the buffer id.
The buffer reset operation can be generated directly, or by the Reset component
shown in Fig. 4.22d. This component is intended to be used inside a trigger
component, a general discrete component with a trigger port (Fig. 2.11e). If the
trigger port is switched on the Reset component generates at its output value 1,
131
4.7
When editing bond graph models of electrical devices, using word model components in the usual (textual) form described in the previous section is perhaps not
too attractive to electrical engineers who are more used to the standard electrical
symbols. A similar situation exists in other elds, e.g. mechanical vibrations. To
enable generation of the Bond Graph components in more familiar forms in
addition to the Editing Box there is also a Template Box (Figs. 4.2, 4.10 and 4.18).
The template box currently contains only two template branches (Fig. 4.23):
Electrical Components, and Mechanical Components. The third branch Component
Orientation serves for the selection between horizontal (default) and vertical orientation of the generated components.
4.7.1
132
133
Start the BondSim application. Open a New project and input the project name,
e.g. RLC Circuit. Click OK. Now an empty document appears in the central part
of the screen.
Select the Template Box in the right tabbed window, and expand the Electrical
Components and Component Orientation branches.
Drag the Voltage Source template to the document window and drop it near the
left edge and at the middle height. Each time when dropping a component, click
outside of it to end text editing.
Drag and drop the Resistor and place it near the upper document rectangle edge
and to the right of the Voltage Source VS. Connect it to the voltage source by
drawing a bond between the corresponding ports. Reshape the bond line by
dragging and dropping to obtain a rectangular shape.
Drag and drop the Inductor and drop it to the right of the resistor R. Adjust its
position so that its left port is horizontally on the same height as the right resistor
port. Connect the ports.
Before inserting the capacitor, select Vertical in the Component Orientation
template. Drag the Capacitor and drop it to the right. It appears as a vertically
drawn capacitor C. Connect its upper port to the left port of the inductor.
Reshape the bond so that it forms a right angle. Click Horizontal in the
Component Orientation template to return to the default orientation.
Before adding the Ground we add rst a node by dragging and dropping the
Node component. However, its power port senses are not correct. We expect that
power flows from the capacitor through the right port and from the left port into
the voltage source; or out of the bottom port to the ground. To change the power
flow sense of a port we may select it and click the toolbar button which has two
half arrows (or select the Change Power Sense command in View menu). After
setting the proper power ports sense of the node connect it to the voltage source
and capacitor.
Now we need more space at the bottom of the node to add the ground component. We put the mouse cursor on the bottom edge of the inside bounding
rectangle. When it changes shape to the up-down arrow, press it and drag the
edge downward until we obtain enough space and then release the mouse.
Now we can drag the Ground and place it below the node and connect it to the
node. We thus obtain the Bond Graph model in as Fig. 4.24.
Now the model has the shape of the ordinary electrical circuit. Only the half
arrow indicates that it is a bond graph model. The model structure of the circuit is
shown in Fig. 4.24 at the left. We see that it has four word model components
represented by symbols: VS, R, L and C. However, these are empty components,
without underlaying model documents. Thus it is not the complete model.
However, we can develop the models in the usual way as was explained in the
previous section.
Note that Branch (node) and Ground are leaves of the model tree, or in Bond
Graph terminology the elements. The electrical nodes physically represent
branching of the currents flowing through them, thus it is really a 0-junction (see
134
4.7.2
135
Drag Connector and drop it below the top wall. A mechanical node appears
having three ports: the left, right and top. We assume the power flow direction
from the bottom (body) to the wall. Thus, we need to change the sense of the
right port by selecting it and clicking double half-arrow toolbar button. Now we
may connect the node to the top wall by drawing the bond.
Next, we will drag Spring and drop it bellow the connector node and to the left.
Then, drag Damper and drop it to the right of the node. The spring and damper
are drawn vertically. We position them approximately at the same heights. We
need to change direction of power flow through these components. Thus, we
select the spring and damper by clicking and then click the toolbar button to
change the power senses of their ports. Then connect the top ports to the
connector node then reshape the bonds so that they have right angle shapes.
Select the Horizontal orientation to return to the default orientation.
Add the bottom connector below the bottom ends of the spring and damper. We
must change the power sense of the left port, and remove the top port (by
selecting it and pressing the Delete key). We also have to insert the port at the
bottom. Hence, we need to return to the Editing Box by clicking its tab, and
expanding the Port branch. We drag and drop the Power-in port to the bottom
of the connector node. Return now back to the Template Box.
Similarly as in the last problem we enlarge the document working area by
dragging the lower edge of the inside bounding rectangle downward.
Finally, we drag Body from the template box and drop it below the bottom
connector node. A Body component appears, bounded by a box, and having the
power port at the left side. We will drag the port to the top, and change its power
flow sense. We will also drag the component to place its port exactly below the
bottom Connector port and draw the bond connecting these ports.
The model of the Body-spring-damper system is shown in Fig. 4.25. The central
window depicts the Bond Graph model, and on the left is shown its Model structure. We can see that the model consists of word model components: Ground
(corresponding to the top wall), k (corresponding to the spring with stiffness constants k), r (corresponding to the damper with linear damping constant r) and Body.
There are no underlying component models, but they can be easily added. The
Connectors are leafs of the model tree (Fig. 4.5). They are the points of common
velocity, hence the 1-junctions.
4.8
4.8.1
The port variables and the constitutive relations of elementary components are
stored in their port objects (Sect. 3.5) and, ultimately, in the component. The same
136
holds for block diagram components, with the difference that the constitutive
relations are stored in their output ports; input ports only store the input variables.
In addition, there are parameters that are dened at the document level, or locally in
the component. The constitutive relation can have different forms depending on the
type of component, as discussed in Sects. 2.5 and 2.6. The corresponding
expressions should conform to the rules of Sect. 3.5.
Default variable names and constitutive relations are dened at the component
port creation. These correspond to simple linear relations. The necessary parameters
also are dened and stored in the component. Hence, it is necessary to implement
methods that enable changing the variable names, parameters, and the constitutive
relations. We address the problem of the editing of variables and constitutive
relations rst. The parameters are discussed later.
Suitable dialogues (Fig. 4.26) are used to support modifying the variables and
the constitutive relations of the element ports in a user-friendly way. These are
invoked by double-clicking the ports of elementary or block diagram components.
In response, the component method is called to open the component port. The
method constructs a dialogue object and transfers data to it, which is then displayed
on the screen. Variable names and constitutive relations are edited using elds
provided by the dialogue. When the editing is nished and the data are accepted (by
clicking the OK button) the dialogue is closed and the data are stored back into the
components ports.
To enforce specic types of variables and constitutive relations, a separate
dialogue is dened for every type of component port. Figure 4.27 shows a dialogue
corresponding to an inertial component power port. Such a port dialog can be
opened e.g. by double-clicking I the component port in Fig. 4.20. Similar dialogues
are used for the other types of elementary port. The top part of the dialogs has elds
that are used for dening the constitutive relation, of the form discussed in Sect. 3.5.
Next are the elds that dene the port variables. On the left are the current port
variables, and on the right a list of other port variables can appear if the component
contains other ports as well. There is also a button that can be used to change the
values of, or dene new, parameters (constants).
Most elds can be changed simply by selecting it followed by editing using the
keyboard. The elds are instances of MFCs CEdit class, which implements
137
common text editing operations. Fields that should not to be changed are set as
read-only, e.g., the Effort eld (Fig. 4.27). Anytime during editing we can undo
the last change by clicking anywhere in the dialogue box.
When the editing is nished, the changes are accepted by clicking OK, or
rejected by clicking Cancel. If the OK button is chosen, the data are validated
before being sent back to the component port.
Validation is done by parsing and syntactical analysis of the expressions. A valid
variable starts with a letter, its length is not limited, and is case sensitive. The
symbols used in the constitutive relation can be port variables, the time symbol t,
which is a global variable, or numerical and symbolic constants. The syntax of the
constitutive expression should conform to the rules discussed in Sect. 3.5. If an
error is found, a message box appears with information about the error. The error
must be corrected before the data in the dialogue can be accepted, or else the user
must dismiss the dialogue by clicking the Cancel button.
Another check is also made before the data are transferred back to the component port. When port variable names are changed, these new names are checked
against the names used in the constitutive relations of the other ports contained in
the same component. If a match is found, a dialogue is opened that prompts the user
to change to a unique variable name. When all such corrections are made, the new
data are accepted and stored back into the component ports.
138
4.8.2
The parameters used in the port constitutive relation can be dened in the component that contains the port, in its container document, or in a lower-level document. The parameter denitions are stored in the document or components as the
lists.
A parameter is dened by its name and an expression. The expression can
contain literal constants, as well as other parameters already dened, as shown
below:
a 0:010
b a^ 2 5
c b 5:0e03
4:1
To dene a parameter in a component, the Parameters button of the port dialogue is used (Fig. 4.27). This invokes a dialogue that displays a list of parameters
dened in the component (Fig. 4.28).
The parameter list in Fig. 4.28 shows only one parameter I0. This is the
parameter that was dened by default at the construction of a I (inertial) component
port and appears in the constitutive relation in Fig. 4.27. To add a new parameter,
e.g. the rst parameter in Eq. 4.1, we type-in the parameter name in the editing box,
and then click the Insert button. A new dialog appears now as shown in Fig. 4.29. It
contains two editing boxes arranged in the form of an equation. The left side is
already dened and contains the parameter name that we have typed in previously,
and the right edit box is ready to accept a corresponding parameter expression. It
shows the default value of 0.0. We change this to 0.010, the value of parameter
a. When the OK button is pressed, the expression on the right side is parsed to
determine if it is syntactically correct and well dened. The dialog box closes and
the new inserted parameter appears in the parameter list. The parameter list is now
139
ready to accept the next parameter. Note that parameter names are case sensitive,
thus e.g. Mass and mass are different parameter names.
The new parameter is added at the end of the list. However, we may change the
position of a parameter in the list by dragging it before or after some other
parameter in the list. A parameter already dened in the list can be changed by
selecting it in the list rst, then pressing the Edit button. The same dialog appears
again, but this time showing the current value of the parameter. To save the changes
made we need to close the parameter dialog by pressing the OK button.
The parameters can be dened at the document level as well. To that end we may
click the toolbar button denoted by P (Fig. 4.11), or use the Model Parameters
command from the Edit menu. In response the same dialogue appears; but this time
it displays parameters dened in the active document. The procedure of editing
parameters is of course identical to that described above, but the created or modied
parameters are stored in the current document.
The parsing and syntactical analysis of parameter expressions are similar to that
implemented for the constitutive relations. The parameter expression is accepted if
the expressions are correct and all parameters are well dened, i.e. they are in this
parameter list, or are dened in some other lower level document.
These parameter lists are ordered in the same way as the components and
documents. Thus, the parameter denitions can be looked at as the list of lists, or
as a parameter tree. Each node of the lists corresponds to a list contained in a
component, or in a lower level document, and nally in the application (Fig. 4.30).
Some of the nodes may be empty.
The lists are searched in the direction from the component to the root document
and the application. Thus if, during the parsing of a constitutive expression in an
elementary component, a symbol is met that is not a port variable, the time or literal
constant, then the parameter lists are searched to see if the symbol is already dened
as a parameter. The search starts at the component parameter list, then the parameter
list dened in the container document, then the last document is searched, and the
140
search is continued until the root document and global parameter list dened in the
application are reached (Fig. 4.30). The rst occurrence of the symbol is taken as its
denition. All possible lower level denitions are ignored.
In this way, a parameter dened at some level hides the same parameter dened
at a lower level. This may be termed the parameter hiding, and is similar to hiding
of the local variables in the C/C++ language. The hierarchical structure of the
parameter denition has several important impacts on modelling.
The often used constants such as the important mathematical and physical
constants, the program constants and the alike are dened as the named parameters.
The list of such constants dened in the BondSim program are termed the global
parameters and are shown in Table 4.1.
Due to the search procedure dened above these constants are visible in any
document and the contained elementary components. In the same vein parameters
specic to some project can be dened in the project document (the root).
The typical values of parameters of a component could be e.g. dened at the
level of its component model. However, the more specic values of the same
parameters can be dened closely to its detailed model, i.e. at higher levels. In this
way we can start to study by using a general model based on typical parameters,
and when the model is rened, a new denition of the same parameter is introduced
that hide the previous typical values. We use this procedure when dealing with
practical problems in the second part of the book, e.g. when dealing with semiconductor models.
141
Value
Note
g
9.80665
Gravity constant (m/s2)
PI
3.141592653589793
constant
BOLTZMANN
1.380662e23
Boltzmann constant (J/K)
ECHARGE
1.6021892e19
Electron charge (C)
EGSI
1.12
Energy gap in Si (V)
TNOM
300.0
Nominal working temperature (K)
BG_EPSILON
4DBL_EPSILON
BondSim epsilon
BG_MAX
DBL_MAX
BondSim maximum value
MEXP
50.0
BondSim maximum exponent
BG_e
2.718281828459045
Basis of natural logarithm
DBL_EPSILON = 2.2204460492503131e016, DBL_MAX = 1.7976931348623158e+308
4.9
Library Operations
The program space where the work is conducted and the data are stored is divided
in BondSim into two main subspaces. The workspace is a part where the main
development work is done and models are stored. Another is the library, which
serves as a repository for projects and components. All the previous operations take
place in the workspace. But, the Library is important, as well.
To simplify access to the Library its contents are shown using an Explorer style
tree in the tabbed window Models Library. This window together with the Model
structure tab is contained in a separate window frame at the left of the main
window. An expanded part of Models Library window is shown in Fig. 4.31.
It is divided into several parts:
Project
Word model components
Electrical components
Mechanical components
We describe next these library branches and how they are used when developing
models for a project.
142
4.9.1
Library Projects
By expanding the Project branch we obtained a list of project les stored in the
library (Fig. 4.32).
Most of these are the projects that we will develop in the second part of this
book, when practical applications are considered. To see what we can do with these
projects click by the right mouse key any of these projects, e.g. Body Spring
Damper Problem. A drop down menu appears as shown in Fig. 4.33.
The menu contains several commands. The Open command is used to open the
library project. The project opens in the main window, but the project title is now
View project: project name (see Fig. 4.34). This indicates that opened project is
in the viewing mode. Thus, we can walk through the project, but changing nothing.
Simultaneously the Models Library tab switches to the Model View tab and the
structure of the library project model is shown. We can walk through the project by
double-clicking documents in the central window or expanding the branches in the
Model structure (or in other ways as we already have discussed).
The Remove command enables the user to remove some of the project from the
library database. We can insert a project into the library by copying a project from
143
the workspace. For that purpose under the Project menu there is a command Copy
to Library as already discussed in Sect. 4.2. Similarly, we may copy a project from
the library into the workspace using the command Copy to the Workspace
(Fig. 4.33).
Finally, there is a Repair command, which is used to repair the library subspace.
The command is similar to that of the Project menu (Sect. 4.2).
4.9.2
Library Components
The components are organized in a similar way. Figure 4.35 shows an expanded
Word model components branch. It contains different components, all of which are
stored in the corresponding containers as les. If we right click any of these
144
145
components a drop-down menu appears, which has the same form as in the previous subsection, with a difference that Copy to the Workspace command is now
unavailable. Therefore, we may open a component as we did with projects, or
remove it from the library. To use a component during model development we
simply use the drag and drop technique as we did with the Editing and Template
boxes. Thus, we pick a library component with the mouse and drag it into a
document window. The application copies the corresponding word model component and all underlying documents.
The Electrical and Mechanical Components are organized in a similar way.
Figure 4.36 shows the expanded Electrical Components branch.
The component library is further divided into specic types, such as Resistor,
Inductor, Diode, Opamp, and others. Each of these sub branches contains specic
components. Thus, e.g. the Resistor type contains only one component denoted as
R. This is a specic component that we can open to see its description in terms of a
Bond Graph model. We can also use it by dragging and dropping it into a corresponding document. The library can contain the other components as well, e.g.
models of commercial resistors, etc. Similarly this holds for Mechanical
Components.
Similarly as with projects we can also insert a component by copying it from a
project document into the library. The Document menu, which is active when a
146
4.10
This section reviews some of the most important document-level operations. These
commands are collected under menus that appear when the rst documentthe
project root documentis opened. These are: Document, Edit, View, Tools,
Window, Simulation, and Help. Some of these commands can also be invoked by
pressing the appropriate tool bar button, or using the keyboard shortcuts.
Many of these commands we have already met. We will describe here some
others that concern model development. These are found in the rst four menus:
4.10
147
Document, Edit, View, and Tools. They implement methods already discussed in
Chap. 3.
The Windows menu contains standard Windows commands, such as Cascade
and Tile, used for arranging windows on the screen. The menu also contains one
specic command: Refresh. This is used to update (redraw) the active window, e.g.
during editing of the bond graph model. There is also a list of all opened documents
at the bottom. These are used to activate the corresponding frame windows. Note
that there is no New Window command in the Window menu, as is customary in
Windows applications. Every document is shown in just one document frame.
Commands in the Simulation menu deal with simulation tasks. We postpone
discussion of these commands until Chap. 5. The Help menu contains commands
that link to the program documentation, as already described at the end of Sect. 4.2.
148
met. This command stores the current document in its component storage, or disk if
it is a project level document.6 In the process, all objects contained in the documents, such as components, ports, bonds, and others, are called to store themselves
in a document archive before the document is stored.
The Save to Project command successively stores documents from the current
document to the project level document. In terms of the model tree structure it
means storing data from a branch down the tree until and including the root. This
command, thus, assures that the project contains the all changes. However, if we
issue the command Save Project the complete project is stored including its all open
documents.
Usually the structured storage data are held on disk in temporary working locations, which are
released after nal store operation is completed.
4.10
149
saved. The extension is predened as .emf. After the dialog is closed by clicking
OK, the command invokes methods very similar to those used for drawing to the
screen, but uses the MFC Library metale context to draw to the specied le [1].
The emf les can be imported by most word processors and graphic programs, such
as MS Word, CorelDraw, and Adobe Illustrator.
150
a component to the buffer we rst select it, and then apply the Copy command, or
Ctrl+C shortcut. Copying means, as has been already stated, creating a new
component object that is a replica of the one being copied. The copy has a new id
and lename. Thus, the document of the original component, as well as those of any
contained components, must be copied. The pointer of the newly created component is put into the Component Buffer.
The components in the Component Buffer can be inserted back into a document
by applying the Insert command from Edit menu, or Ctrl+V shortcut (equivalent of
Paste command). This opens a dialogue with a list of the components that are in the
buffer. Selecting a component from the list and clicking the OK button closes the
dialog and sends a message to the active view, which changes its state to the Insert
Component mode. The status bar displays a message informing the user to pick a
place in the document to insert the component. In the same way as when creating a
component (Sect. 2.6.2), as soon as the cursor is moved into the document area it
changes to a cross, which is surrounded by a rectangle corresponding to the
bounding rectangle of the component that is being inserted. We need to place the
cursor so that this bounding rectangle is completely inside the document working
area. Clicking the left mouse button inserts a copy of the component into the
document.
All the above commands can also be applied to a set of selected components
(Sect. 4.5). We create a separate object to copy or move a selected set of the objects
from the document to a buffer, and back (Sect. 3.8).
The components in the set can be deleted or cut from the document if they are
not connected to other components not belonging to the selected set. In this case,
we simply proceed as explained in Sect. 3.8. Hence, we create a component set
object, remove the pointers of the selected objects from the document and add them
to this object. The object can then be added to a buffer (the Waste Bin or the
Component Buffer). When adding the component set to the buffer, we must append
a suitable reference name. It is not necessary that this name be unique. Any name
conflict is resolved easily by automatically adding a version indicator, e.g. Body,
Body.1, Body.2. (Whether or not the names are the same, they represent different
objects.)
We copy a selection in a similar way. In this case, the components in the set need
not be disconnected from the other components. We again create a component set
object and add to it copies of all selected components and bonds (Sect. 3.8). Copies
of its documents and of all contained documents are made, as well. The new
component set object is then added to the buffer.
Inserting a set of components from the buffer is made in the same way as when
inserting a component. Copies of all components and bonds in the set are created
and added to the document. Their positions are changed to correspond to the
position chosen on the screen. Copies of all documents are also made. Next, a
temporary selection set object is created, pointers to objects inserted in the document are added to the selection object, and all of the objects in the set are selected.
The selected components can now be moved across the screen, if required.
4.10
151
4.11
Inter-process Communications
Bond Graphs basically describe systems in a rather abstract way. For example a ball
bouncing on a horizontal surface can be modeled by Bond Graph models in
combination with signal processing components and display plots. Using the
simulation the motion of a ball can be presented in the form of plots of the position
of the balls center in 3D space over the time, the changes of its velocity components, reaction forces at the impact with the surface, etc. It would be useful if we
simultaneously visualize the ball motion in 3D space in a similar way as when we
watch the ball motion over the floor. 3D geometrical modelling and visualization is
in general very useful when dealing with mechanical systems, such as robots,
clouds of particles, etc.
It is rather complicated to have all this in one place. The approach that we take
here is to concentrate in BondSim on the dynamical side of the problem and to
enable communication with other applications that look on the problem from a
different point of view, e.g. using 3D geometric models and visualization. To that
goal the BondSim application supports inter-process communication (IPC),
Fig. 4.38. With modern computer technology the two systems can appear as one
complex system. In one window we can have many different plots giving details of
the system dynamics, and in the other on the same or different screen we can
visualize the system motion in a 3D scene.
The communication between the Visualization and Simulation can be realized in
different ways [6]. It must ensure that the movement of the geometric object such as
the bouncing balls, robot arms etc. over a 3D scene are smooth for a viewer, without
152
freezing of the objects or their sudden jumps. To that end the scene should be
fleshed for a short time (typically 1/24, 1/25 or 1/30 s) and then immediately
replaced by the next one. Illusion of the objects moving is usually explained by
persistence of the vision, which blends the picture frames together.
The data should be exchanged in a proper order, and also in a strict time
sequence. The data packets exchanged are not large; typically they are of the order
of 50100 bytes. Thus e.g. if six joint angles of a robot were exchanged using the
floating point precision this is only 6 4 = 24 bytes. The packets are, however,
transmitted with a rather high frequency, e.g. every 3050 ms. There is thus nearly
a continuous flow of the data. After the data receiving the Visualization application
recalculates the new positions of the objects and redraws the scene. The possible
mechanisms for the IPC that are considered were the TCP/IP and Pipes.
The TCP/IP is the well-known set of communications protocols used for Internet
and similar networks. Its basic protocols are the Transmission Control Protocol
(TCP) and Internet Protocol (IP). IP works by exchanging the pieces of information
called packets between the computers on the Internet. The TCP provides a communication service at an intermediate level between the application program and the
Internet Protocol (IP). TCP ensures that all the bytes received are identical to the
bytes sent and that are in the correct order. It is optimized for the accurate rather
than timely delivery. Thus, during the transmission there are often relatively long
delays due to waiting for out of order messages, or resending the lost messages. The
sizes of the packets are often increased by collecting the data before the
transmission.
The TCP/IP ensures the correct transmission of the bytes sent, but its timing is
not guaranteed. Thus, it is not suitable for the IPC we need. After initial experimentation with the TCP/IP solutions, nally the named pipe mechanism was
chosen. It enables that two applications running on the same or a different computer
connected by a local net establish a two-way communication. It is also more
responsive and can ensure the proper timing of the packets sent and received.
A scheme of the IPC based on the named pipe is shown in Fig. 4.39.
There are two sides of the pipe, the servers and clients. The intercommunication between the processes starts on the server side, which creates a thread7 that is
used to listen for the massages received from the client. The Server then sends a
7
A thread is an execution stream within a process. A single process may be broken up into multiple
threads. The threads allow the concurrency. Thus, one tread may execute while the others are busy.
4.11
Inter-process Communications
153
request to the Client to connect. When the Client connects the inter-process communications starts. In our case the Server is the visualization process, and the Client
is the simulation process.
After the start and regularly during the simulation, e.g. after every 50 ms, the
quantities that the visualization process needs are generated. They are packed in an
order in which the Server expects them and written into a message, which is sent to
the Server. The Server reads the message, processes it, reevaluates and redraws the
visual scene. Eventually it answers by sending its own message back to the Client.
The data that are sent back are what the Client expects from the Server and are used
inside the simulation process. The complete process lasts until the Client closes the
communication. Both processes interconnected by the pipe behave as one process
showing the problem from both sidesthe results of the simulation e.g. in the form
of the plots and the visualization of the mechanism motion over spacein the
separate windows.
It should be pointed out that there is a problem of different time scales in the
simulation and the visualization processes, because they are the separate processes.
On the simulation side the real (wall clock) time in which the system simulation is
executed is generally different from the simulation time. Thus if we simulate the
motion of a system during e.g. 5 s of simulation time, the computer on which the
simulation is running can execute the complete simulation in much less times, e.g.
100 ms. On the other hand we expect that the visualization time corresponds to the
motion of the real object. However, if the process is too quick, e.g. if the complete
robot motion lasts 2 s, to visualize the motion in the scene it can be useful to slow it
down, or replay it. To attack these problems the different approaches could be used.
Currently the simulation is delayed for a xed time each time it has sent the data to
the server. The delay time can be set at the start of the simulation. How the both
processes works together will be discussed in Chap. 9 on example of a robot
motion.
The BondSim implements the clients side of the named pipe (Fig. 5.39) following [4, 5]. To that purpose it is necessary rst to construct an IPC pipe interface
component at the projects root document. It denes the clients side of the pipe.
The Edit Box (Fig. 4.18 at left) under the Continuous Signal Components branch
contains the IPC pipe tool. By dragging and dropping this tool into the project root
document the corresponding client IPC interface component is created. Only a
single pipe component is permitted.
Figure 4.40 shows a simple example of use of the IPC client interface. The
system consists of three input generators (Fig. 4.40) named as Rate1 to Rate3,
which generates the corresponding the angular velocities. These velocities are
integrated to obtain the corresponding angles, which we wish to send to the Server.
To that end we create a client IPC interface component by dragging and dropping
the IPC pipe tool from the Edit box as has been explained earlier. After its creation
it appears as a ring (a pipe cross-section) having by the default four input ports. The
input ports serve to collect the signals whose values are sent to the Server. We may
add more control-in ports if there are more signals we needed to transmit. Likewise,
154
we may add the control-out ports to access the information received from the
Server.
In this example we will remove one of the control-in ports and drag the other
three to the left side of the IPC interface component and connect them to the
corresponding nodes as shown in Fig. 4.40. Next, we double-click the output ports
of each integrator and rename their variables to q1, q2, or q3. In the same way we
change the names of the corresponding IPC component input ports. In this way we
specied that the variables q1, q2, and q3 generated by the simulation will be
collected and sent to the Server. At the right side of the IPC component, the three
output ports are added (using the corresponding the Port tools in the EditBox) and
its output variables are renamed to x, y and z. Hence, these are the signals received
from the Server. These ports in this example are simply connected to an X-Y
4.11
Inter-process Communications
155
References
1. MSDN Library (2012) Development tools and languages, Visual Studio 2012. http://msdn.
microsoft.com/en-us/library/dd831853(v=vs.110).aspx. Accessed 13 May 2014
2. Dami V, Montgomery J (2003) Mechatronics by Bond GraphsAn object-oriented approach
to modelling and simulations. Springer, Berlin
3. Microsoft Wiki (2014) Globally unique identier, Microsoft.wikia.com/wiki/Globally_Unique_
Identier. Accessed 27 May 2014
4. Multithreaded Pipe Server, msdn.microsoft.com/en-us/library/windows/desktop/aa365588(v=
vs.85).aspx. Accessed 12 Oct 2013
5. Named Pipe Client (2013) msdn.microsoft.com/en-us/library/windows/desktop/aa365592(v=vs.
85).aspx. Accessed 12 Oct 2013
6. Vuskovic M (2013) Operating systems, inter-process communications. http://medusa.sdsu.edu/
cs570/Lectures/Chapter9.pdf. Accessed 12 Oct 2013
Chapter 5
5.1
Introduction
157
158
5.2
In Sects. 2.5 and 2.6 we gave a fairly general description of the constitutive relation
of components used as the building blocks for developing models of systems. Using
the techniques of Chaps. 3 and 4, such models are generated and stored as a tree of
component models. These models consist of relations dened in elementary components that are the leaves of the model tree and which are constrained by relations
describing the interconnections of components that are the branches of the tree. The
models are made more general and, unfortunately, more difcult to solve by
allowing the mixing of bond graph based models with operations on signals. Here
we discuss the general procedure for building system mathematical model of a
project under the study.
5.2.1
The rst step in building the mathematical model is dening a unique set of system
variables. When an elementary component is created the corresponding power ports
are created too. The number of such ports depends on the type of the component. In
some components, e.g. 1 or 0 junctions, a port can be removed or a new one added.
Typically the elementary component ports are power ports, but could be control-in
or control-out ones as shown in Sect. 2.5.8. This holds also for the block diagram
components, but in this case, the ports are control-in or control-out only. Every
created component is unique and is identied by a unique ID (Sect. 4.6.1).
Similarly, every component port is unique as well and is identied by its label,
which represents the ordinal number of the created port.
As already disused in Sects. 2.5 and 2.6 the processes seen at the elementary
components power ports are described by effort and flow power variables and the
corresponding constitutive relations in term of these variables and the parameters.
During the creation of the ports default names of these variables are dened, and
default constitutive relations as well (see Sect. 4.8.1). These names are local in the
component in question and serve only to dene the corresponding constitutive
relation. These variables and the corresponding constitutive relation can be modied by the user. Some components in addition to the power variables use also the
internal state variables. Thus, the inertial components use the generalized
momentums, and the capacitive ones uses the generalized displacements. This holds
also for the control ports of the block diagram components. In this case, however,
there is only one port variableinput, or outputthe constitutive relation is
dened in the control-out port only.
In order to support generation of the system variables, to every port variable
name a corresponding global variable is dened. These variables are not seen by the
user and are internal to the BondSim program. They are employed to dene a
unique set of the system variables, which are used for dening the mathematical
159
model of the current project. These global port variables are rather clumsy and
consist of a leading symbol, the port ordinary number and the component ID. Thus,
e.g. an effort global port variable can have a form
EffortVar e0 #YzifgzgnKgzfe4w05gvi3iqc2f
Connecting two component ports by a bond means that the respective global
efforts and flows of the connected ports are represent by the same system variables.
Thus, these two efforts, or two flows, can be represented by their respective system
variable. We need to develop a technique for dening a unique set of system
variables that represents variables of all elementary and block diagram ports. We do
this by means of the symbol tables.
A symbol table consists of pairs of the port global and system variables. The
system variables can be described by integer indices running from 1 and up. The
index zero (0) is reserved for time t. The symbol table is simply a map (dictionary)
of the port global variables as the keys into the map and system variable indices as
their values. The keys are a unique and are used to search the map for their values.
It is similar to the ordinary language dictionaries. We use a word as the key into the
dictionary to nd its meaning (the value). The map structures are used because of
their shorter search times, which is important during mathematical model creation.
Because we can have two distinct types of physical processcontinuous-time
and discrete-timeswe use the separate symbol tables for each of these. We start
with the continuous-time processes which encompasses Bond Graphs and
continuous-time the block diagrams.
The procedure for the creation of the symbol table consists of traversing the
components, starting from the lowest level and going upwards. During this procedure a port variable is put into the table along with its corresponding system
variable index. We start with the effort and flow junctions, and then continue with
other elementary and block diagram components.
The effort junctions are characterised by the fact that all of their port flows are
the same variable, i.e. the common junction variable (Sect. 2.5.7). Similarly, this
holds for the flow junctions, with the common junction variable being the effort.
The procedure for assigning the system variables is as follows (Fig. 5.1):
1. Increment the index of the system variables by one. Insert in the symbol table
the common junction flow (effort) variable symbol as the key, and the current
system variable index as the value.
2. For every junction power port nd rst the value of the system variable index
corresponding to the junction flow (effort) variable. Then search then for the
port of the elementary component to which it is connected. If the component is
of the same type, i.e. if the effort junction port is connected to a port of another
effort junction or the flow junction port is connected to a port of another flow
junction, treat the ports then as the internal ones and the junction as the same
junction, and proceed further. If, on the other hand, it is a port of another
160
component type, get the port flow (effort) variable and insert it into the symbol
table using the current system variable index.
3. If the port is a control-out port, the procedure is slightly different. Find the
control-in port to which it is connected. Get the corresponding input variable
and insert it into the symbol table using the current value of the system variable
index. The search is stopped if the connected to port is the input port of an
Integrator, a Differentiator, or an Output component. Otherwise, if it is a
Function or a Summator component, continue at the component output port.
Break the search if the output variable is already dened in the symbol table.
Otherwise, increment the index of the system variables. Insert this value in the
symbol table using the output port variable as the key. Continue the search.
Finally if it is a Node input port, nd the port connected to each of its output
ports and continue the search because all node ports share the same variable.
4. Continue with the search and assignment of variables until all power or control
ports of the junction and of other junctions of the same type that are connected
to it are traversed.
5. Continue with the next junction until all junctions are visited.
The procedure outlined above ensures spreading out the common junction
variables to all ports connected directly to it, or across other junction components of
the same type (Fig. 5.1). It also creates variables of input-output components
connected to it. It is important to do this during effort or flow junction variable
assignment, for it is one of the common connection points between bond graphs and
the control signal paths. We stress that this procedure ensures that all directly
connected junctions of the same type behave as a single junction.
After nishing with the effort and flow junctions, we proceed to the other
components. The procedure is similar to the one described above, but is slightly
simpler.
For every unprocessed elementary component port variablei.e. an effort, flow,
or controlwe increment the system variable index by one and insert the variable
161
symbol-system variable index pair into the symbol table. We then nd the port to
which it is connected and add its corresponding variable symbol and the current
value of the system variable index into the symbol table. If the port is an output
control port, we proceed as explained above (item 3). The elementary component
control input ports, e.g. resistive component inputs or transformer input ports, are
dealt with when assigning input-output (block-diagram) component port variables.
Internal variables of inertial and capacitive components are also added to the
symbol table.
Processing of the block-diagram components is similar. We start at the output
ports of Input, Integrator or Differentiator components, increment the system
variable index and insert it into the symbol table using the output variable symbol
as the key. Next we nd the input control port of the component to which it is
connected, and continue in the same way as explained in item 3 above. The search
is stopped when the connected port is the input to an Integrator, Differentiator,
Output component, or a Bond Graph elementary component.
The discrete-time processes are treated similarly but using the discrete variables
symbol table. The search starts at the output ports of A/D converter, Input, or Delay
components, and continue at the output port of the connected to component, and
stops at the D/A converters input ports. We end the discrete path by D/A converters
because in Mechatronics we typically use discrete (digital) signals for either control
of analog devices (e.g. by actuators), or for monitoring (displays).
During the generation of the system variables and populating the symbol tables,
the correctness of the components interconnection is checked too. First, if some
ports are not connected the procedure is stopped and the reason is conveyed to the
user by a suitable message displayed in the Output widow under the Build tab
(Figs. 4.2, or 4.8). Similarly, if the connection on each side of a component does not
te.g. because of incorrect dimensions of the bonds (Sect. 3.7)the procedure is
stopped and a message is posted. Finally, the elementary components are checked
to ensure that the connections are valid (Table 5.1). The elementary components
that are not the junction componentsi.e. effort or flow junctions, Transformers, or
Gyratorscan only be connected to the junction components. The junction components, on the other hand, can be connected to any component. We rule out direct
interconnections of Transformers, or Gyrators, as these combinations are not necessary, e.g. TF-TF is just TF, as is GY-GY.
In the block diagram components the output ports should be connected to the
input ports of the other components. In addition the interconnections are permitted
only between the same kinds of components, i.e. either between the
continuous-time, or discrete-time components. Only the components where a mix
of the signals is permitted are A/D and D/A converters.
Table 5.1 Permited
interconnection of the
elementary components
Components
Permitted connection
I, C, R, SE, SF, Sw
1, 0
TF, GY
1, 0, TF, GY
All
All but not of the same type
162
5.2.2
Once the system variables are dened and their correspondence to port variables
names established, the next step is to generate equations that describe the constitutive relations of the elements. There are no built-in relations; every relation is
either created when the component port is created, or edited later by the user. These
relations are described in a manner similar to that of the usual mathematical
expressions, as explained in Sect. 3.5.
Relations are not translated to subroutines or functions, but are instead, translated to another string that are called byte form and is based on prex (Polish)
notation. This notation was selected because, as is well known, it enables writing an
expression as a brackets free expression. The constitutive relations are translated to
symbolic form that can easily be decompiled to a more familiar mathematical
expression, if required (Sect. 5.4). This form of the constitutive relations is directly
processed symbolically to generate the system Jacobian matrices in the analytical
form. These matrices are needed for the numerical solution of the system equation
during the simulation (Sect. 5.3). The byte form of the system equations and
Jacobians enables their transformation into stack based expressions for their efcient evaluation during a simulation run (Sect. 5.7).
Without going into too much detail, we now explain how the mathematical model
equations are created. During the model building the constitutive relations, which are
held in the elementary component ports, are analysed, translated to byte forms, and
are stored in an array that is accessible for further processing. The method used is an
extension of the approach of [1]. The byte string form is based on the prex operator
form in which the operators are written to the left of its operands, i.e. as
Operator
Operand1
Operand2
5:1
Note, there is no spaces in the byte expressions; they are used only for
readability.
During the constitutive relation parsing the literal constants found are encoded
using operator C and the value of the parameter represented as a real (double)
number, i.e.
C constant value
5:2
5:3
163
Note that parameter evaluation means that the complete hierarchy of parameters is
searched, starting with parameters in the particular component, until the complete
parameter expression is evaluated (Sect. 4.8.2).
Every occurrence of a port variable name, or time, is encoded using operator
V and the integer value of its system variable index
V var index
5:4
5:5
Discrete variables are dened similarly using operator Z and the discrete system
variable index using the discrete symbol table, i.e.
Z var index
5:6
5:7
164
The operator ?: is borrowed from the C language and is used for if then else
constructs. The constitutive relationship describing some physical process often
cannot be described by a single expression valid throughout the range of the
variables, but by two or more expressions valid in different parts of the range. This
is the case, for example, with dry friction in mechanics, and in semiconductor
models in electronics. To describe such relationships we use ternary ?: operators.
The conditional part is described using relational or logical operators, and the
expressional parts are constructed in the usual way. The expression is encoded as
given in (5.7). Thus, for example, expression
c[0 ? e : e1
which reads as e, if c is greater than zero, and e + 1 otherwise, is encoded as
T?B [ V12C0V43B V43C1
where 12 is used as the index of variable c and 43 of variable e.
We also introduce single- and two-variable operators for encoding the functions
dened by tables of values (see Sect. 7.5 for an example), and functions dened
symbolically.
The element constitutive relations are dened as
var expression
5:8
where var stands for the port variable and the expression is the constitutive relation
of the element. Most processes are described by a single relationship of this form
(Sects. 2.6 and 2.7). This is the case for processes at Resistor or Transformer ports.
Such relations are written in implicit form as
var expression 0
5:9
5:10
and encoded as
5:11
165
where x is the internal state variable displacement or momentum of the process and
y is a port effort or flow. The Integrator input-output relationship is described in a
similar form. Such equations are also written in the implicit form as
dx
y0
dt
5:12
5:13
and encoded by
5:14
166
constitutive relations at all, as their roles are taken care of during the generation of the
model variables (Sect. 5.2.1). These equations can be written compactly as
B2 y 0
5:15
5:16
5:17
where z[k] is value of the discrete variables at the current sampling interval k, and u
[k] is the current value of the inputs. The equation predicts the value of discrete
variables z at the next sampling interval in terms of the current values of the
variables and the inputs. The inputs are generally generated by A/D converters and
thus dependent on the value of the continuous-time variable at the sampling time
kTs, where Ts is the sampling interval. Therefore evaluation of the discrete equation
should be coordinated with solution of the continuous-time model.
5.2.3
167
5:18
5:19
Thus, if the partial derivative matrix @g=@y is not singular, this is a system of
ordinary differential equations and, hence, (5.18) has a differential index one. If, on
the other hand, the partial derivative matrix is singular, we proceed as described in
[4]. Supposing that @g=@y is of constant rank, we can transform (5.19) at least
locally to the form
x_ f 1 x; y; t
g1 x; t 0
5:20
This can be achieved by expressing the y-variables that appear in some of the
algebraic equations of (5.18) as functions of the x- and other y-variables, eliminating them from the system. As a result, the new algebraic equation is independent
of the y-variables.
As an illustration, we return to the see-saw problem of Sect. 2.7 and show that
(2.72)(2.75) and (2.98)(2.102), which describe the system, can easily be converted to the form of (5.20). Thus, forces Fb1x and Fb1y can be evaluated from the
last two equations in (2.72) of Body 1 motion and substituted into the rst two. We
can also eliminate the gravity force G1y. In a similar way, we eliminate the corresponding variables in (2.73) of Body 2 motion. In the same way we can eliminate
components FCx, FCy and Gy from (2.101) of the platform mass center motion, and
the moment MC in (2.102) of the platform rotation. Next, we can eliminate
moments in (2.102) by use of the relations in (2.98)(2.100), and (2.75). The
angular velocity in (2.75) is eliminated using (2.74), (2.75) and (2.102). In this way,
we get the rst part of the system equations, which involves derivatives of variables
with respect to time, as shown in (5.21).
We can now eliminate the velocity components from the system. Thus, the
velocity components in (2.72) can be eliminated using (2.98), (2.100), (2.74), (2.75)
and (2.102). We handle the velocity components in (2.73) and (2.101) in a similar
way. Finally, we obtain the system of algebraic equations in (5.22), which contains
only differentiated variables: momenta and the rotation angle.
168
p_ b1x F1x
p_ b1y F1y m1 g
p_ b2x F2x
p_ b2y F2y m2 g
p_ Cx F1x F2x FPx
p_ Cy F1y F2y FPy mg
K_ C a sin / c cos /F1x a cos / c sin /F1y
9
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
=
>
>
>
>
>
>
>
>
>
>
a sin / c cos /F2x a cos / c sin /F2y >
>
>
>
>
>
b cos /FPx b sin /FPx
>
>
>
;
_/ KC =IC
9
pb1x m1 =IC a sin / b c cos /KC >
>
>
>
pb1y m1 =IC a cos / b c sin /KC >
>
>
>
p m =I a sin / b c cos /K =
b2x
>
>
>
>
>
>
>
>
;
5:21
5:22
In this way, the equations of the see-saw motion can be reduced to eight
equations in differential form and six algebraic equations. These contain eight
differentiated and six algebraic variables. The differentiated variables are constrained by the algebraic equations, and hence only two of them are independent.
This is to be expected, for the see-saw is a single-degree-of-freedom system and, as
such, its dynamics can be described by only two variables, the angle of rotation and
its angular momentum (or angular velocity).
We now return to (5.20) and differentiate the last equation with respect to t,
@g1
@g
x_ 1
@x
@t
Substituting from the rst (5.20), we obtain the expression
@g1
@g
f 1 x; y; t 1
@x
@t
5:23
This last equation constitutes a hidden constraint that the solution of the system
must satisfy. Thus, if the matrix
@g1 @f 1
@x @y
5:24
169
is invertible, then the rst (5.20) and (5.23) constitute an index 1 problem.
Differentiating with respect to time, (5.23) gives a differential equation with respect
to variable y. Hence, the system of (5.20) is of differential index 2. The algebraic
variables that need two differentiations in order to express them as differential
equations often are called index-2 variables.
Returning to (5.21) and (5.22), we see that they constitute a system of DAEs of
index-2. The hidden constraints can be found by differentiating the momentum
relations of (5.22) and by substituting from (5.21). We do not give them here
because of their length. It should be noted that reaction forces between bodies and
the platform, as well as between the frame and the pivot (Fig. 2.15), are index-2
variables. These variables correspond to the Lagrangian multipliers of the constrained body mechanics. In the original formulation of the see-saw problem all the
algebraic variables are not of index-2 type. Thus, for example, the velocity components v1x and v1y of (2.72) are of index-1 because we only need one differentiation to get the corresponding differential equations, e.g.
v_ 1x p_ b1x =m1 Fb1x =m1
Equations (5.14)(5.16) are semi-explicit differential-algebraic equations. To
simplify the notation we dene a variable
x
X
y
5:25
5:26
@g
@ X_
5:27
I
0
0
0
5:28
170
5:29
171
5:31
Here u2 u1 is the voltage across the inductor, is the flux, i is the current
through the inductor, and L is the inductance parameter (for the linear inductors).
The equations are added along with the constitutive relations for capacitors to the
nodal equations. The constitutive relations of current-controlled elements are set
directly into the nodal equations.
As an illustration of equations formed using the charge/flux based MNA
approach, consider the simple of circuit in Fig. 5.2. The equations read
172
9
i1 u1 u2 =R 0 >
>
>
>
u1 u2 =R i2 0 >
>
>
>
>
>
i2 q_ 0
>
=
u1 V
>
>
>
U_ u2 u3 0
>
>
>
>
>
>
U L i2
>
>
;
q C u3
5:32
The rst three equations are written by applying the Kirchhoff current law to the
three nodes. The fourth equation gives the constitutive relation of the voltage
source, the next two describe the inductor, and the last is the constitutive relation of
the capacitor.
Charge/flux based MNA is used to describe charge and flux accumulations in
circuits in a better way. It has also been shown that circuit equations based on this
formalism are better suited to simulation [7, 8]. The explanation for this is found in
the leading coefcient matrix null-space that, for the charge/flux based formulation,
does not change during the solution.
There are few papers in the bond graph literature dealing with the analysis of the
DAEs formulation of bond graph models. Important papers in this respect are [10,
11]. These show that the index of the system model can be larger than 2. A similar
analysis is made for electrical circuits in [12]. We believe that most models of
engineering systems have indices not greater than two. Higher index systems at the
current state of solver techniques are difcult to solve by a general-purpose modelling and simulation system. Model reformulation and some specialized approaches are then necessary.
In [13] an approach based on tearing variables for dependent storage elements
has been proposed. It suggests changing the model by introducing Langrange
multipliers. Structural type analysis, such as the causality analysis already discussed
in Sect. 2.10, is generally of limited value, as the structure of real problem models
generally change during solution. The problems can be treated more generally using
the projectors of [5, 6]. But, unfortunately, this is not an easy task.
173
The conclusion that can be drawn from these discussions is that the form of the
model generated by the program is suited to simulation because of the constant
leading coefcient matrix. We believe it serves as an acceptable frame for the
successful modelling and simulation of the mechatronic systems in Part 2.
5.3
This section describes the methods and strategy for the solution of the generated
differential-algebraic equations. Among the possible candidates for solving DAEs,
two methods have attracted most attention: those based on backward difference
formula methods, known as BDF methods; and various kinds of the Runge-Kutta
method [3, 4]. Among the implementations of BDF methods, perhaps the
best-known software is DASSL, of which a detailed description can be found in [3].
It is freely available from the NETLIB web repository. Similarly, among the
implementations of the Runge-Kutta methods, possibly the most useful is Radau5
of [4], which also is freely available from those authors.
We use an implementation of the BDF method for the solution of the generated
DAEs. One of the reasons for this choice is that we have had experience with BDF
methods from the time of the famous DIFSUB program [14]. BDF codes are widely
used in electronic circuit simulators and continue to attract attention as capable,
general-purpose methods for solving DAEs. Part 2 shows that it also is a method
with which it is possible to solve mechatronics problems based on the bond graph
modelling approach.
5.3.1
The solver used for solving DAEs of the model system is based on the variable
coefcient version of BDF [3, 15]. In comparison, DASSL uses a xed coefcient
implementation of BDF [3]. The variable coefcient form is perhaps the most stable
implementation of the BDF methods, though it is less efcient because it requires
frequent re-evaluation of the partial-derivative matrix. The reason for using it here
is that the solution of DAEs is not an easy problem, and the higher level of stability
of this method is welcome. Unfortunately, the authors are aware of one study only
that compares these two BDF implementations [15]. The frequent re-evaluation of
the partial-derivative matrix is less expensive in our approach, as we use it in an
analytical form and not by a numerical approximation. This improves the stability
of the BDF code. In the following section we describe in some detail the method we
use. We use a similar notation as in [3].
The system we solve numerically is described by (5.26). The numerical solver
generates approximations Xi to the true solution X(ti) (Fig. 5.3). The BDF method is
a variable step and variable order predictor-corrector method. Because of the
174
stability requirement, the order k of the method is limited to 5. The method predicts
values of the solution at the next instant of time tn+1 by evaluating a polynomial that
interpolates the last k + 1 values, i.e.
X0n 1 Ptn 1
5:33
5:34
The predicted value of the time derivative at time tn+1 is similarly found by
evaluating the time derivative of the interpolating polynomial, that is
0
X_ n 1 P_ tn 1
5:35
5:36
_ tn 1 ; Qtn 1 ; tn 1 0
g Q
5:37
such that
175
There are several ways correction polynomials can be dened [14]. The method
we use denes it as a polynomial that interpolates through the same last k points as
the predictor, i.e.
Qtn 1i Xn 1i ; i 1; . . .; k
5:38
5:39
h n 1 tn 1 tn
5:40
Here
k
X
ai n 1
5:41
i1
where
ai n 1
hn 1
; i 1
tn 1 tn 1i
5:42
The coefcient i in (5.42) depends on the ratio of the current and accumulated
previous step sizes and changes each time the step size or order changes. Such a
formula is known as a variable coefcient formula. In DASSL, a simplied form of
this formula is used in which the coefcient is independent of the step-size (denoted
in [3] as s). The formula was developed using corrector polynomials that interpolate at equidistant time points.
After substituting in (5.37), we get
a0 n 1
0
g X_ n 1
Xn 1 X0n 1 ; Xn 1 ; tn 1 0
hn 1
5:43
This is an implicit vector equation that can be solved iteratively using the
predicted values as the starting point. The modied Newton method is used. If we
denote by dm the corrections at the m-th iteration step, the corrections can be found
by solving the linear equation
m
m
_
Jdm
g
X
;
X
;
t
n1
n1
n1 n1
5:44
176
@g
@g
a
@X
@ X_
5:45
a0 n 1
hn 1
5:46
with
a
The values of the variables and the derivatives are updated for the next iteration by
using the formulas
m
Xnm11 Xm
n 1 dn 1
m1
m
X_ n 1 X_ n 1 adm
n1
)
5:47
5:48
where |||| is a weighted mean square root norm. The expressions are slightly
different from DASSL because of the variable coefcient form of the differentiation
formula in (5.39).
The code and documentation are freely available through the NETLIB repository. We express our
thanks to the University of California, Berkeley, Department of Electrical Engineering, and to the
authors of this really sophisticated software.
177
5.3.2
Solving (5.44) requires evaluating the partial derivative matrix of (5.45). This
matrix is often approximated numerically. We generate analytical expressions for
this matrix by symbolic differentiation of the model equations.
The matrix is of sparse structure, having a small number of nonzero elements per
row and column. We generate and store only the expressions of nonzero elements.
One of the often-used methods for storing sparse matrices is based on the coordinate scheme. It is used here because it is very easy to implement (Fig. 5.4).
Thus, for every nonzero element of the partial derivative matrix we generate an
analytical expression and record its row and column number. The procedure is
straightforward and is as follows
1. Take the left side of the expression of the rst system model equation.
2. Find the list of variables and the derivatives of variables that appear in the
expression.
3. For every variable evaluate, in turn, the partial derivative of the expression by
symbolic differentiation. The evaluated expressions are stored successively in
the corresponding string array. Store, in the separate arrays, the index of the
equation (row index) and of the variable (column index).
4. Repeat step 2 with the next expression until all equations have been processed.
The values of the partial derivative matrices are evaluated during the simulation
using stack oriented routines, as described in Sect. 5.7.
5.3.3
We now describe the strategies used for error control. We do not apply any projections on the model equations, but try to solve them directly. The BDF code, as
used here, can handle DAEs of index 1 and 2, if some precautions are taken. Putting
178
aside the problem of initialisation that we consider in Sect. 5.5, one of the most
sensitive points is error control. This concerns the strategy for step acceptance and
how the next step and/or the order of the method is chosen.
Error control in BDF codes is based on testing the truncation error estimates
against predened error tolerances. The truncation error is estimated by (5.48),
which is similar to that in DASSL, with some difference in the leading coefcient.
The error is thus proportional to the corrections made in the Newton iterative
loop. If the error test is not satised a new, smaller step size is chosen until the test
is passed. This works well for index-1 DAEs. In index-2 equations there is a
repeatable failure of the error tests and the procedure is nally stopped. The
problem is that errors in some algebraic variables do not approach zero as the step
size approaches zero. As a result, these cannot be made less than the tolerance (in
some norm) with decreasing step size. Thus, solving higher-index DAEs requires
changing the way the error is tested.
The simplest way to do this is suggested in [3]: All the algebraic variables are
removed from the error tests, the next-step-size test, and the order-selection tests,
and these tests are applied to the differentiated variables only. This has the drawback that the algebraic variables are partially out of control. They, however, satisfy
the corrector equation solving loop and are accepted if the differentiated variables
pass the integration error test. The reasoning behind such a strategy is that errors in
the algebraic variables do not influence directly the future state of the system. In this
way, integration can be executed successfully, although with the price of lower
accuracy in the algebraic variables. In many cases this is acceptable, as long as high
accuracy in such variables is not required.
We also scale the algebraic equations by the factor 1/h, where h is the current
step-size. This scaling, as discussed in [3], improves the ill conditioning of the
iteration matrix at very small step sizes. This, in turn, improves the accuracy of the
differentiated variables and, to a lesser extent, of the algebraic variables. In any
case, scaling is recommended. We have not applied scaling directly in the model
equations because these become quite difcult for the user to understand (Sect. 5.4).
Instead, we simply modify the values of the left side of the equations and of the
partial matrix elements when they are evaluated during iteration.
We have also implemented another strategy based on local error control. This
has its roots in a study of the local error control of DAEs of index-1 and 2 in [18].
Using the notation of Sect. 5.3.1, the proposed estimation of the local error is given
by
Sn 1
!
2
a0
1
J A jI 0
J A hn 1
a n 1 h2
1
5:49
Here matrix J is the last evaluated and decomposed partial derivative matrix
dened in (5.45), A the leading coefcient matrix of (5.27), and n+1 the truncation
error estimate of (5.48). The 0 is the value of the BDF parameter in (5.41) used in
the last evaluated partial derivative matrix, and h is the value of the step size used at
179
that time. Parameter is a user-supplied factor used to weight the inherent differentiation in index-2 DAEs. This factor can be set from 1 to a value of the order of
1/h.
In the implementation of the formula the inverse of the Jacobian is not required
because the matrix is already evaluated and decomposed into LU factors.
Corresponding terms in (5.49) can be evaluated by back substitutions from the
corresponding linear system. The cost of the formula is, in essence, these two back
substitutions. We also use this formula for step size and order selection, as suggested in [18]. The basic strategy, as described in [3], is retained using the local
errors estimates evaluated by (5.49) and used for the next step size and order
selection. In [18] it was shown that the error control based on the local error is
satisfactory for index-1 and index-2 DAEs. It is expected that this control strategy is
an improvement over the error control of using the rst strategy. We have found
this to be true at least for some of the problems treated in this book (Chap. 9). We
also found that the local error control strategy works much better if the algebraic
equations are scaled by the step-size.
To summarize the integration control used for solving the model equations
during simulation, we describe the parameters and options at the users disposal.
First of all, after the mathematical model is built and suitable data are created, the
user has to select the
Simulation interval
Output interval
Maximum step size
After the simulation is nished, it is possible to continue or to restart the simulation. Output is generated at every output interval value. The maximum step size
that the integrator selects is limited. By default, both the output interval and
maximum step size are set to 1/100 of the simulation interval. For many problems,
however, quite a short maximum step size is often necessary.
The BDF method likes relatively tight error tolerances. Thus, the default
values of the absolute and relative error tolerance are set to 106. These can be
changed, up or down. Lower values are, in general, not advised. On the other hand,
some problems are not easy to solve with too tight a tolerance, i.e. 1012 or 1015.
Currently only one integration method is implemented, the variable coefcient
BDF method. It is possible, however, to scale the algebraic equations (this is the
default behaviour), or to disable scaling. Both error control strategies described
above are implemented:
Control of errors in differentiated variables only (default)
Local error control
In the last option it is possible to input the differentiation weight parameter
value, too. It is set to 1 by default.
180
5.4
The system model equations, including the partial derivative matrices, are generated
automatically by the BondSim software. They are generated in the byte form, as
explained in Sects. 5.2 and 5.3, and hence are not easily readable. We can, however,
decompile them into a more readable form. The system variables used in the
decompiled form are not the original symbols, but are of the form Y(1), Y(2), etc.,
and t for time. We will show how they can be interpreted.
As an example consider simple problem of Sect. 2.7.1. We start the BondSim
program rst and then open the project Body Spring Damper Problem. To build the
corresponding mathematical model we chose the command Build from Simulation
menu, or click the corresponding toolbar buttons. The process can be observed in
Build tab of Output window at the bottom of the screen. To show the model created
we open the Simulation menu, submenu Show Model, and then the command Write
Equations, or the corresponding toolbar button (in the form of a pencil). The model
appears in the Output window. The decompiled model can be copied into a text le
by clicking on the equations with the right mouse button and selecting Copy. After
the Save As dialogue opens we dene the name of the text le and the destination of
the decompiled data. The result is shown in Fig. 5.5.
181
Fig. 5.6 The project screen with port variable tooltip window
182
5.5
In this and the next section we describe the approaches used for solving two
important issues of simulation: the generation of starting values and integrating
across discontinuities.
The problem of values from which the simulation starts is one of the difcult
problems of DAEs that has attracted much attention. In the equations in state-space
form, such as
x_ f x; t
y gx; t
5:50
this is not much of a problem. To start solving the equations it is enough to specify
the initial values of the state variables, e.g. by specifying the values at initial time
t 0,
x 0 x0
5:51
In this way, the time derivatives of the variables needed by the integration
routine can be evaluated directly from the rst equation
x_ 0 f x0 ; 0
5:52
and the integration can start. The output values are generated using the second
equation. The problem, thus, is decoupled into solving the differential equation and
generating the outputs. This is well known and it is why much attention in bond
graphs, and in other approaches, has been given to setting the model equations into
this form. In modelling real systems, however, models in the state space form
generally are too restrictive. This makes it necessary to deal with DAEs.
183
5:53
184
hidden constraint for the algebraic equations. For this, however, we again need
starting values.
Determination of the initial values of the time derivatives of variables is
accomplished in a similar way as that used for index-1 DAEs. Initial values of the
time derivatives of the differentiated variables are found from the rst equation in
(5.20). But for the algebraic variables we again need to differentiate the hidden
constraint with respect to time and nd the corresponding values of the variables
from the resulting linear equations.
In DAEs of index higher than 2, the problems are even more difcult, as more
differentiation is necessary and the subsequent equations are more difcult to solve.
Different approaches have been reported for solving the problem of starting values
[1923]. Many are concerned with index-1 DAEs, but some also treat index-2
equations. In general, they resort in some way or other to differentiation. A good
survey of these is found in [3, 23]. One of the problems is how to determine the
index of the system. Approaches based only on structural information, as in [20],
are often not feasible, as the system structure can change because, for example,
some of the constitutive relations are dened conditionally, depending on the values
of variables. As a simple example, we return to the see-saw problem (Sects. 2.7 and
5.2.3). The model generated for this system is of index-2. If we assume, however,
that there is dry frictionas there is!between the see-saw seat and the children,
when the children stick to the seat this becomes an index-2 problem. When they slip
even for a short time, however, the model changes to index-1, because the differentiated variables become independent.
The problem of consistent starting values is not only important at the start of the
simulation, but also after every discontinuity. In addition, any approach to the
problem of starting values assumes that the user supplies the necessary data. Even
under the best conditions this is often too much to ask. The modelling approach in
this book has been developed to help the user design or analyse mechatronic
equipment. For this we need a simpler approach to the starting of the simulation.
The approach we use is close to that of [19, 21]. It was prompted by how we start
real equipment. Typically, we switch the power on and, after some time, the system
settles down to the appropriate operating state and we start using it. We thus assume
that the system starts off un-energized, i.e. with efforts and flow equal to zero. We
also assume that the time derivatives of all variables are equal to zero. By default,
the starting values of all differentiated variables dened in the corresponding elements (capacitive, inertial, and integrator elements) are also set to zero, but can be
changed to some other value if required. These are taken as an estimation of
consistent starting values.
To nd a starting value for the simulation we use a version of the BDF solver
that employs a rst-order method (implicit Euler) and a fairly small and constant
step size. To simulate the transients that can be quite intensive until the system
settles down, we simulate the system for several steps without error control. We
then advance the simulation time for one step more and check the error. If the error
test is passed, we integrate back to the initial time and use the state reached as the
starting state for the simulation. If, on the other hand, the test is not passed, we
185
repeat the starting procedure with a smaller step. The starting procedure is stopped
and failure reported if either the step was reduced to the minimum without success,
or if too many initialisations have been attempted. During initialisation the corrector
equations are solved at every step to the prescribed accuracy. The partial derivative
matrix is updated and decomposed at every simulation or iteration step. If, for any
reason, it is not possible to solve these equations, initialisation is stopped with the
appropriate message. In Part 2, in which different mechatronic problems are solved
by bond graph modelling, all initialisations are done using this approach quite
successfully. The reader can test this for herself.
5.6
Discontinuities give reality to the models. There are numerous examples of engineering systems where such features are necessary. This is the case, for example,
when dealing with dry friction and impact in mechanical systems. In electronics,
processes are often described by different expressions, depending on the range of
variable values. This, of course, complicates the problem of equation solving.
We analysed several schemas for dealing with discontinuities. In one of these
during the model generation the sub-expressions contained in the constitutive
equations and which dene the discontinuities in the model are extracted and stored
in a separate array. These sub-expressions are decompiled and shown below
(Fig. 5.8). We may use these functions to generate the state transition tables. The
location time instant of the switching was found by a binary search using interpolating polynomials that the BDF solver maintains or by repeating the time
step. After the discontinuity, the integration was reinitialised using a method similar
to that used for simulation initialisation (Sect. 5.5). We found, however, that this
approach did not work as expected: Many times there were conflicts during the
Newton and the corresponding step-advancing steps. A possible explanation for
such behaviour is that there is no guarantee that when the system crosses the
186
discontinuity it stays on the other side for some nite time and continue its motion.
It is quite possible that the system returns back, and under actions of the driving
efforts tries again to go over the discontinuity. Eventually it goes over the discontinuity. Thus, mechanism often is not smooth
We thus decided not to design a state transition mechanism to control dealing
with the discontinuities, but to try to go straight over the discontinuity; we simply
let the solver handle the discontinuities. The conditional expressions are retained in
the model expressions and those of the partial derivative matrix elements. When the
discontinuity is encountered, the solver tries to go over it. The behaviour of the
solver is similar to that at the initialization. During rst few steps the error is not
controlled. After that if the error control requirements are satised integration
continues. Otherwise, the step-size is reduced and the procedure is repeated.
This perhaps is neither the most efcient nor the best technique that might be
used, but it works. It is capable of dealing with impulsive forces appearing e.g. at
the impacts. It works well in all the examples treated in this book, as well as with
both error control strategies discussed in Sect. 5.3.3.
To help the solver deal with discontinuities it is advisable to ensure continuity of
sub-expressions at their boundaries, if possible. In many cases discontinuities
appear because of the simplication of the model. Thus, a complicated non-linearity
presents fewer problems than an on-off discontinuity. This is particularly true at the
start of a simulation.
5.7
The efcient simulation of models described in terms of Bond Graphs and Block
Diagrams is based on compiled routines. Thus, most of the support for the operations described in the previous chapters is coded in C++ language and compiled
using Visual C++ compiler in MS Visual Studio 2012 environment. However, there
are parts that cannot be precompiled because they depend on data dened during a
project model development. These parts are connected to the constitutive relations
and parameters of different elementary and block diagram components, which
depend on the problem under study.
The solver, in our case BDF, during the simulation repetitively evaluates several
groups of the functions that are based on the constitutive relations. Thus, it evaluates the left side of the mathematical model equations (see Fig. 5.5) in the attempt
to make them approximately equal to zero. These left sides are really the constitutive relations of the elementary components of which the model consists.
BDF solver as described in Sect. 5.3.1 needs the values of the partial derivative
matrix (Jacobian) (5.45) and rate derivative (leading coefcient) matrix (5.27). In
the current implementation these matrices are generated analytically by applying
the symbolic differentiation on the constitutive relations. It is necessary to nd an
efcient method for evaluation of these matrices, in particular the rst one.
187
5:54
Note that reading of the byte expression is from left to right, and thus the rst
operand is pushed rst onto the stack, and then the second. The popping of the
operands was made in the opposite order. The stacks support LIFO (Last In First
Out) order. However, operations dened by prex notation apply the operator,
addition in this case, starting at the rst operand and then the second. These
operations are in accordance with the stack transitional behaviour used in CIL.3
Stack operations can be dened for any byte strings, which include the operations
and function calls discussed in Sect. 5.2.2.
The fundamental question is how to implement these operations. Owing to NET
technology that Windows supports through the NET Framework4 use was made of
the Dynamic Assembly, a powerful concept that allows extending the compiled code
dynamically at the run time. The implementation of this concept was eased due to
Microsoft extension of C++ language known as C++/CLI, which is supported by
Visual C++.
188
We create the assembly builder rst, which is used to create the Math Model
Module builder object. This object is used to create ModelClass type (class) builder
object. This class plays the fundamental role in the model evaluation because it
denes dynamically all necessary operations mentioned in the beginning. The
structure of the class is shown in Fig. 5.9. Note that in NET every class has Object
class as a top superclass (similarly as MFC has CObject as its top superclass).
Using type builder we can dene the class methods. We dene rst the class
constructor. The procedure is
Dene constructor builder. The constructor is with one argument.
Get CIL generator for the constructor.
Using the generator dene the constructor by a stream of CIL commands. The
base class constructor is called rst, and then the pointer (tracking handle) of the
Object passed as the constructor argument is assigned to systemVariable attribute eld.
We dene the class method functions in a similar way, but this time we take into
account that these functions are dened by the byte strings in the Polish notation.
Thus for every type of member function there is a function that reads the corresponding byte strings and translate them into CIL streams of the stack operations.
Thus, the procedure is
Dene method builder
Get CIL generator for the method
Call a function which reads the function byte strings and emit CIL stack
operations instructions using the method CIL generator.
In this way we dene ModelEquations method for evaluating left sides of the
mathematical model equations, ParcDerivativeMatrix and RateDeivativeMatrix
nonzero elements, and ZEquetions method for evaluating the discrete model
relationships.
These methods are CIL equivalent of the byte strings expressions. They need the
other data as well as are the system variables, parameters and functions discussed in
Sect. 3.5. To that purpose we dene a SystemVariables class that warps all system
variables and dene the basic function that the constitutive relations may use. Now
we may create a SystemVariables object containing all necessary information, and
189
create a ModelClass object using the constructor dened above and pass to its eld
the pointer (tracking handle) to just created SystemVariables object.5
Once the ModelClass object is constructed it can be used to call its member
functions in Fig. 5.9 to evaluate quantities that BDF solver needs. The rst time
these functions are called, they are compiled into machine code of the current
processor using JIT (Just In Time) compiler of Windows NET Framework. This
normally happens at beginning of the simulation during the initialization step. After
this step the evaluation of these functions is really very quick.
References
1. Reverchon A, Ducamp M (1993) Mathematical software tools in C++. Wiley, Chichester
2. Petzold L (1982) Differential/algebraic equations are not ODEs, SIAM. J Sci Statist Comput
3:367384
3. Brenan KE, Cambell SL, Petzold LR (1996) Numerical Solution of initial-value problems in
differential-algebraic equations. Classics in Applied Mathematics, SIAM, Philadelphia
4. Hairer E, Wanner G (1996) Solving ordinary differential equations II, Stiff and
differential-algebraic problems, 2nd revisited. Springer, Berlin, Heidelberg, New York
5. Griepentrog E, Mrz R (1986) Differential-Algebraic equations and their numerical treatment.
BSB Teubner, Leipzig
6. Mrz R (1992) Numerical methods for differential-algebraic equations. Acta Numerica 141
198
7. Tischendorf C (1995) Solution of Index-2 differential algebraic equations and its applications
in circuit simulation, Ph.D. thesis Humboldt University Berlin. Logos Verlag, Berlin
8. Mrz R, Tischendorf C (1997) Recent Results in solving index-2 differential-algebraic
equations in circuit simulations, SIAM J Sci Comput 18:139159
9. Haug EJ (1989) Computer-aided kinematics and dynamics of mechanical systems, vol. I:
Basic Methods. Allyn and Bacon, Needham Heights, Massachusetts
10. Van Dijk J, Breedveld PC (1991) Simulation of system models containing zero-order causal
pathsI. Classication of zero-order causal paths. J Franklin Inst 328:959979
11. Van Dijk J, Breedveld PC (1991) Simulation of system models containing zero-order causal
pathsII. Numerical implications of class 1 zero-order causal paths. J Franklin Inst 328:981
1004
12. Schwartz DE, Tischendorf C (2000) Structural analysis of electrical circuits and consequences
for MNA. Int J Circ Theor Appl 28:131162
13. Borutzky W, Cellier F (1996) Tearing in bond graphs with dependent storage elements. In:
Proceedings of symposium on modelling, analysis and simulation, CESA96, IMACS multi
conference on computational engineering in systems applications, vol 2. Lille, France,
pp 11131119
14. Gear CW (1971) Numerical initial-value problems in ordinary differential equations. Prenice
Hall, Englewood Cliffs
15. Jackson KR, Sacks-Davis R (1980) An alternative implementation of variable step-size
multistep formulas for stiff ODEs. ACM Trans Math Softw 6:295318
In CLI because the objects are not xed in memory an analogue to C/C++ pointers known as
tracking handles are used.
190
16. Krogh FT (1974) Changing step size in integrations of differential equations using modied
divided differences. In: Proceedings of conference numerical solution of ODEs, lecture notes
in mathematics 362, Springer, New York
17. Shampine LF, Gordon MK (1975) Computer simulation of ordinary differential equations. FH
Friedman and Co., San Francisco
18. Sieber J (1997) Local error control for general index-1 and index-2 differential-algebraic
equations. Humboldt University Berlin, Preprint
19. Sinovec RF, Erisman AM, Yip EL, Epton MA (1981) Analysis of descriptor systems using
numerical algorithms. IEEE Trans Aut Cont 26:139147
20. Pantelides CC (1988) The consistent initialization of differential-algebraic systems. SIAM J
Sci Comput 9:213232
21. Krner A, Marquardt W, Giles ED (1992) Computing consistent initial conditions for
differential-algebraic equations. Comput Chem Eng 16:S131S138
22. Brown PN, Hindmarsh AC, Petzold LR (1998) Consistent initial conditions calculations for
differential-algebraic systems. SIAM J Sci Comput 19:14951512
23. Schwarz DE (2000) Consistent initialization for index-2 differential algebraic equations and its
applications to circuit simulation. Ph.D. thesis Humboldt University, Berlin
24. Damic V, Montgomery J (2003) Mechatronics by bond graphs: an object-oriented approach
tot modelling and simulation. Springer, Berlin, Heidelberg
Part II
Applications
Chapter 6
Mechanical Systems
6.1
Introduction
In this chapter we start the study of problems from Mechatronics using the bond
graph modelling approach developed in Part 1. The general procedure consists of
1. Analysis of the problem under study
2. Development of the corresponding model in terms of bond graphs, and
3. Analysis of the behaviour by the simulation
Bond graph modelling and simulation will be undertaken using the BondSim
program, which is freely available from the authors web page (see also Appendix).
Readers are advised to use it when reading material given in this and subsequent
chapters.
In this chapter we study simple, mostly one-dimensional, mechanical problems.
One reason for this is to familiarize the reader with using the BondSim software on
relatively simple problems, though these problems are of interest in their own right.
We start with the well-known Body Mass Damper problem already discussed in
Sect. 2.7.1. After that we continue with the study of the influence of dry friction on
the system, which introduces discontinuities in the model equations. We then study
the Bouncing Ball problem. This also involves discontinuities, but is better known
for its chaotic behaviour. The section concludes with a discussion of higher index
problems. It is not the intention to show that it is possible to solve all such problems
using the methodology developed; we simply show that a class of such problems of
interest in Mechatronics can be solved in an acceptable way from an engineering
point of view. This is particularly true for some problems in multibody dynamics. In
this chapter we will study only the simple pendulum problem. Further discussion of
solving problems in multibody dynamics is left to Chap. 9.
193
194
6.2
Mechanical Systems
6.2.1
The Problem
6.2.2
6.2.2.1
Before we start with model development, we must launch the BondSim application.
This can be done in the usual way for Windows environment, e.g. by double
clicking the applications shortcut BondSim 2014 on the computer desktop; or using
the Windows Start button at the left corner of the computer screen, then choosing
the application from the list of the recently used applications, or choosing the All
Programs command, and then the folder BondSim and nally the shortcut
BondSim2014.1 The main program screen then appears having the title BondSim
Application (see Fig. 4.2). There is a menu bar just below the program title showing
the main menu commandsProject, View, Tools and Helpfrom which the program commands are invoked (Sect. 4.2). There is also a row of the toolbar buttons
used to invoke some of the more often-used commands. Some of these buttons are
familiar to Windows users, but others are specically designed for BondSim. By
moving the mouse cursor over the buttons, a tool tip appears that contains a short
description of the corresponding command. Some of these buttons are currently
disabled.
To begin with the model development for the Body Spring Damper problem, we
dene a new project rst. This can be done using the New command in the Projects
menu, or by using the New Project toolbar button. In the dialogue that appears
1
The current program version is BondSim 2014, but similar operation are expected to be valid for
the future versions of the program as well.
195
(Fig. 4.3), we type a suitable project name, e.g. Body Spring Damper Problem,
and then click the OK button. The command is accepted if there is no existing
project with the same name. The dialogue closes, and a new empty document
appears having the title of the new project as shown in Fig. 6.2. The menu also
changes to show the commands that can be used at the document level (Sects. 4.6
and 4.7).
If we expand the Model Structure at the left it shows only one entry: Body
Spring Damper Problem (Fig. 6.3). The central document window serves to dene
the structure of the system model. The basic tools for bond graph model development are contained in the Editing box (Fig. 6.2 at the right). We can expand the
rst two branches: Ports and Bond Graph Components.
The model development starts by decomposing the system into components.
Looking at the problem schematics of Fig. 6.1, we identify the following
components:
196
Mechanical Systems
Fig. 6.3 The project document window with expanded model structure and editing tools
The wall at the left is used to x the left ends of the spring and damper. We
represent the wall by a single two-port component Wall; the ports being the
places where the spring and the damper are connected. There is also the ground
over which the body moves. But, if we neglect the friction between the body and
the ground, we can treat the problem as one dimensional by neglecting interactions in the vertical direction (which simply means that the ground reaction
force is equal to the body weight).
The spring of stiffness k, which can be represented by a two-port component
Spring, which ports represent interactions at the spring connection ends.
The damper, of linear viscosity coefcient b, is represented by a two-port
component Damper. The ports again represent the interactions at its connection
ends.
The body itself, which is connected to the spring and the damper on the left side,
and on the right side acts a force. The body can be modelled by a three-port
component Body.
The force is acting on the body in the direction parallel to the ground. Its effect
can be represented by a source effort component.
To create these components we will use the drag and drop technique described in
Sect. 4.6.1 (Fig. 6.4). We start with Wall component. However, because we wish
to write its name in the vertical direction, we will rst expand the Text Orientation
branch in the Editing Box, and select Vertical. Now we can drag the General Word
Model Component and drop it near the left working area border, but not too close
197
(see the box below). When the caret appears, we start typing the word Wall and
text runs vertically. To end the editing we may click somewhere outside of the text
entered. We will change Text Orientation again to Horizontal to return to the
default text orientation mode.
The created component has two power ports. We will drag them around the
component border and position them on the right side. We assume that power is
delivered by the spring and damper to the wall. The upper ports half-arrow is
already directed into the wall. But, the lower one has the opposite power sense. To
change this we will select the port and then click Change Port toolbar button (with
icon in the form of two opposite power ports).
Next, we will drag again a word model component and drop at the right of the
Wall, and type-in Spring. When we click outside the component it is created
with two power ports directed from left to right. We change the power sense of the
both by clicking the toolbar button Change Ports of the selected component (when
a component is created it is already in the selected state as indicated by the red
bounding box). We drag the component so that its left port is at the same height as
the upper Wall port. Now we may connect the spring to wall by a bond by clicking
Wall port and moving the mouse to the left Spring port and clicking again
(Fig. 6.4).
In a similar way we may create the Damper. This time we will place it
somewhere to the right not to overlap the Spring. We again change power flow
direction of its ports and connect the left port to the bottom wall port by bond. Note
198
Mechanical Systems
as we add components in the central windows the Model structure tree at the left
changes showing these components as the empty leaves.
Now we will create the Body component to the right of the Spring and
Damper by dragging and dropping the word model component and typing Body.
We will again change the sense of the created power ports by clicking the toolbar
button Change Ports. Because Body in Fig. 6.1 has three connection points, we
drag a power-out port from the Editing Tools, Port branch and drop it at the left
bottom of the Body component. We position this component so that its left port is
at the same height as the right Spring port. Now we may connect the left Body
port to the Spring right port, and the bottom Body port to the right Damper port
by the bonds. (When drawing the last bond we may need perhaps to modify the
bond line to form e.g. a right angle as in Fig. 6.4).
The nal component that we create is a Source Effort, which describes the effect
of a force applied to the body by the environment. To place it we need, however,
more place to the right of Body. To enlarge the working area to the right, we place
the mouse over the right edge of the working area until the cursor changes its form
to a two-side arrow. Then click the cursor and drag the right edge to the right to
make space for other components and then release the mouse. Now we may drag
the Source Effort tool and drop it at the right of Body component. Drag its ports
from the right to side facing the Body. Also move the SE component so that its port
is at the same level as the right Body port, and interconnect them by a bond. Now
we obtain the Bond Graph shown in Fig. 6.4.
Figure 6.4 shows the system model that denes the components, which are seen
at the system level and are represented by the word models. To complete the model
it is necessary to develop a model of every one of its components. However before
we go into this, it is important to dene what information we need from the model.
For the system we are studying we may be interested in the input force acting on the
body, the body position during its motion and the total wall reaction to the spring
and damper.
To obtain information on the current value of the input force we can break the
bond connecting SE and Body, and drag the SE to the right to make place for a
0-junction. Next we drag the 0 Junction from the Editing Box, Bond Graph
Components, and drop it between the SE and Body (Fig. 6.5).2 The created
junction has three power ports. We remove the bottom one and replace it by a
Control-out port from the Port branch in the Editing Box. It serves to extract the
effort signal, i.e. the input force, transferred by the junction. We also change the
power port senses of the other two ports so that power flows from the right to the
left. Finally we connect the junction power ports to the corresponding ports of the
SE and Body (Fig. 6.5).
Note that while the previous gures are generated by capturing the computer screens, this gure is
generated using Print to File command described in Sect. 4.10.2.
199
Fig. 6.5 System level model for body spring damper problem
To obtain information on the other two quantities (the body position and the wall
force) we drag Control-out ports and drop them at the peripheries of Body and
Wall. We may now to add a display component to the Bond Graph, by dragging
and dropping the X Y Display from Continuous Signal Components (Fig. 4.18
left). We add an additional Control-in port to this component, and connect the all its
ports to 0-junction, Body and Wall, respectively as shown in Fig. 6.5.
We can assign labels to the plot axes by double clicking the corresponding
display ports. Thus, by double clicking the port connected to the Body, a dialog
opens as shown in Fig. 6.6. We may now type x (position) as label of the axis. By
default it refers to Y axis, but we may select also X axis, or None.
In a similar way we may assign F (the input Force) to the top port, and Fw
(the wall force) to the bottom display port. Note we may assign all variables to the Y
axis, in which case we have Y t plot with all variables plotted to the Y axis, and
time along the X axis. We also can create X Y plots, where one variable is
assigned and plotted along the X axis and all others to Y axis. Finally, if variable is
200
Mechanical Systems
set to None (axis), it means that its plot is not currently displayed, but we can
change this any time.
To complete the model at the system level we need to specify the force generated
by SE (Fig. 6.5). We open the corresponding port by double clicking.
A corresponding dialog opens as shown in Fig. 6.7. We edit the port variable effort
denoting it as F. Using the Parameter button we change eValue to 500 N (for
editing the parameters see Sect. 4.8.2).
Before we close this subsection there are some suggestions regarding editing
Bond Graphs (see also Sect. 4.6).
Note A component can be created anywhere inside the document working
area, but not too close to its boundary. It is better to create it near its center
and then move it. Similarly, a port cannot be created too close to another port.
It is better to create it away from other ports, and then drag it. When drawing
a bond, it is also possible to create intermediate points by clicking to it and
then continuing. A bond line can be dragged to change its shape. Bond lines
often have a zigzag appearance. There is no grid that can be used as guide. To
create a nice looking bond graph, it is usually necessary to move components
or their ports a bit before drawing the bonds. Drawing of a bond can be
canceled by double-clicking!
Note also that the font sizes that the program supports can be
Normal
Small
Medium, and
Large
201
Note that to end editing a component title and create the component it is necessary to click outside of the component.
6.2.2.2
202
Mechanical Systems
port extracts the body velocity. We may double click the 1-junction and in a
dialogue that opens write v (velocity) as name of the junction flow variable
(Fig. 6.9).
To obtain the position we need to integrate the velocity. Thus we will drag and
drop an integrator from Editing box, Continuous Signal Components branch, as we
did in Sect. 4.6.3 and Fig. 4.21. Then connect the input integrator port to the output
1-junction port and its output port to the output document port (Fig. 6.9). We may
set the input integrator variable to v by double clicking its input port, in the same
way as we did with the junction variable in Fig. 6.9. Similarly, we may set the
integrator output by double clicking the integrator output port (Fig. 6.10).
We set the output variable to x, and the output relation now denes the output as
the time integral of the input. There is also a eld that denes the initial value of the
output. By default it is set to zero, and we can accept this value.
In order to nish editing the Body model we have to specify the inertial element
I. By clicking its port a corresponding dialog opens as shown in Fig. 6.11. We will
change the flow variable to v, the state to p (momentum), and we also need to edit
the constitutive relation as shown in Fig. 6.11. This relation denes the body
momentum p as body mass m times its velocity v. Finally, using the Parameter
button, we will set the body mass m to 5 (kg). Note also that there is a eld which is
used to dene the initial value of the body momentum. By default it is set to zero. If
the body is initially at rest we may accept this value.
In a similar way we dene a model of the Spring (Fig. 6.12). The deformation of
the spring depends on the relative velocities of its ends. Hence the Spring component can be described by a flow junction 0 whose two ports are connected to the
document ports (spring ends); the third one is connected to the port of the capacitive
component C that is used to model the process in the spring. To dene the spring
parameters we will double click the port of the C component, similarly as we did
with the inertial component. We change the state variable to the spring deformation
203
204
Mechanical Systems
xs and the effort to the spring force Fs. The default constitutive relation corresponds
to that of the electrical capacitor. This will be changed to read Fs = k*xs. The spring
stiffness k is dened in the capacitive component using the Parameters button. The
value assigned is 112.5 e3 (i.e. 112.5 kN/m). Note again that there is an initial value
of state, in this case the initial deformation of the spring. If initially the spring is not
deformed we may accept the default value of zero.
The model of Damper is similar to that of the Spring but a resistive component R
is used to dene its model. We will again double click its port and the dialogue that
opens is shown in Fig. 6.13. We change the effort variable to the damper force Fd
and flow variable to the velocity of the damper extension vd. We accept the linear
constitutive relation, but the resistive parameter R0 we change to read b. Because of
this change, we have to dene b as a new parameter and assign a value 150 (N s/m).
We create the Wall model in a similar way. The wall xes one side of the spring
and one side of the damper. This implies zero velocity at the spring and the damper
205
ends. Thus, in the Wall document (Fig. 6.14), we create an effort junction 1 connected to a zero-flow source SF. The other two junction ports are connected to the
Wall document power ports and, thus to the spring and the damper ports (Fig. 6.5).
The effort at the flow source port is equal to the sum of the forces at the other two
1-junction ports, i.e. it represents the force transmitted to the Wall. To extract this
force a 0-junction is inserted between the SF and 1-junction with a control out port,
which is connected to the corresponding document output port.
206
Mechanical Systems
The nal model of the Body Spring Damper problem is shown in Fig. 6.15. The
model structure shows that all word model components are dened. We can easily
examine the model by alternately expanding and collapsing the corresponding
components in the model tree.
6.2.2.3
The Body Spring Damper problem of Fig. 6.1 can also be developed using
mechanical components from the Mechanical Components library (Sect. 4.9.2).
Note the components in this library contain the complete models of the component
and are depicted using the mechanical component symbols. We can use these
component models as they are or modify them.
Note that at the point of the connection the mechanical components have the
common velocity. Hence, it is a 1-junction. Following the common practice in the
mechanical circuits for such connections we use the Connector components. These
are 1-junctions visually represented as dots. To create such a component we drag
and drop the Connector tool, which we can nd in the Template Box tab at the right
of the main window, and inside the Mechanical Components (Fig. 4.23 right).
The procedure parallels that of the previous two subsections (Fig. 6.16):
Launch BondSim, select the command New from the Projects menu, or by using
the New Project toolbar button. In the dialogue that opens dene a new project
name, e.g. Body Spring DamperMechanical Model, and then click the OK
button.
Select the Models Library from the left pane, and then expand the Mechanical
Components branch and expand the Wall Left, pick and drag the Ground
207
Fig. 6.16 Model of body spring damper problem using the mechanical components
component to the central document window and drop it near the left document
working area border.
Activate the Template Box tab, and then expand the Mechanical Components.
Pick and drag the Connector to the main window and drop it to the right of the
left wall component. Because we expect that power flows through the
Connector to the wall, we will select its left port and change its power sense
(using the toolbar button Change Port). Delete the right connect port (by
selecting the port and pressing the Delete key). Pick and drag a Power-in port
from the Editing Box tab, the Port branch, and drop it at the bottom of the
Connector component. Move the component so that its left port is at the same
height as the Ground component and connect the ports by a bond.
Expand the Spring branch in the Mechanical Components library. Pick and drag
the k component to the main window. Drag it to the right and somewhat above
the Connector. Similarly, expand the Damper branch and pick and drag
r component to the main window, and drag it to right and something bellow of
the Connector. Arrange the spring and damper component one above the other
and connect their left ports to the corresponding ports of the Connector.
Pick and drag the Connector from the Template Box, Mechanical Components
branch into the main window and drop it to the right of the spring and damper
components, at the same height as the left Connector. Remove the left port, and
change the power sense of the right and top ports. Pick and drag a Power-out
port from the Editing Box tab, the Port branch, and drop it at the bottom of the
Connector component. Connect the top and bottom ports to the corresponding
spring and damper ports by bonds.
Expand the Mass branch in the Mechanical Components library and pick and
drag the Body component to the main window, and drag it to the right of the
208
Mechanical Systems
right Connector. Drag the Body component so that its left port is at the same
height as the right Connector port and connected them by a bond.
Pick and drag the Source Effort from the Editing Box, Bond Graph Components
branch, into the project main window and drop it to the right of the Body
component. Drag the port around the component so as to face the Body component. Position the SE so that its port is at the same height as the right Body
port and connect them by a bond.
Pick and drag the X Y Display from the Editing Box, Continuous Signal
Components branch, into the project main window and drop it at the right lower
corner of the working area. Insert also a Control-in ports at top left of the
component. Connect the left ports to the corresponding Body ports. Insert a
Control-out port at the right boundary of the left wall component and connect it
to the bottom port of the X Y display component.
This completes the construction of the project system level model. As the model
tree at the left indicates all word model components have predened models. By
expanding the k and r branches we can see that their models are the same as in
Figs. 6.12 and 6.13; we will also double-click C and R ports to dene the
parameters. The Body component differs from the model in Fig. 6.15, because the
0-junction including the Control-out port from Fig. 6.15 is included in the component (Fig. 6.17 left). We update the contained elementary components in the
same way as we did earlier (see Fig. 6.11). The model of the left wall component
(Ground) is different also (see Figs. 6.14 and 6.17 right). Because we have already
used the Connector in Fig. 6.16 the model in Fig. 6.17 right does not contain a
1-junction, only a 0-junction. We need to insert a Control-out port at the bottom of
this junction and connect it by a signal line to the output document port.
6.2.3
In previous sections the bond graph model of the Body Spring Damper system was
developed. The model closely resembles the real system. By running simulations
under different conditions, we can observe the time behaviour of different variables
209
in a way that is analogous to observing the behaviour of the real system via the
outputs of the instruments. To analyse the dynamical behaviour of the system, we
thus change the inputs and parameters, and study the effects.
6.2.3.1
We must rst build the mathematical model that will be solved during the simulation runs. To build the model, the modelling project must be opened; and the
Build button on the toolbar clicked, or the Build Model command on the Simulation
menu selected. We analyse the Body Spring Damper Problem project developed in
Sect. 6.2.2. The problem parameters that were already set during the model
development are:
6:1
6:2
210
Mechanical Systems
is open, and the bond going from this component to the Body component. It is
shown in blue colour. Note that the connected to port is not lled with the colour
but only its outline is shown. This indicates that the port is not connected inside the
component model. Of course we can correct this by connecting the bond we earlier
had broken!
211
Fig. 6.20 The screen appearance after the successful build operation
Figure 6.20 shows the screen after the successful build operations. We see that
all components documents are closed and the main document is now active. In
addition there is also a X Y Plot tab, which serves to display the plots generated
by the X Y Display component during the simulation.
After the model is built successfully we can continue with simulation. As already
discussed in Sect. 5.4 we can examine the complete model built, or print it out.
During the simulation, or after it, we can click X Y plot tab to view the plots
generated during the simulation. There are the messages generated at the Output
window at the bottom during the simulation.
6.2.3.2
Running Simulations
The model is created with zero initial conditions for all variables. We change only
the value of the input force. The simulation of such a model corresponds to simulating the system step response to an applied force. To start, we click the Run
toolbar button, or choose the Run command on the Simulation menu. The command
displays a dialogue used to dene the necessary simulation parameters, such as the
duration of the simulation run, the increment at which output values will be generated, error tolerances etc. (Fig. 6.21).
The natural frequency of the system is about 24 Hz, hence the period is about
0.04 s. We can expect the transient to die out after about ve periods, or 0.2 s. We
use a somewhat greater simulation period, e.g. 0.5 s, to be sure that the transient has
settled down. We set the simulation period to 0.5 s, and the output interval and the
maximal step-size to one hundredth of this value, i.e. to 0.005 s. The maximum
step-size should not be greater than the output interval. It is usually set to the same
212
Mechanical Systems
value as the output interval. We can choose a smaller value for the output interval if
we wish to get better resolution and smoother diagrams. This means, however, that
there are more calculations and the simulation run needs more computer time and
memory resources.
Default error tolerances are set to 106 for both the absolute and the relative
errors. The default integration method is the BDF method with a sparse matrix
linear equation solver (Sect. 5.3). Accepting the simulation data by pressing the OK
button, the simulation starts.
When the simulation starts, the messages in the Output window, under the Run
tab, inform the user of the simulation steps completed. Simultaneously, at the right
end of the status bar, a progress bar appears. This shows the progress of the
simulation. When the simulation nishes, the progress bar disappears and a message informs the user of this fact. If the simulation time is short, as is in this case,
the progress bar quickly disappears.
Note that in the central window there is already a tabbed window containing the
X Y plot. We can activate this by clicking the tab. However, to clearly see the change
in the body position with time, because of different scales, we need to deactivate the
input and wall forces (by double clicking the corresponding display ports and setting
the axes to None, Fig. 6.6). The resulting plot is shown in Fig. 6.22.
We can examine the values of the variables by clicking inside the plot.
Horizontal and vertical lines appear which intersect on the curve. The corresponding values of the variables appear below the plot.
213
It is also possible to get a list of output values by clicking on the plot with the
right mouse button. A drop-down menu appears from which we can choose the
Show data command. This command creates a list box containing values of the
variables. By scrolling through the list box we can examine values of variable pairs
generated by the simulation. It should be noted that the number of value pairs is
limited. The values listed are symmetrical with respect to the current value selected
by the mouse. If there is large number of output values, the values throughout the
complete range can be examined by a combination of mouse clicking and the use of
the list box.
In the present example, we can compare the values obtained by simulation with
the exact solution of the problem under study. The equation of motion of the Body
Spring Damper system can be written as
m
d2x
dx
b kx F
2
dt
dt
6:3
The response to a step F of the force can be written as (see e.g. [1] )
"
q
#
efxn t
2
x x0 1 p cos xn 1 f t u
1 f2
6:4
6:5
214
Mechanical Systems
Table 6.1 Response of the body position to a step in the applied force
Time, s
Simulation
(6.4)
0.01
0.05
0.1
0.2
0.3
0.4
0.495
0.003761887676
0.003448204502
0.005076850687
0.004465699802
0.004406268287
0.004455428889
0.004444573861
0.003761880557
0.003448187707
0.005076930584
0.004465689113
0.004406235937
0.004455470625
0.004444576945
Value
The
The
The
The
The
The
The
5
431
901
468
106
106
0.03
6.2.3.3
The study of mechanical vibration pays great attention to the influence of forces that
vary harmonically (see e.g. [1]). We can study such influence by dening a force at
the power port of the force component (Fig. 6.7) as
F F0 sinomega t
6:6
The simulation was conducted on a laptop with an Intel Core i7 CPU 2.0 GHz processor, installed
memory (RAM) 16 GB. The elapsed time is for the simulation runing in the backgound.
215
The amplitude F0 = 500 N and frequency omega of the applied force are
parameters, which can be set to any appropriate value. We study the effects of the
harmonic force on the system by changing its frequency.
The simulation interval is chosen as 1.0 s and the output interval is 0.001 s for
better resolution. Some typical results are given in Figs. 6.23, 6.24, 6.25 and 6.26.
In vibrations as well as in other elds an important role in design is played by
amplitude-frequency and phase-frequency response diagrams. Determination of
such diagrams is not an easy task particularly for non-linear systems (see [2] for
216
Mechanical Systems
detailed discussion). In the case of linear systems such as the Body Spring Damper
system these diagrams can be found from the Fourier transform of the impulse
response of the system [13].
The impulse response of the system can be approximated by the time response to
a very short force pulse of unit area (Fig. 6.27). Such a pulse can be described as
F
Fp ;
0;
t\Tp
t Tp
6:7
217
Using the question operator of Sect. 3.5, the relationship for the pulse of force
can be expressed as
F t\Tp?Fp : 0
6:8
The pulse duration parameter Tp should be very short and the strength Fp such
that their product is equal to one. The duration of the pulse we take as 0.0001 s, and
the pulse strength equal to 1000 N.
Let the response to such a pulse be denoted as h(t). Then the frequency response
of the system is given by the Fourier transform
Z1
H jx
htejxt dt
6:9
1
218
Mechanical Systems
To create the corresponding frequency response, we click using the right mouse
button on the plot and select from the drop-down menu the Continuous Fourier
Transform command. A new magnitude-frequency plot window opens together
with dialogue which is used to dene what part of time response plot would be
selected (Fig. 6.29). We can accept the offered parameters which cover the
219
complete time range and simple rectangular window function. Thus the all generated time data are passed to the FFT routine to generate a continuous Fourier
transform in the form of a collection of amplitude- and phase-frequency data. The
plot that program generates is magnitude-frequency plot. Because it uses the linear
scales we will convert the magnitudes into the ratios of the magnitudes and a
convenient constant, which is expressed in decibels (dB). Right clicking the mouse
over the plots we select the Amplitude Ratio in dB from the drop-down menu. The
three subcommands appear:
To DC Value
To Maximum Value
To Optional Value
We will choose the last subcommand and as the optional value we simply use
the value of 1.0. The new plot is generated with magnitude ratios in dB plotted
along the ordinate axis. We change the frequency scale to logarithmic clicking by
the right mouse key the plot and selecting from the drop-down menu the command
Logarithmic Frequency. We will select only a part of this diagram from frequency 0
to 100 Hz. We can achieve this by right clicking the mouse and selecting the
command Expand. Next we will position the mouse cursor slightly to the left of the
magnitude axis and press the left mouse button, drag the cursor to the vertical line
slightly left of 100 Hz, and then release the mouse button. Resulting plot is shown
in Fig. 6.30.
In a similar way we may obtain the phase response. We will return to the rst
frequency plot, we right click the button and select Show Phase. On the phase
220
Mechanical Systems
frequency plot we right click the mouse and select Unwrap Phase, and nally
expand part of the plot from 0 to 100 Hz. The resulting phase frequency response is
shown in Fig. 6.31.
We again compare simulation values with the exact solution. Recall from (6.3)
that the amplitude of the frequency response to the unit impulse force is given by
(see e.g. [1])
1=m
jH jxj q
2
x2n x2 4f2 x2n x2
After normalization of the frequencies, we get
1=k
jH jxj s
2 2
2
1 xxn
4f2 xxn
6:10
2f
1
x
xn
2
x
xn
6:11
Using the last expressions, we can calculate the amplitude and phase at the same
frequencies as that were obtained by the simulation. The magnitudes and phase
angles obtained by FFT and by (6.10) and (6.11), rounded to eight gures, are given
in Table 6.3 and show good agreement.
221
Table 6.3 Comparison of magnitudes and phase angles calculated analytically and by FFT
Frequency
[Hz]
Magnitude [dB]
by (6.10)
Magnitude [dB]
by FFT
Phase angle []
by (6.11)
Phase angle []
by FFT
1.0002
10.0002
20.0004
24.00048
30.0006
40.0008
60.0012
80.0016
99.00198
101.00810
99.391821
91.703357
87.102075
97.028864
106.31123
115.57470
121.23905
125.22338
101.00810
99.391836
91.703415
87.102158
97.028993
106.31146
115.57521
121.23996
125.22476
0.4809289
5.8016807
29.336570
93.042766
156.54251
169.49645
174.59915
176.25157
177.06871
0.49164163
5.9096765
29.552562
93.301957
156.86650
169.92843
175.24713
177.11553
178.13787
Note that the Fourier transform of the pulse input is not equal to one, as was
assumed in (6.10) and (6.11). The magnitudes are given by well-known sinc
function [3]
sin xTp =2
jF jxj
xTp =2
6:12
6:13
2p 100 0:0001=2
0:9998
and the phases between zero and
0:01 p rad 1:8
These gures explain why we obtain such a good approximation of the Fourier
transformation using the pulse input and FFT. If the pulse width is much larger or
much higher frequencies are considered the expected approximation would be
worse, in particularly the phase.
We can also nd the Fourier transform of the input pulse. We will repeat the
simulation using e.g. a simulation interval of 0.05 s and the output interval of 106.
Applying the Continuous Fourier Transform on the plot of the input force and
expanding the rst part of the magnitude plot up to 5 104 Hz we obtain the diagram
shown in Fig. 6.32. Clearly the absolute value of sinc function is clearly seen. The
value of the magnitude at zero frequency is 0.988197; theoretically it is 1.0.
222
Mechanical Systems
6.3
We continue with the study of vibration systems by analysing the influence of dry
friction. This is usually treated by studying the motion in the positive and negative
directions separately, and the conditions under which the motion ceases [1]. We
will develop an integral model of dry friction that can be used for prediction of such
a motion. The model can be used for the analysis of more general systems in which
this type of friction is important.
6.3.1
So-called dry friction occurs when one solid slides over another. The laws governing such friction date back to Leonardo da Vinci (14521519), but are better
known from the work of Coulomb in 1785 (Fig. 6.33). A modern exposition of the
theory is given in [4]. In the bond graph literature there were also attempts to model
dry friction. Thus in [5], the friction around zero velocity is modelled as a force
dependent on motion and, outside of this region as a function of velocity only. In
[6] discontinuous laws of friction were modelled by sinks of xed causalities. The
modelling of friction was analysed also in [7], motivated by the physical theory of
[4]. The model proposed consists of capacitors and resistors interconnected by
transformers, whose ratios change smoothly from one to zero, depending on the
state of the body motion.
223
We also use the theory of [4], but friction will be modelled by a single element
that imposes restrictions on the body motion. A suitable element for this is the
switch element (Sect. 2.5.8), as it is capable of imposing the zero flow (sliding
velocity) condition before motion commences, and also when the motion ceases. It
also accounts for constantor possibly variableeffort (friction force) during the
motion.
The contact area between bodies generally is not smooth, but is actually rough
Fig. 6.34. Thus, when a body is pressed onto another, the real contact starts at the
tips of the highest asperities. These deform until the area of contact is large enough
to support the load without yielding. Owing to high pressures and temperatures at
the contacts, solid junctions are created at the contact places known as micro welds.
To slide one body over another body (ground), it is necessary to apply a force in
the direction of the sliding that is large enough to break the micro welds. Until the
224
Mechanical Systems
motion commences, the body is in static equilibrium under the action of the applied
forces, including the other bodys reaction force (Fig. 6.35).
Fax and Fay are components of the applied force. The component of the reaction
force Fn that is normal to the sliding direction is the usual normal reaction, and the
component in the direction of sliding is the friction force. It is denoted simply as
F. Thus, the conditions of equilibrium can be stated as
Fax F 0
Fay Fn 0
)
6:14
and
vx 0
vy 0
)
6:15
where vx and vy are the velocity components of the body relative to the other body
(ground).
The limiting force value at which the welds break and hence the sliding commence is termed the static friction Fs. Thus (6.14) is satised if the friction force
satises the condition
jF j F s
6:16
This limiting value, corresponding to the strength of the micro welds, depends
also on the time that the bodies are in the contact. When the bodies are in contact
there is migration of particles over the junction by diffusion, and this needs some
time. If there is enough time, intimate junctions are established and the two bodies
behave as single body. In this way, the static force increases to a maximum value
that the micro junctions can sustain. When we speak of static friction, we mean this
full strength value. The Coulomb law relates this limiting force to the normal
reaction by
225
Fs ls Fn
6:17
6:18
Here the k is the kinetic coefcient of friction, which is somewhat less than the
static coefcient, typically about 2025 %.
To complete the model of friction at this stage, we need to dene the state at the
very moment when the motion commences, which ideally occurs at zero velocity
(Fig. 6.33). This is not covered by (6.18) and hence we add this condition to (6.16).
The friction characteristics valid from no sliding until the sliding commences read
now as
9
v 0; jF j ls F >
=
F lk Fn 0; F [ ls Fn v 0
>
;
F lk Fn 0; F\ls Fn
6:19
This equation is compatible with (6.18) that is valid for the sliding. The (6.18)
and (6.19) are constrains on the body motion imposed by the mechanism of dry
friction. We have not tried to nd an explicit relationship for the friction force, as
this is difcult to nd in the general case. We dont know if the force at the contact
is known or not, and similarly for the velocity. Hence, the effect of friction is
represented by a simple linear implicit equation, different for the body sliding and
not sliding.
We dwell a little more on (6.19). To nd out whether it is applicable for a given
state of the body motion, we need to test the sliding velocity against the zero value.
In computer arithmetic it is, in general impossible to nd out the exact moment
when some variable attains a denite value. Thus, some tolerance on the velocity
around zero is necessary. In parallel to the fact that physically there is no such thing
as rest. The theory of [4] proves that the static friction behaviour holds also when
the sliding is very slow. Thus, we reformulate the above relations to be valid if |
226
Mechanical Systems
v| < tol. The tol represents a tolerance, which we take to be much smaller than the
error tolerance used for simulating motion and close to the machine epsilon.4 In the
BondSim there is a predened parameter BG_EPSILON, dened as four times the
machine epsilon (Table 4.1). This can be used if such a low tolerance is needed.
The relationships given by (6.18) and (6.19) can be represented in the form that
is used when describing the element constitutive relations (Sect. 3.5). The relations
can be compactly expressed using the question (?:) operator. The relationship
reads
absv\tol?absF \ mus Fn ?v : F [ 0?F muk Fn :
F muk Fn : v [ tol?F muk Fn : F muk Fn 0
6:20
In the equation instead of the Greek symbol , mu is used, and also the indices
are written on the same line. The program supports only Latin characters, without
any formatting. The statement can be understood as:
The left side of (6.20) looks like a C language statement. It states in a compact
form the conditions imposed by dry friction on the rest of the system. The mechanism of friction is not a trivial one. There are ve possible states through which the
system goes during its motion. Unfortunately, this is not the end of the story. We
have to dene also the conditions for motion stopping. Otherwise, such a model is
not of much use in simulations.
In books on vibrations such as [1, 8], the motion stops when the amplitude of the
spring force acting on the body is less than the static friction. This is not a precise
enough statement. According to [4, 7], when the body stops, friction does not
achieve the static value again, but at most the kinetic value. To nd a more precise
statement of the stopping condition, we need to express it in terms of the variables
at the interfaces of the two bodies, i.e. the force and the velocity at contact.
By denition the machine epsilon is the smallest positive number such that 1 + 1 in machine
arithmetic and for the given floating-point number representation. It is equal about 2.2 1016 for
double precision numbers.
227
Fig. 6.36 Effects of velocity sign change when applied force is a outside or b inside the friction
limits
We look more carefully at what happens when the body velocity changes its
sign. During the motion there is dynamic equilibrium of the forces acting on the
body, including the body inertia force. Suppose that the active force is acting in a
manner that reverses the body motion. When the velocity changes its sign the sense
of the friction force changes too. Hence, the body acceleration changes abruptly. If
the active force on the body is outside the kinetic friction limit, the acceleration will
not change its sign and hence the body will continue to move in the opposite
direction (Fig. 6.36a).
If, on the other hand, the active force is within the kinetic friction limit, the body
acceleration will change its sign and the body will try to move back (Fig. 6.36b).
This, in effect, means that the friction force tries to push the body back, which is
impossible because dry friction is not capable of delivering positive power to the
body. The dynamic equation of motion and the characteristics of dry friction as
given by (6.19) thus are incompatible. Looking from the viewpoint of the asperities,
there is no abrupt change in the friction force. However, owing to the asperities
stiffness and internal damping, the body rst slows down and stops. It continues to
move in the opposite direction only if the absolute value of the total active force on
the body is greater than the asperities breaking force, i.e. the kinetic friction.
Thus, to solve this problem we apply additional requirements: if the power
delivered by dry friction is positive then the sliding velocity should be equal to zero.
This is stated as follows:
228
Mechanical Systems
F v[0 ) v 0
6:21
Adding this requirement, the nal form of the dry friction constitutive relation
reads (see 6.20)
absv\tol?absF \ mus Fn?v : F [ 0?F muk Fn : F muk Fn :
F v\ 0?v [ 0?F muk Fn : F muk Fn : v
6:22
The model of a ground body that acts on another body by the mechanism of dry
friction can be represented by Ground component as shown in Fig. 6.37a. Its model
is shown in Fig. 6.37b. To model dry friction we use a Switch element with a
constitutive relation given by (6.22). There are two branches in the model.
The left branch corresponds to the interactions in the sliding direction, and the
other describes the interactions in the normal direction (Fig. 3.35). The 0-junction
on the left simply states that the body velocity (the upper port) is equal to the sum of
the ground body velocitydened by the flow source SF on the leftand the body
sliding velocity. The flow junction variable is the friction force. Positive power flow
at the port corresponds to the force and velocity components taken in the direction
of the coordinate axis. This way, power transfer from the ground by the mechanism
of dry friction is positive if the friction is positive. Clearly the (6.18) shows that it is
negative, and hence the real power transfer is negative. The other flow junction
asserts that the velocities of the bodies in the normal direction are equal. The
junction variable is the normal reaction, which is fed back to the control port of the
switch element supplying it with the necessary information.
Based on this model we can dene a component representing the dry friction
interactions between the sliding bodies (Fig. 6.38a). The component implements the
model represented by the central part of Fig. 6.37 (without the flow sources), as
shown in Fig. 6.38b.
We will now test the model on various problems in which the friction is
important. We start with vibrations of the single degree of freedom system of
Sec. 6.2, replacing the linear friction by dry friction. We then analyse some
problems in which stick-slip appears.
229
Fig. 6.38 The component representing dry friction (a) and its model (b)
6.3.2
We return to the problem of Sect. 6.2.1 and analyse the free motion of the body
under the influence of dry friction at the contact with the ground (Fig. 6.1). The
corresponding bond graph model is given in Fig. 6.39.
The model is similar to that of Fig. 6.15. The main difference lies in replacing the
linear mechanical damper with the model of the ground in Fig. 6.37. This includes
the effect of dry friction, but the external force is removed. We are no longer
interested in the wall force, and thus the wall is represented simply by a zero flow
source. The model of the body is somewhat more complex than that in Fig. 6.11
because we need a model of the body motion in two dimensions, i.e. along the
ground and normal to the ground (Fig. 6.40).
The left effort junction of Fig. 6.40 describes the translation of the body along
the ground surface. Similarly the other junction represents the summation of the
forces in the normal direction. The weight of the body is represented by the source
effort SE. The I elements represent the inertia of the body. To monitor the motion of
the body, the velocity (v) is taken from the junction and fed out to the corresponding display port (Fig. 6.39). The position x is obtained by integrating the
v (velocity) and is fed out and connected to the other display port.
To compare the behaviour of the two models, the basic parameters used are the
same. Thus, the parameters of the model are taken as
230
Mechanical Systems
The initial displacement of the body is 5.0 103 m and the initial velocity is 0.
The complete model can be found in the project library under the name Body
Motion with Dry Friction.
The model is more complex than in Sect. 6.2; it consists of seventeen equations
of index 2 type (Chap. 5). During the simulation the structure of the model frequently changes, which could pose a problem for the solver. The method described
in Chap. 5, however, copes with this rather well. The simulation was run for 0.5 s
with an output interval of 0.005 s.
Results (Fig. 6.41) show that amplitudes of the body position decrease linearly
until the body settles down after about 0.3 s. The period of vibrations is equal to 2/
n, where n is the natural frequency of vibration. The theoretical value of the
decrease in amplitude per cycle is equal to 4, where = mg/k, is based on the
same value for both friction coefcients [1].
231
Value
The
The
The
The
The
The
The
1
965
2340
1477
106
106
0.04
Using the parameters given above the value of the amplitude drop obtained by
this formula is 0.0006976 m/cycle. By simulation the amplitude drop per cycle of
0.000699 m is obtained. The body settles down at a position of 0.000114846 m,
which corresponds to a spring force of 12.92 N, or 66 % of the kinetic friction. The
simulation statistics are given in Table 6.4 (for the output interval 0.005 s).
In comparison with Table 6.2 there are apparently many more integration steps,
and the function and the matrix evaluations. However, the simulation takes nearly
the same time. Thus, despite of a more complex mathematical model, the simulation
was conducted successfully and efciently.
6.3.3
Stick-Slip Motion
In the previous problem the static friction is important only at the beginning of the
motion. Later, when oscillations begin and nally settle down, the kinetic friction is
the main influence. This and similar behaviour in engineering equipment often
leads to neglecting the difference between static and kinetic friction and thus
simplifying the model of dry friction (see e.g. [8]). This is not the case, however, in
processes in which intermittent (stick-slip) motion appears as a consequence of the
difference between these two friction coefcients. This is analysed experimentally
and theoretically in detail in the classical reference on friction [4].
The stick-slip motion occurs between the sliding surfaces of two bodies in
contact when one body is driven with constant, a fairly low velocity, and the other
has a certain degree of elasticity. This is the case with the bodies in Fig. 6.39 if the
ground body is driven with a constant and very low velocity and the other body is
initially at rest. At the beginning when the spring force is less than the static
friction, the ground drags the body, thereby increasing the tension in the spring.
This is the stick phase. It lasts until the tension in the spring reaches a value at
which the spring force overcomes the static friction. At that moment, friction
between the body and the ground drops to the kinetic friction value, which generally is lower. Hence, the body under the action of the spring slips quickly back
232
Mechanical Systems
over the ground. The slip phase lasts until the two velocities again are equal.
A new stick phase then begins.
Intermittent motion can be a problem in applications in which smooth motion is
important. As discussed in [4], if there is some damping in the system, intermittent
motion may not occur at all, even if there is a nite difference between static and
kinetic friction. Nevertheless, we will show the behaviour of the system of Fig. 6.39
under very slow ground motion conditions.
In the problem of Fig. 6.39, we assume the ground is driven at a constant
velocity V0 = 0.001 m/s and the body is initially at rest. Thus in the left flow source
of the Ground component (see Fig. 6.37) we change the value of the flow source
velocity to 0.001. Also, in the capacitive element of the Spring (see Fig. 6.12), we
set the initial displacement to zero. In the inertial elements of the Body model
(Fig. 6.40), we retain zero initial conditions, but change the initial position in the
integrator to zero. We build the simulation model and run the simulation for 0.5 s
with an output interval of 0.001 s, accepting the default values for the other simulation parameters. The results are given in Figs. 6.42 and 6.43.
Figure 6.42 shows the position of the body and Fig. 6.43 its velocity with time.
The body sticks to the ground body until the spring tension is greater than the static
friction. This occurs 0.218 s after the start of the motion. The body then detaches
from the ground and, at rst, continues to move in the same direction. Shortly after,
at about 0.219 s, its velocity drops to zero and it then moves in the opposite
direction. Reattachment occurs at 0.241 s, when its velocity catches up with the
velocity of the ground.
We can easily nd the displacement of the body during the slip. Let y1 be the
position of the body at the start, and y2 at end, of slip. During slip the friction force
is equal to kinetic friction Fk. Applying the law of kinetic energy change during the
slip, we easily nd the relationship
233
1 2 1 2
ky ky Fk y1 y2
2 1 2 2
or
y1 y2 2Fk =k
6:23
On the other hand, at the start of the slip, we have y1 = Fs/k. Thus, we obtain
y2 2Fk =k y1 2Fk Fs =k
and the displacement during the slip is given by
s y1 y2 2Fs Fk =k
6:24
6:25
This shows that slip is possible if there is a difference between the static and
kinetic coefcients of friction. Using the values of the parameters given earlier
(Sect. 6.3.2) we nd s = 0.872 104 m. From the simulation we nd that slip in
Fig. 6.42 is 0.875984 104 m. Thus, the value obtained is somewhat greater,
which can be explained by the fact that detachment and reattachment of the body to
the ground occurs shortly before and after the zero velocity positions (Fig. 6.43).
234
6.3.4
Mechanical Systems
As the next example, we simulate the behaviour of the stick-slip oscillator described
in [9]. The system that we analyse consists of a body which has one elastic degree
of freedom and which can slide over the ground under the action of an external
force (Fig. 6.44). On the body there is placed another body, which can also slide
over the rst under the action of a force.
The forces change with time harmonically, i.e.
Fi Fi0 cosxi t ui ; i 1; 2
6:26
235
Note that gravity is different from the value dened at the level of the program.
Thus, to overrule this value a new value given above is dened at the system level
The simulation was run for 5 s, which corresponds to ve cycles of vibration. To
more accurately simulate discontinuities in inertial forces (accelerations here), a
fairly small output interval of 0.001 s was chosen as well as a tighter error tolerance
of 108. Even with these values, the simulation time is not too long (about 0.9 s on
an i7 laptop). The results are shown in Figs. 6.46, 6.47 and 6.48.
Fig. 6.46 The phase portrait
of Body1
236
Mechanical Systems
The system establishes stable limit cycles after two or three cycles (Figs. 6.46
and 6.47). The oscillations of Body1 are fairly symmetrical about the origin and of
Body2 are displaced a little to the right (about 0.04 m).
Figure 6.48 gives a plot of the inertial forceor acceleration, as the mass is 1 kg
against velocity for Body1. The diagram is not smooth as in the previous case,
because there are jumps in the inertial forces when either body changes motion
from sticking to slipping, or vice versa. The bodies are coupled by friction; hence,
237
these changes are reflected in both bodies. By looking carefully, we can see the
limit cycle (the inner loop).
Discontinuities in accelerations occur at zero velocity and at a velocity of
2.626 m/s. The limit cycles closely agree with the phase diagrams of [9]. In
addition, Figs. 6.46, 6.47 and 6.48 also show how the cycles gradually develop.
6.4
The next type of problem that we analyse is one of the simplest problems dealing
with impact. We analyse the impact of a ball dropping on a massive table (ground).
We analyse rst the case where the table is at the rest. But more interesting is the
problem when the table vibrates with constant frequency in which case chaotic
vibrations can occur [10]. We rst develop a simple model of impact, which is then
used in the bouncing ball problems. This model can be used as a basis for solving
much more complicated systems involving multibody motion with impact. It also
can be combined with the model of dry friction developed in the previous section to
model complex interactions at the contacts.
6.4.1
The dynamics of multibodies with contacts are studied in detail in [9]. This uses an
approach based on the classical Newton theory and the Poisson laws of impact. It is
applied to the solution of a range of problems. We will not follow such an approach
here, but use the relatively simple model of Fig. 6.49 in which the contact between
two bodies in the direction normal to the contacting surface is represented by a
spring-dashpot component. Such a model is also presented in [9], but we analyse it
here in more detail. The model is convenient because it enables us to treat processes
at the impact of two bodies as a component that imposes certain conditions on the
rest of the system. It offers the possibility of a more rigorous treatment of the
properties of the materials at the contact. It is usually argued that such models lead
to very stiff systems, which are not easy to solve. But other approaches, such as in
[9], also are not simple because the interactions at impact are rather complicated.
The BDF integration method used in the BondSim is capable of solving such stiff
models efciently.
We formulate the equation of motion of the ball and the spring-dashpot component as in [9]. First we dene the kinematic relationships
v
dy
dt
6:27
238
Mechanical Systems
and
vg
dyg
dt
6:28
The relative velocity of the ball with respect to another body (ground) is
vr v vg
6:29
Hence, the relative distance of the ball to the point of contact is given by
Zt
yr yr0
v vg dt
6:30
If yr > 0 there is a free fall of the ball, hence we have the equations
9
m dv
dt mg F =
dy
b dtg kyg F ; yr [ 0
F0
6:31
The ball hits the other body when yr = 0. From that moment on, the ball and the
spring-dashpot move as single system. Thus we have
239
9
m dv
dt mg F >
=
dy
b dtg kyg F >
;
vr 0
yr 0
6:32
At the moment of impact the ball has a velocity v0. The acceleration of the ball
changes abruptly at that moment to satisfy (6.32). Throughout the contact phase, the
motion the ball-spring-damper is governed by the equation
m
d 2 yg
dyg
kyg mg
b
2
dt
dt
6:33
In the rst phase of the motion there is compression of the spring until the ball
velocity drops to zero (Fig. 6.50a). This is followed by an expansion phase during
which the ball starts rebounding. The question is: At what moment does the ball
detach from the other body? According to [9] this occurs when the force F drops to
zero. At that moment the velocity of the ball and of the spring and damper ends are
equal; they continue to move in the same direction gradually separating one from
the other (Fig. 6.50a).
Such detachment is difcult to detect numerically. What we need is an abrupt
change of the ball motion and of the other body at the point of contact. This occurs
at zero compression where the velocity is v1 > 0. At that moment by (6.31) the
velocity of the spring-damper end drops abruptly to zero and its motion ceases
(Fig. 6.50b). Simultaneously, the force on the ball abruptly changes from the value
bv1 by (6.32) to the value 0 by (6.31). Thus, there is a positive impulse, which
changes the ball acceleration from value gbv1/m to g. In effect the body rejects
the ball.
We thus assume that the contact with the other body is established when the
balls relative displacement is less or equal to zero, and that the detachment occurs
when it is positive again. It is possible that the spring extension never drops to zero
240
Mechanical Systems
in a nite time. This is the case when there is high damping in the system, which
corresponds to an inelastic impact.
To complete the description of this simple model of impact, we calculate the
ratio of the ball velocity after and before impact. Solving (6.33) we get
fp
p
v1
e 1f2
v0
6:34
fp
p
2
6:35
1f
This is just the decrement known from theory of vibrations. For near-elastic
impact, i.e. 1, we have
a 1 fp
6:36
Table 6.5 gives values of the coefcient of restitution for various values of
damping ratio.
Now we can formulate a bond graph component that describes the interactions
between the two bodies during impact. This is basically a two-port component
(Fig. 6.51a). The ports are used to connect the bodies experiencing impact. The
model of impact is shown in Fig. 6.51b. There are two effort junctions 1, which
represent the velocities of bodies in the normal direction (see 6.27 and 6.28).
Summator s evaluates their difference according (6.29); and the integrator evaluates
the difference between the positions of the bodies, as in (6.30).
The rst equations in (6.31) and (6.32) describe the motion of the body (the
ball); thus, these are not included in the model of contact. This is represented by the
capacitive element C and the resistive R elements, which in conjunction with the
third effort junction, describes the second equations in (6.31) and (6.32). The switch
element Sw changes the condition represented by the third equations depending
Damping ratio
Coefcient of restitution
0
0.02
0.04
0.06
0.08
0.1
0.2
1
0.9391
0.8818
0.8279
0.7771
0.7292
0.5266
241
upon the body relative displacement evaluated by the integrator. The constitutive
relation of the switch is simply
yr [ 0?F : vr 0
6.4.2
6:37
We now analyse the motion of a ball, which is dropped from a height h onto a table
that is at rest (Fig. 6.52). The ball drops under the action of gravity, hits the table
and bounces back. It continues to bounce until it eventually reaches rest.
We treat the ball as a particle moving in a vertical direction under the action of
gravity. The model of the system consists of three components Ball, Ground and
Contact (Fig. 6.53). The Ball is represented in the usual way by an inertial element
representing the ball inertia in the vertical direction and a source effort describing its
weight connected to a common effort junction. The Ground is described by a zero
flow source. The last component models the impact of the ball with the table, as
described in the last section.
We extract several signals such as the position and velocity of the ball and the
position of the table (ground). In this problem this last signal is, of course, constant
(zero) since the table is at rest. Details of the model can be found in the library
under the project name Bouncing Ball Problem.
242
Mechanical Systems
We assume that the table is relatively rigid and that the restitution coefcient is
about 0.9. Thus the parameters used for the simulation are:
243
6.4.3
We continue with analysing the motion of a ball bouncing on a table, which is not at
rest, but vibrates with a constant frequency (Fig. 6.56). For low velocities of
vibrations, a stable ball motion appears similar to the case of the xed table
analysed in Sect. 6.4.2. On the other hand, if the velocity increases an irregular,
chaotic motion occurs. The dynamics of such motions are analysed in [10]. We will
244
Mechanical Systems
not repeat this here, but show by simulation some of characteristic motions that can
appear.
We use the model developed in the last section (Fig. 6.53). We also use the same
parameters, but change the velocity generated by the source flow of the component
Ground. We x the amplitude of the table displacement to the value Ag = 0.1 m and
change its frequency of vibrations. The velocity of the table, as generated by the
source, is dened as
vg Ag x cosxt
6:38
That is, it starts moving down. We show two characteristic bouncing ball motion
patterns.
The simulations are run using a simulation interval of 10 s and an output interval
of 0.01 s. Figure 6.57 shows the simulation of the ball motion when the table is
vibrating slowly at frequency of 3 rad/s. It can be seen that the ball bouncing
follows the table and nally comes to rest with respect to the table.
245
A quite different ball motion appears at higher frequencies. Figure 6.58 left
shows the ball motion during the rst 10 s when the table vibrates at 15 rad/s. To
see if the ball comes to rest with respect to the table, Fig. 6.58 right illustrates the
simulation of the same ball motion during the rst 100 s. It apparently doesnt stop
bouncing!
From the gures it can be seen that the interval between two bounces steadily
increases until chaotic motions develop. In [10] it was shown that the existence of
stable and unstable orbits of various periods can occur. Under certain conditions the
ball bouncing from the table at the uppermost position can double its period of
motion. As pointed out in [11], doubling the period leads to chaos. This is clearly
seen in Fig. 6.58. The reader interested in this and other chaotic systems behaviour
can consult [10, 11] for a detailed exposition.
6.5
As the last example of simple mechanical systems we return to the see-saw problem
of Sect. 2.7.3 (Fig. 6.59). This problem was treated as a simple example of a
multibody system, which we will discuss in more detail in Chap. 9. It was shown
that it is possible to develop a bond graph model by systematically decomposing the
system into its components.
Following the approach described in Sect. 2.7.3 and using BondSim, we can
develop a corresponding model. In Fig. 6.60 the basic level of the model is shown
in which the main components and the interactions between them are depicted. The
model consists of several levels and can be reviewed in the project library under the
title See-saw Problem.
The model developed is based on the direct application of the laws of Dynamics.
The corresponding mathematical model consists of a system of
246
Mechanical Systems
247
To simulate the see-saw problem using BondSim, we retrieve the problem from
program library (double clicking the project and selecting the command Copy to the
Workspace), open it and then build the model. We use the following model
parameters:
Body1 mass m1 = 80 kg
Body2 mass m2 = 20 kg
Platform mass m3 = 40 kg
Platform mass moment of inertia (centroidal) I3 = 90 kg m2
Geometric parameters (Fig. 2.20) a = 1.5 m, b = 1.125 m, c = 0.375 m
Initial angle of the platform = 1 rad
The simulation interval was taken equal to 10 s and the output interval to 0.5 s,
the error tolerances to default values. Some simulation results are shown in
Fig. 6.61 and 6.62. From Fig. 6.61 it can be seen that the see-saw oscillates about
the equilibrium position that is at = 0.4324 rad (24.77). The period of oscillation
is 3.4 s. The amplitude of the force on the frame in the horizontal direction is
349.2 N (Fig. 6.62). The force in the vertical direction (not shown) doesnt change
too much, i.e. it oscillates between 1152 N and 1613 N about a value corresponding to the weight of the platform and the bodies on it. Some numerical values
also are given in Table 6.6 (the second and fourth columns) and the simulation
statistics in Table 6.7 (the second column).
Next we develop a simplied model of the see-saw as a pendulum (Fig. 6.63).
First we note that the see-saws centre of mass in not on the body axis. Using the
parameters of Fig. 2.20 we can calculate its coordinates in the body xed frame as
248
Mechanical Systems
Table 6.6 Comparison of results obtained by the BondSim and the RADAU5 routine
Time (s)
0.1
0.5
1.0
1.5
2.0
2.5
3.0
3.4
(rad)
BondSim
RADAU5
Fx (N)
BondSim
RADAU5
0.99043873
0.77540086
0.27476494
0.098058291
0.049639565
0.38312370
0.85591563
0.99998092
0.99043865
0.77540064
0.27476482
0.098058331
0.049639515
0.38312303
0.85591521
0.99998105
348.15083
293.32720
153.46435
349.23567
345.01367
49.423719
330.02007
347.16784
348.15018
293.32710
153.46446
349.23563
345.01384
49.424294
330.01993
347.16789
Equations
Jacobian matrix elements
Steps
Function evaluations
Jacobian evaluations
Decompositions
Error tolerances
Elapsed time s
BondSim
RADAU5
49
123
459
967
502
502
1e6
0.04
5
25
975
8144
879
975
1e10
249
y0C m1 m2 b c m3 b =m
6:39
Here m is the total mass of the see-saw and the bodies on it, i.e.
m m1 m2 m3
6:40
The angle made by a line drawn from the origin through the mass centre CM to
the y-axis is given by
a atan x0C =y0C
6:41
This line is taken as the pendulum axis. Denoting by p its angle with the vertical
axis, we nd the angle of the see-saw by
/ /p a
6:42
Finally, the length from the origin to the centre of mass is given by
lC
q
02
x02
C yC
6:43
Now we can formulate the equation of rotation of the see-saw about the origin
(the pin axis) as
9
/_ p x =
mglC
sin /p ;
x_
IO
6:44
250
Mechanical Systems
Here the IO is its mass moment of inertia about the axis of rotation and is given
by Fig. 2.25
IO m1 m2 a2 b c2 I3 m3 b2
6:45
We also need expressions for the components of the force of the see-saw that
acts on the frame. We calculate such a force because, in the bond graph model of
Fig. 6.60, the efforts associated with the bond connecting the platform and the pin is
the force acting on the pin, not its reaction.
Hence by applying the law of the mass centre motion we have
9
d 2 xC
>
m 2 Fx >
=
dt
>
d 2 yC
>
m 2 Fy mg ;
dt
6:46
yC lC cos /p
6:47
6:48
The system (6.44) is in the state-space form, and (6.42) and (6.48) are the output
equations. These equations can be solved by many methods. We use the RADAU5
method of [12] implemented as C++ library of reference [15] for the comparison.
This method is considered by many as one of the powerful general-purpose
methods for solving higher index DAEs.
We use the same parameters as given at the beginning of this section. The other
necessary parameters are calculated by (6.39)(6.41), (6.43) and (6.45). We also
use the same simulation parameters as before (the simulation period 10 s, output
interval 0.1 s, but error tolerances are 1 1010). The results for the angle of
rotation and x-component of the force are given in Table 6.6 (third and fth
column).
Comparing the results obtained by the BondSim simulation and by the
RADAU5 solution we see that there are minor differences that are of the order of
the error tolerances used. It is interesting to note, in particular, that the accuracy of
the force component obtained by the BondSim is in the same range of accuracy as
that obtained by RADAU5. This is important because it is an index-2 variable.
251
The simulation statistics are given in Table 6.7. The solution of the reduced set
of equations is expected to be more efcient. However, the performances of
BondSim, which is based on BDF integration method, are excellent. We should
take into account that the semi-explicit index-2 equations are solved, and that the
system of equations is relatively large in comparison with the simplied model.
Number of matrix evaluations and decompositions are comparable in both methods.
On the other hand RADAU5 needs much larger number of function evaluations,
which is to be expected from a Runge-Kutta type solver.
References
1. Ginsberg JH (2001) Mechanical and structural vibrations, theory and applications. Wiley, New
York
2. Smith SW (1999) The Scientic and engineers guide to signal processing, 2nd ed. California
Technical Publishing. Electronic form http://dspguide.com
3. Oran Brigham E (1988) The fast fourier transform and its applications. Prentice-Hall, Upper
Saddle River, NJ
4. Bowden FP, Tabor D (1986) The friction and lubrication of solids. Clarendon Press, Oxford
5. Karnopp D (1985) Computer simulation of stick-slip friction in mechanical dynamic systems.
Trans ASME 107:100103
6. Borutzky W (1995) Represeting discontinuities by sinks of xed causality. In: Cellier FE,
Granda JJ (eds) 1995 international conference on bond graph modeling and simulation, Las
Vegas, Nevada, pp 6572
7. Mera JM, Vera C (1999) Dry Friction modelling by means of the bond graph technique. In:
Granda JJ, Cellier FE (eds) 1999 international conference on bond graph modeling and
simulation, San Francisco, California, pp 3035
8. Rao SS (1995) Mechanical vibrations, 3rd edn. Addison-Wesley, Reading
9. Pfeiffer F, Glocker C (1996) Multibody dynamics with unilateral contacts. Wiley, New York
10. Guckenheimer J, Holmes P (1997) Nonlinear oscillations, dynamical systems, and bifurcations
of vector elds. Springer, New York
11. Acheson D (1997) From calculus to chaos, an introduction to dynamics. Oxford University
Press, Oxford
12. Hairer E, Wanner G (1996) Solving ordinary differential equations II, stiff and
differential-algebraic problems, 2nd Revised edn. Springer Berlin Heidelberg
13. Karnopp D (1997) Understanding multibody dynamics using bond graph representations.
J Franklin Inst Eng Appl Math 334B:631642
14. Brenan KE, Cambell SL, Petzold LR (1996) Numerical Solution of initial-value problems in
differential-algebraic equations, classics in applied mathematics. SIAM, Philadelphia
15. Ashby B (2002) ItegratorT.zip. [email protected]. 15 Nov 2002
Chapter 7
Electrical Systems
7.1
Introduction
This section shows that the component model approach developed in Part 1 can be
readily used to model electrical and electromechanical components and systems.
This is important, as both the mechanical and electrical part of mechatronic and
recently evolved micro-mechanical systems [1] can be modelled and analysed on
the same basis, i.e. from the bond graph point of view.
It is well known that the electrical systems can be modelled in terms of bond
graphs [2, 3]. But this approach may appear strange to engineers used to the
electrical schematics. The models in terms of bonds are usually simplied, e.g. by
removing the ground nodes, resistor, capacitor, and other ports. Such models are
quite abstract, and often it is not easy to correlate them with the devices of which
they are models. In addition, the causality relations discussed in Sect. 2.10 restrict
models that could be used for modelling general electrical, as well as of other
engineering systems.
The approach developed here is based on the component models, the constitutive
relations of which can be freely dened. This enables a systematic approach to
development of the electrical components and system models. It is not necessary to
represent the electrical components in terms of word models only but, as already
discussed in Sect. 2.7.2, these can be depicted using graphical electrical symbols. In
this way, the bond graph point of view is retained, but on the surface they are
represented as the electrical schemes. At a deeper level, bond graph elements are
employed to model the processes in the components.
The models of electronic components are usually described in the form of SPICE
models [4]. These are developed for use in SPICE type programs specically
developed for electrical and electronic systems (Sect. 1.7).1 This type of model can
be used in bond graphs, as well. But here it is not necessary to use the SPICE
1
There are various versions of SPICE such as SPICE 2 and 3, HSPICE, PSPICE etc.
253
254
7 Electrical Systems
language, and there are no pre-built models of resistors, diodes, transistors, etc. The
component models are constructed from the ground up from simpler ones. The
same equivalent circuits, constitutive relations, parameter names, and values can be
used as in SPICE. The component models can deal easily with the macro models
that play an important role in the development of complex SPICE models. Once
developed, the component models can be moved into a library and used as needed.
An added advantage of our approach is that component models are transparent,
i.e. they can be opened for overview, and modied if required, or maybe a different
model of the same component can be developed and tested. The BondSim program
is not designed to be a replacement for specially designed programs, such as SPICE,
or others, but more as an open environment for developing the models and simulating the behaviour of the mechatronic and micro-mechanics systems (MMS). The
analysis currently supported is essentially in the time-domain.
This section starts with a relatively detailed description of a typical approach to
developing the bond graph models of the electrical systems and their simulation
using the electrical schematics. This is explained in an example of the simple RLC
circuit already described in Sect. 2.7.2. The approach is very similar to that used in
Sect. 6.2 for the mechanical systems. We then show how SPICE models of electrical circuit elements, such as resistors and capacitors, are developed. We continue
with modelling some basic semiconductor components. The chapter ends with the
analysis of an electro-magnetic system.
7.2
7.2.1
Electrical Circuits
The Problem
The electrical circuits can be modelled in a similar way to the mechanical systems
in Sect. 6.2. A typical approach to modelling the electrical circuits is illustrated by
an example of the RLC circuit of Sect. 2.7.2, repeated here in Fig. 7.1.
The circuit consists of the series connection of a resistor, inductor and capacitor
driven by a voltage source. We use the electrical component template tools to create
Fig. 7.1 The scheme of the
RCL circuit
255
the bond graph models, which model these components represented in the form of
electrical symbols. Using these tools and standard bond graph techniques we can
systematically develop corresponding bond graph models.
7.2.2
7.2.2.1
To begin with, we launch BondSim as described in Sect. 6.2.2. Using the command
New on the Project menu, or New Project toolbar button, we dene a new project,
RCL Circuit in the dialogue that appears and then click the OK button. The dialogue
closes and a new empty project document appears. Because we will dene the RLC
model using the electrical symbols we expand the Template Box at the right of the
new document window, and then the Electrical Components branch as shown in
Fig. 7.2. The model structure at the left shows only the RLC circuit project entry.
We will create the word model components represented by the electric components symbols corresponding to the components shown in the circuit in Fig. 7.1.
This can be achieved by dragging the tools from the electrical components list in the
Template Box and dropping them in the RLC circuit document window at suitable
positions. We start by dragging the Voltage Source tool and dropping it near the left
document border, but leaving some space (Fig. 7.3 left). The component created
appears in the form of the circuit symbol for the voltage source. Near the symbol a
component name VS (Voltage Source) appears; the caret shows that we are in the
Fig. 7.2 RLC circuit empty document window and selected electrical components toolbox
256
7 Electrical Systems
text-editing mode. We can edit the name if we wish, e.g. to E. To end the editing,
we click outside of the component, as is usual with word component models. After
the component has been created, its two power-in and power-out ports are created
as well.
We create the other circuit components in a similar way. By default, the resistors, inductors and capacitors are drawn horizontally. To draw the capacitor vertically, we need to click the Vertical in the Editing Box, Text Orientation branch.
After dropping the component we select again the Horizontal text orientation to
return to the default drawing mode. To complete the circuit, we create the Ground
component. We also create a Node between each of the components. All of these
are not always necessary, but we add them anyway to ease the connection of the
measuring instruments. The left bottom node is used for the connection of the
circuit to the ground. During the addition of the component we can also adjust the
width and height of the document window by dragging the right and bottom
document edges.
In addition to the basic components such as nodes, resistors, etc., we create also
the X-T display at the right top corner of the document window. (Remember that
the tool for creating this component is in the Editing Box tab, under Continuous
Signal Components.)
We can see that the positions of some of the ports in the nodes, as well as their
power directions, are not correct and should be changed (see Fig. 7.3 right). Thus,
we remove the bottom port of the node on the left of the resistor. Hence, we select it
and then press the Delete key. The same is the case with the node between the
resistor and the inductor. In the node at the right of the inductor we will remove the
right port. Similarly, we remove the right and the bottom port of the node below the
capacitor. However, to connect the bottom capacitor port, we need to add a
power-in port at the top of the node. To do this, we expand the Editing Box tab, and
then the Port branch. Now we may pick the Power-out port tool and drag it to the
top of the node bounding rectangle and drop it there. We also need to change the
power flow sense of the left port by selecting and pressing the Change Port toolbar
257
button. A similar operation we apply to the node below the Voltage Source
component.
Now that all the components are created and their ports have the proper power
senses, we interconnect the components by drawing bond lines between corresponding ports. To do this we simply pick a port and by holding the left mouse
button pressed drag the cursor to the port with which we wish to connect. As we
move the cursor, a line is drawn. We release the mouse button when we are above
the port with which we wish to connect. The both ports then disappear and the bond
line appears with a half-arrow pointing to the corresponding node. The bond having
been drawn we can reshape at will by dragging it. Thus we obtain the bond graph
which denes the basic model of the circuit as shown in Fig. 7.4 left.
It is necessary also to dene the variables that will be observed during the
simulation. Otherwise the simulation would be useless. This is similar to what is
encountered when dealing with the real circuit. To measure or record the processes
in the circuits we use instruments. In this example we monitor the voltages across
all components and the currents throughout the circuit. This requires the model
equivalents of voltmeters and ammeters, respectively.
To create a voltmeter word model component to measure the voltage drop across
the resistor, we drag Voltmeter from the Electrical components branch of the
Template Box (Fig. 7.2) and drop it just above the resistor. The voltmeter appears
with two control input ports and a single output port (Fig. 7.4 right). We drag the
output port around the Voltmeter and drop at the top to point upwards. To connect
its ports to nodes at the front and rear of the resistor we need to add the corresponding Control-out ports to these nodes (using the Editing Box, Ports branch).
The voltmeter, like other components, is created as an empty component that has to
be dened. In a similar way we create voltmeters for measuring voltages across the
other components.
Next we create the ammeter. Note that the ammeters are commonly connected
serially. We may insert the ammeter in the bottom line. Thus, we select the bottom
bond and click the Delete key to delete it. Next, we drag the Ammeter and drop it
Fig. 7.4 The system level bond graph model of the RCL circuit
258
7 Electrical Systems
somewhere between the bottom nodes. Note that the ammeter component that
appears has one power-in and one power-out ports and a single control out port. We
will drag the power input port to the right side of the ammeter, and the power-out
one to the left side. The output port is already placed at the bottom of the component. Now, we may connect the right port of the ammeter to the corresponding
port of the node on the right, and the left power port to the node on the left (Fig. 7.4
right).
We now connect the output ports of all voltmeters and ammeters to the X-Y
display component created earlier. Because by default it has only two input ports,
we rst create three additional control-in ports at the component periphery at
convenient places. At their creation the ports have default names, which are used to
label signals displayed along the x or y axes. We can change the names of the
signals after the display ports are connected. All the signals are, by default, plotted
along the y-axis, the x-axis serving as the time axis. This can be changed easily by
double-clicking the plotter ports (Fig. 7.5). The dialogue that opens can be used to
dene the signal names and choose the display axis.
We may select only one variable to be used as the x-axis variable. All others
must be y-axis variables. We can also choose the None option, in which case the
variable is not displayed. We dene E for the source voltage, eR for the voltage
across the resistor, eL for the voltage across the inductor, and eC for the voltage
across the capacitor, and the I for the current throughout the circuit. Because the
expected range of the currents (mA) is quite different from the range of the voltages
(V), we check None for the current axis, so that only the voltages will be displayed.
(Later, we can display the time history of the current in the circuit.)
7.2.2.2
To complete the RCL circuit model, we next dene the model of every one of the
circuit components including the voltmeters and the ammeter. We start with the
voltage source E. To open it we double-click it. We can open it also by right
clicking the component icon E in Model Structure under the project RLC circuit. In
the menu that drops-down select the command Open. Because the model of the
Fig. 7.5 The output variable
dialogue
259
voltage source has not already been dened, a dialogue appears asking if we would
like to create the model of the component. If we answer by clicking the OK a new
document opens in the form of a new document page labelled Component: E. The
document has the already created document ports corresponding to the component
ports. To create the model we will expand the Bond Graph Components branch in
the Editing Box. Next we drag 1 junction tool and drop it into the new document
window, and then do the same with SE (Source Effort) tool. We will rearrange the
inserted components and their ports and connect them as shown in Fig. 7.6. The 1junction denes the voltage difference across the Source Voltage ports, and SE
generates the electromotive force of the source.
The constitutive relation describing the voltage generated by the SE is stored in
its port. To edit it, we double-click the port. A dialogue appears that is used to
assign the port variable name, dene the model parameters, and edit the constitutive
relation that describes the emf at the port (Fig. 7.7). We retain e as the name of the
Fig. 7.7 The dialogue for
editing the voltage source
constitutive relation
260
7 Electrical Systems
effort variable (voltage). The eValue is the parameter dening the constant voltage
generated at the port. At the port creation it is set to zero; we now change it to 10
(V) by use of the Parameters button (see Sect. 4.8.2).
Next, we dene the simple low frequency models of the resistor, inductor and
capacitor, ignoring the parasitic effects. The model of the resistor (Fig. 7.8) consists
of an effort 1-junction, which determines the voltage drop across the resistor and a
resistive component R. We edit the constitutive relation for the voltage across the
resistor by double-clicking the port of the resistor component R (Fig. 7.9). We retain
the default name e for the effort (voltage) and change the flow variable to i. The
constitutive relation corresponds to Ohms Law, with the resistance parameter R0
(Sect. 2.5.4). By default, this is set to 1, but we change it to 200 (ohm) using the
Parameters button.
The Inductor component is dened similarly (Fig. 7.10). This component uses an
inertial component I that denes Henrys Law (Sect. 2.5.2). Double-clicking the
component port displays a dialogue that is used to dene the inductor constitutive
relation (Fig. 7.11). We change the flow variable to the current i, and the state
variable to the coil flux linkage p. In the constitutive relation box we change the
inertial parameter I0 to the inductance parameter L. Likewise, we delete the
261
parameter I0 from the parameter list and insert the parameter L with a value of 0.
010 (H).
Finally, we dene a simple model of the Capacitor (Fig. 7.12). Again, the effort
junction describes the voltage across the capacitor. We use the capacitive component C to describe the processes in the capacitor (Sect. 2.5.3).
The default constitutive relation can be changed by double-clicking the component C port (Fig. 7.13). We change the effort variable (the voltage across the
capacitor) to e, and the state variable to the capacitor charge q. The parameter C0,
the capacitance, is set to 2.0 106 (F).
The last group of components that we have to create are the Voltmeters and
Ammeter (Fig. 7.4). We implement the Voltmeter simply as an instrument, which
gives as its output the difference between the signals fed to its inputs. Thus, to
create the model of the voltmeter, we open the component, e.g. by double clicking
the voltmeter object, and in the document that appears we insert a summator (+) by
dragging and dropping the corresponding tool from the Editing Box, Continuous
signal Components. By default at the summator creation its ports have assigned the
plus sign. To change the sign we double-click the port and from the drop-down
262
7 Electrical Systems
menu select the appropriate sign, e.g. the minus sign. If we wish to scale the output
we may insert a function (gain) component (Fig. 7.14).
To dene the scaling we open the output port (by double-clicking) and in the
dialogue that opens change the gain parameter k0 (Fig. 7.15). By default its value is
pre-set to 1.
The ammeter we may dene in an analogue way. This time we will insert a 1junction and connect it to the ammeter power-in and power-out ports (Fig. 7.16).
We delete the third power port and instead of it insert a control-out port, which
gives the access to the common junction flow, i.e. the current in this case. Finally,
as in the case of the voltmeter, we may insert a function component between the
junction output and the ammeter document output port. This component can serve
to scale the ammeter output up or down, e.g. to mA.
Thus, we have dened the models of all the circuit components. The models of
the nodes are already dened, as they are just flow junctions. The ground is a source
effort component and, by default, the voltage at its port is set to 0 (V). It could be
changed, if required, as is the case with the other source efforts, by double-clicking
its port and using the corresponding dialogue.
263
1
FUN
7.2.3
Before we can start the simulation of the circuit we have rst to build its mathematical model by clicking the Build button or selecting the Build Model command
on the Simulation menu. After the model is built, the mathematical model of the
circuit can be reviewed.
264
7 Electrical Systems
During the Build all the component document windows are closed and saved.
Only the main document window remains opened and active. In addition for each of
the X-Y display components a separate document tab is opened. These documents
are used to display the plots generated during the simulation. Thus, we can activate
the display page by clicking the corresponding tab to see how the simulation
advances.
We start the simulation by clicking the Run button on the toolbar, or by choosing
the Run Simulation command in the Simulation menu. This opens a dialogue in
which we must enter the simulation interval (Fig. 6.21). The values of the circuit
parameters set during model development were:
1.
2.
3.
4.
5.
265
From these plots we can see that at the start of simulation the complete source
voltage appears across the inductor coil; then, as the current starts flowing through
the circuit and the capacitor accumulates the charge, it drops steeply. After the
transients die out, there is no current in the circuit and the capacitor is fully charged
to a value corresponding to the source voltage.
266
7.3
7 Electrical Systems
7.3.1
Resistors
7:1
Here, e1 and e2 are the efforts (voltages) at the ports, eR the voltage across the
resistor, iR the current through the resistor, and R its resistance.
Fig. 7.19 The resistor: a the circuit symbol, b the bond graph representation
Fig. 7.20 The model of the
resistor
267
The resistance is typically a constant expressed in ohm. The SPICE software has
a built-in model of a resistor that can exhibit the temperature dependence. The bond
graph models used here are much more flexible in this respect.
It is a simple matter to describe the dependence of the resistance on temperature
as used in SPICE. We can dene two temperatures, TNOM and TEMP, as the
parameters at the resistor document level using the Parameters button, or the Model
Parameters command on the Edit menu. The nominal temperature TNOM is usually
set to 300 K (27 C), and the value used for TEMP corresponds to the resistors
working temperature. We dene (similar to SPICE) two temperature coefcients,
TC1 and TC2. SPICE-like temperature dependence can be formulated as
R R0 1 TC1 TEMP TNOM TC2 TEMP TNOM^ 2
7:2
7.3.2
Capacitor
268
7 Electrical Systems
Fig. 7.22 The capacitor: a the circuit symbol, b the bond graph representation
The constitutive relations for the capacitor can be found easily (Sect. 2.5.3)
9
e1 e2 eC 0 =
eC q=C
7:3
;
iC dq=dt
Here, e1 and e2 are the efforts (voltages) at the ports, eC the voltage across the
capacitor, q the charge, iR the current through the capacitor, and C its capacitance.
The dependence of the capacitance on temperature can be described essentially
in the same way as we did for the resistor. A non-linear capacitor can be described
using a second equation in Eq. (7.3) that expresses voltage across the capacitor as a
function of the charge. In this way, polynomial, exponential, or other non-linear
dependence can thus be specied readily.
The capacitor model given above is a reasonably good approximation for frequencies up to about 1 kHz [6]. At higher frequencies a series resistive and
inductive element gives a better approximation to real capacitors. The model of
Fig. 7.23 can be modied to include such effects (Fig. 7.24). The parallel resistive
element models the capacitor leakage, which can be usually neglected.
The capacitor model of Eq. (7.3) is based on the charges; it differs from the
SPICE model, in which the charge is eliminated. This model simplies the
description of the accumulation of the charges in the circuits and their conservation.
There is also some evidence that this type of model behaves better when simulating
the complex electrical circuits [8].
269
7.3.3
Inductors
7.3.3.1
Simple Inductor
Fig. 7.25 The inductor: a the circuit symbol, b the bond graph representation
270
7 Electrical Systems
resistance of the inductor coils. At very high frequencies, the winding capacitance
comes into effect. The model of Fig. 7.26 can be modied easily to include such
effects (Fig. 7.27).
The model of (7.4) is flux based and differs from the SPICE model in which the
flux linkage is eliminated from the constitutive relations. It is used here similarly as
in the case of the capacitor because it describes the inductor as a dynamic component with explicitly dened internal state variable. There also is evidence that
such models are better suited to simulating the electrical circuits [8].
7.3.3.2
Coupled Inductors
The coupled inductor is a four-terminal component usually used for modelling ideal
transformers. It is represented schematically in Fig. 7.28a. We represent it by the
four-port component of Fig. 7.28b.
271
Fig. 7.28 Coupled inductors: a the circuit symbol, b the bond graph representation
7:5
272
7 Electrical Systems
Mk
p
L1 L2
7:6
where k is the coupling coefcient. The relation (7.6) can be dened as a parameter
expression at the document level of the component, or inside the inertial
component.
The model presented above is linear with constant values of the impedances. It
could be modied in a way similar to that of the simple inductive component.
7.3.4
Sources
7.3.4.1
Fig. 7.30 The independent voltage source: a the circuit symbol, b the bond graph representation
273
Fig. 7.32 The independent current source: a the circuit symbol, b the bond graph representation
7.3.4.2
Constitutive Relations
There are no built-in functions for voltages or currents generated by the sources.
Voltages or currents, instead, are dened by the constitutive relations of the corresponding SE or SF components (Sect. 2.5.5). We now show how some important
relationships can be described for voltage sources, but the same is valid for current
sources, as well.
The sinusoidal emf can be described simply as (Fig. 3.34)
274
7 Electrical Systems
7:7
This function assumes that the voltage has a constant offset E1 for times less
than TD, and then oscillates with a frequency FREQ (Hz). The constants E1, EA,
TD, and FREQ are dened as the default parameters at the source document level of
the component. The specic values that override them are input in the SE or SF
components by using the corresponding dialogues.
An exponential function can be expressed as (Fig. 7.35)
e t\TD?E1 : E1 E2 E1 1 expt TD=TAU
7:8
275
e t\TD? E1 :
t\TD2?E1 E2 E1 1 expt TD=TAU :
E3 E1 E3 1 expt TD2=TAU1
7:9
The time parameter TD2 > TD and E3 corresponds to the voltage at the
beginning of the fall, i.e.
E3 E1 E2 E1 1 expTD2 TD=TAU
7:10
The last parameter in (7.10) is the time constant, dened by a default value, such
as TAU = 1. The time constant must not be zero, nor should it be too small; either
situation will cause an arithmetic fault and the program may crash.
It is not much more difcult to dene a pulse train of arbitrary waveform, such as
in Fig. 7.36. To dene the pulse, we need the time measured from the start of the
pulse. This can be found as the mod (%) of t TD with respect to the pulse period
PER, i.e. the remainder after dividing by the pulse period,
s t TD%PER
7:11
This expression can be used as the argument of a function dening the pulse
shape
e t\TD?E1 : t TD)%PER \TR? E1 KR t TD)%PER):
t TD)%PER\TR + PW? E2:
t TD)%PER\TR + PW + TF?
E2 KF t TD)% PER TR PW):E1)))
7:12
276
7 Electrical Systems
IN
RL
VS
E1 and E2 are the pulse offset and pulsed value, respectively, and
KR TR [ 0?E2 E1=TR : 0
KF TF [ 0?E2 E1=TF : 0
7:13
The effect of such pulses on the circuit of Fig. 7.37 is described next. This circuit
model can be found in the library project Filtering of Noise Pulses. The resistor R
and capacitor C are used as a high frequency lter of noise transmitted to the load
resistor RL [6].
Signal noise is simulated by a voltage source that generates a rectangular pulse
train with the following parameters: TD = 5 ns, TF = TR = 0, TW = 2 ns,
PER = 10 ns, E1 = 5 V and E2 = 6 V. The pulse is dened by
e t\TD?E1 : t TD%PER\TF PW TR?E2 : E1
7:14
The resistors are as in Fig. 7.20, with the resistance of the lter resistor R = 75
ohm and that of the load RL = 10 kohm. The capacitor includes the parasitic
inductance and resistance, and neglects the leakage (Fig. 7.24). The capacitance
C is 1.5 mF. It initially is charged to 7.44417 mF, which corresponds to 4.96278 V.
The voltages generated by the source and across the load resistor are measured by
the voltmeters and fed to the plotter. Because they are in the same range, the source
voltage is displaced by 2.5 V using a summator s and a signal generator IN.
Two simulations were run. In the rst, the parasitic resistance and inductance of
the capacitor were set to zero. The simulation interval was set to 50 ns and the
output interval was a relatively short 10 ps, the better to display the transients
277
during the short pulse (2 ns). The results (Fig. 7.38) show that the ideal capacitor
efciently removes the noise.
In another simulation the parasitic parameters of the capacitor were set to
LC = 10 pH and RC = 0.001 ohm. Simulation parameters were as in the previous
run.
The results in Fig. 7.39 show the sharp peaks at the rear and the front edges of
the pulses. This is to be expected, as the Fourier transform of a pulse contains all
frequencies (Fig. 6.32). Hence, they surely will excite the higher frequency modes
of the capacitor.
7.3.4.3
Dependent Sources
Dependent sources are often used to describe the dependence of the voltages or
currents supplied by the sources on the other voltages or currents in an electrical
circuit. Electric circuit design tools like SPICE dene four types of such sources:
voltage- and current-controlled voltage sources, and voltage- and current-controlled
current sources. We dont need such special devices, because we can use the
independent sources of the previous section, to which we add the control ports
(Fig. 7.40). These are a direct extension of the controlled components discussed in
Sect. 2.5.8.
These models are similar to those of ordinary sources. We need only to add a
control port to the corresponding source effort or source flow bond graph
278
7 Electrical Systems
Fig. 7.40 The bond graph representation of controlled sources: a the voltage source b the current
source
279
ekc
7:15
7.3.5
Switches
Switches are components often found in electrical circuits. A typical circuit symbol
used for switches is shown in Fig. 7.42a. We represent electrical switches by the
component given in Fig. 7.42b.
A switch toggles between an open position, in which there is no electrical
connection between its terminals; and a closed position, in which the terminals are
short-circuited. In SPICE, the switch is modelled as a controlled resistor that toggles
between a high resistance value ROFF and a low resistance RON, depending on the
value of the control input. Thus, a controlled resistor can be used to model a switch
(Fig. 7.43).
The logic of the switch can be described as
c\EON?e ROFF i : RON i
Fig. 7.42 The switch: a the circuit symbol, b the bond graph representation
7:16
280
7 Electrical Systems
c is the control signal, e is the voltage across the switch, and i is the current
flowing through it. EON is the value of the voltage when switching occurs.
The constitutive relation can also be dened in such a way that there is a
continuous transition from the low to the high resistance, e.g.
c\EON EW ? e ROFF i :
c\EON ? RON ROFF RON=EW c EON i : RON i
7:17
The parameter EW is the width of the zone where the transition between the open
and closed switching occurs.
The (7.16) describes a switch that is initially open, i.e. when there is no signal. It
is easy to dene a switch that is initially closed, e.g.
c\ EON?e RON i : ROFF i
7:18
Switches are sometimes used to model logical gates. Figure 7.44 shows a circuit
for simulating an OR logical gate. The circuit model can be found in the library
projects under the name OR Gate Test Circuit.
As BondSim currently has no predened symbol for the logical gates, a device
symbol can be used. Inputs to the gate are generated by the two voltage sources
connected to the ground through 1 kohm resistors. The sources generate voltage
pulses according to (7.12) (with TD = 0). The parameters of the pulse are given in
Table 7.1. The input signals to the gate are taken from the nodes between the
voltage sources and the resistors. These are fed to the input ports of the gate. The
gate is supplied from a separate 5 V source. The IN input components displace the
inputs of the gate for the better displaying.
Figure 7.45 shows a model of the OR gate implemented using the ideal switches.
The switches are connected to the ground port by a 1 kohm resistor. The switching
logic of the OR gate switches are dened by (7.16), with EON = 2.5 V,
RON = 1 ohm and ROFF = 1 Mohm.
281
IN
IN
VS
R
VS
VS
OR
Parameters
Input 1
Input 2
PER (ns)
TF (ns)
TR (ns)
PW (ns)
E1 (V)
E2 (V)
50
10
10
10
0.0
3.0
100
10
10
20
0.0
3.0
When the model is built, a warning appears informing the user that the model is
purely algebraic, i.e. without derivatives. It is, however, acceptable to the numerical
solver, so we proceed with the simulation. The results of a simulation run for 200 ns
with an output interval of 100 ps are shown in Fig. 7.46.
282
7 Electrical Systems
The models of logical gates based on the switches offer an idealized picture of
the real devices. They are sometimes useful for representing gates in a simple way;
but they often create problems for the simulators. The logical gates are usually built
with transistors. Because these introduce some delays, the switching behaviour of
the real gates is often slightly different from that predicted by the idealised models.
7.4
In this section modelling of the semiconductor devices from the point of view of
bond graphs and component models is described. Numerous books have been
written on the modelling of the semiconductors and, in particular, on their SPICE
models. Thus, we do not discuss this matter more than necessary, but describe some
of the basic bond graph models. The interested reader can consult the literature for
details, for example [1, 7, 9, 10].
In the last section it was shown that it is relatively easy to describe SPICE
models by bond graphs. The same is true for semiconductors. But it is also possible
to use the bond graph to develop models that can take care of effects that are not
easy to implement in programs like SPICE, such as thermal effects. The component
model approach of this book, supported by the language used for the description of
the underlying physical relations, offers a good basis for developing such models.
We start by developing suitable models of diodes with their bond graph representation. Then, three of the main types of transistors are considered: the Bipolar
Junction Transistor (BJT), the Junction Field Effect Transistor (JFET), and the
283
Metal Oxide Field Effect Transistor (MOSFET). The models developed correspond
to SPICE large signal level 1 models. More complex models can be developed in a
similar way. The component model approach is shown to be a powerful method for
modelling the semiconductors.
7.4.1
Diodes
7.4.1.1
Static Model
We start with diodes, which are fundamental to the functioning of practically all
semiconductors. The electrical circuit symbol used for the diode is shown in
Fig. 7.47a. The bond graph component model of a diode is quite similar in
appearance and is shown in Fig. 7.47b.
The diodes are the resistive components described by a non-linear constitutive
relation
id Is eed =VT 1
7:19
7:20
7:21
When the voltage across the diode is less than or equal to zero and the same is
true for the current through the diode, the ports are disconnected and there is no
current through the diode. Otherwise, its ports are short-circuited and the voltage
across the diode is zero.
Fig. 7.47 The diode: a the circuit symbol, b the bond graph representation
284
7 Electrical Systems
The simplied models of the diodes as switches are of a limited value, as they do
not show some of their important features, such as the voltage drop. This could be
included in the model, of course, but at the cost of increased complexity. From the
numerical point of view, they are less convenient than resistor models. This is
because they model the diode by discontinuous algebraic constraints on the voltages across diodes or currents through them.
Experience shows that there is a departure of the behaviour of the real diodes
from the ideal law given by (7.19). This occurs over the greater part of the forward
and reverse regions, as illustrated in Fig. 7.49 (see e.g. [7] for a detailed explanation). To account for such departures, SPICE models diodes as the current
sources with non-linear diode characteristics and a series resistor. The non-linear
characteristic is similar to (7.20), but introduces the emission constant n in the
exponent
285
id Is e^ed =nVT 1
7:22
The default value of this parameter is 1, which corresponds to the ideal diode,
but can be in the range 0.73 for the real diodes. This coefcient describes the
departure of the diode at a low forward bias. The series resistor, on the other hand,
describes the departure at a high forward bias. The voltage ^ed appearing in (7.22) is
the effective voltage, equal to the voltage across the diode terminals less the voltage
drop across the series resistor, i.e.
^ed ed Rs id
7:23
We follow the same approach but, instead of the current source, a non-linear
resistive element Rd is used (Fig. 7.50). The series resistor effect is modelled by a
resistive element R added to the resistor effort junction. In this way, the non-linear
resistive element effort variable is the effective diode voltage, as given by (7.23).
The constitutive relation of the non-linear resistive element is given by (7.22)
id IS exped=N VT 1
7:24
The saturation current IS, the thermal voltage VT and the emission constants N
are parameters of the model. These parameters can be dened at the diode document level by the default values similar to that of SPICE. These values can be
overridden inside the resistive element.
In the reverse bias region the diode current is practically equal to the saturation
current. Some diodes show a stronger dependence on the reverse voltage. This can
be taken into account by modelling the diode characteristics separately for the
forward voltages, as per (7.24); and using a similar expression, but with a different
emission parameter, for the reverse region.
One point that remains to be addressed is the reverse diode breakdown. This
occurs when the reverse voltage reaches some specic value Vb (Fig. 7.49). The
reverse current then suddenly increases to very high values. The process is not
286
7 Electrical Systems
necessarily destructive but, owing to the high power dissipated in the diode, it is
often critical to its useful life. We describe diode breakdown using a similar
approach as in SPICE [4, 6, 7]. The diode characteristics in the breakdown region
can be described by
id IS e BV0 ^ed =VT
7:25
When the voltage is less than BV0 the current starts rising without bound. This
critical value is found from the specication of the breakage voltage value BV and
the corresponding current IBV, i.e.
IBV IS e BV0BV=VT
7:26
Solving, we get
BV0 BV VT ln
IBV
IS
7:27
BV0 is found once the breakdown point, dened by BV and IBV, is known. The
shape of the function in (7.25) ensures a smooth transition from the characteristics
given by (7.22) at the breakdown.
Taken together, the constitutive relation of the resistive element of Fig. 7.50 can
be described as
id ed [ BV0 ? IS exped=N VT 1 :
IS expBV0 ed=VT
7:28
When applying such a relationship for the simulation of diode behaviour, a few
points of caution should be noted. One of these relates to the behaviour of the
exponential term at high voltages. If the series resistance is zero, then the entire
voltage drop occurs across the diode resistive element. Owing to the exponential
character of the diode behaviour, the current through the diode could be very high.
Such a diode would surely melt down. Thus, the series resistor is an essential guard
against this possibility.
Because of the nite precision of floating-point arithmetic, there may be overflow during the numerical calculation. The order of the maximum number that can
be represented in double-precision mode typically is 10308. Thus, the maximum
value of the exponential term before overflow is about 709, or a voltage across the
diode of about 18 V. To prevent this from occurring, it is possible to approximate
the exponential function for high values of exponents by a linear function, e.g.
ed/(N VT) [ MEXP?
IS exp(MEXP) 1 ed/(N VT) MEXP) 1 :
IS exped=N VT 1
7:29
287
The MEXP parameter is set at 50, but can be changed. It is possible, of course,
to limit high currents by using a series resistance [4].
Another important issue is the low conductance at reverse biases, as the exponential term in (7.22) very quickly becomes almost zero. This may cause problems
during simulation because the partial derivative matrix of the system equations can
become badly conditioned. To remedy this, the approach employed in SPICE is
used; that is, to add to (7.29) a constant conduction term of the form GMIN * ed,
where is GMIN is very low, e.g. 1012. This term will not change the diode
behaviour appreciably, but can help to solve this problem. The constitutive relation
of (7.28) now reads
id ed [ BV0 ? IS exped=N VT 1 GMIN ed :
IS expBV0 ed=VT GMIN ed
7:30
It is set to DBL_MAX.
288
Table 7.2 Model parameters
of the diode in Fig. 7.51
7 Electrical Systems
Parameter
Value
IS
RS
N
VT
BV0
46.5 1012 A
0.123 ohm
1.35
0.0255 V
BG_MAX
In the second experiment the simulation interval is set to 0.100 s, i.e. ve periods
of the voltage. Figure 7.53 shows the current in the circuit. During the rst half-of
the period (0.010 s) the current through the resistor reaches its maximum 0.491 A.
When the voltage changes its polarity, the diode becomes reverse biased and there
is an extremely low current through the circuit.
To analyse the behaviour of the circuit when the diode breakdown occurs, the
VB0 was set to 40 V and the simulation repeated. Figure 7.54 shows a plot of the
diode current. During the breakdown there is an appreciable reverse current through
the diode (0.0944 A).
It should be noted that the program failed when the diode breakdown characteristics were described according (7.30). When the breakdown voltage was
reached, there was an error message indicating that the program failed to evaluate
the partial derivative matrix. To cure the problem, the exponential term was
changed as given by (7.29).
289
7.4.1.2
Dynamical Model
The model developed so far is quasi-static. Such a model, from the perspective of
the dynamical applications, would be innitely fast. This is not the case in real
diodes, as the charge-storage effects limit the velocity of the response. To account
for the dynamical effects, we take a similar approach as in the circuit simulators
such as SPICE [4, 7]. Our approach is charge-based, however.
290
7 Electrical Systems
There are two mechanisms of charge storage in diodes: the charges stored in the
depletion layer and the charges injected across the layer into neutral regions. The
depletion region is an area between n-type and p-type regions. Under no bias
voltage, the depletion region consists of the xed dopant ions, and acts as an
isolator. This layer behaves as a plate capacitor of capacitance Cj0 . Under negative
bias (and under positive bias that is less than the built-in potential), the width of this
layer changes, as does the capacitance. We use the charge formulation of such
capacitor effects instead of the more common capacitance formulation.
The charge of the depletion region can be expressed as a function of the applied
voltage using the formula
Qj
i
CJ0 VJ h
1 1 ed =VJ1M
1M
7:31
where CJ0, VJ and M are the zero-bias capacitance, built-in potential and grading
coefcient, respectively. The last coefcient can have a value between 0.5 for an
abrupt, and 0.33 for the linearly graded, junction. The corresponding capacitance is
given by
Cj @Qj =@ed
7:32
CJ0
1 ed =VJM
7:33
The junction charge and capacitance functions, as given by (7.31) and (7.33), are
only approximate and agree with the more exact values at voltages less than about
VJ/2 [7]. At a voltage equal to the built-in potential, the capacitance is innite. At
such high bias the charges generated by the injection dominate. Thus, it is usually
assumed that some error in the charge and the capacitance near the built-in voltage
is acceptable. If better accuracy is required, the formula of [11] can be used. We
note that, in spite of the fact that we are only interested in the charges, the
capacitances naturally appear when the program calculates the partial derivatives of
(7.31) by symbolic differentiation. We thus must take care of the behaviour of the
capacitances, as well.
We follow the approach in [7] that approximates junction charges by (7.31) up to
FC VJ, and employs quadratic interpolation beyond. The corresponding formula
reads
Qj
i
CJ0 VJ h
1 1 ed =VJ1M ; ed \FC VJ
1M
7:34
291
and
VJ
1
1 1 FC1 M
ed FC VJ
1M
1 FCM
M
e FC VJ2 ; ed FC VJ
M 1 d
2VJ1 FC
Qj CJ0
7:35
7:36
where VJ is the built-in potential, CJO the initial junction capacitance value, and
F1 1 1 FC^ 1 M=1 M
F2 1 FC^ M
7:37
^
F3 0:5 M 1 FC 1 M
The FC typically has a value of 0.5.
The minority-carrier charges injected into the neutral sections also influence the
diode dynamics. These are termed the diffusion charges [4, 7] and are given by
Qd TT id
7:38
where TT is the average transit time parameter of the diode. This large minority
charge current occurs for only a short period of time, until access carriers in n- and
p-type sides are exhausted. The accumulation of the diffusion charges can be
represented by a capacitive element Cd in parallel with the junction charges
capacitor Cj, as shown in Fig. 7.55.
292
7 Electrical Systems
Parameter
Name
Value
Zero-biased capacitance
Grading coefcient
Junction potential
Transit time
CJ0
M
VJ
TT
51.5 1012 C
0.333
0.381
5.77 106 s
The constitutive relation for the charge is given by (7.24) and (7.38)
q TT IS exped=N VT 1
7:39
293
dominated by the storage delay time. The value found by the simulation is 3.96 s,
which agrees well with these gures. It can be checked (by opening the diode
voltage plot) that the diode voltage is 0.8 V until the charges are removed.
7.4.1.3
Diode Self-heating
294
7 Electrical Systems
7:40
where e and i are the voltage and current, respectively, at the electrical ports. The
heat flow is equal to the input power.
The temperature at the port is dened relative to the nominal temperature
TNOM. Thus, the absolute (thermodynamic) temperature is
T temp TNOM
7:41
The program is designed to start from the state in which the system is not yet
activated; hence, all variables, with the possible exception of certain state variables,
are zero. Regarding temperature, we assume that the system is not at absolute zero,
but has some predened value TNOM, which is taken equal to 300 K.
295
The temperature at a thermal port affects the processes at electrical ports. In the
diode resistive element this is through the thermal voltage dened by (7.20). Thus,
we change the constitutive relation (7.24), replacing the thermal voltage parameter
VT by the expression BOLTZMANN (temp + TNOM)/ECHARGE, where the
electron charge and Boltzmanns constants are globally dened (Sect. 4.8.2):
ECHARGE 1:6022 1019 C
BOLTZMANN 1:3806 1023 J K1
Practically all the diode parameters depend on temperature [7]. Temperature
dependence of the saturation current is given by
qEg T0
T
is(T) isT0 XTI=n e nkT 1 T=T0
T0
7:42
where T0 is the nominal temperature and XTI is a parameter that has a value 3 (for
pn diodes); Eg(T0), the energy gap at nominal temperature, is dened (for Si) by the
parameter EGNOM = 1.115 V.
We describe the right side of the above equation as
IS 1 temp/TNOM)^ XTI/N) exp(ECHARGE EGNOM
temp/TNOM)/(N BOLTZMANN temp TNOM)))
7:43
296
7 Electrical Systems
T1 T2 T 0
fQ fQT
7:44
i.e. the heat flow is a function of temperature. In the linear case, the constitutive
relation of the element, is simply
fQ T=R
7:45
7:46
7:47
The parameter C is the thermal capacitance and has units of J/K. Strictly
speaking, it corresponds to specic heat at constant volume. But in solids and
liquids, including semiconductor materials, the work done by the expansion of the
material is very small compared to the net heat inflow fQ; hence it is usually
referred to simply as the materials specic heat. (7.47) is the constitutive relation of
the thermal capacitive element in Fig. 7.59b.
The Self heating component of the diode can be represented by the RC bond
graph in Fig. 7.60. The resistive element represents heat that flows due to the
temperature gradient between the junction and the diodes outside surface. A part of
this heat is accumulated in the diode. This is represented by the capacitive element.
The diode thermal port is normally connected to the components that model the
diode environment. This is usually the heat sink that removes heat from the diode,
ensuring that its temperature is held within the acceptable margins (Fig. 7.61). The
other side of the sink is usually at ambient temperature, here represented by a SE
component. Thermal models of such sinks can be represented in a similar way using
a RC bond graph.
297
Heat sinks are usually made of extruded aluminium and for which the manufacturers provide the thermal data, such as the thermal resistance, volume, and
material. The complete thermal models also should include the resistance of the
heat path to the sink, which depends on the design of the semiconductor components. A component is usually enclosed in a case, and between the case and the heat
sink there is some layer of isolation. The thermal model of the diode and heat sink,
as shown in Fig. 7.61, is a simplied one. For proper thermal modelling, details of
the design should be taken into account. Detailed models usually consist of several
RC segments connected in series [14].
To illustrate the application of models of the diode, including the self-heating,
we return to the rectier circuit of Fig. 7.51. We replace the diode model with its
thermal model (Fig. 7.62). Information on the diode temperature is taken from the
heat flow junction (Fig. 7.58) and sent to the display component. The corresponding
project can be accessed from the BondSim project library under the title Rectier
circuit with self-heating.
We simulate the temperature rise in the diode following a sudden voltage change
from 0 to 50 V. Parameters of the diode thermal model and of the heat sink are
given in Table 7.4. The other side of the sink is held at nominal temperature. These
parameter values have been chosen to illustrate the behaviour of the diode under
298
7 Electrical Systems
Parameter
Value
0.1 K/W
0.0001 J/K
10 K/W
0.01 J/K
changing temperature conditions; real values could be derived from, for example,
the cooling tests of the real devices. Simulation results are presented in Fig. 7.63.
7.4.2
Transistors
The bipolar junction transistor was invented by Bardeen, Brattain, and Shockley in
1947 while working at Bell Laboratories. Rightly considered to be one of the
greatest inventions of our time, it earned them the Nobel Prize in physics in 1956.
For a long time after its invention the BJT remained one of most important
three-terminal devices. It is found in ampliers and drivers and, even today, serves
as one of the most important devices in a wide array of applications.
The eld effect transistor (FET) emerged shortly after appearance of the BJT.3 In
fact, many different types of FETs were developed, their difference depending upon
how isolation between the gate and channel was implemented. These include the
FET was patented in 1925 by Julius Edgar Lilienfeld in Canada. However, Lilienfeld did not
publish any research articles about the device. The production of high-quality semiconductor
material was decades away. MOSFET was invented by Dawon Kahng and John Atalla at Bell Labs
in 1959.
299
7.4.2.1
300
7 Electrical Systems
Fig. 7.64 npn BJT: a the circuit symbol, b the bond graph representation
Fig. 7.65 pnp BJT: a the circuit symbol, b the bond graph representation
301
7:48
7:49
where Is, bR and bF are the transistor saturation current, reverse and forward current
gains, respectively. The current source represents the transport of charges given by
ICT bF IdBE bR IdBC IseeBE =nF VT eeBC =nR VT
7:50
302
7 Electrical Systems
303
Symbol
Name
Value
Saturation current
Thermal voltage
Reverse gain
Forward gain
Base resistance
Collector resistance
Emitter resistance
Is
VT
R
F
Rb
Rc
Re
IS
VT
BR
BF
RB
RC
RE
1016 A
0.0258 V
1
80
5 ohm
1 ohm
0.01 ohm
Name
Value
CJ0
VJ
m
FC
TT
0.0 F
0.75 V
0.333
0.5
0.0 s
In the display object (Fig. 7.69) we assign the collector current to the y-axis and
label it as Ic, and the voltage to the x-axis and label it as VCE. During the simulation
the outputs are normally stored in, and plotted by, the plotter object. To have a
family of curves plotted on the same plot, we must perform several simulation runs
and store all the resulting values in the same object, then plot them. This can be
done relatively simply.
We start, for example, with a base current of 10 A, build the model, and run the
simulation for 0.1 s. We select the output and maximum interval to be 0.0001 s.
Next, we change the current value to 0 A. We need not rebuild the model, as it is
304
7 Electrical Systems
updated automatically when we click the OK button after changing the current. We
then rerun the simulation, but in the Simulation Option dialogue (Fig. 7.70) we
select the Restart button and uncheck the Reset plot check box. The rst option
forces the simulation to restart from zero; the second prevents release of the data
from the previous run. We generate transistor characteristics for base currents up to
50 A.
The resulting graph is shown in Fig, 7.71. In the graph the curves are labelled by
the value of the base current in A, which are added using the right mouse button as
explained in Sect. 7.2. The diagram shows the familiar emitter characteristics for
different values of the base current. Because of different current gains for the
forward and reverse diodes (801), they are asymmetrical. When the base current is
50 A the corresponding collector current is 4 mA. This is in accordance with the
forward current gain of 80.
The pnp BJT is similar to the npn type with holes replacing the roles of the
electrons. Thus, the directions of currents and polarities of the voltages across the
emitter, base, and collector are opposite to that of the npn BJT. The corresponding
component representation already has been discussed (Fig. 7.65); its model is
developed in a similar way.
We can also create a model of the pnp BJT directly by using a copy of the
corresponding npn model. Starting with the npn BJT (Fig. 7.65b), we select the
component and change the sense of all ports by the Change Ports All toolbar button
(or by the corresponding command in the Edit menu). This changes the external
ports of the component and also the ports of all components inside its document that
are connected to them, i.e. ports of resistors Rb, Rc, and Re (Fig. 7.66).
We also need to change the power-flow direction of the ports on the other side of
the resistors. Next, we select the diodes and the current source and change power
directions of all their ports. A model of a pnp BJT can be found in BondSims
305
Component Library. The pnp Transistor Characteristics project parallels the npn
transistor project discussed above and is also found in the BondSim projects library.
7.4.2.2
306
7 Electrical Systems
Fig. 7.72 n-channel JFET: a the circuit symbol, b the bond graph representation
Fig. 7.73 p-channel JFET: a the circuit symbol, b the bond graph representation
reversing the power flow direction of all ports. This can be done by selecting the
component and using the command Change Ports All.
It is also possible to change only the gate port. In this case, the drain and the
source of the p-channel JFET change places with respect to the n-channel JFET.
The n-channel and p-channel JFETs differ in the sense of the gate port power flow.
The drain of the n-channel component is a port where the power flows in; for the
p-channel, the power flows out. For the sources, the opposite is true.
The direction of power flow through JFETs is taken to correspond to the normal
mode operation in which the drain of the n-channel device is at a higher potential
with respect to the source. Thus, electrical power flows in at the drain and flows out
at the source. The power flow direction in the p-channel JFETs is just the opposite.
The source is normally at a higher potential, so the current flows from the source to
the drain.
We develop the model of the n-channel JFET (Fig. 7.74) that consists of the two
diodes, DS and DD, which model the reverse-biased junctions between the gate and
the channel, and the voltage-controlled resistor. The resistors RD and RS represent
the ohmic resistances of the drain and source. This model corresponds to the
large-signal SPICE model with the controlled resistor R replacing the dependent
current source [4]. The constitutive relation of the resistor is given by [4]
307
iDS
8
< 0; eGS VT0 0
BETA eDS 2eGS VTO) eDS 1 LAMBDA eDS ; 0\eDS \eGS VT0
:
BETA eGS VTO)2 1 LAMBDA eDS ; eDS eGS VT0 [ 0
7:51
The VT0 parameter is the threshold (pinch-off) voltage. This determines the gate
bias at which the channel is completely pinched-off and there is effectively no
current through the device [4, 9]. If VT0 < 0, then at eGS = 0 the device is in the on
condition and, under a positive drain to source voltage, current will flow from drain
to source. To cut off the device it is necessary to apply a negative gate to the source
voltage. Such device operation is known as the depletion mode. In the enhanced
mode VT0 > 0, the device is pinched-off initially and it is necessary to apply a
positive voltage larger than the threshold to enable the device to conduct the current. The parameter BETA is a trans-conductance parameter, and LAMBDA is the
output conductance at saturation.
Equation (7.51) shows that at a relatively small drain-to-source voltage eDS the
current increases with the voltage until the saturation voltage (equal to eGS VT0)
is reached. This region is called the linear region of the operation. When the
drain-to-source voltage increases above the saturation voltage, the drain-source
current is practically independent of the voltage and the device is saturated.
There is an additional current component due to the pn junction current, characterized by saturation current IS. The gate pn junctions are reverse biased, and thus
the pn junction current is negligible.
The diode models consist of a non-linear resistor and a capacitor (Fig. 7.75).
Because in JFETs the diodes normally are reverse-biased, there is no diffusion
charge. Hence, the charges consist of xed ions in the depletion region and are
represented by a junction capacitor. Following (7.31) the charge of the depletion
region can be expressed as a function of the applied voltage using the formula
308
7 Electrical Systems
i
CGS PB h
1 1 eGS =PB1M
1M
i
CGD PB h
1 1 eGD =PB1M
1M
QjDS
QjDD
7:52
309
to create the gate-to-source voltage eGS a 0-junction is inserted, the junction variable of which is the source potential. A summator is used to evaluate the difference
of these two potentials eGS, and its output is connected to the resistive element
control-input port.
The constitutive relation (7.51) is valid for drain-to-source voltage eDS 0. This
corresponds to the normal mode of operation. In the inverted mode (eDS < 0), the
drain and source ports switch roles and the current flows in the opposite direction.
The corresponding constitutive relation is the symmetric [4, 7]. Thus, instead of the
eGS voltage, the eGD voltage is used in (7.51). Similarly, eDS is changed to eDS and
the sign of the current is changed.
As was the case with the BJT, we can nd the iDS-eDS characteristics of a JFET
by simulation. For this purpose we create a project n-Channel JFET
Characteristics, the system level model of which is given in Fig. 7.77.
The drain of the JFET is supplied from the voltage source VD generating voltage
ramp 05 V. The gate port is connected to a separate voltage source. The source of
the JFET is grounded. We measure the voltage across the drain and source ports by
the voltmeter V and the current through the component by ammeter A. The
instruments outputs are fed to the plotter for display. The JFET parameters correspond to the 2N4416 JFET of reference [6] and are given in Table 7.7.
To generate the iDS-eDS characteristics of the JFET, several simulations were run
with constant gate voltage ranging from 0 to 3.32 V. The simulation interval was
set to 1 s, which corresponds to increasing the drain-to-source voltage from 0 to
5 V. The output interval was 0.001 s. The outputs of each simulation run are stored
in the display component. The results are given in Fig. 7.78.
The transistor is in the depletion mode. As the gate bias becomes negative,
conduction of the transistor drops and, at voltage of 3.32 V, is completely
pinched-off. The curves also show a linear region in which the source voltage
increases with the drain-to-source voltage; and the saturation region in which the
current is independent of the drain-to-source voltage.
The discussion so far has been for n-channel devices, but a similar discussion is
valid for p-channel devices. In p-channel devices all voltage and current polarities,
310
Table 7.7 Basic 2N4416
JFET parameters [6]
7 Electrical Systems
Parameter
Name
Value
VT0
BETA
LAMBDA
3.32 V
0.05 A/V2
0.00928 1/V
RS
RD
IS
PB
CGS
0.575 ohm
0.575 ohm
5 1012 A
0.76 V
3.37 pF
CGD
3.37 pF
including the threshold voltage and the directions of two gate junctions are reversed
[7]. Likewise, greater-than and less-than relations must be reversed. We retain,
however, the same constitutive relation as that used for the n-channel device:
Instead of terminal voltages eGS and eDS, we use reverse voltages eSG and eSD.
Similarly, VT0 is now the negative of the threshold voltage.
Thus, a positive value of VT0 corresponds to a device that is offin the enhanced modefor both n-channel and p-channel devices. Similarly, the negative
value corresponds to a depletion mode device, which is initially on, for both
n-channel and p-channel devices. The change in the polarity of the voltages across
the terminals and of the direction of the current is taken care of by a change in the
power flow direction through the p-channel device (Figs. 7.74 and 7.75).
311
The model of the p-channel JFET is similar to the n-channel model of Figs. 7.74,
7.75 and 7.76, but with direction of the power flow between the external ports
reversed. The change of the power flow direction should be applied only to the
bonds through which power is transferred between the external ports. The others are
not affected, e.g. the power flow direction of the non-linear resistive element and of
the capacitive element of the diode model in Fig. 7.75, as well as that of the
controlled resistive element of the resistor in Fig. 7.76. These are the same for both
n-channel and p-channel devices. In addition, we need to change the signs of the
summator inputs of Fig. 7.76, because these components are used to evaluate Vgs,
the voltage used in (7.51).
This way, the p-channel JFET model can be created from the n-channel model
by changing the port power flow directions. This is done by using the Change Ports
All command for all component ports, or the Change Port command for a particular
port, then changing the summator input signs.
7.4.2.3
312
7 Electrical Systems
Fig. 7.79 n-channel MOSFET: a the circuit symbol, b the bond graph representation
Fig. 7.80 P-channel MOSFET. a the circuit symbol, b the bond graph representation
a label used for the reference to the component and can be changed at this stage or
later. The p-channel component can be created from an n-channel component by
reversing the power flow direction of all ports. It is also possible to change only the
base and bulk ports. In this case, the drain and source of the n-channel MOSFET
effectively change places.
The n-channel MOSFET model (Fig. 7.81) is dynamic and corresponds to the
Level 1 large-signal SPICE model. We use a controlled resistor to describe the
static characteristics of NMOS, as we did in the JFET case. The constitutive relation
of the resistor is dened by relation [4, 7]
iDS
8
< 0; eGS VTH 0
0:5KP eDS 2eGS VTH) eDS 1 LAMBDA eDS ; 0\eDS \eGS VTH
:
0:5KP eGS VTH)2 1 LAMBDA eDS ; eDS eGS VTH [ 0
7:53
where KP is the effective transconductance (scaled by the ratio of the device width
and effective length). VTH is the threshold voltage in the presence of back-gate
bias, eBS < 0,
p p
VTH VT0 GAMA PHI eBS PHI
7:54
VTO, GAMMA, PHI and LAMBDA are the threshold voltage, bulk threshold
parameter, surface potential, and output conductance factor in saturation,
respectively.
313
In MOSFET there is no direct resistive current path between the gate and either
the drain or source because of the oxide isolation layer. There is charge accumulation, however, that is modelled by capacitors CGD and CGS, between the gate and
the drain and the gate and the source, respectively. In a rst-order analysis these can
be described by the constant capacitances. The capacitance between gate and body
is neglected.
There also are junctions between the body, the source, and the drain that are
represented by diodes (Fig. 7.81). These junctions are reverse-biased. We use the
same model of the diodes as in JFET (Fig. 7.75, (7.52)). The capacitances Cj in that
model describe the accumulation of the junction charges.
The discussion regarding direct and reverse operation of JFET applies here, as
well. Thus, eGS in (7.53) is replaced by eGD, eBS is replaced by eBD, eDS is changed
to eDS, and the sign of the current is changed.
The same model applies to PMOSs. The direction of power transfer trough the
component, however, is opposite to that of NMOS. Thus, the PMOS model can be
created from the NMOS model in the same way as discussed for JFETs. The body
port of the PMOS should, however, be connected to the port of higher potential in
order that the body junction be the reverse-biased, to the drain for direct operation,
and to the source for the reverse.
As a rst application of the MOS model developed, we create a project named
NMOS Characteristics that simulates the iDS-eds characteristics of an n-channel
MOSFET. The corresponding system-level model is given in Fig. 7.82. The project
314
7 Electrical Systems
is similar to that of the evaluation of the JFET characteristics (Fig. 7.77). The drain
junction of the NMOS is set at 05 V by the voltage source VD. Its gate port is
connected to a separate voltage source VG.
Because ports of the same component cannot be directly interconnected, a
separate branch node is inserted and is used to connect the NMOS source and body
ports. The node is grounded. There are also instruments for measuring the gate and
drain voltages and drain-source current. The outputs of these instruments are fed to
a plotter for display. The NMOS parameters used for simulation are given in
Table 7.8.
Several simulations were run with different values of the gate voltage 410 V to
generate the iDS-eDS characteristics. The simulation interval was set to 1 s, with the
output interval 0.001 s. Note that the transistor threshold voltage VT0 = 3.5 V
(Table 7.8); hence, this is an enhanced mode NMOS and to conduct the current the
gate bias must be greater than 3.5 V.
The results (Fig. 7.83) show a linear region in which the source voltage increases
with drain-to-source voltage; and the saturation region in which the current is
constant. According to (7.52) the linear range ends up at the value of the
drain-to-source voltage eDS eGS VTH eGS 3:5 V.
The program library also contains a project PMOS Characteristics that the
reader is invited to analyse on his own.
We conclude this section with the analysis of the basic CMOS inverter
(Fig. 7.84). It consists of a PMOS and a NMOS transistor, the drains of which are
connected through a common node. The PMOS is supplied by a 5 V source; the
source of the NMOS is grounded. The input voltage is applied to both transistors
and the voltage is taken from the common node.
The parameters of the inverter are given in Table 7.9. Note that the threshold
voltage of both transistors is 1 V; hence, they are in the enhanced mode.
315
Parameter
Name
Value
VT0
KP
LAMBDA
3.50 V
0.001 A/V2
0.01 1/V
GAMMA
PHI
RS
RD
IS
PB
M
FC
0.0 V
0.6 V
10 ohm
10 ohm
1 1014 A
1V
0.5
0.5
N
CBS
1
5 pF
CBD
5 pF
CGD
CGS
1 pF
1 pF
316
7 Electrical Systems
Name
Value (PMOS/NMOS)
VT0
KP
LAMBDA
GAMMA
PHI
RS
RD
IS
PB
M
FC
N
CBS
CBD
CGD
CGS
1V
80 A/V2
0.0 l/V
0.0 V
0.6 V
1 ohm
1 ohm
1 1014 A
0.75 V
0.5
0.5
1
5 pF
5 pF
8 pF/4 pF
8 pF/4 pF
317
7:55
where V0 = V1 = 2.5 V and f = 20 MHz. The simulation was run for 100 ns with an
output interval of 100 ps for better resolution. The results are shown in Fig. 7.85.
When the input is low, e.g. equal to 0 V, the source-gate voltage of the PMOS is
5 V and is on (conducting). The NMOS, however, is off because its gate-source
voltage is equal to 0 V, below the threshold. The current through both the transistors thus is zero. From the static characteristics of the PMOS it follows that the
voltage between the source and drain must equal to zero. Thus, the inverter output
is equal to the PMOS source port voltage, which is 5 V. On the other hand, when
the gate voltage is high, e.g. equal to 5 V, the PMOS is off and current through the
transistors is zero. But now the NMOS is on. This means that its drain-source
voltage is 0 V. Because the source port of the NMOS is grounded, the inverter
output is also 0 V. Thus, the inverter generates high voltage (5 V) when its input is
low (0 V), and low voltage (0 V) when its input is high (5 V).
7.4.3
Operational Ampliers
318
7 Electrical Systems
Fig. 7.86 Operational amplier. a The circuit symbol. b The bond graph representation
7:56
319
The power delivered at the operational amplier output port is much larger than
at the input. The excess power comes from voltage sources that supply the power to
the op-amp through the supply terminals.
The voltage generated at the output port cannot rise above the voltages at these
terminals. The supply terminals are not shown in the simple op-amp model of
Figs. 7.86 and 7.87. However, we can take care of the limitation on the output
voltage by dening the source effort in Fig. 7.87 as
eo GAIN ediff \ VLIMIT? VLIMIT :
GAIN ediff \VLIMIT? GAIN ediff : VLIMIT
7:57
where GAIN is the static gain of the op-amp and VLIMIT is the maximum value of
the output voltage. This usually is 12 V less than the supply voltage.
We now simulate the characteristics of the operational amplier dened by the
models in Figs. 7.86 and 7.87 and (7.57). As usual, we create a project named Ideal
Op-amp Characteristics and dene the model of a set-up for simulating the static
characteristics of the Opamp, as shown in Fig. 7.88.
The gain of the opamp is set to 1 105 and the output is limited to 4.5 V. The
op-amp is driven by the source voltage VS connected to the inverting port by a
node. The source generates a sinusoidal voltage. The non-inverting port is grounded. The op-amp output port is connected to ground across a 1 kohm resistor. The
output voltage reaches the limiting value at an input of 4.5 105 V. To show the
characteristics more clearly, we drive the op-amp with a low input voltage with
amplitude of 5 104 V and frequency of 1 Hz. The frequency is not critical, as the
op-amp model is static. To display the transition from the region of linear behaviour
to saturation correctly, we must use a fairly small output interval, e.g. 0.001 s or
less.
The results of the simulation are shown in Fig. 7.89, which shows that the input
and output voltages are of the opposite sign. This follows from (7.56) because, for a
grounded non-inverting port, the voltage difference Vdiff = V and, hence, the
output voltage Vo = A0 V. The output voltage changes linearly over a narrow
interval around the origin, and is constant elsewhere.
320
7 Electrical Systems
We can improve the model by incorporating the nite input and nonzero output
resistances, as well as the dynamics. The resulting model is given in Fig. 7.90.
Compared to Fig. 7.87, the source flow in the input section is replaced by a resistive
element that models the input resistance of the op-amp. Similarly, a resistive element is added in series between the source effort and output port. This models the
output resistance.
Finally, an intermediate section is added that models the dynamics of the
operational amplier. Real ampliers are built of many bipolar junction transistors,
JFETs, or MOSFETs, so that the dynamics is quite complex. A capacitance is
321
usually added to the op-amps high-gain node to control its dynamics over the useful
range of the frequencies. In simplied models the amplier dynamics is often
approximated by a rst-order dynamic circuit [1, 4, 5], as represented in Fig. 7.90
by the R and C elements.
Denoting by ec the effort (voltage) on the capacitive element, the current is
i
d
deC
Cd eC Cd
dt
dt
7:58
where Cd is the capacitance of the C element. The same current flows through the
resistor. Thus, the dynamics of the operational amplier of Fig. 7.90 is given by
Rd Cd
deC
eC A0 ediff
dt
7:59
where Rd is the resistance of the middle section R element. The natural frequency of
this simple rst-order system is
xn
1
Rd Cd
7:60
7:61
322
7 Electrical Systems
connected to the inverting input port of the op-amp. Loading the operational
amplier output port is not needed here.
We may estimate the close loop gain of the amplier by summing the currents at
the input node under the hypothesis of an ideal operational amplier of very high
DC gain. Under this hypothesis the potential of the node is equal to the ground
potential, and the current drawn by the op-amp is zero. Hence we have
Vin V0
0
R
Rf
7:62
Rf
Vin
R
7:63
or
V0
The voltage gain of the inverting amplier is, for sufciently high open-loop
gain, given by the ratio of the feedback and input resistors. If we set R = 1 kohm
and Rf = 25 kohm, the gain is 25. This can be veried by simulation. We use a
sufciently low input amplitude of 0.002 V, such that the amplier is not saturated
(set VLIMIT = 5 V). The frequency chosen for the input voltage, 1 Hz, is much less
than the bandwidth frequency of 10 Hz. The parameters of the operational amplier
are given in Table 7.10. The simulation was run for 5 s, corresponding to 5 periods
of the input voltage, and using an output interval of 0.01 s. The results (Fig. 7.92)
Table 7.10 Parameters of the
opamp model
Parameter
Name
Value
Input resistance
Output resistance
Open-loop gain
Output limit
Dynamic resistance
Dynamic capacitance
Rin
Rout
GAIN
VLIMIT
Rd
Cd
1 Mohm
100 ohm
1 105
5V
1 kohm
15.92 F
323
A 0 fn
1
Rf
R
7:64
This relationship is valid if the open loop gain A0 is much larger than 1 + Rf/R, a
criterion that normally is satised. In our example, the gain-bandwidth product A0fn
equals 1 MHz. Hence, for the close-loop gain Rf/R = 25, we get, by (7.64), the
close-loop bandwidth of about 38 kHz. The expected amplitude is 0.05/
2 = 0.03536 V.
We repeat the simulation with an input voltage of the same amplitude, but with a
frequency of 38 kHz. The simulation interval was set to 0.0002 s and the output
interval to 2 107 s. The results (Fig. 7.93) show that the output amplitude has
dropped to 0.0354721 V. There also is a time lag of the output of about 16.5 s that
corresponds to the phase lag of 3.94 rad (1.254 ), where radians is due to the
signal inversion and the other 0.254 /4 rad is the true dynamic phase lag.
324
7 Electrical Systems
7.5
Electromagnetic Systems
This section analyses applications of the bond graph approach to modelling electromechanical systems. The example chosen is an electromagnetic actuator. The
permanent magnet data for the actuator were calculated by a magnetic eld analysis
program. These data are used as input to the BondSim program. More information
on modelling magnetic systems by bond graphs can be found in [2].
7.5.1
325
7.5.2
326
7 Electrical Systems
the displayed variables are the current through electric circuit, the position and
velocity of the plunger, and the total force on the plunger.
7.5.3
327
cells of the grid, i.e. the flux value corresponding to a Position and an Amperewinding. The function can be viewed using the Show Plot button. A Plot Options
dialogue appears that offers several possibilities for the plotting. The Flux function
appears as in Fig. 7.99 left. Similarly, we can dene the EMForce function
(Fig. 7.99 right).
328
7 Electrical Systems
7.5.4
7:65
329
Mechanical port:
F EMForcex; M
v dx
dt
7:66
The gyrator describes the relations between the voltage Vd across the coil ports
and the e.m.f. e, and between the magneto-motive force M and the current i through
the coils:
330
7 Electrical Systems
Gyrator:
Vd N e
M Ni
7:67
where N is the number of coil turns. The (7.65)(7.67) are familiar conversion
relations from electromagnetics.
7.5.5
331
This section, as well as the previous sections of this chapter, shows the effectiveness of the bond graph approach in solving complex electronic and
electro-mechanic systems.
332
7 Electrical Systems
References
1. Senturia SD (2001) Microsystems design. Kluwer Academic Publishers, Boston
2. Karnopp DC, Margolis DL, Rosenberg RC (2000) System dynamics: modeling and simulation
of mechatronic systems, 3rd edn. Wiley, New York
3. Gawthrop P, Smith L (1996) Metamodelling: bond graphs and dynamic systems. Prentice
Hall, Hemel
4. Vladimirescu A (1994) The SPICE book. Wiley, New York
5. Keown J (2001) OrCAD PSpice and circuit analysis. Prentice Hall, Upper Saddle River
6. Kielkowski R (1995) Spice practical device modeling, 2nd edn. McGraw-Hill, New York
7. Massobrio G, Antognetti P (1993) Semiconductor device modeling with SPICE, 2nd edn.
McGraw-Hill, New York
8. Mrtz R, Tischendorf C (1997) Recent results in solving index-2 differential-Algebraic
equations in circuit simulation. SIAM J Sci Comput 18:139159
9. Singh J (2001) Semiconductor devices, basic principles. Wiley, New York
10. Tieze T, Schenk C (1999) Halbleiter-Schaltungstechnik. Springer, Berlin-Heidelberg
11. Van Halen P (1994) A physical charged-based model for space charge region of abrupt and
linear semiconductor junction. In: Proceedings of the 1994 international symposium on
circuits and systems, London, pp 1.4031.406
12. Christen E, Bakalar K, Dewey AM, Moser E (1999) Analog and mixed signal modeling using
VHDL-AMS language (tutorial). In: The 36th design automation conference, New Orleans
13. Thoma J, Bousmsma BO (2000) Modelling and simulation in thermal and chemical
engineering, a bond graph approach. Springer, Berlin-Heidelberg
14. Hafner AR, Blackburn DL (1993) Simulating the dynamic electrothermal behavior of power
electronic circuits and systems. IEEE Trans Power Electron 8:376385
15. de Boor C (1978) A Practical guide to splines. Springer, New York
Chapter 8
Control Systems
8.1
Introduction
Control system theory and practice play important roles in mechatronics. Their
fundamental role is in the control of mechanical motion. Control systems are
commonly described in terms of block diagrams, where input-output relations are
represented by transfer functions. This offers a simplied picture of the system
processes from a control point of view. The theory of control systems is well
documented in numerous books, so we do not cover it here. What we wish to
demonstrate is how the control actions taking place in mechatronic systems can be
modelled using the time domain signal components developed here.
The bond graph elements that can serve as the mechatronic control interfaces are
dened in Sect. 2.5.8. In Sect. 2.6.2 basic block diagram components are dened
that can be used to synthesize the signal processing of the control loops. Control
actions in real components can thus be simplied and represented by block diagram
components. These component models control actions in the time domain.
Modelling is not restricted to linear relations, but is applicable to non-linear relations as well including even those that feature discontinuities. Creation of such
components, or development of more complex components, follows the philosophy
of the component modelling approach discussed in previous chapters.
The next section explains the basic techniques of block diagram components as
applied to a simple control system. Some modelling details specic to block diagram components are given. It will be seen that there is little difference from the
power port component approach.
After that, a short overview of the modelling approach to control systems is
given. This focuses mainly on modelling PID controllers in servo loops. Finally,
modelling and simulation of a DC servomotor is presented.
333
334
8.2
8 Control Systems
We start by modelling a typical feedback control system (Fig. 8.1). This system
consists of a controller that regulates an objects motion. The motion in question is
dened by a reference input and its output information is collected by a sensor.
There are also disturbances acting on the object. In mechatronics, the object is
typically a mechanical linkage actuated by a motor that executes the control action.
We begin the modelling process by creating a new project named A Simple
Control System. Figure 8.2 shows the program screen with the empty project
document window opened in the middle; the model structure tree is on the left and
the editing tools on the right. The basic tools for editing control system models are
contained in the Editing Box, under the Continuous Signal Components branch
(Fig. 8.2). We also need the Ports branch when creating control signal ports. To
Fig. 8.2 A new control system project with editing tools shown
335
Fig. 8.3 The creation of the control system block diagram model
develop the model the same drag and drop technique is used as when editing the
Bond Graph models. The basic difference is that we are now dealing with signals.
Starting from the left in the block diagram in Fig. 8.1, we rst create the input
component that generates the reference signal. This component is created by
dragging the Input Generator tool from the Continuous Signal Components. We
place the component near the left document edge (but not too close), Fig. 8.3. We
may accept the default component name IN and click outside the component to
nish its creation. The component has only one control-out port and by default
generates a constant signal equal to one. We may change it as will be shown later.
We next create a component corresponding to the summation of the reference
and feedback signals. Thus, we drag the Summator tool and create the summator to
the right of the IN component. By default, the newly created component has a
predened name +, which of course can be changed if we wish. We may move the
summator by dragging its title (+) using the mouse so that the left input port is on
the same level as the output port of the IN component. We can move the component also by selecting it (clicking) and using the cursor arrows on the keyboard.
We then connect the output port of IN component to the input port of the summator
by a control line (active bond). We do it as we did when connecting the power ports
by a bond line. We simply put the mouse cursor over the rst port, press the left
button, drag it to the next port, and then release the button.
By default the summator has two input ports and one output port. The input ports
have predened + signs, thus the component at the output generates the sum of the
input signals. Because the feedback signal from the sensor in Fig. 8.1 is subtracted
from the reference input, we have to change the sign of the bottom port of the
summator to . Thus, we double click the bottom port and in the dialogue window
that opens (Fig. 8.4) we select the sign in the Summation Sign combo box.
We can also change the name of the feedback signal to, e.g., cfbshort for
feedback control signal. In the same way we can change the name of the left port,
e.g. to cin. Now, if we double-click the output port we can see that the output
generated is cin-cfb.
336
8 Control Systems
8:1
where K is the controller gain. This is accomplished by dragging the Function tool
and dropping it at the right of the summator. When the text Fun and a textual cursor
(carret) appears we delete this text and type in the K. By default, the constitutive
relation of the component is linear, and thus corresponds to (8.1). Thus, it is a gain
component. We can check this by double-clicking the output port. The value of the
gain defaults to 1 and we accept this for now. We move the gain component K so
that its left port faces the output port of the summator, and then connect the ports.
The next step is to create another summator that will add disturbances to the
system. We create the summator to the right of the gain component, move the
component so that its left input port faces the output port of the gain component,
and connect these ports. The bottom port we drag around the summator periphery to
the top. We now create an IN component above it. This component will generate
the disturbances to the system. Thus, we drag its output port around its periphery to
face the other summator input port, and connect to it (Fig. 8.3).
The object of the control will be created as a word model component named
Object. To create this we need to expand the Bond Graph Component branch and
drag the General Word Model Component in the Editing Box and drop it at the right
of the last summator. When the component is created and a carret appears we type
in the Object as the name of the component and click outside to nish the editing.
By creation, however, the word model component has two power ports. We remove
these ports and at the left side drag and drop a control-in port, and at the right side a
control-out port. We move the component until its left control-in port directly faces
the summator output port, and connect them. Its model will be dened later.
Next, we create a node for the connection of the feedback signal (Fig. 8.1).
Hence, we drag the Node tool and drop it to the right of the Object with its left
input port facing the Object output port, and connect these ports.
337
To close the servo loop, the sensor component must be created. Continuing in a
similar way as when dealing with the gain object we create a simple linear function
component denoting it by Kfb. We must, however, exchange their ports by moving
the right control-out port to the left side of the component, and control-in component from the left to the right side. We move the component to the mid position
with respect to the left and right end of the block diagram and below the second
summator. Connect the left port to the bottom input port of the left summator, and
the right input port to the node (Fig. 8.3).
The nal component that we create serves to display the control systems outputs. Note that every signal has to be fed to some destination; there cannot be
dangling signals. We do not have, however, enough space for this component and
thus need to enlarge the document. To that end we put the mouse cursor on the right
edge of the document rectangle, and when it changes shape into a double arrow,
press it and drag the right edge of the document to the right and release the mouse.
Now we may drag the X-Y Display tool to the right of the node (Fig. 8.3). Note that
that the Display component is created with two input ports. We can drag the
Display component or its left input port, so that it is in the line with the output
port of the node, and then connect them by a signal line. This completes the
generation of the block diagram component model of Fig. 8.1 (see Fig. 8.3).
At this point we introduce a slight modication to the model to permit display of
the reference signal as well. To accomplish this we disconnect the signal line
between the left IN component and the summator, and insert a node. Because there
is not enough space for the node, we need to move the summator and all the
connected components to the right. It is not necessary to redraw the complete block
diagram: Instead we may use the mouse to draw a rectangle around all components
we wish to move. Thus, we press and hold the mouse and drag it to the right. Now
we may insert the node, connect it on the left to the IN component and on the right
to the summator. We connect its bottom output port to the bottom input port of the
Display. The nal form of the block diagram is shown in Fig. 8.5.
The object of control in mechatronic applications is a mechanical object, such as
a robot link or a headlight assembly in an automobile, driven by an actuator. The
objects dynamics is commonly described by a transfer function relating the
Laplace transform of the output to the input,
338
8 Control Systems
8:2
where s is the complex variable. We use the following transfer function as a simple
model of this object:
Gob s
Kob
2 s2 2f T s 1s
Tob
ob ob
8:3
Here Kob is the objects static gain, Tob is the time constant of the object, and ob is
the damping ratio. We cannot, however, model this transfer function directly; we
must transfer it back to the time domain. The time model corresponding to (8.2) and
(8.3) read:
2
Tob
d 3 cout
d 2 cout dcout
Kob cin
2f
T
ob
ob
dt3
dt2
dt
8:4
To describe this equation in block diagram form using only elementary componentsi.e. integrators, functions, summators, etc.integrating (8.4) we obtain
d 2 cout
dt2
2
Zt
d cout
1
d 2 cout dcout
dt
8:5
with
dcout
dt
Zt 2
dcout
d cout
dt
dt 0
dt2
8:6
and
Zt
cout cout0
dcout
dt
dt
8:7
The rst term on the right of each equation is the initial value of the variable in
question. Written in this fashion, these equations can be described directly by the
elementary block diagram components.
The input and output variables are the variables transferred to and from the
control ports of the Object (Fig. 8.5). To describe its model according to (8.5)
(8.7), we create a new model document by double-clicking the Object. In the
document window that opens, we create a model of the control system object in a
way that is similar to the way in which we developed the basic model. The resulting
model is shown in Fig. 8.6.
339
Note that the input port of the gain (function) component Kob and the output of
the last integrator are connected to the document ports that serve as the internal
connectors of the outside component ports. The integration operations in the above
equations including the initial condition of the outputs are represented by the
integrator components [see Sect. 2.6.2.4, Eq. (2.41)].
The function component FUN1 describes multiplication by 1=T2ob in (8.5), and
the rst integrator describes the corresponding integration. The FUN2 component
inside the feedback loop describes the multiplication by 2obTob. The other two
integrators describe the integrations represented by (8.6) and (8.7). Finally, the
summator describes the additions inside the parenthesis in the integrand of (8.5).
Note that the signs of its bottom ports are set to minus.
The initial conditions that are required in (8.5)(8.7) can be set by
double-clicking the integrators output ports. In the dialogue that follows (Fig. 8.7),
the initial values of the output variables can be set in the Initial Value edit box, the
default of which is zero.
340
8 Control Systems
The control system model is now complete, but before simulating the system
several parameters must be set and the input function must be dened.
We use the following parameter values:
Controller gain
Object gain
Object time constant
Object damping ratio
Feedback gain
K
Kob
Tob
ob
Kfb
=
=
=
=
=
30
2.77
5.41 103 s
1.35
1
The default values are accepted for all the other model parameters.
We rst analyse the system response to a unit step input with no disturbances.
Hence we set the output of the left IN object to 1, and of the upper (the disturbance)
IN object to 0, and then build the model. The simulation interval was set to 0.2 s,
the output interval and maximum step-size to 0.001 s, and defaults are accepted for
all the other settings (error constants, method etc.).
The simulation results (Fig. 8.8) show that the settling time is about 0.12 s; and
that there is an overshoot of about 26 %.
We next simulate the response to a unit disturbance with the reference input set
to 0. As can be seen in the next graph (Fig. 8.9), the output does not return to zero,
but settles at a value of 0.0333. Better response behaviour can be achieved using a
better controller, e.g. a controller with proportional-integration and derivative action
(PID) described in the next section.
341
We end the discussion of this simple control system with the analysis of the
response to a sinusoidal input. The reference signal generated by the IN component
of Fig. 8.5 is now dened as a sine function of amplitude cValue and frequency
FREQ Hz. The formula is:
cin cValue sin2p FREQ t
8:8
We estimate the natural frequency of the oscillation from the step response in
Fig. 8.8. The period of the oscillation, estimated as the difference between two
successive crossings of the steady-state line at 1.0, is found to be 0.085 s. Hence the
frequency is estimated as 1/0.085 = 11.76 Hz = 73.89 rad/s. At a much lower
frequency we can expect that output will follow the input closely. To check this, we
simulate the response of the system to a unit sinusoid with the forcing frequency of
1.0 Hz. The simulation interval is taken 5 s and the output interval and the maximal
step to 0.01 s. The result (Fig. 8.10) shows that the input and the output signals are
nearly indistinguishable.
We repeat the simulation with an input frequency equal to the estimated natural
frequency of 11.76 Hz. Because we are interested in the phase shift between the
output and input, we select a simulation interval of 0.5 s and a rather short output
interval of 0.0001 s.
The results of the simulation are shown in Fig. 8.11. We nd that the difference
between the points where the input and output sinusoids cross the time axis is about
0.0206 s. Hence, the phase lag is 2 11.76 0.0206 = 0.4845, which is close to
/2. It was found numerically that the poles of the closed loop transfer function of
the system in Fig. 8.5 are
342
8 Control Systems
s1 435:603
s2;3 31:7363 i 74:2349
343
Hence, the system has a quick exponential rise with time constant
1/435.6 = 0.00230 s, which appears in Fig. 8.8 as a short delay. The transient rises
as a damped sinusoid of the frequency 74.23 rad/s. Thus, the estimation of the
resonant frequency achieved above is a quite good.
8.3
cin dt Kd
dcin
dt
8:9
The Kp, Ki, and Kd are referred to as the proportional, integrator, and derivative
constants (gains), respectively. There are other forms of PID controller laws [1].
The integrator and derivative constants are often expressed as:
Ki Kp =Ti
Kd Kp Td
)
8:10
where Ti and Td are the integrator and derivative time constants, respectively.
The PID model (Fig. 8.12) has three branches. The middle branch with Kp gain
denes the P control. The upper branch contains an integrator and Ki gain and
denes the I control. Finally, the bottom branch contains the differentiator with Kd
gain, and thus denes the D control law.
To evaluate the time derivative we do not use numerical approximations. Rather,
the differentiation is applied directly. The equation is treated as a
differential-algebraic equation and is solved jointly with the other equations
(Chap. 5).
344
8 Control Systems
One of the central problems in the application of PID control is its tuning. The
goal is to obtain good system response. A classical approach is to apply the
well-known Ziegler-Nichols tuning [2, 3]. The application of PID control and the
parameter tuning is illustrated using the example of the last section.
We begin by copying the A Simple Control System project to a new project
named A PID Control system. In the new system we disconnect and delete the
proportional controller K and insert a PID controller, whose model is described in
Fig. 8.12. The resulting system is shown in Fig. 8.13.
There are two Ziegler-Nichols methods known as the open loop and close loop
methods. We will apply the second, the close loop method.
To apply it is necessary to disable the I and D controllers, e.g. by setting Ki = 0
and Kd = 0. We starts then increasing the Kp gain and exciting the system by a step
input until there are self-sustained oscillations in the system. This operation could
be dangerous in real systems and there are some other more acceptable approaches.
However, when simulating the system this is quite an acceptable operation. In fact
the simulations can be used as a rst step in setting the control of a real system. The
value of gain K = Ku where such oscillations appear is denoted as ultimate (or
Fig. 8.13 The control system of Sect. 8.2 with PID controller
345
critical) gain. In our system it happens at Ku = 180. The resulting oscillations in the
output are shown in Fig. 8.14. We nd that the ultimate (or critical) period Pu of the
self-sustained oscillation is Pu = 0.034 s.
According to the Ziegler-Nichols method, the PID constants are given by the
following equations:
9
K 0:6 Ku =
Ti 0:5 Pu
;
Td 0:125 Pu
8:11
The oscillations in the system are acceptable if the ratio of the peaks in the same
direction due to a step in the input or in the disturbance is approximately .
By applying (8.11) we obtain the following values of the PID constants:
K 0:6 180 108
Ti 0:5 0:034 s 0:017 s
Td 0:125 0:034 0:00425 s
The simulation of the system response to the step input using these values of PID
constants is given in Fig. 8.15. The simulation parameters used are the same as used
in the previous section, i.e. the simulation interval 0.2 s, the output interval and
maximum step-size 0.001 s, and the defaults values for the other parameters (error
constants, method etc.). The transient satises the requirements of the stability (
rule).
346
8 Control Systems
We can nd the behavior of the system to a step in the disturbance (with the
reference input set to zero) as in Fig. 8.16. The controller successfully returned the
system output to zero. The stability satises the requirement of rule.
Ziegler-Nichols tuning is referred to as sub-optimal and is used only as the
starting point for a ner controller tuning. Several iterations typically are required to
347
get a satisfactory performance. It should be stressed that PID control tuning is not
always easy to achieve; this is particularly true when the system includes nonlinearities, such as a dead zone or saturation which are often found in the servo-drives.
8.4
The last section of this chapter deals with a position servo system. The next
example shows the power of the combined bond graph-block diagram approach to
modelling of mechatronics systems.
The scheme for the system for the control of the angular position of a body is
given in Fig. 8.17. This is a simplied example of the control of a robotic arm. The
servo loop consists of a servo driver and a permanent magnet DC motor that drives
the body (arm) through a gearbox. The angular position of the body is measured by
a sensor, the output of which is fed back to the servo-driver input. The servo driver
consists of a PID controller as the input stage and an output stage that converts the
low-power controller output to a higher power output needed to drive the motor.
The development of the system model starts by identifying the system components. The components are represented by the corresponding models and interconnected as in the real system. The example project is named DC Servo System.
The system level model is shown in Fig. 8.18.
The Servo Driver has two control-input ports, one for the reference input and
the other for the feedback signal. It also has a power port by which the transfer of
electrical power to the motor takes place.
The permanent magnet motor is represented by the DC Motor component. It has
two power ports, one electrical and one mechanical. The gearbox is represented by
the transformer (TF) component (renamed Gear). The arm shaft rotates in a
bearing xed in the frame. The motor and gearbox body typically are xed in the
frame, and the gearbox shaft is connected to the arm shaft by a clutch.
348
8 Control Systems
349
)
8:14
eemf kt x
The coupling coefcient kt is known as the torque constant. The coupling coefcient in the second equation usually denoted ka and called the back emf constant, is,
in fact, numerically the same coefcient. This is a consequence of the
cross-coupling between variables in the electromechanical conversion and the
conservation of the power in the conversion. The losses are taken care of at the
electrical and mechanical sides of the motor.
The electrical process in the armature winding is commonly described in terms
of the armature resistance Ra and the self-inductance La. In the bond graph model of
Fig. 8.19 it is represented at the electrical side by the resistive and inertial elements,
respectively, joined to a 1-junction. Thus, the relation between the armature
voltage ea across the electrical motor terminals and the armature current ia through
it reads:
ea La
dia
Ra ia eemf
dt
8:15
dx
B m x TL
dt
8:16
8:17
La s Ra Jm s Bm kt2 X La s Ra TL =kt
8:18
Neglecting the external (load) torque, we get the familiar motor transfer function
350
8 Control Systems
Xs
kt
Ea s La s Ra Jm s Bm kt2
8:19
This is the transfer function used in Sect. 8.2. The time constant appearing in
(8.3), denoted here as Tm, is given by
s
La Jm
Tm
Ra Bm kt2
8:20
8:21
kt
Ra Bm kt2
8:22
We can also nd an equation relating the load torque and the armature current by
eliminating the motor angular velocity from (8.17):
TL
La s Ra Jm s Bm kt2 Ia Jm s Bm Ea =kt
8:23
Equation (8.18) shows that the load torque reflects at the electrical side; its effect
should be taken care of by the servo driver. In the same vein, the voltage across the
motor terminals is reflected at the mechanical side and affects the torque delivered
to the mechanical object that the motor drives. These two effects open various
possibilities for the motor control. Thus, it is possible to control the angular velocity
by controlling the armature voltage, treating the torque as a disturbance. Another
possibility is to control the torque by regulating the armature current. Both
approaches have advantages and disadvantages [5, 6].
The Servo Driver in Fig. 8.18 is modelled as in Fig. 8.20. It consists of a
summator that outputs the difference of the reference and feedback signal at the
351
input ports, the PID controller already discussed in Sect. 8.3, and a controlled
source effort that models the power output driver stage. Thus, the control of the DC
motor is accomplished by controlling the armature voltage. The constitutive relation
of the SE element is dened as
ea c\ LIM? (c\ LIM? LIM:k c):LIM
8:24
where ea is the voltage generated by the driver and which is applied to DC motor
input terminal; c is the control signal generated by the controller; k is a gain
constant, and parameter LIM serves to limit the output voltage, and in this way the
maximum current drawn by the motor.
The arm can be modelled as in Sect. 2.7.3 and Fig. 2.26 (Platform). The arm has
a single port only, the shaft. We thus disconnect and remove the other two ports and
all the components connected to them (Fig. 8.21). This model describes the arm as a
rigid body, translating with its mass center CM, and rotating about it.
The model of the FRAME (Fig. 8.18) is a simplied variant of the FRAME object
in Sect. 2.7.3; in the current model we are not interested in the reaction forces at the
arm shaft. Its structure is shown Fig. 8.22 (left). The component Shaft
Translation describes the effect of the bearing that xes the arm shaft axis with
respect to the frame. It consists of two source efforts that impose zero velocities of
translation in two orthogonal directions. The model of Shaft Rotation is
shown in Fig. 8.22 (right). The effort 1-junction, which represents the angular
velocity node, is connected by the document port to the gearbox port (shaft). On the
other side it is connected to the other external port connected to the arm. Thus,
jointly with the Shaft translation it restricts the arm motion to the rotation
about the shaft axis. The resistive element describes friction in the bearing. The
component also supplies information on the angular velocity of the shaft, and by
integrating it, on the angle of rotation.
352
8 Control Systems
Fig. 8.22 The model of the frame: Structure of the model (left), Shaft rotation (right)
This completes the model of the servo system. The system parameters used are
as follows:
Permanent magnet DC motor
Armature resistance
Armature inductance
Torque constant
Rotor mass moment of inertia
Rotor friction constant
Peak current
Continuous current
Gearbox
Reduction ratio
Arm
Mass
Mass moment of inertia about mass center
Distance of mass center from the shaft
Ra
La
kt
Jm
Bm
=
=
=
=
=
iamax =
ia =
2 ohm
0.004 H
0.360 N m/A
9.5 104 kg m2
1.0 105 N m s
50 A
5A
1:20
m = 10 kg
Jc = 0.4 kg m2
a = 0.1 m
Before starting with the simulations, several facts that are important for the
interpretation of the results must be noted (Fig. 8.17). First, the arm is a non-linear
object because the moment of its weight about the axis of rotation is equal to
a m g sin, where is the angle of the arm longitudinal axis to the vertical axis
of the co-ordinate system. Thus, changes in the moment of weight are adequately
approximated by the linear relations only for small angle changes, e.g. || 0.1.
Because of this, the dynamic behaviour of the servo system differs for a small and
large arm angles.
At any positionexcept the verticalthere is a moment of the arm weight that
the motor must supply. Hence, even at a steady-state position of the arm, there is
353
some current flowing through the armature winding of the motor. This effect is
reduced by the action of the gear; its purpose is not only to reduce the angular
velocity transmitted to the arm, but also to reduce the armature torque that the motor
feels. This is a well-known problem that arises in robotics. It has motivated
development of various weight-compensation schemes designed to minimise this
effect. We will investigate how much this is a problem in the present example.
We rst analyse the system response to a quarter-turn (/2) step. The PID
constants are set to K = 2160, Kd = 40, and Ki = 0. The system was simulated for
0.5 s with an output interval of 0.001 s. The arm rotation angle during the response
is given in Fig. 8.23. It settles to a steady-state angle of 1.56954 rad. Thus the error
is 0.00126112 rad, or 0.08 %. Hence, owing to a high P gain, the positional error is
rather low.
Figure 8.24 shows transient in the current drawn by the motor. Initially the
current drawn is very high, but when the system settles down it drops to 1.36203 A.
It can be checked that this current corresponds to the moment of weight that the
motor must supply in the steady-state. To limit the current drawn we can limit the
voltage generated by the driver as given in (8.24). Setting LIMIT = 70 V we obtain
the responses as given in Fig. 8.25 and 8.26. As Fig. 8.25 shows the settle time has
now increased to about 0.2 s; the maximum current is now within the prescribed
limits: the peak less than 50 A, and the continuous current less than 5 A (see the
specications above).
We also checked the response to a small input of 0.1 rad. This resulted in no
apparent change in the behaviour (Fig. 8.27): The settling time is approximately the
same as in the quarter turn step response without the limits (Fig. 8.23), but the
motor now draws much less current.
354
8 Control Systems
One conclusion drawn from this simulation is that the simplied model of the
controller, and in particular its power stage, can provide only a general impression
of how such a system behaves. A much more thorough evaluation requires application of techniques presented in Chap. 7 to develop a physical model of the servo
driver based on its detailed electronic design (e.g. as a MOS H-bridge).
References
355
References
1. RM De Santis (1994) A Novel PID Conguration for speed and position control. Trans ASME J
Dyn Syst Meas Cont 116:542549
2. Vu HV, Esfandiary RS (1998) Dynamic systems: modeling and analysis. McGraw-Hill, New
York
3. Peesen W (1994) A new look at PID-controller tuning. Trans ASME J Dyn Syst Meas Cont
116:553557
356
8 Control Systems
Chapter 9
Multibody Dynamics
9.1
Introduction
There is an extremely large body of literature dealing with the modelling and
simulation of multibody systems, e.g. [17]. The importance of multi-body systems
is also recognized in robotics where different approaches have been developed
taking into account the control aspect as well [8, 9]. The modelling of multibody
systems has attracted attention in bond graph theory, too. The models are based on
eld multiport elements and multibonds [1012].
In this section we describe the modelling and simulation of rigid multibody
systems using the component model approach. In mechatronics, the problem is not
only the mechanical part, but the complete system including the controls and the
interaction with the environment as well. The general component model approach
developed in this book can be applied readily to such complex systems.
The bond graph approach normally leads to the representation of the multibody
system with system constraints described at the velocity, not positional level [13].
This is not specic to bond graphs, but is a characteristic property of the dynamics
of systems that are described by the classical Newton-Euler approach. In this
respect it corresponds more closely to the elegant approach of [7]. We will show
that it is a viable approach not only from the modelling point of view, but also from
the simulation aspect, as well. The component modelling approach enables the
systematic development of the model, starting from the physical components and
modelling the structure of the system. In this way the resulting model is more easily
understood. Visual representation of the model helps this too.
We start with planar multibody systems rst and develop a component model of
body dynamics. Then the basic jointssuch as revolute and prismatic jointsare
analysed and the corresponding models developed. It is shown in an example of a
quick return mechanism how the simulation model of mechanisms can be developed systematically. The system behaviour is analysed by simulation.
357
358
9 Multibody Dynamics
9.2
9.2.1
Recall from engineering mechanics that the term plane motion denotes motion of a
body in which all points move in parallel planes. Referring to Fig. 9.1, motion of
the complete body can be represented by the motion of a body section in its plane.
The plane selected for representing the body motion is the one that contains the
bodys centre of mass. In mechatronic applications the bodies in question are
usually the members of a mechanism assembled by connecting the bodies by
suitable joints. The complete mechanism undertakes plane motion only if the joints
allow motions in which all the members move in the same plane. The term
Fig. 9.1 Representation of a
body motion in a plane
359
multibody system in plane refers to such a case. Otherwise the problem refers to
motion in space. Plane motion of a rigid body has already been discussed in some
detail in Sect. 2.7.3. For completeness we give here the essential points again.
According to the classical approach of engineering mechanics a plane body
motion consists of a translation determined by the motion of the bodys centre of
mass and a rotation about an axis through the centre of mass that is orthogonal to
the plane of motion. To describe the motion of the body, a base (inertial) frame Oxy
is dened (Fig. 9.1). The translation part of the motion can be described by the
position vector rC of its centre of mass C in the base frame. Similarly, to describe
the rotational part of the motion, a body frame Oxy is dened, the origin of which
is taken at the centre of mass, and which is moving with the body. The rotation of
the body can be described by the angle , which the body frame makes with respect
to the base frame.
The bond graph method uses velocities as fundamental quantities for the kinematic description of body motion. This is consistent with Newtons 2nd Law, as
well as with other fundamental laws of body dynamics. Positional quantities are
found from velocities by integration. Thus we take as the fundamental kinematical
variables the vector of centre of mass velocity
vC
vCx
!
9:1
vCy
9:2
i.e. as the sum of the velocity of the centre of mass and the relative velocity due to
rotation of the body around the centre of mass. We are interested mostly in the
points where the body is joined to other bodies. These points are normally dened
in the body frame by the corresponding co-ordinates. The rotational part in (9.2)
(from (2.87) to (2.91)) is given by
vCP Tx
9:3
!
9:4
Assuming that there are two points in a body that serve for the connection to
other bodies, a 2D body model can be represented by a component model (Fig. 9.2)
having two power ports.
360
9 Multibody Dynamics
The force that one body exerts on another can be represented by a resultant force
vector at the connection point and a resultant moment about that point. To represent
the forces and velocities at such points, the power ports of the body component
model should be compounded. Power variables at the ports can be represented by
3D efforts
eP
FP
MP
9:5
and 3D flows
fP
vP
x
9:6
The rst part of such a port serves for the transfer of force FP and linear velocity
vP. The other part serves for the transfer of moment MP and body angular velocity
. The flow vector components in (9.6) are given by (9.2) and (9.3). Similar
relations hold for the effort components of (9.5). They can be developed by
applying the equivalent force and moment laws of engineering mechanics. We
develop these by evaluating the power that is transferred to the body as a result of
mechanical action as we did in Sect. 2.7.3. This alternative approach is convenient,
for it simplies the bond graph representation.
Using vector notation, the power transferred at the ports is given by
f TP eP vTP FP xMP
9:7
9:8
Hence the force at a port not only tends to push the bodys centre of mass, but
also affects the rotation of the body. Term TTFP represents the moment of the force
FP at the port P about the bodys centre of mass. The matrix TT that describes this
transformation is the transposed matrix of (9.4). This term taken together with (9.3)
describe the transformation between linear quantities at the portthe force and the
linear velocity componentsand the angular quantities referred to the bodys centre
of massmoment about the centre of mass and the body angular velocity.
Using the foregoing equations the model of the body moving in a plane can be
represented by the bond graph of Fig. 9.3. We can clearly see the compounded
structure of the document ports (corresponding to the component ports of Fig. 9.2).
361
The 1 component at the top represents the bodys centre of mass junctions and
describes the summation of the forces acting at the centre of mass. The junctions
variables are x- and y- components of the bodys centre of mass velocity. The
components denoted by 0 describe the summation of the velocity vectors in (9.2).
This component consists of two 0-junctions that describe the summation of the xand y-components. These also serve as the junctions of the force components at the
ports. The effort junction 1 in the middle of the model corresponds to the body
angular velocity. It also describes the summation of the moments about the bodys
centre of mass. The components LinRot represent the transformations of the linear
and angular quantities already discussed. The transformation matrix is given by
(9.4). The matrix depends on the body rotation angle which is, in planar body
motion, related to the body angular velocity by
x
du
dt
9:9
xdt
9:10
where 0 is the initial value of the angle. The rotation angle is obtained in the model
of Fig. 9.3 by an integrator component that, as input, takes a signal taken from the
angular velocity junction. The integrator output branches through a node to the
LinRot components. The rotation angle can be also extracted out of the body
component if required.
The transformation of the LinRot component is represented as shown in
Fig. 9.4. According to (9.3) and (9.4), and the TTFP term in (9.8), it consists of two
362
9 Multibody Dynamics
transformers and an effort junction. The transformation ratio is dened by the rows
of the transformation matrix of (9.4).
To complete the model, it is necessary to add the dynamics of body motion. This
consists of the translational dynamics governed by the bodys centre of mass
motion and the dynamics of body rotation about it. The rst is given by the
equations
9
dpC
FC =
dt
;
pC mIvC
9:11
Fc is the resultant force at the centre of mass, vc its velocity, m is the body mass,
and I is the 2 2 identity matrix. The translational dynamics is represented in
Fig. 9.3 by an I component connected to the bodys centre of mass junction 1. The
component consists of two inertial components that describe the momentum law of
(9.11). There is also a SE component connected to it. This is composed of the
source efforts representing the x- and y-components of the body weight.
The rotational dynamics is simpler and is described by the moment of
momentum law
9
dHC
MC =
dt
9:12
;
H C JC x
In these equations Mc is the resultant moment about the centre of mass, is the
bodys angular velocity and Jc is the centroidal mass moment of inertia of the body.
It is represented in Fig. 9.3 by an inertial element connected to the angular velocity
1-junction. This junction is also connected to the lower part of the document ports
and, in this way, the moments at the body component ports are transferred directly
to the junction.
363
The component 2DBody is stored in the Model Library, under the branch Word
Model Component Library (see Fig. 4.35), from which it can be used. It is described
in terms of the absolute angular co-ordinate, i.e. the rotation angle with respect to
the base (inertial) frame. It is also possible to develop a model based on the relative
angular co-ordinates, i.e. of a body with respect to a second body. This approach is
used in Sect. 9.6 when dealing with robot motion in space.
Another point we wish to stress is the selection of the body frame. We have
assumed that its origin is at the bodys centre of mass. Often, however, it is chosen
with the origin at some other point in the body, e.g. at point O (Fig. 9.5). This
selection affects the co-ordinates in the transformation matrix of (9.4) and, hence,
the transformer ratios in the LinRot components (Fig. 9.4). These co-ordinates
can be found from the vector relations
rCA rA rC
9:13
rCB rB rC
9:14
and
It is not necessary to change the transformer relations. The relations (9.13) and
(9.14) can be dened by the parameter statements at the level of the LinRot
components.
9.2.2
Joints
The bodies are connected by the joints. In multibody systems, such as machines and
robot manipulators, the bodies are joined to permit some relative motions between
them. The models of joints depend on their type, i.e. which motions are permitted
and how the joint is physically designed. We look on a joint as a mass-less component, assuming that its mass has been included in the mass distribution of the
364
9 Multibody Dynamics
bodies that it connects. We develop here models of two basic joints: the revolute
and prismatic (translational). Others can be developed in a similar way.
9.2.2.1
The revolute joint connects the bodies by a pin or a shaft (Fig. 9.6). We neglect
clearances between the pin (shaft) and the bearings. Their rotation axis is represented
in the plane of motion by the joints coincidental central point. In the rigid revolute
joint, the only permitted motion is the relative rotation of the bodies about this point.
We represent the joints by components that have two power ports to connect the
bodies (Fig. 9.7).
A model of the joint is given in Fig. 9.8. The 1 component consists of the effort
junctions that represent the x- and y- velocity components of the joint centre. The
force is simply transmitted by the joint.
The flow junction describes the relationship between the angular velocities A
and B of the bodies
xA xB xAB 0
9:15
This holds for planar motion of the bodies only, for in that case the rotation axis is orthogonal to
the plane of the motion.
365
9.2.2.2
366
9 Multibody Dynamics
The analysis of a prismatic joint is done in a similar way as the body motion in
Sect. 9.2.1. We dene a joint Axy co-ordinate frame that is xed in one of the
bodies, e.g. the one with the slot (Fig. 9.9). As the origin A of the frame, a
convenient point on the centreline of the slot is chosen, for example, it can be the
mid-point. The x-axis is directed along the slot axis and the y-axis is orthogonal to
it. The other point, B, used for representing the joint is also chosen on the slot
centreline, but belongs to the other body.
We assume that at these points the joint is connected to both bodies. They correspond
to the ports of the prismatic joint component. Like other body connections, there is a
force vector and moment acting on the joint at one port, and the reactions of other body at
the other port. Likewise the ports flow consists of the velocity vectors of the corresponding junction points and the common angular velocity of the joined bodies.
The position vectors of point B and A, with respect to the base frame (not shown
in Fig. 9.9), are related by
rB rA Rr0AB
9:16
where rAB is the relative position vector of B with respect to A, expressed in the
frame of the joint, i.e.
0
xAB
r0AB
9:17
0
The rotation matrix R of the joint frame with respect to the base frame (Sect. 2.7.3)
is given by
cos u sin u
9:18
R
sin u cos u
Thus (9.16) reads
rB rA
x0AB cos u
x0AB sin u
9:19
Here xAB represents the joint displacement co-ordinate and is the angle of the
slot axis to the base x-axis. Both of these can change with time. Differentiation of
(9.19) with respect to time gives
vB v A
0
xAB sin u
cos u 0
v
x
sin u ABx
x0AB cos u
9:20
du
dt
9:21
367
dx0AB
dt
9:22
is the velocity of the relative displacement of one of the junction parts with respect
to the other along the joint axis. Note that the other velocity component
v0ABy 0
9:23
Note that (9.20) is similar to (9.2) and (9.3), but has an additional term that
comes from the relative translation of the bodies that make up the joint. The matrix
of the angular velocity term in (9.20) can be also denoted as T, but is slightly
simpler and is given by
T
x0AB sin u
x0AB cos u
9:24
cos u 0
v
sin u ABx
9:25
The expression for the power transferred at point (port) B is found as follows.
From (9.25) we have
vTB FB MB x vTA FB TT FB MB x v0ABx cos u sin u FB
9:26
or
vTB FB MB x vTA FB TT FB MB x vTAB FB
9:27
Note that the power transferred at port A is (vA)TFA + MA. From this we cannot
infer that the power transferred at point B is equal to the power input at point
A because this would imply that (vAB)TFB = 0. This holds, however, only for
frictionless and unpowered prismatic joints. From the equilibrium equations of the
mass-less joint we have FA = FB and
MA MB TT FB
9:28
All these relations become clearer when we represent them by bond graphs!
We now formulate the bond graph model of the prismatic joint. It is given in
Fig. 9.11.
Component 0 consists of flow junctions and describes the joint velocity relation
given by (9.25). The junction variables are the components of the force FA at the
368
9 Multibody Dynamics
joints left port, which is equal to the force transferred at other port, i.e. FB. The
effort junction at the top corresponds to the relative velocity of the joint expressed
in the joint frame. The corresponding position co-ordinate can be evaluated by the
integrator that takes as its input the relative velocity of the joint. The component
Rot describes the transformation of the x-components of the relative velocity and
the force at the joint to the base frame. It uses the rst column of the matrix in (9.18)
only. The source effort SE denes the force acting along the joint. It is simply zero
if the friction is negligible, or can be replaced by a resistive element otherwise. This
component can also be used to simulate an actuator driving the junction.
The effort junction 1 on the right corresponds to the joint angular velocity. It
describes the balance of moments as implied by (9.28). The LinRot component
describes the transformation between the linear and angular quantities. The corresponding transformation matrix, as given Eq. (9.24), needs information on the joint
rotation angle and of the position co-ordinate of the joint. The angle of rotation is
found from the integrator, which integrates the angular velocity taken from the
corresponding junction.
9.2.3
369
370
9 Multibody Dynamics
Fig. 9.13 The program window containing the project, library and tools windows
Fig. 9.14 The original model
of the Joint (left) and its
powered form (right)
force/velocity pairs. The bottom bond line transmits the angular moment and
velocity. We will thus have through the mechanism these two bond lines, one
transmitting 2D vectors of force/velocity, and the other the scalar angular
moment/velocity pair. This will affect also the structure of the connecting ports.
In the junction on the left appears a resistor R too. The connecting bond denotes
the relative velocity between the left and the right end (inside and outside ring of the
bearing). By default the resistor in library junction is zero, and hence the junction is
frictionless. We can easily change this. We will retain this in the other two junctions
(corresponding to O and O1), but this one is driven by the constant angular velocity
0 = 2 rad/s (1 c/s). Thus, we will break the bond connecting resistor the R to
0-junction, delete it; we drop from the Edit Tools, Bond Graph Components the SF
tool in place of this component and connect it again (Fig. 9.14 right). By opening
371
the port of SF component we can dene its constitutive relation in the usual way.
The flow of the Flow Source is omega, dened by the parameter expression
omega = 2*PI*RPS. The PI is dened at the program level, and the crank speed
(cycles/s) is dened as RPS = 1 e.g. in the component.
Of the all components only the leftist two should be reworked. These are the two
supports. Thus, we dene that x- and y-components of translational velocity of the
support, as well as its angular velocity, are zero. Figure 9.15 shows the model of
these xtures. We change the power sense of their ports so that in the upper
component it is directed outward and in the bottom one inward. This follows from
the assumed power flow along the mechanism: from the upper Joint (O1) through
the upper body (the crank), then thorough the right Joint (O1) and then thorough
the prismatic JointT and back by the bottom body (the swinging rod) to the lower
Joint (O) and the support.
The nal form of the system level model of the Quick Return Mechanism is shown
in Fig. 9.16. The component titles are changed to better denote object in Fig. 9.13. The
component ports are interconnected by the bond lines. In addition the signals are
extracted from Crank and Swinging rod component models corresponding to the
rotation angles with respect to the base co-ordinates. The Fun object is a function
used to transform the rod rotation angle to the swing angle (see later).
To simulate the motion of the mechanism the following geometrical parameters are
used: a = 0.8 m, b = 0.4 m and r = 0.2 m. The mass parameters are given in Table 9.1.
The geometry of the quick return mechanism is shown in Fig. 9.17. The maximum
swinging angle is given by sin amax r=b, or for the given lengths, as amax p=6.
The limiting the position of the swinging bar are also shown. The upper part of the
crank rotation angle is p 2a. This makes 0:5 a=p 2=3 of the full rotation. Thus
372
Table 9.1 Inertial parameters
of the quick return mechanism
9 Multibody Dynamics
Crank
Swinging rod
Mass (kg)
1.5
4.0
Moment of inertia (kg m2)
0.005
0.25
The mass centers are located at the mid-points of the members
to return the crank needs to make another 0.333 part of the full rotation. Thus, for the
given parameters the mechanism returns back two times quicker.
The length a1 b cos a. The centres of masses of the rods are at their mids, i.e.
0.5r from the crank ends, and 0.5a from the swinging rod ends. Figure 9.18 shows
the initial position of the crank and swinging rod. This also determines the initial
position of the prismatic joint on the swinging rod. This is one of characteristic
points of the swinging rod. The other is its end where it is connected to the Joint.
For the crank these are the end points. The values are summarised in Table 9.2. This
is of course not the only possible selection of the initial position of the mechanism,
but is a simple and logical one.
Initial angle
xleft
xright
373
Crank
Swinging rod
/6
0.5r
0.5r
/3
0.5a
a10.5a
The models of Crank and Swinging rod are discussed in the previous section
(see Fig. 9.3). To dene these models we need the inertial parameters given in
Table 9.1 and the co-ordinates of the characteristic points from Table 9.2 (see 9.4).
Now we can build the mathematical model and start the simulation. The simulation time is set to 2 s, corresponding to two revolutions of the crank. The output
interval chosen is a relatively short (0.001 s) in order to obtain good resolution of
the plot. The results are given in Fig. 9.19. The diagram shows the quick return
behaviour of the mechanism. The results are in agreement with previous results
obtained from the geometry of the problem.
9.3
We now apply the method developed in Sect. 9.2 to the well-known Andrews
squeezer mechanism problem. This problem has been promoted as a test of
numerical codes [3, 13, 14]. We take the formulation of the problem as given in [3,
13] and compare the simulation results obtained by the BondSim program to the
solution given in [14].
The mechanism (Fig. 9.20) consists of seven bodies that can move in a plane.
The bodies are interconnected by revolute joints and also to the base. The arm K1
374
9 Multibody Dynamics
rotates about the xed joint at O under the action of the driving torque Md and this
pushes, via body K2, the central revolute joint where three bodiesK3, K4 and K6
are connected. Bodies K4 and K6 are further connected via bodies K5 and K7 to
another revolute joint A that is xed to the base. The third body, K3, can rotate
about the xed revolute joint at B. The end D of body K3 is connected to a spring
that simulates the squeezer effect. The geometrical parameters of the mechanism are
given in Table 9.3. The masses and mass moment of inertias with respect to the
centre of mass of each body are given in Table 9.4. The spring stiffness and the
driving torque are also given. The data were taken from [13].
To develop a simulation model using BondSim, we create a project called
Andrews Squeezer Mechanism. All of the bodiesK1 to K7will be represented
by the standard plane motion body component model of Sect. 9.2.1. To create the
model we will drag the corresponding 2DBody components from the library at the
appropriate places in the central window (Fig. 9.21), as we did in the previous
example (Sect. 9.2.3). We will also change the component names from standard
2DBody to the corresponding K1K7. The weights of the bodies are neglected. The
local co-ordinates of the connecting points of the bodies can be easily inferred from
the data in Fig. 9.20 (right).
The revolute joints are created by copying (dragging) the standard revolute
component model Joint from the library. The library also contains a joint for connecting more bodies Joint3, which represents a simple extension of the Joint component. This last component is used for connecting bodies K3, K4 and K6 to K2.
To save space the joints are reshaped by moving the ports from leftright to the
bottomup positions. This is achieved by opening the component and
Fig. 9.20 The Andrews squeezer mechanism ([3], used with permission)
Parameter
375
Value (m)
Parameter
ra
0.00092
tb
rr
0.007
ss
d
0.028
sa
da
0.0115
sb
zf
0.02
sc
fa
0.01421
sd
el
0.02
lo
ea
0.01421
xa
u
0.04
ya
ua
0.01228
xb
ub
0.00449
yb
zt
0.04
xc
ta
0.02308
yc
Parameter el corresponds to the length e of body
K1
K2
K3
K4
K5
K6
K7
Spring stiffness k
Driver torque Md
Mass (kg)
0.04325
0.00365
0.02373
0.00706
0.0705
0.00706
0.05498
2.194e6
4.410e7
5.255e6
5.667e7
1.169e5
5.667e7
1.912e5
Value (m)
0.00916
0.035
0.01874
0.01043
0.018
0.02
0.07785
0.06934
0.00227
0.03635
0.03273
0.014
0.072
K4 in Fig. 9.20
Other
4530 N/m
0.033 N m
disconnecting its ports on the inside off the bonds. The ports are then dragged on
the front of the component to upper and bottom positions and then reconnected
again on the inside. Some joints also have the control input ports and a summator to
evaluate difference of the incoming signals (Fig. 9.22). This scheme is used mostly
to nd the difference in angular position of the bodies connected by the joint. This
can be done also without the outsides signals and the summator by integrating the
relative velocity flowing between 0-junction and the resistor R.
It was assumed that there is no friction in the joints. Thus, there are no reaction
moments between the bodies. Hence, a joint restricts only the movement of the
common points of the bodies allowing their free rotation about that point.
To simplify the model there are three components, which model the connection of
the mechanism to the base. These are denoted as A, B and O. They consist of the
supports and joints, as in the previous example (see Fig. 9.16). The component O also
serves to drives the mechanism. Thus, as in Fig. 9.14, instead of the resistor a Source
Effort component SE is used, which supplies the driving moment to the arm K1.
376
9 Multibody Dynamics
The body co-ordinate frames in the original Schiehlen scheme of Fig. 9.20
exactly correspond to the co-ordinate frames used in the formulation of the body
bond graph model in Sect. 9.2.1. We use as a base frame the co-ordinate frame Oxy
of Fig. 9.20. Many angles specied in the scheme, however, are not absolute, but
relative to the body frames of the connected bodies. Thus angle of body K1 is
relative to the base frame, but the angle of the next body K2 is given with respect
to the previous body K1 frame, etc. These angles are used as generalized
co-ordinates of the mechanism in [13, 14].
To compare the results we dene a vector of generalized co-ordinates as in [13]
q b H
e T
9:29
377
9:30
9:31
These last relationships are evaluated by the summators inside the corresponding
joint components (Fig. 9.22). This is the reason why the signals from some of the
bodies in Fig. 9.21 are fed back to their common revolute joints. The output from
the summators is taken out of the joint and connected to the display component at
the bottom right corner. For the others, the outputs from the bodies are fed directly
to the display component.
We now return to the problem of modelling the spring. The spring is attached
between point D of the body and point C of the base. We assume that the
attachments are such that the spring extends and contracts without bending. The
co-ordinates of the attachment point D in the base frame are given by (Fig. 9.20)
xd xb sc sin u sd cos u
yd yb sc cos u sd sin u
)
9:32
cos us
sin us
sin us
cos us
9:33
378
9 Multibody Dynamics
9
xc xd
>
cos us q >
>
>
=
xc xd2 yc yd2 >
yc yd
>
>
sin us q >
>
2
2>
xc xd yc yd ;
9:34
The co-ordinates of point D in these relations are given by (9.32), and those of
point C are the constants given in Table 9.3.
The force and velocity components of point D in the base and local spring frames
are related by the transformations
379
Fd R Fs
v0s RT vd
9:35
9:36
380
Table 9.5 The initial
conguration of the
mechanism
9 Multibody Dynamics
Parameter
Value
K1 angle (rad)
K2 angle (rad)
K3 angle (rad)
K4 angle (rad)
K5 angle (rad)
K6 angle (rad)
K7 angle (rad)
Spring displacement (m)
6.17138900142764e002
6.17138900142764e002
4.5527981916307e001
7.10033369709727e001
0.487364979543842
1.00787905438393
1.23054744454982
2.51774838892633e002
using the standard component models from the BondSim program library leaving
many points to the simulator.
Using the bond graph method the constraints on a bodys motion are described at
the velocity level. This generally leads to DAE models of index 2 (Chap. 5). In this
case the model consists of 219 implicit equations. The equations are relatively
simple, leading to a very sparse matrix of partial derivatives (Jacobian). It has 600
nonzero elements only, i.e. there is on average 2.7 variables per equation. In
comparison the mathematical model of the mechanism based on the Lagrange
multiplier form of constrained multibody mechanics [13, 14] consists of 21 differential and 6 rather complex algebraic equations. In spite of the great difference in
the number of equations, it will be seen that the performance of the BondSim
program is rather good.
To complete the model of the mechanism, it is necessary to dene its initial
conguration. This is dened by the initial values of the rotation angles of all bodies
and the initial deformation of the spring. For the bodies we use the initial values of
the generalized co-ordinates, as given in [13], and evaluate the corresponding initial
rotational angles from (9.30) to (9.31). These are listed in Table 9.5 and correspond
= 0 (Fig. 9.20). The initial spring displacement is calculated as
D s l0
q
xc xd2 yc yd2
9:37
where l0 is the unstretched length of the spring (Table 9.3). Co-ordinates xd and yd
are given by (9.32). This length is given in the last row of Table 9.5. The initial
values of these angles are dened at the output port of the integrator evaluating
these angles in the models of the corresponding bodies (see Fig. 9.3). Initial spring
displacement is dened in the port of the capacitive element of Fig. 9.24.
The simulations were run under similar conditions as in [14]:
Simulation interval 0.031 s
Maximum step size and output interval 0.0001 s
Absolute and relative error tolerance 1e7
The reference solution in [14] was done on a CRAY computer using the PSIDE
parallel software for DAEs. Experiments were also conducted using some other
381
well-known codes including RADAUS [13]. These tests were run on a Silicon
Graphics Indy workstation with 100 MHz R4000SC processor. The simulations
with BondSim software on the other hand were done on a laptop with Intel Core
I7-2630 QM CPU, 2 GHz, and 16 GB RAM.
Figures 9.25, 9.26 and 9.27 give time histories of the angles of the Andrews
squeezer mechanism as dened by Eq. (9.29). The diagrams closely correspond to
those of [13, 14].
382
9 Multibody Dynamics
q1
q2
q3
q4
q5
q6
q7
BondSim
Referent solution
[14]
log
(relerr)
15.81163521
15.7574488
0.04082927883
0.534717726
0.5244112274
0.5347175727
1.048077964
15.810771
15.756371
0.040822240
0.53473012
0.52440997
0.53473012
1.0480807
4.3
4.2
3.8
4.6
5.6
4.6
5.6
BondSim
Referent solution
[14]
log
(relerr)
15.81080552
15.75641311
0.0408227630
0.53472929241
0.5244103070
0.5347292361
1.048079695
15.810771
15.756371
0.040822240
0.53473012
0.52440997
0.53473012
1.0480807
5.6
5.6
4.9
5.8
6.2
5.8
6.0
383
RADAU5 [14]
Scd
3.8
4.9
4.46
Steps
397
489
117
#f
1107
1281
1321
#Jac
715
795
92
CPU (s)
0.13
0.17
0.83
Note scd is the minimum number of signicant correct digits in the solution
Steps means the number of integration steps
#f is the number of function evaluations
#Jac is the number of Jacobian matrix evaluations
Table 9.6 gives the values at t = 0.03 s. The second column gives the values
obtained by BondSim using the default error control method, i.e. by controlling the
differentiated variables only. The third column lists the reference solution from
[14]. To compare the values the number of signicant correct digits are calculated
as in [14] as logjrelerr j. The simulation values agree with the reference solution
to about 4 correct digits. Thus the simple error control used in BondSim by default
gives relatively good accuracy.
The simulations were also repeated using the local error control of Sect. 5.3.3
(using the default differentiation weight of 1). The results are given in Table 9.7.
The values obtained have at least one additional correct digit, that is, they are
correct to a minimum of ve digits.
Table 9.8 gives some of the simulation statistics. The second and third column
gives the statistics when simulations are run using the default and local error
control, respectively. The last column lists the values from [14] when solved
numerically with the RADAU5 code.
The local error control is slightly more expensive in terms of CPU time. The
accuracy of RADAU 5 lies between the BondSim default error control and the local
error control. During the BondSim simulation there are also other operations
besides the numerical solution.
9.4
384
9 Multibody Dynamics
during the course of each revolution of the engine crankshaft. How important these
variations are is difcult to comprehend a priori and requires detailed analysis of the
complete system [16, 17]. There are also some non-linear effects that lumped
parameter models cannot predict, e.g. the so-called secondary resonance [17].
Hence, a more detailed model of the engine in the time domain is important.
In this section we develop a model of a complete single-cylinder engine based on
a multibody model of the reciprocating mechanism. The analysis is based on the
plane body motion models of Sect. 9.2 [18, 19]. The scheme of the reciprocating
mechanism is given in Fig. 9.28.
It consists of a crank that rotates about the bearing at O and which is connected
to the engine piston by the connecting rod AB. All connections of reciprocating
members are by bearings. We treat bearings as frictionless revolute joints. The
piston slides in the cylinder bore and is acted upon by pressure forces developed by
the combustion processes in the cylinder chamber. The piston friction is neglected.
There is also the friction in the mechanism, but this is quite difcult to predict.
Thus its overall effect is represented by a linear resistive element (see later). The
co-ordinate frames used are shown in the gure. The detailed geometry is generally
not known, but it is reasonable to assume that the crank and the connecting rod
mass centres are on their geometrical axes AO and AB, respectively, and the
body-xed axis is taken, in the each case, along these axes.
We develop a model to analyse the engine torsional vibrations using the
BondSim. A project called EngineTorsional Vibrations is created. A model of the
system is developed systematically by creating component models of all the main
engine parts and then connecting them by bond lines (Fig. 9.29). The engine
parameters are based on [17].
385
The crank is xed to the shaft. The shaft is connected on one side to the flywheel
and on the other side (the output part) to the load. It is assumed that the engine is
unloaded and, hence, the load is represented by a zero effort source SE. The shaft
rotates in the bearings xed in the engine body, which is here represented by the
Base component.
The model of the shaft is given in Fig. 9.30. In the centre, the component 1 is
connected to both power document ports. This component describes the translation
of the shaft axis and is represented by an array of effort junctions corresponding to
386
9 Multibody Dynamics
the x- and y-axis motions. It is connected to the Base by the lower power port. The
shaft cannot translate in the engine body and hence the component Base is represented by two zero flow sources. The other effort junction connected to the shaft
upper document port is the shaft angular velocity node.
On each side of the shaft angular velocity junction there are capacitive, inertial
and resistive elements that model the shaft torsional dynamics. The model used
corresponds to the lumped mass model of [17]. Thus, the rst inertial element on
the left is the angular inertia of the reduction gear and the camshaft. The resistive
element describes the overall friction effect in the engine reduced to the shaft.
A pair of capacitive elements on each side of the centre in Fig. 9.30 represents
the stiffness of the shaft parts between the crank and the bearings. The bearings are
represented by the inertial elements. The last capacitive element on the left of the
centreline represents the stiffness of the shaft between the left bearing and the
flywheel; that on the right side represents the stiffness of the output portion of the
shaft. The controlled source effort models the effect of the combustion forces on the
piston, reduced to the shaft. The element is controlled by the angle of shaft rotation.
It simulates the load torque by [16, 17]
M Mm 1 B sinnu
9:38
where Mm is the average indicated torque and B and n are appropriate constants.
The Flywheel (Fig. 9.29) is modelled simply by an inertial element connected
to an effort junction, from which information on the flywheel angular velocity is
obtained. This is fed to the display component (at the right bottom in the
document).
The Crank and Conrod components are modelled as rigid bodies in plane
motion using the general model for plane motion bodies of Sect. 9.2.1. The components are created simply by dragging the 2DBody component from the library.
The main difference is the change of name. The ports are moved to the upper and
lower parts of the components in order to represent the connections as depicted in
Fig. 9.28. Thus, the model of the Crank is as depicted in Fig. 9.31.
387
Note that, because of the connection through the frictionless bearings, there is no
transfer of external moments to the crank. The SE connected to the mass centre joint
describes the weight of the component. It can be seen in the lower part of the model
that signals of the crank rotation angle and the angular velocity are obtained. These
are used to display the crank motion, as well as for simulating the shaft load torque
(Fig. 9.29). The model of the Conrod is almost the same, except that only the
component rotation angle is picked up. The bearings are modelled by the revolute
joint component of Sect. 9.2.2. The Bearing components imply the common
velocity condition of the bodies at the connection points (the bearing axes).
The engine piston slides inside the cylinder. This is described by a translation joint.
The model is simplied by assuming that the engine body is xed in the base frame
(Fig. 9.32). The left effort junction represents the x-axis piston velocity, which is zero.
Table 9.9 The engine model parameters
Parameter
Crank
Conrod
Piston mass
Shaft stiffness
Shaft inertia
Flywheel inertia
Engine friction constant
Average torque
Value
Length OA
Ratio OC/OA
Mass
Inertia
Length AB
Ratio AC/AB
Mass
Inertia
The left part
The right part
The flywheel part
The output part
Gear and camshaft
Bearing left
Bearing right
0.02491 m
0.143
0.557 kg
3.21 104 kg
0.09847 m
0.164
0.1040 kg
1.53 104 kg
0.1649 kg
146,000 N m
146,000 N m
11,090 N m
7960 N m
7.99 105 kg
5.92 106 kg
5.92 106 kg
9.35 103 kg
0.01 N m s
1.86 N m
m2
m2
m2
m2
m2
m2
388
9 Multibody Dynamics
This condition is implied by a zero flow source. The piston can move in the ydirection and is affected by its inertia and gravity. Note also that the position of the
piston is evaluated by integration and the signal is fed out for display.
The effect of the combustion pressure is not represented here but is taken into
account by the equivalent load torque reduced to the Shaft as has already been
described (see 9.38). This analysis of engine torsional vibrations is a common one,
for it is well known that the pressure forces can be described by a Fourier series
[15]. In (9.38) the parameter n takes into account different harmonics contained in
the piston force and, thus, the effect on the torsional vibration characteristic can be
examined by varying it. Alternatively, a detailed model of the combustion process
in the cylinder can be developed and included in the model.
The model parameters are summarized in Table 9.9. These are based on the
measured data of a small four-stroke single cylinder engine [17]. The last two
parameters were chosen in such a way as to achieve, on the one hand, the free
running engine velocity of about 1800 rpm, as in the experiments of [17], and on
the other hand a relatively good mechanical efciency (light damping) of the system. The parameter B of (9.38) was set to 1.
After the model is completed, it is possible to analyse the dynamic behaviour of
the engine by simulation. We are interested mainly in the behaviour of the system
around the rst natural frequency. Thus the time-response of the system to the load
torque is found rst, and then the frequency spectrum of the engine angular velocity
is generated. Because the time constant of the system is about 1 s, we need about 5 s
to be sure that the velocity settles down to a steady state value. After that, we run
the system for an additional 5 s.
Thus the simulation interval is taken to be 10 s. The range of frequency we are
interested in is 01000 Hz. Thus the output interval should be at least 1/2000 s or
5 104 s. We choose the default error tolerance of 106 and the default method.
389
The rst resonance appears when parameter n of (9.38) is about 25. Figure 9.33
shows transients in the angular velocity for n = 25. The output is very noisy because
it is on the border of instability. The rst signs of instability appears after t = 2 s.
We get the frequency spectrum by right-clicking the time plot and select
Frequency spectrum from a drop-down menu. In the dialogue that appears we select
a time window of 510 s and, and retain the default Rectangular window. The
resulting spectrum calculated by Fast Fourier Transform is shown in Fig. 9.34. As
can be seen, there is a large DC component of magnitude 180.570 rad/s (1724 rpm).
390
9 Multibody Dynamics
We expand the low frequency region up to 100 Hz, Fig. 9.35, by clicking with
the right mouse button on the frequency plot, and then selecting the Expand
command from a drop-down menu. In a similar way the high frequency region can
be expanded. This is shown in Fig. 9.36.
The low frequency region shows characteristic harmonics that appear at multiples of the fundamental frequency of 28.7 Hz (*1724 rpm) because of the inertial
effects in the engine. It can be seen that the second natural frequency is the largest,
then the rst, and followed by the third. The higher order harmonics are much lower
in amplitude and there is no response until frequencies in the range 600900 Hz.
The higher natural frequency is estimated at 718.5 Hz with a magnitude of
28.7 rad/s. There are also amplitude peaks on both sides of the resonant frequency,
which are displaced by twice the fundamental frequency, i.e. 57.5 Hz. This is
Fig. 9.37 The base and body
frames
391
termed the secondary resonance and is the result of non-linear inter-coupling in the
engines reciprocating mechanism [17]. The spectrum diagrams, as well as the
characteristic frequencies, agree well with the experimental results reported in [17].
9.5
9.5.1
9:39
where r0CP is the vector of its material co-ordinates, i.e. the co-ordinates with
respect to the body frame.
During motion, the position of the body centre rC and its orientationrepresented by matrix Rchanges with time. The material co-ordinates of a point xed
in the body do not change, but the co-ordinates change with respect to the base
frame. The velocity of the point P, as seen from the base frame, can be found by
differentiating (9.39) with respect to time, i.e.
vP v C
dR 0
r
dt CP
9:40
The relative velocity of the point P with respect to the origin of the body frame
C is
vCP vP vC
and thus the velocity of point P is
9:41
392
9 Multibody Dynamics
vP vC vCP
9:42
From (9.40) the relative velocity depends on the body orientation change
vCP
dR 0
r
dt CP
9:43
9:44
The rotation matrix is orthogonal and thus we have for its inverse
R1 RT
9:45
9:46
dR 0
r
dt CP
9:47
But,
rCP Rr0CP
9:48
Thus, we have
vCP
dR T
R rCP
dt
9:49
It is a simple matter to show that the factors of the position vector on the right
side of (9.47) and (9.49) are skew-symmetric. From (9.45) it follows that
RT R RRT I
9:50
where I is the identity matrix. Hence, by differentiating with respect to time we get
dRT
dR
0
R RT
dt
dt
or
9:51
393
dR
dRT
dR T
R RT
dt
dt
dt
9:52
dR T
dRT
dR T T
R R
R
dt
dt
dt
9:53
RT
And, similarly
9:54
b bx by bz T
9:55
and
reads
0
1 0
ay bz az by
0
a b @ az bx ax bz A @ az
ax by ay bx
ay
az
0
ax
10 1
ay
bx
ax A@ by A
0
bz
9:56
1
0
ay bz az by
0
@
A
@
a
b
a
b
b
ab
z x
x z
z
ax by ay bx
by
bz
0
bx
10 1
by
ax
bx A@ ay A
0
az
9:57
and, hence,
a b b a
9:58
dR T
R
dt
9:59
dR T
R
dt
9:60
and
x axial
394
9 Multibody Dynamics
dR
dt
9:61
and
T dR
x axial R
dt
0
9:62
9:63
dR
Rx0
dt
9:64
and
Vectors and are the base frame and body frame representations of the body
angular velocity. These representations are related by
x Rx0
9:65
9:66
vCP x rCP
9:67
and
9:68
9:69
and
We transform these equations a little more using (9.58). Thus, (9.68) can be
written as
vP vC rCP x
Similarly, from Eq. (9.69), we have
9:70
395
9:71
vC
x
9:72
v0C
x0
9:73
We denote such vectors by f because, as will be shown later, these are simply the
flows of the bond graph component ports.
In a similar way, a generalized velocity of any other point P xed in the body
can be represented in the base frame by
fP
vP
x
9:74
v0P
x0
9:75
I
0
rCP
fC
I
9:76
0 0
f
R C
9:77
Also, we have
fC
R
0
I
0
rCP
I
R
0
0 0
f
R Ci
9:78
396
9 Multibody Dynamics
fP
R
0
rCP R 0
fC
R
9:79
Matrix
C
R
0
rCP R
R
9:80
can be termed a representation of the body frame conguration tensor [7]. Thus, we
have
f P Cf 0C
9:81
I
0
r0CP 0
fC
I
9:82
From (9.77) we nd
f 0C
RT
0
0
RT
9:83
fC
RT
0
r0CP RT
RT
9:84
9:85
In this section some of the basic kinematic quantities have been developed. They
are generalizations of the corresponding expressions for planar body motion
developed in Sect. 9.2.1.
9.5.2
Now we can proceed with the development of a bond graph model of a body
moving in space. It is similar to the one used for bodies in plane motion in
397
Sec. 9.2.1. The main difference lies in the more complex relationship that governs
motion of bodies in space.
To develop a fundamental bond graph representation we consider a single body
interacting with its environment. The environment consists of the bodies to which
the analysed body is connected. We model the body and its environment by two
component objects3DBody and Workspace (Fig. 9.38).
We assume that the body is connected to other bodies at two points. We also
assume that a body in the environment acts on the considered body by a force and a
moment. Likewise the body acts to another body in the environment. In this way
there is a transfer of power from the environment to the body and from the body
back to the environment. In order to represent these interactions we assume that the
3DBody component has three ports. Two of these, the bottom and the upper ones
in Fig. 9.38, correspond to the power interactions just described. We have added the
third one (the side port) to correspond to the body centre of mass. It is possible to
develop a model without the explicit use of the centre of mass port, but its use
simplies the description of the body dynamics.
As explained previously, velocities seen at a port can be represented by the 6D
flow vectors of (9.74) and (9.75). Similarly we can use 6D efforts to represent the
resultant force and moment at a port. Such efforts can be represented in the base
frame by
eP
FP
MP
9:86
F0P
M0P
9:87
Here FP and F0P are 3D representations of the resultant force at connection point
P and MP and M0P the corresponding representations of the resultant moment.
398
9 Multibody Dynamics
To represent these 6D vector quantities, the ports of the Base and Body
components are assumed to be compounded (Sect. 2.4). The rst sub-port corresponds to the linear velocity and resultant force pair, and the other to the body
angular velocity and resultant moment. This way the ports can be used to access
efforts and flows at the port by two ordered 6D efforts and flows. At the mass centre
ports however, as will be seen later, a 3D representation is sufcient. The flow is the
mass centre velocity and the effort is the resultant of the forces acting on the body at
other ports (interconnection points) reduced to the mass centre. The gravity force
(the body weight) acting there is not accounted for and is taken into account when
dealing with the body dynamics. The reason for this is that body weight can be
easily described in the base frame. However, this is not so in a body frame, because
it is generally rotated with respect to the rst.
We represent effort and flow vectors at body ports as seen in the body, i.e. with
respect to a body xed frame. Similarly at the base ports the corresponding
quantities are expressed with respect to the base frame. Transformations between
these two representations are given in Fig. 9.38 by the Coordinate transformation component. This component transforms effort and flow at a body port
to the corresponding base representation and vice versa. The transformation
between efforts is given by
eP
R
0
0 0
e
R P
9:88
R
0
0 0
f
R P
9:89
where R is the rotation matrix of the body frame with respect to the base.
We use Cartesian 3D frames only. Thus the transformation matrix is orthogonal
as shown in the rst part of this section. Thus from (9.89) we get the inverse
transformation
f 0P
RT
0
399
0
RT
9:90
fP
It follows, then, that the transformation does not change the power transfer
between the Body and the Base
T
0
f 0T
P eP f P eP
9:91
The transformation of port quantities can be represented by the 6D transformation component of Fig. 9.39a. This component transforms both 3D parts of the
6D effort-flow pairs of the corresponding ports, according to (9.88) and (9.89), as
shown in Fig. 9.39b. The transformations are represented by the Rot components
that describe the transformation of 3D effort-flow vectors by the rotation matrix
R. The transformation can be represented using transformer elements TF (see
Sect. 9.6).
The velocities at a port are related to the velocity of the body mass centre by
(9.82). To nd the relation between forces and moments, we evaluate the power
transfer between the ports as in Sect. 9.2.1. From (9.82) we get
0
f 0T
P eP
f 0T
C
0 0
e
r0CP I P
I
9:92
After substituting from (9.73), (9.75) and (9.87), and evaluating, we get
0
v0T
P FP
0T
M0P
v0T
C
0T
FP
r0CP F0P M0P
9:93
or
0
0T 0
0T 0
0T 0
0
0
v0T
P FP x MP vC FP x rCP FP MP
9:94
400
9 Multibody Dynamics
The last equation is the generalization of the planar case (9.8). It describes,
jointly with (9.82), the basic velocity and force relationships for rigid bodies.
The basic structure of the Body component, dened by (9.82) and (9.94), is
given in Fig. 9.40. It is very similar to that of the planar body model in Fig. 9.3, but
involves three-dimensional quantities.
Here the component 1 is also an array of the effort junctions corresponding to
the centre of mass velocity. Instead of a simple effort junction for the body angular
velocity, the component Rotation is used. This is because the rotational
dynamics in 3D is much more involved than in the planar case. (We discuss this
component later.). The components 0 represent the array of flow junctions that
describe the port velocities relationship given by the rst 3D row of (9.82). It gives
the linear velocity at a port as the sum of the velocity of the body centre of mass and
the relative velocity of the port due to the rotation of the body about the centre of
mass. The joint variable is the force at the port. The body angular velocity, however, is a property of the body; as suchaccording to the bottom row of (9.82)it
is directly transferred to the corresponding Rotation component port.
The LinRot components represent transformations between linear and angular
quantities. That is, between the relative velocity at the port with respect to the centre
of mass of the body and the body angular velocity on the one hand, and of the force
at the port and its moment about the mass centre, on the other. These transformations are dened by the skew-symmetric tensor operations in (9.82) and (9.94)
and can be represented by transformers, as in Fig. 9.41.
Every transformer in Fig. 9.41 corresponds to a nonzero entry of tensor r0CP
or its transpose. Thus, the flow junctions on the left evaluate the relative velocities
at the left port as a result of the multiplication of the angular velocity at the right
port by matrix r0CP . Likewise, the effort junctions on the right give the moment
at the right port of the force at the left port by multiplying it by the r0CP matrix.
The ratios of the transformers are the material co-ordinates of a body point
401
corresponding to the port with respect to the mass centre. Thus, they are parameters
that depend on the geometry of the rigid body and dont change with its motion.
9.5.3
To complete the model, we need a dynamic equation governing rigid body motion.
The simplest form of such an equation is given with respect to axes translating with
the body mass centre (Fig. 9.42). We assume that the base frame is an inertial
frame.
The translational part of the motion can be described by
9
p mIvC =
dp
F;
dt
Fig. 9.43 Rigid body translation. a Representation in the Base.b The CM component
9:95
402
9 Multibody Dynamics
Here, m is the body mass and F is the resultant of the forces reduced to the mass
centre. We represent the dynamics of body translation in the Workspace
(Fig. 9.43a) by the CM component that describes the motion of the centre of mass of
the body. This last component (Fig. 9.43b) consists of effort junctions corresponding to the x, y and z components of the velocity of the mass centre of the body
with respect to the base frame. These junctions are connected to the Workspace
port to which the resultant of the forces acting on the body is transferred.
Note that the weight of the body is added here. This force is represented by
source efforts dening the weight components with respect to the base frame axes.
The momentum law in (9.95) is represented by the inertial elements I with the body
mass as a parameter. Because it is used both in the SE and I components, it can be
dened just once, at the level of the CM document (Fig. 9.43b).
The rotational part of the body motion is commonly described in a frame
translating with the mass centre of the body and that is parallel to the base frame.
The moment of momentum law with respect to such a frame reads
9
H Jx =
dH
M ;
dt
9:96
where J is the mass inertia matrix and M is the resultant moment about the centre of
mass of the body. Due to rotation of the body, the inertia matrix changes during the
motion. Because of this the equations of the rotational dynamics are as a rule (at
least for rigid bodies) represented with respect to a frame xed to the body. It is not
difcult to transform Eq. (9.96) to this form.
In the body frame the body moment of momentum is given by
H RH0
9:97
9:98
J0 RT JR
9:99
where
is the body mass inertia matrix with respect to the centroidal body axes. Multiplying
the second Eq. (9.96) by RT and substituting from Eq. (9.97), we obtain
RT
or
d
RH0 M0
dt
9:100
403
dH0
dR 0
H M0
RT
dt
dt
9:101
9:102
These are the famous Euler equations of body rotation in which the rate of
change of the moment of momentum is represented by its local change and a part
generated by the body rotation. This other part has a very elegant representation in a
bond graph setting. This is the celebrated Euler Junction Structure (EJS) [10, 11].
Now we can describe the ROTATION component of Fig. 9.40, which represents
the body rotation about the centre of mass with respect to the body frame
(Fig. 9.44). The Torque balance component in the middle consists simply of an
array of three effort junctions that corresponds to the x, y and z components of the
body angular velocity with respect to the body frame. The left and right ports
transfer the moment of the forces and the moments acting on the body. In the centre
it is connected to Inertia and EJS components. The rst of these consists of an
array of inertial elements that describes the local rate of change of the moment of
momentum. There is a control-out port that serves for the transfer of information on
the moment of momentum vector H that the EJS component needs. This can be
seen in (9.102). The EJS component is shown in Fig. 9.45.
It consists of three gyrators connected in a ring. Note that the power circulates
inside the structure, thus there is no net power generation or dissipation. The
gyrators are modulated by the body moment of momentum rectangular components. The EJS can be slightly simplied if the body axes correspond to the
404
9 Multibody Dynamics
principal axes of the inertia tensor. We do not assume this, as selection of the body
axes is usually based on how the body is connected. Thus, we assume that the body
inertia matrix is fully populated. We do not recalculate the moment of momentum
in the EJS component, but rather take it from the inertial component.
This completes development of the component model of a body moving in 3D
space. The model is stored in the BondSim Models Library, under Word Model
Components, from which it can be easily used by dragging into the working
window where the models are developed. Now we turn our attention to the modelling of interconnections between the bodies in space.
9.5.4
405
The modelling and simulation of such complex systems is not an easy task. The
problem of modelling manipulators as multibody systems is only one part of it;
there is also the problem of the control of such complex space systems, particularly
when there are interactions with the environment. The bond graph method is a good
candidate for solving such multi-disciplinary problems. We can go a step further
and show in the last section how the motions of such complex mechanical structures can be visualized in a virtual 3D scene.
9.5.4.1
Revolute Joints
Revolute joints have already been discussed in Sect. 9.2.2. The basic difference
with those discussed earlier is that, because bodies connected by a revolute joint can
move in three-dimensional space, the axis of the joint is not conned to specic
motions but can move freely. To describe this effect, we analyse the bodies A and B
connected by a revolute joint, as shown in Fig. 9.46. The bodies could, for example,
be two links of a robot manipulator joined by a revolute joint. We assume that the
z-axis of the co-ordinate frame OAxAyAzA of body A is directed along the joint axis.
We assume further that there is a body B frame OBxByBzB. The precise position of
the frame is not prescribed and in a specic multibody system can be dened as is
most convenient, e.g. using the Denavit-Hartenberg convention [9]. The frame Oxyz
is the base frame.
Let P be the centre point of the revolute joint used as the reference connection
point. The joint is represented by word model components as in Sect. 9.2.2
(Fig. 9.7). The ports are assumed compounded such that the port variables are 6D
flows and efforts at the connection of the joint to body A and B These are expressed
in their respective frames. At A (the power-in) these are
406
9 Multibody Dynamics
f AP
vAP
xAA
9:103
and
eAP
FAP
MAP
9:104
vBP
xBB
f BP
9:105
and
eBP
FBP
MBP
9:106
The linear velocities of bodies A and B at the connection point are common to
both of the bodies. Hence
vAP RAB vBP
9:107
where RAB is the rotation matrix of the body B frame with respect to the body
A frame.
A similar relation holds for the forces. Because the linear velocities at the
common point are equal, the same is true for the power transferred across the joint
during its translation, i.e.
vAP T FAP vBP T FBP
9:108
9:109
Equations (9.107) and (9.109) describe the relationships between the linear parts
of the flow-effort 3D vectors at the joints ports. We develop next the relationships
between the angular parts, i.e. the angular velocities and moments.
Rotation matrices of the bodies A and B frames with respect to the base frame are
related by composition of the rotations, i.e.
RB RA RAB
9:110
407
RB RA B
dt
dt
dt
9:111
9:112
where
xAAB
A
dRB B
R
axial
dt A
9:113
is the relative angular velocity of body B with respect to body A expressed in body
A frame. Simplifying (9.112) we get
RA T xB RA xAA xAAB
9:114
9:115
9:116
9:117
In addition we have
0 u_ T
9:118
408
9 Multibody Dynamics
We can now represent the model of a revolute joint. It consists of two main parts
(Fig. 9.48): Revolute and Joint Rotation. The Revolute represents the
basic relations between the port variables in the frame of lower joint part (body A).
The other component, Joint Rotation, transforms the port variables from the
frame of the other body (body B) to the frame of the lower (body A).
The structure of the Revolute component is shown in Fig. 9.49a. It consists of
two components. The Tr component represents the translation part of the joint
model and expresses the fact that the joint centre point is common to the both
bodies. Thus it consists solely of three effort junctions for the translation in the
direction of xA, yA and zA axes. This ensures that the joined ends of the bodies move
with a common velocity and that the corresponding forces are the same.
The other component, Rot, whose structure is shown in Fig. 9.49b, represents the
relationship between the angular velocities as given by (9.116) and (9.118). The
model is very simple and consists of two effort junctions in the xA- and yA- directions
409
in which the angular components are the same for both of the joined bodies. There is
also a flow junction that corresponds to the relative rotation about the zA-axis.
The 1-junction on the left in Fig. 9.49a is inserted to extract the joint relative
angular velocity and integrate it to obtain the joint rotation angle. It is used in the
Joint rotation component, but is also transmitted to the output port
(Fig. 9.48).
An important function of the joint is the rotation transformation between the two
link frames (Fig. 9.48). This is depicted in Fig. 9.50. The transformations are
applied to the linear effort-flow parts, and separately to the angular. These are
represented by components RAB. The components represent transformations, as
given by (9.107) and (9.108) for linear variables. The same transformations hold for
the angular variables.
The transformations are usually expressed by transformers TF, which transform
flow and effort components. These are then summed as given in (9.107) and
(9.109), and similarly for the angular quantities. We do not give here the general
410
9 Multibody Dynamics
structure of the component. Later in Sect. 9.6, we meet some specic examples of
such transformations.
Revolute joints play an important role in the design of robotic manipulators.
They offer the simplest way to change the orientation of the robot links. The
component model introduced here gives the main functionality of such joints. They
are used later for the building of manipulator models. This is illustrated in Sect. 9.6.
9.5.4.2
Prismatic Joints
Prismatic joints have already been described in Sect. 9.2.2. The basic difference
here is that the axis of the joint can be anywhere in space (Fig. 9.51). To describe
the effects of prismatic joints on bodies connected by such a joint, we dene a body
frame AxAyAzA attached to one body at point A. The z-axis is directed along the
relative displacement of the joint (joint axis). There is also a second body B and a
frame attached to it.
The precise positions of the frames are not specied and can be dened as is the
most convenient, e.g. by using the Denavit-Hartenberg convention [9]. The frame
Oxyz is the base frame.
Let B be a point on the second body. This body can move along the joint slot.
The joint can be represented by a word model component as in Fig. 9.47, but of
course its model will be different. The ports are assumed compounded such that the
port variables are 6D flows and efforts at the connection of the joint to the bodies
(the upper and lower in Fig. 9.47). The side port is used for actuation of the joint.
We develop the governing equations rst. They are generalizations of the corresponding equations for the planar case in Sect. 9.2.2, but are expressed with respect
to the body frame, not the base frame, as we did for plane revolute joints.
The position vector of point B (Fig. 9.51), the reference point of the body that
can slide along the joint, is given by
rB rA RA rAAB
9:119
where RA is the rotation matrix of frame A with respect to the base and rAAB is its
relative position with respect to the body frame A. By differentiation with respect to
time, we get for its velocity
vB vA RA vAAB
dRA A
r
dt AB
9:120
where
vAAB
drAAB
dt
9:121
411
is the relative velocity of the junction. Substituting from (9.64) in Eq. (9.120) we
get
vB vA RA vAAB RA xAA rAAB
9:122
9:123
9:124
In addition, we have
Here, RAB is the rotation matrix of the second body frame with respect to the body
frame of A. Note that in prismatic joints this is a constant matrix.
In the body frame A, the relative position vector is very simple
rAAB 0
0 s T
9:125
s_ T
9:126
9:127
412
9 Multibody Dynamics
1
0
0A
0
9:128
9:129
0
TAA @ s
0
s
0
0
This is similar to (9.25) for the planar case. We can expect that the model of the
space prismatic joint is just a generalization of the model of Fig. 9.10.
The structure of the prismatic joint component model is similar to the revolute
joint of Fig. 9.48 and is shown in Fig. 9.52. The Joint Rotation component
transforms efforts and flows between the two body frames. This is similar to the
revolute joint (Fig. 9.50), but here the matrix is constant.
The model of the Prismatic component is given in Fig. 9.53. The 0
component-junction describes the prismatic joint velocity relationship given by
Eq. (9.129). It consists of flow junctions that describe the velocity relationships in
the direction of the body axes.
Component 1 on the right corresponds to the joints angular velocity vector. The
LinRot component describes the transformation between linear and angular
quantities given by the last term, which is dened by matrix (9.128). It depends on
the joints relative position, evaluated by the integrator that uses the joint sliding
velocity from the corresponding junction.
Note that because of the very simple form of the matrix in (9.128), there are no zcomponents generated by the linear-to-rotational transformation. Summation of the
velocity components represented by the flow junction that corresponds to (9.129) is
simplied, too. Thus, we see that the space prismatic junction is even simpler than
the planar one.
9.6
9.6.1
413
414
9 Multibody Dynamics
ai
di
1
2
3
4
5
6
1
2
3
4
5
6
90
0
90
90
90
0
0
a2
a3
0
0
0
0
d2
0
d4
0
d6
The control of robots is a eld in its own. Originally the PUMA was controlled
by PID controllers. Even nowadays the PID is commonly used for robot control.
We will present here a complete PUMA 560 system based on a PID controller.
Figure 9.54 shows a 3D view of PUMA 560 robot with the attached co-ordinate
frames. The PUMA robot was the rst anthropomorphic robot designed and was the
leader of many robots that follows. It has a human form. Even its size is chosen to
correspond to a typical man or women. It is customary to describe its parts by
human terms such as a body, shoulder, arm, elbow, wrist, joints, hand, etc.
To model a robot two kinds of 3D Cartesian co-ordinate systems are typically
used: the basic and links systems. The basic is an inertial co-ordinates system, and
represent the basic reference system for the description of the robot motion.
Each robot link has a separate body xed co-ordinate system. Figure 9.54 shows
these co-ordinate systems. They are dened following the well-known standard
Denavit-Hartenberg (DH) scheme [22].2 In this scheme, the co-ordinate frame i is
attached to joint i + 1 and zi axis lies along the axis of the rotation. The origins of
the link 4 and 5 frames coincide with the central point of the spherical wrist, often
used in robots. The origin of the last frame 6 is at the TCP (tool central point). The
corresponding DH parameters are shown in Table 9.10.
The assumed values of the parameters in meters following [21, 22] are given
below. The length L1 is the height of the basic co-ordinate frame from the floor, and
L2 denes the position of the mean plane of the link 2 orthogonal to z-axis:
a2 0:4318; a3 0:0203
d2 0:1501; d4 0:4331; d6 0:056
L1 0:672; L2 0:2435
The joint angles are limited to the values as given below:
160 h1 160
215 h2 35
45 h3 225
140 h4 170
There is also a DH modied scheme introduced by Craig [8]. In this scheme the frame i is
attached to joint i. It is perhaps even simpler to use, but it is not used here.
415
100 h5 100
266 h6 266
Using the link frames we can nd the relative homogenous transformation
matrices from one link frame to the previous one going from the rst link to the last,
Fig. 9.54.
The homogenous transformation is a compact way to represent the position and
orientation of one co-ordinate frame with respect to the other (Fig. 9.55). It also
allows projection and scaling, but is not used here.
Figure 9.55 shows two co-ordinates frames A and B and a point P. The frame B
can be obtained by translation of the frame initially coincident with the frame A by a
vector rAB with respect to frame A (indicated by the superscript). The translated
frame axes are shown by the broken lines. Next, the translated frame is rotated by a
3 3 matrix RAB . This is a matrix whose columns are the co-ordinates of the unit
vectors of axes xB, yB, zB in the co-ordinate frame A (or the translated frame). It is an
orthogonal matrix we spoke about in Sect. 9.5.1.
These transformations can be represented compactly by a 4 4 matrix of
homogenous co-ordinates, which has the following structure
R BA r BA
TBA =
9:130
0
1
416
9 Multibody Dynamics
9:131
r
1
9:132
and using the homogenous transformation matrix (9.130) we can write (9.131)
compactly as
^rAP TAB^rBP
9:133
9:134
where R is a rotation transformation about an axis by an angle, and D is a translation transformation along an axis by a value. The product of the rst two matrices
may be denoted as
0
chi
B shi
Screwz di ; hi Rz hi Dz di B
@ 0
0
shi
chi
0
0
1
0 0
0 0C
C
1 di A
0 1
9:135
1
B0
Screwx ai ; ai Rx ai Dx ai B
@0
0
0
cai
sai
0
0
sai
cai
0
1
ai
0C
C
0A
1
9:136
417
Ti1
Screwz di ; hi Screwx ai ; ai
i
9:137
Ti1
i
chi
B shi
B
@ 0
0
shi cai
chi cai
sai
0
shi sai
chi sai
cai
0
1
ai chi
ai shi C
C
di A
1
9:138
sh2
ch2
0
0
ch2
B
sh2
T12 B
@ 0
0
0
ch3
B sh3
2
T3 B
@ 0
0
0
0
1
0
ch4
B sh4
3
B
T4 @
0
0
0
ch5
B
sh5
T45 B
@ 0
0
0
sh1
ch1
0
0
0
0
1
0
ch1
B
sh1
T01 B
@ 0
0
ch6
B sh6
5
T6 B
@ 0
0
9:139a
1
a2 ch2
a2 sh2 C
C
d2 A
1
9:139b
1
a3 ch3
a3 sh3 C
C
0 A
1
9:139c
0
0
1
0
sh3
ch3
0
0
1
0
0C
C
0A
1
0
0
1
0
sh4
ch4
0
0
1
03
0C
C
d4 A
1
9:139d
0
0
1
0
sh5
ch5
0
0
1
0
0C
C
0A
1
9:139e
1
0
0C
C
d6 A
1
9:139f
sh6
ch6
0
0
0
0
1
0
418
9 Multibody Dynamics
9:140
The position of the TCP in the base frame can be found as the last column of this
transformation matrix. Thus, we nd
x0tcp ch1 a3 ch23 d4 sh23 a2 ch2 d2 sh1
d6 ch1 ch23 ch4 sh5 sh23 ch5 sh1 sh4 sh5
y0tcp
9:141
Link
Mass
a
Link 1
Link 2
Link 3
Link 4
Link 5
Link 6
a
According to
13.0
17.40
4.80
0.82
0.34
0.09
Tarn from
xC
0
0.3638
0.0203
0
0
0
[22]
yC
zC
0.309
0.006
0.014
0.019
0
0
0.004
0.0774
0.070
Ixx
a
Link 1
1.100
Link 2
0.130
Link 3
0.066
Link 4
1.80 103
Link 5
0.30 103
Link 6
0.15 103
a
According to Tarn [22]
Iyy
Izz
0.177
0.524
0.086
1.30 103
0.40 103
0.15 103
1.100
0.539
0.0125
1.80 103
0.30 103
0.04 103
0
0.032
419
Joint 1
Joint 2
Joint 3
Joint 4
Joint 5
Joint 6
1.6
1.6
1.6
3.9
3.9
3.9
0.0048
0.0048
0.0048
0.0039
0.0039
0.0039
0.19
0.19
0.19
0.12
0.12
0.12
0.260
0.260
0.260
0.090
0.090
0.090
4.20
8.1
3.15
200 106
200 106
200 106
18 106
18 106
18 106
97.6
186.4
89.4
24.2
20.1
21.3
6.3
5.5
2.6
1.3
1.0
1.2
62.61
107.36
53.69
76.01
71.91
76.63
9.6.2
9.6.2.1
We next give a brief description of the model. The complete model is held in the
BondSim program library under the project name PUMA 560. The system level
Bond Graph model is shown in Fig. 9.56. It consists of three interconnected main
components: Controller, Manipulator and Workspace. To the right of
420
9 Multibody Dynamics
these components are x y displays, which monitor how the system behaves during
the simulation.
Below these displays a component in the form of a ring is inserted, which will be
used for inter-process communication (IPC) between the PUMA simulation and its
3D visualization. BondSim supports building and running of the named pipe connections with a visualization application BondSimVisual, running on the same or a
remote computer connected by a local net. Using this it is possible to visualize
motion of the PUMA robot during the simulation in a 3D virtual scene. The signals
connected on the left side of the IPC supplies the joint angles calculated by the
model during the simulation. These angles are regularly (e.g. every 4050 ms)
picked and packed into a message, which is then sent by the pipe to the visualization application. After redrawing the scene it responds by sending back information e.g. on the new position of TCP. These data are picked by the signal lines
shown on the right side of IPC component and sent to a display. We will discuss
this in more detail in the next section on visualization.
Below the robot model there is the Direct Kinematics component. It is not
part of the model but is used for the model testing. It evaluates the co-ordinates of
TCP given by (9.141) using for the joint angles the values generated by the
Manipulator. The calculated co-ordinates are compared with the corresponding
values generated by the robot model in the Workspace component. The generated
values of the co-ordinates and differences from the values evaluated by the direct
kinematics are displayed in the corresponding plots.
The Input component on the left generates the joint angles input trajectories
that robot arm should follow. We will discuss it when analyzing the design of the
Controller which we will use to drive the PUMA 560 model.
421
9.6.2.2
PUMA 560 (Fig. 9.54) is a six degree of freedom (DOF) robot designed as an
anthropomorphic (human like) structure. It consists of an arm and wrist with hand.
The arm is formed of three links: the body, upper arm and forearm. The body (Link
1) can rotate about a revolute joint in the immobile base. The upper arm (Link 2) is
connected to the body by the shoulder revolute joint, and the forearm (link 3) to the
upper arm by the elbow revolute joint. These last two joints have parallel rotation
axes, orthogonal to the body axis.
The forearm at its end carries a wrist with hand. The wrist is a spherical joint
realized as three links which can rotate about revolute joints with orthogonal axes
intersecting at a point (Fig. 9.57). This arrangement is used also in many other
industrial robots. The last link plays the role of a hand and enables connecting
different tools, which robot uses in different applications. Its central point is known
usually as the TCP (tool central point).
422
9 Multibody Dynamics
The links are rotated by the servo drives acting at the joints. The arm is
responsible for positioning the wrist in space, and the last three links comprising the
wrist orient the hand in space. For more details see e.g. [9].
The model of the Manipulator is shown in Fig. 9.58. It consists of two
components: the Arm and Wrist. The rst models the robot hand described above
and the other the spherical wrist with hand. There are several bond power and signal
lines between these components and outside components. Their connection points
the portsare compounded. We used this approach in the previous models too,
but in the multibody models it is very important. Otherwise, we will have to deal
with forest of connecting bond and signal lines. It is not only very difcult to
represent this in a tidy and clear way, but it is also prone to errors.
Using the component model approach and compounded ports and bonds we
hope that rather complex multibody models of the robot can be represented in a
clear and understandable way. The bonds on the left side in Fig. 9.58 represent the
efforts (moments) and flows (angular velocities) of the servo drives (motors and
gears) to the joints. The signal on the right transmit out the collected joint angles.
The power transfer in the vertical direction shows the power transfer from the
workspace thorough the links to the robot tip and again back to the workspace.
Figure 9.59 shows models of the Arm and Wristcomponents. The models
follow the structure of the corresponding robot components in Fig. 9.54. They
423
consist of series connections of the joints and links. The rotation of the links about
the joints is represented as a series of the rotation transformations.
The left vertical bonds describe the efforts (forces and moment vectors) and the
flows (liner and angular velocities) on the links at the joints. They are expressed in
the link body frames. Therefore it is necessary to transform these quantities from
one link frame to the next one using the corresponding rotation matrices as discussed in Sect. 9.5.2.
There is also power transfer in the opposite direction. These bonds represent the
transformations of the effort/flow quantities at the robot free end and at the center of
mass of the links across the joints to the workspace. For instance to nd the position
of the TCP in the working (operating) space we must know its velocity in this
space. The weights of the links are well dened in the workspace. Thus we need to
transform them along with the velocities of the centers of masses of the links
between the workspace and the links frames. The force on the robot tip is also
dened in the workspace (here it is zero) and should be transformed into the last
link frame as well.
To achieve these transformations we use an approach that has the root in Damic
[20]. Thus we apply transformation in such a way to support the object oriented
paradigm. A link does not know anything about the other links. Therefore we
cannot apply all rotation transforms needed to evaluate e.g. the weight of a link,
because it is necessary to supply the information on other rotation matrices and the
values of the rotation angles as well. Thus we apply only the transformations in a
joint that the joint knows about, i.e. its own rotation. Therefore we systematically
apply the rotation transformation going from the last joint to the rst one. Gradually
we build the compound bonds that dene quantities transformed by the joint.
Thus starting from the last link of the Wrist (Fig. 9.59 right) we draw a bond
from the free end of the link (TCP) and connect it to the Joint 6. We connect at
the left the bond connecting the Link 6 center of mass port. Inside the Joint 6
component these bonds are connected to the components that apply the corresponding rotation transformations. At the other side of these components the bonds
are connected to the corresponding joint document port. At this port, on the outside
of the Joint 6 we get the compounded bond that is composed of these bonds. It is
farther connected to the Joint 5 component. Again a bond from the centre of the
mass port of the Link 5 is connected to Joint 5 at the left of the previous bond.
These operations are continued systematically until the workspace is reached.
Note that bonds do not carry anything with them. They only dene the ports that
are connected and in that way the quantities that are transformed. The compounded
bonds dene in a concise way only the component ports that participate in these
operations.
To illustrate how this is coded in Bond Graphs we consider Joint 2 object of
Fig. 9.59 left. It has a general structure of the revolute joints discussed in Sect. 9.5.4
and shown in Fig. 9.48. The Joint rotation component changes from joint to
joint. For Joint 2 it has the form shown in Fig. 9.60.
424
9 Multibody Dynamics
In this joint the rotation transformations are applied by component R21 discussed shortly. On the left the joints efforts and flows from the previous link frame
are transformed to the next link frame. On the right are the transformations we are
speaking about. The rst one from the left are the transformation of the efforts and
flows from the center of mass of the previous Link 2. The component denoted as
R21 5 contains the transformations connected to the bonds contained in the
compound bond from the previous Joint 3 (see Fig. 9.59 left). Number 5 in the
component name denotes that there are ve transformations applied to the efforts
and flows of the links 36 centres of masses ports, and of the TCP in that order.
Later, in the Workspace component, this compounded bond is unpacked by
extracting the bonds in just opposite order as they were packed in. Thus all this is
relatively simple, only some discipline is necessary!
Model of R21 is shown in Fig. 9.61. It describes the transformation given by
f 1 R21 f 2
e2 RT21 e1
9:142
425
The rotation matrix is given by (9.139b) and has the following form
0
R21
cos h2
@ sin h2
0
sin h2
cos h2
0
1
0
0A
1
9:143
9.6.2.3
Model of Workspace
We will now direct our attention the Workspace component. This component
models the dynamics of the robot as seen in the basic frame. Its structure is shown
in Fig. 9.62 left.
The component Robot Base consists simply of Source Flow (SF) components
which conrm that the linear and angular velocity of the base is zero. Thus, the
robot base is xed in its initial position.
The next port is on the outside connected to the manipulator by the compounded
bond we spoke about. Thus, inside the Workspace component we unpack it by
dening two components.
The rst one is denoted as CM1 and represents the dynamics of motion of the
centre of the mass of the rst link (see Sect. 9.5.3 and Fig. 9.43). It is connected by
a bond to the right Workspace port. To establish the correct connections we create a
new component and connect it to the right the CM1 connection. It is denoted simply
as Other Part 6 indicating that it must contain six other componentsve
components representing the dynamics of the centres of the mass of the other links,
and a TCP object. We add these components gradually one by one. The structure of
the last component Other Part 2 is shown in Fig. 9.62 right. It contains CM6
component describing the dynamics of the centre of the mass of the last link and the
TCP component. This last component consists simply of three 1-junstions
426
9 Multibody Dynamics
connected to the component port. These junctions represent the nodes of x, y and
z velocity components of the TCP in the basic frame. The information on these
quantities is transferred out and connected to corresponding integrators as shown in
Workspace document in Fig. 9.62. The Free End component denes that the
forces on the TCP are zero, i.e. the robot is free of contacts with other objects.
This completes description of the model of PUMA 560 robot. We will direct our
attention now to the problem of its control.
9.6.2.4
In order to drive the robot to follow the required joint angles trajectories we need a
controller. We develop here a simple controller based on the independent joint
control concept. This is a very common control concept in robotics. A good review
of robotic control approaches can be found elsewhere (see e.g. [9]).
The model of the Controllercomponent is shown in Fig. 9.63. It consists of
six identical drivers, which as input receive the values of the joint angles references
generated by the Input component (Fig. 9.56). The drivers power ports are
connected internally to the controller power port, which is further directly connected to the joint ports of the manipulator (see Figs. 9.56 and 9.58).
The Controller upper port is connected to the Manipulator output. The
connecting signal is the compounded one consisting of the ordered signals connecting the joint rotation angles from the rst to the last. On inside the port is
connected to the upper input signal ports of the drivers. The connections are ordered
from the left to the right corresponding to the structure of the signal line. This
insures that Driver 1 receives information on the rst joint angle (1), Driver 2
from the second (2), and so on.
The drivers have identical models. We designed them similarly to the independent joint controller described in Corke [23]. Figure 9.64 shows the driver
position loop. It consists of the Velocity Loop and the gain (function)
427
component Kp dening a Pcontroller with proportional gain Kp. Note that the
feedback signal is really subtracted from the reference input. This is not clearly seen
in the gure. (The signs of a summator input ports are set by double-clicking the
ports and selecting the corresponding sign + or .)
The Velocity Loop is shown in Fig. 9.65. The input to the loop is the angular
velocity required by the position loop (Fig. 9.64). The feedback signal is the joint
angular velocity taken at the driver power port. It is again subtracted.
The loop uses a PI controller to control the joint servo driver. The Kv and Ki are
corresponding proportional (velocity) and integration gains. The PUMA 560 servo
driver consists of the controlled DC motors, which through the gears, drive the
robot joints. In Sect. 8.4 we analyzed a voltage controlled DC motor. Here, we will
use the current controlled motor. The current control is implemented by an ideal
current source
ia Ka uc :
9:144
428
9 Multibody Dynamics
9:145
where Tm is developed motor toque and Km the motor (torque) constant. Combining
(9.144) and (9.145) we obtain
Tm Kt Ka uc
9:146
9.6.3
We will now conduct the simulations of the developed PUMA 560 model. The
robot parameters used in the model are dened in Sect. 9.6.1. We assume that
initially all the joint angles are zero (the zero pose). In addition we need the initial
position of TCP which is used in the integrators in the Workspace (Fig. 9.62). In the
zero pose from Fig. 9.54 we nd the following values:
xTCP 0 a2 a3 ;
yTCP 0 d2 ;
zTCP 0 d4 d6
These values agree with the values obtained from (9.141) for zero values of the
joint angles.
Finally we need to dene the trajectories of the joint angles, which we wish the
robot to follow. We will dene these trajectories using the trapezoidal velocity
prole with constant acceleration and deceleration at the beginning and at the end
(Fig. 9.66). During the acceleration period the velocity changes linearly and at end
of this interval tc it reaches the value
v c ac t c :
9:147
The angle changes in this interval parabolic and reaches the value
1
1
qc ac tc2 vc tc :
2
2
9:148
429
In the mid interval from tc to tf tc the angle changes with a constant velocity,
usually termed the cruising velocity. This velocity is equal to value reached at the
end of acceleration period. Finally there is deceleration interval at end tf of which
the angle reaches the nal value qf. The velocity prole is symmetric about mean
time tm = tf/2, and the corresponding value of the angle qm = qf/2. This value of the
angle can be expressed using the velocities as
1
1
1
qf vc tc vc tf tc :
2
2
2
9:149
qf vc tf tc
9:150
or
qf
:
tf
9:151
430
9 Multibody Dynamics
t c vc vm
tf
vc
vc
1
vm
vc
vm
9:152
9:153
We assume that vc = 1.5 vm. From (9.152) follows that tc = tf /3. As nal values
of the joint angles the following are taken:
h1 100 ; h2 100 ; h3 80 ; h4 120 ; h5 60 ; h6 150
After some experimenting with controller drives with the robot and without it the
following values of the controller gains are accepted: Kp = 50, Kv = 50, and
Ki = 10. These constants give accepted results as will be shown shortly. The
controller can be improved further by adding feed forward actions, gravity compensations or other changes. We leave it to the reader.
We will analyze two cases. In the rst we will simulate motion of PUMA 560
under quick input trajectories with nal time of 1 s. Before running the simulation
we need to build the model. Below are given the basic information on the characteristics of mathematical model generated (see Chap. 5 for details):
Number
Number
Number
Number
of
of
of
of
Hence, the model contains rather a large number of equations. This is expected
because the robot model developed is a multi-body model in a descriptive form. It is
based on velocity formulation and this as is well known leads to index 2
differential-algebraic model, a pretty challenging task. The partial derivative matric
(Jacobian) is very sparse containing on average 2.8 elements per row. Thus, the
most of equations of the model are very simple; some are not of course. Also the
leading coefcient matrix is rather small, which indicates that we mainly deal with
the algebraic equations. We can examine the model in more detail by opening the
project PUMA 560 from library and applying methods described in Chap. 5.
After the model is successfully built, we start simulation. We use the following
parameters: simulation time 1 s, maximum and output step 0.001 s, default error
tolerance (1e6) and select as method BDF method with the local error control. The
simulation runs is rather quick. Below is given the simulations statistics:
Number of integration steps 1087
Number of function (equations) evaluations 2207
431
Simulation was conducted on a Toshiba laptop with Intel i7 (four core) 2.0 GHz processor, and
16 GB RAM, under Windows 7.1 operating system.
432
Fig. 9.68 The response
curves for the last three joint
angles
9 Multibody Dynamics
433
The simulations are repeated with larger input trajectory nal time of 5 s. We set
simulation time to 5 s, and maximum and output intervals to 0.005 s. The new
response curves are shown in Figs. 9.71 and 9.72.
We can see that the joint angles now much better follow the input trajectories
and both curves in the plot appear as a single curve. The other results are similar to
that of the previous simulation. The elapsed time of the simulation increases now
from 1.25 to 3.39 s.
434
9 Multibody Dynamics
9.7
9.7.1
3D Visualization of Robots
Concept of 3D Visualization
In the previous Sect. 9.6 we dealt with the dynamic of a PUMA robot and its
control. It gives a deep insight into the behavior of the robot. It could be further
improved by adding flexibility of the links, the robot behavior at contact with
surrounding objects and similar. The results are presented in the form of different
plots and qualitative and quantitative data. For people not interested too much in the
mathematic details this is rather esoteric. The visualization of the robot motion in
space is perhaps more informative.
Many robot manufacturers use 3D robot models for off-line programming, e.g.
ABB Robot studio [24], Fanuc RoboGuide [25], KUKA KukaSim [26] and others.
Perhaps the rst software of this kind was Grasp, developed by BYG Systems Ltd.
[27]. These software applications were designed with the specic goals in mind and
are based on geometric and kinematical models.
The geometrical models driven kinematically are useful for solving some
problems, such as off line programming, but cannot simulate the real behaviour of
the robots. It is quite complicated, however, to have all in one application, both the
geometry and dynamics. Thus, we developed a separate application
BondSimVisual, which supports developing of 3D geometric models of robots and
similar mechanical systems and their rendering on the computer screen in a virtual
scene. The simulation of robot motion based on Bond Graph models can be
visualized by the motion of a virtual robot on the computer screen.
435
The communication between these two model spaces is established through the
support of the corresponding modelling programsBondSimVisual and BondSim.
This is realized in the form of IPC (Inter Process Communication) between these
two applications, which is based on the named pipes [28], Fig. 9.73.
The conguration of the named pipe IPC used is shown in Fig. 9.74. The server
(the BondSimVisual) is responsible for creating the pipe having a specied name. It
also creates a special processing thread, which enables that the program simultaneously with its other task listens for the message from the client. The server also
asks the client to connect. When the client (the BondSim) connects the two-way
communication is established and simulation can start.
As already discussed in Sect. 9.6.2BondSim supports exchange of data by using
a special IPC interface component (Fig. 9.56). Its task is to collect the data from the
Bond Graph model, pack it and send it with a message to the server. In the same
vein after receiving the messages from the server it unpacks it and makes it
available to the dynamic model. During the simulation the dynamic model regularly
sends the messages containing information e.g. on the current values of the joint
angular or linear displacements to the server. After receiving them the server
extracts the content of the pack, reevaluates the 3D virtual model and renders it to
the screen. If asked it can calculate the position of some point in a robot link and
return its co-ordinates in the form of the message packs to the client. The IPC
communication exists so long as the simulation session is active. Thus, it is possible
to repeat different simulation runs. When the session is closed, the IPC communication and the servers listening tread are closed as well.
The 3D virtual and Bond Graph dynamic models represent two different, but
closely related views of the same problem. As discussed above they are generated
by two different processes that communicate one with the other. However, these
processes are running in different time domains. There is also a third process, that of
the user. When there is the simulation of the dynamic model only the problem of the
time scales usually is not a severe one. The term simulation time denotes the real
436
9 Multibody Dynamics
time of the physical process. The time that is necessary to execute simulation is
basically different and can be much shorter or much longer. But, there is no
confusion.
However, when there is visualization the situation is quite different. The user
expects that the time that the objects move over the screen corresponds to the user
time scale. To try to solve this problem the currently adopted approach is described
below.
We do not allow the simulation runs as quickly as the processor can execute it,
i.e. we will slow it down. Therefore, in the Simulation Option dialog (see e.g.
Fig. 6.21) there is a simulation parameter Output delay (ms). It is by default equal to
zero. But, when there is the visualization and we wish to slow down the simulation,
we set it to some value, e.g. 50 (ms). This means that the simulation, after it
generates the outputs, packs the respective data into a message and updates the
virtual scene every 50 ms of the real-world time. Thus, the simulation shoots a new
picture every 50 ms. Note that shooting the picture every 50 ms corresponds to
frequency of 1/0.050 = 20 pictures per second. Thus the virtual scene is refreshed
20 times in second. We are free to use a different delay time and/or different
simulation output interval. Note that the lm makers in order to generate a continuous motion picture for human eyes usually shoot 2025 picture frames per
second. It is usually explained by the persistence of human eyes. The computer
games screens are updated typically 30 times per second.
9.7.2
437
Fig. 9.76 The basic forms: aCylinder. bCube. cSphere. dPolyPrism. ePolyDataObject
438
9 Multibody Dynamics
the complete computer screen. Their properties can be dened, such as colours. The
actors receive data from the mappers. However, they can receive the user inputs
from the transforms, which dene the joint rotation or sliding. Their input data, the
angular or sliding displacements are, however, dened by an external program such
as BondSim.
To dene the conguration of the system for visualization we use scripts.
A script consists of commands that BondSimVisual uses to create the visualization
pipeline for the problem. We will illustrate this on the problem of visualization of
Puma 560 robot analyzed in the Sect. 9.6. The script is shown in Textbox 9.1 on the
following two pages.
We dene the coordinate frames differently from we did in Sect. 9.6.1, where we
used the Denavit-Hartenberg scheme. Here we will use an alternative scheme,
which is similar to that of Cork [23], and is based on a series of elementary
transforms. We start from the world coordinate frame Oxwywzw, which denes the
3D virtual space (Fig. 9.77). It has the origin in the middle of the scene, z-axis
directed out of the screen, x-axis to the right, and y-axis upward. We can dene the
robot base coordinate frame x0y0z0 as usual, with x-axis out of the screen, y-axis to
the right and z-axis upward. It is dened relative to the world frame.
439
440
9 Multibody Dynamics
polyprism Puma560-2poly01
height 110.000000 axis Y
0.000000 0.000000
arc to 149.000000 -57.000000 radius -223.246063 tolerance 1.000000
arc to 298.000000 0.000000 radius -223.246033 tolerance 1.000000
298.000000 196.000000
224.000000 619.000000
arc to 182.425995 671.353027 radius -76.875259 tolerance 1.000000
arc to 115.573997 671.353027 radius -76.875053 tolerance 1.000000
arc to 74.000000 619.000000 radius -76.874718 tolerance 1.000000
0.000000 196.000000
0.000000 0.000000;
set Puma#2 add Puma560-2poly01 ( shift X -172 Y 200 Z 149 euler 0 90 0 ) ;
render Puma#2 color 0.9 0.9 0.9 ;
polyprism Puma560-3poly01
height 88.000000 axis Y
0.000000 0.000000
arc to 76.000000 -32.000000 radius -132.999954 tolerance 1.000000
arc to 152.000000 0.000000 radius -132.999954 tolerance 1.000000
99.190002 437.000000
12.190000 437.000000
0.000000 0.000000;
set Puma#3 add Puma560-3poly01 ( shift X -76 Y -44 Z -85.5 ) ;
render Puma#3 color 0.90 0.90 0.90 ;
polyprism Puma560-4poly00
height 88.000000 axis Y
0.000000 0.000000
57.000000 0.000000
57.000000 10.000000
arc to 69.594002 45.959000 radius -41.500034 tolerance 1.000000
arc to 47.549999 77.035004 radius -41.499989 tolerance 1.000000
arc to 9.450000 77.035004 radius -41.500027 tolerance 1.000000
arc to -12.594000 45.959000 radius -41.499992 tolerance 1.000000
arc to 0.000000 10.000000 radius -41.500000 tolerance 1.000000
0.000000 0.000000 ;
cube Puma560-4cu00 87.000000 88.000000 40.000000;
set Puma#4 add Puma560-4poly00 ( shift X -28.5 Y -44 Z -42.5 )
Puma560-4cu00 ( shift X -43.4 Y -44 Z -81.5 ) ;
render Puma#4 color 0.4 0.4 0.4;
cylinder Puma560-6cyl00 diameter 53.000000 resolution 8 length 20.000000;
cube Puma560-6cu00 12 13.717000 10.000000 ;
set Puma560-6set00_set add Puma560-6cu00
Puma560-6cyl00 ( shift Z -15 ) ;
set Puma560#6 add Puma560-6set00 ( shift Z 46 );
render Puma560#6 color 0.25 0.25 0.25;
Probe Point1 Puma560#6( shift z 56) refer Puma560 ;
!-------------------------End of Robot Puma 560 --------------------------------------------------------
441
We can obtain the base frame from the world frame by applying the rotations.
We use Euler zyz transform. Assuming the base frame is coincident with the world
frame, we rotate it by 90 about z-axis, and by 90 about new y-axis. The joints
axes are dened similarly by a series of the elementary transformations. This is
dened in the script in Box 9.1 by the robot command. This command denes rst
the name of the robot simply as Puma, and then the base coordinate frame using
euler zyz transform. The joint 1 frame is dened with respect to the base by a
translation (shift) along z-axis, and then applying revolute Z transform. The rst is a
constant transform dened by the height of the robot shoulder above the floor
(672 mm). The other transform denes that the joint is a revolute, with the rotation
axis along z-axis. The rotation angle is not known and will be generated by simulation of the robot system. However, its initial value, which denes the initial
posture of the robot arm, is dened by the last part of the command. In the similar
way joint 2 is dened with respect to the previous joint and so on until the tcp (tool
central point) is dened. The Initial function species the initial values of the all
joint displacements in the order as they appear in the command.
The joint statement generally can have the following form:
Joint n Pre transform
Joint transform
Post transform
442
9 Multibody Dynamics
BondSimVisual program we open the program (Fig. 9.78), select the command
Import in menu File and choose the Project subcommand. A Windows Open le
dialogue opens, which we can use to browse the system to nd the script le we
wish to import. When we nd it, we select it and press the OK button. A project
import dialogue opens with the name of the le we have just selected (Fig. 9.78).
We can accept the le name as the name of the new project (or change it if we
wish) and click OK; the le will be copied and stored into the project database
under the accepted project name. This project name can be used to open the project
le and render the robot to the screen. Thus, to open Puma 560 robot, we open rst
the BondSimVisual, click the Open toolbar button and from the projects combo box
select the Puma 560. A new tabbed document opens showing the Puma 560 robot
arm in its initial posture (Fig. 7.79).
The robot arm is shown as seen when viewing along the world z-axis. The
BondSimVisual implements also the VTKs interactor, which allows rotating the
complete scene by mouse clicking. This way we can change viewing direction at
will (some other operations are supported as well).
The project le (script) of 3D Puma 560 model is relatively long because it is
built of elementary components such as the cylinders, cubes, etc. It could be much
shorter if the bodes are designed by suitable 3D CAD tool such as Catia, Solid
Works, or others, and imported in the form of stl les.
443
Fig. 9.79 Visualization of Puma 560 in initial posture and viewing along the world z-axis
To illustrate this point we consider 3D visual model of ABB IRB 1600 robot
[30]. Its visualization script is shown in Box 9.2. It has a similar structure as the
Puma 560 script in Box 9.1, but uses the parts, which represent the geometry of the
robot. It is shorter than the Pumas script.
The 3D model was assembled from CAD drawings of the parts, which are
downloaded from the robot manufacturer web page [31]. To implement the script it
has been edited and saved as a text le and then imported similarly as we did with
the Puma script. We assign to it the project name ABB IRB1600_12. In addition to
the script we need to import the downloaded parts les as well. To do this, we
apply the Import command, and then select the CAD Part.subcommand. In the
dialogue window that opens we dene the corresponding project name, to which
the parts belong. In this case it is ABB IRB1600_12. Then, again the Open le
dialogue appears, which we use to nd and transfer the CAD parts stl les. These
names are used as the parts names in the script in Box 9.2.
444
9 Multibody Dynamics
Box 9.2
!-------- ABB IRB1600_12 -----------------------------------------Robot ABB_IRB1600_12 (euler -90.0 -90.0 0.0)
Joint 1 revolute Z
Joint 2 (shift x 150 z 486.5 ) revolute y
Joint 3 (shift z 475) revolute y
Joint 4 ( shift x 600 ) revolute x
Joint 5 revolute y
Joint 6 revolute x
initial (0.0 0.0 0.0 0.0 0.0 0.0) ;
Part IRB1600_X-120_m2004_rev0_01-1_Body0;
Part IRB1600_X-120_m2004_rev0_01-7_Body1;
Part IRB1600_X-120_m2004_rev0_01-4_Body2;
Part IRB1600_X-120_m2004_rev0_01-5_Body3;
Part IRB1600_X-120_m2004_rev0_01-3_Body4;
Part IRB1600_X-120_m2004_rev0_01-2_Body5;
Part IRB1600_X-120_m2004_rev0_01-6_Body6;
Set ABB_IRB1600_12 add IRB1600_X-120_m2004_rev0_01-1_Body0 ;
Render ABB_IRB1600_12 color 0.89 0.423 0.039;
Set ABB_IRB1600_12#1 add IRB1600_X-120_m2004_rev0_01-7_Body1 ;
Render ABB_IRB1600_12#1 color 0.0 0.6 0.6 ;
Set ABB_IRB1600_12#2 add IRB1600_X-120_m2004_rev0_01-4_Body2
(shift x -150 z -486.5 );
Render ABB_IRB1600_12#2 color 0.0 0.2 0.8 ;
Set ABB_IRB1600_12#3 add IRB1600_X-120_m2004_rev0_01-5_Body3
(shift x -150 z -961.5 );
Render ABB_IRB1600_12#3 color 0.89 0.423 0.039 ;
Set ABB_IRB1600_12#4 add IRB1600_X-120_m2004_rev0_01-3_Body4
(shift x -750 z -961.5 );
Render ABB_IRB1600_12#4 color 0.1 0.1 1.0 ;
Set ABB_IRB1600_12#5 add IRB1600_X-120_m2004_rev0_01-2_Body5
(shift x -750 z -961.5 );
Render ABB_IRB1600_12#5 color 1.1 1.1 1.1 ;
Set ABB_IRB1600_12#6 add IRB1600_X-120_m2004_rev0_01-6_Body6
(shift x -750 z -961.5 );
Render ABB_IRB1600_12#6 color 0.1 0.1 0.1 ;
Probe Point1 ABB_IRB1600_12#6( shift x 65) refer ABB_IRB1600_12;
!------------- End --------------------------------------------------
445
Fig. 9.80 ABB IRB 1600 robot in the initial posture (and slightly rotated to the right)
Figure 9.80 shows 3D visual model of robot ABB IRB 1600 in the initial
posture, slightly rotated to the right (by the mouse clicking).
9.7.3
446
9 Multibody Dynamics
Fig. 9.81 The sequence of Puma 560 robot postures during the simulation
447
sequence of Puma 560 posturesthat were generated are shown in Fig. 9.81. The total
elapsed time is 2.2 s.
Figure 9.82 shows the co-ordinates of the Tcp trajectory during the simulation.
The thin lines represent the coordinates evaluated by the simulation, and the thick
ones that returned by the IPC pipe from the visualization process.
We may see that the curves are shifted in time by the 50 ms delay we used for
the generation of the visual scene. We may also note that the visually generated
curves are not smooth ones because they are generated every 0.050 s. Otherwise
they agree in the values.
References
1. Wittenburg J (1977) Dynamics of systems of rigid bodies. BG Teubner, Stuttgart
2. Haug EJ (1989) Computer-aided kinematics and dynamics of mechanical systems. Allyn and
Bacon, Boston
3. Schiehlen W (1990) Multibody systems handbook. Springer, Berlin
4. von Schwerin R (1991) Multibody system simulation: numerical methods, algorithms, and
software. Springer, Berlin
5. Shabana AA (1998) Dynamics of multibody systems, 2nd edn. Cambridge University Press,
Cambridge
6. Rabier PJ, Rheinboldt WC (2000) Nonholonomic motion of rigid mechanical systems from a
DAE viewpoint. SIAM, Philadelphia
7. Borri M, Trainelli L, Bottasso CL (2000) On representation and parameterizations of motions.
Multibody Syst Dyn 4:129193
8. Craig JJ (1986) Introduction to robotics: mechanics and control
9. Sciavicco L, Siciliano B (1996) Modeling and control of robot manipulators. McGraw-Hill,
New York
448
9 Multibody Dynamics
10. Breedveld PC (1984) Physical systems theory in terms of bond graphs, PhD thesis, Technische
Hochschool Twente, Entschede
11. Karnopp DC, Margolis DL, Rosenberg RC (2000) System dynamics: modeling and simulation
of mechatronic systems, 3rd edn. Wiley, New York
12. Fahrenthold EP, Wargo JD (1994) Lagrangian bond graphs for solid continuum dynamics
modeling. ASME J Dyn Syst Measur Control 116:178192
13. Hairer E, Wanner G (1996) Solving ordinary differential equations II, stiff and
differential-algebraic problems, 2nd Revisited edn. Springer, Berlin
14. Lioen WM, Swart JJB Test set for initial value problem solvers, Amsterdam. Available at
http://www.cwi.nl/cwi/projects/IVPteseset/
15. Den Hartog JP (1956) Mechanical vibrations, 4th edn. McGraw-Hill, New York
16. Pan CH, Moskwa JJ (1996) An analysis of the effects of torque, engine geometry, and speed
on choosing an engine inertia model to minimize prediction errors. ASME J Dynamic Syst
Measur Control 118:181187
17. Hesterman DC, Stone BJ (1994) A systematic approach to the torsional vibration of
multi-cylinder reciprocating engines and pumps. Proc Inst Mech Eng 208:395408
18. Damic V, Kesic P (1997) A system approach to modelling and simulation of multibody
systems using acausal bond graphs. In: Marovic P, Soric J, Vrankovic N (eds) Proceedings of
the 2nd congress of Croatian Society of Mechanics, Supetar, Croatia, pp 415422
19. Damic V, Montgomery J, Koboevic N (1998) Application of automated modelling in design.
In: Marjanovic P (ed) Proceedings of 5th international design conference, Dubrovnik, Croatia,
pp 111116
20. Damic V (1987) An approach to computer aided design of industrial robots using simulation
package simulex. In: Vukobratovic M (ed) Proceedings of 5th Yugoslav symposium on
applied robotics and flexible automatization, Bled, pp 2839
21. Armstrong B, Khatib O, Burdick J (1986) The explicit dynamic model and inertial parameters
of the PUMA 560 Arm. In: Proceedings of the IEEE international conference robotics and
automation, vol 1, San Francisco, USA, pp 510518
22. Corke PI, Armstrong B (1994) A search for consensus among model parameters reported for
the PUMA 560 Robot. In: Proceedings of the IEEE international conference robotics and
automation, San Diego, pp 16081613
23. Corke P (2011) Robotics, vision and control fundamental algorithms in matlab. Springer,
Berlin
24. RobotStudio, http://new.abb.com/products/robotics/robotstudio. Accessed 09 May 2015
25. RoboGuide,
http://www.fanucamerica.com/products/vision-software/ROBOGUIDEsimulation-software.aspx. Accessed 09 May 2015
26. KUKASim,
http://www.kukarobotics.com/en/pressevents/productnews/NN_040630_
KUKASim.htm. Accessed 09 May 2015
27. Grasp 10, www.bygsimulations.com. Accessed 27 May 2015
28. Vuskovic M (2014) Operating systems, inter-process communications. http://medusa.sdsu.
edu/cs570/Lectures/Chapter9.pdf. Accessed Sept 2014
29. Schroeder W, Martin K, Lorensen B (1998) The Visualization toolkit, an object-oriented
approach to 3D graphics, 2nd edn. Prentice Hall, Upper saddle river, NJ
30. Cohodar M (20122015), Private communications. University of Sarajevo, Faculty of
Mechanical Engineering, Sarajevo, Bosnia and Herzegovina
31. http://new.abb.com/products/robotics/industrial-robots/irb-1600/irb-1600-cad. Accessed Feb
2015
Chapter 10
Continuous Systems
10.1
Introduction
Continuous systems are important in many engineering disciplines, such as structural mechanics, fluid mechanics, thermal systems, electrical eld etc. They are
important in mechatronics applications too, i.e. control of robotic manipulators
taking account of flexibility of mechanical structure, sensor design, and
micro-mechanics systems design. Solving such problems requires some form of
discretisation. The methods that are generally used are nite difference and nite
element. The both start with partial differential equations that describe the problem,
but differ in the discretization. The rst method uses suitable numerical approximation of the equation on a selected grid. Finite element methods, on the other
hand, are based on discretization of the physical problem domain, dividing a
continuous system or a continuous component into nite elements. Motion of
elements typically is based on an assumed displacement eld used to formulate the
governing equations of element motion. The equations are formulated using different methods, such as the Lagrange equations, the DAlembert-Lagrange principle, the Galerkin method, or others. Finite element methods nowadays dominate the
scene in solid mechanics; many extremely powerful software packages based on
these methods are available to solve various engineering problems. There are also
related methods, such as nite-volume and boundary-element methods that are
popular in fluid mechanics and the electrical engineering and eld theory. We will
not go into details of these methods here, but suggest that the interested reader
consult suitable references. It should be noted that the available methods are not as
powerful when applied to the mixed problems, e.g. solid body fluid interactions,
complex electromechanical problems, continuous spaceconcentrated parameter
problems, and similar. This is in particularly true if the interconnections are strong.
The question we would like to ask is where the place of the Bond graph methods
in this area is. The strength of Bond graphs lies in its multidisciplinary paradigm and
visual expressiveness. In many problems of mechatronics and micro-mechanics, the
Springer-Verlag Berlin Heidelberg 2015
V. Dami and J. Montgomery, Mechatronics by Bond Graphs,
DOI 10.1007/978-3-662-49004-4_10
449
450
10
Continuous Systems
physical domain is not uniform. There are strong interactions between processes
taking place in physically different elds. This is, for example, the case in
computer-controlled drives of mechanical links that often are not too rigid, or in
sensors where there are strong interactions of solid mechanics, fluid mechanics,
electrical and thermal processes. Bond graphs are capable of helping to bridge the
gap between these different elds.
In this nal chapter we describe an approach for solving the problems dealing
with continuous systems based on bond graphs. In the literature there are different
approaches for solving continuous systems by bond graphs [13]. The approach
described here is based on the component model philosophy developed in this book
and implemented in BondSim. We start with a description of the general approach
to modelling continuous systems based on component models. This will be applied
rst to the problem of modelling electric transmission lines. Next, a bond graph
component model of a beam element, based on classic Euler-Lagrange theory, will
be developed. We will end with two practical problems: package vibration testing
and Coriolis mass-flow meters.
10.2
Continuous systems possess innitely many degrees of freedom and, as such, are
not directly amenable to numerical solution. Their solution requires some sort of
discretisation. Various approaches are possible. Here we consider an approach that
is compatible with the methods used in this book, i.e. representing the continuous
system as an assemblage of bond graph components, then developing the mathematical model as a set of differential-algebraic equations that are solved directly.
This kind of approach belongs to a class of methods known as the Method of Lines
(MOL) [4]. To represent continuous systemssuch as robotic links or transmission
linesby a bond graph component model, it is necessary to discretises them
spatially. One of most powerful ways to do this is by the nite-element method.
Other approaches also can be used, notably nite-difference approximations and
even ad hoc lumping. We are not speaking in favour of any of these, but wish
simply to explain how they can be implemented in a Bond graph setting.
A continuous system can be discretized by dividing it into a number of nite
parts (elements). For example, a beam can be divided into number of small parts
(Fig. 10.1). The parts are called nite to distinguish them from the differential
elements used in mathematical analysis of the problem. The parts can also be of
different forms. Thus, in nite element analysis, triangular or quadrilateral elements
often are used in plane problems; tetrahedral and hexahedral (solid) elements for
space problems; plate elements for analysis of plates, etc. In nite difference
approximations one-, two- or three-dimensional grids are used.
The parts are assumed to be joined only at distinct nodes. Thus, discretisation is
based on physical variables dened only at the distinct nodes. Values of variables
inside the nite parts (elements) are described in terms of nodal variables.
10.2
451
452
10
Continuous Systems
They are responsible for element mesh generation and displaying results in a
user-friendly way. Such special purpose devices are not used in BondSim; the
hierarchical component model approach we have developed can be used to simplify
discretisation of continuous components by bond graph nite-element components.
To that end, a component can be dened that is represented by some number of
bond graph nite-element components (Fig. 10.3). Such a component plays the role
of a super element. In the same way, a lower-level super-element component can
be dened that is composed of such higher-level super elements. This way, a
complex model consisting of a large number of nite elements can be constructed
easily by using the component copy and insertion operations supported by the
program. This technique is similar to nite-element sub-structuring [5].
In the next sections we apply this technique to solve some practical continuous
system problems.
10.3
10.3
453
454
10
Continuous Systems
To apply this modelling approach to transmission lines, we analyse the telephone line of [7] and compare the results given therein with those generated by
BondSim. The parameters of the line are
1.
2.
3.
4.
5.
The line is divided into ten sections of length 32.2 km (20 mi) each. The
parameters of the line segments are
1.
2.
3.
4.
R 101:5 ohm
L 0:0393 H
C 0:159 106 F
Rs 0:172 106 ohm
10:1
10.3
455
R02 x2 L02
G02 x2 C02
1=4
744:991
10:2
456
10
Continuous Systems
xR0 C 0 G0 L0
1:32954
R0 G0 x2 C 0 L0
Hence,
c 1:8439 105 ej1:32954 4:40544 106 j1:7905 105 1=m
This way we get the attenuation factor of the line = 4.40544 106 1/m and
the phase constant = 1.7905 105 1/m.
In a transmission line loaded by the characteristic impedance, there are no
reflected waves, so voltage amplitudes along the line are given by
Vx Vs ecx
10:4
10:5
10.3
457
Hence,
Is Ir eaLen 1:342 103 A
Finally, from (10.4), we nd the time delay for voltage and current waves to
reach the other end. This is given by
Dt b Len=x 0:001153 s
Values found above correspond to steady-state sinusoidal wave transmission
along the line. The transmission line problem in [7] is based on such steady-state
frequency analysis.
The simulation based on the model developed above, on other hand, predicts the
complete transient behaviour of the line and thus gives a more complete picture of
the processes involved. This is, of course, approximate, as a nite number of the
lumps are used; but the accuracy can be increased by increasing the number of
sections.
We simulate processes in the line using a simulation interval of 0.05 s. The
period of the supply voltage is 2/ = 0.00126 s. Thus, we use an output interval of
0.00001 s. Results are shown in Figs. 10.9, 10.10 and 10.11.
There is an initial period of about 0.01 s during which there are transients in the
currents and the voltages, before they settle to a steady state. Voltage and current
amplitudes at the receiving end are 0.2312 V and 0.3104 mA, respectively. At the
sending end, the amplitude of the current is 1.392 mA, as in [7].
Figures 10.9 and 10.10 show a time delay before the waves reach the other end
of the line. It is difcult to determine accurately when current and voltage start to
increase from zero. Therefore, the delay is found by the difference in times when
458
10
Continuous Systems
the voltage crosses the time axis for the rst time. Thus, the delay is 0.001190 s.
The values found by simulations are close to those found analytically. Better
accuracy can be achieved by increasing the number of sections in which the line is
divided. The complete simulation uses 0.86 s of CPU time.
10.4
10.4
459
Fig. 10.12 A beam in planar motion. a An element of the beam. b The co-ordinates
460
10
f1
Continuous Systems
w_ 1
h_ 1
10:6
and
f2
w_ 2
h_ 2
10:7
The effort at the left port consists of force F1 in the transverse direction and
moment M1 of action of the left part of the beam on the element
e1
F1
M1
10:8
Similarly, the effort at the right port is composed of a force F2 and a moment M2
of the action of the beam element on the beam part at the right of the element
e2
F2
M2
10:9
This way, at the right element end there is a reaction force and moment, and
power flows through the element from the left to the right port (Fig. 10.13).
In a similar way, we introduce generalised displacements of the beam element
ends
q1
w1
h1
10:10
and
q2
w2
h2
10:11
q1
q2
10:12
f1
f2
10:13
10.4
461
10:14
S4
10:15
9
S1 1 3n2 2n3 >
>
>
>
S2 L n 2n2 n3 =
>
S3 3n 2n3
>
>
>
2
;
3
S4 L n n
10:16
S2
S3
With
and = xe/L. Differentiating (10.14) with respect to time, we get the velocity of the
beam transverse displacement
vS
f1
f2
10:17
10:18
where T is the kinetic energy of the beam element and Q is a vector of generalised
forces. The generalised forces include effects of element elastic forces, as well as
those of forces at the element boundary, i.e. at the ports.
The kinetic energy of a beam element is given by
1
T
2
ZL
qAv2 dx
10:19
where is the mass density of the beam, and A is the elements cross-sectional area.
Using (10.17), we get
v
2
f T1
f T2
f
S S 1
f2
T
10:20
462
10
Continuous Systems
1 T
f
2 1
f T2
f1
f2
10:21
10:22
ST S dn
0
where m = AL is the element mass. Using the shape functions of (10.16) and
evaluating integrals in (10.22), the mass matrix can be written as [5]
0
156
m B
22L
B
M
420 @ 54
13L
22L
4L2
13L
3L2
54
13L
156
22L
1
13L
3L2 C
C
22L A
4L2
10:23
We also can represent the mass matrix (10.23) in the block form
M
M11
M21
M12
M22
10:24
10:25
f1
f2
10:26
Thus,
d @T
p_
dt @ q_
10:27
10.4
463
@V
Q
@q
e1
e2
10:28
Using simple beam theory, the beam element strain energy is given by
1
V
2
ZL
EI
d2w
dx2
2
10:29
dx
where E is the Young modulus of elasticity and I is the second moment of the beam
cross-section. Substituting from (10.14), we nd
1
V qT Kq
2
10:30
Z1
d 2 ST d 2 S
dn
dn2 dn2
10:31
Using shape function of Eq. (10.16) and evaluating integrals, we get [5]
0
12
EI B
6L
K 3B
L @ 12
6L
6L 12
4L2 6L
6L 12
2L2 6L
1
6L
2L2 C
C
6L A
4L2
10:32
K11
K21
K12
K22
10:33
10:34
10:35
464
10
Continuous Systems
Finally, substituting from (10.27) and (10.35) into (10.18), we get the governing
equation of beam element dynamics
dp
q
e1
K 1
q2
e2
dt
10:36
10:37
10:38
where and are suitable constants. This type of damping is known as Rayleigh
damping [5].
The equation of element motion, as given by (10.26) and (10.37), can be readily
represented by a bond graph model of the BFE component shown in Fig. 10.14.
Note that the rst row of (10.37) corresponds to the left port variables, and the
second row to those of the right port. The variable at one effort junction at the left
component port is the linear velocity; at the other, it is the angular velocity.
A similar situation holds for the right effort junctions. The inertia of the beam
element is represented by a four-port inertial element I, corresponding to (10.26)
and the rst term in (10.37). Elasticity of the element is represented by a four-port
capacitive element C, corresponding to the third term of (10.37) and (10.13).
Finally, a four-port resistive element R describes Rayleigh type damping in the
beam, as given by the second terms of (10.37) and of (10.38).
To complete the model, it is necessary to dene model parameters and element
constitutive relations. Model parameters can be dened conveniently at the level of
beam element document. We dene the physical parameters rst. These include the
element length, mass, modulus of elasticity. We then dene expressions for mass,
stiffness, and damping matrix elements. The constitutive relations of I, C, and R
elements are dened at corresponding ports as given by (10.26) and (10.37),
respectively.
Fig. 10.14 Bond graph beam
element BFE
10.4
465
The model of a beam is created using component models that correspond to the
elements into which the beam is divided. To simplify generating models that consist
of a large number of elements, a technique similar to that used in Sect. 10.3 can be
applied. Thus, we dene a component consisting of ve element component
models; then another consisting of the ve previously dened components; and so
forth. This way, using hierarchical decomposition of the beam, it is relatively easy
to generate a beam model consisting of a large number of nite element component
models by copying and inserting. We apply this technique in the next section.
10.5
466
10
Continuous Systems
10.5
10.5.2.1
467
Beam elements will be represented using the component model of Sect. 3.4. In this
problem the elements frames are not xed with respect to the global reference
frame, but translate jointly with the container body frame. Thus, in addition to the
generalised displacements of the element with respect to the container frame, the
matrix of generalised displacements also will contain the z0 co-ordinate of the
container body frame. The generalised displacement matrix of a typical element
thus reads
0
1
z0
q @ q1 A
q2
10:39
q
z z0 S 1
q2
10:40
where S is the shaping function matrix of (10.15) and (10.16). The corresponding
velocities are
v v0 Sf
10:41
dz0
dt
10:42
To develop the equation for the beam element motion, Lagranges equations
were used, as in Sect. 10.4. These read
d @T
@T
Q
_
dt @ q
@q
10:43
where T is the kinetic energy of the element and Q is vector of generalised forces.
The generalised forces now read (see (10.33) and (10.35))
0
0
Q @ 0
0
0
K11
K21
10
1 0
1
F0
z0
0
K12 A@ q1 A @ e1 A
K22
q2
e2
10:44
468
10
Continuous Systems
where K is the element stiffness matrix and F0 is a force corresponding to the effect
of container body translation on the element.
The kinetic energy of a beam element is given by
1
T
2
ZL
qAv2 dx
10:45
10:46
f
f T2 M 1
f2
10:47
Sdn
10:48
m
6
12
6 L
10:49
10:50
10:51
m
p @ NT1
NT2
N1
M11
M21
10 1
v0
N2
M12 A@ f 1 A
M22
f2
10:52
10.5
469
Thus, by substituting from (10.51), and (10.44) into (10.43), the equation of
beam element motion can be written as
0
0
dp @
0
dt
0
0
K11
K21
10
1 0
1
F0
z0
0
K12 A@ q1 A @ e1 A
K22
q2
e2
10:53
0
dp @
0
dt
0
0
R11
R21
10 1 0
0
v0
0
R12 A@ f 1 A @ 0
R22
f2
0
0
K11
K21
10
1 0
1
F0
z0
0
K12 A@ q1 A @ e1 A
K22
q2
e2
10:54
10.5.2.2
To model motion of the device, the rigid body model of Sect. 9.2 is used. There is
some difference, however, the motion of the device is referred to the container body
frame, not to the base (inertial) frame. Because the container body translates with
respect to the base, there is an additional (inertial) force acting at the device mass
centre, as was found above for the beam elements. Thus, in addition to the port
corresponding to joining the end of the cantilever beam, there is a port that corresponds to the effects of translation of the container body frame (Fig. 10.18). The
effort and flow of the container port are inertial forceowing to the container frame
accelerationand velocity of the container frame translation, respectively. The
470
10
Continuous Systems
efforts and flows at the beam ports are of the form given by (10.9) and (10.7),
respectively. It was assumed that the beam axis undergoes z-axis transverse displacement only, ignoring the beam x-axis strains. There is also an output port to
supply information on the relative transverse displacement of the device mass
centre with respect to the container body frame.
The model of the device body created using the plane body model of Fig. 9.3 is
shown in Fig. 10.19. The effort junction at the top-left of the document window
corresponds to the transverse velocity component of the device mass centre with
respect to the base frame.
This velocity can be expressed as
vd v0 vbd
10:55
where the term with the superscript b denotes the velocity component with respect
to the container body frame, and v0 is its translation velocity. Thus, the kinetic
energy of the device translation is given by
TCd md v0 vbd 2 =2
10:56
10.5
471
Analogous to the approach used in the beam element model, we dene the flow
vector corresponding to the mass centre motion as
fd
v0
vbd
10:57
10:58
now reads
pd
md
md
md
f
md d
10:59
10:60
F0
Fd
10:61
10.5.2.3
We give a short description of the model of package system vibration testing. The
complete model can be accessed in the BondSim program library under the project
name Package Vibration Testing. The system level model is given in Fig. 10.20.
It consists of two main components: Package and Testing machine. There
is also an output component used to display time and frequency plots of the package
container and device body positions. The Testing machine is represented
simply by a flow source generating vertical motion of the machine table. We will
use two types of test inputs. Similarly, as in Sect. 6.2.3, to generate a frequency
response plot of device motion, we apply to the package a velocity pulse of short
duration. The form of the pulse is shown in Fig. 10.21a. The corresponding package
container position is shown in Fig. 10.21b.
472
10
Continuous Systems
10:62
Amplitude vp0 is chosen such that the peak acceleration is constant, i.e.
vp0
amax
2pf
10:63
The package consists of a container wall and base plate represented by the Wall
component (Fig. 10.22), xed to the vibration machine table and to which is
connected a Cantilever component that carries the component Device.
Interconnection of the cantilever beam to the container is shown in Fig. 10.23.
The effort junction is the transverse displacement node of the container. The
junction port, together with the Clamp port, is connected to the Wall output port.
The porta compounded onehas efforts and flows at the container wall represented by
econ
F0
e1
10:64
10.5
473
and
f con
v0
f1
10:65
Here, v0 and F0 are, respectively, its velocity and the total force that the testing
machine supplies to the container. Effort component e1 consists of the transverse
force and moment at the clamping of the cantilever beam to the container. The
component in the beam axis direction was neglected. Similarly, f1 consists of the
linear velocity and the angular velocity of the beam end with respect to the
container.
The end of the cantilever is clamped to the container wall, which is represented
by the Clamp component. This component consists of two zero-flow sources that
force the linear velocity and the angular velocity of the beam end to be zero.
The cantilever beam is divided into four subsections (Fig. 10.24), each of which
is represented by a SectB component consisting of ve BFE components
(Fig. 10.25). The bond graph representation of this nite-element beam
474
10
Continuous Systems
10.5
475
Property
Cantilever
Value
Length
Width
Height
0.100 m
0.0258 m
0.0055 m
Material
Acrylic (PMMA)
Modulus of elasticity
3.1 GPa
Density
1200 kg/m3
Device block
Mass
0.0362 kg
Moment of inertia
5.168 106 kg m2
x
0.0128 m
z
0.0126 m
Note The device body data include the part of the beam clamped
to it. x and y are co-ordinates of the mid-point of the cantilever
beam end section with respect to the device centroidal body frame
476
10
Continuous Systems
Fourier Transform from the drop-down menu. We enlarge the part of the plot in the
range of 0100 Hz by right-clicking on the frequency plot, selecting the Expand
command, and drag the right edge of the frequency window to about 100 Hz. The
resulting diagram is shown in Fig. 10.27.
The
diagram
resembles
the
familiar
response
diagrams
of
single-degree-of-freedom system vibrations induced by the motion of the base [11].
The maximum amplitude occurs in the vicinity of 39.0 Hz.
In a similar way, we can nd the Continuous Fourier Transform of the input
(Fig. 10.28). The amplitude of the container displacement is practically constant
over the frequency range of interest at about 1.0 107 m and, hence, it approximates the ideal impulse fairly well. Comparing this with Fig. 10.27, it can be seen
that the maximum displacement transmissibility ratio of the device to container
displacement is a little above 10.
We next apply a sinusoidal vibration to the container according to (10.62) and
(10.63) with a frequency of 39.0 Hz and a peak acceleration of amax = 0.5 g. This
requires changing the source effort relation in the Testing machine (Fig. 10.20)
component, then re-building the model.
The response curve is shown in Fig. 10.29. It was generated with same simulation parameters as in the previous run. The amplitudes at beginning steadily grow
until they reach a steady value of 0.0008375 m. The amplitude of the container
vibration is 8.170 105 m; thus, we have the transmissibility ratio of 10.25, as
found previously.
10.6
477
10.6
478
10
Continuous Systems
10.6
479
480
10
Continuous Systems
application. The main focus has been the evaluation of CMF sensitivity factors,
vibration control of the tube with the specied amplitude and operating frequency
close to fundamental natural frequency of the tubes, the effects of meter geometry
and environment conditions on performance, and others. Different approaches have
been used. Thus, in [14], rather simple lumped-parameter models were used. In
[13], the tubes are modelled as EulerBernoulli beams and problems were solved
by perturbation theory. Timoshenko beam theory was applied in [15], and the
problem was analyzed using a nite-element program. CMF analysis based on
curved beam theory was used in [16]. We will show that problems can be readily
solved using the bond graph component method. A CMF transducer that uses
curved tubes will be analyzed using Timoshenko beam theory. The complete model
will be developed including its digital controls. The behavior of such CMF system
will be investigated by simulation.
10.6.3.1
10.6
481
Jemah [18]. The tube has a constant radius of the curvature and the uniform
cross-section and material properties and is lled with a still fluid.
An innitesimal element of the tube with subtended angle d about the center of
a circle of radius R is shown in Fig. 10.33. The local element coordinate frame is
shown in the center of the left cross-sections and consist of the radial (axis 1),
transversal w (axis 2), and tangential (axis 3) directions. The corresponding
variables are rotation angle due to pure bending , the transverse displacement due
to shear w, and the torsion angle . Along these axes act the bending moment M*,
shearing force Q*, and torsional moment T*. The equations of dynamic equilibrium
of shear, bending and torsion are given by
1 @Q
@ 2 w
qA 2
R @/
@t
1 @M
1
@2w
T Q qI1 2
R @/
R
@t
1 @T
1
@2h
M qIp 2
R @/ R
@t
10:66
Quantity A represents the mass of tube including the contained fluid per unit
length. Similarly I1 is moment of inertia of the tube including fluid about rotation axis
1 per unit length, and Ip is moment of inertia of tube about tangential axis per unit
length. Equivalent mass per tube length has the form qA qt At qf Af , where subscripts t denotes quantities referred to the tube cross section, and f to inside cross
section containing the fluid. The similar relation holds for flexure, i.e.
qI1 qt I1t qf I1f . In torsion, however the effect of fluid is neglected and hence
qIp qt Ipt . For the circular cross-sections we have Ipt 2I1t .
482
10
Continuous Systems
M
10:67
where EI1t, GJt and k are the flexural rigidity, torsional rigidity and shape factor of
the tube, respectively; Jt is St. Venants torsional constant of the tube.
We consider free vibration of tubes in which all variables can be expressed as
/ejxt
v/; t X
10:68
where
v w; w; h; M ; Q ; T
M;
W;
T
W;
H;
Q;
X
Substituting into (10.66) and (10.67) we obtain
1 dQ
0
qAx2 W
R d/
1 dM
1
0
qI1 x2 W
T Q
R d/
R
1 d T 1
0
M qIp x2 H
R d/ R
10:69
and
EI1t d W
H
M
R d/
GJt d H
T
W
R d/
1 dW
0
Q k At G
W
R d/
10:70
Following Irie et al. [17] the following dimensionless variables and parameters
are introduced:
10.6
483
2
M; T R M;
W W ; H H;
T ; Q R Q;
W W;
EI1t
EI1t
R
qIp
qAR2 2
At R2
GJt
G
s21
; s1t
;g
;l
; kq k0 s21t ;
E
qI1
I1t
qI1
EI1t
2 2
4 2
qI1 R x
qAR x
; k2
s21 c2
c2
EI1t
EI1t
10:71
10:72
and
dW
H
@/
dH
W
Tl
d/
dW
Q kq
W
d/
10:73
dW
d2W
kq
s21 c2 W 0
d/
d/2
d2W
dW
dH
1 l
0
l kq c2 W kq
2
d/
d/
d/
dW
d2H
l 2 gc2 1 H 0
1 l
d/
d/
10:74
These are linear differential equations of second order. Thus, we may assume
their solutions in the form
W Cep/
W qCep/
H rCe
p/
10:75
484
10
Continuous Systems
kq p
@ p2 l k q c 2
1 lp
10 1
1
0
A@ q A 0
1 lp
r
lp2 gc2 1
kq p2 s21 c2
kq p
0
10:76
This is a homogenous linear equation for q and r. It has solutions if the determinant of the system matrix is equal to zero. Expanding this determinant we obtain
a bicubic equation
a6 p6 a4 p4 a2 p2 a0 0
10:77
10:78
This is the characteristic equation for the problem, whose solutions are the
eigenvalues of out-of-plane tube vibrations. These eigenvalues can be found using
e.g. Cardanos formulas. The corresponding eigenfunctions constants q and r can be
easily found from (10.76):
kq p
kq p2 s21 c2
10:79
1 lp
lp2 gc2 1
10:80
q
r
Because there are six eigenvalues we may express the beam bending, torsion and
transverse displacements by
W
6
X
Ci epi /
i1
6
X
qi C i e p i /
i1
6
X
i1
ri Ci epi /
10:81
10.6
485
10.6.3.2
An example for geometry of a CMF is shown in Fig. 10.34. It may be decomposed into
two short straight tube parts at the start and end of the tube, two small circular arcs and
the main one in the middle. The tube is clamped at the nodes 0 and 8. Nodes 1 and 7 are
the connection nodes between the straight and curved tube parts at the beginning and
end, and nodes 2 and 6 are the connection nodes between the small and main circular
arcs. The main arc is further divided onto sub-arcs by nodes 3, 4 and 5. At these nodes
the sensors and the actuators coils or magnets and their bodies (supports) are connected, which we represent by concentrated masses. Their effects will be taken into
account later. We consider now only the tubes lled with still fluid.
The gure also shows the coordinate systems used. The origin of the global
coordinate frame is placed at the midpoint between left and right tube ends. Axis
z is directed to the right, y axis upwards and x axis into the undeformed tube
centerline plane. The local tube coordinates wi wi i are dened for each of the
circular parts in the same way as we did earlier (Fig. 10.33). For the straight parts
the coordinates are simple, just the coordinate s along the parts centerlines.
Irie et al. in [17] analyzed structures consisting of only a single arc. It can be
shown that their approach based on transfer matrices can be extended to multi arch
structures such as in Fig. 10.34. The transfer matrices approach of Irie et al. [17] is
interesting because it is compatible with the Bond graph component approach.
There is also another possible better known approach based on stiffness matrices,
proposed by Howden and Jemah [18]. It is compatible with the classical nite
element displacement based approach.
For our calculations, we start at the left end by using equations of the form
(10.81) and applying the boundary conditions for that part. The left straight part is
486
10
Continuous Systems
clamped at the left node 0, and on the right at node 1 is connected to the small
circular tube. At the connection points they have the same displacements and
slopes. We continue along the small arc and again apply the boundary conditions at
its left and right nodes. We continue along the main arc, and so on until the last
straight part at the right end of the tube. These lead to a frequency equation from
which we can nd the natural frequencies of tube vibrations. For each of these
frequencies we can nd the values of the corresponding constants in (10.81) for the
tube parts, and thus the forms of the vibration shapes. The complete procedure was
implemented in a program written in C++, which generates the natural frequencies
of the tube and the mode shapes coefcients. We give the nal results only. In
Fig. 10.35 are shown the rst three natural frequencies and mode shapes for a
specic Coriolis tube lled with water. It shows all three vibration displacements
bending, torsion and transverse. For lower modes the bending dominates. For
higher modes (not shown) the torsion is more influential. The tube sensors measure
the transverse displacements. In the fundamental mode (1) the transverse displacements are symmetric with respect to the mid of the tube. In the second mode it
is antisymmetric. Note also that the tube bending always has the opposite symmetry
with respect to transverse displacement and torsion.
Fig. 10.35 The rst three eigenmodes of a coriolis tube lled with water
10.6
10.6.3.3
487
Now we will consider the dynamical model of CMF tube including masses of
sensor and actuator parts (the coils, magnets and holders), but also the effects of
fluid flowthe Coriolis and centrifugal inertial forces. We consider the main circular parts, which play the fundamental role. The dynamics of small arcs and short
straight parts are much simpler and their role is minor. The equations of motion
have the following form
@2w
@M
1
T Q qI1 Js1 ds ss1 Ja1 ds sa Js1 ds ss2 2
R
@t
@s
2
@Q
@
w
t
ds
s
qA
m
ds
s
m
ds
s
m
ds
s
s
a
s
a
a
s1
a
s2
@s
@t2
@ 2 w
@ 2 w
2qf Af Vf qf Af Vf2 2
@s @t
@s
@2h
@T 1
M
qI
J
ds
s
J
ds
s
J
ds
s
p
s3
a3
s3
s1
a
s2
@t2
@s R
10:82
where ds Rd/ is differential of the arc length along the tube centerline.
Comparing with (10.66) there are two main differences. One is the effect of fluid
flow with mean velocity Vf on the tube motion. It is described by the second and
third terms on the right hand side of the second (10.82). They represent the Coriolis
inertial force and centrifugal force, respectively. The other term describes the
interaction of the measuring tube with the attached sensors and actuators bodies
containing their coils or magnets. The sensor and actuator parts attached to the tube
for out-of-plane motion are described respectively by mass moments of inertia Js1
and Ja1 with respect to the radial axes, Js3 and Ja3 with respect to the tangential
axes, and their total mass ms and ma. Because these are the concentrated parameters
they are taken into account in distributed model (10.82) by use of Dirac (s*)
functions. Their positions along the arc are denoted by the arc lengths
ss1 ; sa ; and ss2 , respectively. The actuator also delivers the forces to the measuring
tubes. It is represented by the concentrated force Fa ds sa acting at the position
of actuator coils or magnets in the transverse direction as can be seen in (10.82).
Substituting stress-strain and strain-displacement Eqs. (10.67), normalizing by
(10.71) we obtain the dynamic equations of CMF tube written compactly as
Lw/; t Fa td/ /a e2 M w/; t Ma w/; t
@2w
@2w
k21f Vf2 2 e2
2k21f Vf
@/@t
@/
where we introduced the state vector
10:83
488
10
w/; t w
Continuous Systems
h T
10:84
Following Han et al. [19] we also introduced linear matrix operators dened as
0
@2
@/2
@
l kq kq @/
B @
Lw/; t B
@ kq @/
@
kq @/
2
2
@
1 l @/
@
1 l @/
0
@2
l @/
2
1
1
C
Cw/; t
A
10:85
and
0
c21 @ 2
B @t
M w/; t @ 0
0
2
0
k21 @t@ 2
0
2
0
0
C
Aw/; t
10:86
gc21 @t@ 2
2
Note that c1 and k1 are parameters c and k dened in (10.71) that correspond to
the fundamental natural frequency of the unperturbed tube x1 . Time is also normalized by the same frequency, i.e. t t x1 .
Operator Ma takes into account inertias of the sensors and actuator coils or
magnets and is given bellow:
0
2
C @ w/; t
B
Ma w/; t diag@ k2s d/ /s1 k2a d/ /a k2s d/ /s2 ; A
@t2
c2s3 d/ /s1 c2a3 d/ /a c2s3 d/ /s2
10:87
We dene constants
Js1 Rx2
Ja1 Rx2
ms R3 x2
ma R3 x2
Js3 Rx2
1
1
1
1
1
; c2a1
; k2s
; k2a
; c2s3
;
EI1t
EI1t
EI1t
EI1t
EI1t
Vf
qf Af R4 x2
Ja3 Rx2
F R2
1
1
; k21f
; Fa a ; Vf
EI1t
EI1t
EI1t
Rx1
c2s1
c2a3
10:88
Finally e2 0; 1; 0T in (10.83) is unit vector of the second (transverse) axis.
Similar equations hold for small circular arcs and the straight part at the front and
end of the measuring tube, but are simpler because there are no the sensors and
actuator.
The motion of the tube can be treated as a perturbation of the pure tube motion,
which was considered in the previous subsection. To nd its motion we will apply
the method of eigenfunction expansion (Han et al. [19]). According to which the
motion of the perturbed tube can be written in the form
10.6
489
wu; t
1
X
qn tWn u
10:89
n1
q2
q3 T
10:90
10:91
where
0
B
M@
0
B
BB
@
0
B
KB
@
l1 m11
m12
m21
m31
l2 m22
m32
m13
C
m23 A;
l3 m33
2k21f Vf a12
2k21f Vf a13
2k21f Vf a21
2k21f Vf a23
2k21f Vf a31
2k21f Vf a32
1
C
C;
A
W3 /a
10:92
490
10
Continuous Systems
Note that mass matrix M is composed of the modal masses i of the unperturbed
tube on its diagonal, and inertial parameters mij, which describe the inertial effect of
the sensors and actuator bodies, and their coils and magnets. Due to parity of the
eigenmodes these parameters satisfy: m12 = m21 = m23 = m32 = 0, and m13 = m31.
The damping matrix B contains the linear damping terms 2fi li xi on the diagonal, and the Coriolis force terms 2k21f Vf aij . Due to parity of the eigenmodes ij
satisfy: 11 = 13 = 22 = 31 = 33 = 0, 12 = 21, and 23 = 32. Only the linear
damping term is responsible for the dissipation of the tube mechanical energy. The
Coriolis forces are in effect gyroscopic and are energetically neutral.
The third matrix K describes the tube stiffness terms of the form l1 x21 on the
diagonal and centrifugal terms of the form k21f Vf2 bij . The stiffness terms are
described as product of the tube modal masses and the square of the natural frequencies of the unperturbed tube. The centrifugal stiffness parameters ij has
similar properties as the inertial parameters: 12 = 21 = 23 = 32 = 0, and 13 = 31.
Thus the centrifugal forces reduce the tube eigenfrequencies at higher fluid flows
(they are of the order of the squared mean fluid velocity). The values of the
parameters are not specied here because they depend on characteristics of the
measurement tubes, the actuator and sensors employed. One set of these parameters
are used in the simulation project discussed later.
1
q1
q @ q2 A ;
q3
1
v1
v @ v2 A;
v3
1
p1
p @ p2 A;
p3
1
F1
F @ F2 A
F3
10:93
dq
dt
10:94
10:95
10.6
491
where M is the mass matrix given in (10.92). Because of the form of the rst three
eigenfunctions (see Fig. 10.35) some terms are zero. Thus, we have
0
l1 m11
0
M@
m31
1
m13
A
0
l3 m33
0
l2 m22
0
10:96
10:97
where
0
2f1 l1 x1
B
V
B
B B 2k21f a21 Rf
@
0
2k21f a12
V
2f2 l2 x2
V
2k21f a32 Rf
V
C
C
f
R C
A
2f3 l3 x3
10:98
2k21f a23
2
l1 x2
1 k1f b11
B
B
K B
B0
@
V
2
k21f b31 Rf
V
2
f
k21f b13
V
2
f
V
2
2
f
l2 x2
2 k1f b22 R
2
l3 x2
3 k1f b33
C
C
C
C
V
2 A
f
10:99
It can be shown that the coefcients bii \0; i 1; 2; 3, and thus the centrifugal
inertial forces effectively lower the tube stiffness, a well-known effect (Stack et al.
[15]).
Finally, the actuator force is given by (see 10.92 and 10.71)
0 x2 R2
1
F t
B xEI21tR2
B 1
@ EI1t
2
x2
1 R
EI1t
W1 /a
C
W2 /a C
AFa t
W3 /a
10:100
492
10
Continuous Systems
To nd the velocity measured by the sensors from (10.89) we may write for the
main arc
w/2 ; t
3
X
qn tWn /2
n1
3
X
qn tWn /2
n1
3
X
dqn
n1
dt
Wn /2
i 1; 2
10:101
Similarly, the velocity of the point of application of the actuator force is given by
Va R v1 W1 /a v2 W2 /a v3 W3 /a
10:102
We represent the model of the CMF transducer by the Bond graph component
model shown in Fig. 10.36. Because this component will be used for modelling the
behavior of the CMF under control it has only signal ports. Going from the left the
rst port serves for input of control signal generated by digital control circuits. Next
two deliver voltage signals generated by the sensors. Finally, the last port gives
information on the voltage across a shunt resistor in the actuator driver circuit,
which gives information on the current in the actuator coil.
The model of transducer is shown in Fig. 10.37. It represents CMF transducer
consisting of two parallel Measuring Pipes, driven by an Actuator. Two
function components model the sensors. Thus the output of the left sensor is given by
Va0:5 Vs1 up Vs1 dn Ksen 1000
10:103
10.6
493
where Ksen is the sensor gain in V/(m/s), and is expressed in mV. Vs1_up and
Vs1_dn are the velocities of the pipe at position of the sensor on upper and
downward measuring pipe. The analogous statement holds for the right sensor.
A model of Actuator is shown in Fig. 10.38. The L and R represent the
actuator coil inductance and resistance, and EMC models electro-mechanical
conversion between the electrical and mechanical actuator ports. As shown in
Fig. 10.38 right it is represented simply by a Gyrator, similarly as in other electrical
motors. The gyrator ratio is Kemc expressed in N/A or V/(m/s). The Rs is a shunt
used to get voltage in mV, which gives information on the current flowing through
the actuator coils.
A model of the Measuring Pipe is shown in Fig. 10.39. The I, R, and C
components represent three ports inertial, resistive and capacitive components
describing the corresponding terms in (10.95) and (10.97). The 1 represents three
1-junctions, which describes vector summation implied by (10.97). Similarly, the
SE component consists of three controlled SE (source effort) elementary components, which represent the actuator force vector given by (10.100). The control signal
494
10
Continuous Systems
is the force signal, generated by the Actuator, which is picked at 0-junction in the
Coriolis Transducer component model (Fig. 10.37).
In the same vein Va and Vb components consist of three functions and a
summator, which implements (10.101). The input signals are the velocity components picked at 1-junctions in component 1. The dot denotes the component, which
represent branching out the velocities signals.
Finally there is a SF component (compare with the central part of Fig. 10.37). It
has similar structure as Va and Vb components and evaluates the velocity of the
point where the actuator is connected as given by (10.102). In spite that we do not
explicitly use this quantity for the control it is necessary to evaluate this in order to
correctly interconnect the I-R-C model of the pipe and the Actuator. Note that
generalized coordinates q in (10.93) are not the physical quantities, but convenient
dimensionless quantities.
10.6
495
There are various kinds of PLL. We consider here so called all digital PLLs
(ADPLLs) following Best [21]. They have similar structures as the other kinds of
PLLs, but are realized entirely digitally. A typical scheme of PLL is shown in
Fig. 10.40. We left out the optional divide-by-N counter for frequency
down-scaling. There are different kinds of PD, which are based on different principles. It generates at its output a signal proportional to the phase difference
between the reference input and VCO generated signals. The LF is really a controller, typically of PI type.
The radian frequency 2 generated by VCO is proportional to output uf of
the LF,
x2 x0 K0 uf
10:104
496
10
Continuous Systems
10.6
497
Denoting by n the current value of the time the averaged values are calculated
simply as
A cos u
N 1
1X
un i cos2pfc tn i
N i0
N 1
1X
A sin u
un i sin2pfc tn i
N i0
10:105
It is also possible to extend the averaging process over several periods of the
generated quadrature functions.
The amplitude of the input signal is calculated as
A
q
A cos /2 A sin /2
10:106
10:107
y 6 0
10:108
498
10
Continuous Systems
Fig. 10.44 DSP component (left) and Driver Frequency & Amplitude component (right)
We will now describe the proposed model of CMF control system. Figure 10.43
shows BondSim model of the complete CMF system. Starting from the top of the
gure we have Coriolis Transducer component, which we have discussed in
the previous section. There are three output signalsfrom the left and right sensors
and shunt voltage we have already discussed. They are connected to a component
from which they branch to the display. The sensors signals are further amplied in
IO Gains component and then converted into the digital form by A/D converters.
The clock component denes the sampling rate of the converters, and denes
starting ending of the digital processing. The signals are further preceded to the
DSP (Digital Signal Processing) component where main processing was done and
which is the heart of the complete system. The DSP generates a voltage signal
which is after D/A conversion and scaling, returned back to the Coriolis
Transducer. It is used to drive the tubes actuator. The other signals are output as
well, such as Mean Amplitude, Mean Phase, Signals Phase Difference, Operating
Frequency, etc. These are rst converted into analog domain by D/A conversion
components, scaled and displayed. The phases are converted into degrees for
display.
The structure of DSP component is shown in Fig. 10.44 (left). It consists of three
main components. The Driver Frequency & Amplitude generates the frequency and amplitude for driving actuator of Coriolis transducer. The sin/cos
generates the values of the quadrature signals at every sampling instance. It is
implemented as described in Turner [20]. These values are used in the previous
component and also for generating the driver voltage in DriverInput
component.
10.6
499
10:109
500
10
Continuous Systems
Fig. 10.46 Processing of the signals and generation of driving frequency and amplitude
Fig. 10.47 Averaging and calculation of the signal amplitude and phase
As Fig. 10.47 right shows, to apply the averaging according to (10.105) three
special digital components described in Sect. 4.6.4 are usedthe buffer summation,
buffer size and the reset operation. The rst two serves to evaluate the sum of the
products stored in the buffers, and the number of the products stored. Dividing these
quantities the averages values of A cos u and A sin u are calculated. After these
10.6
501
values are evaluated the reset signal is sent to the buffer to reset the buffer array
indexes to zero (the array operations are zero based). The Amplitudes and
Phases in Fig. 10.47 left are evaluated according to (10.106)(10.108).
The function MeanAmpl in Fig. 10.46 evaluates the arithmetic mean of the
sensors amplitudes. It is used as the input to CalcAmpl component, which represent a common PID controller, similar to that discussed in Chap. 8. This controller generates the amplitude Ac of the control signal (10.41), which drives the
CMF actuator. Similarly, the MeanPhase evaluates the arithmetic mean of the
sensors phases. It is used as the input to CalcFreq component, which represent a
conventional PID controller. It generates the operation frequency fc, which is used
both in sin/cos generator (Fig. 10.44), and in the actuator driver voltage (10.
109). The summator (+) evaluates differences between phases of signal b and that
of signal a. The generated signals are also sent to the right output port, and thus out
of the DSP component (Fig. 10.43), where they are after post-processing sent to the
displays as described before.
502
10
Continuous Systems
values. The complete simulation lasts about 2400 s of wall clock time.1 The results
are shown in Fig. 10.48, 10.49, 10.50 and 10.51.
The value of the operating frequency was set to 450 Hz, and set point of the
p
mean amplitude to 30 2 42:4264 mV. Figures 10.48 and 10.49 show that
operating frequency becomes close to the fundamental natural frequency after 5 s,
and after about 6 s the mean signal phase drops practically to zero.
The simulation was run on a laptop with i7 quad core processor under Windows 7.1.
10.6
503
The mean amplitude starts rising only when the frequency approaches the
fundamental natural frequency and settles down to value very close to the required
set point after about 20 s. This is due to very slow transient of the tubes. The
operating frequency settled to about 406.039 Hz, which agrees well with the calculated value of 406.2 Hz.
From Fig. 10.50 it can be seen that the sensors phase difference very quickly
settles to a constant value of 0.3261. Because the mass flowrate is 1.508 kg/s this
means that the sensitivity of the transducer is 0.216/(kg/s). Finally Fig. 10.51
shows that maximum current drawn by the actuator was 15 mA, and in the
steady-state it drops down to only a few milliamps.
It could be concluded that the averaged phase detector works very well. The
resulting curves are pretty smooth and regular. By applying a suitable quick search
algorithm it is possible to shorten the starting time for operating frequency to reach
the natural frequency, i.e. the rst 45 s. However, the transients dominate the
amplitude response.
References
1. Fahrenthold EP, Wargo JD (1994) Lagrangian bond graphs for solid continuum dynamics
modeling. ASME J Dyn Syst Meas Control 116:178192
2. Fahrenthold EP, Venkataraman M (1996) Eulerian bond graphs for fluid continuum dynamics
modeling. ASME J Dyn Syst Meas Control 118:4857
3. Karnopp DC, Margolis DL, Rosenberg RC (2000) System dynamics: modeling and simulation
of mechatronic systems, 3rd edn. Wiley, New York
4. Schiesser WE (1991) The numerical method of lines. Academic Press, San Diego
504
10
Continuous Systems
5. Cook RD, Malkus DS, Plesha ME (1989) Concept and applications of nite element analysis,
3rd edn. Wiley, New York
6. Johansson J, Lundgren U (1997) EMC of telecommunication lines. A Master thesis from the
Fieldbusters. http://jota.sm.luth.se/*d92-uln/master/Theory/4
7. Keown J (2001) OrCAD PSpice and circuit analysis, 4th edn. Prentice Hall, Upper Saddle
River
8. Shabana AA (1998) Dynamics of multibody systems, 2nd edn. Cambridge University Press,
Cambridge
9. Borri M, Trainelli L, Bottasso CL (2000) On representation and parameterizations of motions.
Multibody Syst Dyn 4:129193
10. Jaram V (2001) Evaluation of bond graph based object oriented approach to determination of
natural frequencies of packaging system elements. MS thesis, Department of Packaging
Science of Rochester Institute of Technology, Rochester, New York
11. Rao SS (1995) Mechanical vibrations, 3rd edn. Addison-Wesley, Reading
12. Kesic P, Damic V, Ljustina AM (2000) The coriolis flowmeter for measurement of petroleum
and its products. Nafta, Zagreb 51:103111
13. Raszillier H, Durst F (1991) Coriolis-effect in mass flow metering. Arch Appl Mech 61:192
214
14. Plache KO (1979) Coriolis gyroscopic flow meter. Mechanical Engineering, March 1979,
pp 3641
15. Stack CP, Garnett RB, Pawlas GE (1993) A nite element for the vibration analysis of a
fluid-conveying timoshenko beam. Am Inst Aeronaut Astronaut AIAA-93-1552-CP
16. Sultan G, Hemp J (1989) Modelling of a coriolis mass flowmeter. J Sound Vib 132:473489
17. Irie T, Yamada G, Tanaka K (1982) Natural frequencies of out-of-plane vibration of arcs.
Trans ASME 49:910913
18. Howson WP, Jemah AK (1999) Exact out-of-plane natural frequencies of curved timoshenko
beams. J Eng Mech 125:1925
19. Han SM, Benaroya Haym, Wei T (1999) Dynamics of transversely vibrating beams using four
engineering theories. J Sound Vib 225(5):935988
20. Clay ST (2003) Recursive discrete-time sinusoidal oscillators. IEEE Signal Process Mag 101
111
21. Best RE (2007) Phase locked loops, 6th edn. McGraw-Hill Co., New York
Appendix
A.1
Installation of BondSim
The book uses the program BondSim 2014 which can be downloaded from the
program web page given below. The currently there are two versions of the software: BondSim 2014 Basic and Professional.
The Basic version is a limited version of BondSim program, which permits
building the models of up to 1500 modelling components. This version is really
designed to be used with the book. This is often enough for many problems. The
readers can use methods explained in the book for developing their own mid-size
modelling projects. For comparison Puma 560 project of Chap. 9 contains about
1200 components.
The professional version, which is not free, has no restrictions on the size of the
modelling projects. In addition it includes BondSimVisual program, which jointly
with BondSim supports visualization of motion of mechatronics system in 3D
space, as discussed in Chap. 9.
The programs can be run on PC computers under Windows 7, 8 or 10 operating
systems. Prior to the installation they require the .NET Framework version 4.5. If it
is not already contained as a part of the operating system, the framework can be
freely downloaded from the Microsoft Windows Update website.
The complete instructions on download and installation of BondSim program
can be found on the web page given below.
A.2
505
506
Appendix
The book explains how to use the program. Chap. 4, for example, describes the
visual environment, the main program commands, editing tools, and how to
develop the Bond Graph models. Modelling and simulation of practical mechatronic systems using BondSim is described in the application part of the book,
starting with Chap. 6. The rst section of these chapters describes the procedure on
relatively simple problems in a step-by-step manner. The later sections treat more
demanding problems.
Interested readers can order a full version of the program by visiting the program
web page. We would also be very happy for any feedback, criticism, advice or
support for further work. Suggestions on other mechatronic or other relevant
problems are truly welcome.
A.3
Contact Addresses
Index
A
Andrews squeezer mechanism, 374
model, 374
simulation, 380
Application
class, 98
operations, 99
start, 98
Attributes, 12
Automatic differentiation, 11
B
BDF method, 173
differentiation formula, 175
local error, 178
variable coefcient, 173
Beam, 459
Euler-Bernoulli theory, 459
model, 464
package element, 469
Block diagram components
differentiator, 39
display. See Output
function, 39
input, 38
integrator, 39
IPC pipe, 85
node, 40
output, 38
summator, 40
Body. See Motion in
Body in space
transformation, 398
Bond
class, 88, 112
object creation, 88
permited interconnection, 161
Bond graph, 27
model, 8
507
508
Component (cont.)
identier, 120
inertial, 29
object, 14
resistive, 31
source efforts, 32
source flows, 32
switch, 36
transformer, 33
visual representation, 78
Component buffer, 109
Component model, 26
Component object, 77
creation, 78
methods, 79
states, 110
text editing, 79
Component set
class, 96
selection, 95
Computational algebra, 11
Constitutive relations, 89
byte form, 162
dependent sources, 277
editing, 136
operators, 89
sources, 273
variables, 89
Controlled components, 35
Copy to Library, 109
Coriolis mass flowmeter, 477, 478
D
Decompiling, 180
Descriptor form, 69
Differential-algebraic equations (DAEs), 18,
157, 166
differentiation index, 166
discontinuities, 185
extended, 166
hidden constraint, 168
leading coefcient matrix, 169
perturbation index, 170
starting values, 182
tractability index, 169
Diodes, 283
dynamical model, 289
thermal model, 293
Discrete components
A/D converter, 40
clock, 41
D/A conversion, 42
delay, 42
Index
Display Plot, 110
Document, 26
class, 79
commands, 146
copying, 82
creation, 81
edit commands, 149
operations, 83
parameters, 83
persistent, 82
states, 115
visual representation, 79
Document commands
Open Next, 147
Drag and drop technique, 119
Dry friction, 222, 223
constitutive relation, 228
micro welds, 223
model, 228
stick-slip motion, 231
stick-slip oscillator, 234
E
Editing box, 118
Electrical components
capacitor, 267
coupled inductor, 270
current source, 272
DC motor, 349
inductor, 269
line section, 453
resistor, 266
switches, 279
voltage source, 272
Environment, 5
F
Fast Fourier Transform, 217
Function, 109
dened by tables, 326
overloading, 14
H
Help topics, 110
Homogenous transformation, 415
I
Impact, 237
model, 240
Impulse response, 216
Inheritance, 13
Inter-process communication, 151
IPC pipe, 127
Index
J
Joints. See Motion in
L
Library, 101
components, 101
project repository, 101
Linear gain, 42
Lookup table function, 130
M
Main application window, 107
Mathematical model, 158
generating, 165
system variables, 158
Mechanical components
beam element, 459
body in plane, 359
body in space, 396
body in translating frame, 469
contact, 240
dry friction, 228
impact, 240
joints, 364
revolute joint, 407
Mechatronics, 4
Methods, 12
Model exchange, 102
Modelling, 3
body in space, 396
body spring damper, 43, 194
control system, 334
electrical circuit, 48, 254
electromechanical systems, 324
general approach, 5
package vibration testing, 465
permanent magnet DC servo, 347
physical, 6
planar mechanism, 368
robot system. See Robot
see-saw, 53, 245
transmission lines, 452, 454
Models
simulation, 3
Motion in plane, 358
model of body, 360
prismatic joint, 365
model, 367
revolute joint, 364
Motion in space, 390
Euler Junction Structure, 403
model of body, 399
prismatic joints, 409
model, 411
509
revolute joints, 404
model, 407
rotational part, 402
translational part, 401
O
Object, 12
Operational ampliers, 317
improved model, 320
model, 318
P
Parameter hiding, 140
Parameters, 138
dene, 138
deletion, 141
tree, 139
Partial derivative matrix, 177
PID controller, 343
model, 343
Polymorphism, 13
Port, 7
activation port, 41
class, 86, 112
compound, 86
compounded, 26
connections, 92
control, 24
object creation, 86
Power ports, 24
Prex operator form, 162
Print document, 148
Project, 97
a simple control system, 334
Andrews squeezer mechanism, 374
ball bouncing
on a table at rest, 241
on a vibrating table, 243
body motion with dry friction, 229
body spring damper problem, 195
CMOS inverter, 314
coriolis mass flowmeter, 501
DC servo system, 347
diode recovery, 292
electric line, 454
engine torsional vibrations, 384
ltering of noise pulses, 276
inverting amplier, 321
menu, 107
n-channel JFET characteristics, 309
NMOS characteristics, 313
npn transistor characteristics, 302
op-amp characteristics, 319
package vibration testing, 471
510
quick return mechanism, 369
rectier circuit, 287
with self-heating, 297
RLC circuit, 255
see-saw problem, 245
stick-slip oscillator, 234
Projects
export, 109
import, 109
repair, 109
waste bin, 109
Pseudo-bond graphs, 8, 294
Pseudo random number, 85
Pseudo random number generator, 130
PUMA 560, 419
Q
Quantization interval, 41
R
Reset, 130
Robot
ABB IRB 1600, 445
arm and wrist, 422
controller, 426
IPC, 435
joints, 423
PUMA 560, 413
Puma 560 sequence, 445
simulation, 428
spherical wrist, 421
system model, 419
tcp position, 418
visualization pipeline, 436
visualization Puma 560, 442
workspace, 425
S
Sampling interval, 37
Show Joined, 124
Signal line, 128
Signals, 11
Simulation, 211
Index
Simulation parameters, 179
State-space equation, 72
State space form, 69
Storage buffer, 130
Symbol table, 159
creation, 159
Symbolic operations
differentiation, 109
System, 5
decomposition, 5
level, 97
System variable, 159
T
Template box, 131
Tools, 109
Torsional vibration, 383
model, 384
simulation, 388
Transistors, 298
bipolar junction, 299
junction eld effect, 305
MOSFET, 311
Trigger component, 130
V
Variables
across-through, 9
algebraic, 165
bond graph, 7
differentiated, 165
effort and flow, 7
generalized, 7
power, 7
View, 109
Visual environment, 105
W
Word model, 24, 26
Z
Zero-order hold, 42