negative terminal of the battery,
towards positive, and passes through
resistor R1 last. Also, Kirchhoff’s
second rule: The directed sum of the
electrical potential differences around
any closed circuit must be zero.
Finally, we get a taste of how SPICE
data is presented. For most hobby
applications, the number precision
and terse formatting can be a bit of a
turn-off, but don’t give up as it will
soon become second nature!
We can place our own labels on
Nets, using the Label Net tool as we
will see in NV_SPICE_ 12.as c, which
should be loaded after closing the
results window and saving your first
simulation results. I’ve also swapped
the battery symbol for the pure
voltage generator symbol — a more
popular SPICE graphic. For clarification, I’ve shown the battery internal
resistance as an extra resistor (R1) and
added all three load resistors at once
(see Figure 5). Run the simulation and
save your results. Take a look at them
in Figure 6. Notice the resistor’s values
are in decades ( 10, 100, 1000), and
the corresponding currents are also in
decades.
■ FIGURE 5. Schematic for
NV_SPICE_ 12.as c.
wrong as the values are all
zero! What this tells us is
that the SPICE operating
point — or initial conditions — have no circuit
voltage and indeed all the
Nodes are zero volts. We
need to trigger the waveform generator and let
SPICE do a time sweep of
the circuit while the generator is running, and this
uses a different simulation
type. Let’s take a shortcut
and just tell SPICE what to
run, as the toolbar process
to get there is a bit lengthy.
Using the cut
command, remove the
SPICE directive .op text
from the schematic. Next,
using the SPICE directive
command found on the far right of the
toolbar, enter the text .tran 100m and
place it on the schematic. Anywhere
will work, but I like to put these on a
line under the ground symbol so
they’re easy to find later. Run the
simulation and see that the screen
now looks like Figure 9. If it’s not
formatted, hit Tile Windows. The
simulation has run and the graphical
results window is visible; we just need
to request SPICE to fill in the graph
traces of interest to us. Click the Pick
Visible Traces toolbar button and
select the V(pulsegen) Node; hit OK
to create the graph shown in Figure
10. At this point, it might help to
expand the plot window to full screen
using the Maximize button
in the top right-hand corner of the plot window.
—- Operating Point —-
V(voltagegen):
V(battery):
I(R4):
I(R3):
I(R2):
I(R1):
I(V1):
9 voltage
8.10081 voltage
-0.810081 device_current
-0.0810081 device_current
-0.00810081 device_current
-0.89919 device_current
-0.89919 device_current
■ FIGURE 6. Results table for
NV_SPICE_ 12.as c.
Understanding The
Simulation Results
Taking The Circuit’s
Pulse
The last exercise for this session is
to replace the SPICE “battery” with a
signal generator. In SPICE, we can call
up a simple sine wave generator, a
swept sine wave generator, an impulse
generator (a personal favorite), or a
custom waveform made from
various voltage segments that play out
over time (and which we can also
adjust at will). Loading the schematic
NV_SPICE_ 13.as c, notice the voltage
generator has more text (Figure
7). This is the SPICE directive to
define the waveform from the
generator. I’ve removed the V(pulsegen):
internal resistance and adjusted V(shortcr):
the generator to 10V to make V(equalr):
the math results a bit easier to I(C2):
read. Run the simulation, then I(C1):
look at the results in Figure 8. I(R3):
V(longcr):
I(R4):
Well, something might be I(R2):
■ FIGURE 8. Results table for I(R1):
NV_SPICE_ 13.as c. I(V1):
What do we see? This is the time
sweep of the circuit from zero to 100
milliseconds. During that time, the
pulse generator produced 10 pulses of
1 ms duration and 2 ms rest between
pulses, and then stopped. The pulses
are 10V amplitude and the node
EqualR (with two resistors each of
10K) divides the pulse amplitude in
half (5V). To see both traces at once,
■ FIGURE 7. Schematic for
NV_SPICE_ 13.as c.
—- Operating Point —-
0 voltage
0 voltage
0 voltage
0 voltage
0 device_current
0 device_current
0 device_current
0 device_current
0 device_current
0 device_current
0 device_current
December 2008 55