Electronics-Related.com
Forums

SPICE tarnsient analysis of oscillators - sampling time

Started by Unknown March 5, 2019
On Thu, 7 Mar 2019 18:56:01 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>"Steve Wilson" wrote in message >news:XnsAA0AB68B337B6idtokenpost@69.16.179.22... > >John Larkin <jjlarkin@highland_snip_technology.com> wrote: > >> On Wed, 06 Mar 2019 19:51:36 GMT, Steve Wilson <no@spam.com> wrote: >> >>>John Larkin <jjlarkin@highlandtechnology.com> wrote: >>> >>>> After 10 cycles, I see about 500 PPM in my LC. Not so different. It >>>> means that you might not want to design crystal oscillators in time >>>> domain. >>> >>>You need time domain to adjust the crystal drive. Too little and the >>>oscillator may not start. Too much and you may fracture the crystal. >>> >>>You cannot get this information any other way. >>> >>>Crystal oscillators have a long startup time due to the high Q. You >>>cannot make meaningful measurements after hundreds of milliseconds of >>>cycles. I show how to bypass the long startup in my oscillator.zip >>>article which you ignored >>> >>>https://drive.google.com/open?id=1ZsbpkV0aaKS5LURIb1dfu_ndshsSaYtf >>> >>>>>Always specify the maximum time step. >>> >>>> The thing I remember about my previous much-maligned dual sine wave >>>> experiment is that setting a small dt fixed the frequency error. So it >>>> wasn't a simple ESR problem. I'll try to find that one. >>> >>>Your problem was ESR. You took the difference between the LC and the >>>sine signals but you didn't know the default ESR for an inductor is 1 >>>milliohm. So the LC signal decayed. Your measurement cannot tell the >>>difference between phase and amplitude changes and you came to the wrong >>>conclusion. >>> >>>> LT Spice is mathematically chaotic, especially when it uses its >>>> default time step algorithm. There are probably cases that are >>>> especialy bad, and maybe I get lucky finding them. I am usually lucky. >>> >>>LTspice repeats exactly given the same data. There is nothing chaotic >>>about it. >>> >>>Always specify the maximum time step. >>> >>>> I'm not doing anything wrong. I design electronics and most of it >>>> works first time, and we sell it. >>> >>>That has nothing to do with the topic. >>> >>>> You just have to be careful when you drive things. And not believe >>>> everything just because a computer was involved. >>> >>>>Nonsense. You use the computer for everything. When was the last time >>>>you picked up a slide rule. You just have to be careful about the data >>>>you enter. >>> >>>>LTspice is as accurate as the models you give it. >> >>> Are you here to discuss electronics, or just to be obnoxious? > >>I discussed electronics and system design. I posted links to oscillator >>design that you ignored. I showed your ignorance of LTspice caused you to >>make false claims about its performance. You completely failed to >>acknowledge any of my posts and still insisted your original erroneous >>analysis about the accuracy of LTspice was correct. > >>LTspice is vital in electronics design. If you can show that any of my >>replies is wrong, please post. > >Ahmmmmm.... I am assuming you mean Spice. LTSpice has some deficiencies.
Sure. Most things like this have some quirks. I've mostly become aware of these things in LT Spice. The sims are usually nicely predictive of what the hardware ultimately does, even for picosecond stuff. Most of my sims never see production. They are prods to thinking, and ways to archive good and bad ideas. More parts makers should supply models and working examples of LT Spice for their parts. A few do.
> > >-- Kevin Aylward >http://www.anasoft.co.uk - SuperSpice >http://www.kevinaylward.co.uk/ee/index.html
-- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
>"Steve Wilson" wrote in message >news:XnsAA0A972A26F0Fidtokenpost@69.16.179.22...
>John Larkin <jjlarkin@highlandtechnology.com> wrote:
>> After 10 cycles, I see about 500 PPM in my LC. Not so different. It >> means that you might not want to design crystal oscillators in time >> domain.
>You need time domain to adjust the crystal drive. Too little and the >oscillator may not start. Too much and you may fracture the crystal.
Although its true that too large a drive might kill the xtal, that is not usually the determinator of max drive current in a precision oscillator xtal. A key issue is ageing. Excessive overdrive makes the xtal frequency drift over time. A second issue is the creation of anomalous frequency variations over temperature that can't easily be compensated out.
>Crystal oscillators have a long startup time due to the high Q. You cannot >make meaningful measurements after hundreds of milliseconds of cycles. I >show how to bypass the long startup in my oscillator.zip article which you >ignored
https://drive.google.com/open?id=1ZsbpkV0aaKS5LURIb1dfu_ndshsSaYtf An, arguable, more convenient alternative to setting node initial conditions to speed startup is to simple set the initial inductor current of the xtal inducter e.g. to form a line: LXTAL 1 2 1m ic=1.5ma In SuperSpice, you just set it in the inductor setup dialog. In standard spice you also need to set UIC (use initial conditions). not sure how LTSPice handles this. To get an accurate value requires running a sweep of initial values to find the correct value, typically running a deQed circuit to speed up that evaluation. What looks like a steady state amplitude, isn't. It still takes the time associated with its c1/L to stabilise.
>>Always specify the maximum time step.
Yes.
>> LT Spice is mathematically chaotic, especially when it uses its >> default time step algorithm. There are probably cases that are >> especialy bad, and maybe I get lucky finding them. I am usually lucky.
>LTspice repeats exactly given the same data. There is nothing chaotic about >it.
It is indeed an excellent example of a mathematically chaotic system. The fact that a simulation will repeat itself exactly, with the same data does not make the system non chaotic. Indeed, the predictability of the apparent randomness is, arguable, the key feature of chaotic systems. The classic example being the rediscovery of chaos theory when Edward Lorenz noted a difference in results for what he initially thought was an identical simulation. https://en.wikipedia.org/wiki/Chaos_theory
>> You just have to be careful when you drive things. And not believe >> everything just because a computer was involved.
>Nonsense. You use the computer for everything. When was the last time you >picked up a slide rule. You just have to be careful about the data you >enter.
Oh dear... "Don't believe just because a computer was involved" includes "be careful about the data" . Data is what drives a computer
>LTspice is as accurate as the models you give it.
The models are never 100% accurate, and neither is the simulator, even if the models were 100% accurate. Spice, now get this, has a reltol, vntol, chgtol and an abstol, additionally it has a gmin. These create errors... Now.... In order to simulate high Q xtal oscillators (c1=0.3fF), especially embedded into larger circuits one might well need to put a clamp across the inductor. This is because operating voltages across the the inductor may be 100kV, and whilst searching for the solution, the iterator might start generating voltages of 1000s of MV. If not clamped, the large span of voltages can cause convergence failure. Typically numbers need to be restricted to about 12-13 digit spans. A two diode series clamp using a spice default gmin=1p across the inductor will totally collapse the phase response so that the system won't oscillate. Reducing gmin can cause convergence failure for other parts of the circuit. 1 Tohms is too low a resistance! The point here, is that the simulator itself has limitations independent of the accuracy of the models that can cause it to fail. Its not just the models that cause accuracy problems. -- Kevin Aylward http://www.anasoft.co.uk - SuperSpice http://www.kevinaylward.co.uk/ee/index.html
"John Larkin"  wrote in message 
news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com...


