Forums

LT Spice, ringing LC

Started by John Larkin July 26, 2015

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

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?
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. -- John Larkin Highland Technology, Inc lunatic fringe electronics jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
On 7/26/2015 12:11 PM, 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 guess so. I just plugged in 0.1591549430918953357688837634 for each of your reactances and got pretty much the same display.
In article <vh1ara9eijdef9r1eq9if6vq5nfnnn5ldl@4ax.com>, 
jlarkin@highlandtechnology.com says...
> > 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. >
LC comes out to 1.000507xxxx on my end.. That may explan it. done on a FX7400G Jamie
On 7/26/2015 12:27 PM, M Philbrook wrote:
> In article <vh1ara9eijdef9r1eq9if6vq5nfnnn5ldl@4ax.com>, > jlarkin@highlandtechnology.com says... >> >> 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. >> > 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?
On 7/26/2015 1:11 PM, 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.
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
In article <mp35ai$d3i$4@dont-email.me>, Sophi.2@invalid.org says...
> > On 7/26/2015 12:27 PM, M Philbrook wrote: > > In article <vh1ara9eijdef9r1eq9if6vq5nfnnn5ldl@4ax.com>, > > jlarkin@highlandtechnology.com says... > >> > >> 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. > >> > > 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?
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
On 7/26/2015 12:44 PM, M Philbrook wrote:
> In article <mp35ai$d3i$4@dont-email.me>, Sophi.2@invalid.org says... >> >> On 7/26/2015 12:27 PM, M Philbrook wrote: >>> In article <vh1ara9eijdef9r1eq9if6vq5nfnnn5ldl@4ax.com>, >>> jlarkin@highlandtechnology.com says... >>>> >>>> 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. >>>> >>> 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? > > 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.
On Sun, 26 Jul 2015 12:53:02 -0500, John S <Sophi.2@invalid.org>
wrote:

>On 7/26/2015 12:44 PM, M Philbrook wrote: >> In article <mp35ai$d3i$4@dont-email.me>, Sophi.2@invalid.org says... >>> >>> On 7/26/2015 12:27 PM, M Philbrook wrote: >>>> In article <vh1ara9eijdef9r1eq9if6vq5nfnnn5ldl@4ax.com>, >>>> jlarkin@highlandtechnology.com says... >>>>> >>>>> 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. >>>>> >>>> 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? >> >> 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