Electrical – LTSpice resonant circuit simulation non-idealities

ltspicesimulation

I just simulated the following circuit in ltspice XVII:

enter image description here

A parallel resonant circuit is tuned to 125KHz with varying capacitor sizes. Then a voltage divider is formed with a resistor.

These are my settings for the inductor, capacitor and in the Tool Panel. In my understanding, this should now simulate an ideal inductor without losses and the same for the capacitor.

enter image description here

Using ordinary AC-calculation, the voltage over the resonant circuit should be:

$$ V_{res} = V1 * \frac{\frac{1}{\frac{1}{j \omega L} + j \omega C}}{R + \frac{1}{\frac{1}{j \omega L} + j \omega C}} $$
$$ = V1 * \frac{1}{R*(j \omega C + \frac{1}{j \omega L}) + 1} = V1 * \frac{1}{j R*(\omega C – \frac{1}{\omega L}) + 1} $$
$$ \Rightarrow V_{res} = V1 \quad \forall \quad \omega C = \frac{1}{\omega L} \Rightarrow L = \frac{1}{C \omega^2} $$

So at resonance, when \$ \omega C = 1/(\omega L) \$ the resonant circuit poses an infinite resistance and \$ V_{res} = V1 \$.

However, LTSpice gives the following simulation results (where smaller C values yield larger amplitudes):

enter image description here

Now I'm wondering how this is calculated by LTSpice. Are there any non idealities that I didn't switch off? Or am I missing something in my calculation?

Any hints would be very appreciated,
Thanks in advance.

Best Answer

ltspice (or any simulator really) is only an approximation to both, reality and ideal components. Reality because it can not model all the details reality depends upon, and ideal because it can not run with infinite precision in values and time.

Basically how any spice works is that for the next timestep it checks all involved complex formulas and matrices, and if they converge within the required number of iterations into values with error tolerances below those specified with the *tol options, then it will go on. If not, it will lower the timestep and try again, until it either reaches a limit and errors out, or the tolerance is met.

reltol is the paramter used to specify a certain accepted error relative to the next timestep. The error is estimated using a polynomial to "predict" the value at the next chosen timestep, then it is actually computed there, and the difference taken. If its too big, make the timestep smaller.

This also means that instead of those parameters, you can make the simulation more accurate by forcing a really small timestep like 1n but that makes things really really slow, the dynamic timestep feature is one of the things that make it much faster.

Together with trtol (which specifies a factor on overestimation of the actual error) these are the major knobs you want to play with to either make the simulation more accurate, or faster.

Additionally, ltspice internally uses floats, so sometimes .opt numdgt=7 (anything over 6) is needed to force it to use doubles instead, which may or may not make things more accurate.

Related Topic