Greg's DOWNLOAD page.
|
SPICE
This is the celebrated nonlinear circuit simulator from Berkeley. BSpice.exe is the simulator. Nutmeg.exe is used to display the output file from spice. The other files included here are from the examples directory. You can buy the printed manuals direct from Berkeley. The "User's Manual" only costs about $5.00 plus shipping. If you are serious about using the simulator, it is a "must have". They will also sell you a copy of the source code if you want it. The contact info follows:
email: software@eecs.berkeley.edu ftp: ilpsoft.eecs.berkeley.edu phone: 510 643 6687
Software Distribution Office industrial Liason Program 205 Corey Hall #1770 University of California at Berkeley Berkeley Ca. 94720-1770
There are four help files included here, spice.0, spice.1, nutmeg.0, and nutmeg.1. These are oriented toward the interactive UNIX version (explanation comming)
If you are not at all familiar with Spice, and refuse to buy the manuals from Berkely, I will give you enough information here to get started.
First of all, SPICE is written to run on a UNIX maching, and it had to be cropped a bit to make it fit into DOS. The UNIX version is interactive. The DOS version "BSPICE" is a batch mode program. That means you generate a circuit file then run BSPICE, and give it the name of the circuit file as a command line parameter. For instance, use the example circuit RC.CIR. type {BSPICE RC.CIR}. Bspice will run the analysis, and generate an output file called RAWSPICE.RAW. Next, run the program NUTMEG. NUTMEG will read the data in RAWSPICE.RAW. You have to give nutmeg commands at a command line, much like dos. In order to plot the voltage at node 2, type {plot v(2)} in order to list the voltage at node 2, type {list v(2)} You can give expressions in C language syntax for instance {plot 2*vdb(2)} All of the commands are case sensitive. If you use capitals such as "PLOT" NUTMEG will respond with a message telling you that there is no such command.
If you browse the example files, you should be able to figure out the syntax, and write your own circuit files. Start by editing the examples.
Also, browse the file COMMENTS.CIR. This is an example file with lots of comments added to help you figure it out.
If all else fails, break down and buy the user's manual from Berkeley. Below is a partial summary of the commands available in spice.
1.0 TYPES OF ANALYSIS:
DC analysis; Determines the DC operating point of the circuit with inductors shorted, and capacitors open circuited. DC analysis is automatically performed before AC or TRansient analysis.
AC small signal analysis; Computes the response of the circuit as a function of frequency.
TRansient analysis; Computes the response of the circuit as a function of time.
Pole Zero analysis; Computes the poles and zero's of the circuit's transfer function.
Small signal distortion analysis; computes steady state HARMONIC and INTERMODULATION products for circuits operating under small signal conditions. (not highly distorting conditions)
Sensitivity analysis; Computes the sensitivity of an output variable to changes in all input variable.
Noise analysis; Calcultes total noise voltage or current over a given frequency range.
2.0 CIRCUIT DESCRIPTION
2.1 GENERAL STRUCTURE AND CONVENTIONS:
The circuit to be analyzed is described to SPICE by a set of element lines, which defing the circuit topology and element values, and a set of control lines which define the model parameters and the run controls. The first line in the input file must be the title, and the last line must be ".end"
Each element in the circuit is specified by an element line that contains the element name, the circuit nodes to which the element is connected, and the values of the paramenters that determine the electrical characteristics of the element. The first letter of the element name specifies the element type. Each element must have a unique element name such as R1, R2, R3... If you just name all of the resistors R, the simulator will think they are all the same part, and an error will result. a resistor could be named R1, Res, Rout or whatever you like as long as it begins with the letter R.
Element names must begin with a letter. number fields can be integer (2, 27) floating point (3.23, 78.8) or a floating point followed by an exponent (1e-6, 4e3). {4e3 = 4000} The following scale factors can also be used: T=10^12 G=10^9 Meg=10^6 K=10^3 m=10^-3 u=10^-6 n=10^-9 p=10^-12 f=10^-15
Letters immediately following a number which are not a scale factor are ignored. Hence 10, 10V, 10Volts and 10Hz all represent the same number (10).
Nodes may be named by arbitrary character strings, but to keep life simple, I reccomend that you name them 1, 2, 3, etc. The ground node must be named 0. Note that 0 and 00 are different nodes in spice 3 since they are evaluated as character strings. In spice 2 and previous versions, the node names were evaluated as numbers.
Each node in the circuit must have at least two connections, and each must have a DC path to ground.
2.2 TITLE LINE, COMMENT LINES, AND .END LINE
TITLE LINE; the title line must be the first line in the input file. It's contents are printed as the heading for each section of output .
.END line; The .END line must be the last line in the input file. Note that the period is an integral part of the name.
Comments; An asterisk in the first column indicates that a line is a comment. The simulator ignores it. Spice 3 also considers any line with leading white space a comment.
2.3 DEVICE MODELS:
GENERAL FORM; .MODEL MNAME TYPE(PNAME1=PVALU1 PNAME2=PVAL2 ...) EXAMPLE; .MODEL MOD1 NPN(BF=50 IS=1E-13 VBF=50)
2.4 SUBCIRCUITS: A subcircuit is a group of elements connected together which can be defined and refered to in a way similar to device models. The program automatically inserts the group of elements wherever the subcircuit is referenced.
SUBCKT LINE:
GENERAL FORM;
.SUBCKT subname N1
The last line in a subcircuit definition is always the .ENDS line.
.ENDS
The subname is only needed when subcircuits are nested. (subcircuits which contain
other subcircuits)
SUBCIRCUIT CALLS;
GENERAL FORM:
XYYYYYYY N1
Subcircuits are used in SPICE by specifying pseudo-elements beginning with the letter X,
followed by the circuit nodes to be used in expandng the subcircuit.
3.0 CIRCUIT ELEMENTS AND MODELS
Data fields enclosed in <> characters are optional.
Punctuation shown here is reccomended, not necessarialy manditory.
Branch voltages and currents follow the associated reference convention
(current flows in the direction of voltage drop)
3.1 ELEMENTARY DEVICES
RESISTORS:
GENERAL FORM;
RXXXX N1 N2 VALUE
EXAMPLES;
R1 1 2 100 (100 0HMS, CONNECTED BETWEEN NODES 1 AND 2)
RC1 12 17 1K
Value may be positive or negative, but never zero.
CAPACITORS:
GENERAL FORM;
CXXXX N+ N- VALUE
INDUCTORS:
GENERAL FORM;
LYYYYY N+ N- VALUE
COUPLED (MUTUAL) INDUCTORS
GENERAL FORM;
KXXXXX LYYYYY LZZZZZ VALUE
EXAMPLES;
K43 LAA LBB 0.999
KXFMR L1 L2 0.87
LYYYYY AND LZZZZZ ARE THE NAMES OF THE COUPLED INDUCTORS. VALUE IS THE COEFFICIENT OF COUPLING
BETWEEN THE TWO INDUCTORS. k MUST BE GREATER THAN 0 AND LESS THAN 1. USING THE DOT CONVENTION,
PLACE A DOT AT THE FIRST NODE OF EACH INDUCTOR. OBVIOUSLY, THE INDUCTORS THEMSELVES MUST
BE DEFINED SOMEWHERE IN THE CIRCUIT. KXXXXX JUST SPECIFIES THE COUPLING BETWEEN THEM.
3.2 VOLTAGE AND CURRENT SOURCES
INDEPENDENT SOURCES
GENERAL FORM;
VXXXXX N+ N- <
EXAMPLES;
VCC 10 0 DC 6
VIN 13 2 0.001 AC 1 SIN(0 1 1MEG)
ISRC 23 211 AC 0.333 45.0 SFFM(0 1 10K 5 1K)
VMEAS 12 9
VCARRIER 1 0 DISTOF1 0.1 -90
DC/TRAN is the DC and transient analysis value of the source.
ACMAG is the AC magnitude and ACPHASE is the AC phase. The source is set to this value
for the AC analysis . If ACMAG is ommited following the keyword AC, a value of unity
is assumed.
PULSE:
GENERAL FORM;
PULSE (V1 V2 TD TR TF PW PER)
EXAMPLE:
VIN 3 0 PULES (-1 1 2NS 2NS 2NS 50NS 100NS)
PARAMETER DEFAULT UNITS
V1 VOLTS OR AMPS
V2 VOLTS OR AMPS
TD (TIME DELAY) 0 SECONDS
TR(RISETIME) TSTEP SECONDS
TF(FALLTIME) TSTEP SECONDS
PW(PULSE WIDTH) TSTOP SECONDS
PER(PERIOD) TSTOP SECONDS
SINUSOIDAL
GENERAL FORM;
SIN(VO VA FREQ TD THETA)
EXAMPLE;
VIN 3 0 SIN(0 1 100MEG 1NS 1E10)
PARAMETERS DEFAULT UNITS
VO(OFFSET) VOLTS OR AMPS
VA(AMPLITUDE) VOLTS OR AMPS
FREQ 1/TSTOP Hz
TD(DELAY) 0 SECONDS
THETA(DAMPING FACTOR) 0 1/SECONDS
EXPOTENTIAL
GENERAL FORM;
EXP(V1 V2 TD1 TAU1 TD2 TAU2)
EXAMPLE;
VIN 3 0 EXP(-4 -1 2NS 30NS 60NS 40NS)
TRANSMISSION LINES
GENERAL FORM
TXXXXXX N1 N2 N3 N4 ZO=VALUE
JUNCTION DIODES:
GENERAL FORM;
DXXXXX N+ N- MNAME
BIPOLAR JUNCTION TRANSISTOR:
GENERAL FORM:
QXXX NC NB NE
NC, NB, AND NE ARE THE THE NODES OF THE BASE, EMITTER, AND COLLECTOR. NS IS THE OPTIONAL
SUBSTRATE NODE. MNAME IS THE MODEL NAME.
THERE ARE PLENTY OF TRANSISTOR TYPES AND MODELS, AND THEY WILL NOT BE COVERED HERE.
YOU CAN EITHER BORROW THE MODELS USED IN THE EXAMPLE FILES, OR GET A COPY OF THE
MANUAL. GENERALLY, YOU WILL WANT TO GET SPICE MODELS OF REAL DEVICES FROM THE
MANUFACTURER.
4.0 ANALYSES
.AC SMALL SIGNAL AC ANALYSIS
GENERAL FROM:
.AC DEC ND FSTART FSTOP
.AC OCT NO FSTART FSTOP
.AC LIN NP FSTART FSTOP
EXAMPLES:
.AC DEC 10 1 10K
.AC DEC 10 1K 100MEG
.AC LIN 100 1 100Hz
DEC stands for decade variation. ND stands for the number of points per decade.
OCT stands for octave variation. NO is the number of points per octave.
LIN stands for linear variation and NP is the number of points. FSTART AND FSTOP
are the frquencies at which analysis starts and stops.
.DC DC TRANSFER FUNCTION:
GENERAL FORM;
.DC SRCNAM VSTART VSTOP VINCR [SRC2 START2 STOP2 INCR2]
EXAMPLES;
.DC VIN 0.25 5.0 .25
.DC VDS 0 10 .5 VGS 0 5 1
.DC VCE 0 10 .25 IB 0 10U 1U
.DISTO; DISTORTION ANALYSIS
GENERAL FORM;
.DISTO DEC ND FSTART FSTOP
.DISTO OCT NO FSTART FSTOP
.DISTO LIN NP FSTART FSTOP
EXAMPLES;
.DISTO DEC 10 1KHz 100 MHz
.DISTO DEC 10 1KHz 100 MHz
The number of points, start and stop frequencies follow the same conventions as the
AC analysis.
.NOISE NOISE ANALYSIS
GENERAL FORM;
.NOISE V(OUTPUT<,REF>) SRC (DEC|LIN|OCT) PTS FSTART FSTOP
OUTPUT is the node at which total output noise is desired. SRC is the name of an
independent source to which noise is referred. PTS, FSTART, and FSTOP follow the
same convention as the AC analysis.
.PZ
GENERAL FORM:
.PZ NODE1 NODE2 NODE3 NODE4 CUR POL
.PZ NODE1 NODE2 NODE3 NODE4 CUR ZER
.PZ NODE1 NODE2 NODE3 NODE4 CUR PZ
.PZ NODE1 NODE2 NODE3 NODE4 VOL POL
.PZ NODE1 NODE2 NODE3 NODE4 VOL ZER
.PZ NODE1 NODE2 NODE3 NODE4 VOL PZ
EXAMPLES;
.PZ 1 0 3 0 CUR POL
.PZ 2 3 5 0 VOL POL
.PZ 4 1 4 1 CUR PZ
CUR stands for a transfer function of the type (current out / current in)
VOL stands for a transfer function of the type (voltage out / voltage in)
POL means find the poles of the transfer function.
ZER means find the zeroes of the transfer function.
pz means find both poles and zeroes.
.TRAN TRANSIENT ANALYSIS
GENERAL FORM;
.TRAN TSTEP TSTOP
TSTEP is the printing or plotting increment for line printer output, and also the
suggested computing increment. TSTOP is the final time, and TSTART is the initial time.
If tstart is ommited, it is assumed to be zero.
NUTMEG COMMANDS:::
WHEN RUNNING NUTMEG TO VIEW THE SIMULATION RESULTS, USE THE FOLLOWING COMMANDS.
plot(NODE)
print(node)
The help files "nutmeg.0" and "nutmeg.1" will explain these commands fully.
Remember to use lower case letters!! NUTMEG will not respond to commands
typed in capitals.
HOME
HOME