Difference between revisions of "OpenModelica/C2/OpenModelica-Connectors/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 86: Line 86:
 
| | Point to '''Specialization''' field and the classes.
 
| | Point to '''Specialization''' field and the classes.
  
Point to the Model.
+
Point to the '''Class'''.
  
 
| | In the '''Specialization''' field, select the type of '''class '''you wish to create.
 
| | In the '''Specialization''' field, select the type of '''class '''you wish to create.
  
I will choose '''Model'''.
+
I will choose '''Class'''.
  
 
|-
 
|-

Revision as of 15:40, 10 January 2017

Visual Cue Narration
Slide Number 1

Title Slide

Welcome to this spoken tutorial on OpenModelica Connectors.
Slide Number 2

Learning Objectives

In this tutorial, we will learn to:
  • Create a new class
  • Open an existing class
  • Connect different classes
  • Build a model and
  • Simulate the model
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

spoken-tutorial.org

To practice this tutorial, you need to know about OMEdit.

The Prerequisite tutorials are mentioned on our website.

Slide Number 5

Code Files

RLC_Circuit file used in the tutorial is provided as a code file on our site.

Download the files from Code Files link.

I have already opened the OMEdit window.
/* Creating a new class file and switching views */

Click on File >> New Modelica Class.

Now we will discuss how to create a new model.

First we will create a new class.

So go to File menu and select New Modelica Class.

Point to Create New Modelica Class window. Create New Modelica Class window appears.
Point to Name field.

Place the cursor in the Name field.

In the Name field, enter the name of the class which we want to create.

I will enter the name as Sample.

Point to Specialization field and the classes.

Point to the Class.

In the Specialization field, select the type of class you wish to create.

I will choose Class.

Click on OK. Then click on OK.
Point to the new class A new class will be created with the given name.

We will learn more about classes in the upcoming tutorials.

Click on File>> Save Now we will save this class.

For this, go to File menu and click on Save.

Choose an appropriate location to save this file.

Right click on Sample and select Unload.

Click Yes in the conformation dialog box that appears.

Let's close the Sample file.

Right-click on Sample and select Unload.

Click Yes in the confirmation dialog box that appears.

<<PAUSE>>
/* Opening a new class file and switching views */

Go to File >> Click to Open Model/Library File

Now we shall learn how to open an existing class.

To open a class, go to the File menu.

Then click on Open Model/Library File.

Click on Open. Select the desired file you wish to open and click on the Open button.
Slide Number 6

Connectors

Now we will learn about Connectors.

A Connector is a way for one model to exchange information with another model.

Slide Number 7


Use of Connectors

Use of Connectors:

Connectors are used in:

  • Connections
  • Communication
  • Coupling between component and outside world.
Point to RLC_Circuit file Next, we will learn to connect classes.

For this I will use RLC_Circuit file which we downloaded earlier.

Point to different classes in the package. RLC_Circuit is a Modelica package containing different classes.

Let’s expand the package.

Point to all the models in the package. Here we can see various classes namely,
  • Ground
  • VoltageSource
  • Resistor
  • Capacitor and
  • Inductor

and also a connector named Pin

We will learn more about classes and connectors in upcoming tutorials in this series.

Move the cursor on circuit class.

Point to the class.

Move the cursor over to all the blocks.

This package also contains a circuit class.

Double-click on the circuit file and go to the Text view.

Here we can see that the class doesn’t contain any code.

Go to Diagram View. Now go to Diagram View.
/* Placing all the components in the Grid */

Point to all the blocks/components in the grid area.

Let us place all the blocks/components in the grid area.

Then we will connect them.

Click on Resistor. Click on Resistor and drag and drop it into the grid space.
Click on Inductor.

Resistor>>Indicator.

Click on Inductor and place it next to the Resistor.
Click on Capacitor.

Indicator>> Capacitor.

Click on the Capacitor and place it next to the Inductor.
Click on VoltageSource.

Point the position of VoltageSource.

Next, click on the VoltageSource.

Place it above the R, L and C which are placed in series.

