DEPARTMENT OF ELECTRICAL ENGINEERING
SPICE Example: DC Sweep, and Thevenin Equivalent Circuit
This is an example of a SPICE input file that will calculate the DC Node voltages, the Thevenin Equivalent Circuit and also sweep the input voltage source.
Input file: (the lines starting with a "*" are comment lines and are inserted for clarity only).
* We are interested in finding the following characteristics:
* 1. Node voltages v12, v2 and current i4 when vin=10V
* 2. Thevenin equivalent voltage and resistance, seen
* at the output terminals v(3,0)
* 3. Sweep the input from 0 to 20V in steps of 2V and plot
* the voltages v12, v2, vo and the current i4.
* ------------------------------------------------------
VIN 1 0 DC 10
F1 0 3 VMEAS 0.5
VMEAS 4 0 DC 0
*VMEAS is a 0V source to measure i4
R1 1 2 1K
R2 2 3 10K
R3 1 3 15K
R4 2 4 40K
R5 3 0 50K
.OP
* --------------------------------------------------
* The operating point .OP command will tell Spice
* print all DC node voltages, currents through voltage
* sources and voltages over current sources.
* --------------------------------------------------
.TF V(3,0) VIN
* --------------------------------------------------
* The .TF statement tells Spice to calcuate the ratio of
* Vout/Vin and the resistance seen at the terminals of
* Vout=V(0,3) and Vin (corresponding to the output and
* input resistances). This statement is used to calculate
* the Thevenin equivalent circuit.
* --------------------------------------------------
.DC VIN 0 20 2
* --------------------------------------------------
* The .DC statement instructs Spice to sweep the voltage source
* Vin from 0 to 20 V in steps of 2V.
* --------------------------------------------------
.PLOT DC V(1,2) V(2,4)
.PLOT DC I(VMEAS)
* --------------------------------------------------
* The above Plot statement instruct Spice to plot the
* node voltages and current in the Vmeas voltage source,
* obtained as a results of the DC sweep.
* --------------------------------------------------
.END
The result of the SPICE simulation is given below.
DC Sweep:
a: v(1,2)
b: v(2,4)
volt v(1,2) (ab ) 0. 5.0000 10.0000 15.0000 20.0000 + + + + + 0. 0. -2------+------+------+------+------+------+------+------+- 2.0000 54.507m a b + + + + + + + + 4.0000 109.015m a + b + + + + + + + 6.0000 163.522m a + + b + + + + + + 8.0000 218.029m +a + + +b + + + + + 10.0000 272.537m +a + + + b+ + + + + 12.0000 327.044m +a + + + + b + + + + 14.0000 381.551m +a + + + + + b + + + 16.0000 436.059m +a + + + + + + b + + 18.0000 490.566m +a + + + + + + b + 20.0000 545.073m-+-a----+------+------+------+------+------+------+----b-+- + + + + + volt i(vmeas) (a ) 0. 200.0000u 400.0000u 600.0000u 800.0000u + + + + + 0. 0. -a------+------+------+------+------+------+------+------+- 2.0000 48.637u + a + + + + + + + + 4.0000 97.275u + a + + + + + + + 6.0000 145.912u + + a + + + + + + + 8.0000 194.549u + + a + + + + + + 10.0000 243.187u + + + a + + + + + + 12.0000 291.824u + + + a+ + + + + + 14.0000 340.461u + + + + a + + + + + 16.0000 389.099u + + + + a+ + + + + 18.0000 437.736u + + + + + a + + + + 20.0000 486.373u-+------+------+------+------+-----a+------+------+------+- + + + + +***** operating point status is all simulation time is 0.
node =voltage node =voltage node =voltage
+0:1 = 10.0000 0:2 = 9.7275 0:3 = 9.4340
+0:4 = 0.
**** voltage sources
Currents in Voltage sources:
total voltage source power dissipation= 3.1027m watts
**** current-controlled current sources