Difference between revisions of "ESim/C2/Editing-a-Subcircuit/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 33: Line 33:
 
Pre-requisites
 
Pre-requisites
 
||To practice this tutorial, you should know
 
||To practice this tutorial, you should know
*To create and simulate a circuit and a subcircuit in '''eSim'''.
+
*To create and '''simulate''' a '''circuit''' and a '''subcircuit''' in '''eSim'''.
  
If not, watch the prerequisite eSim tutorials on this website.
+
If not, watch the prerequisite '''eSim''' tutorials on this website.
 
|-
 
|-
 
||'''System Computer:'''
 
||'''System Computer:'''
Line 56: Line 56:
 
A '''subcircuit''' tab will open up.
 
A '''subcircuit''' tab will open up.
  
In the previous tutorial, we have seen to create a ''Subcircuit''.
+
In the previous tutorial, we have seen to create a '''Subcircuit'''.
  
 
|-
 
|-
Line 66: Line 66:
 
Click '''Open'''  
 
Click '''Open'''  
  
||Let us now edit a ''Subcircuit'' of a ''Half adder''.
+
||Let us now edit a '''Subcircuit''' of a '''Half adder'''.
  
 
In the '''subcircuit''' tab, click on the '''Edit Subcircuit Schematic''' button.
 
In the '''subcircuit''' tab, click on the '''Edit Subcircuit Schematic''' button.
  
The '''Subcircuit''' library opens up.
+
The '''Subcircuit library''' opens up.
  
Select the '''half''' underscore '''adder''' and  click on the '''Open''' button.
+
Select the '''Half underscore adder''' and  click on the '''Open''' button.
  
The ''schematic'' of ''Half adder'' subcircuit opens in ''eeschema''.
+
The '''schematic''' of '''Half adder subcircuit''' opens in '''eeschema'''.
  
 
|-
 
|-
Line 80: Line 80:
 
Press '''F1'''
 
Press '''F1'''
  
||Press '''F1''' key to zoom in the schematic.
+
||Press '''F1''' key to zoom in the '''schematic'''.
  
Let us connect an additional '''Inverter''' ''gate'' to the output of the '''AND''' ''gate''.
+
Let us connect an additional '''Inverter gate''' to the output of the '''AND gate'''.
 
   
 
   
 
|-
 
|-
Line 96: Line 96:
 
click '''OK'''.
 
click '''OK'''.
  
||On eeschema, click on the '''Place Component''' tool from the right toolbar.
+
||On '''eeschema''', click on the '''Place Component''' tool from the right toolbar.
  
Click on the ''editor''.
+
Click on the '''editor'''.
  
In the Filter field, type '''eSim''' underscore '''Digital'''.
+
In the '''Filter''' field, type '''eSim underscore Digital'''.
  
Select '''d''' underscore '''Inverter''' and click on the '''OK''' button.
+
Select '''d underscore Inverter''' and click on the '''OK''' button.
  
 
Place it below the '''PORT D'''.
 
Place it below the '''PORT D'''.
Line 114: Line 114:
 
Connecting '''AND''' gate and '''Inverter''' gate
 
Connecting '''AND''' gate and '''Inverter''' gate
  
||Connect a ''wire'' from '''Pin 3''' of the '''AND''' gate to '''Pin 1''' of the '''Inverter''' gate.
+
||Connect a '''wire''' from '''Pin 3''' of the '''AND gate''' to '''Pin 1''' of the '''Inverter gate'''.
  
 
A '''junction''' will be placed.
 
A '''junction''' will be placed.
Line 136: Line 136:
 
Click on the '''Place Component''' tool from the right toolbar.
 
Click on the '''Place Component''' tool from the right toolbar.
  
Click on the ''editor''.
+
Click on the '''editor'''.
  
In the '''Filter''' field, type '''eSim''' underscore '''Miscellaneous'''.
+
In the '''Filter''' field, type '''eSim underscore Miscellaneous'''.
  
 
Select '''Port''' from the list.
 
