previous | back | home | next |
CACD Group updated 2000.03.30 Author Janez Puhan |
Getting startedLet us consider a simple transistor amplifier shown on figure below. First we have to describe the circuit in a*.cir file.
The circuit netlist can be put together with some schematic editor
or it can be written in a text editor. The netlist of the simple amplifier
is as follows:
When the netlist of the circuit is written (in our case the
c:\spiceopus\amplifier.cir file) the circuit
can be simulated. Run Spice Opus by clicking
Spice Opus is waiting for our first command with prompt: Spice Opus 1 -> _ First we have to load the netlist of the circuit into SPICE. We can do this with source command:Spice Opus 1 -> source c:\spice3f4\amplifier.cir Circuit: transistor amplifier Spice Opus 2 -> _ We perform a DC, transient and AC analyses with dc ,
tran and ac command respectively.
The voltage source v2 is swept from 0 to 1V in 5mV
increments in the dc analysis. A transient analysis
from 0 to 200us with a 10kHz sine wave input is performed by
tran command. And the input frequency is swept
from 1kHz to 10MHz with 25 points per decade in ac
analysis:Spice Opus 2 -> dc v2 0 1V 5mV Spice Opus 3 -> tran 1us 200us Spice Opus 4 -> ac dec 25 1kHz 100megHz Spice Opus 5 -> _ The results are saved in a special data structures called plots. Our three analyses just created three new plots. We can change the current plot with a setplot command.
The results of a particular analysis can be plotted by plot command.Spice Opus 5 -> setplot Type the name of the desired plot: new New plot Current ac1 transistor amplifier (AC analysis) tran1 transistor amplifier (Transient analysis) dc1 transistor amplifier (DC transfer characteristic) const Constant values (constants) ? dc1 Spice Opus 6 -> plot v(4) xlabel v(2)[V] ylabel Output[V]
Spice Opus 7 -> setplot tran1 Spice Opus 8 -> plot 10*v(1) v(4) xlabel t[s] ylabel '10*Input, Output [V]' Spice Opus 9 -> setplot ac1 Spice Opus 10 -> _
To plot phase in degrees (not in radians) the Spice Opus 10 -> set units = degrees Spice Opus 11 -> plot vdb(4) vp(4)
Spice Opus 12 -> _
The discontinuity can be eliminated with defining a new vector
called Spice Opus 12 -> let phase = vp(4) / 10 - 36 * (vp(4) gt 0) Spice Opus 13 -> plot vdb(4) phase xlabel f[Hz] ylabel 'Magnitude[dB], Phase[deg]' Spice Opus 14 -> _
At the end we will delete all plots and free memory
with Spice Opus 14 -> destroy all Spice Opus 15 -> quit Spice-3f4 done |
previous | back | home | next |