From: holychicken on
I am a C programmer working on an embedded application and I am looking
into finding a less processor intensive algorithm for calculating the Total
Harmonic Distortion than using an FFT.

In my search, however, almost every calculation involves looking at each of
the harmonics. Is there any way to subtract out the fundamental RMS value
and get the THD from there? I have the RMS value of the fundamental
already and was just wondering if I could use that in someway to get the
THD.

Thanks for any input even if it is just, "tough luck."


From: Vladimir Vassilevsky on


holychicken wrote:

> I am a C programmer working on an embedded application and I am looking
> into finding a less processor intensive algorithm for calculating the Total
> Harmonic Distortion than using an FFT.
>
> In my search, however, almost every calculation involves looking at each of
> the harmonics. Is there any way to subtract out the fundamental RMS value
> and get the THD from there? I have the RMS value of the fundamental
> already and was just wondering if I could use that in someway to get the
> THD.
>
> Thanks for any input even if it is just, "tough luck."

If you subtract fundamental frequency from the signal, you will get a
mix of (THD + noise + non-harmonic components + nonstationarity +
numeric artifacts). The result may or may not be acceptable depending on
your application. What THD numbers are you after?


Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com

From: Jerry Avins on
On 7/11/2010 5:30 PM, holychicken wrote:
> I am a C programmer working on an embedded application and I am looking
> into finding a less processor intensive algorithm for calculating the Total
> Harmonic Distortion than using an FFT.
>
> In my search, however, almost every calculation involves looking at each of
> the harmonics. Is there any way to subtract out the fundamental RMS value
> and get the THD from there? I have the RMS value of the fundamental
> already and was just wondering if I could use that in someway to get the
> THD.
>
> Thanks for any input even if it is just, "tough luck."

THD of what? My first distortion analyzer was a Heathkit that, if I
remember correctly, generated quite pure sine waves at a few frequencies
(Wien bridge) and provided notch filters at those frequencies (twin T).
The filters were adjusted for null with a distortion-free system (a.k.a
wire) in place, then readings were taken with an actual system. It gave
useful results that correlated well with my other distortion analyzer
(also Heathkit) that measured IM at two frequency pairs.

Subtracting out the fundamental instead of using a notch filter isn't
necessarily simple in practice. You need to account for very small
variations of gain during the test.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
From: holychicken on
Thanks for the responses. The application is to give our customers a heads
up to make sure that their customers are meeting the IEEE 519 spec. It is
just meant to give them a warning of where they should go off and take a
more accurate reading.

I will definitely look into the suggestions you two gave and thanks again.
From: Tim Wescott on
On 07/11/2010 02:59 PM, Jerry Avins wrote:
> On 7/11/2010 5:30 PM, holychicken wrote:
>> I am a C programmer working on an embedded application and I am looking
>> into finding a less processor intensive algorithm for calculating the
>> Total
>> Harmonic Distortion than using an FFT.
>>
>> In my search, however, almost every calculation involves looking at
>> each of
>> the harmonics. Is there any way to subtract out the fundamental RMS value
>> and get the THD from there? I have the RMS value of the fundamental
>> already and was just wondering if I could use that in someway to get the
>> THD.
>>
>> Thanks for any input even if it is just, "tough luck."
>
> THD of what? My first distortion analyzer was a Heathkit that, if I
> remember correctly, generated quite pure sine waves at a few frequencies
> (Wien bridge) and provided notch filters at those frequencies (twin T).
> The filters were adjusted for null with a distortion-free system (a.k.a
> wire) in place, then readings were taken with an actual system. It gave
> useful results that correlated well with my other distortion analyzer
> (also Heathkit) that measured IM at two frequency pairs.
>
> Subtracting out the fundamental instead of using a notch filter isn't
> necessarily simple in practice. You need to account for very small
> variations of gain during the test.

And possibly whopping big phase variations, too. By the time you make
an amplifier that'll track the gain and phase change of the fundamental,
you've done a lot more work than making a notch filter.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" was written for you.
See details at http://www.wescottdesign.com/actfes/actfes.html