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.
This is a very nice feature of gnucap.
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.
-Dan
_______________________________________________ geda-user mailing list geda-user@xxxxxxxxxxxxxx http://www.seul.org/cgi-bin/mailman/listinfo/geda-user