From: Jerry Avins on
On 7/13/2010 5:34 AM, kevin wrote:
> On 07/12/2010 11:55 AM, holychicken wrote:
>
>> What I am looking for is the THD as defined by the IEEE 519 spec: "The
>> ratio of the root-mean-square of the harmonic content to the
>> root-meansquare value of the fundamental quantity, expressed as a percent
>> of the fundamental"
>
>> It will be for power transmission and distribution systems so I know the
>> fundamental will be 60hz.
>
>> I am using a 12 bit ADC, taking 128 samples over a single 60Hz cycle. They
>> are looking for THDs between 5-10% so .1% might be pushing it as I think
>> 10% is a good number to shoot for.
>
>> I hope that is enough information.
>
>
> I may be missing something here (my sanity, perhaps?), but doesn't the
> THD for a 60 Hz line refer to the fundamental versus the harmonics at
> 120, 180, 240 Hz ... etc.?
>
> I am admittedly not an expert at this, so please bear with me if it is
> indeed my sanity that has gone missing (I think I misplaced it in the
> fruit and nut section of a local supermarket - I'll look for it
> later).
>
> I did a little Googling, and it seems that you can start religious
> wars over definitions of THD, as in:
>
> http://www.hydrogenaudio.org/forums/index.php?showtopic=51180
>
> I hope no one gets burned at the stake over the above (that was the
> penalty for heresy in the Middle Ages - supposedly to mimic the fires
> of Hell). Especially not you or me (well ... especially not me).
>
> It just seems to me that you'd want the info of your 60, 120, 180
> Hz .. etc. waveforms. According to your post, you're computing a 128
> point FFT based on one cycle of your 60 Hz line (sample_rate = 128 and
> N = 128, for a 'df' in the frequency domain of sample_rate/N = 1),
> which puts your (supposedly) 60 Hz line at bin 60. Now I am well
> aware of the fact that if you don't have an anti-aliasing filter, the
> 120 Hz 2nd harmonic will show up at bin 120, and higher harmonics will
> be aliased back into other bins. Is this what you intend?
>
> For a simple estimate of THD, might you not compute a single frequency
> DFT at 60, 120, 180 Hz. .. etc., and then do the THD calculation in
> the heretical manner of your choosing? You might not need very many
> single frequency DFT's to get 10% accuracy.
>
> Admittedly, I'm not an expert at THD, so keep that in mind. I'm sure
> that others can offer you better insight.

I'm still in the dark about THD of what. Power-line harmonics is not the
same as channel distortion. BTW, with 128 points per cycle, if it's the
power line that's interesting, there'll be no aliasing below the 64th
harmonic, or 3840 Hz.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
From: Tim Wescott on
On 07/13/2010 07:45 AM, Jerry Avins wrote:
> On 7/13/2010 5:34 AM, kevin wrote:
>> On 07/12/2010 11:55 AM, holychicken wrote:
>>
>>> What I am looking for is the THD as defined by the IEEE 519 spec: "The
>>> ratio of the root-mean-square of the harmonic content to the
>>> root-meansquare value of the fundamental quantity, expressed as a
>>> percent
>>> of the fundamental"
>>
>>> It will be for power transmission and distribution systems so I know the
>>> fundamental will be 60hz.
>>
>>> I am using a 12 bit ADC, taking 128 samples over a single 60Hz cycle.
>>> They
>>> are looking for THDs between 5-10% so .1% might be pushing it as I think
>>> 10% is a good number to shoot for.
>>
>>> I hope that is enough information.
>>
>>
>> I may be missing something here (my sanity, perhaps?), but doesn't the
>> THD for a 60 Hz line refer to the fundamental versus the harmonics at
>> 120, 180, 240 Hz ... etc.?
>>
>> I am admittedly not an expert at this, so please bear with me if it is
>> indeed my sanity that has gone missing (I think I misplaced it in the
>> fruit and nut section of a local supermarket - I'll look for it
>> later).
>>
>> I did a little Googling, and it seems that you can start religious
>> wars over definitions of THD, as in:
>>
>> http://www.hydrogenaudio.org/forums/index.php?showtopic=51180
>>
>> I hope no one gets burned at the stake over the above (that was the
>> penalty for heresy in the Middle Ages - supposedly to mimic the fires
>> of Hell). Especially not you or me (well ... especially not me).
>>
>> It just seems to me that you'd want the info of your 60, 120, 180
>> Hz .. etc. waveforms. According to your post, you're computing a 128
>> point FFT based on one cycle of your 60 Hz line (sample_rate = 128 and
>> N = 128, for a 'df' in the frequency domain of sample_rate/N = 1),
>> which puts your (supposedly) 60 Hz line at bin 60. Now I am well
>> aware of the fact that if you don't have an anti-aliasing filter, the
>> 120 Hz 2nd harmonic will show up at bin 120, and higher harmonics will
>> be aliased back into other bins. Is this what you intend?
>>
>> For a simple estimate of THD, might you not compute a single frequency
>> DFT at 60, 120, 180 Hz. .. etc., and then do the THD calculation in
>> the heretical manner of your choosing? You might not need very many
>> single frequency DFT's to get 10% accuracy.
>>
>> Admittedly, I'm not an expert at THD, so keep that in mind. I'm sure
>> that others can offer you better insight.
>
> I'm still in the dark about THD of what. Power-line harmonics is not the
> same as channel distortion. BTW, with 128 points per cycle, if it's the
> power line that's interesting, there'll be no aliasing below the 64th
> harmonic, or 3840 Hz.

