0% found this document useful (0 votes)
10 views2 pages

Emcs Exercise 05 2025

This document outlines Exercise 5 for Energy-Based Modeling of Complex Systems, focusing on simulation with OpenModelica. It includes tasks such as translating bond graphs to simulation models, creating a library of electro-mechanical network elements, and developing models for a quarter car, RLC circuit, and two mass system. The exercise encourages students to explore the equation-based approach and utilize provided model files for practical application.

Uploaded by

Salaudeen Ilyas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Emcs Exercise 05 2025

This document outlines Exercise 5 for Energy-Based Modeling of Complex Systems, focusing on simulation with OpenModelica. It includes tasks such as translating bond graphs to simulation models, creating a library of electro-mechanical network elements, and developing models for a quarter car, RLC circuit, and two mass system. The exercise encourages students to explore the equation-based approach and utilize provided model files for practical application.

Uploaded by

Salaudeen Ilyas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Energy-Based Modeling of Complex Systems – Exercise 5

Exercise 5 – Simulation with OpenModelica

This exercise shall encourage you to translate your bond graphs to simulation models and try out the equation-
based approach. There will be no “solutions” to the programming exercises, but you you will be provided with
the model files for the mass-spring-damper system on moodle (see also the short introduction in the lecture
notes). This shall enable you do set up the OpenModelica models also for the other example systems!
OpenModelica is not a topic of the exam, so this sheet is for students interested in the approach.

5.1 Structure of Modelica Models and Simulation Results

To get an idea about what type of models Modelica generates, and how the simulations results are stored,
open the OpenModelica Shell and type the commands shown in the screenshot in Fig. 5.1. It is assumed that
the model files of the mass-spring-damper system are located in the directory "e:/".

Figure 1: Screenshot of the OpenModelica Shell with the commands to execute in Exercise 5.1.

© Prof. Dr.-Ing. habil. Paul Kotyczka 1


Chair of Automatic Control
Technical University of Munich
Energy-Based Modeling of Complex Systems – Exercise 5

a) The command exportDAEtoMatlab generates the Matlab script msd_imatrix.m. What information
is stored in the cell arrays IM, VL, EqStr and OldEqStr?
Remark: Modelica obtains the numerical solution of a model by default after a transformation of the
DAE to an ODE representation. However, also a direct solution of the DAE model with a corresponding
solver is possible, which can reduce the effort of model post-processing1 .

b) Once in Matlab, load the file msd_res.mat with the simulation data. Browse the data structures and
write a Matlab script, which generates a plot that represents the elongation of the spring and the velocity
of the mass over time.

5.2 Library of Electro-Mechanical Network Elements

Starting with the example models mass.mo, spring.mo and damper.mo, create a library (a collection of
models) in OpenModelica for the network elements in the examples we have treated so far.

In the remaining exercises, the parameter values for the considered models are not a priori given. Choose
yourself typical parameters values that are physically reasonable and would fit to the considered application.
Do a quick research in the literature/on the web if necessary.

5.3 Quarter Car Model

Create a Modelica model QuarterCar.mo using the (sub-)models from your library. When simulating the
quarter car model, the following issues can be interesting:

a) Simulate the system behavior for different road profiles (input velocities). To this end, the corresponding
velocity must be equated with an appropriate time function. Find out in the OpenModelica documen-
tation how this works.

b) How could you import, for example, a velocity profile given in a csv table?

c) Create nonlinear models NLspring.mo and NLdamper.mo for spring and damper with corresponding
characteristics that can be tuned by a set of parameters. You can use, for example, a degressive damper
and a progressive spring model. Search in the literature. Replace the linear models in the quarter car
model and describe differences in the dynamic behavior.

5.4 RLC Circuit

Set up a Modelica model RLCcircuit.mo for the RLC circuit and check its correctness by the matching of the
simulation results with characteristic quantities that can be computed, e.g., the (undamped) eigenfrequency.

5.5 Two Mass System

Finally, create the Modelica model TwoMassSystem.mo. Excite the system with test inputs like steps in the
input voltage and load torque. Does the system react in the physically meaningful way? Consider the transient
dynamics and the behavior in steady state.
1 See www.openmodelica.org/doc/OpenModelicaUsersGuide/latest/solving.html

© Prof. Dr.-Ing. habil. Paul Kotyczka 2


Chair of Automatic Control
Technical University of Munich

You might also like