ngspice as library of functions ?


To ng-spice@ieee.ing.uniroma1.it
From Berkan Eskikaya <berkan@cogs.susx.ac.uk>
Date Sun, 23 Apr 2000 16:36:33 +0100
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice@ieee.ing.uniroma1.it
User-Agent Mutt/1.0.1i

Hi,

I've got 2 questions about ngspice:

1) I've just started working on a new project that involves designing
filters (mainly passive) where a variety of circuits are automatically
generated and then analyzed with ngspice.

Although ngspice is a great tool, I'm finding it hard to interface with
my existing code. What would be really convenient is to have a library
interface to the ngspice simulator where a function would accept a circuit
definition, simulate/analyze it, and return the resulting vector as an
array. My understanding is that most of the ngspice code has already been
put into libraries but there is still the main ngspice binary and I don't
know how much of the functionality that I'm interested in is in that
executable.

Basically, I don't need the command interface nor the simulation code for
70-80% percent of the models -- just the core simulator/analyzer and the
functions it would call (mainly for simulating passive filters and doing
transient analyses), in the form of a set of libraries.

Unfortunately, I know next to nothing about the internals of (ng)spice, and
hence have no idea where to start or how feasible the idea is. Is there a
document somewhere explaining what happens in what order during a simulation
so that maybe I can isolate the parts that I need? Even a document about how
a circuit is internally represented in (ng)spice will be of great help at
this stage.

If those on the list who are familiar with the ngspice code could provide
some information as how to create a purely library interface to ngspice, 
I'd be eternally grateful. If you think it would not be that
straight-forward and/or would involve many changes to the code, please 
say that too because that would also help.

(If all fails, I know I can open a FIFO to a running ngspice and feed
netlists to/read data from it that way, but this would definitely slow
things down.)

2) My second question is somewhat more general and less important: because
the circuits will be automatically generated, I was wondering if there is
already a tool that will read a netlist and produce a circuit graph out of
it. I have a good idea about how such a thing can be implemented in short
time (for relatively small/simple circuits anyway) but I thought asking it
here first could prevent code/effort duplication in case such a tool already
exists.

Cheers,

Berkan

Partial thread listing: