diyAudio

diyAudio (http://www.diyaudio.com/forums/)
-   Solid State (http://www.diyaudio.com/forums/solid-state/)
-   -   THD in LTSpice ? (http://www.diyaudio.com/forums/solid-state/177820-thd-ltspice.html)

Tekko 24th November 2010 11:11 AM

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.

macboy 24th November 2010 01:16 PM

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.

Tekko 24th November 2010 03:21 PM

0.01% THD at 100-140W output when using command: .four 1kHz V(output) in spice directive.

http://i.imgur.com/XyAzn.jpg

jcx 24th November 2010 05:41 PM

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

cbdb 25th November 2010 04:17 AM

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.

cbdb 25th November 2010 04:25 AM

The thread is still a sticky but now its in the software.... forum.

Tekko 25th November 2010 10:22 AM

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.

Elvee 25th November 2010 11:08 AM

Quote:

Originally Posted by Tekko (Post 2376673)
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.

Rafael L 25th November 2010 11:35 AM

Use these parameters to make simulation THD:

http://www.diyaudio.com/forums/softw...ml#post1744406

macboy 25th November 2010 03:46 PM

Quote:

Originally Posted by Rafael L (Post 2376721)
Use these parameters to make simulation THD:

http://www.diyaudio.com/forums/softw...ml#post1744406

Nice


All times are GMT. The time now is 08:23 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