Re: [ng-spice] ngspice as library of functions ?


To ng-spice@ieee.ing.uniroma1.it
From Erik de Castro Lopo <erikd@zip.com.au>
Date Sun, 23 Apr 2000 23:57:28 +0000
CC berkan@cogs.susx.ac.uk
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
Organization Erik Conspiracy Secret Labs
References <20000423163633.A541@cogs.susx.ac.uk >
Reply-To ng-spice@ieee.ing.uniroma1.it
Sender erikd@zip.com.au

Berkan Eskikaya wrote:
> 
> 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.)

Hi Berkan,

I am a relative newcomer to the current (ng)spice code base. However, 
from what I've seen, I don't think turning the current code into a
library would be at all easy. The spice code base is huge and
rather convoluted.

You might have better luck getting this request into the new code
base which people are working on. Unfortunately, I don't think
this will be ready any time soon. 

At the moment your best bet would be to communicate with spice
via a pipe or fifo.

Hope this helps,
Erik
-- 
+-------------------------------------------------+
     Erik de Castro Lopo     erikd@zip.com.au
+-------------------------------------------------+
"Two hands working can do more than a thousand clasped in prayer." 
-- anonymous

Partial thread listing: