仿真故障排除
When a circuit will not simulate, you must identify if the problem is in the circuit, or the process of simulation. Follow the information contained in this section of the reference and work through the suggested points, trying one at a time.
Sometimes during a simulation, a message will be displayed reporting errors or warnings. These messages are listed in the Messages panel.
- Warning Messages – warning messages are not fatal to the simulation. They generally provide information about changes that SPICE had to make to the circuit in order to complete the simulation. These include invalid or missing parameters, and so on.
- Error Messages – error messages provide information about problems that the simulator could not resolve and were fatal to the simulation process. Error messages indicate that simulation results could not be generated, so they must be corrected before you will be able to analyze the circuit.
Troubleshooting Simulation Analysis Failures
One of the challenges of all simulators is convergence. What exactly is meant by the term, convergence? Like most simulators, Altium Designer's SPICE engine uses an iterative process of repeatedly solving the equations that represent your circuit, to find the quiescent circuit voltages and currents. If it fails to find these voltages and current (fails to converge) then it will not be able to perform an analysis of the circuit.
SPICE uses simultaneous linear equations, expressed in matrix form, to determine the operating point (DC voltages and currents) of a circuit at each step of the simulation. The circuit is reduced to an array of conductances which are placed in the matrix to form the equations (G * V = I
). When a circuit includes nonlinear elements, SPICE uses multiple iterations of the linear equations to account for the non-linearities. SPICE makes an initial guess at the node voltages then calculates the branch currents based on the conductances in the circuit. SPICE then uses the branch currents to recalculate the node voltages, and the cycle is repeated. This cycle continues until all of the node voltages and branch currents fall within specified tolerances (converge).
However, if the voltages or currents do not converge within a specified number of iterations, SPICE produces error messages (such as singular matrix
, Gmin stepping failed
, source stepping failed
or iteration limit reached
) and aborts the simulation. SPICE uses the results of each simulation step as the initial guesses for the next step. If you are performing a Transient analysis (that is, time is being stepped) and SPICE cannot converge on a solution using the specified timestep, the timestep is automatically reduced, and the cycle is repeated. If the timestep is reduced too far, SPICE displays a Timestep too small
message and aborts the simulation.
General Simulation Convergence Troubleshooting
When a simulation analysis fails, the most common problem is failure of the circuit to converge to a sensible operating point. Use the following techniques to solve convergence problems.
Convergence Troubleshooting Steps
- When you have a convergence problem, first turn off all the analyses except the Operating Point analysis.
- Consult the Messages panel for any errors/warnings relating to simulation.
- Make sure the circuit is wired correctly. Dangling nodes and stray parts are not allowed.
- Ensure that the circuit has a ground node, and that every node in the circuit has a DC path to this ground. Components that can isolate a node include transformers and capacitors. Voltage sources are considered a DC short circuit, current sources are considered a DC open circuit.
- Ensure that zeros have not been confused with the letter O when entering simulation parameters.
- Ensure that proper SPICE multipliers have been specified (
MEG
instead ofM
for1e6
) for any component values or simulation parameters. Multipliers are not case-sensitive. Also, spaces between values and multipliers are not allowed. For example, it should be1.0uF
, not1.0 uF
. - Make sure all devices and sources are set to their proper values.
- Make sure the gain of any dependent source is correctly set.
- Temporarily eliminate series capacitors or current sources and re-run the simulation.
- Temporarily eliminate parallel inductors or voltage sources and re-run the simulation.
- On the Advanced tab of the Advanced Analysis Settings dialog (accessed by clicking Settings in the Analysis Setup & Run region of the Simulation Dashboard panel), increase the value of the
ITL1
parameter to300
. This will allow the Operating Point analysis to go through more iterations before giving up. - On the Advanced tab of the Advanced Analysis Settings dialog, set the value of the
RSHUNT1
. This value of resistance is added between each circuit node and the ground helps to correct problems such as "singular matrix" errors. As a rule, the RSHUNT value must be set to a very high resistance, such as1e12
. - Add .NS (Nodeset) devices to define the node voltages. If the initial guess of a node voltage is way off, the Nodeset device can be used to predefine a starting voltage that is used for a preliminary pass of the operating point analysis. Configure the Initial Voltage parameter in each Nodeset device that you place. A Nodeset can be placed from the Simulation Generic Components library.
- If the Nodeset device does not assist in convergence, try defining the initial conditions by placing .IC devices. In this case, the node voltages are held at the specified values during the Operating Point analysis, then released during the Transient analysis. Initial Condition devices can be placed from the same libraries as a Nodeset device, the Initial Voltage parameter must be configured in the same way.
- Enable the Use Initial Conditions option in the Transient settings in the Analysis Setup & Run region of the Simulation Dashboard panel. This option works in conjunction with the .IC devices (or the IC parameter of the components). By setting this option, the Operating Point analysis is not performed and the specified voltages are used as the initial conditions for the Transient analysis.
- Specify the series resistance parameters of your models and increase the
GMIN
option (the Advanced tab of the Advanced Analysis Settings dialog) by a factor of10
. - Specify the initial condition (Starting Condition) of semiconductor devices, especially diodes, as
OFF
. This can help solve numerical convergence problems by skipping the diode (or semiconductor device) for the first iteration, helping improve convergence.
DC Sweep Analysis Troubleshooting
When you have a problem with a DC Sweep analysis, first try the steps listed above in the convergence troubleshooting steps. If you still encounter problems, try the following:
- Change the value of the Step parameter in the Analysis Setup & Run section of the Simulation Dashboard. If discontinuities exist in a device model (perhaps between the linear and saturation regions of the model), increasing the step size may allow the simulation to step over the discontinuity. Making the steps smaller, on the other hand, will allow the simulation to resolve rapid voltage-transition discontinuities.
- Do not use the DC Sweep analysis. Some problems (such as hysteresis) cannot be resolved by DC analysis. In such cases, it is more effective to use the Transient analysis and ramp the values of the appropriate power sources.
Transient Analysis Troubleshooting
When you have a problem with a Transient analysis, first try the steps listed above in the convergence troubleshooting steps. If you still encounter problems, try the following.
On the Advanced tab of the Advanced Analysis Settings dialog (accessed by clicking Settings in the Analysis Setup & Run region of the Simulation Dashboard panel):
- Set the
RELTOL
parameter to0.01
. By increasing the tolerance from its default of0.001
(0.1% accuracy), fewer iterations will be required to converge on a solution and the simulation will complete much more quickly. - Increase the value of the
ITL4
parameter to100
. This will allow the Transient analysis to go through more iterations for each timestep before giving up. Raising this value may help to eliminatetimestep too small
errors improving both convergence and simulation speed. - Reduce the accuracy by increasing the values of
ABSTOL
andVNTOL
, if current/voltage levels allow. Your particular circuit may not require resolutions down to 1uV or 1pA. You should, however, allow at least an order of magnitude below the lowest expected voltage or current levels of your circuit. - Change the Integration Method to one of the Gear methods. Gear integration requires a longer simulation time, but is generally more stable than trapezoidal. Gear integration may be particularly useful with circuits that oscillate or have feedback paths.
Additional things to try:
- Realistically model your circuit. Add realistic parasitics, especially stray/junction capacitance. Use RC snubbers around diodes. Replace device models with subcircuits, especially for RF and power devices.
- Increase the rise/fall times of any Periodic Pulse sources in your circuit. Even the best pulse generators cannot switch instantaneously.