Select '''Port''' from the list.
  
Click on the '''drop-down''' arrow.
+
Click on the drop-down arrow.
  
 
Select '''Unit  E''' and click on the '''OK''' button.
 
Select '''Unit  E''' and click on the '''OK''' button.
Line 154: Line 154:
 
press the '''R''' key to rotate.
 
press the '''R''' key to rotate.
  
||Place the '''Port E''' near the output pin of the '''Inverter'''.
+
||Place the '''Port E''' near the output '''pin''' of the '''Inverter'''.
  
 
Place the cursor on the '''Port Unit E''' and press the '''R''' key to rotate.
 
Place the cursor on the '''Port Unit E''' and press the '''R''' key to rotate.
  
In the '''clarify selection''' window, select component '''Port U''' and press the '''R''' key.
+
In the '''Clarify selection''' window, select '''component''' '''Port U''' and press the '''R''' key.
  
Connect the output ''pin'' of the '''Inverter''' to '''Port Unit E'''.
+
Connect the '''output pin''' of the '''Inverter''' to '''Port Unit E'''.
  
The  '''Port Unit E''' will be ''pin 5'' of the component schematic.
+
The  '''Port Unit E''' will be '''pin 5''' of the '''component schematic'''.
  
 
|-
 
|-
Line 174: Line 174:
 
Press '''Ctrl+S'''  keys together
 
Press '''Ctrl+S'''  keys together
  
||Now we will annotate the schematic.
+
||Now we will annotate the '''schematic'''.
  
 
Click on the '''Annotate schematic components''' icon from the top toolbar.
 
Click on the '''Annotate schematic components''' icon from the top toolbar.
Line 184: Line 184:
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
  
Press '''Ctrl+S''' keys together to ''save'' the schematic.
+
Press '''Ctrl+S''' keys together to save the '''schematic'''.
  
 
|-
 
|-
Line 198: Line 198:
 
Click '''Save'''
 
Click '''Save'''
  
||To generate a netlist, click on '''Generate Netlist'''.
+
||To generate a '''netlist''', click on '''Generate Netlist'''.
  
 
Select the '''Spice''' tab and check the '''Default Format'''.
 
Select the '''Spice''' tab and check the '''Default Format'''.
Line 206: Line 206:
 
Then click on the '''Save''' button.
 
Then click on the '''Save''' button.
  
This creates the '''KiCad''' netlist of the ''half adder'' subcircuit.
+
This creates the '''KiCad netlist''' of the '''Half adder subcircuit'''.
  
 
|-
 
|-
Line 222: Line 222:
 
In the '''Subcircuit''' tab, click on the '''Convert Kicad to Ngspice''' button.
 
In the '''Subcircuit''' tab, click on the '''Convert Kicad to Ngspice''' button.
  
You can specify the '''transient''' analysis parameters or leave them blank.  
+
You can specify the '''transient analysis parameters''' or leave them blank.  
  
 
I am leaving these values blank.
 
I am leaving these values blank.
Line 228: Line 228:
 
Skip the '''Ngspice Model''' and '''Device Modeling''' tabs.
 
Skip the '''Ngspice Model''' and '''Device Modeling''' tabs.
  
If any ''device modeling'' or ''subcircuit'' is used, please specify here.
+
If any '''device modeling''' or '''subcircuit''' is used, please specify here.
  
 
|-
 
|-
Line 240: Line 240:
 
||Press the '''Convert''' button in the '''Kicad to Ngspice''' tab.
 
||Press the '''Convert''' button in the '''Kicad to Ngspice''' tab.
  
Click on the '''OK''' button in the '''information''' dialog box.
+
Click on the '''OK''' button in the '''Information''' dialog box.
  
This creates the '''Ngspice''' netlist of the Subcircuit.
+
This creates the '''Ngspice netlist''' of the '''subcircuit'''.
  
 
|-
 
|-
 
||'''eSim Schematic Window:'''
 
||'''eSim Schematic Window:'''
  
