
Home  Forums  Rules  Articles  The diyAudio Store  Gallery  Blogs  Register  Donations  FAQ  Calendar  Search  Today's Posts  Mark Forums Read  Search 
Solid State Talk all about solid state amplification. 

Please consider donating to help us continue to serve you.
Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving 

Thread Tools  Search this Thread 
27th February 2004, 06:46 PM  #1 
diyAudio Member
Join Date: Jan 2004
Location: Malveira

Distortion simulation with LTspice
Hi,
has anyone successfuly simulated distortion measurements with ltspice? I've read somewhere an approximation could be obtained with fourier, though i do not know the procedure to accoplish this. The goal is to simulate THD and, if possible, the distribution across the harmonics. Thanks and regards, Tiago 
27th February 2004, 07:32 PM  #2 
The one and only

I haven't used LTSpice, but I am assuming that nothing radically
new has been developed in Spice algorithms for it. I don't recommend trying to perform other than crude distortion analysis with simulation. From my experience, you can't depend on such numbers, and there are a few texts written that address these issues, two being Kielkowski's "Spice: Practical Device Modeling" or Tuinenga's "Spice: A Guide to Circuit Simulation and Analysis using PSpice". Both these books are fairly explicit about the limitations of distortion analysis with Spice. If you really want to know, I recommend that you build the circuit. 
27th February 2004, 08:54 PM  #3 
diyAudio Member

Hi tiagor,
There are two rather different points to consider: 1. How to get the THD etc. numbers in LTSpice simulation 2. How these numbers relate to the performance of the real circuit The caveats of 2. were already addressed by Nelson. OTOH, you can get some insigts about some sources of THD using SPICE simulation. Ad 1. Prerequisite:  Always turn Compression of in LTSpice's control panel.  Setup a transient analysis with the analysis time a multiple of your signal generator's period  If your circuit needs some time to achieve steady state, you must also specify a nonzero start time Method 1: Add a .fourier command using the "SPICE directive" button. Syntax is described in the online help. E.g. if your signal generator is set to 5k and you want to watch the node named "out" the command would be: .fourier 5k V(out) After running the sim, you can see the results using "View SPICE error log" Method 2: Do a graphical FFT of the transient analysis' output and measure the peaks of the harmonics with the mouse Method 3: Use Helmut Sennewalds utilities to convert the .raw files written in the transient analysis to ASCII and do further computations with the tool of your choice. General advice: Read the fine online help. Join the mailing list http://groups.yahoo.com/group/LTspice/ Regards, Peter Jacobi
__________________
 YMMV 
27th February 2004, 10:08 PM  #4 
diyAudio Member
Join Date: May 2002
Location: Switzerland

I think LTSPICE's accuracy will be somewhat similar to that of PSPICE. Regarding the accuracy of the FFT (needed for THD analysis) within PSPICE I found the following:
http://www.orcadpcb.com/kb_articles/020019.asp?bc=F an excerpt: "Simulation Accuracy Simulation accuracy is limited to about 33.5 digits (6070dBc). The accuracy can be improved by tightening tolerances and taking the above considerations to extremes, but not by very much. This may not be considered sufficient for some applications, but keep in mind that even the best simulation models are probably not accurate enough to provide better results. " So it is really the best to follow N.P.'s suggestion. Regards Charles 
27th February 2004, 10:22 PM  #5 
diyAudio Member

I have done a lot of distoritionanalysis using Orcad Pspice. I would say that it works well in some situtations. However, if the transistors/FET:s in the circuit are operating at very low voltages one have to be carefull.
__________________
"It was never supposed to be a hit, it was supposed to be a Joe Morello drum solo" Paul Desmond 
27th February 2004, 10:55 PM  #6  
diyAudio Member

Hi phase_accurate, All,
Quote:
With compression off, alternative solver on, running .tran 0 12m 0 .1u gives .fourier results down to 3E6 (110dB dynamic range). The graphical FFT, selecting 65536 points and Hann window, gives a "noise floor" of 200dB. And if you join Bernhard's Church of the Merciless Noise Killing, he will most likely give you the setup for getting down to 300dB. But these are only numbers in a theoretical game, as the active devices' models are not anywhere near this accuracy. Regards, Peter Jacobi
__________________
 YMMV 

28th February 2004, 01:03 AM  #7 
diyAudio Member
Join Date: Jun 2002
Location: Left Coast

With regard to LTSpice, more than squeezing out the last drop of THD+N, I would ne interested on whether and how .ac or some other analysis to create a Bode plot to be used to predict fairly accurately whether an amp circuit will be stable. I can generate curves that LOOK like a Bode graph and seem to behave to changes in component values in the right direction, but I'm not at all sure I'm using the software appropriately.

28th February 2004, 10:45 AM  #8  
diyAudio Member

Quote:
You should ask at: http://groups.yahoo.com/group/LTspice/
__________________
 YMMV 

28th February 2004, 12:13 PM  #9 
diyAudio Member
Join Date: Nov 2002
Location: Netherlands

Hi,
Apart from the accuracy of the models you need to know what the basics are behind performing FFT’s. So start reading a good textbook what it is all behind a FFT. I.e. Spice programs don’t use windowing, which means the number of periods of your signal needs to fit exactly in the measurement time. Also you need to set up your measurement time to an exact multiple of the FFT length and so on. A workaround is to model windowing (i.e. Hamming, Blackman and so on) yourself in the circuit. Also DCblocking capacitors and inductors cause DC drift over time, limiting dynamic range. So it is best to avoid capacitors and inductors in the circuit. With the proper setup I managed to simulate harmonics below –160 dB. But anyway the results of simulated distortion have limited use. With some luck it will give only a crude indication what to expect in the real thing. Cheers 
28th February 2004, 12:30 PM  #10  
diyAudio Retiree
Join Date: Oct 2002
Location: Spain or the pueblo of Los Angeles

A beautifully asked question..... it brings tears to my eyes
Quote:
unity gain. This needs to be done with reactive loads the amp will see rather than just a purely resistive load. Give this poster a gold star for brevity along with stating exactly what he wants to know in clear terms that give an indication of his level of understanding so that replies can be right to the point. 

Thread Tools  Search this Thread 


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
LTSpice Simulation template?!  ipop07  Tubes / Valves  5  13th May 2009 07:17 PM 
Using LTSpice  gaetan8888  Solid State  6  19th July 2007 01:33 AM 
UcD / LTSpice help  fokker  Class D  94  1st October 2006 02:12 PM 
LTSpice PSU simulation help  SoftStart modeling  ninjanki  Power Supplies  10  21st March 2005 05:04 PM 
Ltspice....  mikeks  Solid State  10  13th June 2004 09:10 PM 
New To Site?  Need Help? 