>>I have attached a simple sim showing the frequency error is unmeasurable >>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>1,000 >>cycles, the tank voltage and sine wave overlap exactly. The frequency >>difference is too small to measure.
>Maybe so, but I often have to force the time step down to get a useful >simulation. And that sometimes makes simulation times silly. There is >a reason that the max time step can be set. When precision matters, I >reduce it until the sim doesn't change.
>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >and zoom the top of the sine. It's chunky line segments. Change the >time step to 1 us and it looks a lot better.
I am going to guess that you must be using LTSpice with compression on. Running straight spice with a max step of 1ms, wont get you any jaggies until zooming in to the 100uV region of the top. Zooming in to say, 25mV range of the top shows a pretty smooth curve from where I'm standing. -- Kevin Aylward http://www.anasoft.co.uk - SuperSpice http://www.kevinaylward.co.uk/ee/index.html
On Fri, 8 Mar 2019 16:12:57 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>>"Steve Wilson" wrote in message >>news:XnsAA0A972A26F0Fidtokenpost@69.16.179.22... >>Yes. > >>> LT Spice is mathematically chaotic, especially when it uses its >>> default time step algorithm. There are probably cases that are >>> especialy bad, and maybe I get lucky finding them. I am usually lucky. > >>LTspice repeats exactly given the same data. There is nothing chaotic about >>it. > >It is indeed an excellent example of a mathematically chaotic system. The >fact that a simulation will repeat itself exactly, with the same data does >not make the system non chaotic. Indeed, the predictability of the apparent >randomness is, arguable, the key feature of chaotic systems. The classic >example being the rediscovery of chaos theory when Edward Lorenz noted a >difference in results for what he initially thought was an identical >simulation. > >https://en.wikipedia.org/wiki/Chaos_theory
LT Spice will sometimes do weird things, and maybe not do them, with the tiniest change of anything. Sometimes an entire sim run will slow down by 100:1. Sometimes it will cruise along and then stall at some arbitrary point for seconds or minutes, then wake up and resume. The initial conditions solution can take forever. Does SuperSpice do that? Is that inherent with Spice? I used to run ECA under DOS. Nothing would stop it; not convergence problems, not divide by zero, nothing. -- John Larkin Highland Technology, Inc lunatic fringe electronics
On Fri, 8 Mar 2019 16:13:29 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>"John Larkin" wrote in message >news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com... > > >>>I have attached a simple sim showing the frequency error is unmeasurable >>>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>>1,000 >>>cycles, the tank voltage and sine wave overlap exactly. The frequency >>>difference is too small to measure. > >>Maybe so, but I often have to force the time step down to get a useful >>simulation. And that sometimes makes simulation times silly. There is >>a reason that the max time step can be set. When precision matters, I >>reduce it until the sim doesn't change. > >>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >>and zoom the top of the sine. It's chunky line segments. Change the >>time step to 1 us and it looks a lot better. > >I am going to guess that you must be using LTSpice with compression on.
Right, that is the default.
> >Running straight spice with a max step of 1ms, wont get you any jaggies >until zooming in to the 100uV region of the top. >Zooming in to say, 25mV range of the top shows a pretty smooth curve from >where I'm standing. > > >-- Kevin Aylward >http://www.anasoft.co.uk - SuperSpice >http://www.kevinaylward.co.uk/ee/index.html
-- John Larkin Highland Technology, Inc lunatic fringe electronics
"John Larkin"  wrote in message 
news:an658epspab4p9b433lbtca3uno7a2ku8h@4ax.com...

