Forums

LT Spice, ringing LC

Started by John Larkin July 26, 2015
On 26/07/2015 18:11, John Larkin wrote:
> On Sun, 26 Jul 2015 11:41:58 -0500, John S <Sophi.2@invalid.org> > wrote: > >> On 7/26/2015 11:26 AM, John Larkin wrote: >>> >>> >>> 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. >> >> 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.
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
On 7/26/2015 8:34 PM, John Larkin wrote:
> 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.
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).
On 7/27/2015 3:01 AM, R wrote:
> On 7/26/2015 8:34 PM, John Larkin wrote: >> 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. > 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.