Micro-Cap v7.1.6 / RM
.PDFWhat causes convergence problems
Many things can cause non-convergence. Here are the usual suspects:
Model discontinuities: Sometimes the model produces a discontinuity in a conductance, transconductance, or capacitance term. When the solution traverses the discontinuity, a disproportionate result is obtained, and the solution iterates around the discontinuity until the iteration limit is reached. There is little the user can do about this cause, except to avoid the model region where the discontinuity occurs.
Bistable or even unstable circuits: If a circuit is unstable, or has multiple stable states, the routines will sometimes iterate between one stable state and another. Because they never converge to one stable answer, convergence fails. This is usually a problem only in the DC operation point and transfer function analyses. To solve this problem, the DC operating point is often bypassed or achieved by ramping the power supplies and transient analysis is often substituted for DC transfer analysis.
Incorrect modeling: This is the most common source of trouble. Unrealistic impedances or source values, zero-valued capacitors, dangling nodes, and unintentional shorts are some of the more common problems. The most common problem in this category is misconnected components. If you take a circuit that converges and runs through every analysis perfectly and randomly alter its topology by breaking or adding connections, it will frequently fail to converge. The second most common problem is zero-valued capacitance. Capacitors act like shock absorbers in transient analysis. They harmonize with the numerical routines to produce more realistic, more convergeable solutions. Model capacitances should rarely be set to zero. Use small values if you must, but don't make them zero. The third most common problem occurs when a diode or a switch is placed in series with an inductor. As experienced auto mechanics know, very high voltages are produced by interrupting the flow of current through an inductor. An ideal diode does this very neatly. When this happens, the time step routines reduce the time step to very small values and sometimes produce non-convergence. To mitigate this problem, use a medium value resistor in parallel with the diode or switch to absorb some of the current. Make the resistance large enough so that it doesn't interfere with normal circuit operation, but small enough to absorb the current when the diode shuts off. A practical value is 1E6. Even if non-convergence isn't a problem, this technique will usually speed up the run.
267
Convergence checklist
Here are the things you should try when convergence problems arise:
Check circuit topology:
Path to ground: Every node must have a DC path to the ground node. The classic example of this is a circuit containing two capacitors in series, with nothing else connected to the junction of the two capacitors. From the junction, there is no DC path to ground and the circuit will fail to find a DC operating point. The solution is to replace the series combination with an equivalent capacitor, or put a high-valued resistor like 1E12 from the junction to ground. Another circuit configuration that creates a very similar problem is a set of cascaded, ungrounded, transmission lines. There is no DC path from the output of a transmission line to the input, so unless the junction between the lines is grounded or has a path to ground through some other component, an operating point convergence failure usually occurs. The solution is to place a high-valued resistor like 1E12 from the junction to ground.
Current sources in series: Current sources in series with different values are a logical absurdity and may produce convergence errors. Eliminate them or add a large resistance in parallel with each source.
Voltage sources or inductor loops: Both voltage sources and inductors are voltage-defined branches. A loop with only voltage-defined branches is a source of much trouble since it allows a possibly nonzero sum of voltages around the loop. MC7 will check for these, but if you eliminate them by adding a very small resistance within the loop to absorb the net loop voltage, be careful not to make it too small.
Shorts and opens: The easiest way to see short circuits and open circuits is to turn on the Node numbers display option. If two nodes are shorted to form one node there will be a single node number. If two nodes are distinct there will be a unique node number on each.
Floating nodes: Floating nodes sometimes cause problems. Make sure the Floating Nodes option (Options / Preferences / Common Options) is enabled. This eliminates floating nodes by checking for the presence of at least two connections for every node. The check procedure is done when ananalysis is selected.
268 Chapter 18: Convergence
Check circuit modeling:
Nonzero diode series resistance: The RS of the diode serves to selflimit the possibly exponential current that can flow if an external voltage source is placed across the diode. The same argument applies to
the BJT transistor lead resistances.
Nonzero diode parallel resistance: The RL of the diode serves to limit the reverse voltages that can occur when an inductor is in series with the diode. Normal reverse resistance due to IS alone is on the order of 1e15 ohms. This is unrealistically high for most diodes. The RL parameter provides a convenient way to specify a realistic leakage resistance of 1E6 to 1E9. High reverse diode resistance in the presence of series inductors not only leads to the most common cause of "time step too small" errors, it is also a common cause of slow simulations, as it forces very small time steps.
Nonzero capacitors: Do all capacitors have nonzero values? If not, set them to a small value relative to other capacitors in the circuit.
Switches and inductors in series: If these are present and are causing problems, add parallel resistors of 10K or larger to minimize convergence problems. Any kind of a switch in series with an inductor can cause a problem. This includes diodes, switches, and active devices.
MOSFET drain-source conductance: A small nonzero value, like .01 to
.001, for the LAMBDA model parameter, produces a finite output conductance and can frequently solve convergence problems with MOSFETs. Alternatively, adding a 1K to 10K resistor between the drain and source will accomplish the same thing. The value of the resistance should be large enough to avoid loading the drain circuit.
Tweak the Global Settings:
Increase Gmin: Gmin is the minimum branch conductance. Increasing it sometimes helps a DC operating point to converge.
Increase RELTOL: RELTOL is the maximum relative error tolerance. Sometimes increasing it from the default value of .001 to .01 will converge a difficult circuit.
Increase ABSTOL or VNTOL: These Global Settings values specify the maximum absolute error tolerance in current variables and voltage variables, respectively. The default values for these parameters are:
269
ABSTOL = 1E-12
VNTOL = 1E-6
These values are suitable for typical integrated circuits where the currents are typically 10 mA and the voltages are typically 10 volts. If your circuit contains especially large currents or voltages, try increasing these values proportionate to the size of the expected maximum current and voltage values in your circuit. Thus, if your circuit produces 1000 amps, increase ABSTOL by 1E5 (1000/10mA), to 1E-7 (1E5*1E-12).
Increase ITL1: If the non-convergence occurs in a DC operating point, then increasing ITL1 from its customary 100 to a larger value sometimes helps. There are circuits that converge after 150, or even 300 iterations.
Convergence Assist, if enabled, will increase ITL1 for you automatically.
Increase ITL4: If the non-convergence occurs during a transient analysis, increase ITL4 to 20 or even 50. ITL4 is the limit on the number of iterations at each timepoint beyond which the program discards the solution, reduces the timestep, and tries again with the smaller timestep. Convergence Assist, if enabled, will do this for you automatically.
Turn off the operating point:
If the problem is lack of convergence in the operating point, try eliminating it and letting the circuit simply stabilize at its operating point the way a real circuit would do if you simply turned on the power. If you anticipate many simulations, you might want to run the circuit with all waveform sources set to their Time= 0 values to let it stabilize at an operating point and then save the operating point values from the State Variables editor. Later runs would then be set to read the operating point values from the file. This is done by choosing the Read option in the State Variables list box in the Analysis Limits dialog box. On the subsequent runs you may need to choose the Operating Point option if the circuit has changed enough to change the operating point values. The initial approximation from the file should substantially aid convergence.
Try something drastic:
Ramp the supplies slowly: Replace all DC voltage and current sources in the circuit with pulse source equivalents. Then set the timing parameters of the pulse sources to gradually ramp up the values. Use 0.0 for all initial source values, or bypass the DC operation point completely by disabling the Operating Point option in the Analysis Limits dialog box. This option is only available in transient analysis.
270 Chapter 18: Convergence
Use Nodeset commands: Nodeset commands are used to specify an
initial guess at the value of a node voltage, prior to beginning the operating point. If the guess is close, it sometimes helps convergence.
Use the Off keyword: Turn active devices off with the OFF keyword. Especially if the device is involved in the area of the circuit that is not converging, this can be a very useful technique.
Use the IC device options: These options let you specify the initial conditions for the active devices. If the device is the one not converging, this can help. It is necessary to estimate the initial condition (voltage or current) to use this method.
Check the numeric output file: If convergence fails, look at the numeric output (F5). It includes information on the devices that failed to converge. Sometimes you can get a hint of what the problem is by seeing which devicesfailed.
Enable Convergence Assist: This option, enabled from Options / Global Settings / Common Options / Analysis is sometimes useful in getting difficult circuits to converge. It tries several combinations of the Global Settings simulation parameters in an attempt to get the circuit to converge. If it succeeds, it places a .OPTIONS statement with the successful parameters in the circuit so that future runs will converge more readily.
271
272 Chapter 18: Convergence
Chapter 19 |
Expressions |
What's in this chapter
Expressions are used in certain component parameters and in plotting and printing simulation results. A clear understanding of expressions is essential to get the most from MC7. This chapter covers these topics:
•What are expressions?
•Numbers
•Constants
•Variables
•Component variables
•Subcircuit and Macro Variables
•Model variables
•Sample variables
•Mathematical operators and functions
•Sample expressions
•Rules for using operators and variables
Features new in Micro-Cap 7
•All trigonometric and hyperbolic functions and their inverses are now available and all accept complex arguments and return complex answers.
•Complex IF, MIN, MAX, and LIMIT functions.
•New energy terms (ED,ES,EG) similar to power terms.
•Run-invariant expressions are now allowed in model parameters. For example, VTO=2+TEMP/100.
273
What are expressions?
Expressions are text strings entered by the user that contain numbers, constants, variables, and mathematical operators. All curves to be printed or plotted are defined in the Analysis Limits dialog box with expressions. The numeric behavior of resistors, capacitors, inductors, Laplace sources, and Function sources is defined through the use of expressions.
Case is ignored in expressions, so RLOAD is the same variable as Rload. The expression value is updated whenever any of the constituent variables change.
Here are some typical expressions:
10.0
V(10)
V(OUT)*I(L1)
VCE(Q1)*IC(Q1)
274 Chapter 19: Expressions
Numbers
Numbers are expressed in one of three formats:
•Real numbers:
1.0, 6.7
•Floating point numbers: These use standard scientific notation. 1.87E-12, 23E3
•Engineering notation:
2.7K, 12pF, 10.5ma, 1MEGHz
This notation uses standard engineering abbreviations. The letters
for units are optional (F, a, Hz). No blank space is allowed between the number and letter(s). Engineering notation uses these abbreviations:
|
Abbreviation |
Name |
Value |
|
|
|
|
|
|||
F |
Femto |
1E-15 |
|
|
|
P |
Pico |
1E-12 |
|
|
|
N |
Nano |
1E-9 |
|
* To conserve space, the X and |
|
U |
Micro |
1E-6 |
|
Y scales on MC7 graphs use |
|
M* |
Milli |
1E-3 |
|
||
|
the small letter 'm' to refer to |
||||
K |
Kilo |
1E3 |
|
||
|
milli and the large letter 'M' to |
||||
MEG* |
Mega |
1E6 |
|
||
|
refer to Mega. |
||||
G |
Giga |
1E9 |
|
||
|
|
||||
T |
Tera |
1E12 |
|
|
|
|
|
|
|
|
|
275
Constants and analysis variables
MC7 provides these constants and analysis variables.
Symbol |
Value |
T |
Time in seconds |
F |
Frequency in Hz |
DCINPUT1 |
Value of Variable1 in DC analysis |
E |
EXP(1) = 2.718281828459045 |
PI |
3.141592653589793 |
S |
Complex frequency = 2*PI*J |
J |
Imaginary unit value used in complex numbers. For |
|
example 1+J, or 10+23*J |
TEMP |
Analysis temperature and default device temperature |
|
in degrees Celsius |
VT |
1.3806226e-23*(273.15 + TEMP)/1.6021918e-19 |
|
= 2.586419e-2 at TEMP=27 °C |
GMIN |
Minimum conductance across junctions |
TMIN |
Starting transient analysis time |
TMAX |
Ending transient analysis time |
DT |
Transient analysis time step |
FMIN |
Starting AC analysis frequency |
FMAX |
Ending AC analysis frequency |
INOISE |
Input noise in AC analysis |
ONOISE |
Output noise in AC analysis |
ANALYSIS |
= _TRANSIENT in transient analysis |
|
= _AC in AC analysis |
|
= _DC in DC analysis |
|
= _DYNAMICDC in Dynamic DC analysis |
|
= _TF in Transfer Function analysis |
|
= _SENS in Sensitivity analysis |
|
For example, the expression ANALYSIS=_AC would be |
|
TRUE (1.0) in AC analysis and FALSE (0.0) elsewhere. |
PGT |
Total power generated in the circuit |
PST |
Total power stored in the circuit |
PDT |
Total power dissipated in the circuit |
EGT |
Total energy generated by sources in the circuit |
EST |
Total energy stored in the circuit |
EDT |
Total energy dissipated in the circuit |
276 Chapter 19: Expressions