The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 21st, 2024, 7:29pm
Pages: 1
Send Topic Print
KCL: Spectre versus other simulators (Read 10578 times)
Visjnoe
Senior Member
****
Offline



Posts: 233

KCL: Spectre versus other simulators
Feb 09th, 2007, 1:25am
 
Dear,

I recently read in one of Ken Kundert's presentations that only Spectre respects KCL...I looked at the convergence criterium and realized this was true and I subsequently checked the manuals of HSPICE and ELDO:
they indeed do not guarantee KCL!

However, I was wondering, are there any 'real life' situations where this can cause real misconceptions about
the circuit's performance?

Another engineer responded to me this is  not big of an issue because 'most circuits contain a lot of high impedant nodes'.

I think this statement actually is wrong and that circuits with high impedant nodes will cause more severe simulations errors due to errors in the calculated currents...but I'm really on a slippery path here, it's just reasoning based on Ohm's law....

Any comments welcome...

Kind Regards

Peter

ps: I recently observed some strange behavior with a high-Q crystal oscillator using HSPICE...played around with all accuracy settings and nothing helped. The waveforms looked very weird, physically impossible. Then, we switched to Spectre and out came nice sinusoids (I expected the simulator (HSPICE) was wrong all along). I'll post some pics in the near future.
Back to top
 
 
View Profile   IP Logged
topquark
Community Member
***
Offline



Posts: 61
Thames Valley, UK
Re: KCL: Spectre versus other simulators
Reply #1 - Feb 9th, 2007, 5:15am
 
Hspice doesn't obey KCL?!  :o
This's news to me...having raised on a diet of spice in all flavors in school.

I thought spice does indeed solve nodal equations in matrix form [V][G]=[I]

Then, I learnt different simulators used different algorithms/methods to arrive at the solution.

Kindly enlighten if I'm missing some fundamental nevertheless non-trivial stuff

Thanks,
Gau
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: KCL: Spectre versus other simulators
Reply #2 - Feb 12th, 2007, 5:51am
 
topquark wrote on Feb 9th, 2007, 5:15am:
Hspice doesn't obey KCL?!  :o
This's news to me...having raised on a diet of spice in all flavors in school.


The claim is that Spectre *enforces* KCL, and (most?) other simulators don't.  All of them obey KCL, but only to within tolerances.

The problem with Spice is that it checks the *change* in the currents rather than the actual currents.  Spice doesn't actually compute the currents themselves; it computes the Spice Right-Hand-Side vector, which is a combination of the currents and the Jacobian matrix times the V-vector on the current iteration.  That way, when you solve the matrix, you get the next V vector directly.

If you compute the currents as the RHS, then you are solving for "deltaV", the update that needs to be added to the current V-vector.

You might want to write out the equations -- do a Taylor expansion of F(V) = 0 where F(V) is the vector of "currents" (also includes v-source branch voltages and such).  J = Jacobian of F.  So, you have V(k) on the kth iteration, solve for V(k+1).

Anyway, there are some cases where V changes only slightly between iterations (so the VNTOL check passes) and "deltaI" only changes slightly (so the ABSTOL check passes), but I is not close enough to zero.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
Visjnoe
Senior Member
****
Offline



Posts: 233

Re: KCL: Spectre versus other simulators
Reply #3 - Feb 12th, 2007, 8:51am
 
Dear Geoffrey,

is the situation more dramatic for high impedant nodes or not? I would guess it is...

Kind Regards

Peter
Back to top
 
 
View Profile   IP Logged
byang
Community Member
***
Offline



Posts: 46

Re: KCL: Spectre versus other simulators
Reply #4 - Feb 12th, 2007, 9:50am
 
If the nodes are of high impedance, it means when voltage change is small, current change is still big. So for error control, seems like you can also just tighten the error tolerance if the Spice simulator doesn't check TCL.

byang
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: KCL: Spectre versus other simulators
Reply #5 - Feb 12th, 2007, 3:29pm
 
