OpenModelica/C2/Introduction-to-OMEdit/English

From Script | Spoken-Tutorial
Jump to: navigation, search
Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this spoken tutorial on Introduction to OMEdit.
Slide Number 2

Learning Objective

In this tutorial, we will learn,
  • About OpenModelica
  • Introduction to OMEdit
  • Open a Class from Libraries Browser
  • Simulate a Class from Libraries Browser
Slide Number 3

System Requirements

To record this tutorial, I am using
  • OpenModelica version 1.9.5 and
  • Ubuntu Linux OS 14.04

But, the process demonstrated in this tutorial is identical in other OS such as-

  • Windows,
  • Mac OS X or
  • FOSSEE OS on ARM.
Slide Number 4

Pre-requisites

To follow this tutorial, you should have knowledge of differential and algebraic equations.
Slide Number 5

Introduction to OpenModelica

What is OpenModelica?

OpenModelica is

  • an open-source modeling and simulation environment.
  • object-oriented, multi-domain modeling language for complex systems.
  • intended for both industrial and academic purposes.
Slide Number 6

About OMEdit

Let's first look at what is OMEdit.
  • OMEdit stands for OpenModelica Connection Editor.
  • It is a new Graphical User Interface for graphical model.
  • It has several features to create and modify the models.
/* Switch to OMEdit */ Now let me go to the OMEdit window.

I have already installed OMEdit on my system.

Point to Dash Home Click on Dash Home. To open OMEdit window, click on Dash Home.
Type OMEdit in the search bar >> click on OMEdit In the search bar, type OMEdit.

Click on the OMEdit icon that is displayed.

Switch to Welcome Perspective.

Hover the mouse on Recent Files and Latest News

On clicking OMEdit icon, we see the Welcome perspective window.

It shows a list of Recent Files and Latest News.

Switch to Libraries Browser.

Hover the mouse on the Libraries.

On the left side of OMEdit window, we see the Libraries Browser.

Here we can see a list of libraries.

/* Expanding Modelica Library

/* Click on expand button to the left of Modelica Library

Let us expand the Modelica library.

To do this, click on the arrow head to the left of Modelica library.

Here we can see list of available libraries.

/* Expand HeatTransfer library Click on the arrow head to the left of Thermal library.

Under Thermal, we find HeatTransfer library.

Expand it.

/* Point to different library items Once again, we see many different libraries displayed.

Now, let’s expand the Example library.

Here we can see different examples of Heat Transfer.

/* Opening TwoMasses Class in Example Library

/* Right click TwoMasses >> Open Class

Let us open the class named TwoMasses.

Right click on TwoMasses and select Open Class.

We can also double-click on the class name to open the class.

Switch to Modeling Perspective window

Switch to Diagram View.

Now we are in the Modeling Perspective window.

The class opens by default in Diagram View.

Don’t worry if the class doesn’t open in Diagram View.

I shall show you how to switch between different views.

Switch to Modeling area.

Point at the modeling area.

On the modeling area window, we can see the Diagram View of models.
Hover the mouse on modeling area On the top of the modeling area, we see four different icons.
/* Switch to Icon View */

Point to the first icon.

Click on Icon View button above Modeling Area

The first icon represents Icon View.

Click on it to see the Model representation.

/* Switch to Diagram View

/* Click on Diagram View button next to Icon View

The next icon represents Diagram view.

Click on it to see the diagram that represents the model.

/* Switch to Text View

/* Click on Text View button next to Diagram View.

Hover the mouse to Text View

Point to the Modelica code.

The third icon is Text View icon.

Let’s click on it.

Here we see the Modelica code pertaining to Two Masses class.

In upcoming tutorials, we will learn how to write code in OMEdit.

/* Switch to Documentation View.

/* Click on Documentation View button next to Text View.

Point to the new window.

Cursor on detailed information of the Modelica class.

Click on the next icon, which is Documentation view.

A new window named Documentation Browser opens on the right side of OMEdit window.

Here we can read the given detailed information about the model.

Close the Documentation Browser. Now close the Documentation Browser.
/* Checking a Class */ Before simulating a model, we need to check for correctness of the model.
Click green button with white colored double tick To do this, first locate Check All Models button on the toolbar.

This button has white coloured double ticks on it.

Click on it.

Getting error messages in Messages Browser.

Cursor on the Messages Browser.

Observe that a Messages Browser opens at the bottom of the window.

This will show messages pertaining to the Modelica class.

/* Simulating a Class */ Now, let’s try to simulate the model.
Click green colored arrow button To do this, click on green colored arrow button on the toolbar.

This is the Simulate button which is used to simulate the model.

We can also press Ctrl +B to simulate a Modelica class.

/* Switching to Simulation Output Window */ On simulating, a new window opens.
Hover the mouse on simulation output window. It shows the compilation process of the class.
Point to the success message. Once the compilation is successful, the output window displays the message:

Simulation process finished successfully.

Minimize this window.

/* Switching to Plotting Perspective */ By default, Plotting Perspective opens in the OMEdit window.

If it does not open, click the Plotting button at the bottom right.