||An additional ''port'' is added to the '''Half adder''' subcircuit.
+
||An additional '''port''' is added to the '''Half adder subcircuit'''.
  
Hence, the ''component schematic'' has to be modified to include ''pin 5''.
+
Hence, the '''component schematic''' has to be modified to include '''pin 5'''.
  
 
|-
 
|-
 
||'''eSim Schematic Window:'''
 
||'''eSim Schematic Window:'''
Back to '''Half Adder''' schematic.
+
Back to '''Half Adder schematic'''.
  
 
Directing to '''Part Library Editor''' window
 
Directing to '''Part Library Editor''' window
  
||Go back to the '''Half Adder''' schematic.
+
||Go back to the '''Half Adder schematic'''.
  
On the ''schematic editor'', click on the '''Library Editor''' icon from the top toolbar.
+
On the '''schematic editor''', click on the '''Library Editor''' icon from the top toolbar.
  
 
It directs us to the '''Part Library Editor''' window.
 
It directs us to the '''Part Library Editor''' window.
Line 270: Line 270:
 
||Click on the '''File''' option from the top menu, and click on the '''Current Library''' option.
 
||Click on the '''File''' option from the top menu, and click on the '''Current Library''' option.
  
Scroll down and choose '''eSim''' underscore '''Subckt'''.
+
Scroll down and choose '''eSim underscore Subckt'''.
  
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
Line 276: Line 276:
 
|-
 
|-
 
||'''Part Library Editor window:'''
 
||'''Part Library Editor window:'''
Hover the mouse on the top of the Part library editor window pointing '''/usr/share/kicad/library/eSim_Subckt'''
+
Hover the mouse on the top of the '''Part library editor''' window pointing '''/usr/share/kicad/library/eSim_Subckt'''
  
||You can see the path of the selected library is displayed on top of the '''Part Library''' window.
+
||You can see the '''path''' of the selected '''library''' is displayed on top of the '''Part Library''' window.
  
 
|-
 
|-
 
||'''Part Library Editor window:'''
 
||'''Part Library Editor window:'''
Loading the component from the current library.
+
Loading the '''component''' from the current '''library'''.
  
 
||Click on the '''Load component to edit from the current library''' icon in the top toolbar.
 
||Click on the '''Load component to edit from the current library''' icon in the top toolbar.
  
Click on the '''half''' underscore '''adder''' and click on the '''OK''' button.
+
Click on the '''Half underscore adder''' and click on the '''OK''' button.
 
   
 
   
 
|-
 
|-
Line 292: Line 292:
 
Moving the '''pin 4''' of the component schematic
 
Moving the '''pin 4''' of the component schematic
  
||Place the cursor on '''Pin 4''', '''Cout'''.
+
||Place the cursor on '''Pin 4, Cout'''.
  
Press '''M''' key to move the pin and place it just below '''pin 3'''.
+
Press '''M''' key to move the '''pin''' and place it just below '''pin 3'''.
  
 
|-
 
|-
 
||'''Part Library Editor window:'''
 
||'''Part Library Editor window:'''
Demo of adding '''Pin 5''', '''Out''' to the Half Adder component.
+
Demo of adding '''Pin 5, Out''' to the '''Half Adder component'''.
  
 
||Click on '''Add pins to component''' tool from the right toolbar.
 
||Click on '''Add pins to component''' tool from the right toolbar.
  
Click on the ''editor''.
+
Click on the '''editor'''.
  
 
'''Pin Properties''' window will appear.
 
'''Pin Properties''' window will appear.
Line 310: Line 310:
 
If you wish, you can give any other '''Pin name''' of your choice.
 
If you wish, you can give any other '''Pin name''' of your choice.
  
'''Pin Number''' should match with the '''Port Unit''' Name.
+
'''Pin Number''' should match with the '''Port Unit''' name.
  
'''Port E''' represents '''Pin 5''' of the subcircuit.
+
'''Port E''' represents '''Pin 5''' of the '''subcircuit'''.
  
 
Enter '''Pin Number''' as '''5'''.
 
