Keyboard Shortcuts
ctrl + shift + ? :
Показати всі комбінації клавіш
ctrl + g :
Не доступний для безкоштовних груп.
ctrl + shift + f :
Знайти
ctrl + / :
Сповіщення
esc to dismiss
Лайки
Пошук
After all these years ...
... No one has come up with the real reason for this behavior: I run a simulation where a resistor has a value of 51.7K. The first 30% or so of the simulation completes in the blink of an eye then slows down to 25ns/s. If I change that one resistor value to 51.71K, the whole simulation completes without a hitch! Why does adding 10 ohms, a less than 0.02% change in value in this case, make such a difference? This doesn't just apply to LTspice - it's been something people have complained about since Berkely SPICE was invented. I've yet to hear anyone give one definitive answer.
Sure, in my case, this is no big deal, except when I try to step the resistance value or run a Monte Carlo analysis on the circuit. If that particular resistance hits the magical 51.7K, the whole thing comes to an essential standstill. Any thoughts, anyone?
Thanks,
John
|
It's practically bound to be because some
internal variable in the SPICE calculation has an extreme
gradient just around that particular value of the input quantity
51.7 k. What happens with 51.69 k? Exactly what causes the
extreme gradient is more difficult to pin down, but it might be
due, for example, to a term x - y in a denominator, where x is
very nearly equal to y. On 2024-12-08 18:57, John Waugaman via
groups.io wrote:
-- OOO - Own Opinions Only Best Wishes John Woodgate Keep trying |
Or, phrased a little differently: the condition number of the MNA circuit matrix expresses how sensitive the circuit outputs are with respect to changes in the parameters (components). The condition number depends on the ratio of matrix entries, and the simultaneous presence of very small and very large impedances (milli- to Giga Ohms) almost certainly leads to a high condition number. As a CN of 1,000 ... 100,000 is not uncommon, it is very well possible that a change of 0.1% in one component causes a change in an output of 1 ... 100%. SPICE monitors errors and may try to correct by decreasing the simulation step-size, which does not always work but is guaranteed to decrease simulation speed.
A high condition number is the most common problem in SPICE. The fix at the user level is to increase/decrease impedances that are unrealistically small/large, and/or put small capacitors in parallel to high-impedance nodes. Indeed, the effect of CN is very noticeable when doing sensitivity and MC analyses. This is because it is not always clear how sensitive a circuit is (that is the point of the analysis), so parameter ranges are chosen 'blindly' and without taking interactions into account. -marcel |
Folk,
переключити цитоване повідомлення
Показати цитований текст
I know I am probably way way way of course, but I feel its important to note you can't actually increase a value by 0.01. The underlying maths will use binary floating point and 0.01 doesn't have an exact equivalent. Of course LTspice may be using scaled values where .01 is scaled so its a value that does map exactly... Dave On 08/12/2024 21:11, mhx via groups.io wrote:
Or, phrased a little differently: the condition number of the MNA circuit matrix expresses how sensitive the circuit outputs are with respect to changes in the parameters (components). The condition number depends on the ratio of matrix entries, and the simultaneous presence of very small and very large impedances (milli- to Giga Ohms) almost certainly leads to a high condition number. As a CN of 1,000 ... 100,000 is not uncommon, it is very well possible that a change of 0.1% in one component causes a change in an output of 1 ... 100%. SPICE monitors errors and may try to correct by decreasing the simulation step-size, which does not always work but is guaranteed to decrease simulation speed. |
There is good stuff on this at: https://blogs.mathworks.com/cleve/2017/07/17/what-is-the-condition-number-of-a-matrix/ Scroll down to 'Close to singular', which
shows a very small change in a value that has dramatic effects. On 2024-12-08 21:11, mhx@... wrote:
Or, phrased a little differently: the condition number of the MNA circuit matrix expresses how sensitive the circuit outputs are with respect to changes in the parameters (components). The condition number depends on the ratio of matrix entries, and the simultaneous presence of very small and very large impedances (milli- to Giga Ohms) almost certainly leads to a high condition number. As a CN of 1,000 ... 100,000 is not uncommon, it is very well possible that a change of 0.1% in one component causes a change in an output of 1 ... 100%. SPICE monitors errors and may try to correct by decreasing the simulation step-size, which does not always work but is guaranteed to decrease simulation speed. A high condition number is the most common problem in SPICE. The fix at the user level is to increase/decrease impedances that are unrealistically small/large, and/or put small capacitors in parallel to high-impedance nodes. Indeed, the effect of CN is very noticeable when doing sensitivity and MC analyses. This is because it is not always clear how sensitive a circuit is (that is the point of the analysis), so parameter ranges are chosen 'blindly' and without taking interactions into account. -marcel -- OOO - Own Opinions Only Best Wishes John Woodgate Keep trying |
On Sun, Dec 8, 2024 at 01:57 PM, John Waugaman wrote:
When that happens, it is almost definitely (if not absolutely) because of the nonlinear parts of your circuit. When the resistor was 51.7 K, apparently it hits the nonlinear element(s) just right (i.e., wrong) that they can't solve quickly. Maybe you hit an inflection point in its I/V curve. Maybe you hit a point where it could not solve without a larger error estimate, forcing LTspice/SPICE to back up and try again and again with smaller timesteps.
The resistors themselves don't matter. Resistors are linear and behave exquisitely in mathematical analysis. It was something else in your circuit that ran into the trouble, as a consequence of hitting it at just the wrong place.
In SPICE, functions (e.g., the I/V function of a nonlinear component) must be continuous and have continuous first derivatives. Many SPICE models today have inflection points where the derivative is not continuous, and that spells trouble. The derivative tells SPICE where to try next (e.g., which direction and by how much), and if the derivative changes abruptly, it can make SPICE ratchet back and forth almost forever, always missing the point where it ought to go next.
I once saw a rare case where SPICE found itself exactly synchronized with a PULSE waveform's stimulus, in such a way that it missed the pulses. Then if I changed anything, it lost sync (a good thing) and was able to resolve the signal correctly. This just illustrates that sometimes even the smallest of changes can have profound effects, when things are just right, - or wrong.
Andy
|
On Sun, Dec 8, 2024 at 04:36 PM, Dave Wade wrote:
... I feel its important to I think you are off by several orders of magnitude. LTspice uses double precision floating point, giving it a resolution of at least 53 binary bits or about 16 orders of magnitude. Changing something by 0.01 is child's play. Changing it by 0.0000000000000001 might not work as expected.
Of course LTspice may be using scaled values where .01 is scaled so itsNo you are right that values are never exactly exact. Well, almost never. Andy
|
On 08/12/2024 19:57, John Waugaman via
groups.io wrote:
My thoughts are that I don't now what you're talking about, because as far as I can see, you haven't uploaded anything we can look at and appraise. Most likely, the issue has nothing to do with the resistor, and everything to do with something else. If that doesn't change, no one will ever come up with the "real reason". Just as a provocation, I uploaded a simple schematic that has no trouble with a resistor of 51k7: Mystery_R_Value. Any thoughts? -- Regards,
Tony |
On Sun, Dec 8, 2024 at 04:36 PM, Dave Wade wrote:
Folk, I think I understand now what you (Dave Wade) are saying. You are right that the Delta might not be exactly 0.01 (i.e., 0.01000000000000000) because that Delta might not be exact when put in binary format.
But it is way off course, and not related to John Waugaman's original question. Whether he changed the resistor's value by 0.01000000000000000 or by 0.00999999999999999 (or whatever), it is not what caused SPICE to slow down for him. It was in the rest of his circuit, especially the nonlinear parts, that caused the slowdown when the resistor's value was just right (or wrong).
Andy
|
I'm not a math expert, I'm an engineer but I understand the potential issues with large scale matrix math. LTspice has 3 different integration methods, trap, modified trap and gear. The trap method can have glitches as an artifact of trap ringing, modified trap which has post processing to remove the ringing and gear takes longer and imposes some artifical numerical dampening on the circuit, which can make unstable circuits look stable in simulation. In my experience, issues on this type occur when using trap or modified trap not gear. Changing the integration method is usually one of the first things I do. |
Повідомлення
Більше
Додаткові параметри
Більше
to navigate to use esc to dismiss