And if it's the power line you can't really measure total harmonic
_distortion_ anyway -- you can only measure total harmonic _content_.

Distortion is what an amplifier or other component does to a signal.
That's not a tremendously good model for the power net, it seems.

--

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
From: dbd on
On Jul 13, 5:43 am, Grant Griffin <nob...(a)example.com> wrote:
> ...

>
> Now we get to the hard part: it's _critical_ to integrate a whole number
> of periods of your fundamental of interest. Otherwise, you get what
> would be called "spectral leakage" in an DFT/FFT analysis.  Basically,
> you have to calculate how many samples make up a whole number of periods
> and integrate that many samples after you determine approximately how
> many periods or samples you want to use.  It's critically important to
> be accurate about this because any amount of spectral leakage can
> dominate the THD calculation and give you inaccurate results.  In fact,
> I ended up using a frequency that was an exact number of samples per period.
> ...

This is what the OP says he has, 128 samples in 1 cycle.

> Taking this to
> its logical conclusion when analyzing with many frequencies, you might
> want to use an FFT.  In that case, you will need to set the number of
> points in the FFT such that all your analysis points align on the exact
> centers of FFT bins.  Generally speaking, you will need a "mixed radix"
> (not power-of-2) FFT for this.  Alternatively, if you can control your
> analysis frequency, you can pick it such that its fundamental and
> harmonics align on some convenient power-of-2 FFT size.
> ...

That's what 128 samples gives.

>
> Grant

The term "synchronous sampling" refers to sampling with a exact number
of samples per cycle of the fundamental.

Dale B. Dalrymple
From: Jerry Avins on
On 7/13/2010 11:16 AM, Tim Wescott wrote:

...

> And if it's the power line you can't really measure total harmonic
> _distortion_ anyway -- you can only measure total harmonic _content_.

Let's not begin discussing what "distortion" means.

> Distortion is what an amplifier or other component does to a signal.

An oscillator (or an alternator or a flute) produces harmonics all an
its own. When the model is pure a sinusoid, that's distortion.
Otherwise, it's timbre. (So sue me. I discussed it!)

> That's not a tremendously good model for the power net, it seems.

I must have missed the assertion that the subject is power line.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������
From: dbd on
On Jul 13, 10:41 am, Jerry Avins <j...(a)ieee.org> wrote:

> ...
> I must have missed the assertion that the subject is power line.
>
> Jerry

You asked the OP:
You haven't fully answered my original question: "THD of what?"

The OP responded:
What I am looking for is the THD as defined by the IEEE 519 spec

IEEE 519 is:
ANSI/IEEE 519-1992, IEEE Recommended Practices and Requirements for
Harmonic Control In Electric Power Systems


Dale B. Dalrymple