Sei sulla pagina 1di 60

Introduction

"With Electronics Workbench, you can create circuit schematics that look just the same as those
you're already familiar with on paper -- plus you can flip the power switch so the schematic
behaves like a real circuit. With other electronics simulators, you may have to type in S!"E
node lists as te#t files -- an abstract representation of a circuit beyond the capabilities of all but
advanced electronics en$ineers."
(Electronics Workbench User's guide -- version 4, page 7)
This introduction comes from the operating manual for a circuit simulation program called
Electronics Workbench. Using a graphic interface, it allows the user to draw a circuit schematic
and then have the computer analyze that circuit, displaying the results in graphic form. It is a
very valuable analysis tool, but it has its shortcomings. For one, it and other graphic programs
like it tend to be unreliable when analyzing complex circuits, as the translation from picture to
computer code is not uite the exact science we would want it to be !yet". #econdly, due to its
graphics reuirements, it tends to need a significant amount of computational $horsepower$ to
run, and a computer operating system that supports graphics. Thirdly, these graphic programs
can be costly.
%owever, underneath the graphics skin of Electronics Workbench lies a robust !and free&"
program called #'I(), which analyzes a circuit based on a text*file description of the circuit+s
components and connections. ,hat the user pays for with Electronics Workbench and other
graphic circuit analysis programs is the convenient $point and click$ interface, while #'I() does
the actual mathematical analysis.
-y itself, #'I() does not reuire a graphic interface and demands little in system resources. It is
also very reliable. The makers of )lectronic ,orkbench would like you to think that using #'I()
in its native text mode is a task suited for rocket scientists, but I+m writing this to prove them
wrong. #'I() is fairly easy to use for simple circuits, and its non*graphic interface actually lends
itself toward the analysis of circuits that can be difficult to draw. I think it was the programming
expert .onald /nuth who uipped, $,hat you see is all you get$ when it comes to computer
applications. 0raphics may look more attractive, but abstracted interfaces !text" are actually
more efficient.
This document is not intended to be an exhaustive tutorial on how to use #'I(). I+m merely
trying to show the interested user how to apply it to the analysis of simple circuits, as an
alternative to proprietary !111" and buggy programs. 2nce you learn the basics, there are other
tutorials better suited to take you further. Using #'I() ** a program originally intended to
develop integrated circuits ** to analyze some of the really simple circuits showcased here may
seem a bit like cutting butter with a chain saw, but it works&
3ll options and examples have been tested on #'I() version 4g5 on both 6#*.2# and 7inux
operating systems. 3s far as I know, I+m not using features specific to version 4g5, so these
simple functions should work on most versions of #'I().
History of SPICE
#'I() is a computer program designed to simulate analog electronic circuits. It original intent
was for the development of integrated circuits, from which it derived its name8 Simulation
Program with ntegrated !ircuit Emphasis.
The origin of #'I() traces back to another circuit simulation program called (39():. .eveloped
by professor :onald :ohrer of U.(. -erkeley along with some of his students in the late ;<5=+s,
(39(): continued to be improved through the early ;<>=+s. ,hen :ohrer left -erkeley, (39():
was re*written and re*named to #'I(), released as version ; to the public domain in 6ay of
;<>4. ?ersion 4 of #'I() was released in ;<>@ !version 4g5 ** the version used in this book ** is
a minor revision of this ;<>@ release". Instrumental in the decision to release #'I() as a public*
domain computer program was professor .onald 'ederson of -erkeley, who believed that all
significant technical progress happens when information is freely shared. I for one thank him for
his vision.
3 maAor improvement came about in 6arch of ;<B@ with version C of #'I() !also released under
public domain". ,ritten in the ( language rather than F2:T:39, version C incorporated
additional transistor types !the 6)#F)T, for example", and switch elements. ?ersion C also
allowed the use of alphabetical node labels rather than only numbers. Instructions written for
version 4 of #'I() should still run in version C, though.
.espite the additional power of version C, I have chosen to use version 4g5 throughout this book
because it seems to be the easiest version to acuire and run on different computer systems.
Fundamentals of SPICE programming
'rogramming a circuit simulation with #'I() is much like programming in any other computer
language8 you must type the commands as text in a file, save that file to the computer+s hard
drive, and then process the contents of that file with a program !compiler or interpreter" that
understands such commands.
In an interpreted computer language, the computer holds a special program called an interpreter
that translates the program you wrote !the so*called source file" into the computer+s own
language, on the fly, as its being executed8
In a compiled computer language, the program you wrote is translated all at once into the
computer+s own language by a special program called a compiler. 3fter the program you+ve
written has been $compiled,$ the resulting e#ecutable file needs no further translation to be
understood directly by the computer. It can now be $run$ on a computer whether or not compiler
software has been installed on that computer8
#'I() is an interpreted language. In order for a computer to be able to understand the #'I()
instructions you type, it must have the #'I() program !interpreter" installed8
#'I() source files are commonly referred to as $netlists,$ although they are sometimes known as
$decks$ with each line in the file being called a $card.$ (ute, don+t you thinkD 9etlists are created
by a person like yourself typing instructions line*by*line using a word processor or text editor.
Text editors are much preferred over word processors for any type of computer programming, as
they produce pure 3#(II text with no special embedded codes for text highlighting !like italic or
bold"ace fonts", which are uninterpretable by interpreter and compiler software.
3s in general programming, the source file you create for #'I() must follow certain conventions
of programming. It is a computer language in itself, albeit a simple one. %aving programmed in
-3#I( and (E(FF, and having some experience reading '3#(37 and F2:T:39 programs, it is
my opinion that the language of #'I() is much simpler than any of these. It is about the same
complexity as a markup language such as %T67, perhaps less so.
There is a cycle of steps to be followed in using #'I() to analyze a circuit. The cycle starts when
you first invoke the text editing program and make your first draft of the netlist. The next step is
to run #'I() on that new netlist and see what the results are. If you are a novice user of #'I(),
your first attempts at creating a good netlist will be fraught with small errors of syntax. .on+t
worry ** as every computer programmer knows, proficiency comes with lots of practice. If your
trial run produces error messages or results that are obviously incorrect, you need to re*invoke
the text editing program and modify the netlist. 3fter modifying the netlist, you need to run
#'I() again and check the results. The seuence, then, looks something like this8
(ompose a new netlist with a text editing program. #ave
that netlist to a file with a name of your choice.
:un #'I() on that netlist and observe the results.
If the results contain errors, start up the text editing
program again and modify the netlist.
:un #'I() again and observe the new results.
If there are still errors in the output of #'I(), re*edit the
netlist again with the text editing program. :epeat this
cycle of editErun as many times as necessary until you are
getting the desired results.
2nce you+ve $debugged$ your netlist and are getting good
results, run #'I() again, only this time redirecting the
output to a new file instead of Aust observing it on the
computer screen.
#tart up a text editing program or a word processor
program and open the #'I() output file you Aust created.
6odify that file to suit your formatting needs and either
save those changes to disk andEor print them out on
paper.
To $run$ a #'I() $program,$ you need to type in a command at a terminal prompt interface,
such as that found in 6#*.2#, U9IG, or the 6#*,indows .2# prompt option8
spice < example.cir
The word $spice$ invokes the #'I() interpreting program !providing that the #'I() software has
been installed on the computer&", the $H$ symbol redirects the contents of the source file to the
#'I() interpreter, and example.cir is the name of the source file for this circuit example. The
file extension $.cir$ is not mandatoryI I have seen $.inp$ !for $input$" and Aust plain $.txt$
work well, too. It will even work when the netlist file has no extension. #'I() doesn+t care what
you name it, so long as it has a name compatible with the filesystem of your computer !for old
6#*.2# machines, for example, the filename must be no more than B characters in length, with
a C character extension, and no spaces or other non*alphanumerical characters".
,hen this command is typed in, #'I() will read the contents of the example.cir file, analyze
the circuit specified by that file, and send a text report to the computer terminal+s standard
output !usually the screen, where you can see it scroll by". 3 typical #'I() output is several
screens worth of information, so you might want to look it over with a slight modification of the
command8
spice < example.cir | more
This alternative $pipes$ the text output of #'I() to the $more$ utility, which allows only one page
to be displayed at a time. ,hat this means !in )nglish" is that the text output of #'I() is halted
after one screen*full, and waits until the user presses a keyboard key to display the next screen*
full of text. If you+re Aust testing your example circuit file and want to check for any errors, this is
a good way to do it.
spice < example.cir > example.txt
This second alternative !above" redirects the text output of #'I() to another file, called
example.txt, where it can be viewed or printed. This option corresponds to the last step in the
development cycle listed earlier. It is recommended by this author that you use this techniue of
$redirection$ to a text file only after you+ve proven your example circuit netlist to work well, so
that you don+t waste time invoking a text editor Aust to see the output during the stages of
$debugging.$
2nce you have a #'I() output stored in a .txt file, you can use a text editor or !better yet&" a
word processor to edit the output, deleting any unnecessary banners and messages, even
specifying alternative fonts to highlight the headings andEor data for a more polished
appearance. Then, of course, you can print the output to paper if you so desire. -eing that the
direct #'I() output is plain 3#(II text, such a file will be universally interpretable on any
computer whether #'I() is installed on it or not. 3lso, the plain text format ensures that the file
will be very small compared to the graphic screen*shot files generated by $point*and*click$
simulators.
The netlist file format reuired by #'I() is uite simple. 3 netlist file is nothing more than a plain
3#(II text file containing multiple lines of text, each line describing either a circuit component or
special #'I() command. (ircuit architecture is specified by assigning numbers to each
component+s connection points in each line, connections between components designated by
common numbers. )xamine the following example circuit diagram and its corresponding #'I()
file. 'lease bear in mind that the circuit diagram exists only to make the simulation easier for
human beings to understand. #'I() only understands netlists8
Example netlist
v1 1 0 dc 15
r1 1 0 2.2k
r2 1 2 3.3k
r3 2 0 150
.end
)ach line of the source file shown above is explained here8
v1 represents the battery !voltage source ;", positive
terminal numbered ;, negative terminal numbered =, with
a .( voltage output of ;@ volts.
r1 represents resistor :; in the diagram, connected
between points ; and =, with a value of 4.4 kJ.
r2 represents resistor :4 in the diagram, connected
between points ; and 4, with a value of C.C kJ.
r3 represents resistor :C in the diagram, connected
between points 4 and =, with a value of ;@= kJ.
)lectrically common points !or $nodes$" in a #'I() circuit description share common numbers,
much in the same way that wires connecting common points in a large circuit typically share
common wire labels.
To simulate this circuit, the user would type those six lines of text on a text editor and save them
as a file with a uniue name !such as example.cir". 2nce the netlist is composed and saved to
a file, the user then processes that file with one of the command*line statements shown earlier
!spice < example.cir", and will receive this text output on their computer+s screen8
1*******10/10/99 ******** spice 2g. 3/15/!3 ********0"#32#$2*****
0example netlist
0**** inp%t listing temperat%re & 2".000 deg c
v1 1 0 dc 15
r1 1 0 2.2k
r2 1 2 3.3k
r3 2 0 150
.end
*****10/10/99 ********* spice 2g. 3/15/!3 ******0"#32#$2******
0example netlist
0**** small signal 'ias sol%tion temperat%re & 2".000 deg c
node voltage node voltage
( 1) 15.0000 ( 2) 0.522
voltage so%rce c%rrents
name c%rrent
v1 *1.11"E*02
total po+er dissipation 1."E*01 +atts

,o' concl%ded
0 total ,o' time 0.02
1*******10/10/99 ******** spice 2g. 3/15/!3 ******0"#32#$2*****
0**** inp%t listing temperat%re & 2".000 deg c
#'I() begins by printing the time, date, and version used at the top of the output. It then lists
the input parameters !the lines of the source file", followed by a display of .( voltage readings
from each node !reference number" to ground !always reference number =". This is followed by a
list of current readings through each voltage source !in this case there+s only one, v;". Finally,
the total power dissipation and computation time in seconds is printed.
3ll output values provided by #'I() are displayed in scientific notation.
The #'I() output listing shown above is a little verbose for most peoples+ taste. For a final
presentation, it might be nice to trim all the unnecessary text and leave only what matters. %ere
is a sample of that same output, redirected to a text file !spice < example.cir >
example.txt", then trimmed down Audiciously with a text editor for final presentation and
printed8
example netlist
v1 1 0 dc 15
r1 1 0 2.2k
r2 1 2 3.3k
r3 2 0 150
.end
node voltage node voltage
( 1) 15.0000 ( 2) 0.522
voltage so%rce c%rrents
name c%rrent
v1 *1.11"E*02
total po+er dissipation 1."E*01 +atts
2ne of the very nice things about #'I() is that both input and output formats are plain*text,
which is the most universal and easy*to*edit electronic format around. 'ractically any computer
will be able to edit and display this format, even if the #'I() program itself is not resident on
that computer. If the user desires, he or she is free to use the advanced capabilities of word
processing programs to make the output look fancier. (omments can even be inserted between
lines of the output for further clarity to the reader.
The command-line interface
If you+ve used .2# or U9IG operating systems before in a command*line shell environment, you
may wonder why we have to use the $H$ symbol between the word $spice$ and the name of the
netlist file to be interpreted. ,hy not Aust enter the file name as the first argument to the
command $spice$ as we do when we invoke the text editorD The answer is that #'I() has the
option of an interactive mode, whereby each line of the netlist can be interpreted as it is entered
through the computer+s #tandard Input !stdin". If you simple type $spice$ at the prompt and
press #Enter$, #'I() will begin to interpret anything you type in to it !live".
For most applications, its nice to save your netlist work in a separate file and then let #'I()
interpret that file when you+re ready. This is the way I encourage #'I() to be used, and so this is
the way its presented in this lesson. In order to use #'I() this way in a command*line
environment, we need to use the $H$ redirection symbol to direct the contents of your netlist file
to #tandard Input !stdin", which #'I() can then process.
Circuit components
:emember that this tutorial is not exhaustive by any means, and that all descriptions for
elements in the #'I() language are documented here in condensed form. #'I() is a very
capable piece of software with lots of options, and I+m only going to document a few of them.
%ll components in a #'I() source file are primarily identified by the first letter in each respective
line. (haracters following the identifying letter are used to distinguish one component of a
certain type from another of the same type !r;, r4, rC, rload, rpullup, etc.", and need not follow
any particular naming convention, so long as no more than eight characters are used in both the
component identifying letter and the distinguishing name.
For example, suppose you were simulating a digital circuit with $pullup$ and $pulldown$ resistors.
The name rp%ll%p would be valid because it is seven characters long. The name rp%lldo+n,
however, is nine characters long. This may cause problems when #'I() interprets the netlist.
Kou can actually get away with component names in excess of eight total characters if there are
no other similarly*named components in the source file. #'I() only pays attention to the first
eight characters of the first field in each line, so rp%lldo+n is actually interpreted as rp%lldo+
with the $n$ at the end being ignored. Therefore, any other resistor having the first eight
characters in its first field will be seen by #'I() as the same resistor, defined twice, which will
cause an error !i.e. rp%lldo+n1 and rp%lldo+n2 would be interpreted as the same name,
rp%lldo+".
It should also be noted that #'I() ignores character case, so r1 and -1 are interpreted by #'I()
as one and the same.
#'I() allows the use of metric prefixes in specifying component values, which is a very handy
feature. %owever, the prefix convention used by #'I() differs somewhat from standard metric
symbols, primarily due to the fact that netlists are restricted to standard 3#(II characters !ruling
out 0reek letters such as L for the prefix $micro$" and that #'I() is case*insensitive, so $m$
!which is the standard symbol for $milli$" and $6$ !which is the standard symbol for $6ega$" are
interpreted identically. %ere are a few examples of prefixes used in #'I() netlists8
r1 1 0 2t !:esistor :;, 4t M 4 Tera*ohms M 4 TJ"
r2 1 0 $g !:esistor :4, Ng M N 0iga*ohms M N 0J"
r3 1 0 $"meg !:esistor :C, N>meg M N> 6ega*ohms M N> 6J"
r$ 1 0 3.3k !:esistor :N, C.Ck M C.C kilo*ohms M C.C kJ"
r5 1 0 55m !:esistor :@, @@m M @@ milli*ohms M @@ mJ"
r 1 0 10% !:esistor :5, ;=u M ;= micro*ohms ;= LJ"
r" 1 0 30n !:esistor :>, C=n M C= nano*ohms M C= nJ"
r! 1 0 5p !:esistor :B, @p M @ pico*ohms M @ pJ"
r9 1 0 250. !:esistor :<, 4@=f M 4@= femto*ohms M 4@= fJ"
#cientific notation is also allowed in specifying component values. For example8
r10 1 0 $."e3 !:esistor :;=, N.>eC M N.> x ;=
C
ohms M N.> kilo*ohms M N.> kJ"
r11 1 0 1e*12 !:esistor :;;, ;e*;4 M ; x ;=
*;4
ohms M ; pico*ohm M ; pJ"
The unit !ohms, volts, farads, henrys, etc." is automatically determined by the type of
component being specified. #'I() $knows$ that all of the above examples are $ohms$ because
they are all resistors !r;, r4, rC, . . . ". If they were capacitors, the values would be interpreted
as $farads,$ if inductors, then $henrys,$ etc.
Passive components
CAPACITORS
/eneral .orm# c0name1 0node11 0node21 0val%e1 ic&0initial voltage1
Example 1# c1 12 33 10%
Example 2# c1 12 33 10% ic&3.5

!o%%ents& The $initial condition$ !ic&" variable is the capacitor+s voltage in units of volts at the
start of .( analysis. It is an optional value, with the starting voltage assumed to be zero if
unspecified. #tarting current values for capacitors are interpreted by #'I() only if the .tran
analysis option is invoked !with the $%ic$ option".
INDUCTORS
/eneral .orm# l0name1 0node11 0node21 0val%e1 ic&0initial c%rrent1
Example 1# l1 12 33 133m
Example 2# l1 12 33 133m ic&12."m

!o%%ents& The $initial condition$ !ic&" variable is the inductor+s current in units of amps at the
start of .( analysis. It is an optional value, with the starting current assumed to be zero if
unspecified. #tarting current values for inductors are interpreted by #'I() only if the .tran
analysis option is invoked.
INDUCTOR COUPLING (transformers)
/eneral .orm# k0name1 l0name1 l0name1 0co%pling .actor1
Example 1# k1 l1 l2 0.999

!o%%ents& #'I() will only allow coupling factor values between = and ; !non*inclusive", with =
representing no coupling and ; representing perfect coupling. The order of specifying coupled
inductors !l;, l4 or l4, l;" is irrelevant.
RESISTORS
/eneral .orm# r0name1 0node11 0node21 0val%e1
Example# rload 23 15 3.3k

!o%%ents& In case you were wondering, there is no declaration of resistor power dissipation
rating in #'I(). 3ll components are assumed to be indestructible. If only real life were this
forgiving&
Active components
3ll semiconductor components must have their electrical characteristics described in a line
starting with the word $.model$, which tells #'I() exactly how the device will behave. ,hatever
parameters are not explicitly defined in the .model card will default to values pre*programmed
in #'I(). %owever, the .model card must be included, and at least specify the model name and
device type !d, npn, pnp, nAf, pAf, nmos, or pmos".
DIODES
/eneral .orm# d0name1 0anode1 0cat2ode1 0model1
Example# d1 1 2 mod1

'('E )('E*S&
/eneral .orm# .model 0modelname1 d 0parmtr1&x1 0parmtr2&x1 . . .
Example# .model mod1 d
Example# .model mod2 d v,&0.5 rs&1.3

diodeparameter
arameter definitions&
is M saturation current in amps
rs M Aunction resistance in ohms
n M emission coefficient !unitless"
tt M transit time in seconds
c,o M zero*bias Aunction capacitance in farads
v, M Aunction potential in volts
m M grading coefficient !unitless"
eg M activation energy in electron*volts
xti M saturation*current temperature exponent !unitless"
k. M flicker noise coefficient !unitless"
a. M flicker noise exponent !unitless"
.c M forward*bias depletion capacitance coefficient !unitless"
'v M reverse breakdown voltage in volts
i'v M current at breakdown voltage in amps
!o%%ents& The model name must begin with a letter, not a number. If you plan to specify a
model for a ;9N==C rectifying diode, for instance, you cannot use $;nN==C$ for the model name.
3n alternative might be $m;nN==C$ instead.
TRANSISTORS, bipolar !n"tion ## $%T
/eneral .orm# 30name1 0collector1 0'ase1 0emitter1 0model1
Example# 31 2 3 0 mod1

+,- -./0SS-(. )('E*S&
/eneral .orm# .model 0modelname1 0npn or pnp1 0parmtr1&x1 . . .
Example# .model mod1 pnp
Example# .model mod2 npn '.&"5 is&1e*1$

The model examples shown above are very nonspecific. To accurately model real*life transistors,
more parameters are necessary. Take these two examples, for the popular 494444 and 494<=>
transistors !the $4$" characters represent line*continuation marks in #'I(), when you wish to
break a single line !card" into two or more separate lines on your text editor8

Example# .model m2n2222 npn is&19. '.&150 va.&100 ik.&.1!
4 ise&50p ne&2.5 'r&".5 var&.$ ikr&12m
4 isc&!."p nc&1.2 r'&50 re&0.$ rc&0.$ c,e&2p
4 t.&0.5n c,c&11p tr&"n xt'&1.5 k.&0.032. a.&1

Example# .model m2n290" pnp is&1.1p '.&200 n.&1.2 va.&50
4 ik.&0.1 ise&13p ne&1.9 'r& rc&0. c,e&23p
4 v,e&0.!5 m,e&1.25 t.&0.5n c,c&19p v,c&0.5
4 m,c&0.2 tr&3$n xt'&1.5

arameter definitions&
is M transport saturation current in amps
'. M ideal maximum forward -eta !unitless"
n. M forward current emission coefficient !unitless"
va. M forward )arly voltage in volts
ik. M corner for forward -eta high*current rolloff in amps
ise M -*) leakage saturation current in amps
ne M -*) leakage emission coefficient !unitless"
'r M ideal maximum reverse -eta !unitless"
nr M reverse current emission coefficient !unitless"
'ar M reverse )arly voltage in volts
ikrikr M corner for reverse -eta high*current rolloff in amps
iscisc M -*( leakage saturation current in amps
nc M -*( leakage emission coefficient !unitless"
r' M zero bias base resistance in ohms
ir' M current for base resistance halfway value in amps
r'm M minimum base resistance at high currents in ohms
re M emitter resistance in ohms
rc M collector resistance in ohms
c,e M -*) zero*bias depletion capacitance in farads
v,e M -*) built*in potential in volts
m,e M -*) Aunction exponential factor !unitless"
t. M ideal forward transit time !seconds"
xt. M coefficient for bias dependence of transit time !unitless"
vt. M -*( voltage dependence on transit time, in volts
it. M high*current parameter effect on transit time, in amps
pt. M excess phase at fM;E!transit time"!4"!pi" %z, in degrees
c,c M -*( zero*bias depletion capacitance in farads
v,c M -*( built*in potential in volts
m,c M -*( Aunction exponential factor !unitless"
x,c, M -*( depletion capacitance fraction connected in base node !unitless"
tr M ideal reverse transit time in seconds
c,s M zero*bias collector*substrate capacitance in farads
v,s M substrate Aunction built*in potential in volts
m,s M substrate Aunction exponential factor !unitless"
xt' M forwardEreverse -eta temperature exponent
eg M energy gap for temperature effect on transport saturation current in electron*volts
xti M temperature exponent for effect on transport saturation current !unitless"
k. M flicker noise coefficient !unitless"
a. M flicker noise exponent !unitless"
.c M forward*bias depletion capacitance formula coefficient !unitless"
!o%%ents& Oust as with diodes, the model name given for a particular transistor type must
begin with a letter, not a number. That+s why the examples given above for the 494444 and
494<=> types of -OTs are named $m4n4444$ and $4n4<=>$ respectively.
3s you can see, #'I() allows for very detailed specification of transistor properties. 6any of the
properties listed above are well beyond the scope and interest of the beginning electronics
student, and aren+t even useful apart from knowing the euations #'I() uses to model -OT
transistors. For those interested in learning more about transistor modeling in #'I(), consult
other books, such as 3ndrei ?ladimirescu+s 'he Spice (ook !I#-9 =*N>;*5=<45*<".
%&ET, !n"tion 'el(#e)e"t transistor
/eneral .orm# ,0name1 0drain1 0gate1 0so%rce1 0model1
Example# ,1 2 3 0 mod1

,1E- -./0SS-(. )('E*S&
/eneral .orm# .model 0modelname1 0n,. or p,.1 0parmtr1&x1 . . .
Example# .model mod1 p,.
Example# .model mod2 n,. lam'da&1e*5 p'&0."5

arameter definitions&
vto M threshold voltage in volts
'eta M transconductance parameter in ampsEvolts
4

lam'da M channel length modulation parameter in units of ;Evolts
rd M drain resistance in ohms
rs M source resistance in ohms
cgs M zero*bias 0*# Aunction capacitance in farads
cgd M zero*bias 0*. Aunction capacitance in farads
p' M gate Aunction potential in volts
is M gate Aunction saturation current in amps
k. M flicker noise coefficient !unitless"
a. M flicker noise exponent !unitless"
.c M forward*bias depletion capacitance coefficient !unitless"
*OS&ET, transistor
/eneral .orm# m0name1 0drain1 0gate1 0so%rce1 0s%'strate1 0model1
Example# m1 2 3 0 0 mod1

)(S1E- -./0SS-(. )('E*S&
/eneral .orm# .model 0modelname1 0nmos or pmos1 0parmtr1&x1 . . .
Example# .model mod1 pmos
Example# .model mod2 nmos level&2 p2i&0.5 rd&1.5
Example# .model mod3 nmos vto&*1 (depletion)
Example# .model mod$ nmos vto&1 (en2ancement)
Example# .model mod5 pmos vto&1 (depletion)
Example# .model mod pmos vto&*1 (en2ancement)

!o%%ents& In order to distinguish between enhancement mode and depletion*mode !also
known as depletion*enhancement mode" transistors, the model parameter $vto$ !zero*bias
threshold voltage" must be specified. Its default value is zero, but a positive value !F; volts, for
example" on a '*channel transistor or a negative value !*; volts" on an 9*channel transistor will
specify that transistor to be a depletion !otherwise known as depletion-enhancement" mode
device. (onversely, a negative value on a '*channel transistor or a positive value on an 9*
channel transistor will specify that transistor to be an enhancement mode device.
:emember that enhancement mode transistors are normally*off devices, and must be turned on
by the application of gate voltage. .epletion*mode transistors are normally $on,$ but can be
$pinched off$ as well as enhanced to greater levels of drain current by applied gate voltage,
hence the alternate designation of $depletion*enhancement$ 62#F)Ts. The $vto$ parameter
specifies the threshold gate voltage for 62#F)T conduction.
Sources
/! S0EW/2E 2(*-/3E S(U.!ES (4hen using 5ac card to speci"6 "re7uenc6)&
/eneral .orm# v0name1 04node1 0*node1 ac 0voltage1 0p2ase1 sin
Example 1# v1 1 0 ac 12 sin
Example 2# v1 1 0 ac 12 2$0 sin (12 5 2$0
o
)
!o%%ents& This method of specifying 3( voltage sources works well if you+re using multiple
sources at different phase angles from each other, but all at the same freuency. If you need to
specify sources at different freuencies in the same circuit, you must use the next method&
/! S0EW/2E 2(*-/3E S(U.!ES (4hen 0(- using 5ac card to speci"6 "re7uenc6)&
/eneral .orm# v0name1 04node1 0*node1 sin(0o..set1 0voltage1
4 0.re31 0dela61 0damping .actor1)
Example 1# v1 1 0 sin(0 12 0 0 0)
arameter definitions&
o..set M .( bias voltage, offsetting the 3( waveform by a specified voltage.
voltage M peak, or crest, 3( voltage value for the waveform.
.re3 M freuency in %ertz.
dela6 M time delay, or phase offset for the waveform, in seconds.
damping .actor M a figure used to create waveforms of decaying amplitude.
!o%%ents& This method of specifying 3( voltage sources works well if you+re using multiple
sources at different freuencies from each other. :epresenting phase shift is tricky, though,
necessitating the use of the delay factor.
'! 2(*-/3E S(U.!ES (4hen using 5dc card to speci"6 voltage)&
/eneral .orm# v0name1 04node1 0*node1 dc
Example 1# v1 1 0 dc
!o%%ents& If you wish to have #'I() output voltages not in reference to node =, you must use
the .dc analysis option, and to use this option you must specify at least one of your .( sources
in this manner.
'! 2(*-/3E S(U.!ES (4hen 0(- using 5dc card to speci"6 voltage)&
/eneral .orm# v0name1 04node1 0*node1 dc 0voltage1
Example 1# v1 1 0 dc 12
!o%%ents& 9othing noteworthy here&
PU*SE 2(*-/3E S(U.!ES
/eneral .orm# v0name1 04node1 0*node1 p%lse (0i1 0p1 0td1 0tr1
4 0t.1 0p+1 0pd1)
arameter definitions&
i M initial value
p M pulse value
td M delay time !all time parameters in units of seconds"
tr M rise time
t. M fall time
p+ M pulse width
pd M period
Example 1# v1 1 0 p%lse (*3 3 0 0 0 10m 20m)
!o%%ents& )xample ; is a perfect suare wave oscillating between *C and FC volts, with zero
rise and fall times, a 4= millisecond period, and a @= percent duty cycle !FC volts for ;= ms, then
*C volts for ;= ms".
/! S0EW/2E !U..E0- S(U.!ES (4hen using 5ac card to speci"6 "re7uenc6)&
/eneral .orm# i0name1 04node1 0*node1 ac 0c%rrent1 0p2ase1 sin
Example 1# i1 1 0 ac 3 sin (3 amps)
Example 2# i1 1 0 ac 1m 2$0 sin (1 m7 2$0
o
)
!o%%ents& The same comments apply here !and in the next example" as for 3( voltage
sources.
/! S0EW/2E !U..E0- S(U.!ES (4hen 0(- using 5ac card to speci"6 "re7uenc6)&
/eneral .orm# i0name1 04node1 0*node1 sin(0o..set1
4 0c%rrent1 0.re31 0 0)
Example 1# i1 1 0 sin(0 1.5 0 0 0)
'! !U..E0- S(U.!ES (4hen using 5dc card to speci"6 current)&
/eneral .orm# i0name1 04node1 0*node1 dc
Example 1# i1 1 0 dc
'! !U..E0- S(U.!ES (4hen 0(- using 5dc card to speci"6 current)&
/eneral .orm# i0name1 04node1 0*node1 dc 0c%rrent1
Example 1# i1 1 0 dc 12
!o%%ents& )ven though the books all say that the first node given for the .( current source is
the positive node, that+s not what I+ve found to be in practice. In actuality, a .( current source in
#'I() pushes current in the same direction as a voltage source !battery" would with its ne$ative
node specified first.
PU*SE !U..E0- S(U.!ES
/eneral .orm# i0name1 04node1 0*node1 p%lse (0i1 0p1 0td1 0tr1
4 0t.1 0p+1 0pd1)
arameter definitions&
i M initial value
p M pulse value
td M delay time
tr M rise time
t. M fall time
p+ M pulse width
pd M period
Example 1# i1 1 0 p%lse (*3m 3m 0 0 0 1"m 3$m)
!o%%ents& )xample ; is a perfect suare wave oscillating between *C m3 and FC m3, with
zero rise and fall times, a CN millisecond period, and a @= percent duty cycle !FC m3 for ;> ms,
then *C m3 for ;> ms".
2(*-/3E S(U.!ES (dependent)&
/eneral .orm# e0name1 0o%t4node1 0o%t*node1 0in4node1 0in*node1
4 0gain1
Example 1# e1 2 0 1 2 999k
!o%%ents& .ependent voltage sources are great to use for simulating operational amplifiers.
)xample ; shows how such a source would be configured for use as a voltage follower, inverting
input connected to output !node 4" for negative feedback, and the noninverting input coming in
on node ;. The gain has been set to an arbitrarily high value of <<<,===. 2ne word of caution,
though8 #'I() does not recognize the input of a dependent source as being a load, so a voltage
source tied only to the input of an independent voltage source will be interpreted as $open.$ #ee
op*amp circuit examples for more details on this.
!U..E0- S(U.!ES (dependent)&
Analysis options
/! /0/*8SS&
/eneral .orm# .ac 0c%rve1 0points1 0start1 0.inal1
Example 1# .ac lin 1 1000 1000
!o%%ents& The PcurveQ field can be $lin$ !linear", $dec$ !decade", or $oct$ !octave", specifying
the !non"linearity of the freuency sweep. specifies how many points within the freuency sweep
to perform analyses at !for decade sweep, the number of points per decadeI for octave, the
number of points per octave". The PstartQ and PfinalQ fields specify the starting and ending
freuencies of the sweep, respectively. 2ne final note8 the $start$ value cannot be zero&
'! /0/*8SS&
/eneral .orm# .dc 0so%rce1 0start1 0.inal1 0increment1
Example 1# .dc vin 1.5 15 0.5
!o%%ents& The .dc card is necessary if you want to print or plot any voltage between two
nonzero nodes. 2therwise, the default $small*signal$ analysis only prints out the voltage between
each nonzero node and node zero.
-./0SE0- /0/*8SS&
/eneral .orm# .tran 0increment1 0stop8time1 0start8time1
4 0comp8interval1
Example 1# .tran 1m 50m %ic
Example 2# .tran .5m 32m 0 .01m
!o%%ents& )xample ; has an increment time of ; millisecond and a stop time of @=
milliseconds !when only two parameters are specified, they are increment time and stop time,
respectively". )xample 4 has an increment time of =.@ milliseconds, a stop time of C4
milliseconds, a start time of = milliseconds !no delay on start", and a computation interval of
=.=; milliseconds.
.efault value for start time is zero. Transient analysis always beings at time zero, but storage of
data only takes place between start time and stop time. .ata output interval is increment time,
or !stop time * start time"E@=, which ever is smallest. %owever, the computing interval variable
can be used to force a computational interval smaller than either. For large total interval counts,
the itl5 variable in the .options card may be set to a higher number. The $%ic$ option tells
#'I() to $use initial conditions.$
P*(- (U-PU-&
/eneral .orm# .plot 0t6pe1 0o%tp%t11 0o%tp%t21 . . . 0o%tp%t n1
Example 1# .plot dc v(192) i(v2)
Example 2# .plot ac v(39$) vp(39$) i(v1) ip(v1)
Example 3# .plot tran v($95) i(v2)
!o%%ents& #'I() can+t handle more than eight data point reuests on a single .plot or
.print card. If reuesting more than eight data points, use multiple cards&
3lso, here+s a maAor caveat when using #'I() version C8 if you+re performing 3( analysis and
you ask #'I() to plot an 3( voltage as in example R4, the v(39$) command will only output the
real component of a rectangular*form complex number& #'I() version 4 outputs the polar
magnitude of a complex number8 a much more meaningful uantity if only a single uantity is
asked for. To coerce #'I()C to give you polar magnitude, you will have to re*write the .print or
.plot argument as such8 vm(39$).
P.0- (U-PU-&
/eneral .orm# .print 0t6pe1 0o%tp%t11 0o%tp%t21 . . . 0o%tp%t n1
Example 1# .print dc v(192) i(v2)
Example 2# .print ac v(29$) i(vinp%t) vp(293)
Example 3# .print tran v($95) i(v2)
!o%%ents& #'I() can+t handle more than eight data point reuests on a single .plot or
.print card. If reuesting more than eight data points, use multiple cards&
1(U.E. /0/*8SS&
/eneral .orm# ..o%r 0.re31 0o%tp%t11 0o%tp%t21 . . . 0o%tp%t n1
Example 1# ..o%r 0 v(192)
!o%%ents& The ..o%r card relies on the .tran card being present somewhere in the deck,
with the proper time periods for analysis of adeuate cycles. 3lso, #'I() may $crash$ if a .plot
analysis isn+t done along with the ..o%r analysis, even if all .tran parameters are technically
correct. Finally, the ..o%r analysis option only works when the freuency of the 3( source is
specified in that source+s card line, and not in an .ac analysis option line.
It helps to include a computation interval variable in the .tran card for better analysis precision.
3 Fourier analysis of the voltage or current specified is performed up to the <th harmonic, with
the PfreQ specification being the fundamental, or starting freuency of the analysis spectrum.
)S!E**/0E(US&
/eneral .orm# .options 0option11 0option21
Example 1# .options limpts&500
Example 2# .options itl5&0
Example 3# .options met2od&gear
Example $# .options list
Example 5# .options nopage
Example # .options n%mdgt&
!o%%ents& There are lots of options that can be specified using this card. 'erhaps the one most
needed by beginning users of #'I() is the $limpts$ setting. ,hen running a simulation that
reuires more than 4=; points to be printed or plotted, this calculation point limit must be
increased or else #'I() will terminate analysis. The example given above !limpts&500" tells
#'I() to allocate enough memory to handle at least @== calculation points in whatever type of
analysis is specified !.(, 3(, or transient".
In example 4, we see an iteration variable !itl5" being set to a value of =. There are actually six
different iteration variables available for user manipulation. They control the iteration cycle limits
for solution of nonlinear euations. The variable itl5 sets the maximum number of iterations for
a transient analysis. #imilar to the limpts variable, itl5 usually needs to be set when a small
computation interval has been specified on a .tran card. #etting itl5 to a value of = turns off
the limit entirely, allowing the computer infinite iteration cycles !infinite time" to compute the
analysis. Warnin$& this may result in lon$ simulation times)
)xample C with $met2od&gear$ sets the numerical integration method used by #'I(). The
default is $trapezoid$ rather than $gear,$ trapezoid being a simple geometric approximation of
area under a curve found by slicing up the curve into trapezoids to approximate the shape. The
$gear$ method is based on second*order or better polynomial euations and is named after (.,.
0ear !*umerical !nte$ration of Stiff +rdinary E,uations, :eport 44;, .epartment of (omputer
#cience, University of Illinois, Urbana". The 0ear method of integration is more demanding of the
computer !computationally $expensive$" and will sometimes give slightly different results from
the trapezoid method.
The $list$ option shown in example N gives a verbose summary of all circuit components and
their respective values in the final output.
-y default, #'I() will insert 3#(II page*break control codes in the output to separate different
sections of the analysis. #pecifying the $nopage$ option !example @" will prevent such
pagination.
The $n%mdgt$ option shown in example 5 specifies the number of significant digits output when
using one of the $.print$ data output options. #'I() defaults at a precision of N significant
digits.
W'-9 !(0-.(*&
/eneral .orm# .+idt2 in&0col%mns1 o%t&0col%mns1
Example 1# .+idt2 o%t&!0
!o%%ents& The .+idt2 card can be used to control the width of text output lines upon
analysis. This is especially handy when plotting graphs with the .plot card. The default value is
;4=, which can cause problems on B=*character terminal displays unless set to B= with this
command.
Quirks
"-arba$e in, $arba$e out."
/non6%ous
#'I() is a very reliable piece of software, but it does have its little uirks that take some getting
used to. -y $uirk$ I mean a demand placed upon the user to write the source file in a particular
way in order for it to work without giving error messages. I do not mean any kind of fault with
#'I() which would produce erroneous or misleading results8 that would be more properly
referred to as a $bug.$ #peaking of bugs, #'I() has a few of them as well.
#ome !or all" of these uirks may be uniue to #'I() version 4g5, which is the only version I+ve
used extensively. They may have been fixed in later versions.
A good beginning
#'I() demands that the source file begin with something other than the first $card$ in the circuit
description $deck.$ This first character in the source file can be a linefeed, title line, or a
comment8 there Aust has to be somethin$ there before the first component*specifying line of the
file. If not, #'I() will refuse to do an analysis at all, claiming that there is a serious error !such
as improper node connections" in the $deck.$
A good ending
#'I() demands that the .end line at the end of the source file not be terminated with a linefeed
or carriage return character. In other words, when you finish typing $.end$ you should not hit the
#Enter$ key on your keyboard. The cursor on your text editor should stop immediately to the
right of the $d$ after the $.end$ and go no further. Failure to heed this uirk will result in a
$missin$ .end card$ error message at the end of the analysis output. The actual circuit analysis is
not affected by this error, so I normally ignore the message. %owever, if you+re looking to receive
a $perfect$ output, you must pay heed to this idiosyncrasy.
Must have a node 0
Kou are given much freedom in numbering circuit nodes, but you must have a node = somewhere
in your netlist in order for #'I() to work. 9ode = is the default node for circuit ground, and it is
the point of reference for all voltages specified at single node locations.
,hen simple .( analysis is performed by #'I(), the output will contain a listing of voltages at
all non*zero nodes in the circuit. The point of reference !ground" for all these voltage readings is
node =. For example8
node voltage node voltage
( 1) 15.0000 ( 2) 0.522
In this analysis, there is a .( voltage of ;@ volts between node ; and ground !node =", and a .(
voltage of =.5@44 volts between node 4 and ground !node =". In both these cases, the voltage
polarity is negative at node = with reference to the other node !in other words, both nodes ; and
4 are positive with respect to node =".
Avoid open circuits
#'I() cannot handle open circuits of any kind. If your netlist specifies a circuit with an open
voltage source, for example, #'I() will refuse to perform an analysis. 3 prime example of this
type of error is found when $connecting$ a voltage source to the input of a voltage*dependent
source !used to simulate an operational amplifier". #'I() needs to see a complete path for
current, so I usually tie a high*value resistor !call it r'og%s&" across the voltage source to act as
a minimal load.
Avoid certain component loops
#'I() cannot handle certain uninterrupted loops of components in a circuit, namely voltage
sources and inductors. The following loops will cause #'I() to abort analysis8
netlist
l1 2 $ 10m
l2 2 $ 50m
l3 2 $ 25m
netlist
v1 1 0 dc 12
l1 1 0 150m
netlist
c1 5 33%
c2 " $"%
The reason #'I() can+t handle these conditions stems from the way it performs .( analysis8 by
treating all inductors as shorts and all capacitors as opens. #ince short*circuits != J" and open
circuits !infinite resistance" either contain or generate mathematical infinitudes, a computer
simply cannot deal with them, and so #'I() will discontinue analysis if any of these conditions
occur.
In order to make these component configurations acceptable to #'I(), you must insert resistors
of appropriate values into the appropriate places, eliminating the respective short*circuits and
open*circuits. If a series resistor is reuired, choose a very low resistance value. (onversely, if a
parallel resistor is reuired, choose a very high resistance value. For example8
To fix the parallel inductor problem, insert a very low*value resistor in series with each offending
inductor.
original netlist
l1 2 $ 10m
l2 2 $ 50m
l3 2 $ 25m
.ixed netlist
r'og%s1 2 3 1e*12
r'og%s2 2 5 1e*12
l1 3 $ 10m
l2 2 $ 50m
l3 5 $ 25m
The extremely low*resistance resistors :bogus; and :bogus4 !each one with a mere ; pico*ohm of
resistance" $break up$ the direct parallel connections that existed between 7;, 74, and 7C. It is
important to choose very low resistances here so that circuit operation is not substantially
impacted by the $fix.$
To fix the voltage source E inductor loop, insert a very low*value resistor in series with the two
components.
original netlist
v1 1 0 dc 12
l1 1 0 150m
.ixed netlist
v1 1 0 dc 12
l1 2 0 150m
r'og%s 1 2 1e*12
3s in the previous example with parallel inductors, it is important to make the correction resistor
!:bogus" very low in resistance, so as to not substantially impact circuit operation.
To fix the series capacitor circuit, one of the capacitors must have a resistor shunting across it.
#'I() reuires a .( current path to each capacitor for analysis.
original netlist
c1 5 33%
c2 " $"%
.ixed netlist
c1 5 33%
c2 " $"%
r'og%s " 9e12
The :bogus value of < Tera*ohms provides a .( current path to (; !and around (4" without
substantially impacting the circuit+s operation.
Current measurement
3lthough printing or plotting of voltage is uite easy in #'I(), the output of current values is a
bit more difficult. ?oltage measurements are specified by declaring the appropriate circuit nodes.
For example, if we desire to know the voltage across a capacitor whose leads connect between
nodes N and >, we might make out .print statement look like this8
c1 $ " 22%
.print ac v($9")
%owever, if we wanted to have #'I() measure the current through that capacitor, it wouldn+t be
uite so easy. (urrents in #'I() must be specified in relation to a voltage source, not any
arbitrary component. For example8
c1 $ " 22%
vinp%t $ ac 1 sin
.print ac i(vinp%t)
This .print card instructs #'I() to print the current through voltage source ?input, which
happens to be the same as the current through our capacitor between nodes N and >. -ut what if
there is no such voltage source in our circuit to reference for current measurementD 2ne solution
is to insert a shunt resistor into the circuit and measure voltage across it. In this case, I have
chosen a shunt resistance value of ; J to produce ; volt per amp of current through (;8
c1 $ " 22%
rs2%nt $ 1
.print ac v(9$)
%owever, the insertion of an extra resistance into our circuit large enough to drop a meaningful
voltage for the intended range of current might adversely affect things. 3 better solution for
#'I() is this, although one would never seek such a current measurement solution in real life8
c1 $ " 22%
v'og%s $ dc 0
.print ac i(v'og%s)
Inserting a $bogus$ .( voltage source of zero volts doesn+t affect circuit operation at all, yet it
provides a convenient place for #'I() to take a current measurement. Interestingly enough, it
doesn+t matter that ?bogus is a .( source when we+re looking to measure 3( current& The fact that
#'I() will output an 3( current reading is determined by the $ac$ specification in the .print
card and nothing more.
It should also be noted that the way #'I() assigns a polarity to current measurements is a bit
odd. Take the following circuit as an example8
example
v1 1 0
r1 1 2 5k
r2 2 0 5k
.dc v1 10 10 1
.print dc i(v1)
.end
,ith ;= volts total voltage and ;= kJ total resistance, you might expect #'I() to tell you there+s
going to be ; m3 !;e*=C" of current through voltage source ?;, but in actuality #'I() will output
a figure of ne$ative ; m3 !*;e*=C"& #'I() regards current out of the negative end of a .(
voltage source !the normal direction" to be a negative value of current rather than a positive
value of current. There are times I+ll throw in a $bogus$ voltage source in a .( circuit like this
simply to get #'I() to output a positive current value8
example
v1 1 0
r1 1 2 5k
r2 2 3 5k
v'og%s 3 0 dc 0
.dc v1 10 10 1
.print dc i(v'og%s)
.end
9otice how ?bogus is positioned so that the circuit current will enter its positive side !node C" and
exit its negative side !node =". This orientation will ensure a positive output figure for circuit
current.
Fourier analysis
,hen performing a Fourier !freuency*domain" analysis on a waveform, I have found it
necessary to either print or plot the waveform using the .print or .plot cards, respectively. If
you don+t print or plot it, #'I() will pause for a moment during analysis and then abort the Aob
after outputting the $initial transient solution.$
3lso, when analyzing a suare wave produced by the $p%lse$ source function, you must give the
waveform some finite rise and fall time, or else the Fourier analysis results will be incorrect. For
some reason, a perfect suare wave with zero riseEfall time produces significant levels of even
harmonics according to #'I()+s Fourier analysis option, which is not true for real suare waves.
Eample circuits and netlists
The following circuits are pre*tested netlists for #'I() 4g5, complete with short descriptions
when necessary. Feel free to $copy$ and $paste$ any of the netlists to your own #'I() source file
for analysis andEor modification. 6y goal here is twofold8 to give practical examples of #'I()
netlist design to further understanding of #'I() netlist syntax, and to show how simple and
compact #'I() netlists can be in analyzing simple circuits.
3ll output listings for these examples have been $trimmed$ of extraneous information, giving you
the most succinct presentation of the #'I() output as possible. I do this primarily to save space
on this document. Typical #'I() outputs contain lots of headers and summary information not
necessarily germane to the task at hand. #o don+t be surprised when you run a simulation on
your own and find that the output doesn+t e#actly look like what I have shown here&
Multiple-source DC resistor network part !
,ithout a .dc card and a .print or .plot card, the output for this netlist will only display
voltages for nodes ;, 4, and C !with reference to node =, of course".
0etlist&
:%ltiple dc so%rces
v1 1 0 dc 2$
v2 3 0 dc 15
r1 1 2 10k
r2 2 3 !.1k
r3 2 0 $."k
.end
(utput&
node voltage node voltage node voltage
( 1) 2$.0000 ( 2) 9."$"0 ( 3) 15.0000
voltage so%rce c%rrents
name c%rrent
v1 *1.$25E*03
v2 *.$!5E*0$
total po+er dissipation $.39E*02 +atts
Multiple-source DC resistor network part "
-y adding a .dc analysis card and specifying source ?; from 4N volts to 4N volts in ; step !in
other words, 4N volts steady", we can use the .print card analysis to print out voltages
between any two points we desire. 2ddly enough, when the .dc analysis option is invoked, the
default voltage printouts for each node !to ground" disappears, so we end up having to explicitly
specify them in the .print card to see them at all.
0etlist&
:%ltiple dc so%rces
v1 1 0
v2 3 0 15
r1 1 2 10k
r2 2 3 !.1k
r3 2 0 $."k
.dc v1 2$ 2$ 1
.print dc v(1) v(2) v(3) v(192) v(293)
.end
(utput&
v1 v(1) v(2) v(3) v(192) v(293)
2.$00E401 2.$00E401 9."$"E400 1.500E401 1.$25E401 *5.253E400
#C time-constant circuit
For .( analysis, the initial conditions of any reactive component !( or 7" must be specified
!voltage for capacitors, current for inductors". This is provided by the last data field of each
capacitor card !ic&0". To perform a .( analysis, the .tran !$transient$" analysis option must be
specified, with the first data field specifying time increment in seconds, the second specifying
total analysis timespan in seconds, and the $%ic$ telling it to $use initial conditions$ when
analyzing.
0etlist&
-; time dela6 circ%it
v1 1 0 dc 10
c1 1 2 $"% ic&0
c2 1 2 22% ic&0
r1 2 0 3.3k
.tran .05 1 %ic
.print tran v(192)
.end
(utput&
time v(192)
0.000E400 "."01E*0
5.000E*02 1.9"E400
1.000E*01 3.551E400
1.500E*01 $.!2$E400
2.000E*01 5.!$$E400
2.500E*01 .$E400
3.000E*01 ".322E400
3.500E*01 ".!51E400
$.000E*01 !.2"$E400
$.500E*01 !.15E400
5.000E*01 !.!!!E400
5.500E*01 9.10"E400
.000E*01 9.2!3E400
.500E*01 9.$25E400
".000E*01 9.53!E400
".500E*01 9.29E400
!.000E*01 9."02E400
!.500E*01 9."1E400
9.000E*01 9.!0!E400
9.500E*01 9.!$E400
1.000E400 9.!""E400
Plotting and analy$ing a simple AC sinewave voltage
This exercise does show the proper setup for plotting instantaneous values of a sine*wave
voltage source with the .plot function !as a transient analysis". 9ot surprisingly, the Fourier
analysis in this deck also reuires the .tran !transient" analysis option to be specified over a
suitable time range. The time range in this particular deck allows for a Fourier analysis with
rather poor accuracy. The more cycles of the fundamental freuency that the transient analysis is
performed over, the more precise the Fourier analysis will be. This is not a uirk of #'I(), but
rather a basic principle of waveforms.
0etlist&
v1 1 0 sin(0 15 0 0 0)
rload 1 0 10k
* c2ange tran card to t2e .ollo+ing .or 'etter <o%rier precision
* .tran 1m 30m .01m and incl%de .options card#
* .options itl5&30000
.tran 1m 30m
.plot tran v(1)
..o%r 0 v(1)
.end
(utput&
time v(1) *2.000E401 *1.000E401 0.000E400 1.000E401
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 0.000E400 . . * . .
1.000E*03 5.$!"E400 . . . * . .
2.000E*03 1.025E401 . . . * .
3.000E*03 1.350E401 . . . . * .
$.000E*03 1.$!!E401 . . . . *.
5.000E*03 1.$25E401 . . . . * .
.000E*03 1.150E401 . . . . * .
".000E*03 ".1!$E400 . . . * . .
!.000E*03 1.!"9E400 . . . * . .
9.000E*03 *3."1$E400 . . * . . .
1.000E*02 *!."2E400 . . * . . .
1.100E*02 *1.25E401 . * . . . .
1.200E*02 *1.$E401 . * . . . .
1.300E*02 *1.$5E401 . * . . . .
1.$00E*02 *1.25E401 . * . . . .
1.500E*02 *!."9E400 . . * . . .
1.00E*02 *3."09E400 . . * . . .
1."00E*02 1.!"E400 . . . * . .
1.!00E*02 ".191E400 . . . * . .
1.900E*02 1.1$9E401 . . . . * .
2.000E*02 1.$25E401 . . . . * .
2.100E*02 1.$!9E401 . . . . *.
2.200E*02 1.3$9E401 . . . . * .
2.300E*02 1.02E401 . . . * .
2.$00E*02 5.$91E400 . . . * . .
2.500E*02 1.553E*03 . . * . .
2.00E*02 *5.51$E400 . . * . . .
2."00E*02 *1.022E401 . * . . .
2.!00E*02 *1.3$9E401 . * . . . .
2.900E*02 *1.$95E401 . * . . . .
3.000E*02 *1.$2"E401 . * . . . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
.o%rier components o. transient response v(1)
dc component & *1.!!5E*03
2armonic .re3%enc6 .o%rier normali=ed p2ase normali=ed
no (2=) component component (deg) p2ase (deg)
1 .000E401 1.$9$E401 1.000000 *"1.99! 0.000
2 1.200E402 1.!!E*02 0.00122 *50.12 21.!3
3 1.!00E402 1.3$E*03 0.000090 102."$ 1"$."1
$ 2.$00E402 1."99E*02 0.00120$ *10.! 1.132
5 3.000E402 3.0$E*03 0.0002$1 10.923 232.921
3.00E402 5.$2E*03 0.0003"! *1".2$" *10$.250
" $.200E402 2.095E*03 0.0001$0 122.1 19$.5!
! $.!00E402 $.5"$E*03 0.00030 *1$3."5$ *"1."5"
9 5.$00E402 $.!9E*03 0.00032! *129.$1! *5".$20
total 2armonic distortion & 0.1!350 percent
Simple AC resistor-capacitor circuit
The .ac card specifies the points of ac analysis from 5=%z to 5=%z, at a single point. This card,
of course, is a bit more useful for multi*freuency analysis, where a range of freuencies can be
analyzed in steps. The .print card outputs the 3( voltage between nodes ; and 4, and the 3(
voltage between node 4 and ground.
0etlist&
>emo o. a simple 7; circ%it
v1 1 0 ac 12 sin
r1 1 2 30
c1 2 0 100%
.ac lin 1 0 0
.print ac v(192) v(2)
.end
(utput&
.re3 v(192) v(2)
.000E401 !.990E400 ".9$9E400
%ow-pass &lter
This low*pass filter blocks 3( and passes .( to the :load resistor. Typical of a filter used to
suppress ripple from a rectifier circuit, it actually has a resonant freuency, technically making it
a band*pass filter. %owever, it works well anyway to pass .( and block the high*freuency
harmonics generated by the 3(*to*.( rectification process. Its performance is measured with an
3( source sweeping from @== %z to ;@ k%z. If desired, the .print card can be substituted or
supplemented with a .plot card to show 3( voltage at node N graphically.
0etlist&
?o+pass .ilter
v1 2 1 ac 2$ sin
v2 1 0 dc 2$
rload $ 0 1k
l1 2 3 100m
l2 3 $ 250m
c1 3 0 100%
.ac lin 30 500 15k
.print ac v($)
.plot ac v($)
.end
.re3 v($)
5.000E402 1.935E*01
1.000E403 3.2"5E*02
1.500E403 1.05"E*02
2.000E403 $.1$E*03
2.500E403 2.$02E*03
3.000E403 1.$03E*03
3.500E403 !.!!$E*0$
$.000E403 5.9"3E*0$
$.500E403 $.20E*0$
5.000E403 3.0"2E*0$
5.500E403 2.311E*0$
.000E403 1."!2E*0$
.500E403 1.$03E*0$
".000E403 1.12$E*0$
".500E403 9.1$1E*05
!.000E403 ".53E*05
!.500E403 .2!5E*05
9.000E403 5.29E*05
9.500E403 $.50$E*05
1.000E40$ 3.!3E*05
1.050E40$ 3.33"E*05
1.100E40$ 2.903E*05
1.150E40$ 2.5$1E*05
1.200E40$ 2.23"E*05
1.250E40$ 1.9"9E*05
1.300E40$ 1."0E*05
1.350E40$ 1.5"1E*05
1.$00E40$ 1.$09E*05
1.$50E40$ 1.2!E*05
1.500E40$ 1.1$E*05
.re3 v($) 1.000E*0 1.000E*0$ 1.000E*02 1.000E400
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5.000E402 1.935E*01 . . . * .
1.000E403 3.2"5E*02 . . . * .
1.500E403 1.05"E*02 . . * .
2.000E403 $.1$E*03 . . * . .
2.500E403 2.$02E*03 . . * . .
3.000E403 1.$03E*03 . . * . .
3.500E403 !.!!$E*0$ . . * . .
$.000E403 5.9"3E*0$ . . * . .
$.500E403 $.20E*0$ . . * . .
5.000E403 3.0"2E*0$ . . * . .
5.500E403 2.311E*0$ . . * . .
.000E403 1."!2E*0$ . . * . .
.500E403 1.$03E*0$ . .* . .
".000E403 1.12$E*0$ . * . .
".500E403 9.1$1E*05 . * . .
!.000E403 ".53E*05 . *. . .
!.500E403 .2!5E*05 . *. . .
9.000E403 5.29E*05 . * . . .
9.500E403 $.50$E*05 . * . . .
1.000E40$ 3.!3E*05 . * . . .
1.050E40$ 3.33"E*05 . * . . .
1.100E40$ 2.903E*05 . * . . .
1.150E40$ 2.5$1E*05 . * . . .
1.200E40$ 2.23"E*05 . * . . .
1.250E40$ 1.9"9E*05 . * . . .
1.300E40$ 1."0E*05 . * . . .
1.350E40$ 1.5"1E*05 . * . . .
1.$00E40$ 1.$09E*05 . * . . .
1.$50E40$ 1.2!E*05 . * . . .
1.500E40$ 1.1$E*05 . * . . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Multiple-source AC network
2ne of the idiosyncrasies of #'I() is its inability to handle any loop in a circuit exclusively
composed of series voltage sources and inductors. Therefore, the $loop$ of ?;*7;*74*?4*?; is
unacceptable. To get around this, I had to insert a low*resistance resistor somewhere in that loop
to break it up. Thus, we have :bogus between C and N !with ; pico*ohm of resistance", and ?4
between N and =. The circuit above is the original design, while the circuit below has :bogus
inserted to avoid the #'I() error.
0etlist&
:%ltiple ac so%rce
v1 1 0 ac 55 0 sin
v2 $ 0 ac $3 25 sin
l1 1 2 $50m
c1 2 0 330%
l2 2 3 150m
r'og%s 3 $ 1e*12
.ac lin 1 30 30
.print ac v(2)
.end
(utput&
.re3 v(2)
3.000E401 1.$13E402
AC phase shi't demonstration
The currents through each leg are indicated by the voltage drops across each respective shunt
resistor !; amp M ; volt through ; J", output by the v(192) and v(193) terms of the .print
card. The phase of the currents through each leg are indicated by the phase of the voltage drops
across each respective shunt resistor, output by the vp(192) and vp(193) terms in the .print
card.
0etlist&
p2ase s2i.t
v1 1 0 ac $ sin
rs2%nt1 1 2 1
rs2%nt2 1 3 1
l1 2 0 1
r1 3 0 .3k
.ac lin 1 1000 1000
.print ac v(192) v(193) vp(192) vp(193)
.end
(utput&
.re3 v(192) v(193) vp(192) vp(193)
1.000E403 .3E*0$ .3$9E*0$ *9.000E401 0.000E400
(rans'ormer circuit
#'I() understands transformers as a set of mutually coupled inductors. Thus, to simulate a
transformer in #'I(), you must specify the primary and secondary windings as separate
inductors, then instruct #'I() to link them together with a $k$ card specifying the coupling
constant. For ideal transformer simulation, the coupling constant would be unity !;". %owever,
#'I() can+t handle this value, so we use something like =.<<< as the coupling factor.
9ote that all winding inductor pairs must be coupled with their own k cards in order for the
simulation to work properly. For a two*winding transformer, a single k card will suffice. For a
three*winding transformer, three k cards must be specified !to link 7; with 74, 74 with 7C, and 7;
with 7C".
The 7;E74 inductance ratio of ;==8; provides a ;=8; step*down voltage transformation ratio. ,ith
;4= volts in we should see ;4 volts out of the 74 winding. The 7;E7C inductance ratio of ;==84@
!N8;" provides a 48; step*down voltage transformation ratio, which should give us 5= volts out of
the 7C winding with ;4= volts in.
0etlist&
trans.ormer
v1 1 0 ac 120 sin
r'og%s0 1 1e*3
l1 0 100
l2 2 $ 1
l3 3 5 25
k1 l1 l2 0.999
k2 l2 l3 0.999
k3 l1 l3 0.999
r1 2 $ 1000
r2 3 5 1000
r'og%s1 5 0 1e10
r'og%s2 $ 0 1e10
.ac lin 1 0 0
.print ac v(190) v(290) v(390)
.end
(utput&
.re3 v(1) v(2) v(3)
.000E401 1.200E402 1.199E401 5.993E401
In this example, :bogus= is a very low*value resistor, serving to break up the sourceEinductor loop
of ?;E7;. :bogus; and :bogus4 are very high*value resistors necessary to provide .( paths to ground
on each of the isolated circuits. 9ote as well that one side of the primary circuit is directly
grounded. ,ithout these ground references, #'I() will produce errors&
Full-wave bridge recti&er
.iodes, like all semiconductor components in #'I(), must be modeled so that #'I() knows all
the nitty*gritty details of how they+re supposed to work. Fortunately, #'I() comes with a few
generic models, and the diode is the most basic. 9otice the .model card which simply specifies
$d$ as the generic diode model for mod1. 3gain, since we+re plotting the waveforms here, we
need to specify all parameters of the 3( source in a single card and printEplot all values using the
.tran option.
0etlist&
.%ll+ave 'ridge recti.ier
v1 1 0 sin(0 15 0 0 0)
rload 1 0 10k
d1 1 2 mod1
d2 0 2 mod1
d3 3 1 mod1
d$ 3 0 mod1
.model mod1 d
.tran .5m 25m
.plot tran v(190) v(293)
.end
(utput&
legend#
*# v(1)
4# v(293)
time v(1)
(*)********* *2.000E401 *1.000E401 0.000E400 1.000E401 2.000E401
(4)********* *5.000E400 0.000E400 5.000E400 1.000E401 1.500E401
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 0.000E400 . 4 * . .
5.000E*0$ 2.!0E400 . . 4 . * . .
1.000E*03 5.$!3E400 . . 4 * . .
1.500E*03 ".929E400 . . . 4 * . .
2.000E*03 1.013E401 . . . 4* .
2.500E*03 1.19!E401 . . . . * 4 .
3.000E*03 1.33!E401 . . . . * 4 .
3.500E*03 1.$35E401 . . . . * 4.
$.000E*03 1.$"E401 . . . . * 4
$.500E*03 1.$"0E401 . . . . * 4
5.000E*03 1.$0E401 . . . . * 4 .
5.500E*03 1.299E401 . . . . * 4 .
.000E*03 1.139E401 . . . . *4 .
.500E*03 9.$55E400 . . . 4 *. .
".000E*03 ".113E400 . . . 4 * . .
".500E*03 $.591E400 . . 4. * . .
!.000E*03 1.!$1E400 . . 4 . * . .
!.500E*03 *9.1""E*01 . . 4 *. . .
9.000E*03 *3.!9E400 . . *4 . . .
9.500E*03 *.3!0E400 . . * . 4 . .
1.000E*02 *!."!$E400 . . * . 4 . .
1.050E*02 *1.0"5E401 . *. . .4 .
1.100E*02 *1.255E401 . * . . . 4 .
1.150E*02 *1.3"2E401 . * . . . 4 .
1.200E*02 *1.$0E401 . * . . . 4
1.250E*02 *1.$"E401 .* . . . 4
1.300E*02 *1.$0E401 . * . . . 4
1.350E*02 *1.3"3E401 . * . . . 4 .
1.$00E*02 *1.25$E401 . * . . . 4 .
1.$50E*02 *1.0""E401 . *. . .4 .
1.500E*02 *!."2E400 . . * . 4 . .
1.550E*02 *.293E400 . . * . 4 . .
1.00E*02 *3.!$E400 . . x . . .
1.50E*02 *9.31E*01 . . 4 *. . .
1."00E*02 1.!"5E400 . . 4 . * . .
1."50E*02 $.552E400 . . 4. * . .
1.!00E*02 ".1"0E400 . . . 4 * . .
1.!50E*02 9.$01E400 . . . 4 *. .
1.900E*02 1.1$E401 . . . . *4 .
1.950E*02 1.293E401 . . . . * 4 .
2.000E*02 1.$1$E401 . . . . * 4.
2.050E*02 1.$$E401 . . . . * 4
2.100E*02 1.$!3E401 . . . . * 4
2.150E*02 1.$30E401 . . . . * 4.
2.200E*02 1.3$$E401 . . . . * 4 .
2.250E*02 1.195E401 . . . . *4 .
2.300E*02 1.01E401 . . . 4* .
2.350E*02 ".91"E400 . . . 4 * . .
2.$00E*02 5.$0E400 . . 4 * . .
2.$50E*02 2.!09E400 . . 4 . * . .
2.500E*02 *!.29"E*0$ . 4 * . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Common-base )*( transistor ampli&er
This analysis sweeps the input voltage !?in" from = to @ volts in =.; volt increments, then prints
out the voltage between the collector and emitter leads of the transistor v!4,C". The transistor
!S;" is an 9'9 with a forward -eta of @=.
0etlist&
;ommon*'ase @AB ampli.ier
vs%ppl6 1 0 dc 2$
vin 0 $ dc
rc 1 2 !00
re 3 $ 100
31 2 0 3 mod1
.model mod1 npn '.&50
.dc vin 0 5 0.1
.print dc v(293)
.plot dc v(293)
.end
(utput&
vin v(293)
0.000E400 2.$00E401
1.000E*01 2.$10E401
2.000E*01 2.$20E401
3.000E*01 2.$30E401
$.000E*01 2.$$0E401
5.000E*01 2.$50E401
.000E*01 2.$0E401
".000E*01 2.$E401
!.000E*01 2.$39E401
9.000E*01 2.3!3E401
1.000E400 2.31"E401
1.100E400 2.2$E401
1.200E400 2.1"$E401
1.300E400 2.101E401
1.$00E400 2.02E401
1.500E400 1.951E401
1.00E400 1.!"E401
1."00E400 1.!00E401
1.!00E400 1."2$E401
1.900E400 1.$!E401
2.000E400 1.5"2E401
2.100E400 1.$95E401
2.200E400 1.$1!E401
2.300E400 1.3$2E401
2.$00E400 1.25E401
2.500E400 1.1!!E401
2.00E400 1.110E401
2."00E400 1.033E401
2.!00E400 9.50E400
2.900E400 !."!"E400
3.000E400 !.01$E400
3.100E400 ".2$0E400
3.200E400 .$5E400
3.300E400 5.91E400
3.$00E400 $.915E400
3.500E400 $.1$0E400
3.00E400 3.3$E400
3."00E400 2.5!!E400
3.!00E400 1.!11E400
3.900E400 1.03$E400
$.000E400 2.5!"E*01
$.100E400 9."$$E*02
$.200E400 ".!15E*02
$.300E400 .!0E*02
$.$00E400 .1$1E*02
$.500E400 5.5"E*02
$.00E400 5.2!1E*02
$."00E400 $.9!1E*02
$.!00E400 $."3$E*02
$.900E400 $.525E*02
5.000E400 $.3$E*02
vin v(293) 0.000E400 1.000E401 2.000E401 3.000E401
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 2.$00E401 . . . * .
1.000E*01 2.$10E401 . . . * .
2.000E*01 2.$20E401 . . . * .
3.000E*01 2.$30E401 . . . * .
$.000E*01 2.$$0E401 . . . * .
5.000E*01 2.$50E401 . . . * .
.000E*01 2.$0E401 . . . * .
".000E*01 2.$E401 . . . * .
!.000E*01 2.$39E401 . . . * .
9.000E*01 2.3!3E401 . . . * .
1.000E400 2.31"E401 . . . * .
1.100E400 2.2$E401 . . . * .
1.200E400 2.1"$E401 . . . * .
1.300E400 2.101E401 . . .* .
1.$00E400 2.02E401 . . * .
1.500E400 1.951E401 . . *. .
1.00E400 1.!"E401 . . * . .
1."00E400 1.!00E401 . . * . .
1.!00E400 1."2$E401 . . * . .
1.900E400 1.$!E401 . . * . .
2.000E400 1.5"2E401 . . * . .
2.100E400 1.$95E401 . . * . .
2.200E400 1.$1!E401 . . * . .
2.300E400 1.3$2E401 . . * . .
2.$00E400 1.25E401 . . * . .
2.500E400 1.1!!E401 . . * . .
2.00E400 1.110E401 . . * . .
2."00E400 1.033E401 . * . .
2.!00E400 9.50E400 . *. . .
2.900E400 !."!"E400 . * . . .
3.000E400 !.01$E400 . * . . .
3.100E400 ".2$0E400 . * . . .
3.200E400 .$5E400 . * . . .
3.300E400 5.91E400 . * . . .
3.$00E400 $.915E400 . * . . .
3.500E400 $.1$0E400 . * . . .
3.00E400 3.3$E400 . * . . .
3."00E400 2.5!!E400 . * . . .
3.!00E400 1.!11E400 . * . . .
3.900E400 1.03$E400 .* . . .
$.000E400 2.5!"E*01 * . . .
$.100E400 9."$$E*02 * . . .
$.200E400 ".!15E*02 * . . .
$.300E400 .!0E*02 * . . .
$.$00E400 .1$1E*02 * . . .
$.500E400 5.5"E*02 * . . .
$.00E400 5.2!1E*02 * . . .
$."00E400 $.9!1E*02 * . . .
$.!00E400 $."3$E*02 * . . .
$.900E400 $.525E*02 * . . .
5.000E400 $.3$E*02 * . . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Common-source *F+( ampli&er with sel'-bias
0etlist&
common so%rce ,.et ampli.ier
vin 1 0 sin(0 1 0 0 0)
vdd 3 0 dc 20
rdrain 3 2 10k
rso%rce $ 0 1k
,1 2 1 $ mod1
.model mod1 n,.
.tran 1m 30m
.plot tran v(290) v(190)
.end
(utput&
legend#
*# v(2)
4# v(1)
time v(2)
(*)********* 1.$00E401 1.00E401 1.!00E401 2.000E401 2.200E401
(4)********* *1.000E400 *5.000E*01 0.000E400 5.000E*01 1.000E400
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 1."0!E401 . . * 4 . .
1.000E*03 1.09E401 . .* . 4 . .
2.000E*03 1.51E401 . * . . . 4 .
3.000E*03 1.$$!E401 . * . . . 4 .
$.000E*03 1.$19E401 .* . . . 4
5.000E*03 1.$32E401 . * . . . 4.
.000E*03 1.$90E401 . * . . . 4 .
".000E*03 1.5""E401 . * . . 4. .
!.000E*03 1."E401 . . * . 4 . .
9.000E*03 1."!E401 . . 4 *. . .
1.000E*02 1.!$1E401 . 4 . . * . .
1.100E*02 1.!90E401 . 4 . . * . .
1.200E*02 1.912E401 .4 . . * . .
1.300E*02 1.912E401 .4 . . * . .
1.$00E*02 1.!90E401 . 4 . . * . .
1.500E*02 1.!$2E401 . 4 . . * . .
1.00E*02 1."!E401 . . 4 *. . .
1."00E*02 1."E401 . . * . 4 . .
1.!00E*02 1.5""E401 . * . . 4. .
1.900E*02 1.$91E401 . * . . . 4 .
2.000E*02 1.$32E401 . * . . . 4.
2.100E*02 1.$19E401 .* . . . 4
2.200E*02 1.$$9E401 . * . . . 4 .
2.300E*02 1.51E401 . * . . . 4 .
2.$00E*02 1.09E401 . .* . 4 . .
2.500E*02 1."0!E401 . . * 4 . .
2.00E*02 1."9E401 . . 4 * . .
2."00E*02 1.!1E401 . 4 . . * . .
2.!00E*02 1.900E401 . 4 . . * . .
2.900E*02 1.91E401 4 . . * . .
3.000E*02 1.90!E401 .4 . . * . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
,nverting op-amp circuit
To simulate an ideal operational amplifier in #'I(), we use a voltage*dependent voltage source
as a differential amplifier with extremely high gain. The $e$ card sets up the dependent voltage
source with four nodes, C and = for voltage output, and ; and = for voltage input. 9o power
supply is needed for the dependent voltage source, unlike a real operational amplifier. The
voltage gain is set at <<<,=== in this case. The input voltage source !?;" sweeps from = to C.@
volts in =.=@ volt steps.
0etlist&
Cnverting opamp
v1 2 0 dc
e 3 0 0 1 999k
r1 3 1 3.29k
r2 1 2 1.1!k
.dc v1 0 3.5 0.05
.print dc v(390)
.end
(utput&
v1 v(3)
0.000E400 0.000E400
5.000E*02 *1.39$E*01
1.000E*01 *2."!!E*01
1.500E*01 *$.1!2E*01
2.000E*01 *5.5"E*01
2.500E*01 *.9"0E*01
3.000E*01 *!.3$E*01
3.500E*01 *9."5!E*01
$.000E*01 *1.115E400
$.500E*01 *1.255E400
5.000E*01 *1.39$E400
5.500E*01 *1.533E400
.000E*01 *1."3E400
.500E*01 *1.!12E400
".000E*01 *1.952E400
".500E*01 *2.091E400
!.000E*01 *2.231E400
!.500E*01 *2.3"0E400
9.000E*01 *2.509E400
9.500E*01 *2.$9E400
1.000E400 *2."!!E400
1.050E400 *2.92!E400
1.100E400 *3.0"E400
1.150E400 *3.20E400
1.200E400 *3.3$E400
1.250E400 *3.$!5E400
1.300E400 *3.25E400
1.350E400 *3."$E400
1.$00E400 *3.903E400
1.$50E400 *$.0$3E400
1.500E400 *$.1!2E400
1.550E400 *$.322E400
1.00E400 *$.$1E400
1.50E400 *$.00E400
1."00E400 *$."$0E400
1."50E400 *$.!"9E400
1.!00E400 *5.019E400
1.!50E400 *5.15!E400
1.900E400 *5.29"E400
1.950E400 *5.$3"E400
2.000E400 *5.5"E400
2.050E400 *5."1E400
2.100E400 *5.!55E400
2.150E400 *5.99$E400
2.200E400 *.13$E400
2.250E400 *.2"3E400
2.300E400 *.$13E400
2.350E400 *.552E400
2.$00E400 *.92E400
2.$50E400 *.!31E400
2.500E400 *.9"0E400
2.550E400 *".110E400
2.00E400 *".2$9E400
2.50E400 *".3!9E400
2."00E400 *".52!E400
2."50E400 *"."E400
2.!00E400 *".!0"E400
2.!50E400 *".9$E400
2.900E400 *!.0!E400
2.950E400 *!.225E400
3.000E400 *!.3$E400
3.050E400 *!.50$E400
3.100E400 *!.$3E400
3.150E400 *!."!3E400
3.200E400 *!.922E400
3.250E400 *9.01E400
3.300E400 *9.201E400
3.350E400 *9.3$0E400
3.$00E400 *9.$!0E400
3.$50E400 *9.19E400
3.500E400 *9."5!E400
-oninverting op-amp circuit
3nother example of a #'I() uirk8 since the dependent voltage source $e$ isn+t considered a
load to voltage source ?;, #'I() interprets ?; to be open*circuited and will refuse to analyze it.
The fix is to connect :bogus in parallel with ?; to act as a .( load. -eing directly connected across
?;, the resistance of :bogus is not crucial to the operation of the circuit, so ;= kJ will work fine. I
decided not to sweep the ?; input voltage at all in this circuit for the sake of keeping the netlist
and output listing simple.
0etlist&
noninverting opamp
v1 2 0 dc 5
r'og%s 2 0 10k
e 3 0 2 1 999k
r1 3 1 20k
r2 1 0 10k
.end
(utput&
node voltage node voltage node voltage
( 1) 5.0000 ( 2) 5.0000 ( 3) 15.0000
,nstrumentation ampli&er
9ote the very high*resistance :bogus; and :bogus4 resistors in the netlist !not shown in schematic for
brevity" across each input voltage source, to keep #'I() from thinking ?; and ?4 were open*
circuited, Aust like the other op*amp circuit examples.
0etlist&
Cnstr%mentation ampli.ier
v1 1 0
r'og%s1 1 0 9e12
v2 $ 0 dc 5
r'og%s2 $ 0 9e12
e1 3 0 1 2 999k
e2 0 $ 5 999k
e3 9 0 ! " 999k
rload 9 0 10k
r1 2 3 10k
rgain 2 5 10k
r2 5 10k
r3 3 " 10k
r$ " 9 10k
r5 ! 10k
r ! 0 10k
.dc v1 0 10 1
.print dc v(9) v(39)
.end
(utput&
v1 v(9) v(39)
0.000E400 1.500E401 *1.500E401
1.000E400 1.200E401 *1.200E401
2.000E400 9.000E400 *9.000E400
3.000E400 .000E400 *.000E400
$.000E400 3.000E400 *3.000E400
5.000E400 9.955E*11 *9.95E*11
.000E400 *3.000E400 3.000E400
".000E400 *.000E400 .000E400
!.000E400 *9.000E400 9.000E400
9.000E400 *1.200E401 1.200E401
1.000E401 *1.500E401 1.500E401
.p-amp integrator with sinewave input
0etlist&
Cntegrator +it2 sine+ave inp%t
vin 1 0 sin (0 15 0 0 0)
r1 1 2 10k
c1 2 3 150% ic&0
e 3 0 0 2 999k
.tran 1m 30m %ic
.plot tran v(190) v(390)
.end
(utput&
legend#
*# v(1)
4# v(3)
time v(1)
(*)******** *2.000E401 *1.000E401 0.000E400 1.000E401
(4)******** *.000E*02 *$.000E*02 *2.000E*02 0.000E400
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 .53E*0! . . * 4 .
1.000E*03 5.51E400 . . . * 4. .
2.000E*03 1.021E401 . . . 4 * .
3.000E*03 1.350E401 . . . 4 . * .
$.000E*03 1.$95E401 . . 4 . . *.
5.000E*03 1.$1!E401 . . 4 . . * .
.000E*03 1.150E401 . 4 . . . * .
".000E*03 ".21$E400 . 4 . . * . .
!.000E*03 1.!"E400 .4 . . * . .
9.000E*03 *3."09E400 . 4 . * . . .
1.000E*02 *!.!05E400 . 4 . * . . .
1.100E*02 *1.259E401 . * 4 . . .
1.200E*02 *1.$E401 . * . 4 . . .
1.300E*02 *1.$"1E401 . * . 4. . .
1.$00E*02 *1.259E401 . * . . 4 . .
1.500E*02 *!.""$E400 . . * . 4 . .
1.00E*02 *3."23E400 . . * . 4. .
1."00E*02 1.!"0E400 . . . * 4 .
1.!00E*02 ".1!!E400 . . . * 4 . .
1.900E*02 1.15$E401 . . . 4 . * .
2.000E*02 1.$1!E401 . . .4 . * .
2.100E*02 1.$90E401 . . 4 . . *.
2.200E*02 1.355E401 . . 4 . . * .
2.300E*02 1.020E401 . 4 . . * .
2.$00E*02 5.$9E400 . 4 . . * . .
2.500E*02 *1.$!E*03 .4 . * . .
2.00E*02 *5.$!9E400 . 4 . * . . .
2."00E*02 *1.021E401 . 4 * . . .
2.!00E*02 *1.355E401 . * . 4 . . .
2.900E*02 *1.$!!E401 . * . 4 . . .
3.000E*02 *1.$2"E401 . * . .4 . .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
.p-amp integrator with s/uarewave input
0etlist&
Cntegrator +it2 s3%are+ave inp%t
vin 1 0 p%lse (*1 1 0 0 0 10m 20m)
r1 1 2 1k
c1 2 3 150% ic&0
e 3 0 0 2 999k
.tran 1m 50m %ic
.plot tran v(190) v(390)
.end
(utput&
legend#
*# v(1)
4# v(3)
time v(1)
(*)******** *1.000E400 *5.000E*01 0.000E400 5.000E*01 1.000E400
(4)******** *1.000E*01 *5.000E*02 0.000E400 5.000E*02 1.000E*01
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0.000E400 *1.000E400 * . 4 . .
1.000E*03 1.000E400 . . 4 . *
2.000E*03 1.000E400 . . 4 . . *
3.000E*03 1.000E400 . . 4 . . *
$.000E*03 1.000E400 . . 4 . . *
5.000E*03 1.000E400 . . 4 . . *
.000E*03 1.000E400 . . 4 . . *
".000E*03 1.000E400 . . 4 . . *
!.000E*03 1.000E400 . .4 . . *
9.000E*03 1.000E400 . 4. . . *
1.000E*02 1.000E400 . 4 . . . *
1.100E*02 1.000E400 . 4 . . . *
1.200E*02 *1.000E400 * 4 . . . .
1.300E*02 *1.000E400 * 4 . . . .
1.$00E*02 *1.000E400 * 4. . . .
1.500E*02 *1.000E400 * .4 . . .
1.00E*02 *1.000E400 * . 4 . . .
1."00E*02 *1.000E400 * . 4 . . .
1.!00E*02 *1.000E400 * . 4 . . .
1.900E*02 *1.000E400 * . 4 . . .
2.000E*02 *1.000E400 * . 4 . . .
2.100E*02 1.000E400 . . 4 . . *
2.200E*02 1.000E400 . . 4 . . *
2.300E*02 1.000E400 . . 4 . . *
2.$00E*02 1.000E400 . . 4 . . *
2.500E*02 1.000E400 . . 4 . . *
2.00E*02 1.000E400 . .4 . . *
2."00E*02 1.000E400 . 4. . . *
2.!00E*02 1.000E400 . 4 . . . *
2.900E*02 1.000E400 . 4 . . . *
3.000E*02 1.000E400 . 4 . . . *
3.100E*02 1.000E400 . 4 . . . *
3.200E*02 *1.000E400 * 4 . . . .
3.300E*02 *1.000E400 * 4 . . . .
3.$00E*02 *1.000E400 * 4 . . . .
3.500E*02 *1.000E400 * 4 . . . .
3.00E*02 *1.000E400 * 4. . . .
3."00E*02 *1.000E400 * .4 . . .
3.!00E*02 *1.000E400 * . 4 . . .
3.900E*02 *1.000E400 * . 4 . . .
$.000E*02 *1.000E400 * . 4 . . .
$.100E*02 1.000E400 . . 4 . . *
$.200E*02 1.000E400 . . 4 . . *
$.300E*02 1.000E400 . . 4 . . *
$.$00E*02 1.000E400 . .4 . . *
$.500E*02 1.000E400 . 4. . . *
$.00E*02 1.000E400 . 4 . . . *
$."00E*02 1.000E400 . 4 . . . *
$.!00E*02 1.000E400 . 4 . . . *
$.900E*02 1.000E400 . 4 . . . *
5.000E*02 1.000E400 4 . . . *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Potrebbero piacerti anche