All circuit simulators perform two convergence checks, one on the voltages and one on the currents. Typically, on high impedance nodes the voltage check is more important because small changes in current produce large changes in voltage. On low impedance nodes it is the current check that is more important.

When checking the voltage there is no absolute reference to compare against. That is because the simulator does not know the true solution, it only has its estimate of what it thinks the solution is. So, the simulator performs a check not on V, but on ΔV. It check to see whether the change between the current iteration and previous iteration is small.

The situation is different with currents. There we know that KCL applies, that Σi = 0. This is an absolute reference that we can check against. However, it is my understanding that still, Spectre is the only simulator that actually checks this. All the other simulators check Δi, meaning that they check that the change in current computed between the current iteration and previous iteration is small.

This causes two problems. First, the simulator will generate a solution that violates KCL by an unknown and unbounded amount (with Spectre that amount is bounded by the tolerances). With charge storage circuits this error will tend to accumulate, manifesting itself as a lack of charge conservation. While it is possible to reduce the problem by tightening tolerances, since there is no absolute control of the error, one never knows how tight to make the tolerances.

The second problem is more rare but also more problematic. Spectre uses one absolute check and one delta check. The absolute check is important because it assures that you are close to a solution. SPICE uses two delta checks. The problem is that if something causes the convergence to slow, then both checks can be satisfied even though the simulator is far from the solution. In one case I found that SPICE produced a result that had a regular analog IC dissipating over 300 W. When I tracked down the power, it was all in one transistor stack. SPICE said 10 A was flowing into the top transistor with only a few microamps flowing out. This is more likely to happen if there are bugs in the model, but cannot be ruled out even when the models are perfect.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
byang
Community Member
***
Offline



Posts: 46

Re: KCL: Spectre versus other simulators
Reply #6 - Feb 12th, 2007, 4:31pm
 
For the rare case where 10 A was flowing into the top transistor with only a few microamps flowing out, the mismatch should be reflected in right hand side, i.e. the residue. Then it should also be reflected in delta v (note that delta v, not v) solution of the circuit equation.

So if the error control doesn't use a loose global reference for computing relative error, seems like the delta v error checking should also be able to catch this violation.

When one uses global maximum reference for error checking, I think there are rare cases that Spectre can also converge to a false solution. The range of current variation could be huge. I have been fighting convergence problem for a long time, not easy to find an optimal solution Smiley

byang
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: KCL: Spectre versus other simulators
Reply #7 - Feb 12th, 2007, 6:35pm
 
Choose a completely arbitrary set of node voltages for a circuit. This set is not a solution and so when applied to the components of a circuit it will result in currents that do not satisfy KCL. Now assume that the Jacobian is such that the Newton update is very small. Say it is infinitesimal. In this case, the delta checks will pass indicating that this arbitrary set of node voltages is a solution but Spectre's KCL check will fail indicating that it is not a solution.

The bottom line is that the delta check are looking for motion; stop the motion and they pass regardless of whether a solution is found or not. Spectre's KCL check is actually looking for the solution and will only pass when at or near the solution.

In this regard, Spectre's KCL check is clearly better than SPICE's delta check. And from personal experience, I have suffered false convergence with SPICE and I have never seen Spectre exhibit false convergence, even though I am a heavy user of Spectre and only use SPICE very occasionally.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
byang
Community Member
***
Offline



Posts: 46

Re: KCL: Spectre versus other simulators
Reply #8 - Feb 12th, 2007, 7:29pm
 
Hi, Ken,

Thank you for the example. I still have one question for the example with "a completely arbitrary set of node voltages":

How easy is it for the delta v to be small pratically speaking? I can think of a way to make the delta v appear small. If we artifically raise all voltage nodes by 100V, we can modify the circuit equation accordingly to have the same delta v solution. (Voltage is potential.) In this case, then of course the delta v will be small and it is very easy for false convergence to happen. However, how should one check KCL error in this case? If one uses C*V in the reference for computing KCL relative error, the KCL error is also artifically "deflated" and we can't rule out false convergence completely. Then if the absolute value of V is small, the delta v will also appear small if local error criteria is used.