On Fri, 8 Mar 2019 16:13:29 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>"John Larkin" wrote in message >news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com... > > >>>I have attached a simple sim showing the frequency error is unmeasurable >>>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>>1,000 >>>cycles, the tank voltage and sine wave overlap exactly. The frequency >>>difference is too small to measure. > >>>Maybe so, but I often have to force the time step down to get a useful >>>simulation. And that sometimes makes simulation times silly. There is >>>a reason that the max time step can be set. When precision matters, I >>>reduce it until the sim doesn't change. > >>>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >>>and zoom the top of the sine. It's chunky line segments. Change the >>>time step to 1 us and it looks a lot better. > >>I am going to guess that you must be using LTSpice with compression on.
>Right, that is the default.
My advice is to never use compression. Its a solution looking for a problem. -- Kevin Aylward http://www.anasoft.co.uk - SuperSpice http://www.kevinaylward.co.uk/ee/index.html
"John Larkin"  wrote in message 
news:h6658epnuom5lj4b0hn1kifniv39do9c1a@4ax.com...

On Fri, 8 Mar 2019 16:12:57 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>>"Steve Wilson" wrote in message >>news:XnsAA0A972A26F0Fidtokenpost@69.16.179.22... >>Yes. > >>> LT Spice is mathematically chaotic, especially when it uses its >>> default time step algorithm. There are probably cases that are >>> especialy bad, and maybe I get lucky finding them. I am usually lucky. > >>LTspice repeats exactly given the same data. There is nothing chaotic >>about >>it. > >>It is indeed an excellent example of a mathematically chaotic system. The >>fact that a simulation will repeat itself exactly, with the same data >>does >>not make the system non chaotic. Indeed, the predictability of the >>apparent >>randomness is, arguable, the key feature of chaotic systems. The classic >>example being the rediscovery of chaos theory when Edward Lorenz noted a >>difference in results for what he initially thought was an identical >>simulation. > >https://en.wikipedia.org/wiki/Chaos_theory
>LT Spice will sometimes do weird things, and maybe not do them, with >the tiniest change of anything. Sometimes an entire sim run will slow >down by 100:1. Sometimes it will cruise along and then stall at some >arbitrary point for seconds or minutes, then wake up and resume. The >initial conditions solution can take forever.
>Does SuperSpice do that? Is that inherent with Spice?
Yes. Its inherent in solving any system of equations that convergence at spot points and regions may be more difficult than others. As the circuit gets bigger, so does the convergence problems. Even with Cadence Spectre one someone has to do quite a bit of fiddling to get convergence. -- Kevin Aylward http://www.anasoft.co.uk - SuperSpice http://www.kevinaylward.co.uk/ee/index.html
On Fri, 8 Mar 2019 19:25:28 -0000, "Kevin Aylward"
<kevinRemovAT@kevinaylward.co.uk> wrote:

