Algorithm Search⌘K

Techniquecore

Gmin stepping

Also called conductance stepping, gmin continuation.

Adds a large conductance from every node to ground and reduces it in steps to zero, solving the DC equations at each step from the last answer to reach convergence.

Gmin stepping finds the DC operating point of a circuit that plain Newton cannot solve. It connects a conductance γ\gamma from every node to ground, solves the circuit with a large γ\gamma, where the equations are close to linear and easy, and then lowers γ\gamma step by step, starting each Newton run from the previous solution, until the conductance is removed. It is a technique of the circuit simulation half of the logic and circuit simulation sub-area, and a homotopy continuation whose parameter is a physical conductance.

In plain words

A circuit can be hard to solve because some parts of it are floating or very sensitive: a node held only by switched-off transistors, or a loop with large gain. Tie every node to ground through a strong resistor, and all voltages are pulled close to zero. That circuit is easy.

Now weaken those resistors a little. The answer moves only a little, so the previous answer is a good guess, and Newton's method finds the new one in a few steps. Repeat, making the extra resistors weaker each time, until they are so weak that they no longer matter, and then remove them.

When it applies

Use it for the DC operating point after Newton, with junction voltage limiting, has failed from the usual start. It suits circuits with nodes that are almost floating, such as the internal nodes of stacks of transistors that are off, and circuits whose Jacobian is singular at the starting point. It needs only one change to modified nodal analysis: add γ\gamma to each diagonal entry of a node row. It is a standard fallback in SPICE, tried before or after source stepping.

The template

Write the operating point equations as F(x)=0F(x) = 0 with x=(e,j)x = (e, j), the node voltages and the currents of the voltage sources, and let P=diag⁡(In,0)P = \operatorname{diag}(I_n, 0) select the node voltages. The gmin circuit with conductance γ≥0\gamma \ge 0 is

H(x,γ)=F(x)+γPx=0,H(x, \gamma) = F(x) + \gamma P x = 0,

KCL with an extra current γek\gamma e_k leaving each node kk to ground. At γ=0\gamma = 0 it is the given circuit.

  1. GMIN-STEPPING(F, γ_0, γ_min, ρ)
  2. 1γ ← γ_0; x ← 0
  3. 2x ← NEWTON(H(·, γ), x) ▷ the easy circuit
  4. 3while γ > γ_min do
  5. 4γ' ← max(γ / ρ, γ_min)
  6. 5(x', ok) ← NEWTON(H(·, γ'), x) ▷ hole: the corrector, Newton with limiting
  7. 6if ok then γ ← γ'; x ← x'
  8. 7else ρ ← a smaller factor; if ρ is too close to 1 then return FAILURE ▷ hole: the step rule
  9. 8x ← NEWTON(F, x) ▷ remove the added conductance
  10. 9return x

In SPICE3 the fixed version starts at a conductance 10k10^k times GMIN, divides by a fixed factor at each step, and after reaching GMIN sets the added conductance to GSHUNT (zero by default) for the final solve. The dynamic version of ngspice starts at 10−210^{-2} S, divides by an adaptive factor, and after a failure goes back to the last good point and replaces the factor by its fourth root. In both, the conductance GMIN (10−1210^{-12} S by default) that every pn junction model places across its junction stays in the circuit.

Assumptions for the proofs. Every resistive device is a two-terminal element with a continuous, nondecreasing law i=gk(v)i = g_k(v); the voltage sources form no loop, so AVA_V has independent columns; and W={w:AVTw=0}W = \{w : A_V^{\mathsf T} w = 0\} is the set of changes of node voltages that keep every voltage source satisfied. Monotone laws give (v−v′)(gk(v)−gk(v′))≥0(v - v')(g_k(v) - g_k(v')) \ge 0, and summing over the devices with v=ANTev = A_N^{\mathsf T} e gives

(e−e′)TAN(g(ANTe)−g(ANTe′))≥0.(∗)(e - e')^{\mathsf T} A_N\big(g(A_N^{\mathsf T} e) - g(A_N^{\mathsf T} e')\big) \ge 0. \qquad (\ast)

Theorem 1 (every gmin circuit has one solution). Under the assumptions, for every γ>0\gamma > 0 the equation H(x,γ)=0H(x, \gamma) = 0 has exactly one solution x(γ)x(\gamma), even when F(x)=0F(x) = 0 has none.

Proof. Pick e0e_0 with AVTe0=sVA_V^{\mathsf T} e_0 = s_V; it exists because AVTA_V^{\mathsf T} has full row rank. Every solution has e=e0+we = e_0 + w with w∈Ww \in W. Let Π\Pi be the orthogonal projection onto WW and Φ(w)=Π(ANg(ANT(e0+w))+AIsI+γ(e0+w))\Phi(w) = \Pi\big(A_N g(A_N^{\mathsf T}(e_0 + w)) + A_I s_I + \gamma (e_0 + w)\big), a continuous map of WW into itself. By (∗)(\ast), (w−w′)T(Φ(w)−Φ(w′))≥γ∥w−w′∥2(w - w')^{\mathsf T}(\Phi(w) - \Phi(w')) \ge \gamma \|w - w'\|^2, so Φ\Phi is uniformly monotone on WW and has exactly one zero by the uniform monotonicity theorem (Ortega and Rheinboldt, Section 6.4). At that zero, the KCL vector r=ANg(⋅)+AIsI+γer = A_N g(\cdot) + A_I s_I + \gamma e is orthogonal to WW, and W⊥W^\perp is the column space of AVA_V, so AVj=−rA_V j = -r has exactly one solution jj. Conversely every solution of H=0H = 0 gives a zero of Φ\Phi this way, so the solution is unique. ■\blacksquare

Theorem 2 (the large end). Let eˉ\bar e be the node voltage vector of least norm with AVTeˉ=sVA_V^{\mathsf T} \bar e = s_V. Then

∥e(γ)−eˉ∥≤∥ANg(ANTeˉ)+AIsI∥γ.\|e(\gamma) - \bar e\| \le \frac{\|A_N g(A_N^{\mathsf T} \bar e) + A_I s_I\|}{\gamma}.

Proof. Let w=e(γ)−eˉ∈Ww = e(\gamma) - \bar e \in W. The least norm solution lies in the column space of AVA_V, which is W⊥W^\perp, so wTeˉ=0w^{\mathsf T} \bar e = 0; also wTAVj=0w^{\mathsf T} A_V j = 0. Multiply the KCL rows of H=0H = 0 by wTw^{\mathsf T}: wTANg(ANTe(γ))+wTAIsI+γ∥w∥2=0w^{\mathsf T} A_N g(A_N^{\mathsf T} e(\gamma)) + w^{\mathsf T} A_I s_I + \gamma \|w\|^2 = 0. By (∗)(\ast) the first term is at least wTANg(ANTeˉ)w^{\mathsf T} A_N g(A_N^{\mathsf T} \bar e), so γ∥w∥2≤−wT(ANg(ANTeˉ)+AIsI)\gamma \|w\|^2 \le -w^{\mathsf T}(A_N g(A_N^{\mathsf T} \bar e) + A_I s_I), and the Cauchy-Schwarz inequality gives the bound. ■\blacksquare

So for large γ\gamma the solution is close to a known point, and Newton started there meets an almost linear problem: the start of the homotopy is easy. Without voltage sources eˉ=0\bar e = 0 and the bound is ∥AIsI∥/γ\|A_I s_I\|/\gamma when the device laws pass through the origin.

Theorem 3 (the path is smooth). If in addition the device laws are continuously differentiable, then γ↦x(γ)\gamma \mapsto x(\gamma) is continuously differentiable on (0,∞)(0, \infty): the homotopy path has no turning points and no branch points.

Proof. The Jacobian of HH in xx is (K+γIAVAVT0)\begin{pmatrix} K + \gamma I & A_V \\ A_V^{\mathsf T} & 0 \end{pmatrix} with K=ANDANTK = A_N D A_N^{\mathsf T} and DD the diagonal of the slopes gk′≥0g_k' \ge 0. If it maps (w,y)(w, y) to zero, then AVTw=0A_V^{\mathsf T} w = 0, so 0=wT(K+γI)w+wTAVy=wT(K+γI)w≥γ∥w∥20 = w^{\mathsf T}(K + \gamma I) w + w^{\mathsf T} A_V y = w^{\mathsf T}(K + \gamma I) w \ge \gamma \|w\|^2, hence w=0w = 0, then AVy=0A_V y = 0 and y=0y = 0. The Jacobian is nonsingular at every point, and the implicit function theorem gives a continuously differentiable solution curve through each x(γ)x(\gamma); by uniqueness these pieces are the one curve x(γ)x(\gamma). ■\blacksquare

