### SPICE Convergence

About the writer: Harvey Morehouse is a contractor/consultant with many years of experience using circuit analysis programs. His primary activities are in Reliability, Safety, Testability and Circuit Analysis. He may be reached at harvey.annie@verizon.net. Simple questions for which I know the answer are free. Complex questions, especially where I am ignorant of the answers, are costly!!!

Summary: Convergence is a recurring problem in performing SPICE analyses of circuits. The attached articles contain the bulk of the information that needs be conveyed, however some additional thoughts seem appropriate. Read the referenced articles first.

First things first:

Before anything else, build your model using tested models for new devices. Often convergence issues involve these new devices. As an example, consider a behavioral model for a device. Particularly when this model is replicated, especially when it is in a regenerative or a bistable configuration, it can present problems. Why is this?

Consider that all replicated devices are identical in performance save for specified initial conditions. In REAL regenerative devices, such as astable multivibrators, the circuit as shown on a schematic can be truly symmetrical, whereas a real-world implementation may rely on noise or non-perfect component matching to 'get started'.

Unfortunately there is no easy way to randomly tolerance devices such that they are not a perfect match, or to add a 'noise' voltage to insure the circuit will start. (Wish list: add a rnd(n) function to B2SPICE to enable random part values to be specified, or a small noise generator to be created. The proposed function would return a pseudo-random number between zero and unity, where 'n' could represent a uniform distribution for the value '0', a Gaussian distribution for a '1' argument, and so on.)

In the SMPS #3 article in the resources section, a flip-flop was created using behavioral models of 3-input NAND devices. This device model will not converge without some 'tweaking'. One solution is to use different NAND3 implementations, one with an output initial condition of '1' or high (MAND3-1), and the other '0' or low (NAND3-0). This would work in most cases. Another would be to modify the models internally slightly to make each of the NAND3 gates slightly different. A third would be to internally insure the devices performed differently by use of hysteresis in the models for the NAND3 devices. A fourth would be to externally add loading at the outputs (or inputs) to make the devices behave slightly differently. Lastly, some combination of the above might be tried if all else fails. In the article mentioned the fourth method was used with success.

DC Convergence:

All SPICE analyses start with a DC analysis. In order to arrive at a starting point, several techniques are use, some of which are done automatically. One is source stepping. IF convergence cannot be achieved with the specified source values, the DC sources are set to a small non-zero value and then increased. If one uses nonlinear sources to create devices, especially with logical functions, this may not be fully useful IF one uses constants for voltages levels as opposed to SPICE voltage sources.

Consider the following equation for a nonlinear generator (refer to the articles on logical equations in the resources section of the B2SPICE web site):

V = 5 -u(v(4,2)-1)*3

In this case the '5' represents a voltage source which is not stepped, nor is the output level if the condition, V(4,2)>1, is met. It might be useful to enable source stepping (if needed) by specifying a DC voltage generator (V9 as an example) of 5 volts, and modifying the equation slightly to become similar to:

V = V9 * (1 - u(v(4,2)-1)*.6)

Switching Mode or other Switched Circuits:

Switching Mode Power supply circuits (and some others) are characterized by relatively rapid switching intervals that are infrequent compared to the time intervals when the circuit responds to the switched devices. If the switch changes are unrealistically rapid, at best the solution will require long simulation times. Often it will not converge.

The solution is to use non-ideal switching elements to represent diodes, transistors and other devices that in reality do not change as abruptly as ideal elements. This can be done by creating smooth switches, or, by adding capacitances and resistances to ideal elements. The added elements need not be vary large, and ideally will create transitions similar to a real device although this may not be required to achieve convergence.

Conclusions:

Vexing though it can be at times, most circuits can be made to converge with some effort. The key is to understand where the non-convergence is, why it occurs, and what can be done to enable convergence. Always assume it is a circuit implementation problem before messing with the analysis settings. And then, when convergence is achieved, examine carefully the circuit voltage and current values to insure they are accurate.

Case in point: an AC analysis is a small-signal analysis about a DC operating point. Consider an improperly configured analysis where the DC operating point 'solution' is (erroneously) close to a device 'rail'. The AC analysis might indicate suitable operation, whereas a transient analysis with an AC input would reveal signal clipping.

Performing a SPICE analysis takes thought, time, and work. Often several different circuit models may have to be developed to obtain the proper results. All models are approximations, and the key is to find the right one which properly displays circuit performance to the required accuracy. One cannot just buy a SPICE program and use it and expect perfect results without careful thought. IF something about the analysis results seem strange, or defy explanation, do NOT pass it by without determining what is happening.

References:

1. Solving SPICE Convergence Problems, Intusoft articles, http://www.intusoft.com/articles/converg.