0% found this document useful (0 votes)
78 views11 pages

Tutorials: Tutorial 17 - Getting Started With Modelica Edition

Tutorial 17 - Getting Started with Modelica(r) Edition explains the first steps from opening existing models and packages to modeling including result interpretation. For a better illustration a simple one mass oscillator will be built up using elements from the Modelica standard Library.

Uploaded by

ctnei
Copyright
© Attribution Non-Commercial (BY-NC)
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)
78 views11 pages

Tutorials: Tutorial 17 - Getting Started With Modelica Edition

Tutorial 17 - Getting Started with Modelica(r) Edition explains the first steps from opening existing models and packages to modeling including result interpretation. For a better illustration a simple one mass oscillator will be built up using elements from the Modelica standard Library.

Uploaded by

ctnei
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 11

Tutorials

Tutorial 17 – Getting Started with Modelica®


Edition

Objective
This tutorial gives an introduction to the SimulationX Modelica Edition, Opening Modelica
explaining the first steps from opening existing models and packages to files & packages
modeling including result interpretation. For a better illustration of the process, a
simple one mass oscillator will be built up using elements from the Modelica
Standard Library. Modeling with
Modelica Standard
Library
Before we start
Ensure you have addressed at least one entry in the Modelica search path. It can Editable Modelica
be changed via the menu Extras  Options  Directories. To have the Modelica code created
Standard Library units available you should furthermore add the path of the automatically
Modelica Standard Library into the Modelica search path.

Versatile analysis
possibilities

Figure 1: Set the Modelica search path


Page 2 of 11

Workflow

The following steps have to be carried out


• Get to know the Graphical User Interface of SimulationX
• Open examples of the Modelica Standard Library
• Create a simple model of a one mass oscillator
• Run a simulation and analyze the results
• Open the generated model

Graphical User Interface


Figure 2 shows the Graphical User Interface of SimulationX including different views, windows and
managers. Unlike other Modelica tools the GUI is fully customizable so you can decide where and
when views and windows shall be visible. The views can be activated via the menu View.

Diagram View Text View


Task
Pane
Library Bar

Result Window

Result
Manager

Model Explorer

Output

Figure 2: Customizable Graphical User Interface of SimulationX

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
Page 3 of 11

Modelica Standard Library Examples


To open one of the examples of the Modelica Standard Library in the Diagram View right-click on
the desired example and select Open SimulationX Model (Copy) as seen in figure 3.

3rd: Define
Library Bar
settings

1st: Right-click on
the desired example

2nd: Open as
SimulationX
Model (Copy)

Figure 3: Open an example of the Modelica Standard Library

With the help of the Library Bar settings you can define your specific standard actions. Therewith, it
is possible to open Modelica examples as SimulationX model via double-click as you might know
from Dymola®. Furthermore, you can decide whether name or comment of the model or even both
shall be displayed in the library tree.

Creation of a simple model


For the creation of the model of a one mass oscillator you need to arrange the three elements Mass,
SpringDamper and Fixed of the Modelica Standard Library in the Diagram View. Therefore, just
drag and drop the elements from Mechanics.Translational.Components into the Diagram View.

Figure 4: Arrange the mechanical elements in the model view

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 4 of 11

The definition of the properties and parameters of the sliding mass has to be carried out in three
steps:
1. Open the property window via double-click on the element
2. Set the mass in the tab Parameters to 100 kg
3. Switch to the tab General and change the name to Mass
... as seen in figure 5.

Figure 5: Definition of the parameters of the element Mass

The next step is to set the properties and parameters of the spring damper. Therefore, the spring
constant and the damping constant have to be defined including their specific quantities.
1. Open the property window of the element springDamper1
2. Open the Attribute Window and change the quantity with the help of the drop-down
menu to Linear Stiffness. Set the value to 10000 N/m. Equivalent quantities can be chosen
via the drop-down menu
3. Set the quantity of the damping constant to Linear Damping, the value to 100 Ns/m
4. Change the name of the element to SpringDamper

1st: Open
Property
Window

2nd: Open 3rd: Select


Attribute Quantity
Window

Figure 6: Editing of the SpringDamper

The element fixed1 is edited in the following way:


1. Turn the element by clicking on the red arrow and moving the mouse with pressed mouse
button
2. Change the name to Restraint

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 5 of 11

Before connecting the elements it is useful to label the pins via the menu View  Pin Labels.
Afterwards, the connections can be drawn via left-click at the pin flange_b of the element Mass and
moving the mouse with pressed mouse button to flange_a of the element SpringDamper.
SpringDamper and Restraint are connected in the same way.

Finally, a source to activate the mechanical system is needed. Choose the element ConstantForce
from Mechanics.Translational.Sources, set its parameter Nominal Force to 10 kN and change its
name to Force. To change the given quantity of the parameter use the drop-down menu at the
right-hand side of the Property Window.

Now the model of the one mass oscillator is finished and ready for simulation.

Figure 7: General page of the TypeDesigner