Enter '''Pin Number''' as '''5'''.
  
Enter '''Orientation''' as '''left''' as it is an output pin.
+
Enter '''Orientation''' as '''left''' as it is an '''output pin'''.
  
 
Enter '''Electrical Type''' as '''Output'''.
 
Enter '''Electrical Type''' as '''Output'''.
Line 322: Line 322:
 
Keep '''Graphic Style''' as '''Line'''.
 
Keep '''Graphic Style''' as '''Line'''.
  
You can choose '''Orientation''' and '''Electrical Type''' based on the requirement of the subcircuit.
+
You can choose '''Orientation''' and '''Electrical Type''' based on the requirement of the '''subcircuit'''.
  
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
Line 332: Line 332:
 
|-
 
|-
 
||'''Part Library Editor window:'''
 
||'''Part Library Editor window:'''
'''Save''' the current component schematic
+
'''Save''' the current '''component schematic'''
  
||Now, let us ''save'' the schematic symbol.
+
||Now, let us save the '''schematic''' symbol.
  
Press '''Ctrl+S''' keys together to save the schematic.
+
Press '''Ctrl+S''' keys together to save the '''schematic'''.
  
In the '''confirmation''' box click on the '''Yes''' button.
+
In the '''Confirmation''' box click on the '''Yes''' button.
  
In the second '''confirmation box''', click on the '''Yes''' button.
+
In the second '''Confirmation''' box, click on the '''Yes''' button.
  
 
|-
 
|-
Line 346: Line 346:
 
Point to '''Update current component in current library'''.
 
Point to '''Update current component in current library'''.
  
||You can ''save'' the component using the '''Save Current Library to Disc''' icon from the top toolbar.
+
||You can save the '''component''' using the '''Save Current Library to Disc''' icon from the top toolbar.
  
You can select the current library using the '''Select Working Library''' option.
+
You can select the current '''library''' using the '''Select Working Library''' option.
  
You can ''delete'' the component using the '''Delete''' option.
+
You can delete the '''component''' using the '''Delete''' option.
  
 
You can also use '''Update current component in current library''' option from the top toolbar.
 
You can also use '''Update current component in current library''' option from the top toolbar.
  
This will save the modified component to the current library.
+
This will save the modified '''component''' to the current '''library'''.
  
 
|-
 
|-
Line 362: Line 362:
 
||There is an option '''Create a new component from the current one''' in the top toolbar.
 
||There is an option '''Create a new component from the current one''' in the top toolbar.
  
This imports the schematic of the components and can be used to create a new one.
+
This imports the '''schematic''' of the '''components''' and can be used to create a new one.
  
 
|-
 
|-
Line 376: Line 376:
 
Open Project '''Half''' underscore '''Adder'''  
 
Open Project '''Half''' underscore '''Adder'''  
  
||Now, let us simulate a circuit with the newly added subcircuit and its component.
+
||Now, let us '''simulate''' a '''circuit''' with the newly added '''subcircuit''' and its '''component'''.
  
Let us open the '''Half''' underscore '''Adder''' from the '''Example''' folder of '''eSim'''.
+
Let us open the '''Half underscore Adder''' from the '''Example''' folder of '''eSim'''.
  
 
On the '''eSim''' window, click on the '''Open Project''' button from the top menu.
 
On the '''eSim''' window, click on the '''Open Project''' button from the top menu.
Line 384: Line 384:
 
Locate the directory where '''eSim''' is installed and click on the '''Example''' folder.
 
Locate the directory where '''eSim''' is installed and click on the '''Example''' folder.
  
Select '''Half''' underscore '''Adder''' and then click on '''Open'''.
+
Select '''Half underscore Adder''' and then click on '''Open'''.
  
The  '''Half''' underscore '''Adder''' is added to the '''eSim''' window under '''Projects'''.
+
The  '''Half underscore Adder''' is added to the '''eSim''' window under '''Projects'''.
  
 
|-
 
|-
Line 394: Line 394:
 
Click on the '''Open Schematic''' option from the  left toolbar
 