I agree that KCL checking shuold be useful. It should have something to do with the condition number of the matrix (having both very high impedance node and very low impedance node in the same circuit?). Just not sure how often KCL makes a difference in practice assuming strict local error checking. Note that if one checkes LTE error, it is another safeguard after the delta v error checking.

byang
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: KCL: Spectre versus other simulators
Reply #9 - Feb 12th, 2007, 11:55pm
 
The point I have been trying to make is that if the simulator does not check KCL, then false convergence can occur regardless of how tight the tolerances are. And it has nothing to do with scaling issues.

Even if we put aside  the issue of false convergence, if a user has to count on tight tolerances to make up for the error that results from not assuring KCL is satisfied, then their simulations are going to run considerably slower for the same accuracy. This is particularly true if one is counting on LTE controls (which force small time steps) to reduce the error.

Each simulator trades off speed and accuracy. You can always get more accuracy at the cost of running slower, or you can run faster at the cost of less accuracy. However, the figure of merit for a simulator is how much accuracy does it provide at a given speed or how much speed does it provide for a given accuracy. Simulators that do not assure that KCL is satisfied (SPICE) have a significantly lower figure of merit than simulators that do (Spectre) on circuits where charge conservation is important (charge storage circuits).

Personally, the idea of using a simulator that does not assure that KCL is satisfied just seems silly to me.

Currents summing to zero at a point. It's not just a good idea, its the law!

-Ken
Back to top
 
 
View Profile WWW   IP Logged
topquark
Community Member
***
Offline



Posts: 61
Thames Valley, UK
Re: KCL: Spectre versus other simulators
Reply #10 - Feb 13th, 2007, 2:23am
 
Ken, Geoffrey, Byang :

Some illuminating discussion there!
Kirchoff's surely missing all this  ::)
Thanks for clarifying some basic ideas on the topic.
Now, I can appreciate better why something didn't converge.

i just noticed this 'rforce' setting which affects the initial conditions (in my case, voltage on a cap)
I get a warning like :"Initial condition computed for node Vin is in error by 12.475 uV.
To reduce error in computed initial conditions, decrease `rforce'.
       However, setting rforce too small may result in convergence
       difficulties or in the matrix becoming singular."
So, does this delta V affects delta I and hence convergence, right?
'rforce' seems innocous but anything more to it in this context?

Thanks!
Gau
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: KCL: Spectre versus other simulators
Reply #11 - Feb 13th, 2007, 10:04am
 
byang wrote on Feb 12th, 2007, 7:29pm:
However, how should one check KCL error in this case? If one uses C*V in the reference for computing KCL relative error, the KCL error is also artifically "deflated" and we can't rule out false convergence completely.


C*V is not used. The relative tolerance has to be set based on numerical precision: ie, if you add currents of 1e+30 amps and -1e30 amps, you can't expect the sum to be less than abstol; so you take the largest value of current injected into a node and use that to set your relative tolerance.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
rgcii
New Member
*
Offline



Posts: 3
SoCal
Re: KCL: Spectre versus other simulators
Reply #12 - Mar 16th, 2007, 10:15pm
 
I noticed that for certain bias conditions, the current through a bsim3v324 transistor is very sensitive to the value of "gmin" in HSPICE, about 30% when gmin=1e-12 versus value when gmin=0, but shows very little sensitivity, in the 4th digit, to "gmin" in Spectre.  Is that because of this error checking, or is there some difference in the way "gmin" conductances are connected within the bsim3 models in HSPICE versus Spectre?  Which nodes have the "gmin" connections in each simulator? Huh

Glenn
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: KCL: Spectre versus other simulators
Reply #13 - Mar 17th, 2007, 12:24am
 
Gmin is a different topic from KCL, and in general it is a good idea to start a new thread when changing the subject.

But yes, Spectre applies Gmin in a different way than SPICE or HSPICE. The SPICEs connect the Gmin conductor across the substrate junctions (bulk to source and bulk to drain), while Spectre connects it from source to drain.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.