[comp.sys.mac.apps] Analog and Digital Circuit Analysis Programs

siegman@sierra.STANFORD.EDU (siegman) (02/16/91)

ANALOG AND DIGITAL CIRCUIT ANALYSI PROGRAMS FOR THE MACINTOSH

[These opinions are posted by Professor A. E. Siegman, E. L. Ginzton
Laboratory MC-4085, Stanford University, Stanford CA 94305.  Email
responses directed to siegman@sierra.stanford.edu on Internet or
RW.AAP@STANFORD on Bitnet will be welcomed.]

                              -----

Messages keep appearing on Mac newsgroups asking about analog and
digital circuit analysis programs for the Macintosh.  This is a brief
summary of two digital and two analog circuit analysis programs I know
about, plus three additional programs that may be of interest to
electrical engineers, students, and teachers.

The programs reviewed here are:

  --DigSim and LogiMac: two quite good digital circuit analysis programs
  --IsSPICE and Micro-CAP II: two rather poor analog circuit programs
  --MacFlow: a drawing program said to be good for drawing circuits
  --TLS: A very good wave propagation and transmission line simulator
  --PARAXIA: A package of optics programs from my own lab


DigSim 2.0
**********

DigSim is a shareware program written by Brian Rauchfuss, 8915 N 13th
Avenue, Phoenix AZ 85021 (this is an old address and is probably no
longer valid; information on an updated address would be appreciated).
This program is currently available as version 2.2 in the "app"
section of the info-mac archives at sumex-aim.

This is one of my favorite programs: small, neat, user-friendly, very
Mac-like, and cleverly done.  When you open the program there is a
palette of standard digital components including toggle switches,
LEDs, inverters, and multiple kinds of logic gates and flipflops
displayed at the side of the screen.  Using the mouse pointer (which
neatly turns into a soldering iron) you can click and drag these
elements out onto the screen and wire them up into a digital logic
circuit of any complexity you wish.

Multiple wires can be connected to the "solder points" on each
element, and neat "square-corner" layout of the wires between any two
circuit elements is taken care of automatically by the program.  A
menu selection allows you to turn the mouse pointer from a soldering
iron into a pair of wire clippers, which you can use to cut away any
wires or elements you want to remove.

As soon as the circuit is wired up you can use the mouse to switch any
of the toggle switches in the circuit ON or OFF; and by connecting
LEDs to any points of interst in the circuit you can watch the
resulting logic values at these points switch HIGH or LOW. As an
example, if you want to demonstrate one of DeMorgan's theorems, you
just wire up a pair of switches so that they drive the inputs to both
forms of the logic statements appearing on opposite sides of the
theorem, and see visually that for every possible combination of
inputs, the LED responses at the outputs of the two circuits are the
same.

In addition, you can open a simulation window which will display the
input and output waveforms versus time at multiple selected points in
the circuit, just as they would be seen on a multi-beam oscilloscope.
You can draw arbitrary binary waveforms for each input point using the
mouse, and then see what the outputs will be at other points, with a
choice of times scales for the horizontal axis.  There is even a small
fixed logic delay or switching time associated with each element, so
that the effects of gate delay can be envisioned.

Much more complex circuits can of course be wired up and tested, as
well as saved for future use; and in addition multielement circuits
can be saved as "black boxes" with multiple inputs and outputs for use
as building blocks in still more complex circuits.

All in all, this is everything a small educational or demo program
should be. Despite being written in 1986 (or earlier) it seems to run
fine under Multifinder.  I recommend it highly as an "on-screen
digital logic lab" for class demonstrations, student experimentation,
and the like.


LogiMac 1.21 
************

LogiMac is a similar digital circuit analysis program written by Chris
Dewhurst, Capilano Computing, P. O. Box 86971, North Vancouver,
British Columbia , Canada V7L 4P6 (also an old address which may or
may not be valid.).  It was formerly distributed by Kinko's Academic
Courseware Exchange, which is unfortunately defunct.  It is now
available from the Intellimation Library for the Macintosh (see the
TLS description below for the address).

