0% found this document useful (0 votes)
127 views7 pages

SPICE - A Brief Overview-2

This document provides instructions for beginners on how to get started using SPICE simulation software. It explains the basic steps which are to draw a circuit schematic, create an input file describing the circuit, run the SPICE program to perform simulations, and view the output files to analyze the results. Examples are also provided of creating input files for both PSPICE and HSPICE simulations.

Uploaded by

josuemx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views7 pages

SPICE - A Brief Overview-2

This document provides instructions for beginners on how to get started using SPICE simulation software. It explains the basic steps which are to draw a circuit schematic, create an input file describing the circuit, run the SPICE program to perform simulations, and view the output files to analyze the results. Examples are also provided of creating input files for both PSPICE and HSPICE simulations.

Uploaded by

josuemx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Fore translation in Bulgarian click here (courtesy of Cloudlakes.

com)
3. HOW TO GET STARTED WITH SPICE? (for beginners)
(URL: http://www.seas.upenn.edu/~jan/spice/spice.guide.html)
This document will explain how to run Spice or HSpice. It does not explain the Spice commands. This
can be found earlier in this document under How to Specify the Circuit Topology?, in your textbook,
or the Spice User's Guide.
In order to run Spice, you will have to go through the following steps:
Draw a schematic of the circuit (can be skipped)
Create an input le
Run the program
Look at the output le and print the results

3.1 Creating an Input File for Spice - Example
We will rst explain how to use PSpice without a Schematic Editor (see PSpice Primer for how to use
the Schematic Editor).
a. Draw a schematic of the circuit, number the nodes and label all elements. Note that the common
node (ground) always has number "0".
A sample circuit is given below.
Figure 1
We are interested in the voltages v12, v2 and the current i4 when the input voltage vin is equal to 10V.
We also want to nd the Thevenin equivalent voltage and resistance seen by the terminals ab.
In addition, we like to step the input voltage between 0 and 20 V in steps of 2V and print and plot
v12, vo, v2 and i4 as a function of vin.
Note that we inserted a DC voltage source, VMEAS, of zero value, in order to be able to measure the
current i4.
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
1 de 7 30/01/13 15:59
b. Create the input le (source le) for PSpice.
The source le needs the extension (usually ".cir") in its name. For a description of the data, control
and output statement, refer to "How to Specify the Circuit Topology" earlier in this document, the
Spice manual or the textbook.
Create the input le with any editor, such as Emacs, Microsoft editor, Word perfect, NotePad under
windows, etc. Save it on the c: drive or on your disk on the a: drive. In case you store it on the c:
drive, put it in a subdirectory (ex. c:\users\lename.cir; the subdirectory is required for the PSpice
version that runs on the network in the PC labs and sits on the h: drive). Save the le as a textle
(when using a word processor such as MS Word).
Example: c:\users\example1.cir
EXAMPLE PSpice
VIN 1 0 DC 10
F1 0 3 VMEAS 0.5
VMEAS 4 0 DC 0
R1 1 2 1K
R2 2 3 10K
R3 1 3 15K
R4 2 4 40K
R5 3 0 50K
.OP
.TF V(3,0) VIN
.DC VIN 0 20 2
.PRINT DC V(1,2) V(2,4) I(VMEAS)
.PLOT DC V(1,2) V(2,4)
.PLOT DC I(VMEAS)
.END
Notes:
1. The rst line is a title line and can be anything. It cannot be omitted.
2. The last line must be the .END statement.
3. You can insert comment lines. Anytime a line starts with an "*", PSpice ignores the whole
line. Using an "*" is also handy to block out a command line.
4. You can use upper or lower case letters.
5. Don't forget to add a carriage return after the .END statement.
c. Run Spice
Once you are in PSpice, pull down the File menu at the top of the screen and select "Open ". The
system prompts you for the name of the le. Type in the le name of the circuit you have created
before. As an example: c:\users\example1.cir
A window will appear telling you that Spice program is running, or that the simulation has been
completed successfully, or that errors were detected. Click on the "OK" button.
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
2 de 7 30/01/13 15:59
4 PSPICE with Capture
5. HSPICE
5.1 Running HSPICE
You can run HSPICE on Eniac (Sun Sparc), which is basically the same program as PSpice, except
for the Schematic editor and Probe. The advantage of using HSpice on Eniac is that you can run it
from your room through a modem connection or over ResNet. In addition, it comes with a
user-friendly and powerful graphical interface (gsi) provided you have access to an x-terminal.
First, you have to create the input le that contains the data, control and output statements in the same
way as is done for PSpice. The format and commands are identical. You can create this input le with
any editor. Once you have the input le, you can run HSpice by typing the following command at the
unix prompt,
hspice inputfilename
in which inputle is the name of your input le. The output will be displayed on the screen. You can
also store the output of HSPice in an output le, as follows,
hspice inputfile > outputfile
To view the output le, use your favorite editor. The le can be printed as any other document:
lpr -w80 outputfile
Notice that HSpice does not give the DC voltages unless you have specied a certain analysis type,
such as for instance .TRAN, or .AC analysis (Spice automatically does a DC analysis before doing a
transient or AC analysis). Thus, if you are only interested in the DC voltages in HSpice, you should
specify the .OP option, or the .DC option.
5.2 Special Features of HSPICE
HSpice has many capabilities. If you intend to use HSpice for Integrated Circuits simulation you will
need to make use of many of these. Please consult the MetaSoftware manual (available from the DSL,
room 100M). Here are a couple of these features.
a .Mathematical expressions in Hspice
HSPICE supports a few mathematical functions which can be used to condition any output variable.
The following general format should be used for all expressions:
.print varname=PAR('sqrt(v3)')
This instructs HSPICE to print the square root of the voltage "v3" and assign it the variable name
varname. The results can be found in the output le as well as gsi under the print'plot eld. Apart
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
3 de 7 30/01/13 15:59
from square root, other useful functions such as log(), sin() and tan() are supported. Consult the
HSPICE manual for a complete listing.
b. Node Names.
Instead of using node numbers, you can use node names in the input le. This makes the les much
easier to read. The same names will appear in the output le and the graphical display.
5.3 Graphical Output: gsi
In case you have access to an x-window terminal the output can also be viewed graphically using the
gsi program. In order to use the graphical display, you have to include the statement "option post" in
the input le. This will create a *.sw# (for .sweep analysis) or a *.tr# le (for transient analysis) which
contains the simulation results in a format that can be interpreted by gsi.
To run gsi, type "gsi inputfilename". All node voltages will be saved for later display. In case you
have a large circuit and don't need to look at all the nodes, you can reduce the size of the le by
specifying which node voltages to save. This is done by the ".option post probe", followed by the
".print nodenames" command. This last command is identical to the one you use to specify what
node voltages, or currents you want Spice to save.
Here is an example of the input le, with the .option post command for gsi.
example hspice with gsi
vin input 0 dc 10
f1 0 output vmeas 0.5
vmeas 4 0 dc 0
r1 input 2 1k
r2 2 output 10k
r3 input 3 15k
r4 2 4 40k
r5 output 0 50k
.tf output vin
.dc vin 0 20 2
.option post
*.print dc v(1,2) v(2,4) i(vmeas)
*.plot dc v(1,2) v(2,4) i(vmeas)
.end
To see the graphical output, type gsi example1 (if on an x-window terminal; if you are not familiar
with x-windows consult CETS). The gsi output is shown in the next gure. After typing "gsi", two
windows will open.
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
4 de 7 30/01/13 15:59

The top one allows you to select what variables to display. After making the selection of the "type" of
variables (voltages, current, etc.) and the "curves" to be displayed, click on the "Draw" button. The
curves will be shown on the second window (Graph window).

You can select the number of panels by going to the "Panels" menu and selecting the number of
panels. There are several option and manipulations you can incorporate (see Features of gsi below).
Features of gsi
In the Graph window you have a number of interesting options. The measurement menu allows you to
use cursors. To zoom in/out click on the right mouse button and select one of the zoom commands.
Then with the left button draw a short line to indicate what you would like to zoom.
To clear a panel, click on the right mouse button and select "Clear".
Printing can be done by going to the "Print" menu. The print command will write the graphical output
to a le (labeled as lename.gr#)) which can then be printed later on (using the lpr command).
Mathematical expressions can be plotted as well. In the top window, you will see a small box called
expression. You can type mathematical expressions such as additions, multiplications, square, etc. of
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
5 de 7 30/01/13 15:59
graphs. As an example lets calculate the power in a resistor (power = i(vmeas)*v(2)). To display the
expression, select expression in the "Types" window and "power" in the "Curves" window. Next, click
on the "Draw" button.
6. Most common mistakes
Typos in the source le: wrong node numbers, wrong units (ex. the value of a capacitor of 12
picofarad, incorrectly specied as 12, instead of 12p.)
1.
Confuse M for mega instead of MEG: a 5 megaohm resistor should be specied as 5MEG and
not 5M. (M or m stands for milli).
2.
Typing the letter O instead for the number 0 (zero as in 10) 3.
Omitting the nal carriage return after the .END statement. 4.
7. If Spice does not run.
1. First check that /cad/bin is in your path. If not, you should alter the path to statement in your shell
initialization le to include /cad/bin.).
2. To run hspice on eniac from an X-TERMINAL that runs on a computer different from eniac (lets
say hobo in the EE domain):
logon to hobo.ee (to which the display is connected) and type:
xhost eniac.seas.upenn.edu
login to eniac and type:
rsh eniac.seas.upenn.edu; once on eniac type:
setenv DISPLAY hobo.ee:0.0
8. REFERENCES
SPICE, A Guide to Circuit Simulation and Analysis Using PSpice, 3rd Ed., P. Tuinenga,
Prentice Hall, Upper Saddle River, NJ, 1995. This book comes with a IBM-PC 3.5 disk with the
PSpice Student Version.
1.
Schematic Capture with MicroSim PSpice, 3rd Ed., Marc. E. Herniter, Prentice Hall, Upper
Saddle River, N.J, 1998. This book comes with a CD that contains an evaluation version of
PSpice.
2.
MicroSim PSpice with Circuit Analysis, 2nd Ed., F. Monssen, Prentice Hall, Upper Saddle
River, NJ, 1998.
3.
MicroSim PSpice for Windows, Vol. I and II, R. W. Goody, Prentice Hall, Upper Saddle River, 4.
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
6 de 7 30/01/13 15:59
NJ, 1998.
Spice for Circuits and Electronics Using PSpice, 2nd ed., M. H. Rashid, Prentice Hall,
Englewood Cliffs, NJ, 1995. This book comes with a tear-out card to order a disk with the
PSpice Student Version (available for both PC and MAC). The cost for the disk is about
$7.50-$15.50
5.
Computer-Aided Circuit Analysis Using PSpice, 2nd Ed., W. Banzhaf, Prentice-Hall,
Englewood Cliffs, NJ, 1992
6.
Hands On PSpice,"J.G. Gottling, Houghton Mifin Co., MA, 1995 7.
The Spice Book, A. Vladimirescu, John Wiley & Sons, New York, NY, 1994 8.
Semiconductor Device Modeling with Spice, 2nd Ed., G. Massobrio and P. Antognetti,
McGraw-Hill, NY, 1993
9.
Mosfet Modeling with Spice, D. Foty, Prentice Hall, Upper Saddle River, NJ, 1997. 10.
Macromodeling with Spice, J.A. Connelly/P. Choi, Prentice-Hall, Englewood Cliffs, NJ, 1992 11.
Inside SPICE, Overcoming the Obstacles of Circuit Simulation, R. M. Kielkowski,
MacGraw-Hill, Inc., New York, 1994.
12.
SPICE, Practical Device Modeling, R. W. Kielkowski, McGraw-Hill, Inc., New York, 1995. 13.
Introduction to PSpice, A Supplement to Electric Circuits, 4th ed., by J. W. Nilsson and Susan
A. Reidel, Addison-Wesley Publ. Company, Reading, MA, 1993
14.
Spice, by G. Roberts and A. Sedra, Oxford University Press, 1997, 2nd Edition. 15.
HSPice Users' Manual, Meta-Software, Inc., Campbell, CA 16.
PSpice Users' Guide, MicroSim Corporation, Irvine, CA 17.
SPICE User's Guide 18.

Back to Table of Contents
Jan Van der Spiegel
jan@ee.upenn.edu
Created Sept. 30, 1995; Updated Dec. 3, 2001
spice guide http://www.seas.upenn.edu/~jan/spice/spice.guide.html#PSPICE
7 de 7 30/01/13 15:59

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy