Loop stability analysis for Ngspice

A loop stability analysis is introduced in ngspice. It use the "General Feedback Theorem" proposed by Prof. R. D. Middlebrook, in a modified formulation proposed by Frank Wiedmann.

Download and Compilation

git clone git://git.code.sf.net/p/ngspice/ngspice
cd ngspice
git checkout loop_analysis
mkdir build-loop
cd build-loop
../configure --enable-loopana CFLAGS="-O3 -march=native"
make
./src/ngspice ../example/loop/vreg.cir

Usage

A voltage source probe is added in the circuit somewhere along the feedback loop to analyze. Note that the operating point found by the simulator is undisturbed as the added probe don't change anything in the circuit characteristics. The AC loading at each side of the probe is automatically taken into account for the loop analysis which give accurate results.

The direction of the probe is important. If the loop is analyzed in the wrong direction, the gain will most probably be very small and no stability information can be extracted.

Syntax

General form:

.loop <probe> dec/oct/lin <nd> <fstart> <fstop> <param>=<value> ...

Examples

.loop vprobe DEC 10 1 10e9
.loop M2/Gate DEC 10 1 10e9 insrc="Vin" outpos="out" outneg="vcc" dir=-1
.loop M2 DEC 10 1 10e9 portname="Gate"