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.
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.
.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.
0.01% THD at 100-140W output when using command: .four 1kHz V(output) in spice directive.
Last edited:
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
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
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.
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.
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.
Normal: without it, you increase the available loop gain at the harmonics frequency.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.
Results have to be taken with a pinch of salt, but it certainly doesnt mean they are completely worthless.Now in reality i do doubt that my amp actually get below 1% THD since spice is ideal component models in an ideal environment.
Do you use identical models?I also noticed that in ltspice i can have a much smaller Cdom before the amp oscillates than in circuitmaker 2000.
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.
Use these parameters to make simulation THD:
http://www.diyaudio.com/forums/software-tools/101810-spice-simulation-83.html#post1744406
http://www.diyaudio.com/forums/software-tools/101810-spice-simulation-83.html#post1744406
Use these parameters to make simulation THD:
http://www.diyaudio.com/forums/software-tools/101810-spice-simulation-83.html#post1744406
Nice
Now in reality i do doubt that my amp actually get below 1% THD since spice is ideal component models in an ideal environment.
The spice components are not ideal but for accurate results you need accurate models, and a lot of the models out there are not very good.
also noticed that in ltspice i can have a much smaller Cdom before the amp oscillates than in circuitmaker 2000.
I woudnt trust using the the .tran function to test for stability. Better to use the traditional loop gain/phase calculations (gain/phase margins) within LTSpice. Check the Spice thread and the spice examples for Middlebrook probe.
0.01% THD at 100-140W output when using command: .four 1kHz V(output) in spice directive.
The amp you used Blameless as the basis for your project, keep darligton in VAS this should reduce the THD
LT Spice modeling audio
Keep in mind LT Spice was developed by them to mainly model their components, mainly in power products. Most good engineers use spice as a general tool to prove a concept. To go further, complicated math models have to be formulated taking into account every concievable parasitic. Best alternative is good old bench testing with some half decent equipment!
Keep in mind LT Spice was developed by them to mainly model their components, mainly in power products. Most good engineers use spice as a general tool to prove a concept. To go further, complicated math models have to be formulated taking into account every concievable parasitic. Best alternative is good old bench testing with some half decent equipment!
The amp you used Blameless as the basis for your project, keep darligton in VAS this should reduce the THD
Not just that ,but the sine gen. in spice generates .005% just by itself. you can get a blameless to do "parts per million" with proper models and without "tricks".
Get that "Andy C. sine gen." linked to a few posts back.
PS. The IRF models "suck". Still... one can get .0001% or below with them.
OS
Attachments
Last edited:
I never understood this "blameless" name i keep seeing in threads here, what does it mean ?
Douglas Self amp, "blameless" ... the prime example he references to in his "power amplifier design handbook"
Audio power amplifier design handbook - Google Books
OS
Ohh😱😱
Despite 100% outta my head it turns out i did a outright copy of an already existing amp design and then calling it my own.
I will remove all schematics of "my" amp.
Despite 100% outta my head it turns out i did a outright copy of an already existing amp design and then calling it my own.
I will remove all schematics of "my" amp.
Is a circuit of the book, is to be used in studies/simulation, I found similar to "Blameless", recognize his authorship on the project.
Ohh😱😱
Despite 100% outta my head it turns out i did a outright copy of an already existing amp design and then calling it my own.
I will remove all schematics of "my" amp.
The basic design is linn/RCA , long in the public domain. Mr. Self does not have patent on topology. So it can be "your" amp , "My" amp ... the monkey's uncle amp.... Nobody owns it. keep your schematics up.. NO issue. 🙂
OS
- Status
- Not open for further replies.
- Home
- Amplifiers
- Solid State
- THD in LTSpice ?