# Wrangling output with MacSPICE?

#### ctishman

Joined Oct 12, 2011
9
Hey, folks

I'm trying to complete the worksheets shown in the e-book, but they seem to refer to an ancient and arcane version of SPICE that:

a) is no longer available anywhere and
b) seems a heck of a lot more helpful than the 3f5 that's current.

For instance, in the book all the instructor has to do is list a voltage source and a resistor and BAM, out pops a page or two with useful info like voltage at various nodes and most importantly, total power dissipation.

Now let's contrast that with what I get out of SPICE 3:

Rich (BB code):
MacSpice 1 -> source Macintosh\ HD:Users:ctishman:Documents:2011:Electrical\ Study:SPICE\ files:circuit3.cir

Circuit: first example circuit

MacSpice 2 ->
Now, after a day or so of banging my head against the usual impenetrable maze of spaghetti-documentation, I managed to cajole it into printing a DC sweep, but there's still no power dissipation and everything's in scientific notation, including the steps between 0 and 100v. Yeah, it's good practice for mental multiplication but GOD is it annoying to try and make anything useful out of a quick scan of a graph.

Does anybody know a way to make this software use fixed-point notation by default, or at least until it gets to very large or small numbers?

#### charles7

Joined Jan 19, 2011
3
You appear to be referring to

which is using SPICE2.6G for its examples. This was a fortran version of Spice released in 1983. At that time circuit simulation was typically performed by feeding punched cards into a mainframe and waiting many hours. One was expected not to waste a second of precious CPU time so by default it produced a dump of everything onto a bail of line-printer paper to study while waiting for the next place in the queue.

So, here is how to make MacSpice (roughly) reproduce this behaviour:

---- Circuit_spice2.src file starts below this line ----
01 My First Circuit
v 1 0 dc 10
r 1 0 5

.options ACCT LIST NODE OPTS NOPAGE
.dc v 0 100 5
.print dc v(1) i(v)
.plot dc i(v)
.control
destroy all
set nomoremode
run
plot v(1)
.endc
.end
---- Circuit_spice2.src file ends above this line ----

By 1989, when Spice 3 came out, most people would have used a terminal such as a VT100 to review the results of simulations. It was also possible to run (small) simulations interactively in a matter of minutes. Since VT220s could only display 24 lines of 132 characters with no scroll-back having large amounts of data spew out by default was counterproductive so, by default Spice 3 does nothing until asked. To get the results you seek using the Spice 3 as nature intended use:

---- Circuit_spice3.src file starts below this line ----
01 My First Circuit
v 1 0 dc 10
r 1 0 5
.end
---- Circuit_spice3.src file ends above this line ----

And then type the following commands at the command line:

MacSpice 18 -> op
MacSpice 19 -> print all
MacSpice 20 -> dc v 0 100 5
MacSpice 21 -> print v(1) i(v)
MacSpice 22 -> plot v(1)
MacSpice 23 -> plot i(v)

etc. These commands can be stored with the netlist between .control/.endc lines, or in a script file.

Something that people sometimes miss with Spice 3 is the automatic calculation of the power dissipation of a circuit which SPICE2 used to produce. The problem is that the SPICE2 method is okay for simple circuits where adding up the the power supplied by every source is what you want. However, many so-called macro models for devices use virtual sources (and other components) as part of the model. These need to be excluded from the calculation. In practice it is easier to identify the sources representing the power supplies, and just sum the reported dissipation for these.

There is a comprehensive set of documentation, tutorials and examples for MacSpice at www.macspice.com. You can also email developer@macspice.com for additional advice and support.

Best regards

Charles