Forums

Best way to estimate amplitude and phase

Started by Mimar July 9, 2013
Hello, 

as Tim Wescott wrote in his last followup it will be better to create new
thread instead to continue in "Sliding Goertzel problem" thread. 

I need to estimate amplitude and phase of power line voltage. My boss has
said me recently we have to compute these values quickly and accurately. 
At the moment we use normal DFT, but this method is too slowly. So I tried
to implement sliding Goertzel, but without good results. More in previous
thread....

Yesterday I asked myself:"What about to use GA with integer K and then
correct errors according well-known frequency?" Do you think it can work?

I tried to find information about other method how to estimate ampl. and
phase, but there are only several articles on the web. Any tips?

Thank you a lot.

Miroslav	 

_____________________________		
Posted through www.DSPRelated.com
On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated>
wrote:

>I need to estimate amplitude and phase of power line voltage. My boss has >said me recently we have to compute these values quickly and accurately.
United States Patent 5,594,655. Greg
On 7/9/2013 6:14 AM, Mimar wrote:

> I need to estimate amplitude and phase of power line voltage.
http://en.wikipedia.org/wiki/Prony%27s_method Vladimir Vassilevsky DSP and Mixed Signal Designs www.abvolt.com
On Wednesday, July 10, 2013 1:13:45 AM UTC+12, Greg Berchin wrote:
> On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated> > > wrote: > > > > >I need to estimate amplitude and phase of power line voltage. My boss has > > >said me recently we have to compute these values quickly and accurately. > > > > United States Patent 5,594,655. > > > > Greg
phase relative to what?
On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated> wrote:

>Hello, > >as Tim Wescott wrote in his last followup it will be better to create new >thread instead to continue in "Sliding Goertzel problem" thread. > >I need to estimate amplitude and phase of power line voltage. My boss has >said me recently we have to compute these values quickly and accurately. >At the moment we use normal DFT, but this method is too slowly. So I tried >to implement sliding Goertzel, but without good results. More in previous >thread.... > >Yesterday I asked myself:"What about to use GA with integer K and then >correct errors according well-known frequency?" Do you think it can work? > >I tried to find information about other method how to estimate ampl. and >phase, but there are only several articles on the web. Any tips? > >Thank you a lot. > >Miroslav
How are you currently using the DFT? Are you computing all of the bins or just the bin(s) of interest? The nice thing about a DFT is you only need to compute the bins you want. This can dramatically reduce the computational load compared to computing the entire DFT. Or is the problem that the window length takes too long to collect data? And what are you measuring the phase against? Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Tue, 09 Jul 2013 15:30:13 +0000, Eric Jacobsen wrote:

> On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated> wrote: > >>Hello, >> >>as Tim Wescott wrote in his last followup it will be better to create >>new thread instead to continue in "Sliding Goertzel problem" thread. >> >>I need to estimate amplitude and phase of power line voltage. My boss >>has said me recently we have to compute these values quickly and >>accurately. At the moment we use normal DFT, but this method is too >>slowly. So I tried to implement sliding Goertzel, but without good >>results. More in previous thread.... >> >>Yesterday I asked myself:"What about to use GA with integer K and then >>correct errors according well-known frequency?" Do you think it can >>work? >> >>I tried to find information about other method how to estimate ampl. and >>phase, but there are only several articles on the web. Any tips? >> >>Thank you a lot. >> >>Miroslav > > How are you currently using the DFT? Are you computing all of the bins > or just the bin(s) of interest? The nice thing about a DFT is you only > need to compute the bins you want. This can dramatically reduce the > computational load compared to computing the entire DFT. > > Or is the problem that the window length takes too long to collect data? > > And what are you measuring the phase against?
If I'm understanding his problem correctly, he already knows frequency. I suggested that he first compute the nearest frequency that's an integer fraction of his sampling rate, then do a one-bin DFT on exactly one cycle of samples at that frequency, then correct his amplitude measure for error between actual and measured frequency. Miroslav: When you try this and find out that it's too noisy, then you'll want to go up to two or three or more cycles. Not only will that give you more noise suppression, but it'll let you get closer in frequency. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Is this just a 60Hz wave with noise?  If so, some sort of DFT sounds like overkill.  Why can't you just find the peaks (with an early-late loop, or Muller-Mueller or something like that) and measure the peaks, averaging over a few to cancel out noise effects?  I may be missing something here.
On Tue, 09 Jul 2013 11:40:16 -0500, Tim Wescott
<tim@seemywebsite.really> wrote:

>On Tue, 09 Jul 2013 15:30:13 +0000, Eric Jacobsen wrote: > >> On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated> wrote: >> >>>Hello, >>> >>>as Tim Wescott wrote in his last followup it will be better to create >>>new thread instead to continue in "Sliding Goertzel problem" thread. >>> >>>I need to estimate amplitude and phase of power line voltage. My boss >>>has said me recently we have to compute these values quickly and >>>accurately. At the moment we use normal DFT, but this method is too >>>slowly. So I tried to implement sliding Goertzel, but without good >>>results. More in previous thread.... >>> >>>Yesterday I asked myself:"What about to use GA with integer K and then >>>correct errors according well-known frequency?" Do you think it can >>>work? >>> >>>I tried to find information about other method how to estimate ampl. and >>>phase, but there are only several articles on the web. Any tips? >>> >>>Thank you a lot. >>> >>>Miroslav >> >> How are you currently using the DFT? Are you computing all of the bins >> or just the bin(s) of interest? The nice thing about a DFT is you only >> need to compute the bins you want. This can dramatically reduce the >> computational load compared to computing the entire DFT. >> >> Or is the problem that the window length takes too long to collect data? >> >> And what are you measuring the phase against? > >If I'm understanding his problem correctly, he already knows frequency. > >I suggested that he first compute the nearest frequency that's an integer >fraction of his sampling rate, then do a one-bin DFT on exactly one cycle >of samples at that frequency, then correct his amplitude measure for >error between actual and measured frequency.
He's indicated he wants magnitude and phase (although relative to what we don't know), and he's been using a DFT to do it, but that's too slow. If he's already using a DFT and it's working, then all they really need is computational reduction (if I understand correctly), which means one thing to try is to not compute anything but the one bin that they already use for the task. I suspect that's why he was looking at Goertzel. He might mean that it takes too long, which could be a problem for any DFT/Goertzel based algorithm since it depends on taking the time required to at least collect the input vector data.
>Miroslav: When you try this and find out that it's too noisy, then >you'll want to go up to two or three or more cycles. Not only will that >give you more noise suppression, but it'll let you get closer in >frequency. > >-- > >Tim Wescott >Wescott Design Services >http://www.wescottdesign.com >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Tue, 09 Jul 2013 18:36:08 +0000, Eric Jacobsen wrote:

> On Tue, 09 Jul 2013 11:40:16 -0500, Tim Wescott > <tim@seemywebsite.really> wrote: > >>On Tue, 09 Jul 2013 15:30:13 +0000, Eric Jacobsen wrote: >> >>> On Tue, 09 Jul 2013 06:14:09 -0500, "Mimar" <94571@dsprelated> wrote: >>> >>>>Hello, >>>> >>>>as Tim Wescott wrote in his last followup it will be better to create >>>>new thread instead to continue in "Sliding Goertzel problem" thread. >>>> >>>>I need to estimate amplitude and phase of power line voltage. My boss >>>>has said me recently we have to compute these values quickly and >>>>accurately. At the moment we use normal DFT, but this method is too >>>>slowly. So I tried to implement sliding Goertzel, but without good >>>>results. More in previous thread.... >>>> >>>>Yesterday I asked myself:"What about to use GA with integer K and then >>>>correct errors according well-known frequency?" Do you think it can >>>>work? >>>> >>>>I tried to find information about other method how to estimate ampl. >>>>and phase, but there are only several articles on the web. Any tips? >>>> >>>>Thank you a lot. >>>> >>>>Miroslav >>> >>> How are you currently using the DFT? Are you computing all of the >>> bins or just the bin(s) of interest? The nice thing about a DFT is >>> you only need to compute the bins you want. This can dramatically >>> reduce the computational load compared to computing the entire DFT. >>> >>> Or is the problem that the window length takes too long to collect >>> data? >>> >>> And what are you measuring the phase against? >> >>If I'm understanding his problem correctly, he already knows frequency. >> >>I suggested that he first compute the nearest frequency that's an >>integer fraction of his sampling rate, then do a one-bin DFT on exactly >>one cycle of samples at that frequency, then correct his amplitude >>measure for error between actual and measured frequency. > > He's indicated he wants magnitude and phase (although relative to what > we don't know), and he's been using a DFT to do it, but that's too slow. > > If he's already using a DFT and it's working, then all they really need > is computational reduction (if I understand correctly), which means one > thing to try is to not compute anything but the one bin that they > already use for the task. I suspect that's why he was looking at > Goertzel.
He mentioned (in the other thread, but not this one, I think) that the line frequency can vary from 45Hz to 55Hz, and that he was trying to do his one-point DFT on 20ms worth of sample -- so for all cases except the exact 50Hz case, he was doing a one-bin DFT at the wrong frequency. So his DFT (which he was trying to do using the Goertzel) was, indeed, not working quite right.
> He might mean that it takes too long, which could be a problem for any > DFT/Goertzel based algorithm since it depends on taking the time > required to at least collect the input vector data.
Yes. I don't think that's his biggest problem. I also don't think that a more traditional DFT is going to be more computationally expensive than a Goertzel, at least with modern processing facilities. And it'll be a hell of a lot less obscure to anyone who has to maintain the code. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Tuesday, July 9, 2013 7:14:09 AM UTC-4, Mimar wrote:
> Hello, > > > > as Tim Wescott wrote in his last followup it will be better to create new > > thread instead to continue in "Sliding Goertzel problem" thread. > > > > I need to estimate amplitude and phase of power line voltage. My boss has > > said me recently we have to compute these values quickly and accurately. > > At the moment we use normal DFT, but this method is too slowly. So I tried > > to implement sliding Goertzel, but without good results. More in previous > > thread.... > > > > Yesterday I asked myself:"What about to use GA with integer K and then > > correct errors according well-known frequency?" Do you think it can work? > > > > I tried to find information about other method how to estimate ampl. and > > phase, but there are only several articles on the web. Any tips? > > > > Thank you a lot. > > > > Miroslav > > > > _____________________________ > > Posted through www.DSPRelated.com
Hello Miroslav, Try looking an Rick Lyons' paper here: http://dspguru.com/sites/dspguru/files/Scalloping%20Loss%20Compensation-Lyons.pdf You may use this trick to implement a flat top window using several Goertzels, so your frequency doesn't have to be exact. To go along with Rick's paper, I wrote this code of which you may find helpful: http://www.claysturner.com/scalloploss.cpp Even though I implemented the DFTs directly, one may simply do them via Goertzel or even sliding Geortzel. IHTH, Clay