>"John Larkin" wrote in message >news:an658epspab4p9b433lbtca3uno7a2ku8h@4ax.com... > >On Fri, 8 Mar 2019 16:13:29 -0000, "Kevin Aylward" ><kevinRemovAT@kevinaylward.co.uk> wrote: > >>"John Larkin" wrote in message >>news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com... >> >> >>>>I have attached a simple sim showing the frequency error is unmeasurable >>>>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>>>1,000 >>>>cycles, the tank voltage and sine wave overlap exactly. The frequency >>>>difference is too small to measure. >> >>>>Maybe so, but I often have to force the time step down to get a useful >>>>simulation. And that sometimes makes simulation times silly. There is >>>>a reason that the max time step can be set. When precision matters, I >>>>reduce it until the sim doesn't change. >> >>>>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >>>>and zoom the top of the sine. It's chunky line segments. Change the >>>>time step to 1 us and it looks a lot better. >> >>>I am going to guess that you must be using LTSpice with compression on. > >>Right, that is the default. > >My advice is to never use compression. Its a solution looking for a problem. > > >-- Kevin Aylward >http://www.anasoft.co.uk - SuperSpice >http://www.kevinaylward.co.uk/ee/index.html
The point I was making, somewhere far above, is that the LT Spice defaults seem to go for speed. That usually works fine for things like opamp circuits, but sometimes doesn't. Things with a huge range of time constants are nasty. I wonder how it handles time steps when I specify a pulse generator with fast rise and fall times, maybe driving a slow RC or something. Or transmission lines? How many time buckets inside a transmission line? One txline can theoretically store an unlimited amount of information. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
On 2019-03-08, John Larkin <jjlarkin@highland_snip_technology.com> wrote:
> On Fri, 8 Mar 2019 19:25:28 -0000, "Kevin Aylward" ><kevinRemovAT@kevinaylward.co.uk> wrote: > >>"John Larkin" wrote in message >>news:an658epspab4p9b433lbtca3uno7a2ku8h@4ax.com... >> >>On Fri, 8 Mar 2019 16:13:29 -0000, "Kevin Aylward" >><kevinRemovAT@kevinaylward.co.uk> wrote: >> >>>"John Larkin" wrote in message >>>news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com... >>> >>> >>>>>I have attached a simple sim showing the frequency error is unmeasurable >>>>>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>>>>1,000 >>>>>cycles, the tank voltage and sine wave overlap exactly. The frequency >>>>>difference is too small to measure. >>> >>>>>Maybe so, but I often have to force the time step down to get a useful >>>>>simulation. And that sometimes makes simulation times silly. There is >>>>>a reason that the max time step can be set. When precision matters, I >>>>>reduce it until the sim doesn't change. >>> >>>>>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >>>>>and zoom the top of the sine. It's chunky line segments. Change the >>>>>time step to 1 us and it looks a lot better. >>> >>>>I am going to guess that you must be using LTSpice with compression on. >> >>>Right, that is the default. >> >>My advice is to never use compression. Its a solution looking for a problem. >> >> >>-- Kevin Aylward >>http://www.anasoft.co.uk - SuperSpice >>http://www.kevinaylward.co.uk/ee/index.html > > The point I was making, somewhere far above, is that the LT Spice > defaults seem to go for speed. That usually works fine for things like > opamp circuits, but sometimes doesn't. > > Things with a huge range of time constants are nasty. > > I wonder how it handles time steps when I specify a pulse generator > with fast rise and fall times, maybe driving a slow RC or something. > > Or transmission lines? How many time buckets inside a transmission > line? One txline can theoretically store an unlimited amount of > information.
Ltspice probably just looks at the simulated signal at the other end of the lines at the apropriate time in the past. it doesn't need separate storage for the line. -- When I tried casting out nines I made a hash of it.
On Sat, 9 Mar 2019 02:41:08 -0000 (UTC), Jasen Betts
<jasen@xnet.co.nz> wrote:

