User Tools

Site Tools


Translations of this page are also available in the following languages: Русский

Spice POLY Constructs

This is a draft of what I've learned about POLYs. I'm not sure it's completely accurate, so anyone should feel free to make corrections.

Different versions of spice use different methods of modeling non-linear dependent sources, Eg. ASRC, Bxxxx, Exxxx, Gxxxx, Fxxxx, Hxxxx, etc…

Some like NGspice use arbitrary expressions with conditionals, others like GNUcap use polynomials and curve fitting. The POLY function seems to be the least common denominator of these, though Spice3 doesn't support them. Polynomials were the first tool used to approximate non-linear relationships because they are well behaved functions, and spice can easily find the derivative at a point which is used in the numerical solutions. The down side is you have to do some extra work with other tools to get the coefficients for your polynomial description.

Some common problems with polynomial approximations are:

  1. They rapidly become useless outside a limited domain. BSIM models are indeed prone to unphysical behavior at operating points outside the domain of their approximations because they use polynomial adjustments for some computations.
  2. It takes a lot of terms to do a decent approximation of a function whose shape isn't very “polynomial like”.

The other method is to use an arbitrary expression with something like if-then-else functionality or the piece wise linear functions. They are simpler to formulate but incur the risk of discontinuities which can cause serious convergence problems. However they are much more convenient for hacking something together.

A lot of effort has gone into having the best of both worlds. The PWL functions often use small curves to smooth the transition from one derivative to the next. and the expressions using the if-then-else functions are forced to make gradual transitions between different values. In general the libraries use polynomial approximations where they can and constrain them to areas where they are useful. Examples of this in Gnucap are the fit and table statements.

However, if you want to try out your models in other spice versions you'll probably want to do the extra work to describe their behavior in terms of the POLY statement which unfortunately (as of this writing) is not documented very well in Ngspice or Gnucap. Here is one place it is:

To do the curve fitting I suppose you could use tools like Gnuplot, Grace, or Simfit.

Note that for Ngspice to support POLYs you need to set that compile time option see:

Clif Eugene 2010/11/23 01:31

geda/spice_polys.txt · Last modified: 2014/04/17 06:43 by vzh