Hi, Can anybody recommend a book that has good stuff about implementing the discrete Hilbert transform, preferably in an FPGA? I need practical stuff, like accuracy over frequency ranges for given tap count, windowing, truncation effects, etc. I need to take a stream of digitized (16 bit) analog samples and produce an I-Q data stream pair over roughly a 20:1 frequency range, to maybe 1 degree accuracy. Max signal frequency will be low, 1 KHz maybe. Any other resource tips would be appreciated. We could pay for a bit of consulting maybe, too. Thanks, John
need a book: Hilbert transform
Started by ●May 31, 2005
Reply by ●May 31, 20052005-05-31
Hello John, Skolnik's "Radar Handbook" has some I/Q error budgeting in chapter 3 but I don't think it'll suffice here. I have never seen a book that goes this far into practical matters on Hilbert (except for the analog version), maybe too small a market for publishers. If there is anything out there it'll be most likely for Doppler applications. Artech House may have some good stuff and you could check them. Most books about transforms come with a CD full of helpful routines but often they will be plain C code: http://www.artechhouse.com/default.asp?Frame=Book.asp&Book=C5P10&Country=&Continent=ME&State= Possibly you could start at one of the math simulator vendors, like here: http://www.mathworks.com/access/helpdesk/help/toolbox/signal/filterd9.html Simulators are almost a must when doing this kind of stuff. My turf is med imaging and there usually every company invents the wheel again, simulates until smoke comes out of the PC and then it all becomes a trade secret. They rarely publish. What do you want to do? Does it have to be poured into the FPGA? Regards, Joerg http://www.analogconsultants.com
Reply by ●June 1, 20052005-06-01
On Wed, 01 Jun 2005 00:44:18 GMT, Joerg <notthisjoergsch@removethispacbell.net> wrote:>Hello John, > >Skolnik's "Radar Handbook" has some I/Q error budgeting in chapter 3 but >I don't think it'll suffice here. I have never seen a book that goes >this far into practical matters on Hilbert (except for the analog >version), maybe too small a market for publishers. If there is anything >out there it'll be most likely for Doppler applications. > >Artech House may have some good stuff and you could check them. Most >books about transforms come with a CD full of helpful routines but often >they will be plain C code: > >http://www.artechhouse.com/default.asp?Frame=Book.asp&Book=C5P10&Country=&Continent=ME&State= > >Possibly you could start at one of the math simulator vendors, like here: > >http://www.mathworks.com/access/helpdesk/help/toolbox/signal/filterd9.html > >Simulators are almost a must when doing this kind of stuff. My turf is >med imaging and there usually every company invents the wheel again, >simulates until smoke comes out of the PC and then it all becomes a >trade secret. They rarely publish. > >What do you want to do? Does it have to be poured into the FPGA? >Suppose I have an AC power system, and I can digitize a pair of voltage and current waveforms. I want to report everything: trms volts/amps, true power, reactive power, phase angle. The line frequency could vary from maybe 20 to 80 Hz for a stationary generator, or 200-800 for an aircraft system (including startup and weird situations.) I'll digitize to 16 bits, at maybe 20K samples/second or something. I'm considering doing all the signal processing in an FPGA, crunching maybe 8 voltage+current pairs. For the rms volts/amps, we could just square the samples, filter, and allow my pokey uP to occasionally pick up that and square root. True power is just the product of the e*i samples, lowpass filtered. Easy. What's tricky is the reactive power/phase angle thing. The ideal thing would be to delay the voltage samples 90 degrees and then multiply by the current samples, then filter to get the signed reactive power. The trick is to delay the voltage sample data stream 90 degrees. A discrete (fir) Hilbert would give me the phase-shifted voltage signal (actually 135 deg, not 90, so I'd have to delay the current samples, too, but that's OK.) I just need to quantify how good a given implementation might be. The other way to do it would be to use a fifo clocked at a multiple of the waveform frequency, delaying the voltage or current samples by 90 degrees. That would take a digital PLL to track the voltage waveform frequency and generate a 128x or something tracking clock. Maybe a dds/nco clock gen with some fancy digital phase detector? That's complex, too, but has the advantage of acquiring the waveform frequency essentially for free. I could have a range bit the user sets for the 60 vs 400 Hz situations, so I'd only need about a 4:1 tracking range on the clock. Either way, it sounds like I'm in for some simulation. PowerBasic! John
Reply by ●June 1, 20052005-06-01
John Larkin wrote:> On Wed, 01 Jun 2005 00:44:18 GMT, Joerg > <notthisjoergsch@removethispacbell.net> wrote: > > >>Hello John, >> >>Skolnik's "Radar Handbook" has some I/Q error budgeting in chapter 3 but >>I don't think it'll suffice here. I have never seen a book that goes >>this far into practical matters on Hilbert (except for the analog >>version), maybe too small a market for publishers. If there is anything >>out there it'll be most likely for Doppler applications. >> >>Artech House may have some good stuff and you could check them. Most >>books about transforms come with a CD full of helpful routines but often >>they will be plain C code: >> >>http://www.artechhouse.com/default.asp?Frame=Book.asp&Book=C5P10&Country=&Continent=ME&State= >> >>Possibly you could start at one of the math simulator vendors, like here: >> >>http://www.mathworks.com/access/helpdesk/help/toolbox/signal/filterd9.html >> >>Simulators are almost a must when doing this kind of stuff. My turf is >>med imaging and there usually every company invents the wheel again, >>simulates until smoke comes out of the PC and then it all becomes a >>trade secret. They rarely publish. >> >>What do you want to do? Does it have to be poured into the FPGA? >> > > > Suppose I have an AC power system, and I can digitize a pair of > voltage and current waveforms. I want to report everything: trms > volts/amps, true power, reactive power, phase angle. The line > frequency could vary from maybe 20 to 80 Hz for a stationary > generator, or 200-800 for an aircraft system (including startup and > weird situations.) I'll digitize to 16 bits, at maybe 20K > samples/second or something. I'm considering doing all the signal > processing in an FPGA, crunching maybe 8 voltage+current pairs. > > For the rms volts/amps, we could just square the samples, filter, and > allow my pokey uP to occasionally pick up that and square root. > > True power is just the product of the e*i samples, lowpass filtered. > Easy. > > What's tricky is the reactive power/phase angle thing. The ideal thing > would be to delay the voltage samples 90 degrees and then multiply by > the current samples, then filter to get the signed reactive power. The > trick is to delay the voltage sample data stream 90 degrees. A > discrete (fir) Hilbert would give me the phase-shifted voltage signal > (actually 135 deg, not 90, so I'd have to delay the current samples, > too, but that's OK.) I just need to quantify how good a given > implementation might be. > > The other way to do it would be to use a fifo clocked at a multiple of > the waveform frequency, delaying the voltage or current samples by 90 > degrees. That would take a digital PLL to track the voltage waveform > frequency and generate a 128x or something tracking clock. Maybe a > dds/nco clock gen with some fancy digital phase detector? That's > complex, too, but has the advantage of acquiring the waveform > frequency essentially for free. I could have a range bit the user sets > for the 60 vs 400 Hz situations, so I'd only need about a 4:1 tracking > range on the clock. > > Either way, it sounds like I'm in for some simulation. PowerBasic! > > > Johnwhy not a synchronous demodulator (or lock-in amp ;) if you have 3 phases, its trivial. measure all 3 phases, and do a 3-2 phase transform to create an equivalent rotating vector a + jb. for a single-phase system, build a 90 degree phase shifter so you have Vpeak*sin(theta) + j*Vpeak*cos(theta). then multiply by exp(-jtheta) (decompose into real & imaginary calcs) You will then get 2 outputs, call them Vd and Vq. If you have a pure sinusoidal system, and theta = integral(w_line.dt) is the correct phase, one of these will be zero. Use this as the feedback to a PI controller, whose reference is zero. PI output has ideal line frequency added to it (if you want, not necessary) and is then integrated to produce theta. once it syncs up, you have your real & imaginary V,I components in the stationary reference frame, IOW they are DC quantities. easy to figure out reactive power etc. Cheers Terry
Reply by ●June 1, 20052005-06-01
John Larkin wrote: [...]> Suppose I have an AC power system, and I can digitize a pair of > voltage and current waveforms. I want to report everything: trms > volts/amps, true power, reactive power, phase angle. The line > frequency could vary from maybe 20 to 80 Hz for a stationary > generator, or 200-800 for an aircraft system (including startup and > weird situations.) I'll digitize to 16 bits, at maybe 20K > samples/second or something. I'm considering doing all the signal > processing in an FPGA, crunching maybe 8 voltage+current pairs. > > For the rms volts/amps, we could just square the samples, filter, and > allow my pokey uP to occasionally pick up that and square root. > > True power is just the product of the e*i samples, lowpass filtered. > Easy.Isn't that Volt-Amperes? You need the phase angle to separate the components into true power and reactive power.> What's tricky is the reactive power/phase angle thing.Can't you just detect the zero crossings in the voltage and current waveforms and get the phase angle between them? Then solve the relationship: cos(phi) = True Power / Total Power Any waveform distortion could mess things up a bit trying to find the zero crossings. A simple boxcar integrator is very fast in software and might help improve the accuracy. Is this what you are looking for, or did I miss something fundamental in your post? [...]> JohnMike Monett
Reply by ●June 1, 20052005-06-01
John Larkin wrote:> > Suppose I have an AC power system, and I can digitize a pair of > voltage and current waveforms. I want to report everything: trms > volts/amps, true power, reactive power, phase angle. The line > frequency could vary from maybe 20 to 80 Hz for a stationary > generator, or 200-800 for an aircraft system (including startup and > weird situations.) I'll digitize to 16 bits, at maybe 20K > samples/second or something. I'm considering doing all the signal > processing in an FPGA, crunching maybe 8 voltage+current pairs. > > For the rms volts/amps, we could just square the samples, filter, and > allow my pokey uP to occasionally pick up that and square root. > > True power is just the product of the e*i samples, lowpass filtered. > Easy. > > What's tricky is the reactive power/phase angle thing. The ideal thing > would be to delay the voltage samples 90 degrees and then multiply by > the current samples, then filter to get the signed reactive power. The > trick is to delay the voltage sample data stream 90 degrees. A > discrete (fir) Hilbert would give me the phase-shifted voltage signal > (actually 135 deg, not 90, so I'd have to delay the current samples, > too, but that's OK.) I just need to quantify how good a given > implementation might be. > > The other way to do it would be to use a fifo clocked at a multiple of > the waveform frequency, delaying the voltage or current samples by 90 > degrees. That would take a digital PLL to track the voltage waveform > frequency and generate a 128x or something tracking clock. Maybe a > dds/nco clock gen with some fancy digital phase detector? That's > complex, too, but has the advantage of acquiring the waveform > frequency essentially for free. I could have a range bit the user sets > for the 60 vs 400 Hz situations, so I'd only need about a 4:1 tracking > range on the clock. > > Either way, it sounds like I'm in for some simulation. PowerBasic!Pathetically trivial when you use Parseval's Identity and various elementary results relating multiplication in the time domain to convolution in the frequency domain and take note that the frequency domain representation is on an orthogonal basis...
Reply by ●June 1, 20052005-06-01
On Wed, 01 Jun 2005 16:21:36 +1200, Terry Given <my_name@ieee.org> wrote:>John Larkin wrote: >> On Wed, 01 Jun 2005 00:44:18 GMT, Joerg >> <notthisjoergsch@removethispacbell.net> wrote: >> >> >>>Hello John, >>> >>>Skolnik's "Radar Handbook" has some I/Q error budgeting in chapter 3 but >>>I don't think it'll suffice here. I have never seen a book that goes >>>this far into practical matters on Hilbert (except for the analog >>>version), maybe too small a market for publishers. If there is anything >>>out there it'll be most likely for Doppler applications. >>> >>>Artech House may have some good stuff and you could check them. Most >>>books about transforms come with a CD full of helpful routines but often >>>they will be plain C code: >>> >>>http://www.artechhouse.com/default.asp?Frame=Book.asp&Book=C5P10&Country=&Continent=ME&State= >>> >>>Possibly you could start at one of the math simulator vendors, like here: >>> >>>http://www.mathworks.com/access/helpdesk/help/toolbox/signal/filterd9.html >>> >>>Simulators are almost a must when doing this kind of stuff. My turf is >>>med imaging and there usually every company invents the wheel again, >>>simulates until smoke comes out of the PC and then it all becomes a >>>trade secret. They rarely publish. >>> >>>What do you want to do? Does it have to be poured into the FPGA? >>> >> >> >> Suppose I have an AC power system, and I can digitize a pair of >> voltage and current waveforms. I want to report everything: trms >> volts/amps, true power, reactive power, phase angle. The line >> frequency could vary from maybe 20 to 80 Hz for a stationary >> generator, or 200-800 for an aircraft system (including startup and >> weird situations.) I'll digitize to 16 bits, at maybe 20K >> samples/second or something. I'm considering doing all the signal >> processing in an FPGA, crunching maybe 8 voltage+current pairs. >> >> For the rms volts/amps, we could just square the samples, filter, and >> allow my pokey uP to occasionally pick up that and square root. >> >> True power is just the product of the e*i samples, lowpass filtered. >> Easy. >> >> What's tricky is the reactive power/phase angle thing. The ideal thing >> would be to delay the voltage samples 90 degrees and then multiply by >> the current samples, then filter to get the signed reactive power. The >> trick is to delay the voltage sample data stream 90 degrees. A >> discrete (fir) Hilbert would give me the phase-shifted voltage signal >> (actually 135 deg, not 90, so I'd have to delay the current samples, >> too, but that's OK.) I just need to quantify how good a given >> implementation might be. >> >> The other way to do it would be to use a fifo clocked at a multiple of >> the waveform frequency, delaying the voltage or current samples by 90 >> degrees. That would take a digital PLL to track the voltage waveform >> frequency and generate a 128x or something tracking clock. Maybe a >> dds/nco clock gen with some fancy digital phase detector? That's >> complex, too, but has the advantage of acquiring the waveform >> frequency essentially for free. I could have a range bit the user sets >> for the 60 vs 400 Hz situations, so I'd only need about a 4:1 tracking >> range on the clock. >> >> Either way, it sounds like I'm in for some simulation. PowerBasic! >> >> >> John > >why not a synchronous demodulator (or lock-in amp ;) > >if you have 3 phases, its trivial. measure all 3 phases, and do a 3-2 >phase transform to create an equivalent rotating vector a + jb. for a >single-phase system, build a 90 degree phase shifter so you have >Vpeak*sin(theta) + j*Vpeak*cos(theta). > >then multiply by exp(-jtheta) (decompose into real & imaginary calcs) > >You will then get 2 outputs, call them Vd and Vq. If you have a pure >sinusoidal system, and theta = integral(w_line.dt) is the correct phase, >one of these will be zero. Use this as the feedback to a PI controller, >whose reference is zero. PI output has ideal line frequency added to it >(if you want, not necessary) and is then integrated to produce theta. > >once it syncs up, you have your real & imaginary V,I components in the >stationary reference frame, IOW they are DC quantities. easy to figure >out reactive power etc. > >Cheers >TerryThe only tricky part here is the "once it syncs up" bit. John
Reply by ●June 1, 20052005-06-01
On Wed, 01 Jun 2005 00:44:02 -0400, Mike Monett <no@spam.com> wrote:>John Larkin wrote: > >[...] > >> Suppose I have an AC power system, and I can digitize a pair of >> voltage and current waveforms. I want to report everything: trms >> volts/amps, true power, reactive power, phase angle. The line >> frequency could vary from maybe 20 to 80 Hz for a stationary >> generator, or 200-800 for an aircraft system (including startup and >> weird situations.) I'll digitize to 16 bits, at maybe 20K >> samples/second or something. I'm considering doing all the signal >> processing in an FPGA, crunching maybe 8 voltage+current pairs. >> >> For the rms volts/amps, we could just square the samples, filter, and >> allow my pokey uP to occasionally pick up that and square root. >> >> True power is just the product of the e*i samples, lowpass filtered. >> Easy. > >Isn't that Volt-Amperes? You need the phase angle to separate the >components into true power and reactive power. >VA would be the product of the RMS-averaged voltage and current values, which throws away phase information. The average of the instantaneous e/i sample pairs is true power, just as if you'd used an analog multiplier to calculate power.>> What's tricky is the reactive power/phase angle thing. > >Can't you just detect the zero crossings in the voltage and current >waveforms and get the phase angle between them? >No, because I only have the digitized samples, and because the current waveform has a huge dynamic range and might be very ugly. The voltage waveform in a power system is usually pretty close to a clean sine. John
Reply by ●June 1, 20052005-06-01
On Wed, 01 Jun 2005 13:36:24 GMT, Fred Bloggs <nospam@nospam.com> wrote:>Pathetically trivial when you use Parseval's Identity and various >elementary results relating multiplication in the time domain to >convolution in the frequency domain and take note that the frequency >domain representation is on an orthogonal basis...Thanks, Fred, you're always so helpful. John
Reply by ●June 1, 20052005-06-01
John Larkin wrote:> On Wed, 01 Jun 2005 16:21:36 +1200, Terry Given <my_name@ieee.org> > wrote: > > >>John Larkin wrote: >> >>>On Wed, 01 Jun 2005 00:44:18 GMT, Joerg >>><notthisjoergsch@removethispacbell.net> wrote: >>> >>> >>> >>>>Hello John, >>>> >>>>Skolnik's "Radar Handbook" has some I/Q error budgeting in chapter 3 but >>>>I don't think it'll suffice here. I have never seen a book that goes >>>>this far into practical matters on Hilbert (except for the analog >>>>version), maybe too small a market for publishers. If there is anything >>>>out there it'll be most likely for Doppler applications. >>>> >>>>Artech House may have some good stuff and you could check them. Most >>>>books about transforms come with a CD full of helpful routines but often >>>>they will be plain C code: >>>> >>>>http://www.artechhouse.com/default.asp?Frame=Book.asp&Book=C5P10&Country=&Continent=ME&State= >>>> >>>>Possibly you could start at one of the math simulator vendors, like here: >>>> >>>>http://www.mathworks.com/access/helpdesk/help/toolbox/signal/filterd9.html >>>> >>>>Simulators are almost a must when doing this kind of stuff. My turf is >>>>med imaging and there usually every company invents the wheel again, >>>>simulates until smoke comes out of the PC and then it all becomes a >>>>trade secret. They rarely publish. >>>> >>>>What do you want to do? Does it have to be poured into the FPGA? >>>> >>> >>> >>>Suppose I have an AC power system, and I can digitize a pair of >>>voltage and current waveforms. I want to report everything: trms >>>volts/amps, true power, reactive power, phase angle. The line >>>frequency could vary from maybe 20 to 80 Hz for a stationary >>>generator, or 200-800 for an aircraft system (including startup and >>>weird situations.) I'll digitize to 16 bits, at maybe 20K >>>samples/second or something. I'm considering doing all the signal >>>processing in an FPGA, crunching maybe 8 voltage+current pairs. >>> >>>For the rms volts/amps, we could just square the samples, filter, and >>>allow my pokey uP to occasionally pick up that and square root. >>> >>>True power is just the product of the e*i samples, lowpass filtered. >>>Easy. >>> >>>What's tricky is the reactive power/phase angle thing. The ideal thing >>>would be to delay the voltage samples 90 degrees and then multiply by >>>the current samples, then filter to get the signed reactive power. The >>>trick is to delay the voltage sample data stream 90 degrees. A >>>discrete (fir) Hilbert would give me the phase-shifted voltage signal >>>(actually 135 deg, not 90, so I'd have to delay the current samples, >>>too, but that's OK.) I just need to quantify how good a given >>>implementation might be. >>> >>>The other way to do it would be to use a fifo clocked at a multiple of >>>the waveform frequency, delaying the voltage or current samples by 90 >>>degrees. That would take a digital PLL to track the voltage waveform >>>frequency and generate a 128x or something tracking clock. Maybe a >>>dds/nco clock gen with some fancy digital phase detector? That's >>>complex, too, but has the advantage of acquiring the waveform >>>frequency essentially for free. I could have a range bit the user sets >>>for the 60 vs 400 Hz situations, so I'd only need about a 4:1 tracking >>>range on the clock. >>> >>>Either way, it sounds like I'm in for some simulation. PowerBasic! >>> >>> >>>John >> >>why not a synchronous demodulator (or lock-in amp ;) >> >>if you have 3 phases, its trivial. measure all 3 phases, and do a 3-2 >>phase transform to create an equivalent rotating vector a + jb. for a >>single-phase system, build a 90 degree phase shifter so you have >>Vpeak*sin(theta) + j*Vpeak*cos(theta). >> >>then multiply by exp(-jtheta) (decompose into real & imaginary calcs) >> >>You will then get 2 outputs, call them Vd and Vq. If you have a pure >>sinusoidal system, and theta = integral(w_line.dt) is the correct phase, >>one of these will be zero. Use this as the feedback to a PI controller, >>whose reference is zero. PI output has ideal line frequency added to it >>(if you want, not necessary) and is then integrated to produce theta. >> >>once it syncs up, you have your real & imaginary V,I components in the >>stationary reference frame, IOW they are DC quantities. easy to figure >>out reactive power etc. >> >>Cheers >>Terry > > > The only tricky part here is the "once it syncs up" bit. > > Johnbecause Vq == 0 (ish) (and Vd == Vpeak) is the very definition of locked, a sync detector is pretty easy. |Va| diode-ORed with |Vb| gives a nice big DC signal whenever Vac exists, ensuring you can quickly and easily tell when an AC supply voltage exists of a suitable magnitude, and whether or not lock-in has occurred is then a simple Vq thresholding exercise (given suitable PI gains). Cheers Terry






