need a book: Hilbert transform

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

Reply to
John Larkin
Loading thread data ...

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:

formatting link

Possibly you could start at one of the math simulator vendors, like here:

formatting link

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

formatting link

Reply to
Joerg

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 to
John Larkin

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

Reply to
Terry Given
[...]

Isn't that Volt-Amperes? You need the phase angle to separate the components into true power and reactive power.

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?

[...]

Mike Monett

Reply to
Mike Monett

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 to
Fred Bloggs

The only tricky part here is the "once it syncs up" bit.

John

Reply to
John Larkin

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.

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 to
John Larkin

Thanks, Fred, you're always so helpful.

John

Reply to
John Larkin

because 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

Reply to
Terry Given
[...]

Good explanation - thanks.

Yes, the current waveform could be difficult, especially with rectifier loads feeding capacitors. The peak current can be enormous. I couldn't find any references that discuss this, but you can see the peaks of the AC waveform are flattened because of it.

I did come across an article that discusses different methods of measuring reactive power. One method is to shift the voltage waveform 90 degrees in software. Another method used in the Analog Devices E77xx series is the phase shift of a simple rc filter. This would certainly cause errors with short current spikes such as DC power supplies. Here's the url:

formatting link

Looks like you are going to have fun:)

Mike Monett

Reply to
Mike Monett

reactive power is defined:

reactive power = squareroot (apparent power ^2 - true power ^2) cos phi = true power / apparent power reactive power = sin phi * apparent power

This was done in this way because if voltage and current are not purely sinusoidal, the reactive power contains power products of harmonics. They cannot be calculated using the hilbert transform of the fundamental only. Reactive power is the square root of the square sums of fundamental rp, reactive products of equal harmonics, and products of unequal harmonics. Reactive products of equal harmonics are products of equal harmonics with integral zero ( i.e. harmonic reactive power). The time integrals of nonequal harmonics products are always zero. This is called distortion power, but its is a part of the reactive power.

True power is the square root of the square sums of fundamental real power and real products of equal harmonics. This is the same as your

Most important is to use a sampling rate which is high enough to saisfy Nyquist's theorem. A sampling frequency 100* line frequency may be a starting point, but *1000 or above may be necessary.

hope this can help to simplify your problem! regards ...gerhard

Reply to
new.online.de

In most ac power systems, the voltage waveform is reasonably sinusoidal, so I can get away with defining reactive power as the averaged product of current * (90 degree shifted voltage) waveforms.

(A good Hilbert shifts all frequencies 90 degrees!)

But I do need the phase angle. Arc-cos is ambiguous.

Actually, no. Nyquist is irrelevant: we're not trying to reconstruct the waveform, but merely gather statistics on it. One can make a very nice, accurate power meter that samples at a fraction of the line frequency.

John

Reply to
John Larkin

Hello John,

As long as the goal isn't to meter cheap printers. Their cheap-as-can-be "power supplies" sound like a moped with fouled spark plugs and their current plot looks like 4th of July fireworks ;-)

Regards, Joerg

formatting link

Reply to
Joerg

ROTFLMAO! dont beat about the bush Joerg, tell us what you really think.

Cheers Terry

Reply to
Terry Given

But longterm, you'll still get the right number of KWHs!

John

Reply to
John Larkin

Hello John,

Yes, although it could be very long term if they are constantly printing something.

Regards, Joerg

formatting link

Reply to
Joerg

Hello Terry,

No hidden agendas here. Seriously, I have a new printer where the power supply sounds like a Madagascan hissing cockroach, the scope won't sync on anything when checking the current intake and the topper was that it was able to swamp the X10 signal in that area. These signals were a whopping 3V. I wonder how it ever passed the smog check. It needed two Dollar-sized toroids just to make X10 work again.

Regards, Joerg

formatting link

Reply to
Joerg
[...]

You don't even need it. Just lock a DDS or pll to 360 times the line frequency to drive the ADC's. You can get a 90 degree shift by looking 90 clocks ahead (or behind) in memory. You can multiply the actual ADC values and not have to apologize for approximations. This also gives the phase relations needed to handle 3-phase power.

When you average the reactive power, capacitive and inductive loads give the opposite average values. So you automatically get the right answer.

Averaging also helps eliminate noise in the current waveform and improves accuracy. You can change the average in software to suit conditions.

[...]

Yes, but you have to average for a very long time. You can provide much faster response to changing conditions by using a faster clock. This may be significant when debugging 400Hz a/c power systems during engine start, for example. Silicon and software are cheap, and will be even cheaper in the future. You can add a lot of benefit for the user with a very small increase in cost.

A clock at 360X the line frequency should give plenty of resolution. It is not unreasonably high for a 16-bit ADC at 400Hz.

The nice thing about using sine and cosine is the narrow current pulses from a rectifier in a power supply only affect the real power average.

I was pleasantly surprised to find the pulses occur at the zero crossings for the reactive part, so they average to zero and have minimal affect on the result. I have some SPICE plots that show this and could post them if you like.

Mike Monett

Reply to
Mike Monett

It seems like it would be more cost effective and easier to do this using a DSP.

The Hilbert transform of a real-valued signal is as easy as two FFT's, basically, and DSP's are good at FFT's.

In any event, Xilinx has tons of notes about doing FFT's and convolution and correlation and so on on their website.

--Mac

Reply to
Mac

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.