Click on the '''Open Schematic''' option from the  left toolbar
  
||To open the schematic, select '''Half Adder''' from '''Projects'''.
+
||To open the '''schematic''', select '''Half Adder''' from '''Projects'''.
  
 
Click on the '''Open Schematic''' button from the left toolbar.
 
Click on the '''Open Schematic''' button from the left toolbar.
Line 402: Line 402:
 
Place cursor on schematic and press '''F1'''
 
Place cursor on schematic and press '''F1'''
  
||It directs us to the schematic editor.
+
||It directs us to the '''schematic editor'''.
  
Zoom in the schematic by pressing '''F1''' key.
+
Zoom in the '''schematic''' by pressing '''F1''' key.
  
 
|-
 
|-
Line 410: Line 410:
 
Place and connect '''half adder''' subcircuit
 
Place and connect '''half adder''' subcircuit
  
||Let us replace the ''Half Adder'' subcircuit with the modified Half Adder component.
+
||Let us replace the '''Half Adder subcircuit''' with the modified '''Half Adder component'''.
  
 
Click on the '''Place Component''' tool from the left toolbar.
 
Click on the '''Place Component''' tool from the left toolbar.
  
Click on the ''editor''.
+
Click on the '''editor'''.
 
   
 
   
In the '''filter''' field, type '''eSim''' underscore '''Subckt'''.
+
In the '''Filter''' field, type '''eSim underscore Subckt'''.
  
Scroll down and select the '''half''' underscore '''adder'''.
+
Scroll down and select the '''Half underscore adder'''.
  
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
Line 432: Line 432:
 
Adding a '''Global Label Out'''
 
Adding a '''Global Label Out'''
  
||Similarly connect '''DAC''' , '''plot V1''' and global label '''out''' as shown here.
+
||Similarly connect '''DAC, plot V1''' and global label '''out''' as shown here.
  
 
|-
 
|-
Line 440: Line 440:
 
Generating the '''Netlist'''.
 
Generating the '''Netlist'''.
  
Saving the schematic.
+
Saving the '''schematic'''.
  
||Now annotate the schematic using '''Annotate Schematic Components''' from the top toolbar.
+
||Now annotate the '''schematic''' using '''Annotate Schematic Components''' from the top toolbar.
  
Generate the '''Spice''' netlist.
+
Generate the '''Spice netlist'''.
  
Refer to previous tutorials to learn annotation and generating netlist of the schematic.
+
Refer to previous tutorials to learn annotation and generating '''netlist''' of the '''schematic'''.
  
Save the schematic by pressing '''Ctrl+S'''  keys together.
+
Save the '''schematic''' by pressing '''Ctrl+S'''  keys together.
  
 
|-
 
|-
Line 462: Line 462:
 
In the Analysis Tab:
 
In the Analysis Tab:
  
||Let us not change the '''Transient Analysis''' parameters.
+
||Let us not change the '''Transient Analysis parameters'''.
  
 
|-
 
|-
Line 471: Line 471:
 
||Click on the '''Source details''' tab.
 
||Click on the '''Source details''' tab.
  
Enter '''5V''' for DC source, '''V1''' and '''V2'''.
+
Enter '''5V''' for '''DC source, V1''' and '''V2'''.
  
 
|-
 
|-
Line 487: Line 487:
 
In the '''Subcircuit''' tab, click on the '''ADD''' button.
 
In the '''Subcircuit''' tab, click on the '''ADD''' button.
  
Click on '''Half''' underscore '''Adder''' and then click on the '''Open''' button.
+
Click on '''Half underscore Adder''' and then click on the '''Open''' button.
 
   
 
   
 
In the '''KiCad to Ngspice''' tab, press the '''Convert''' button.
 
In the '''KiCad to Ngspice''' tab, press the '''Convert''' button.
  
Click the '''OK''' button in the '''Confirmation''' box.
+
Click the '''OK''' button in the '''Information''' box.
  
 
|-
 
|-
Line 497: Line 497:
 
