gnucap-devel
[Top][All Lists]

## [Gnucap-devel] Rethinking multi-dimensional "Kneechord" nonlinear conver

 From: Telford Tendys Subject: [Gnucap-devel] Rethinking multi-dimensional "Kneechord" nonlinear convergence Date: Mon, 22 Nov 2004 19:51:45 +1100 User-agent: Mutt/1.2.5i

```I emailed some ideas earlier but now I've had time to think about it
there seems to be an easy extension of the "kneechord" algorithm for
higher dimensional components (in particular 3 pin components like
transistors).

Let's set the scene by taking a BJT and presume that the emitter
is at ground (so there are 2 non-ground nodes available).
Now we can set the voltage arbitrarily on those two non-ground nodes
(base and collector) thus there are two independent variables
Vb and Vc. Once those voltages are set, the current through those
pins will be determined by the device (looking at steady-state
behaviour only). So there are two dependent variables.

[ Ib Ic ] = f( [ Vb Vc ])

Which is a two-dimensional function (two inputs, two outputs).
Our objective is to find a local slope of that function which will
work as a good approximation of the nonlinear equation in the region
around our operating point. This slope will be in the form of a 2x2
matrix.

My idea is this: wrap the 3 pin component inside a 2 pin component
where one of the Vb or Vc is constant while the other is the input
and the output is only one of Ib or Ic. Thus the two-dimensional
function is reduced down to a one-dimensional function but it still
evaluates the same set of nonlinear equations. The kneechord algorithm
can be applied to this wrapper component and it will find a single

Now comes the special bit.

There are four different wrapper designs:
input Vb, hold Vc constant, output Ib
input Vb, hold Vc constant, output Ic
input Vc, hold Vb constant, output Ib
input Vc, hold Vb constant, output Ic

These give four resulting gradients which build the four elements of
the 2x2 matrix needed to approximate the slope of the two-dimensional
function. Voila... there are your matrix parameters!

I'm fairly sure this theory is sound... now, the issue of applying
it to gnucap. I've concluded that attempting to apply it to the BJT
or MOSFET as a whole is hopeless because those devices are broken down
into sub-components and there are internal nodes and other stuff that
would be too hard to deal with.

The only multi-dimensional element that I can find that seems to be
a suitable candidate is the DEV_CPOLY_G so I would have to make a
wrapper element that took a DEV_CPOLY_G and some parameters to control
which input/output combo of the admittance was exposed. Then just
step through all the possible combos and insert each matrix parameter.

I still have a problem with this idea... the BJT and MOSFET models
seem to update a lot of stuff when they re-evaluate so just evaluating
the DEV_CPOLY_G probably won't do the correct calculations, or is there
some automagical link that causes the device to update? What I'm thinking
here is that I have to apply the algorithm to the low level object because
that's the only place it makes sense but the nonlinearity comes from the
high level object so that's what needs evaluation. How to tie this together
neatly?

I kind of wish there was a map or something, I get very drained from
walking through the gnucap code because to understand any bit you also
have to understand all the other bits. I don't feel brave enough to
write documentation because I have no confidence in my own understanding.
Well at any rate, I have the abstract theory straight in my head and
I don't think it is a difficult thing to implement, if it can integrate
with the existing codebase.

By the way, are there any examples of circuits where the nonlinear
convergence of the BJT or MOSFET models is difficult? I mean, something
to look at and decide where improvements could be made...

P.S. I've got a bit of spare time until the new year so if there is
documtation to be written or some other project that might help me learn
my way round the code a bit better, this might be a good time to make
some suggestions.

- Tel

```