THD in LTSpice ? - diyAudio
Go Back   Home > Forums > Amplifiers > Solid State

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
Reply
 
Thread Tools Search this Thread
Old 24th November 2010, 12:11 PM   #1
Banned
 
Join Date: Jan 2005
Default THD in LTSpice ?

I've seen ppl over in the class d section simulating with ltspice including THD, i have been unable to find anything about THD in ltspice so i wonder if anyone here knows how its done.
  Reply With Quote
Old 24th November 2010, 02:16 PM   #2
macboy is offline macboy  Canada
diyAudio Member
 
Join Date: Oct 2003
Location: Ottawa, Canada
You can add a spice directive like this:
.fourier {Freq} V(output)

You need to label the output as "output" so that V(output) has meaning. You can replace "{Freq}" above with a hard-coded number for whatever frequency you are running at (the frequency of your sine source). Or you can define a parameter called Freq and use it for both the .fourier and for the source voltage for the amp. Then you only have to change it in one place to re-run the sim at any frequency. e.g.:
.param Freq 1k

To see the result, open the spice error log.

Don't forget that you can also do an FFT on any waveform. This will let you see which harmonics are present. When doing distortion and FFT measurements, you must turn off 1st and 2nd order compression (in Tools -> control panel) for more accurate results. You can also set the maximum timestep to something relatively small to get a better sim (note small timestep and no compression = BIG memory and disk requirements). When doing FFT try to get an exact integer number of cycles on screen. Otherwise you get a DC component in the result and this adds a slant to the FFT chart.

Have you looked through the examples in the "educational" folder? Please do.
  Reply With Quote
Old 24th November 2010, 04:21 PM   #3
Banned
 
Join Date: Jan 2005
0.01% THD at 100-140W output when using command: .four 1kHz V(output) in spice directive.

Click the image to open in full size.

Last edited by Tekko; 24th November 2010 at 04:40 PM.
  Reply With Quote
Old 24th November 2010, 06:41 PM   #4
jcx is offline jcx  United States
diyAudio Member
 
Join Date: Feb 2003
Location: ..
an important and obscure issue is that Ltspice automatically applies data compression - which will limt your distortion measurement resolution

always either turn off data compression in the Tools/ContolPanel/Compression dialog box

or better always add the spice directive

.option plotwinsize=0

I almost never use the .four - I much prefer looking at the relative levels in the fft graph with Blackman window and integer number cycles (5-10x) of the fundamental fitting the analysis time exactly

2 tone measurements can be more interesting with IMD difference products often being more audible than simple harmonics
  Reply With Quote
Old 25th November 2010, 05:17 AM   #5
cbdb is offline cbdb  Canada
diyAudio Member
 
Join Date: Oct 2008
Location: Vancouver
Unfortunatley the Spice thread that used to to be sticky and at the top of the solid state forum now needs searching for. It holds the answers to this and many more spice questions.
  Reply With Quote
Old 25th November 2010, 05:25 AM   #6
cbdb is offline cbdb  Canada
diyAudio Member
 
Join Date: Oct 2008
Location: Vancouver
The thread is still a sticky but now its in the software.... forum.
  Reply With Quote
Old 25th November 2010, 11:22 AM   #7
Banned
 
Join Date: Jan 2005
That Cdom cap on VAS do have an impact on THD, without it i ger 0.008% THSD and with it im up to 0.015% THD.

Now in reality i do doubt that my amp actually get below 1% THD since spice is ideal component models in an ideal environment.

A Blackman FFT looks like a comb but the harmonics are only up to around -58dB while the fundamental is like +25dB with a noise floor around -100dB.

I also noticed that in ltspice i can have a much smaller Cdom before the amp oscillates than in circuitmaker 2000.

And my sim in ltspice was using IRFP240/9240 since ltspice doesent have IRF540/9540.
  Reply With Quote
Old 25th November 2010, 12:08 PM   #8
Elvee is online now Elvee  Belgium
diyAudio Member
 
Elvee's Avatar
 
Join Date: Sep 2006
Quote:
Originally Posted by Tekko View Post
That Cdom cap on VAS do have an impact on THD, without it i ger 0.008% THSD and with it im up to 0.015% THD.
Normal: without it, you increase the available loop gain at the harmonics frequency.


Quote:
Now in reality i do doubt that my amp actually get below 1% THD since spice is ideal component models in an ideal environment.
Results have to be taken with a pinch of salt, but it certainly doesnt mean they are completely worthless.

Quote:
I also noticed that in ltspice i can have a much smaller Cdom before the amp oscillates than in circuitmaker 2000.
Do you use identical models?
The timestep has a paramount importance too: with a large timestep, you can get away with almost anything.
Try 100ns or less f.e.
The solver could also influence that aspect.
  Reply With Quote
Old 25th November 2010, 12:35 PM   #9
diyAudio Member
 
Join Date: Nov 2008
Location: Brazil
Use these parameters to make simulation THD:

Spice simulation
  Reply With Quote
Old 25th November 2010, 04:46 PM   #10
macboy is offline macboy  Canada
diyAudio Member
 
Join Date: Oct 2003
Location: Ottawa, Canada
Quote:
Originally Posted by Rafael L View Post
Use these parameters to make simulation THD:

Spice simulation
Nice
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: how can I measure THD of my amplifier if my sound card is 0,02% THD ? ygg-it Solid State 1 13th June 2010 08:54 AM
Using LTSpice gaetan8888 Solid State 6 19th July 2007 01:33 AM
RIAA in LTspice Herrmann Tubes / Valves 2 17th September 2004 08:28 PM
LTSpice Issue... mikeks Solid State 17 3rd September 2004 08:42 AM
Ltspice.... mikeks Solid State 10 13th June 2004 09:10 PM


New To Site? Need Help?

All times are GMT. The time now is 08:20 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2