Click on '''Simulation'''
 
Click on '''Simulation'''
  
||To generate ''plots'', click on the '''Simulation''' button from the left toolbar.
+
||To generate '''plots''', click on the '''Simulation''' button from the left toolbar.
  
 
|-
 
|-
Line 503: Line 503:
 
Highlight the '''sum''' and '''carry''' and '''out''' output.
 
Highlight the '''sum''' and '''carry''' and '''out''' output.
  
||An '''Ngspice''' terminal and plot windows open along with a '''python''' plot window.
+
||An '''Ngspice terminal''' and '''plot''' windows open along with a '''python plot''' window.
  
Since both the inputs are '''5''' volts, the '''sum''' is '''0''',
+
Since both the '''inputs''' are '''5''' volts, the '''sum''' is '''0''', '''carry''' will be '''5''' volts and the '''Output''' will be '''0''' volts.
  
'''carry''' will be '''5''' volts and the '''Out''' will be '''0''' volts.
+
Close the '''Ngspice plots''' and '''terminal''' windows.
 
+
Close the '''Ngspice''' plots and terminal windows.
+
  
 
|-
 
|-
Line 520: Line 518:
 
click '''Plot'''
 
click '''Plot'''
  
||In the '''Python''' plot, check the '''Sum''' node,'''cout''' node and the '''Out''' node.
+
||In the '''Python plot''', check the '''Sum''' node,'''cout''' node and the '''Out''' node.
  
 
Click on the '''Plot''' button.
 
Click on the '''Plot''' button.
  
You can see the plots for '''sum''','''cout''' and '''Out''' nodes.
+
You can see the '''plots''' for '''sum, cout''' and '''Out''' nodes.
  
Close the '''Python''' plot.
+
Close the '''Python plot''' window.
  
 
|-
 
|-
 
||'''Show Slide:'''
 
||'''Show Slide:'''
 
Summary
 
Summary
||Let us summarise.
+
||Let us now summarise.
 
In this tutorial, we learnt-
 
In this tutorial, we learnt-
 
*To edit a '''Subcircuit''' and
 
*To edit a '''Subcircuit''' and

Latest revision as of 14:49, 10 August 2020

Editing a Subcircuit in eSim

Author: Gloria N

Keywords: eSim, Subcircuit, KiCad, Eeschema, Subcircuit, Part library,Port


Visual cue Narration
Show Slide:

Opening Slide

Welcome to the spoken tutorial on Editing a Subcircuit in eSim.
Show Slide:

Learning Objectives

In this tutorial, using eSim we will learn to-
  • To edit a Subcircuit.
  • To modify the component schematic.
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
  • To create and simulate a circuit and a subcircuit in eSim.

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

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:

Clicking on Subcircuit

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

A subcircuit tab will open up.

In the previous tutorial, we have seen to create a Subcircuit.

Subcircuit tab:

Click Edit Subcircuit Schematic>>

Double click half_adder>>

Click Open

Let us now edit a Subcircuit of a Half adder.

In the subcircuit tab, click on the Edit Subcircuit Schematic button.

The Subcircuit library opens up.

Select the Half underscore adder and click on the Open button.

The schematic of Half adder subcircuit opens in eeschema.

eSim Schematic Window

Press F1

Press F1 key to zoom in the schematic.

Let us connect an additional Inverter gate to the output of the AND gate.

eSim Schematic Window:

Select Place Component from right toolbar>>

click on editor>>

Type eSim_Digital in the filter field>>

select d_inverter>>

click OK.

On eeschema, click on the Place Component tool from the right toolbar.

Click on the editor.

In the Filter field, type eSim underscore Digital.

Select d underscore Inverter and click on the OK button.

Place it below the PORT D.

The inverter is tied to the cursor.

Place it below the PORT D.

eSim Schematic Window:

Connecting AND gate and Inverter gate

Connect a wire from Pin 3 of the AND gate to Pin 1 of the Inverter gate.

A junction will be placed.

eSim Schematic Window:

Select Place Component from right toolbar>>

