ESim/C4/eSim-interface-to-OpenModelica/English

From Script | Spoken-Tutorial
Revision as of 15:50, 11 January 2023 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Visual cue Narration
Show Slide:

Title Slide

Welcome to the spoken tutorial on “eSim interface to OpenModelica”.
Show Slide:

Learning Objectives

In this tutorial, we will learn to
  • Add a netlist file in Modelica Converter in eSim
  • Convert Ngspice netlist to Modelica model in eSim
  • Load OMEdit from eSim
Show Slide:

System Requirements

To record this tutorial, I am using
  • Ubuntu Operating system version 20.04
  • eSim version 2.2
  • OpenModelica version 1.19.2

The process demonstrated in this tutorial is similar in Windows OS also.

Show Slide:

Pre-requisites

https://spoken-tutorial.org

To follow this tutorial,
  • The learner should have basic knowledge ofeSim and OpenModelica.
  • For pre-requisiteeSim and OpenModelicatutorials, please visit this website.
Show Slide:

Code Files

  • The files used in this tutorial are provided in the Code files link.
  • Please download and extract the files.
  • Make a copy and then use them while practicing.
Show Slide:

OpenModelica with eSim

  • OpenModelica is a modeling software and eSim is an EDA tool
  • Interfacing these two, helps us to get eigenvalues.
  • It also helps us to determine the stability of the system.
Show Slide:

About Modelica Converter:

https://www.openmodelica.org/

  • The Modelica Converter feature of eSim converts a netlist file to a model file.
  • OpenModelica OMEdit can be launched from eSim to edit and simulate the model file.
  • For more details on OpenModelica, please visit this site.
Open eSim Let us now explore the Modelica Converter option in eSim.

I have already opened the eSim software on my Desktop.

Only narration. In this tutorial, we will see the plotting of curves in OpenModelica from eSim.

For that, let us look at the BJT_amplifier example project.

I have downloaded the BJT_amplifier project files from the Code File link.

Let us open the BJT_amplifier project in eSim.

Click on the Open Project button on the top left corner Click on the Open Project button on the eSim top toolbar.
Double-click on the Downloads folder


Click on the BJT_amplifier folder

Now, locate the Downloads folder and select the BJT_amplifier folder.
Click on the Open Click on the Open button at the top.
Point to the BJT_amplifier project in the Projects Panel Now the BJT_amplifier project appears under the Projects on the left panel.

The BJT_amplifier is a voltage divider amplifier using BJT.

When input is given, it amplifies the input by a certain gain as output.

Click on the BJT_Amplifier project in the Projects Panel First of all, let us select the BJT_Amplifier project.
Only narration Next, we will see how to interface OpenModelica with eSim.
Click on Modelica Converter icon So, navigate to the left toolbar and click on the Modelica Converter icon.

The Modelica-1 window opens on the right panel.

Only narration Now let us look at the features of the window.
Point to the netlist directory textbox The textbox on the top displays the path to the netlist of the selected project.

Currently, it is showing the netlist of the BJT_amplifier project.

Hover over Browse Netlist, Convert, Load OMEdit and Browse OM The Modelica-1 window has four buttons on the right side:
  • Browse Netlist
  • Convert
  • Load OMEdit and
  • Browse OM
Point to Browse Netlist button The Browse Netlist button is used to browse the netlist file.

Note that the file is identified with the extension .cir.out

Only narration We can see that the BJT_amplifier.cir.out file is loaded in the Browse Netlist textbox.

We know that OpenModelica runs the Modelica model file.

Click on the Convert button Now let us convert the BJT_amplifier.cir.out Ngspice netlist to the Modelica model file.

To do so, click on the Convert button.

Point to eSim dialog box


Click OK

A pop-up window shows that Ngspice netlist gets converted to OpenModelica netlist.

Click on OK.

Only narration Next we will see how to load OMEdit from eSim.

So we have to link OpenModelica with eSim.

Point to the Browse OM button


Click on the Browse OM button.

Make sure that OpenModelica is already installed in your system.


We need to add the path to OpenModelica’s executable.


Click on the Browse OM button.

Browse to /usr/bin folder

Click on Open

Modelica Converter needs to know the path of OpenModelica executable.

Now, let us browse to the OpenModelica executable location.

In my case, it is located in /usr/bin.

Point to the text box next to the Browse OM button. The directory of the OpenModelica’s executable file is loaded in the Browse OM textbox.
Only narration Now, let us load the OpenModelica Connection Editor.
Click on the Load OMEdit button Click on the Load OMEdit button.

OpenModelica Connection Editor is a GUI to run and edit the model.

On OMEdit - OpenModelica Connection Editor Window

Point to the BJT_Amplifier project under the Libraries panel on the left panel

We see that OMEdit has been loaded.

The BJT_Amplifier project is visible under the Libraries on the left panel.

Click on BJT_Amplifier To open the project, double click on the BJT_Amplifier on the left panel.
Only narration We see the plot window of BJT_Amplifier has opened.

Click on Simulate button in the top toolbar

Now, let us simulate the BJT_Amplifier project.


In the top toolbar, click on the Simulate button with a green right arrow icon.

Point to the Messages Browser panel We can see the circuit model is getting compiled.
Hovering over the output tab

Point to the message

The model gets compiled successfully.

We see The simulation finished successfully displayed in the output tab.

Point to Variables panel. Now, the variable plots are visible under the Variables panel on the right side.

We can trace the graph of the required plots on the gridded Plot window by selecting it.

Click on c1 Click on c1.
Click on the C checkbox To plot the graph of Capacitor value C, let us click on the checkbox.
Point to plot window We see the Capacitor value is constant throughout.
Click on der(v) checkbox Click on the der(v) checkbox to plot the graph of the derivative of Voltage.
Point to plot window We see the derivative of Voltage is increasing exponentially.

To see the other plots, we need to remove the der(v) plot.

Uncheck the der(v) checkbox to remove the derivative of Voltage plot.

Click on i checkbox Click on the i checkbox to plot the graph of the current.
Point to plot window We see the current plot is increasing exponentially.

Uncheck the i checkbox to remove the current plot.

Hover over the textbox value of Capacitance C We can even change the parameters and re-simulate the model.
Click on the textbox next to C and type 10e-05 So, let us edit and set the Capacitance C value to 10e-05.
Click on Re-simulate button in the top toolbar

Highlight the message in Output tab

Now, let us re-simulate theBJT_Amplifier project.

In the top toolbar, click on the Re-simulate button with a green right arrow icon.

We see The simulation finished successfully displayed in the output tab.

Hover over the plot We see that the capacitance C value has changed in the plot.
Only narration We can plot the graphs of all the plot variables in the same way.

With this, we have successfully simulated a project by interfacing OpenModelica to eSim.

Show Slide:

Summary

This brings us to the end of the tutorial. Let us summarize.

In this tutorial, we have

  • Added a netlist file in Modelica Converter in eSim
  • Converted the Ngspice netlist to Modelica model
  • Loaded OMEdit from eSim
Show Slide:

Assignment

As an assignment, please do the following:
  • Load the BJT_Biascircuit project in eSim
  • BJT_Biascircuit project is available in the Code file link
  • Click on the BJT_Biascircuit on the right panel
  • Click on the Modelica Converter.
  • Check the path of the Netlist file.
  • Click on the Convert option.
  • Click on the Browse OM option
  • Browse to the path of the OpenModelica executable
  • Check the path loaded in the textbox
  • Click on the Load OMEdit option
  • Simulate the model from the OMEdit interface
Show Slide:

About Spoken Tutorial Project

The video at the following link summarizes the Spoken Tutorial project.

Please download and watch it.

Show Slide:

Spoken Tutorial Workshops

The Spoken Tutorial Project team conducts workshops and gives certificates.

For more details, please write to us.

Show Slide:

Answers for THIS Spoken Tutorial

Please post your timed queries in this forum.
Show Slide:

FOSSEE Forum

For any general or technical questions on eSim, visit the FOSSEE forum and post your question.
Show Slide:

Circuit Simulation Project

The FOSSEE team coordinates the Circuit Simulation Project.

For more details, please visit this site.

Show Slide:

Textbook Companion Project

The FOSSEE team coordinates the TextBook Companion Project.

For more details, please visit this site.

Show Slide:

Lab Migration

The FOSSEE team coordinates the Lab Migration Project.

For more details, please visit this site.

Show Slide: Acknowledgement Spoken Tutorial Project is funded by theMinistry of Education, Government of India.
Show Slide: Thank you This is Harisankar a FOSSEE summer fellow 2022, IIT Bombay signing off.

Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Nirmala Venkat