With small enough steps the corrector of line L5 therefore always converges for monotone circuits, by the local convergence of Newton along the compact pieces [γmin⁡,γ0][\gamma_{\min}, \gamma_0] of the path. The theorems say nothing about the end γ→0\gamma \to 0: if the given circuit has no operating point, the path runs off to infinity. Transistor circuits are not monotone, and for them the path can turn back; then fixed decreasing steps fail, and only methods that follow the arc length of the path, as in homotopy continuation, can pass the turn.

Theorem 4 (the error of a small leftover conductance). Let x∗x^\ast solve F=0F = 0 and x(γ)x(\gamma) solve H(⋅,γ)=0H(\cdot, \gamma) = 0, and suppose the device and resistor laws are uniformly monotone on WW with constant μ>0\mu > 0, that is (∗)(\ast) holds with right side μ∥e−e′∥2\mu \|e - e'\|^2 whenever e−e′∈We - e' \in W. Then

∥e(γ)−e∗∥≤γμ+γ ∥Πe∗∥≤γμ ∥e∗∥.\|e(\gamma) - e^\ast\| \le \frac{\gamma}{\mu + \gamma}\, \|\Pi e^\ast\| \le \frac{\gamma}{\mu}\, \|e^\ast\|.

Proof. Let w=e(γ)−e∗∈Ww = e(\gamma) - e^\ast \in W. Subtract the KCL rows of F(x∗)=0F(x^\ast) = 0 from those of H(x(γ),γ)=0H(x(\gamma), \gamma) = 0 and multiply by wTw^{\mathsf T}; the terms with AVA_V and the sources vanish, which leaves wTAN(g(⋅)−g(⋅))+γwT(w+e∗)=0w^{\mathsf T} A_N(g(\cdot) - g(\cdot)) + \gamma w^{\mathsf T}(w + e^\ast) = 0. So μ∥w∥2+γ∥w∥2≤−γwTe∗=−γwTΠe∗≤γ∥w∥∥Πe∗∥\mu \|w\|^2 + \gamma \|w\|^2 \le -\gamma w^{\mathsf T} e^\ast = -\gamma w^{\mathsf T} \Pi e^\ast \le \gamma \|w\| \|\Pi e^\ast\|. ■\blacksquare

The bound is tight: a current source II into a single resistor RR has μ=1/R\mu = 1/R, e∗=IRe^\ast = IR and e(γ)=IR/(1+γR)e(\gamma) = IR/(1 + \gamma R), and the change IR⋅γR/(1+γR)IR \cdot \gamma R/(1 + \gamma R) equals the bound. Linear resistors that connect every node to ground or to a node held by a voltage source make μ\mu at least the smallest eigenvalue of their conductance matrix on WW. For a circuit that is not monotone, the implicit function theorem at a solution with nonsingular Jacobian JJ gives the first-order form x(γ)=x∗−γJ−1Px∗+O(γ2)x(\gamma) = x^\ast - \gamma J^{-1} P x^\ast + O(\gamma^2), so the change is at most γ∥J−1∥∥e∗∥\gamma \|J^{-1}\| \|e^\ast\| to first order.

Worked example. A 5 V source drives a diode (Is=10−14I_s = 10^{-14} A, Vt=25.852V_t = 25.852 mV) through 1 kΩ1\ \text{k}\Omega; the operating point is v∗=0.692544v^\ast = 0.692544 V. With γ\gamma from the diode node to ground (the source node is held by the source, so its γ\gamma changes only the source current):

γ\gamma (S) 10−110^{-1} 10−210^{-2} 10−310^{-3} 10−610^{-6} 10−910^{-9} 10−1210^{-12}
v(γ)v(\gamma) (V) 0.04950 0.45451 0.68808 0.6925395 0.692543629 0.692543633
v(γ)−v∗v(\gamma) - v^\ast −0.643-0.643 −0.238-0.238 −4.5×10−3-4.5 \times 10^{-3} −4.1×10−6-4.1 \times 10^{-6} −4.1×10−9-4.1 \times 10^{-9} −4.1×10−12-4.1 \times 10^{-12}

Theorem 4 with μ=1/R=10−3\mu = 1/R = 10^{-3} S bounds the change at γ=10−12\gamma = 10^{-12} S by 6.9×10−106.9 \times 10^{-10} V. The first-order form is sharper: JJ is the conductance 1/R+I/Vt≈0.1681/R + I/V_t \approx 0.168 S at the solution, so the change is about γv∗/0.168=4.1×10−12\gamma v^\ast / 0.168 = 4.1 \times 10^{-12} V, as measured. The circuit with no solution, a current source pulling 1 mA out of the anode of a diode, shows the other end: the gmin circuit has the solution v≈−10−3/γv \approx -10^{-3}/\gamma, which runs to −109-10^9 V at γ=10−12\gamma = 10^{-12} S, a sign that F=0F = 0 has no solution.