click on editor>>

Type eSim_Miscellaneous in the filter field>>

select PORT>>

select Unit E >>

click OK

Now, we will connect a Port to the Inverter output.

Click on the Place Component tool from the right toolbar.

Click on the editor.

In the Filter field, type eSim underscore Miscellaneous.

Select Port from the list.

Click on the drop-down arrow.

Select Unit E and click on the OK button.

eSim Schematic Window:

Place it near the output pin of the Inverter >>

Place the cursor on the Port Unit E >>

press the R key to rotate.

Place the Port E near the output pin of the Inverter.

Place the cursor on the Port Unit E and press the R key to rotate.

In the Clarify selection window, select component Port U and press the R key.

Connect the output pin of the Inverter to Port Unit E.

The Port Unit E will be pin 5 of the component schematic.

eSim Schematic Window:

Click on Annotate schematic components>>

click Annotate >>

click OK

Press Ctrl+S keys together

Now we will annotate the schematic.

Click on the Annotate schematic components icon from the top toolbar.

Keep the default settings.

Click on the Annotate button.

Click on the OK button.

Press Ctrl+S keys together to save the schematic.

eSim Schematic Window:

Click Generate netlist>>

select Spice tab >>

check Default format>>

click on Generate.

Click Save

To generate a netlist, click on Generate Netlist.

Select the Spice tab and check the Default Format.

Click on the Generate button.

Then click on the Save button.

This creates the KiCad netlist of the Half adder subcircuit.

eSim Main Window:

Subcircuit tab >>

Click on Convert Kicad to Ngspice

Point to transient analysis parameters

Point to Ngspice Model and Device Modeling tabs

Let us go back to the eSim window.

In the Subcircuit tab, click on the Convert Kicad to Ngspice button.

You can specify the transient analysis parameters or leave them blank.

I am leaving these values blank.

Skip the Ngspice Model and Device Modeling tabs.

If any device modeling or subcircuit is used, please specify here.

eSim Main Window:

Subcircuit tab

Press Convert >>

Click OK

Press the Convert button in the Kicad to Ngspice tab.

Click on the OK button in the Information dialog box.

This creates the Ngspice netlist of the subcircuit.

eSim Schematic Window: An additional port is added to the Half adder subcircuit.

Hence, the component schematic has to be modified to include pin 5.

eSim Schematic Window:

Back to Half Adder schematic.

Directing to Part Library Editor window

Go back to the Half Adder schematic.

On the schematic editor, click on the Library Editor icon from the top toolbar.

It directs us to the Part Library Editor window.

Part Library Editor window:

Adding Current Library

Click on the File option from the top menu, and click on the Current Library option.

Scroll down and choose eSim underscore Subckt.

Click on the OK button.

Part Library Editor window:

Hover the mouse on the top of the Part library editor window pointing /usr/share/kicad/library/eSim_Subckt

You can see the path of the selected library is displayed on top of the Part Library window.
Part Library Editor window:

Loading the component from the current library.

Click on the Load component to edit from the current library icon in the top toolbar.

Click on the Half underscore adder and click on the OK button.

Part Library Editor window:

Moving the pin 4 of the component schematic

Place the cursor on Pin 4, Cout.

Press M key to move the pin and place it just below pin 3.

Part Library Editor window:

Demo of adding Pin 5, Out to the Half Adder component.

Click on Add pins to component tool from the right toolbar.

Click on the editor.

Pin Properties window will appear.

Enter Pin name as Out.

If you wish, you can give any other Pin name of your choice.

Pin Number should match with the Port Unit name.

Port E represents Pin 5 of the subcircuit.

Enter Pin Number as 5.

Enter Orientation as left as it is an output pin.

Enter Electrical Type as Output.

Keep Graphic Style as Line.

You can choose Orientation and Electrical Type based on the requirement of the subcircuit.

Click on the OK button.

The pin is attached to the cursor.

Place it below Pin 4 with a single click.

Part Library Editor window:

Save the current component schematic