>On 2019-03-08, John Larkin <jjlarkin@highland_snip_technology.com> wrote: >> On Fri, 8 Mar 2019 19:25:28 -0000, "Kevin Aylward" >><kevinRemovAT@kevinaylward.co.uk> wrote: >> >>>"John Larkin" wrote in message >>>news:an658epspab4p9b433lbtca3uno7a2ku8h@4ax.com... >>> >>>On Fri, 8 Mar 2019 16:13:29 -0000, "Kevin Aylward" >>><kevinRemovAT@kevinaylward.co.uk> wrote: >>> >>>>"John Larkin" wrote in message >>>>news:jkvt7e1mu51gueopgk7lodptq5imp5vjru@4ax.com... >>>> >>>> >>>>>>I have attached a simple sim showing the frequency error is unmeasurable >>>>>>when you set the tank ESR to zero. Let it run for 1,000 cycles. After >>>>>>1,000 >>>>>>cycles, the tank voltage and sine wave overlap exactly. The frequency >>>>>>difference is too small to measure. >>>> >>>>>>Maybe so, but I often have to force the time step down to get a useful >>>>>>simulation. And that sometimes makes simulation times silly. There is >>>>>>a reason that the max time step can be set. When precision matters, I >>>>>>reduce it until the sim doesn't change. >>>> >>>>>>Make a pure, 1 volt, 1 Hz sine wave V source. Run that for 5 seconds >>>>>>and zoom the top of the sine. It's chunky line segments. Change the >>>>>>time step to 1 us and it looks a lot better. >>>> >>>>>I am going to guess that you must be using LTSpice with compression on. >>> >>>>Right, that is the default. >>> >>>My advice is to never use compression. Its a solution looking for a problem. >>> >>> >>>-- Kevin Aylward >>>http://www.anasoft.co.uk - SuperSpice >>>http://www.kevinaylward.co.uk/ee/index.html >> >> The point I was making, somewhere far above, is that the LT Spice >> defaults seem to go for speed. That usually works fine for things like >> opamp circuits, but sometimes doesn't. >> >> Things with a huge range of time constants are nasty. >> >> I wonder how it handles time steps when I specify a pulse generator >> with fast rise and fall times, maybe driving a slow RC or something. >> >> Or transmission lines? How many time buckets inside a transmission >> line? One txline can theoretically store an unlimited amount of >> information. > >Ltspice probably just looks at the simulated signal at the other end of the >lines at the apropriate time in the past. it doesn't need separate storage for >the line.
That works for the lossless line, but data is only saved at time-step times of the overall circuit. The lossy line model has stuff happening all along the line, so can't just look back in time at the input. I wonder how many effective segments Spice chops up a line into, and whether the time step matters there. I might do some experiments. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com