Maker Pro
Maker Pro

Developing a Circuit Simulator from Scratch

J

Joel Kolstad

Jan 1, 1970
0
Kevin Aylward said:
I am going to repeat what already has been said. You are simple wasting your
time trying to write a simulater from scratch.

I don't agree with you, Kevin... the course I took teaches, I dunno, 40 or so
students how to write a SPICE simulator every other year by having the
students write their own (and I'm sure there are other such courses around the
country), and I think the average student coming out of that 12-week course
ends up with a much better understanding of how a SPICE simulator works than
someone who just spent 12 weeks examining the source code for SPICE 3f5,
reading Nagels' thesis, etc.
Its way to big a project for one person such that you could produce a
usefull outcome.

Define "useful?" Our final projects were to implement some "interesting"
extension to SPICE, and some of the students chose challenging projects, such
as harmonic balance simulation, "shooting method" simulations, etc. Yes,
obviously the results weren't anything you could start selling commercially,
but in the span of 12 weeks going from knowing nothing about SPICE engines to
being on the verge of being able to write a research paper on some improved
method of simulation that could be implemented commercially or in an
open-source program is pretty impressive, in my book.

Keep in mind that our SPICEs were not very big -- maybe a few thousand lines
at most; I expect commercial SPICEs are tens or hundreds of times larger for
the "core."
Listen er...sonny...these old timers do actually know what is worth
doing...or not...sometimes.

Oh yeah, absolutely. I'm suggesting that, just as many people are made to
design their own op-amps in their EE courses (I took another 12 week course
which was largely about building op-amps, starting from very simple-minded
approaches and ending up with fancy fully-differntial folded-cascode
topologies with specifications that, while not the fastest/lowest power/best
in any particular leading-edge spec, were just as good as many "jellybean"
commercial offerings), designing your own SPICE based on the traditional
methods is a useful exercise.

---Joel
 
A

Andrew Tweddle

Jan 1, 1970
0
Hi,

Can anyone give me some directions on how to develop a circuit
simulator from scratch. I need to develop a simple spice compatible
simulator,that can read in spice netlists. I will be using C++ to code
the simulator. I need to support only simple R,L,C, diode and mosfet
devices and DC,AC and transient analyses. I would be using the Ebbers
- Moll models. The problem is that I could not find any guidelines on
how to actually go about writing a simulator from sctrach. I found
several books that explain the different types of analysis but none of
the books give a frame work to develop a circuit simulator.

I am right now going through "Computer Simulation Of Electronic
Circuits" by R Raghuram and "SPICE2: A Computer Program To Simulate
Semiconductor Circuits" by Laurence W.Nagel. But, these are very old
books and are based on FORTRAN.

If anyone could suggest a website or a book it would be great help.

Thanx,
Balaji.
I went through the exercise of modifying a public domain simulator some
years ago. It took about 5 years of spare time to get 5000 lines added
to a 20000 line program (this was in turbo pascal,) my additions work
but this had simple linear s-parameter internals. (Algorithmically very
fast, unlike SPICE.) Doing the same thing in C++ would be a very
difficult exercise. Their is the ASME (American Society of Mechanical
Engineers) Website

www.asme.org

which has source and executables of various SPICE versions and other
simpler simulators.

Next question is what are you hoping to achieve? SPICE is a kludge of
translated C from fortran which is pretty much unreadable by humans.
Goodluck?

Andrew
 
Top