Classic examples

  • The DC analysis of SPICE3 and ngspice tries gmin stepping when Newton fails from the initial junction voltages, before source stepping.
  • Pseudo-transient analysis is the other conductance-like regularization: the companion conductance C/hC/h of an added capacitor plays the role of γ\gamma, but centred at the previous point instead of ground.
  • The artificial parameter homotopies of Melville, Trajković, Fang and Watson for the operating point problem, of the form λF(x)+(1−λ) G(x−a)\lambda F(x) + (1 - \lambda)\, G (x - a), act like a conductance GG in series with a source aa at every node, so that the start is a chosen point aa instead of zero; they come with conditions under which the path reaches a solution.
  • In MOS transistor models and diode models the fixed GMIN across each junction keeps the MNA matrix nonsingular when a node is held only by devices that are off; SPICE3 steps the node conductance down to the same value before it removes it.

Variations

  • Fixed factor steps. Divide γ\gamma by a fixed factor, such as 10, at each step, and stop at the first failure (SPICE3).
  • Adaptive factor. Divide by a factor that grows after easy steps and shrinks after failures, and return to the last good point after a failure (dynamic gmin in ngspice).
  • Gmin on device junctions only. Step the conductance across each pn junction instead of from each node to ground; the proofs are the same with PP replaced by the junction incidence.
  • Combined with source stepping. ngspice's source stepping first solves the circuit with all sources off under gmin stepping, and then raises the sources with the conductance in place.
  • Keep a final shunt. Leave a small conductance GSHUNT from every node to ground in the final circuit; Theorem 4 bounds the error this makes.

Pitfalls

  • Turning points. For circuits with positive feedback, such as latches and Schmitt triggers, the solution path in γ\gamma can fold back. A step past the fold has no nearby solution, and the corrector fails or jumps to another branch.
  • Too small an end value. Removing the conductance is the last step and can itself fail when a node is truly floating; the MNA matrix of the final circuit is then singular, and the right answer is to report the floating node.
  • A wrong solution that looks right. If the final γ\gamma is kept and is not small next to the conductances of the circuit, the answer is that of a different circuit; Theorem 4 says how small it must be.
  • No operating point. When F=0F = 0 has no solution, every gmin circuit still has one, so success at each step proves nothing about the end; node voltages that grow like 1/γ1/\gamma are the sign.

Exercises

  1. For the circuit of a current source II into a diode, write H(v,γ)=0H(v, \gamma) = 0 and show that v(γ)v(\gamma) is decreasing in γ\gamma for I>0I > 0.
  2. Prove Theorem 2 for a circuit without voltage sources directly from (∗)(\ast), and show that the bound is reached by a single linear resistor.
  3. Give a circuit with two nodes, one diode and one resistor for which μ\mu of Theorem 4 is zero, and compute e(γ)−e∗e(\gamma) - e^\ast exactly.
  4. For the tunnel-diode law g(v)=v3−6v2+10vg(v) = v^3 - 6v^2 + 10v driven by 66 V through 1 Ω1\ \Omega, write γ\gamma as a function of vv along the gmin path and decide which of the three operating points the path from γ=∞\gamma = \infty reaches.

References

  1. Farid N. Najm, Circuit Simulation, Wiley-IEEE Press, 2010, Chapter 4, Section 4.4.4 (gmin stepping) and Section 4.4.6 (the justification of the continuation methods)
  2. ngspice source, src/spicelib/analysis/cktop.c, the functions spice3_gmin (fixed factor steps) and dynamic_gmin (adaptive factor), which set CKTdiagGmin and remove it at the end
  3. James M. Ortega and Werner C. Rheinboldt, Iterative Solution of Nonlinear Equations in Several Variables, SIAM Classics in Applied Mathematics 30, 2000 (first published 1970), Section 6.4, the uniform monotonicity theorem (a continuous, uniformly monotone map of R^n onto itself has exactly one zero)
  4. Robert C. Melville, Ljiljana Trajković, San-Chin Fang and Layne T. Watson, Artificial parameter homotopy methods for the DC operating point problem, IEEE Transactions on Computer-Aided Design 12(6), 861 to 877, 1993, the conductance homotopies for the operating point problem and the conditions under which their paths reach a solution

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW3 standard
  • five exercises