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, phase-mode DC analysis )see (184.108.40.206) is used to compute the DC operating point. Historically, transient analysis with Josephson junctions was performed using the uic option since it was not previously possible to perform a true DC analysis with Josephson junctions present. The phase-mode DC feature in WRspice avoids the need to use uic in most circuits, however some circuits may still require it, for example if the circuit is not quiescent with its initial DC bias.
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
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.