The public domain SPICE source code was originally written in Fortran. If you look say, in the ASME website you can find the different versions. Later code is C generated from passing this code with additions through a Fortran to C preprocessor. It is almost entirely un-readable IMHO. From this you should be able to answer your various questions. IMHO the stuff should be rewritten (that is the core code) in a more readable format and then made into an open source project. I could suggest using regular expressions to make the parser work a bit better. The matrix solver could be reworked for more performance. Doing this sort of stuff could benefit the whole SPICE community. As it is all modifications seem to be hidden inside commercial software. Improvements like better dealing with RF modelling would then trickle down to the users of the cheap packages. As it is a good RF package runs a bare minimum of $1000US ex. Microwave Office, Eagleware Genesys, Agilent ADS. As it is SPICE class modifications which can do 2D EM modelling would be really cool to add IMHO. This stuff in Microwave Office for IC design runs up to big dollars.

Thanks for the comment Andrew. Yes, I am actually trying to write the MNA in C++ myself. I am writing it as part of a tool I am creating which can predict about simulation. Though it is not a great tool, its just part of my research.

It's part of the solution: Solving an MNA matrix becomes the inner part of a loop that attempts to figure out the correct bias point of all your non-linear devices. From that bias point, you generate an MNA matrix using the linearized equations describing your non-linear device. The "loop" is just Newton-Raphson iteration... applied to the MNA matrix (recall that "regular" Newton-Raphson is a method for solving an arbitrary equation f(x)=y -- which is often non-linear -- using only linear methods).

Hmm... I'm not sure, although I can tell you that in the class I took on circuit simulators, we all wrote our own and it didn't take too long to do so (it was something like... week 1... write the parser for the netlist, week 2 get it to work with DC sources and RLCs, week 3 get it to work with dependent sources and AC, week 4 add a diode and a transistor, week 5 add transient analysis, etc.). You were allowed to use your programming language of choice, and since at the time almost everyone was using C I decided to be different and used "legitimate" object-oriented C++ for mine, although I was sorely tempted to use Matlab instead (the main reason I didn't is because we used the a public-domain sparse matrix package written in C that not only handled all the memory management for you but solved Ax=b as well... nice! ...although Matlab has sparse matrix support built-in, it still would have been a bit more work.)

The class was taught by Dr. Karti Mayaram, who definitely knew what he was talking about (not to mention being a nice guy). Hmm... looks like he's teaching it this quarter as well, here's the web page:

formatting link

. Some of the student projects were quite impressive... I just did some lame circuit modelling stuff, but others implemented fancy things like harmonic balance simulators.

Numbers. Conceptually you can use the symbolic form, but even with a powerful computer algebra system such as the one in Maple or Mathematica, in most cases you won't be able to derive a closed-form solution for anything but trivial circuits.

As I vaguely remember from the class I took, there were other, more recent, algorithms for Non-Linear Equations as well as the standard Newton-Raphson. But it was hard to beat Newton-Raphson for speed and robustness. Though as I understand it has connections to Dynamical Systems and Chaos.

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.