What is the method for calculating THD in PLECS? Why does the THD value in PLECS look like not right?

Hello!

Fig. 1 (The waveforms in the scope):

Fig. 2 (The Fourier Analysis results of these waveforms):

Fig. 3 (My setting of the Fourier Analysis tool):

We can see that in Plot 1, the THD value is so high(=80936.9%). Its looks like not right… Does the PLECS calculate THD value with the DC component(=217.319)?

However, Does the THD value(=5.21%) in Plot 3 calculated with the DC component(=108.66)?

Attached are file of Fig. 1, 2, 3.

Thanks!

Jeremy

The THD can only be calculated correctly if the correct base frequency is specified. For the first plot in your example, this is obviously not the case (you specified half the base frequency).

The DC component is not taken into account for calculation of the THD.

Kind regards,

Oliver Schwartz

Thanks for your great answer!

I’m sorry that I didn’t take care that in the first plot, the base frequency is 160kHz.

In the second plot, the base frequency is 80kHz which is specified. However, I cannot calculate the THD of “Measured voltage” displayed(≈0.48):

THD(Measured voltage in Plot 2)

≈ { [V3/sqrt(2)]2+[V5/sqrt(2)]2+[V7/sqrt(2)]2+[V9/sqrt(2)]2+[V11/sqrt(2)]2+[V13/sqrt(2)]2+[V5/sqrt(2)]2+[V17/sqrt(2)]2+[V19/sqrt(2)]2 } / { [V1/sqrt(2)]2 }

= { V32+V52+V72+V92+V112+V132+V152+V172+V192 } / { V12 }

=(195.232+117.1382+83.672+652+532+452+392+342+302) / 585.692

=0.208

which is largely different from0.48.

So I am curious that the left harmonic components will cause a so large difference? or how to calculate in the software?

You may want to check your definition of THD - compared to common definition you are missing a square root. In PLECS the THD is calculated as sqrt(sum(Vn^2))/V1 for n>=2. This is in accordance with, for example, the definition in Wikipedia: https://en.wikipedia.org/wiki/Total_harmonic_distortion, where this is referred to as THDF.

Also, from the same article, the THDF of an ideal rectangular wave is 48.3% (which roughly matches sqrt(0.208)). The remaining difference can be explained by the number of harmonics that are considered, the THD from PLECS considers all harmonics.

Kind regards,

Oliver Schwartz

Thank you very much for correcting my misunderstanding.

Best regards,

Jeremy