LT Spice, ringing LC

Jul 26, 2015 12 Replies

This is fun. The LC should ring at 1 Hz, but in the default Spice sim, it's low by about 1800 PPM. You have to crank the time step down to 10 us to get the error down below 10 PPM, and the sim gets really slow. Which illustrates the futility of trying to do accurate sims of high-Q circuits in the time domain.


Version 4 SHEET 1 880 680 WIRE 224 -192 64 -192 WIRE 416 -192 224 -192 WIRE 480 -192 416 -192 WIRE 64 -112 64 -192 WIRE 416 -112 336 -112 WIRE 480 -112 416 -112 WIRE 336 -80 336 -112 WIRE 224 -64 224 -192 WIRE 288 -64 224 -64 WIRE 288 -16 224 -16 WIRE 64 16 64 -32 WIRE 336 32 336 0 WIRE 224 112 224 -16 WIRE 224 112 64 112 WIRE 320 112 224 112 WIRE 416 112 320 112 WIRE 480 112 416 112 WIRE 64 160 64 112 WIRE 320 160 320 112 WIRE 224 176 224 112 WIRE 64 288 64 240 WIRE 224 288 224 240 WIRE 320 288 320 240 FLAG 224 288 0 FLAG 320 288 0 FLAG 64 288 0 FLAG 64 16 0 FLAG 336 32 0 FLAG 416 -112 DIFF FLAG 416 -192 IDEAL FLAG 416 112 LC SYMBOL ind 304 144 R0 WINDOW 0 47 100 Left 2 WINDOW 3 -2 185 Left 2 SYMATTR InstName L1 SYMATTR Value 0.159154943 SYMBOL cap 208 176 R0 WINDOW 0 29 70 Left 2 WINDOW 3 -73 154 Left 2 SYMATTR InstName C1 SYMATTR Value 0.159154943 SYMBOL current 64 160 R0 WINDOW 0 -70 50 Left 2 WINDOW 3 -165 99 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName I1 SYMATTR Value PULSE(1 0 1) SYMBOL voltage 64 -128 R0 WINDOW 0 -109 61 Left 2 WINDOW 3 -188 104 Left 2 WINDOW 123 0 0 Left 2 WINDOW 39 0 0 Left 2 SYMATTR InstName V1 SYMATTR Value SINE(0 1 1 1) SYMBOL e 336 -96 R0 WINDOW 0 60 40 Left 2 WINDOW 3 53 74 Left 2 SYMATTR InstName E1 SYMATTR Value -100 TEXT -208 80 Left 2 !.tran 0 25 0 TEXT -272 -176 Left 2 ;LT Spice LC Simulation TEXT -232 -136 Left 2 ;JL July 2015


John Larkin Highland Technology, Inc lunatic fringe electronics jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Maybe I'm wrong, but your LC resonance is actually

0.999999999422604576498614831 Hz.

Would that not explain it?

No, that's just the rounding error of my HP32 calculator, parts per billion. The default sim frequency is off by about 2 parts per thousand.

I think there's an optimum time step, and smaller steps make things worse again. But it would take hours or days to prove that.

John Larkin Highland Technology, Inc lunatic fringe electronics jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

I guess so. I just plugged in 0.1591549430918953357688837634 for each of your reactances and got pretty much the same display.

LC comes out to 1.000507xxxx on my end..

That may explan it. done on a FX7400G Jamie

Maybe I'm missing something. His L is 0.159154943 and his C is

0.159154943. How does that come out to your number?

That's pretty typical for difference equation approximations to continuous time. In FDTD codes like my clusterized simulator, you have to dork the value of c in order to get the results right. Fortunately the right value is easy to calculate.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

Well, maybe because I used short term 2*Pi. (6.28) Which is what I generally use..

I just did it doing full PI and I get something on the order of

1.0000000001, I didn't count the zeros, but the last one was "1"

I guess that still does not come out to what you got.

Jamie

Oh! I think I understand. You're saying 1/2/pi/sqrt(LC) is your number (1.00000....). Yes? Okay, I dig it.

TTCalc says the resonant frequency is

0.999,999,999,422,604,576,498,614,831

Hz. My point was that the time step matters, and the default LT Spice sim is way, way off.

John Larkin Highland Technology, Inc lunatic fringe electronics jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

You are up against the limitations of numerical methods here. The matrix formulation of the circuit coupled with the need to solve a pure second order differential equation makes life tricky for the solver.

Computing numerical derivatives is the work of the devil - integrating is easier but the sweet spot for the optimum result vs effort expended is small.

You generally do best with ODE solvers when the timestep is somewhere around sqrt(eps)*period where eps is the smallest machine representable number although for a second order ODE solved crudely as consecutive first order ones it might be nearer eps^(1/3)*period.

TBH I'm impressed that by default it is only 0.2% out in the time domain given that it isn't really geared to solving resonance problems.

BTW Is some of the lower resonance frequency not coming from series resistance, parasitic capacitance and lead inductance in the LTspice model components or are you feeding it ideal perfect ones?

Again this unrealistic situation will make life harder for the solver.

Regards, Martin Brown

Hi,

resonant frequency is calculated as: f = 1/(2*pi *sqrt(L*C)) your result is exact reciprocal value or 2*pi*sqrt(L*C).

Yup. Both John and I forgot to take the reciprocal.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required