Ngspice/C2/Operating-point-analysis-in-NGspice/English

From Script | Spoken-Tutorial
Revision as of 19:56, 27 November 2012 by Chandrika (Talk | contribs)

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

Title of the Script: Operating point analysis using ngspice

Author: Abhishek, IIT Bombay

Keywords: video tutorial, ngspice.


Visual Cues
Narration
Show slide
Welcome to the spoken tutorial on “Operating point analysis in ngspice
Show slide
In this tutorial we will learn,
Show slide
To perform operating point analysis.

To verify Kirchoff's voltage law using ngspice in,


interactive mode using command-line interface &

commandscript included in netlist file.

Show slide
Ubuntu 12.04 is the operating system


used with ngspice version 23 installed.

Show slide
Basic knowledge of electronic circuits is a prerequisite for this tutorial.


Basic knowledge of Ubuntu Linux and shell commands is also required.

Show slide
(hover mouse over circuit diagram)
(show nodes a,b,c)
We will use the example circuit shown.


The circuit consists of three prominent nodes “a”, “b” and “c”.


In addition, a fourth node called as reference OR datum node must be marked as node “0”. This is mandatory for any circuit.



Go to gedit window which is already open


hover mouse over components and node information


hover over .op


Open the terminal window
as mentioned


Go to the folder containing
example1.cir as mentioned


Type the commands as mentioned
Let us open the ngspice netlist example1.cir file corresponding to the circuit schematic shown before, in a text editor.


I have already opened this in gedit text editor.


Note that the netlist file is saved with .cir extension


We can see all the components like voltage source, resistors and current source


also information about nodes connecting them together.


.op command included in netlist file is used to perform operating point analysis


Now we will simulate this circuit, and verify Kirchoff's voltage law using the interactive mode-command-line interface.


let us open ngspice through terminal.


Go to top left corner of Ubuntu desktop screen.


Click on Dash home.


In the search bar, write terminal and press Enter.


This will open Terminal window.


Let me resize this window


Now I go to the folder where the netlist file example1.cir is saved.

I do this as follows:


On terminal, I will type cd Desktop/op-analysis and press Enter.


Now let us simulate the ngspice file.


Let us see how this can be done.


On terminal,


Type ngspice space example1.cir and press Enter.


Here you will notice that we have entered into the ngspice command line interface.


Type run and press Enter


This will simulate the circuit and store the results.

We will verify Kirchoff's voltage law using the above simulation results.
Slide 5

show circuit

hover mouse over the circuit

According to Kirchoff's voltage law,


voltage around outer loop should be equal to the value of the dc voltage source V1



Switch to Terminal


Type print v(a,b)+v(b,c)+v(c) and Press Enter Key


Type print v(a) and press enter


Calculate voltage around the outer loop. For this, let us do the following:


On to the Terminal ,


Type “print space v(a,b)+v(b,c)+v(c) and press Enter Key


Here v(a,b) denotes the voltage drop between the nodes a and b and so on.


print command displays the results of the calculation mentioned to its right side.


Notice the result of the calculation in the terminal.


It is 30 volt as shown


Now calculate the value of DC voltage source V1 that is v(a).


Type print space v(a) and press Enter

Notice the result of the calculation in the terminal.


If both the results are equal then Kirchoff's voltage law is verified.



Hover mouse over both the results Since both voltage values are equal, the Kirchhoff's Voltage law is verified for the outer loop a-b-c-0.



Now we will simulate this circuit, and verify Kirchoff's voltage law using the command-script included in netlist file.
Show example-modified.cir file already opened
Modified netlist file example-modified.cir is as shown



Show example-modified.cir file
As you can see all the commands we executed in command-line interface are included in this netlist as control statements.


That is the statements in between the .control and the .endc statements.


Echo command will echo the text written to its right side, on the terminal window.


You can see that we have included the print statements in the netlist.

Go to the terminal window.


On the terminal type source example-modified.cir and press Enter
Now we execute the modified netlist file.


source command is used to simulate the netlist from within the ngspice simulator environment


On the terminal type source space example-modified.cir and press Enter.


This will run the simulation and directly show the results for KVL verification.


You can see that results are the same as seen earlier.


This brings us to the end of this tutorial.


Quit the ngspice simulator by typing quit and press Enter. key

Show slide
Now let us summarize what we learnt in this tutorial.

In this tutorial we learnt,

To perform operating point analysis of a given circuit.

To verify Kirchhoff's voltage law using ngspice through interactive mode

command-line interface &

using commandscript included in netlist.

Show slide


Watch the video available at the following link
  • It summarises the Spoken Tutorial project
  • If you do not have good bandwidth, you can download and watch it


Show slide
The Spoken Tutorial Project Team
  • Conducts workshops using spoken tutorials
  • Gives certificates for those who pass an online test
  • For more details, please write to contact at spoken hyphen tutorial dot org


Show slide
Spoken Tutorial Project is a part of the Talk to a Teacher project
  • It is supported by the National Mission on Education through ICT, MHRD, Government of India
  • More information on this Mission is available at
  • spoken hyphen tutorial dot org slash NMEICT hyphen Intro


Thank you for joining.

Hope you found this tutorial useful.

This is Rupak Rokade from IIT Bombay signing off.


Thank You.

Contributors and Content Editors

Chandrika