This is also a good program for digital and logic circuit analysis,
perhaps even a little more capable than DigSim. It comes with good
documentation and I give it a very favorable recommendation, though I
like DigSim a little better and therefore have used it much more. This
is primarily because the individual elements in DigSim are visible on
screen in a palette, while in LogiMac the elements are all listed in a
long menu, and you have to pull the menu repeatly to access a new
element to add to the circuit.  Other than that the capabilities of
the two programs are quite similar.

One other problem is that the version 1.21 of LogiMac which I have is
dated 1985 and will not run under Multifinder, at least not on my Mac
II or SE/30.  [On my SE/30 it gives the error message "Invalid Illegal
Instruction: ---- 3000".  Does that imply there can somehow be "Valid
Illegal Instructions" ?!?]  If a new version is or will be available
from Intellimation, perhaps this problem will be solved.


IsSPICE/PSPICE (Mac Classroom Version)
**************************************

IsSPICE/Mac is a commercial version of SPICE for the Macintosh
available from MicroSim Corporatin, 20 Fairbanks, Irvine CA 92718
(714--770-3022 or 800-826-8603) for $95 (no coprocessor version) or
$295 (coprocessor version.)

MicroSim distributes a series of both student and professional
versions of PSPICE for use on a variety of Apollo, DEC, IBM DOS,
Macintosh, OS/2, and Sun machines.  The student version of PSPICE for
the Mac appears to be a pretty complete professional-grade version of
the well-known SPICE program, except it's limited to about 10
transistors and 25 nodes and has a reduced version of the SPICE
library.

Unfortunately, what the program provides is just plain old 1970s-style
SPICE with the same antiquated text file data input and output
methods; no ability to wire up or view circuits as on-screen
schematics; and little or no adaption of the program interface to the
Mac.  You also still have to first run SPICE on the input data file to
carry out the analysis and then run another program, Probe, as a
separate program to view the output waveforms; and the viewing
capabilities and command interface in Probe are pretty primitive by
modern standards.

SPICE itself is of course a powerful, highly developed, and widely
used piece of circuit analysis software.  If you like SPICE itself, or
if you just enjoy running programs with IBM PC interfaces on the Mac,
this will be fine with you.  But if you're looking for a _Macintosh_
circuit analysis program, forget it.

[Could someone make up a HyperCard interface that would let you draw
your circuit and automatically prepare the associated input text file
in HyperCard, then launch SPICE and Probe from HyperCard buttons?
Might be one way to put a Mac interface on this program.]


Micro-CAP II (Student Version)
******************************

This is a student version of an analog-circuit analysis program which
was originally developed (I believe) for the IBM PC world.  It's
available commercially from Spectrum Software, 1021 South Wolfe Road,
Sunnyvale CA 94086 (408-738-4387).  The price is right (around $40);
the general approach is right (you can wire up circuits on screen by
selecting elements from a palette and pointing and clicking on
screen); and if the details were just a little better excecuted, the
whole program would be just right.  Unfortunately it isn't.

As mentioned, the program opens up with a Circuit Window; a Components
Window, i.e., a palette of standard components like RLC elements,
diodes, transistors, batteries, pulsed and sinusoidal time-varying
voltage and current sources, op amps, and so on; and a Library Window
in which one can select or define values for named components.  Using
a slightly awkward approach one can click on an element in the palette
to select it, click in the circuit window to create a copy of the
element there, and then type in a numerical value or a logical name
for the element.

Unfortunately the troubles start right there.  If you want to create a
100 picofarad capacitor, after clicking to position the capacitor you
have to type "100PF" EXACTLY -- not "100 PF" or "100pF" or "100 pf".
The program will accept all of these other inputs, with no indication
of any trouble -- but "100 PF" for example will give you 100 FARADS
instead of 100 picofarads.  Similar complications arise in trying to
assign values to resistances or inductances in ohms, kilohms,
microhenries, and so on: "1K" gives 1 kilohm, but "1 K" doesn't; I
guess it gives 1 ohm. In general neither adequate input error checking
nor the "pico, milli, Mega" concepts of SI have made it into this
program yet.

To keep things interesting if hardly consistent, if you want to put in
a 10-volt battery, you have to click and then type just plain "10",
not "10V" or "10 V" -- neither of which will be accepted at all.

Once a circuit is wired up on screen, you can insert, delete, or
change the value of elements, using the mouse; and then carry out
transient, DC or AC analyses.  

The transient analysis does a time-domain solution with single or
repeated pulsed signal inputs of various kinds.  There are 16
adjustable parameters (time scales, time steps, error criteria, output
voltage points, etc.) for the simulation; these can be edited (in a
rather awkward fashion) in an "edit window" which operates essentially
like a Mac dialog box.  You can then run and display the transient
analysis on screen, displaying 4 separate voltage waveforms versus
time.  The analysis parameters and the output waveforms can also be
printed or dumped to disk files.

The DC analysis finds the DC response of the circuit (which may be
linear or nonlinear) and displays a plot of the output voltage at one
selected node versus the input voltage at another selected node, with
everything else in the circuit held constant.  Again there are
multiple parameters, such as choice of input and output nodes, input
voltage range and step size, and so on, that can be edited; and the
results can be printed or saved.

A third mode is an AC analysis or Bode plot which plots gain in dB,
phase shift in degrees, and group delay in time units versus frequency
for selected input to output points of a circuit.  The frequency axis
is on a log scale with selectable lower and upper frequency values and
frequency steps.

The program also has user-defined waveform generation capabilities and
a Fourier Analyzer module, which I have not explored.

This program has the promise of being very valuable and useful, but
unfortunately the difficulties I mentioned above, plus others I'll
mention below, put me off sufficiently that I stopped trying to make
any substantial use of the program even though I teach an undergrad
intermediate electronics course in which it could be most useful.

My first effort, for example, was to use the MOS transistor model in
the program to wire up an elementary two-transistor enhancement-load
MOSFET logic gate such as we were analysing in class.  Neither the
transient analysis nor the dc input-output characteristics of this
gate were correctly simulated by the program.  In an attempt to
understand this, I set up a simpler circuit just to display one curve
(for one fixed gate voltage) of the IDS versus VDS characteristic
curves of a single MOS transistor.  That didn't come out right either.
A call to the vendor revealed that this can't be avoided, due to some
problem in the MOS dc response related to the way the body of the
MOSFET is handled (though if the manual is to believed this shouldn't
even matter at all).

Playing with other circuits gave somewhat better results; though in
general the numerical simulations using default parameter values
seemed very crude and inaccurate.  Simulating the decay of a simple
RLC circuit, for example, gave transient results hardly recognizable
as a sine wave, and with a very inaccurate value of damping rate.

I imagine the program can probably be made to perform better with
better tuning of the parameters employed in the simulations, though
probably at the cost of considerable slowing down of the calculations.
I'd want to see a much more "bullet proof" and reliable program,
however, before turning something like this loose on inexperienced
students.

Other complaints are that the overall implementation of the Macintosh
interface is awkward and poorly done, and there are many "buggy"
aspects to the program.  The windows lack zoom or go-away boxes, and
the command keys violate Mac interface standards.  A menu command is
supposed to display the node numbers in the on-screen circuit
schematic; it doesn't work on my machines.  You can print the circuit
netlist using a menu command, but not display it on screen or edit it.
The manual tries to be helpful, but is basically inadequate.

The program may or may not be compatible with Multi-Finder; it seems
to encounter different difficulties when I try to run it under MF on
my two different machines.  Sometimes it can't find the required
Library file; when that happens it freezes rather than opening a
SFGetFile dialog box.

All in all, I hope a much better version of this program (at the same
reasonable price) will eventually appear.  According to the vendor a
"Micro-CAP IV" version for the Macintosh is in the works, but won't be
out for some time -- another year at least.  Until then, you might
find this program useful; but I don't recommend it.


MacFlow 3.5
***********

MacFlow is a _drawing_ program, not a circuit analysis program,
available for circa $190 from Mainstay.  I have not tried it myself,
but it has been praised by one reviewer as very suitable for drawing
flow charts, electrical circuits, schematic diagrams, and the like.
It has no circuit analysis capabilities as such, though it has an
application launching capability as mentioned below.

MacFlow features palettes of standard or customizable symbols, such as
electrical circuit elements, which can be selected, re-sized, placed
anywhere on the screen, and connected with lines which can be
right-angle style or curved.  Each symbol and line can be given an
associated text label.  Each symbol can also be associated with an
optional text window for comments, a chart or an application, and the
window or chart can be edited or the application launched by
double-clicking on the symbol.


TLS: Transmission Line Simulator
********************************

TLS is a Transmission Line Simulator program written by Charles Roth,
Jr., of the University of Texas at Austin and distributed by the
Intellimation Library for the Macintosh, P. O. Box 1922, Santa Barbara
CA 93116-1922 (1-800-346-8355).  I have used it in teaching an
undergrad EM theory course, and recommend it enthusiastically.

What you see on the screen with this program is a section of
transmission line which you can terminate with an arbitrary impedance
load at the output end and an arbitrary source impedance at the input
end. You can then launch a wide variety of waveforms -- single pulse,
multiple pulses, sinusoidal tone bursts, CW sinusoidal signals turned
on at t=0 -- from the source end; and watch the voltage and/or current
waveforms on the line move down the line, reflect off the output end,
and continue bouncing back and forth on the line.  You can view either
a kind of dynamic instantaneous display of V(z,t) or I(z,t) versus
time on the line, or a form of integrated display in which a shadowy
echo of earlier curves makes the standing-wave patterns on a line very
visible and graphic.

Extensive capabilities exist to pause the simulation so you can
examine and discuss the instantaneous waveform before continuing; or
you can turn off the input wave and let a pulse or tone burst rattle
back and forth, decaying with time; or you can tune the input CW
sinusoidal signal so that you see the resonant response in a line with
large end reflectivities, or in a laser cavity equivalent.  The loss
in the line itself, the end impedance, and other parameters can be set
or changed during operation in a flexible fashion.

The program interface is a little complicated to learn at first, but
one rapidly becomes comfortable with it.  The numerics of the
simulation seem to be very well thought out, so that the program
always seems to give accurate and reliable results, and to operate
with acceptable speed.

All in all, I find this an excellent, very useful and very well
implemented program, and I recommend it to anyone teaching or studying
transmission theory, waveguides, or EM theory.


PARAXIA
*******

This, finally, is a package of four programs intended for simulating
and analysing laser cavities, optical lensguides and optical beam
propagation (Fresnel and Fraunhofer diffraction) written by research
students in my group.  A brochure describing it is available from
Stanford University's Software Distribution Center, 857 Serra Street
MC-6225, Stanford CA 94305-6225.  Single-copy price is $150 to
academic users and $500 to industrial users

The ABCD program carries out complex-valued ray-matrix and
Hermite-gaussian mode analyses for arbitrary complex-valued paraxial
resonators and lensguides with two separate transverse dimensions,
including astigmatism and misalignment in each individual element.

The FRESNEL program uses FFT and FHT methods to propagate an arbitrary
optical wavefront through any arbitrary paraxial optical system using
Huygens diffraction integral in one rectangular or one radial
transverse coordinate, in either the Fresnel or Fraunhofer domains.  A
combination of scripting capabilities and masking facilities allows
for such things as iterative Fox and Li optical resonator calculations
as well.

The VSOURCE program implements the so-called virtual-source method for
calculating the lowest and higher-order eigenvalues and eigenmodes in
so-called unstable optical resonators with both circular or strip
mirrors over a wide range of Fresnel numbers.

Finally a VRM program carries out some simple mode calculations and
design analyses for gaussian variable-reflectivity-mirror (VRM)
optical resonators.

The outputs from the different programs can be displayed on screen,
printed, exchanged between programs or saved to disk in various
formats, especially including formats which will feed directly into
major Macintosh graphics programs.

These programs are intended primarily for those studying laser beams
and resonators and laser beam propagation; I'll leave it to others to
assess their quality and value.  Note that this package does not
contain any form of the conventional ray-tracing programs, showing
rays propagating through simple lenses and the like.  A number of such
programs are commercially available, however, and would obviously be
of interest for teaching elementary optics.

--Professor A. E. Siegman
--E. L. Ginzton Laboratory
--Stanford University