Ngspice/C2/DC-Sweep-Analysis/English

From Script | Spoken-Tutorial
Revision as of 17:13, 8 April 2013 by Rakhiwarriar (Talk | contribs)

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

Title of the Script: DC sweep analysis in ngspice

Author: Abhishek

Keywords: video tutorial, ngspice.


Visual Cues
Narration
Slide 1
Welcome to this spoken tutorial on “DC sweep analysis in Ngspice



Slide 2
In this tutorial we will learn,


To perform,

DC sweep analysis and

Nested DC sweep analysis.



Slide 3
Basic knowledge of electronic circuits is a prerequisite for this tutorial.

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



Slide 4
Ubuntu 12.04 is the operating system used with ngspice version 23 installed.



Slide 5
(hover mouse over circuit diagram)
(show nodes 1,2,3)
We will use the example circuit shown.


The circuit consists of three prominent nodes “1”, “2” and “3”.


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



Demonstration


Go to gedit window with example.cir file, which is already open


hover mouse over components and node information


hover mouse over .dc


Let us open the ngspice netlist file example.cir corresponding to the circuit schematic shown before, in a text editor.


I have already opened this in gedit text editor.


Note that netlist file is saved with .cir extension


We can see all the components like voltage source, resistors and information about nodes connecting them together.


dc command included in netlist file is used to perform dc sweep analysis.

Go to slide no 6
General form to use dc command is as shown,

dot dc SRCNAM VSTART VSTOP VINCR

where,


SRCNAM is name of independent voltage or current source.


VSTART, VSTOP and VINCR are the starting, final and increment values respectively for the source.



Go to the text editor (i.e)example.cir


Hover mouse over .dc command statement


As you see we are sweeping voltage source V1 for a single value of 24 VOLTS with step increment of 1.


Now we will simulate this circuit, and find out voltage values at different nodes.



let us open ngspice through terminal.


Press Control Alt T together.


This will open the Terminal window.


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

I do this as follows:


cd downloads path to the folder and press Enter.



Type the commands as mentioned
Now let us simulate the ngspice file.


Let us see how this can be done.


On terminal,


Type ngspice space example.cir and press Enter.


Value of voltage v1 is 24 volts. Value of voltage v2 is 9.746 volts.


Other node voltages are also displayed.



Show slide 7
Next we will see how to do nested dc sweep analysis.


Generalized form for this is as shown.


Dot DC SRCNAM VSTART VSTOP VINCR SRC2 START2 STOP2 INCR2


where,


SRCNAM is the primary sweep variable and SRC2 is the secondary sweep variable.


Secondary sweep variable forms the outer loop.


That is for every increment of secondary sweep variable, the first sweep variable is stepped through its entire range of values.


It will be more clear with the example circuit we will simulate.



Slide 8


Hover cursor over vin.


Hover cursor over Rload

We will use Bipolar junction transistor based circuit in common base configuration.


Primary sweep variable is voltage Vin connected between emitter and base terminals.


Secondary sweep variable will be the load resistor Rload.


We will plot output voltage versus input voltage for different values of the load resistor.


The output voltage is the voltage across Rload and the input voltage is Vin



Open the file example-nested.cir already open in gedit


Following is the netlist corresponding to the common base transistor circuit.


NPN is the default model used for transistor, mod1, in the circuit.


As you can see Vin is varied from 0.2 volts to 2 volts with step increment of 0.02 volts.


Rload is varied from 5kiloohms to 10 kiloohms with step increment of 2kiloohms


For different values of Rload, Vin is swept through the complete range of 0.2 to 2.


Graphs of output voltage versus input voltage is plotted in each case.


Plot v of 3,4 plots the voltage drop between the nodes 3 and 4, that is the voltage across Rload.



Go to the terminal window.
On the terminal type
source example-nested.cir and press Enter.


Now we will simulate this circuit and see the results.


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


This will run the simulation.


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

simulator environment



On terminal type, quit. Press enter.
As you can see graph of output voltage versus input voltage is plotted for different values of load resistor.


Quit the ngspice simulator by typing quit and press enter.


Here we come to the end of this tutorial



Slide 6
In this tutorial we learnt,

To perform,

DC sweep analysis of a given circuit.

Nested DC sweep analysis of a given circuit.

Slide 7


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


Slide 8
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


Slide 9
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 Anuradha Amrutkar signing off.

Contributors and Content Editors

Rakhiwarriar