We can also press Ctrl +F3 to open Plotting window.

Here we can see the simulation results of the Modelica class.
Switch to Variables Browser. On the right of Plotting Perspective, look at the Variables Browser window.
Point to Variables Browser. Under Variables Browser:

I will demonstrate how to change input variable values of a Modelica class.

Point to G, Q_flow and dT. Let’s expand the conduction variable.

Change the value of G and see how the values of Q_flow and dT change.

Point By default, G = 10, Q_flow = 264.13 W and dT = 26.413 K
Change G value to 15. Let us change the value of G from 10 to 15.

Type 15 and press Enter.

Click Re-simulate button. Go to the top right corner of the window.

Click Re-simulate button on the toolbar.

Point to the message >> minimize the window We get the success message window.

Minimize this window.

Point to the changes. Once simulation is completed, note the changes.

Q_flow = 202.249 W and dT = 13.4833 K

Cursor on the plot window. Now let me show you how to generate a plot.
Click on check box against dT variable. Click on the check box against dT variable.
Point to the plot, dT on Y-axis and time on X-axis. You can see a plot between time on X-axis and dT on Y-axis.

This plot describes the temperature difference between two masses varying with time.

/* Simulation Setup Window

/* Change Simulation Interval

Point to X-axis from 0 to 1 unit.

By default, the simulation runs from 0 to 1 unit time.

We can vary this interval using the Simulation Setup option.

Go to Modeling Perspective. For this, go to Modeling Perspective.

Click on Modeling button at the bottom right.

Or press Ctrl +F2 to open Modeling window.

Click on Simulation Setup option on the toolbar. Click on Simulation Setup option on the toolbar.
Point to Simulation Setup window. Simulation Setup window opens.
Change Stop Time to 5 unit. Change Stop Time to 5 unit.
Ensure that Simulate check box is checked. Ensure that Simulate check box is checked.
Click Ok. Click Ok.
Point to the success message window. Immediately, we get the success message window.
Minimize this window. Minimize this window.
Point to the simulation. The class is re-simulated with a simulation interval of 0 to 5 unit time.
/* Switch to Plotting Perspective */ We can also obtain a plot between any two variables, other than time.

Let’s try that now.

Generate Parametric Plot Window Click on New Parametric Plot Window on the toolbar.
Select Q_flow and dT. Let's select the two variables, Q_flow and dT that we wish to plot.
Point the graph, Q_flow on Y-axis and dT on X-axis.

Point to the plotted line

We can now see a plot between dT on X-axis and Q_flow on Y-axis.

It shows the variation of heat flow as the temperature difference between them decreases.

/* Delete Result in Variables Browser*/ Once the necessary plot is generated, we can delete the results.
Right Click on TwoMasses >> select Delete Result In the Variables Browser, right click on TwoMasses.

Select Delete Result.

The result has now been deleted.

/* Help from OpenModelica

/* Go to Help.

Click on OpenModelica users Guide (PDF).

OpenModelica has a Help menu.

Go to the Menu bar and click on Help option.

Here we can see User Guide, System, Scripting and Modelica Documentation.

Let's summarize.
Slide Number 7

Summery

In this tutorial, we have learnt,
  • About OpenModelica
  • Introduction to OMEdit
  • Open a Class from Libraries Browser
  • Simulate a Class from Libraries Browser
Slide Number 8

Assignment

As an assignment:
  • Expand Fluid library in Modelica
  • Expand Examples Library in Modelica.
  • Simulate HeatExchangerSimulation class in HeatExchanger Library
  • Change value of few input variables and re-simulate
  • Generate a plot between Q_Flow_1 and time.
Slide Number 9

About the Spoken Tutorial Project

Watch the video available at the following link.

It summarizes the Spoken Tutorial project.

Slide Number 10

Spoken Tutorial Workshops

The Spoken Tutorial Project Team:
  • conduct workshops using spoken tutorial.
  • Gives certificates to those who pass an online test.

For more details, please write to us.

Slide Number 11

Forum slide

Do you have questions in this Spoken Tutorial?

Please visit this site

Choose the minute and second where you have the question.

Explain your question briefly.

Someone from the FOSSEE team will answer them.

Slide Number 12

Forum for specific questions:

The Spoken Tutorial forum is for specific questions on this tutorial.

Please do not post unrelated and general questions on them

This will help reduce the clutter

With less clutter, we can use this discussions as instructional material.

Slide Number 13

Textbook Companion Project

The FOSSEE team coordinates coding of solved examples of popular books.

We give honorarium and certificates for those who do this.

For more details, please visit this site.

Slide Number 14

Lab Migration Project

The FOSSEE team helps migrate commercial simulator labs to OpenModelica.

We give honorarium and certificates for those who do this.

For more details, please visit this site.

Slide Number 15

Acknowledgements

Spoken Tutorial and FOSSEE projects are funded by NMEICT, MHRD, Government of India.
Slide Number 16

Thanks

This tutorial is contributed by Kaushik Datta and Priyam Nayak.

Thanks for joining.

Contributors and Content Editors

Kaushik Datta