Suppose there is a nonlinear circuit with the vastly different time constants. An example could be RF oscillator; the time scale of events is a fraction of RF period; whereas the RC bias time constant is somewhat 10M times slower then the period.
When simulating this circuit in *.SPICE, is there any loss of accuracy due to accumulation of the very small increments in a part with the long time constant? Is there any way to estimate that sort of accuracy loss?
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
formatting link
Didn't find your answer? Ask the community — no account required.
T
Tim Wescott
Spice is pretty good at sensing that situation and really cutting down the simulation interval. You can tell if you're "there" by cutting it down yourself and seeing if there is any difference -- if cutting the interval improves things then you're still getting inaccurate results (at least until you start screwing things up because of numerical accuracy issues).
LTSpice is superlative for modeling oscillators. They've basically rewritten the SPICE simulation engine to make it good for modeling switching supplies; whatever they did for that makes it good for modeling oscillator start-up, too.
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html
V
Vladimir Vassilevsky
That "cutting down similation interval" is what I am worried about. It should have the similar effect as the loss of precision in the digital filters when Fc/Fs is too high.
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
formatting link
J
John Larkin
Probably not. Spice generally uses double floats, which have lots of dynamic range.
The bigger problem is that you need small time steps to model the fast bits accurately, so if there are also slow things going on, the sim may take a long time - hours maybe - to settle out. Things with high Qs, like crystal oscillators, are especially nasty. I simulate XOs mostly in the frequency domain, which is fast.
You can sometimes force some initial conditions to jump ahead in time.
To resolve time-step and math resolution effects, just run a few sims with different time steps. If the results are the same, you're not bumping up against any artifacts.
John
V
Vladimir Vassilevsky
Speaking very approximately, a traditional digital filter of the Nth order looses the dynamic range as Q*(Fc/Fs)^N. So, if the timeconst ratio is 10M, then the filter of the only 2nd order will gobble the double float precision. I don't know if this consideration is valid for the SPICE engine though.
Yes, yes, yes. A comprehensive simulation of something like RF OFDM amplifier could take weeks. It is faster to try the things on the prototype.
That assumes the reasonable linearity; when you are after nonlinearities, there is no choice.
You can also tweak the RELTOL and other tolerances; they have the pronounced effect on the speed vs accuracy.
Can you recommend a good book about the details of the SPICE engine?
Vladimir Vassilevsky DSP and Mixed Signal Design Consultant
formatting link
J
John Larkin
For things like XOs, I run a coarse time-domain sim, with fudged initial conditions, to get the amplitudes and bias and such. Then switch to frequency domain to get the phases and slopes right and estimate TC and such. I haven't found a way to, say, measure an oscillator frequency to sub-PPM levels while running time domain. In the frequency domain, you can find the oscillation frequency to ppb levels.
No, sorry, I'm not a Spice jock. I just futz with it now and then.
John
J
Joel Koltner
When you say "frequency domain," do you mean by using, e.g., a harmonic balance simulator? Or just using small-signal AC analysis (like SPICE)? In the later case, at least in my experience, the predicted oscillation frequency is always a little bit off of what the real circuit would do (even with perfect tolerance components) because of the "dynamic bias changes" caused by larger signals that SPICE AC analysis doesn't take into consideration.
---Joel
J
Jim Thompson
True. Also deviation from real world because the modeling cannot possibly include all strays.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona 85048 Skype: Contacts Only | |
| Voice:(480)460-2350 Fax: Available upon request | Brass Rat |
| E-mail Icon at http://www.analog-innovations.com | 1962 |
I love to cook with wine Sometimes I even put it in the food
J
John Larkin
I mean just AC Spice analysis. For something like an XO, you can optimize and beautify the open-loop phase-vs-frequency slope, see the exact zero-phase crossing frequency, see the effects of parts variations and tc's, stuff like that. Of course the frequency you simulate won't be exact, but it won't be exact in real life, either; accurate crystal oscillators are always trimmed.
John
O
oopere
To simulate this kind of circuits, the best approach is to make use of tools that directly compute the steady state without having to integrate the equations during the (long) transient. You may choose among time domain techniques:
-Shooting methods: you try to guess (Newton) the initial state that starts the circuit directly in the steady state.
-Discrete time techniques: you try to find (again, Newton and derivatives) a set of N samples of the circuit waveform in the steady state.
or, in the frequency-domain:
-Harmonic balance: you try to find (idem) the amplitude and phase (or real and imaginary part) of N harmonics of the solution in the steady state.
That said, PSpice should give you the "right" answer in spite of the largely different time constants, provided you are able to wait long enough and have a way to detect when you are in the steady state (which is by no means obvious in this kind o f circuits). However, to provide useful results in this kind of circuits (strong nonlinearity), you have to manually limit the time step to something reasonable (from 10 to 100 samples per RF period), which increases simulation time.
A reasonably good book on PSpice details is Kenneth S. Kundert's "The Designer's Guide to SPice & SPectre". I seem to recall another title "Inside PSpice (or similar)" but I can't dig it up right now.
J
Jim Thompson
[snip]
Here's a nice listing...
formatting link
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus |
| Phoenix, Arizona 85048 Skype: Contacts Only | |
| Voice:(480)460-2350 Fax: Available upon request | Brass Rat |
| E-mail Icon at http://www.analog-innovations.com | 1962 |
I love to cook with wine Sometimes I even put it in the food
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.