Now, let us save the schematic symbol.

Press Ctrl+S keys together to save the schematic.

In the Confirmation box click on the Yes button.

In the second Confirmation box, click on the Yes button.

Part Library Editor window:

Point to Update current component in current library.

You can save the component using the Save Current Library to Disc icon from the top toolbar.

You can select the current library using the Select Working Library option.

You can delete the component using the Delete option.

You can also use Update current component in current library option from the top toolbar.

This will save the modified component to the current library.

Part Library Editor window:

Point to Create a new component from the current one.

There is an option Create a new component from the current one in the top toolbar.

This imports the schematic of the components and can be used to create a new one.

Part Library Editor window:

Click on File from top menu>>

choose Quit

Let us now close the Part Library Editor window.
eSim Main Window:

Open Project Half underscore Adder

Now, let us simulate a circuit with the newly added subcircuit and its component.

Let us open the Half underscore Adder from the Example folder of eSim.

On the eSim window, click on the Open Project button from the top menu.

Locate the directory where eSim is installed and click on the Example folder.

Select Half underscore Adder and then click on Open.

The Half underscore Adder is added to the eSim window under Projects.

eSim Main Window:

Select Half_Adder from Projects>>

Click on the Open Schematic option from the left toolbar

To open the schematic, select Half Adder from Projects.

Click on the Open Schematic button from the left toolbar.

eSim Schematic Window:

Place cursor on schematic and press F1

It directs us to the schematic editor.

Zoom in the schematic by pressing F1 key.

eSim Schematic Window:

Place and connect half adder subcircuit

Let us replace the Half Adder subcircuit with the modified Half Adder component.

Click on the Place Component tool from the left toolbar.

Click on the editor.

In the Filter field, type eSim underscore Subckt.

Scroll down and select the Half underscore adder.

Click on the OK button.

Place and connect it as shown here.

eSim Schematic Window:

Demo of adding dac bridge 1 to the pin 5

Connecting Plot_V to the DAC

Adding a Global Label Out

Similarly connect DAC, plot V1 and global label out as shown here.
eSim Schematic Window:

Performing Annotation.

Generating the Netlist.

Saving the schematic.

Now annotate the schematic using Annotate Schematic Components from the top toolbar.

Generate the Spice netlist.

Refer to previous tutorials to learn annotation and generating netlist of the schematic.

Save the schematic by pressing Ctrl+S keys together.

eSim Main Window:

Click on Convert Kicad to Ngspice

Let us go back to the eSim window.

Click on Convert Kicad to Ngspice from the left toolbar

Kicad to Ngspice Converter:

In the Analysis Tab:

Let us not change the Transient Analysis parameters.
Kicad to Ngspice Converter:

Source Details Tab V1: Enter Value>>5 Source Details Tab V2: Enter Value>>5

Click on the Source details tab.

Enter 5V for DC source, V1 and V2.

Kicad to Ngspice Converter:

Subcircuit Tab

Click on ADD >>

click on Half underscore Adder >>

click Open

Skip the Ngspice Model and Device Modeling tab.

In the Subcircuit tab, click on the ADD button.

Click on Half underscore Adder and then click on the Open button.

In the KiCad to Ngspice tab, press the Convert button.

Click the OK button in the Information box.

eSim Main Window:

Click on Simulation

To generate plots, click on the Simulation button from the left toolbar.
Ngspice Terminal:

Highlight the sum and carry and out output.

An Ngspice terminal and plot windows open along with a python plot window.

Since both the inputs are 5 volts, the sum is 0, carry will be 5 volts and the Output will be 0 volts.

Close the Ngspice plots and terminal windows.

Python Plot Window:

Check sum node >>

check cout node >>

click Plot

In the Python plot, check the Sum node,cout node and the Out node.

Click on the Plot button.

You can see the plots for sum, cout and Out nodes.

Close the Python plot window.

Show Slide:

Summary

Let us now summarise.

In this tutorial, we learnt-

  • To edit a Subcircuit and
  • To modify the component schematic.
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