Monday, January 11, 2010

Spice circuit simulator

I'm learning electrical engineering... Pretty tough to understand this stuff, but really helps. Another tool I'm trying to use is a spice simulator. This way I can write tiny circuits and see if I understand what they're supposed to do, and spice can verify that.

Anyhow, I started searching for spice, and that was a bit of a challenge just because of it's name... Google doesn't bring you to what you're looking for directly, so here's a good starting point: - Homepage - List of available spice simulators

OK. So which one to download. I like to work as manually as possible to increase my understanding as much as possible, so this meant I wanted a tool that was as much like the UNIX version (I'm on Windows) as possible. I also want a text based tool for now. This led me to download Berkeley's spice3f5.tar.gz, and to figure out how to compile this with Visual C++ 2008. A good starting point is I did some things differently from what he listed, but I believe his directions will work too. A tip would be to use GnuWin32's find, xargs, and sed tools to perform the necessary changes to the files. Also when following the /OUT: directions you have to add that line to only the files he listed, otherwise the lib files won't get added correctly. I chose a more generic method of modifying the batch files with something like this in the relevant msc51.bat files:
set LIBNAME=..\..\dev1.lib
if not exist %LIBNAME% set LIBPARAM=/OUT:
lib %LIBPARAM%%LIBNAME% @response.lib >> ..\..\..\msc.out

... After getting it to compile I realize that it doesn't create spice3.exe, and only really creates bspice.exe and cspice.exe. I don't currently know much about spice so I don't really know what those files do for you, but from what I can see they aren't what I was looking for.

At this point I started looking for another alternative. I found ngspice: The download page is I know it says that they only release sources, but that's not true, download the zip file and you'll see it has Windows binaries. I'm guessing that they never bothered to update that information.

Last thing... Seems that spice uses something referred to as decks (input decks). Trouble is no one bothers to tell you what that is. I am once again positing that this term comes from very old systems that accepted commands on actual cards. Each command was put on a card and the cards were fed into a machine. The combined cards were referred to as decks. I found a reference to cards and decks here: So an input deck seems to just be a set of input commands.

Will update as I learn more. At this point I'm still just a fish flapping around on dry land with regards to spice.

No comments:

Post a Comment