Difference between revisions of "OpenModelica/C3/Component-oriented-modeling/English"
Nancyvarkey (Talk | contribs) |
|||
(One intermediate revision by the same user not shown) | |||
Line 26: | Line 26: | ||
* '''OpenModelica 1.9.2'''. | * '''OpenModelica 1.9.2'''. | ||
− | * '''Ubuntu | + | * '''Ubuntu Operating System version 14.04'''. |
* But this process is identical to any of the following operating systems. | * But this process is identical to any of the following operating systems. | ||
Line 52: | Line 52: | ||
For example, an individual can be considered an instance of human being '''class'''. | For example, an individual can be considered an instance of human being '''class'''. | ||
− | '''Instance''' of a class has the same variables and equations as the class itself. | + | '''Instance''' of a '''class''' has the same variables and equations as the '''class''' itself. |
|- | |- | ||
Line 67: | Line 67: | ||
|- | |- | ||
− | || | + | || Switch to '''OMEdit''' |
|| Let me switch to '''OMEdit'''. | || Let me switch to '''OMEdit'''. | ||
Line 75: | Line 75: | ||
*'''simpleCircuit'''. | *'''simpleCircuit'''. | ||
− | Double click on '''classInstantiationExample'''. | + | Double-click on '''classInstantiationExample'''. |
− | Let us discuss more about this class now. | + | Let us discuss more about this '''class''' now. |
|- | |- | ||
Line 85: | Line 85: | ||
|| Let me shift '''OMEdit''' window to the left for better visibility. | || Let me shift '''OMEdit''' window to the left for better visibility. | ||
− | Here, I have instantiated the '''bouncingBall''' | + | Here, I have instantiated the '''bouncingBall class''' to create two objects named |
* '''object1''' and | * '''object1''' and | ||
* '''object2'''. | * '''object2'''. | ||
− | Note that each instance has different start values for the height variable '''h'''. | + | |
+ | Note that each '''instance''' has different start values for the height variable '''h'''. | ||
+ | |||
Please refer prerequisite tutorials for more information on the '''bouncingBall''' model. | Please refer prerequisite tutorials for more information on the '''bouncingBall''' model. | ||
Line 102: | Line 104: | ||
The class did not simulate and it threw up an error. | The class did not simulate and it threw up an error. | ||
− | This is because '''bouncingBall''' | + | This is because '''bouncingBall class''' is not open in '''OMEdit'''. |
|- | |- | ||
|| Load and Simulate | || Load and Simulate | ||
− | || Open '''bouncingBall''' | + | || Open '''bouncingBall class''' which you downloaded from the website. |
− | Now, simulate this class once again. | + | Now, simulate this '''class''' once again. |
Close the pop up window. | Close the pop up window. | ||
Line 114: | Line 116: | ||
|- | |- | ||
|| Click on the '''+''' button beside '''Ball1''' in '''variables browser'''. | || Click on the '''+''' button beside '''Ball1''' in '''variables browser'''. | ||
− | || Note that the class simulates successfully this time around. | + | || Note that the '''class''' simulates successfully this time around. |
− | This exercise demonstrates that a class should be open in '''OMEdit''' to be instantiated. | + | |
+ | This exercise demonstrates that a '''class''' should be open in '''OMEdit''' to be instantiated. | ||
Expand '''object1''' variables in the '''variables browser'''. | Expand '''object1''' variables in the '''variables browser'''. | ||
|- | |- | ||
− | || | + | || Highlight the variables. |
− | || Note that the variables listed here are declared in '''bouncingBall''' | + | || Note that the variables listed here are declared in '''bouncingBall class'''. |
− | |||
− | Now delete the result and go back to the slides. | + | These variables are also a part of '''object1''' and '''object2''' since the adjust instances of the '''bouncingBall class'''. |
+ | |||
+ | |- | ||
+ | ||Delete the result >> switch back to the slides. | ||
+ | ||Now delete the result and go back to the slides. | ||
|- | |- | ||
Line 148: | Line 154: | ||
|| '''Acausal connectors''' serve as the interface between component instances. | || '''Acausal connectors''' serve as the interface between component instances. | ||
− | They are defined using '''connector''' | + | They are defined using '''connector class'''. |
+ | |||
+ | For example, '''pins''' can be used as '''connectors''' for electrical components. | ||
− | |||
We will learn more about this when we try to simulate the example for an electric circuit. | We will learn more about this when we try to simulate the example for an electric circuit. | ||
− | |||
− | they cannot contain equations. | + | '''Connectors''' content across and flow variables and they cannot contain equations. |
|- | |- | ||
Line 162: | Line 168: | ||
'''Circuit Diagram''' | '''Circuit Diagram''' | ||
− | || Now, let us simulate this Electric Circuit shown in the slide. | + | || Now, let us simulate this '''Electric Circuit''' shown in the slide. |
The voltage of battery is given by '''{Vo*Sin(2*pi*f*t)}''', where '''Vo''' is '''10''' Volts, '''f''' is '''1''' Hz and the resistance is '''5''' ohm. | The voltage of battery is given by '''{Vo*Sin(2*pi*f*t)}''', where '''Vo''' is '''10''' Volts, '''f''' is '''1''' Hz and the resistance is '''5''' ohm. | ||
Line 170: | Line 176: | ||
'''Solution Methodology''' | '''Solution Methodology''' | ||
− | || Let us take a look at the '''Solution Methodology''' to model the electric circuit shown in previous slide: | + | || Let us take a look at the '''Solution Methodology''' to model the '''electric circuit''' shown in previous slide: |
− | Note that any Resistor and Voltage Source have two pins: '''Positive''' and '''Negative'''. | + | Note that any '''Resistor''' and '''Voltage Source''' have two pins: '''Positive''' and '''Negative'''. |
− | * Hence, define a connector named '''pin'''. | + | * Hence, define a '''connector''' named '''pin'''. |
− | * Define a class named '''Ground''' with one instance of pin connector. | + | * Define a '''class''' named '''Ground''' with one instance of '''pin connector'''. |
− | * Define a class named '''Resistor'''. | + | * Define a '''class''' named '''Resistor'''. |
− | * The '''Resistor''' | + | * The '''Resistor class''' should have two instances of the '''pin connector''': '''Positive pin''' and the '''Negative pin'''. |
− | * Define a class named '''VoltageSource''' with two instances of '''pin''' | + | * Define a '''class''' named '''VoltageSource''' with two instances of '''pin connector''' as we have seen in the case of '''resistor class'''. |
− | * Define a class named '''simpleCircuit'''. | + | * Define a '''class''' named '''simpleCircuit'''. |
* '''simpleCircuit''' should have instances of '''Resistor''' and '''VoltageSource'''. | * '''simpleCircuit''' should have instances of '''Resistor''' and '''VoltageSource'''. | ||
− | * Connect the respective pins of '''Resistor''', '''ground''' and the '''VoltageSource'''. | + | * Connect the respective '''pins''' of '''Resistor''', '''ground''' and the '''VoltageSource'''. |
|- | |- | ||
|| | || | ||
Line 189: | Line 195: | ||
|- | |- | ||
− | || | + | || Switch to '''OMEdit''' >> '''Modeling perspective'''. |
|| Let me switch to '''OMEdit'''. | || Let me switch to '''OMEdit'''. | ||
Line 197: | Line 203: | ||
|| Click on the '''plus''' button beside '''simpleElectricCircuit''' in '''Libraries Browser'''. | || Click on the '''plus''' button beside '''simpleElectricCircuit''' in '''Libraries Browser'''. | ||
|| Let me shift '''OMEdit''' window to the right. | || Let me shift '''OMEdit''' window to the right. | ||
+ | |||
Expand '''simpleElectricCircuit'''package in the '''Libraries Browser'''. | Expand '''simpleElectricCircuit'''package in the '''Libraries Browser'''. | ||
− | Note that this package has five classes named: | + | Note that this package has five '''classes''' named: |
* '''pin''', | * '''pin''', | ||
Line 211: | Line 218: | ||
Close '''ClassinstantiationExample'''. | Close '''ClassinstantiationExample'''. | ||
+ | |||
Let me shift '''OMEdit''' window to the left once again for better visibility. | Let me shift '''OMEdit''' window to the left once again for better visibility. | ||
Line 222: | Line 230: | ||
|| '''Modelica.SIunits''' package has been imported in the package '''simpleElectricCircuit'''. | || '''Modelica.SIunits''' package has been imported in the package '''simpleElectricCircuit'''. | ||
− | Hence, type definitions in that package can be used without reference to their full names. | + | |
+ | Hence, '''type''' definitions in that package, can be used without reference to their full names. | ||
|- | |- | ||
|| Scroll down | || Scroll down | ||
− | || Let us try to understand '''pin''' | + | || Let us try to understand '''pin connector'''. |
Scroll down a little bit. | Scroll down a little bit. | ||
Line 232: | Line 241: | ||
|- | |- | ||
|| // connector pin // | || // connector pin // | ||
− | || '''Pin''' is defined using '''connector''' | + | || '''Pin''' is defined using '''connector class'''. |
|- | |- | ||
− | || | + | || Highlight the variables |
|| '''Voltage''' and '''current''' are the variables that a '''pin''' exchanges with its surroundings. | || '''Voltage''' and '''current''' are the variables that a '''pin''' exchanges with its surroundings. | ||
|- | |- | ||
|| // Voltage v; // | || // Voltage v; // | ||
− | || Potential at the pin is defined by '''v'''. | + | || '''Potential''' at the '''pin''' is defined by '''v'''. |
− | '''Voltage''' and '''Current''' are types defined in '''SIunits''' package of | + | |
+ | '''Voltage''' and '''Current''' are '''types''' defined in '''SIunits''' package of '''Modelica library'''. | ||
|- | |- | ||
Line 248: | Line 258: | ||
|| '''Voltage''' across a component causes a current to flow through it. | || '''Voltage''' across a component causes a current to flow through it. | ||
− | Hence, current is a '''flow''' variable and is defined using '''flow''' | + | Hence, '''current''' is a '''flow''' variable and is defined using '''flow keyword'''. |
|- | |- | ||
|| // annotation(....); // | || // annotation(....); // | ||
− | || '''pin''' | + | || '''pin connector''' also has an '''Icon view''' specified by '''annotations''' as shown. |
|- | |- | ||
|| Scroll down to '''Resistor''' class | || Scroll down to '''Resistor''' class | ||
− | || Now let us discuss a little about '''Resistor''' | + | || Now let us discuss a little about '''Resistor class.''' |
Scroll down a little more. | Scroll down a little more. | ||
Line 264: | Line 274: | ||
pin n ann(...); // | pin n ann(...); // | ||
− | || As discussed in the '''Solution Methodology''', '''Resistor''' | + | || As discussed in the '''Solution Methodology''', '''Resistor class''' has two instances of '''pin connector'''. |
− | '''p''' stands for positive pin and | + | *'''p''' stands for '''positive pin''' and |
− | '''n''' stands for negative pin. | + | *'''n''' stands for '''negative pin'''. |
|- | |- | ||
|| | || | ||
− | || Now, let me show you how to instantiate a class using the '''drag and drop''' functionality of '''OMEdit'''. | + | || Now, let me show you how to instantiate a '''class''' using the '''drag and drop''' functionality of '''OMEdit'''. |
|- | |- | ||
|| Press Ctrl + N | || Press Ctrl + N | ||
− | || To demonstrate that, let me open a new class using '''Ctrl + N'''. | + | || To demonstrate that, let me open a new '''class''' using '''Ctrl + N'''. |
|- | |- | ||
|| Type '''example''' in the '''name''' field. | || Type '''example''' in the '''name''' field. | ||
− | || Name this | + | || Name this '''class example1''' and press '''Ok'''. |
Shift '''OMEdit''' window to the right. | Shift '''OMEdit''' window to the right. | ||
|- | |- | ||
− | || | + | || Click on '''Diagram View''' |
|| Go to '''Diagram View''' if the class opens in '''Text View'''. | || Go to '''Diagram View''' if the class opens in '''Text View'''. | ||
|- | |- | ||
− | || Drag and | + | || Drag and drop '''pin''' icon in '''Libraries Browser'''. |
− | || Now let me instantiate '''pin''' | + | || Now let me instantiate '''pin class'''. |
− | Left click on '''pin''' icon in '''Libraries Browser'''. | + | Left-click on '''pin''' icon in '''Libraries Browser'''. |
+ | |||
+ | Hold and drag the icon to the '''diagram''' layer. | ||
− | |||
Drop it at any location on the canvas. | Drop it at any location on the canvas. | ||
− | We have now created an instance of '''pin''' | + | |- |
+ | || | ||
+ | ||We have now created an '''instance''' of '''pin class'''. | ||
− | You may also change the dimensions and location after dropping it as shown. | + | |
+ | You may also change the dimensions and location after dropping it, as shown. | ||
|- | |- | ||
− | || | + | || Click on '''Text View''' |
− | || Now let us see how this class is instantiated in '''Text View'''. | + | || Now let us see how this '''class''' is instantiated in '''Text View'''. |
Go to '''Text View'''. | Go to '''Text View'''. | ||
Line 310: | Line 324: | ||
|- | |- | ||
|| // simpleElectricCircuit // | || // simpleElectricCircuit // | ||
− | || Notice the command for instantiation of | + | || Notice the command for instantiation of '''class pin''' and an '''annotation''' based on its placement in '''Diagram View'''. |
+ | |||
+ | Hence, creating an '''instance''' of a '''class''' in '''Diagram View''' automatically reflects in the '''Text View'''. | ||
− | |||
Now let me close '''example1''' tab. | Now let me close '''example1''' tab. | ||
− | Let us learn | + | Let us learn how to model '''electric circuit''' that we saw in the slides. |
|- | |- | ||
− | || | + | || Double-click on '''Circuit''' |
− | || Double click on '''Circuit''' icon which is also a part of '''simpleElectricCircuit''' package. | + | || Double-click on '''Circuit''' icon which is also a part of '''simpleElectricCircuit''' package. |
− | This class already has our circuit of interest assembled as can be seen in its '''Diagram View'''. | + | This '''class''' already has our circuit of interest assembled, as can be seen in its '''Diagram View'''. |
It is ready to be simulated. | It is ready to be simulated. | ||
Line 328: | Line 343: | ||
|- | |- | ||
|| | || | ||
− | || But let us build the same circuit in a new file. | + | || But let us build the same '''circuit''' in a new file. |
We shall use '''drag and drop''' functionality that we have just learnt about. | We shall use '''drag and drop''' functionality that we have just learnt about. | ||
|- | |- | ||
− | || | + | || '''Ctrl + N''' >> name the file >> press '''Ok''' |
|| Press '''Ctrl + N'''. | || Press '''Ctrl + N'''. | ||
Name this file '''circuit(underscore)construction'''. | Name this file '''circuit(underscore)construction'''. | ||
+ | |||
Press '''OK'''. | Press '''OK'''. | ||
Line 342: | Line 358: | ||
|- | |- | ||
|| Click on '''Diagram View'''. | || Click on '''Diagram View'''. | ||
− | || Switch to '''Diagram View''' if it opens in '''Text View'''. | + | || Switch to '''Diagram View''', if it opens in '''Text View'''. |
|- | |- | ||
|| Select, drag and drop Voltage Source | || Select, drag and drop Voltage Source | ||
|| Select, drag and drop the '''VoltageSource''' icon from '''Libraries Browser'''. | || Select, drag and drop the '''VoltageSource''' icon from '''Libraries Browser'''. | ||
+ | |||
You may change its dimensions as you wish. | You may change its dimensions as you wish. | ||
Line 355: | Line 372: | ||
|- | |- | ||
− | || Select, drag and drop Ground. | + | || Select, drag and drop '''Ground'''. |
− | || Do the same with '''Ground''' | + | || Do the same with '''Ground class'''. |
|- | |- | ||
|| | || | ||
− | || Now, we need to connect the respective pins of each component. | + | || Now, we need to connect the respective '''pins''' of each component. |
|- | |- | ||
|| Hover over the left pin of Voltage Source. | || Hover over the left pin of Voltage Source. | ||
− | || Let us first connect the positive pin of Voltage Source to the positive pin of Resistor. | + | || Let us first connect the '''positive pin''' of '''Voltage Source''' to the '''positive pin''' of '''Resistor'''. |
Hover over the left pin of '''Voltage Source'''. | Hover over the left pin of '''Voltage Source'''. | ||
− | The text that appears indicates that, this is the | + | The text that appears indicates that, this is the '''positive pin p'''. |
|- | |- | ||
|| Connect the positive pin of voltage source to positive pin of resistor. | || Connect the positive pin of voltage source to positive pin of resistor. | ||
− | || Left click on this pin and drag the cursor closer to the left pin of Resistor. | + | || Left click on this '''pin''' and drag the cursor closer to the left '''pin''' of '''Resistor'''. |
Leave the mouse when the appearance of cursor changes to cross from an arrow. | Leave the mouse when the appearance of cursor changes to cross from an arrow. | ||
Line 378: | Line 395: | ||
|- | |- | ||
|| Connect the negative pin of voltage source to negative pin of resistor. | || Connect the negative pin of voltage source to negative pin of resistor. | ||
− | || Similarly, connect the negative pin of resistor to the negative pin of voltage source. | + | || Similarly, connect the '''negative pin''' of '''resistor''' to the '''negative pin''' of '''voltage source'''. |
|- | |- | ||
− | || Connections to Ground | + | || Connections to '''Ground''' |
|| We have not mentioned the connections with '''Ground''' in the circuit diagram. | || We have not mentioned the connections with '''Ground''' in the circuit diagram. | ||
− | But, we need to connect the negative pins of | + | But, we need to connect the '''negative pins''' of '''Resistor''' and '''Voltage Source''' to '''Ground''' individually. |
− | This ensures a reference point for potential in the circuit. | + | This ensures a reference point for '''potential''' in the '''circuit'''. |
|- | |- | ||
|| Press Ctrl + S | || Press Ctrl + S | ||
− | || Now, this class is complete. | + | || Now, this '''class''' is complete. |
− | Save the class by pressing '''Ctrl + S'''. | + | Save the '''class''' by pressing '''Ctrl + S'''. |
|- | |- | ||
|| Click on '''Simulate''' button. | || Click on '''Simulate''' button. | ||
|| Click on '''Simulate''' button. | || Click on '''Simulate''' button. | ||
+ | |||
Close the pop up window. | Close the pop up window. | ||
− | The class has simulated successfully. | + | |- |
+ | || | ||
+ | ||The '''class''' has simulated successfully. | ||
− | Let me shift '''OMEdit''' window to the left for better visibility of ''' | + | |
+ | Let me shift '''OMEdit''' window to the left for better visibility of '''Variables browser'''. | ||
|- | |- | ||
Line 408: | Line 429: | ||
|| Expand '''Resistor''' column in the '''Variables Browser''' and select '''Ir'''. | || Expand '''Resistor''' column in the '''Variables Browser''' and select '''Ir'''. | ||
− | Note that the profile is sinusoidal as expected. | + | Note that the profile is '''sinusoidal''' as expected. |
− | Since the | + | Since the '''Voltage Source''' is an '''AC''' source instead of '''DC'''. |
|- | |- | ||
Line 416: | Line 437: | ||
|| Hence, we have created a model from its component parts and simulated it. | || Hence, we have created a model from its component parts and simulated it. | ||
− | We shall learn more about the Resistor and Voltage Source classes that we used here in the next tutorial. | + | We shall learn more about the '''Resistor''' and '''Voltage Source classes''' that we used here in the next tutorial. |
|- | |- | ||
− | || | + | || Switch to the slides. |
|| Let me switch to the slides. | || Let me switch to the slides. | ||
Line 428: | Line 449: | ||
'''Assignment''' | '''Assignment''' | ||
− | || As an assignment, construct an electric circuit with two resistors in series with one | + | || As an assignment, construct an '''electric circuit''' with two '''resistors''' in '''series''', with one '''Voltage Source'''. |
− | Use the component models for Voltage source and Resistor provided in simple electric circuit package. | + | Use the component models for '''Voltage source''' and '''Resistor''' provided in '''simple electric circuit''' package. |
|- | |- |
Latest revision as of 14:54, 29 March 2016
Visual Cue | Narration |
Slide:
Title Slide |
Welcome to the spoken tutorial on Component oriented modeling. |
Slide:
Learning Objectives |
In this tutorial, we are going to learn:
|
Slide:
System Requirements |
To record this tutorial, I am using:
|
Slide:
Prerequisites |
To understand and practice this tutorial, you need to know
Prerequisite tutorials are mentioned on our website. Please go through them. |
Slide:
Class Instantiation |
Now let us learn more about Class Instantiation.
Modelica classes can be instantiated. For example, an individual can be considered an instance of human being class. Instance of a class has the same variables and equations as the class itself. |
Slide:
Syntax |
The syntax for Class Instantiation is as shown. |
Now, let us understand this through an example.
Please download and save all the files available on our website. | |
Switch to OMEdit | Let me switch to OMEdit.
The following files are already open in OMEdit:
Double-click on classInstantiationExample. Let us discuss more about this class now. |
/* classInstantiationExample */
bouncingBall Ball1(h(start = 40), h(start = 50)); |
Let me shift OMEdit window to the left for better visibility.
Here, I have instantiated the bouncingBall class to create two objects named
|
Click on Simulate button. | Let us simulate this class now.
Click on Simulate button in the toolbar. The class did not simulate and it threw up an error. This is because bouncingBall class is not open in OMEdit. |
Load and Simulate | Open bouncingBall class which you downloaded from the website.
Now, simulate this class once again. Close the pop up window. |
Click on the + button beside Ball1 in variables browser. | Note that the class simulates successfully this time around.
Expand object1 variables in the variables browser. |
Highlight the variables. | Note that the variables listed here are declared in bouncingBall class.
|
Delete the result >> switch back to the slides. | Now delete the result and go back to the slides. |
Slide:
Component orientation |
Component orientation sets Modelica apart from other modeling and simulation softwares.
It is the single most important feature of Modelica. component models represent single physical phenomenon. They can be instantiated and connected to produce desired effect. For example, an RLC circuit could be developed from resistor, inductor and capacitor models. |
Slide:
Acausal connectors |
Acausal connectors serve as the interface between component instances.
They are defined using connector class. For example, pins can be used as connectors for electrical components.
|
Slide:
Circuit Diagram |
Now, let us simulate this Electric Circuit shown in the slide.
The voltage of battery is given by {Vo*Sin(2*pi*f*t)}, where Vo is 10 Volts, f is 1 Hz and the resistance is 5 ohm. |
Slide:
Solution Methodology |
Let us take a look at the Solution Methodology to model the electric circuit shown in previous slide:
Note that any Resistor and Voltage Source have two pins: Positive and Negative.
|
The component models required have already been programmed.
Hence, I shall demonstrate only the last two steps of Solution Methodology. | |
Switch to OMEdit >> Modeling perspective. | Let me switch to OMEdit.
Go back to the Modeling perspective. |
Click on the plus button beside simpleElectricCircuit in Libraries Browser. | Let me shift OMEdit window to the right.
Note that this package has five classes named:
Double-click on simpleElectricCircuit. Close ClassinstantiationExample.
|
//
import Modelica.SIunits.* // |
Modelica.SIunits package has been imported in the package simpleElectricCircuit.
|
Scroll down | Let us try to understand pin connector.
Scroll down a little bit. |
// connector pin // | Pin is defined using connector class. |
Highlight the variables | Voltage and current are the variables that a pin exchanges with its surroundings. |
// Voltage v; // | Potential at the pin is defined by v.
|
// flow Current i; // | Voltage across a component causes a current to flow through it.
Hence, current is a flow variable and is defined using flow keyword. |
// annotation(....); // | pin connector also has an Icon view specified by annotations as shown. |
Scroll down to Resistor class | Now let us discuss a little about Resistor class.
Scroll down a little more. |
// pin p ann(...);
pin n ann(...); // |
As discussed in the Solution Methodology, Resistor class has two instances of pin connector.
|
Now, let me show you how to instantiate a class using the drag and drop functionality of OMEdit. | |
Press Ctrl + N | To demonstrate that, let me open a new class using Ctrl + N. |
Type example in the name field. | Name this class example1 and press Ok.
Shift OMEdit window to the right. |
Click on Diagram View | Go to Diagram View if the class opens in Text View. |
Drag and drop pin icon in Libraries Browser. | Now let me instantiate pin class.
Left-click on pin icon in Libraries Browser. Hold and drag the icon to the diagram layer.
|
We have now created an instance of pin class.
| |
Click on Text View | Now let us see how this class is instantiated in Text View.
Go to Text View. |
// simpleElectricCircuit // | Notice the command for instantiation of class pin and an annotation based on its placement in Diagram View.
Hence, creating an instance of a class in Diagram View automatically reflects in the Text View.
Let us learn how to model electric circuit that we saw in the slides. |
Double-click on Circuit | Double-click on Circuit icon which is also a part of simpleElectricCircuit package.
This class already has our circuit of interest assembled, as can be seen in its Diagram View. It is ready to be simulated. |
But let us build the same circuit in a new file.
We shall use drag and drop functionality that we have just learnt about. | |
Ctrl + N >> name the file >> press Ok | Press Ctrl + N.
Name this file circuit(underscore)construction.
|
Click on Diagram View. | Switch to Diagram View, if it opens in Text View. |
Select, drag and drop Voltage Source | Select, drag and drop the VoltageSource icon from Libraries Browser.
|
Select, drag and drop Resistor. | Similarly, select, drag and drop the Resistor icon from Libraries Browser. |
Select, drag and drop Ground. | Do the same with Ground class. |
Now, we need to connect the respective pins of each component. | |
Hover over the left pin of Voltage Source. | Let us first connect the positive pin of Voltage Source to the positive pin of Resistor.
Hover over the left pin of Voltage Source. The text that appears indicates that, this is the positive pin p. |
Connect the positive pin of voltage source to positive pin of resistor. | Left click on this pin and drag the cursor closer to the left pin of Resistor.
Leave the mouse when the appearance of cursor changes to cross from an arrow. |
Connect the negative pin of voltage source to negative pin of resistor. | Similarly, connect the negative pin of resistor to the negative pin of voltage source. |
Connections to Ground | We have not mentioned the connections with Ground in the circuit diagram.
But, we need to connect the negative pins of Resistor and Voltage Source to Ground individually. This ensures a reference point for potential in the circuit. |
Press Ctrl + S | Now, this class is complete.
Save the class by pressing Ctrl + S. |
Click on Simulate button. | Click on Simulate button.
|
The class has simulated successfully.
| |
Expand Resistor column in Variables Browser and select Ir. | Expand Resistor column in the Variables Browser and select Ir.
Note that the profile is sinusoidal as expected. Since the Voltage Source is an AC source instead of DC. |
Hence, we have created a model from its component parts and simulated it.
We shall learn more about the Resistor and Voltage Source classes that we used here in the next tutorial. | |
Switch to the slides. | Let me switch to the slides.
This brings us to the end of this tutorial. |
Slide:
Assignment |
As an assignment, construct an electric circuit with two resistors in series, with one Voltage Source.
Use the component models for Voltage source and Resistor provided in simple electric circuit package. |
Slide:
About the Spoken Tutorial project |
Watch the video available at the following link:
http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial It summarises Spoken Tutorial project. |
Slide:
Spoken Tutorial Workshops |
We conduct workshops using spoken tutorials.
Please contact us. |
Slide:
Forum to answer questions |
If you have questions from this tutorial, please visit the website mentioned below. |
Slide:
Textbook Companion Project |
We coordinate coding of solved examples of popular books.
Please visit our website. |
Slide:
Lab Migration Project |
We help migrate commercial simulator labs to OpenModelica.
Please visit the following website for more information. |
Slide:
Acknowledgements |
Spoken Tutorial Project is funded by NMEICT, MHRD Government of India. |
Slide:
Thanks |
We thank the development team of OpenModelica for their support.
Thank you. |