Click on Ground.

Point the position of Ground.

Point to all the components in the RLC Circuit.

Next, click on Ground.

Place it below the R, L and C components in series.

Now we have all the required components to construct the RLC Circuit in series.

/* Connecting the components to complete the circuit */ Let's connect these components.
Point to the left part of the component.

Point to the left part of the component.

The left part of the components represents p (positive) pin.

And the right part represents the n (negative) pin.

Move the mouse to negative pin of resistor.

Point to + sign.

Place the cursor over the negative pin of the Resistor.

We can see a '+' sign when the cursor is placed over n pin.

Click on the pin>> hold >> drag it to the p pin of Inductor. Click on the pin.

Hold and drag it to the p pin of the Inductor.

Click on its p pin Click on the Inductor's p pin and then release the cursor.
Point to indicator and capacitor.

Click on n pin of Inductor>> hold >> drag top pin of Capacitor.

Next, we will connect n pin of the Inductor with the p pin of the Capacitor.

Click on the n pin of the Inductor.

Hold and drag it to the p pin of the Capacitor.

Click on the p pin.

Point to the connection.

Click on the p pin of the Capacitor.

Now we have connected the Resistor, Inductor and Capacitor in series.

Click on p pin of Resistor>> hold >>drag to p pin of VoltageSource. Next step is to provide the VoltageSource.

Click on the p pin of the Resistor.

Hold and drag it to the p pin of the VoltageSource.

Point to the pin.

Click on n pin of Capacitor>> hold>> drag to n pin of VoltageSource.

Click on it.

Similarly, we will connect the n pin of the Capacitor with the n pin of the VoltageSource.

Click on the n pin of the Capacitor.

Hold and drag it to the n pin of the VoltageSource.

Click on the n pin and release the cursor.

Click on n pin of VoltageSource>>hold >> drag to p pin of Ground.

Click on it.

Point to the completed circuit.

Click on its p pin

Next step is to Ground the circuit.

Click on the n pin of the VoltageSource.

Hold and drag it to the Ground.

Click on it and release the cursor.

Now the circuit is complete.

Pause the tutorial and check that your circuit looks like mine.
Press CTRL + S Press CTRL + S to save the class.
/* Check the Model */

Click on Check All Models button.

Now we will check for the correctness of the class.

Click on Check All Models button.

Point to the message.

Point to equations and variables.

Observe that a Messages Browser.

This will show all the messages pertaining to the Modelica class.

It shows the number of equations and the number of variables.

Model will be ready to simulate if both of them are equal.

/* Simulate the Model */

Click on Simulate button.

Point to the window.

Click on the Simulate button.

A new window appears.

Point to the window. This output window displays the success message.
/* Generating plot for the Model */

Expand resistor1 >> click on Ir to get plot between Ir and time.

Expand resistor1 and click on Ir to get the plot between Ir and time.

We will learn more about Equations and Variables in the upcoming tutorials.

That's all for this tutorial.

Let's summarize.

Slide Number 8

Summary

In this tutorial, we have learnt to,
  • Create a new class
  • Open an existing class
  • Connect different classes
  • Build a Model and
  • Simulate the Model
Slide Number 9

Assignment

As an assignment-

Construct a RLC Circuit where:

Resistor, Inductor and Capacitor are in parellel connection.

Use the same classes and connectors available in the RLC_Circuit package.

Here is the diagram of the circuit which needs to be constructed.

[[Image:]]

Slide Number 10

About the Spoken Tutorial Project

Watch the video available at the following link.

http://spoken-tutorial.org/

It summarizes the Spoken Tutorial project.

Slide Number 11


Spoken Tutorial Workshop

The Spoken Tutorial Project Team
  • Conducts workshops using spoken tutorials
  • Gives certificates to those who pass an online test
  • For more details, please write to contact@spoken-tutorial.org
Slide Number 12

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.

Please post your times queries in this forum.
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 Kauhsik Datta and Priyam Nayak.

Thanks for joining.

Contributors and Content Editors

Kaushik Datta, Nancyvarkey