Type Safety of Equation-Based Object-Oriented Modeling Languages Background Why is EOO Important?

advertisement
Type Safety of Equation-Based Object-Oriented Modeling Languages
David Broman and Peter Fritzson
Department of Computer and Information Science, Linköping University, Sweden
Background
Why is EOO Important?
What is an EOO-Language?
R2
Ind
E...
Inertia1
L=0.1
k=1
R=200
L=1
C1
R=10
R1
L
Multi-Domain
Can be used for modeling complex physical
systems in multiple domains, e.g., electrical,
mechanical, and hydraulic.
C=0.01
sineVoltage
R
Hybrid Modeling
Both continuous- and discrete-time
behavior of a system can be described.
R=50
Equation-based Object-Oriented (EOO)-languages
typically possess the following characteristics:
The continuous-time behavior is described by
using Differential Algebraic Equations (DAEs).
Graphical modeling using well-defined
graphical components.
Textual modeling of components using a
high-level language syntax.
Making use of OO-concepts, such as
inheritance, subtyping, and abstraction.
Acausal Modeling
Modeling is primarily based on equations,
rather than statements.
AC=220
Computer aided modeling and simulation of complex
physical systems, using components from multiple
domains, such as electrical, mechanical, and
hydraulic, have in recent years witnessed a
significant growth of interest. Generalpurpose simulation tools, e.g., Simulink,
using block diagrams and causal
connections have dominated the
area for years. However, in the
last decade novel languages,
(e.g., Modelica[1], gPROMS[2],
and VHDL-AMS[3]) based on
acausal modeling using
Differential Algebraic
Equations (DAEs),
have evolved. We
call these kind
of languages
Equation-based
Object-Oriented
(EOO).
spring
c=1
J=0.1
model Circuit
Ground G;
Resistor R1(R=50);
Resistor R2(R=200);
Inductor Ind(L=0.1);
Capacitor C1(C=0.01);
SineVoltage AC(V=220);
equation
connect(AC.n, C1.n);
connect(AC.p, R1.p);
connect(R1.p, R2.p);
connect(R1.n, C1.p);
connect(R2.n, Ind.p);
connect(C1.n, Ind.n);
connect(G.p, AC.n);
end Circuit;
model TwoPin
Pin p, n;
Voltage v;
Current i;
equation
v = p.v - n.v;
0 = p.i + n.i;
i = p.i;
end TwoPin;
model Inductor
extends TwoPin;
parameter Real L = 1;
equation
L*der(i) = v;
end Inductor;
G
Figure 3. Simple electrical circuit viewed both as graphical components and textual source code.
G
y
world
r={L1,0,0}
a
x
b
b
a
bodyBox
n={0,0,1}
actuatedRev...
revolute
b
a
n={0,0,1}
r={L2,0,0}
b
a
bodyBox1
Validation
Figure 2. Modelica model of a motor connected to a double
pendulum. Illustrates multi-domain usage, where an electrical
circuit is combined with mechanical components.
Figure 1. An ABB-robot that could be modeled and simulated by
an equation-based object-oriented (EOO)-language.
The Problems
Large and Complex Languages
Currently available EOO-languages are large
and complex, which make them hard to
analyze and reason about.
To the best of our knowledge, no EOOlanguage has a complete precise formal
semantics including formal type system.
Hence, no type-soundness proofs exist
for this kind of languages.
Early Error Detection
No complete solution exists for:
Detecting and debugging under- or overconstrained systems of equations at the
component and type system level.
Static Unit checking. Detect and automatically
convert between physical units (e.g., newton,
meter, and ampere).
Separately Compiled Components
In for example Modelica, no sound solution exists
to separately compile components and still make
full use of symbolic transformations.
Objectives and Approach
Project Objectives
Improve the theoretical foundation of EOOlanguages.
Enable engineers to detect modeling errors
at an early stage.
Our Approach
Define a formally specified kernel language,
called Modeling Kernel Language (MKL) that:
Describes the core concepts of EOO-languages.
Makes use of static type checking.
Is minimal and expressive.
Modeling Kernel
Language
(MKL)
Modelica
models
Correctness
Formal operational semantics including
type system.
Type soundness proofs.
Relevance and Usefulness
Transform real Modelica models collected
from industry to MKL.
Perform experiments on a prototype
implementation of MKL.
References
[1] Modelica Association. Modelica - A Unified Object-Oriented Language
for Physical Systems Modeling – Language Specification Version 2.2,
February 2005. Available from: http://www.modelica.org
[2] M. Oh and C. C. Pantelides. A Modelling and Simulation
Language for Combined Lumped and Distributed Parameter
Systems. Computers and Chemical Engineering, 20(6-7):611-633, 1996.
[3] Ernst Christen and Kenneth Bakalar. VHDL-AMS – A Hardware
Description Language for Analog and Mixed-Signal Applications. IEEE
Transactions on Circuits and Systems II: Analog and Digital Signal Processing,
46(10):1263-1272, 1999.
Transformation
Figure 4. Illustrates our approach of developing a precise formal kernel language to which
models constructed in for example the Modelica language can be transformed.
Acknowledgement
This research work is funded by CUGS (the
Swedish National Graduate School in Computer
Science), by SSF under the VISIMOD project, and
by Vinnova under the NETPROG Safe and Secure
Modeling and Simulation on the GRID project.
§
Further Information
Please contact David Broman davbr@ida.liu.se
or Prof. Peter Fritzson petfr@ida.liu.se for more
information. An electronic version of this poster can be
downloaded at www.ida.liu.se/~davbr.
Download