Edy wrote:
> I'm trying to program shooting-method with Newton
> and/or harmonic balance method for calculation of
> periodic steady state of nonlinear circuits in NGSPICE.
> Some (more) help would be nice. Is there someone
> with a good knowledge about ngspice and C programming?
> Have you something of this already done? Is it work?

How about doing it for gnucap instead?

A while back I started to look ito it for gnucap.  It doesn't 
look too hard, but you need to understand how it works first.

As a first cut, which is easy to do manually in gnucap, run a 
transient analysis with relaxed tolerance for a few cycles 
until it appears to reach steady state.  To see this, run it, 
run it again, until it settles down.  Then tighten the 
tolerances and pick the exact fundamental frequency, and run a 
fourier analysis.  Then tweek the frequency and run the fourier 
analysis again.  If it is close enough to the same and you 
didn't change the frequency, you really have the steady state.  

This is approximately what the shooting method does.  Automating 
this would be a good start, but slow.  Gnucap actually lets you 
do this as I described.  NGspice will fight you.  

In gnucap, I am guessing it would take about 20 lines of code to 
add an option to the fourier command to do this automatically.

In ngspice, you will need a real Fourier transform, and the 
ability to do repeat runs, with changes between them in such as 
way as to not start over every time.  You will also need to 
find a way to synchronize the data points with the Fourier 
points, otherwise you will see what appears to be a high noise 
floor, even if your frequencies are perfectly matched.  Also, I  
question whether the step size control is capable of getting 
acceptable accuracy.  You may need to completely replace the 
time step control code.  

The best book to read is by Ken Kundert "Steady State Methods 
for Simulating Analog and Microwave Circuits".  Mine is dated 
1990.  He may have a new edition.  It well written and 
complete, but not as well written as some of his more recent 
works, which are really excellent.  The book discusses some 
supposedly more efficient algorithms, including harmonic 
balance and mixed frequency-time methods.

There's another book by Jan Ogrodzki "Circuit Simulation Methods 
and Algorithms" 1994.  This one is perhaps the most complete 
book on simulation, if you define completeness as hitting 
everything, but clarity, consistency, and depth are issues.   
It is hard to determine what you really need to know, vs what 
can be deferred.  There is nothing on harmonic balance.  The 
treatment of shooting methods shows algorithms, with detail 
that is really just the transient analysis algorithm repeated.  
It would be nice if he would just call known algorithms, or 
reference and change, but he repeats instead.


_______________________________________________
geda-user mailing list
geda-user@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

Reply via email to