ESim/C2/Uploading-a-spice-Subcircuit-file/English

From Script | Spoken-Tutorial
Revision as of 00:33, 6 August 2020 by Glorianandihal (Talk | contribs)

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

Uploading a spice Subcircuit file in eSim

Author: Gloria N

Keywords: esim, Subcircuit, KiCad, Eeschema, .include, device models


Visual cue Narration
Show Slide:

Opening Slide

Welcome to the spoken tutorial on Uploading a spice Subcircuit file in eSim.
Show Slide:

Learning Objectives

In this tutorial, using eSim we will learn to-
  • Upload an external spice Subcircuit file in eSim.
Show Slide:

Systems Requirements

To record this tutorial, we will use-
  • Ubuntu Linux OS version 16.04
  • eSim version 2.0
Show Slide:

Pre-requisites

To practice this tutorial, you should know how to create and simulate a circuit in eSim.

If not, watch the prerequisite eSim tutorials on this website.

Show Slide:

General form of Subcircuit

The subcircuit file always begins with the dot subckt statement.

Subname is the subcircuit component name.

N1,N2 are the nodes.

The subcircuit ends with dot ENDS followed by the subcircuit name.

Show Slide:

Introduction

This option is available in the eSim 2 point 0 and later versions.

The subcircuit file is added to the eSim subcircuit library.

You can also refer to the subcircuit files available in the Ngspice manual.

System Computer:

Desktop icon

To launch eSim, you need to double-click on the eSim icon on your Desktop.
System Computer:

eSim startup window

I have already opened eSim.
eSim Main Window:

Click on Subcircuit.

On the eSim main window, click on the Subcircuit button from the left toolbar.

In the previous tutorial, we have seen how to create a new subcircuit and edit an existing subcircuit.

Slide Show:

Code File

Pause the video here.

Download Fulladder_using_Nand text file from the Code file section available on this page.

Save it on Desktop with a dot sub extension.

Subcircuit tab:

Click on Upload a Subcircuit

Now, on the Subcircuit tab, click on Upload a Subcircuit option.

I have saved this file on my Desktop.

System Computer:

Double click on Desktop>>

click on Fulladder_using_Nand.sub >>

Click Open

Double-click on the Desktop folder.

Click on Full_adder_using_Nand dot sub and then click on the Open button.

System computer:

Opening the subcircuit FA using NAND folder.

The subcircuit uploaded using Upload option loads only .sub file.

As you can see here, only dot sub files will be available.

No sch or cir files will be present in this folder.

eSim Main Window:

Click on Open Project option from top menu>>

click on eSim-2.0>>

Double click on Examples>>

select FullAdder >>

Click Open

Let us simulate the Full Adder example with the newly added subcircuit library.

Open the FullAdder example from the Examples folder of eSim installer.

Click on the Open Project option from the top menu.

Locate the directory where the eSim is installed and double-click on the Examples folder.

Now select the FullAdder example and click on the Open button.

eSim Main Window:

Select FullAdder under Projects>>

click on Convert Kicad to Ngspice

On the eSim window, select FullAdder under Projects.

Then click on Convert Kicad to Ngspice button from the left toolbar.

Kicad to Ngspice Converter:

Analysis Tab

Source Details Tab

Let the transient analysis parameters and Source details be the same.

We will not change it.

Skip the Ngspice Model and Device Modeling tab.

Kicad to Ngspice Converter:

Subcircuit Tab

Click on 'ADD>>

click on FA_using_NAND >>

click on Open.

Click on Convert button

Under the Subcircuits tab, click the ADD button.

Click on FA using NAND dot sub file.

Now click on the Open button.

On the Kicad to Ngspice tab, click on the Convert button.

eSim Main Window:

Click on Simulation.

On the eSim window, click on the Simulation button from the left toolbar.
Ngspice plot: An Ngspice terminal and plot windows open along with a python plot window.

We have given the inputs as 5, 5 and 0.

Hence, the output for Sum is 0 volts and Carry is 5 volts.

Close the Ngspice terminal and plot windows.

Python Plot Window:

Check sum node >>

check cout node >>

click Plot

In the python plot window, check the Sum node and Cout node.

And click on the Plot button.

You can see the output of the sum and carry node.

Close the Python plot window.

System Computer:

UJT.sub file

Open eSim 2.0 folder>>

Double click on Library folder >>

Double click on SubcircuitLibrary folder >>

Click on UJT folder>>

open UJT.sub file.

The subcircuit file can also have model or subcircuit components within it.

These components can be from existing eSim libraries.

If the models or subcircuits are not present in eSim library then the user has to define the same.

For example: Let us open the UJT subcircuit file present in eSim.

In this file, there is a subcircuit of a Half adder and this is from eSim libraries.

Hence the statement, dot include is added in this file.

System Computer:

UJT.sub file

Explaining the model RMOD and model Emitter

Here, the model RMOD and Emitter are the two models which are defined by the user.

These model files are not available under eSim libraries.

Hence, you need to mention the parameters in the spice model format.

If any subcircuit is used, then the parameters are defined in the spice subcircuit format.

Show Slide:

Summary

Let us summarize.

In this tutorial, we learnt to -

  • Upload an external spice Subcircuit file in eSim
Show Slide:

Forum to answer questions

https://forums.spoken-tutorial.org/

Do you have questions in this Spoken Tutorial?

Please visit this site.

Show Slide:

FOSSEE Forum

https://forums.fossee.in/

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

Circuit Simulation

https://esim.fossee.in/circuit-simulation-project

The FOSSEE team coordinates the Circuit Simulation project.

We give Certificates and Honorarium to the contributors.

For more details, please visit this site.

Show Slide:

Lab Migration

https://esim.fossee.in/lab-migration-project

The FOSSEE team coordinates the Lab Migration project.

For more details, please visit this site.

Show Slide:

Acknowledgment

http://spoken-tutorial.org

Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India.

For more details, visit this site.

Thank you slide This is Gloria N from IIT Bombay signing off.

Thank you

Contributors and Content Editors

Glorianandihal, Nancyvarkey