You are on page 1of 3

Modelica Lecture - Outline

Introduction to the Modelica language and


the simulating environment Dymola, part I Introduction, relation between Modelica and Dymola,
applications, overview of Dymola
Staffan Haugwitz
Introduction to the Modelica language, syntax and
constructs
Dept. of Automatic Control
Traps and pitfalls (high index problem, stiff systems)
Lund University

Based on material from Modelon

Modelica in Vehicle Modeling Modelica in Microturbine Systems

Modelica Features Modelica vs Simulink

Declarative equations
Write the model equations as they are derived from
physics, instead of deriving the right hand side. Acausal modeling
Declarative languages just require
dP2
= F4 F5 ;
 
C dP2 1 F1 cp(T2 T1 ) the developer to define the problem
dt = F5 ;
dt C at a higher level and leaves the
F4 = F1 cp(T2 T1 );
solution to the simulation tool
Object-oriented modeling language Block-oriented modeling
(classes, instances, inheritence...) Procedural programmes require
Component models the developer to define the order
Easy to build libraries of reusable code. Modelica standard that calculations are to be done in
library contains 740 different models, ready to use or
modify.

Modelica vs Dymola Dymola Overview 1

1
Dymola Overview 2 Dymola Introduction 1

Dymola Introduction 2 Dymola Introduction 3

Dymola Introduction 4 Dymola Introduction 5

Dymola Introduction 6 Dymola Introduction 7

2
Dymola Introduction 8 Simulation in Dymola 1

Simulation in Dymola 2 Simulation in Dymola 3

Live Demo 1 - Pendulum Live Demo 2 - MotorDrive

Build model by editing text equations Build model by using existing components

Simple planar pendulum Simple DC motor with ideal gearbox and inertia
Two states Three states

= sin (1)
L

model SimplePendulum
constant Real g = 9.81;
parameter Real L = 1;
Real Theta(start = 0.1);
Real ThetaDot;
equation
ThetaDot = der(Theta);
der(ThetaDot) = - g/L*sin(Theta);
end SimplePendulum;

Dymola features - Linearization

Linearize model, from Simulation-menu, beware


linearization is at the start time t = 0!
Simulate model to the desired linearization point
Set the final state as the initial state with importInitial();
Linearize as usual
Load file dslin.mat into Matlab with e.g. tloadlin, many
specific matlab routines delivered with Dymola.

You might also like