next up previous contents index
Next: .pz Line Up: Analysis Specification Previous: .noise Line   Contents   Index

.op Line

General Form:
The inclusion of this line in an input file will force WRspice to determine the dc operating point of the circuit with inductors shorted and capacitors opened. This is done automatically prior to most other analyses, to determine the operating point of the circuit, yielding transient initial conditions or the linearized models for nonlinear devices for small-signal analysis. It will not be done in transient analysis if the uic keyword is given in the transient analysis specification.

WRspice performs a dc operating point analysis if no other analyses are requested.

In interactive mode, the op command can be used to compute the operating point.

Operating point analysis will fail due to a singular circuit matrix if the circuit topology contains inductor and/or voltage source loops. Circuits containing such loops can only be simulated in transient analysis using the uic keyword in the analysis command, which will cause the operating point analysis to be skipped. On convergence failure, WRspice will check for and print a list of inductor and voltage source names found to be connected in loops. The dual situation of current source/capacitor cut sets will often converge in operating point analysis, as there is an added minimum conductance which will keep the solution finite (but huge).

If Josephson junctions are present in the circuit, they will be taken as shorted (actually, a resistance of 1uV/Ic) during operating point analysis. It is in general not possible to perform this type of analysis on Josephson junctions. The approach taken here may be useful when working with hybrid semiconductor/superconductor circuits, but in no case should one expect operating point analysis of Josephson circuits to ``work''. Transient analysis, which takes into account the past history of the Josephson excitation, is required for a complete simulation.

When computing the initial operating point for transient analysis, after the operating point is calcualted with Josephson junctions shorted, the Josephson junctions will be given any specified initial voltage and phase (or these will be reset to exactly zero with no initial conditions given). Thus, the Josephson junctions are always ``uic'', but the circuit is not in uic mode unless uic is actually given in the transient analysis command.

In operating point analysis, any .save or save directives will be ignored. All node voltages and branch currents will be saved in an "op" plot in interactive mode.

Given that operating point analysis is the starting point of most types of analysis, it is critical that this step succeeds. Unfortunately, many circuits are prone to convergence failure at this step, and achieving dc convergence has been one of the traditional battles when using SPICE simulators.

The original operating point calculation algorithm, which was very similar to the SPICE3 algorithm, was really pretty poor. For example, when attempting to simulate a large CMOS mixed-signal circuit, the old convergence algorithm would iterate for several minutes before ultimately failing. On the other hand, HSPICE could find the operating point within seconds (if that).

Lots of work was done to improve this, and a new algorithm is now the default in release 3.2.15 and later. The new algorithm seems to work pretty well, and the Berkeley algorithms have been retained as alternatives. There is flexibility in algorithm choice, giving the user some tools needed to obtain convergence of their circuits with the fewest iterations (quickest convergence).

There are two basic ways to solve for the circuit operating point. In ``gmin stepping'', a conductance is applied between every circuit node and ground. When this conductance is large enough, convergence can always be achieved. The conductance is then progressively reduced, while continuing to solve the circuit equations with the previous solution as a starting point. If all goes well, convergence is maintained when the conductance approaches zero, and the method succeeds.

The second method is ``source stepping''. In this method, all voltage and current sources are set to zero initially, where the circuit is guaranteed to have a trivial solution with every node at zero voltage. The sources are progressively ramped up, while solving the circuit equations using the previous solution as the starting point. Ultimately, if convergence is maintained when the sources reach their true values, the method succeeds.

The original Berkeley algorithm is as follows. First, unless the option variable noopiter is set, an attempt is made to solve the equation set directly, without using stepping. If convergence is acheived within the number of iterations specified by the itl1 variable (default 400), the operating point analysis succeeds.

If, as is likely, the initial attempt fails, gmin stepping is attempted. In the Berkeley algorithm, the conductance is reduced by a factor of 10 for each gmin step. If convergence is maintained through all steps, a final solution is attempted with no added conductance, and if this too succeeds, operating point analysis succeeds. However, it is possible that at some step, convergence will fail, and thus gmin stepping will fail.

If gmin stepping fails, or is not attempted, source stepping is tried. In the Berkeley algorithm, each source step is a fixed percentage of the final value. If convergence is maintained through all steps, then operating point analysis succeeds. Otherwise, the user will have to alter the circuit or change parameters to coerce convergence in a subsequent run.

The number of gmin and source steps is set by the option variables gminsteps and srcsteps, both default to 10 in SPICE3, and in earlier versions of WRspice.