Visualization of the Modelica Code


A new feature of SimulationX 3.3 is the Text View option allowing you to edit the Modelica Code.
Open the Text View by right click on the tab of the Diagram View and select New Text View. A
second view named Model1*:2 shows the Modelica code of the model. Unlike Dymola®
SimulationX provides the parallel display of both, the Diagram and the Text View, via clicking at one
of the tabs and selecting New Vertical Tab Group. The main steps are shown in figure 8, the result
in figure 9.

Figure 8: Create the Text View of the model

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 6 of 11

Figure 9: Diagram View and Text View of the model

For a simple demonstration of the possibility of textual modeling we will rotate the element
Restraint. Therefore you just have to change the rotation angle of the placement annotation from
90 to 0 degree as shown in figure 10. After clicking at the Diagram View the clockwise rotation of
the element Restrain is visible.

Original Modelica code:


model Model1
Modelica.Mechanics.Translational.Components.Mass Mass(m=100) annotation
Modelica.Mechanics.Translational.Components.SpringDamper SpringDamper(
Modelica.Mechanics.Translational.Components.Fixed Restraint annotation
(Placement(transformation(
origin={45,10},
extent={{-10,-10},{10,10}},
rotation=90)));
Modified Modelica code:
model Model1
Modelica.Mechanics.Translational.Components.Mass Mass(m=100) annotation
Modelica.Mechanics.Translational.Components.SpringDamper SpringDamper(
Modelica.Mechanics.Translational.Components.Fixed Restraint annotation
(Placement(transformation(
origin={45,10},
extent={{-10,-10},{10,10}},
rotation=0)));

Figure 10: Modify the Modelica code

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 7 of 11

Saving the model


When saving your model you can choose between the three file types SimulationX Model (*.ism),
SimulationX Project (*.isx) and Modelica File (*.mo) via a drop-down menu.
In general, models are saved including all data, comments and results, but you have several options
for reducing the required disk space, e. g. by saving the model without results or compressing them
(figure 11).

Figure 11: Saving options

Simulation and analysis


The first step is to set the parameters for the transient simulation. Therefore, left-click the Property
Dialog and set the Stop Time tStop to 11 seconds.

1st: Open
Property Dialog

2nd: Set
Simulation time

Figure 12: Set the simulation parameters

In order to save space results are not logged automatically. Instead you choose them explicitly
before starting the simulation. Therefore select the element Mass in the Diagram View and activate
the protocol attribute of the absolute velocity v in the Model Explorer.

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 8 of 11

Afterwards, right-click on the element Mass and select Results (transient)  absolute velocity of
component v as shown in figure 13. A Result Window showing the velocity v of the Mass as a
function of time will be displayed.

2nd: Select

1st: Activate

Figure 13: Select the results

To add a second result activate the protocol attribute of the absolute position of the center of
component s in the Model Explorer and open the Result Window via drag and drop of the
activation button into the Structure View. To display both results in one common window just drag
and drop the output quantity s – Mass into the Result Window of v – Mass and adjust the window
size.

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 9 of 11

Figure 14: Ready for simulation including results velocity and position

Now the model can be simulated.


Start the simulation using either the start icon in the toolbar, pressing F5 or use the menu
Simulation  Start.
After having finished the simulation run, detailed information concerning the computation time,
computed steps etc. are displayed in the output window (figure 15).

Figure 15: Simulation finished successfully

Analysis
To display both output quantities in one chart select s – Mass and drag it into the chart of the
velocity v – Mass. By left-click Options  Properties  Tab: Y-Axes  Common Axes you can display
both characteristics on common axes.
For indicating the absolute velocity of the Mass as a function of its position click Options  y(x)-
Chart and change the axes. The described plots are shown in figure 16.

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 10 of 11

Figure 16: Different plotting options y(t) and y(x)

Via the menu View  Measure Bar you can measure all kinds of charts by mouse click.

Figure 17: Measuring options

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB
Page 11 of 11

Opening Models
In SimulationX you have several options for opening models. The most obvious method for opening
a model is via the menu File  Open or the folder symbol. A second option is to drag the file from
the Windows explorer into the SimulationX Diagram View. The third way to open a model is the
Task Pane which shows a list of the models that were modified recently.
One fact all options have in common is that the model is opened in the same view it was saved
including all result windows.

Open Model
via Task Pane

Figure 18: Open model from Task Pane

ITI Headquarters Webergasse 1 ⋅ 01067 Dresden ⋅ Germany ⋅ T +49 (0) 351 26050 0 ⋅ F +49 (0) 351 260 50 155 ⋅ [email protected]
SimulationX For your local representative please visit www.simulationx.com/global

ITI and SimulationX are registered trademarks of ITI GmbH Dresden. © ITI GmbH, Dresden, Germany, 2010. All rights reserved.
® Modelica is a registered trademark of the Modelica Association. For further information please visit www.modelica.org/documents
® Dymola is a registered trademark of Dynasim AB

You might also like