The new algoritm uses ``dynamic'' stepping, for both gmin and source. In dynamic stepping, if a step fails, the step size is cut, and the calculation is repeated. If the step size is cut below a threshold after repeated failures, the method is exited with failure. On the other hand, if convergence is achieved with just a few iterations, then the step size is increased. This method is far more effective than the original approach. This concept was borrowed from the open-source NGSPICE project.

The new algorithm is invoked when both the gminsteps and srcsteps values are 0, which are the current defaults (these can be set from the Convergence page of the Simulation Options tool). If either is positive, a modified SPICE3 algorithm is used. If negative (-1 is now an allowed value) that convergence method will not be attempted. If both are negative, a direct solution will be attempted, whatever the state of the noopiter option variable.

The new algorithm is the following. If either gminsteps or srcsteps is positive, we are in a quasi-SPICE3 compatibility mode. In this case, if the noopiter variable is not set, the first task is to Newton iterate the matrix to attempt direct convergence. If convergence is not achieved in an iteration count given by the value of the itl1 variable, this is aborted, and the stepping options are attempted.

This initial direct convergence attempt can be very time-consuming and is rarely successful for large circuits, thus it is not done unless

  1. as above, either of gminsteps or srcsteps is positive, and noopiter is not set.
  2. if gminsteps and srcsteps are both -1. Direct convergence will be attempted whether or not noopiter is set in this case.

For very simple sircuits, when the direct method succeeds, this will probably yield the fastest operating point calculation. However, in these simple cases the difference is too small to be noticeable by the user, although in some automated tasks the accumulated time difference might be important.

By default, the next attempt will use source stepping. This is different from SPICE3, which would attempt gmin stepping before source stepping. However, it appears that source stepping is more effective on large CMOS circuits, so we try it first. However, if the option variable gminfirst is set, gmin stepping will be attempted before source stepping.

The default value of srcsteps is 0, which indicates use of the new dynamic source stepping algorithm. This algorithm takes variable-sized steps when raising the source values to their specified initial values, and backs up and tries again with a smaller step on failure. The SPICE3 source stepping takes fixed-size steps, and aborts on failure. The dynamic approach is far more effective. If srcsteps is positive, the SPICE3 approach will be used, with the given number of steps. If srcsteps is -1, source stepping will be skipped.

The gmin stepping, which is attempted if convergence has not been achieved, is similar. The default value of the gminsteps option variable is 0, indicating use of the dynamic gmin stepping algorithm. This reduces the ``gmin'' conductivity that is added to the circuit to achieve convergence in variable sized increments. If convergence fails, a smaller step is tried. The SPICE3 gmin stepping algorithm uses fixed-size steps (actually, orders of magnitude) when reducing gmin, and if convergence fails, the operation is aborted. This is done if gminsteps is given a positive value. The dynamic algorithm is much more effective. If gminsteps is given a value -1, gmin stepping is not done.

Another difference between WRspice and Berkeley SPICE is that in WRspice, the minimum value of conductance allowed on the matrix diagonal, in any analysis mode, is the value of the gmin option variable. This defaults to 10-12 Si. This avoids a singular matrix in various cases, such as series capacitors in dc analysis, or elements that have a floating node.

There are option variables which set the number of iterations to allow between steps when using the dynamic stepping algorithms. These are itl2gmin and et itl2src, both of which default to 20. The ``itl2'' prefix derives from the fact that in earlier versions of WRspice, the dc sweep iteration limit was used, which is set with the <a href="itl2"><tt>itl2</tt></a> variable and defaults to 100. It is probably counter-intuitive that reducing this number is a good thing, however this proved to be effective in solving some difficult convergence problems, in particular with some of the Verilog-A bipolar transistor models (hicum2, mextram). What happens is that when iterating and not converging, the computed matrix element entries can blow up to a point where the matrix becomes singular, and the run aborts. With the smaller iteration limit, the limit is reached before the matrix becomes singular, so the step gracefully fails, and a smaller step is then attempted, which converges.

Operating point analysis can be halted by the user by pressing Ctrl-C. However, unlike other analysis types, it can not be resumed.

If the trantrace debugging variable is set to a nonzero value, during operating point analysis, messages will be printed giving information about the analysis, including iteration counts and stepsize. This applies for any operating point calculation, not just in transient analysis.

The dcmu option variable can be used to improve convergence during operating point analysis. This variable takes a value of 0.0-0.5, with the default being 0.5. When set to a value less than 0.5, the Newton iteration algorithm mixes in some of the previous solution, which can improve convergence. The smaller the value, the larger the mixing. This gives the user another parameter to twiddle when trying to achieve dc convergence. This can be set from the Convergence page of the Simulation Options tool.

next up previous contents index
Next: .pz Line Up: Analysis Specification Previous: .noise Line   Contents   Index
Stephen R. Whiteley 2017-02-22