Forums

Does Paraller implementation of IIR help with delay?

Started by Mil1o 4 years ago13 replieslatest reply 4 years ago146 views

Hello,

I am using a lowpass biquad to measure rms of a signal (fc 10 Hz, FS=48K).

It is not smooth enough so I would want to increase the order but If I do that by cascading to biquads it will have too much delay. Does it help if instead of cascading them I implement a parallel filter structure?


Thanks,

Milad

[ - ]
Reply by dgshaw6July 26, 2018

Can you decimate a couple of times first, and then do the Biquad?

Consider a cascade of half-band filters to get the sampling rate down first.

Also, if you are measuring RMS, what is the time constant of the filter you want, and if it is long enough, why do you care about delay?

If you were doing a simple boxcar average with a cutoff of 10 Hz it is virtually equivalent to 4800 samples of delay.  That's a lot, so I'm confused by your issues with delay.

[ - ]
Reply by Mil1oJuly 26, 2018

Can you elaborate? Do I need to use antialiasing filter and downsample it?

Doesn't decimation add to the delay itself?


This whole rms filter is a side chain and the problem is due to it's delay I'll have to have long buffer in the signal path.

[ - ]
Reply by dgshaw6July 26, 2018

For decimation, you will have to have some anti-aliasing filtering.

Decimation will add to delay, but it is un-avoidable.

You have expressed a desire to measure RMS with a LPF that has a cutoff of 10 Hz.  If you think this through, consider that one way to do it is to square all the samples and then average them, after which you take the square root (the definition of RMS). In order to get the averaging down to a point where frequencies above 10 Hz do not have much effect on your estimate, you need to look at an average of at least 4800 samples, before you even get your first valid result.  That is a delay of 100 msec from when the first sample enters the system.

So, I am confused by your design issue with delay.

I'm sorry to report that you cannot measure RMS with few components above 10 Hz without delaying your signal a lot.  Reminds me of uncertainty.

I need to add one point.

If you use biquads, your can do the implementation with minimum phase.  That is as as little delay as you can get for the response you want in frequency.

[ - ]
Reply by dgshaw6July 26, 2018

Looks like I may have missed the essence of your issue.

I re-read you comment and see that you are trying to align your RMS estimate with the signal itself.

If this is true, then there is no way around the delay.  But again, as I just commented, cascaded biquads will give you the minimum group delay possible for a given frequency cutoff.

[ - ]
Reply by Mil1oJuly 26, 2018

Thanks. 

But still my main question is does it help if instead of cascading I put them in parallel?

[ - ]
Reply by dgshaw6July 27, 2018

My understanding is that the design of the IIR filter you want will define the delay.  A parallel or cascade implementation in the form of biquads are just different ways of implementing the same basic IIR filter response.

So I don't think that the implementation in biquads will change the actual delay of the same IIR filter response.

[ - ]
Reply by Tim WescottJuly 28, 2018

Yes.  The transfer function determines the delay.  Putting two low-pass filters in parallel will, in general, give you a different transfer function.  \(H_1 + H_2 \ne H_1 \cdot H_2\).

[ - ]
Reply by dszaboJuly 27, 2018

Not really.  If you put two of the same filter in parallel, it would be the same as one filter with the gain increased by a factor of two. If you arbitrarily combine two biquad filters in parallel, there is an equivalent combination of two series filters.  Regarding your application, you should probably use an FIR filter instead if you want to keep the group delay low

[ - ]
Reply by dgshaw6July 27, 2018

An FIR filter with minimum phase response can - at best - match the delay of a set of biquads.

I believe that you won't be able to do any better WRT delay.

A typical FIR design will be linear phase by default, and therefore will have more delay than the IIR design.

[ - ]
Reply by dszaboJuly 27, 2018

I mostly agree.  If the biquad has all its poles and zeroes inside the unit circle in the z-domain, it’s already minimum phase, so it’s true that there is nothing to gain there.

Similarly, for that particular amplitude response, the biquad is the minimum phase implementation, so saying the same thing in a different way, nothing to gain there.

I agree that phase linear filter would not provide any benefit in terms of group delay.

What I would say is that the only way to reduce group delay is to make concessions in the amplitude response. I suppose this could either mean modifying your IIR coefficients, or trying to implement an FIR filter

[ - ]
Reply by fred_harrisJuly 27, 2018

Hello Milad,

You are trying to build a biquad low-pass filter with a large ratio of sample rate to bandwidth. The biquad is ill conditioned for this task, see attached paper. There are better architectures. one is called a normal filter. Raising the order is no useful, in fact raising the order makes the problem worse. You also run into finite arithmetic effects... reducing the bandwidth causes processing gain in proportion to the BW ratio...and in an IIR filter each pole causes additional gain... the total gain being the product of the reciprocal distance of each pole from the DC frequency, (Z=1+j0). Evaluate your denominator at Z=1 to see the severity of the gain problem. Even double precison floating point is overwhelmed by the ill conditioning of the biquad. Reducing the BW with a cascade of 1/2 band filters will improve conditioning but will not reduce delay. You now run into the signal processing uncertainty principle... time bandwidth product is bounded by 0.5 BW goes down, time duration of filter time duration goes up without regard for sample rate. The higher sample rate just means you work harder. is there something about the signal that you can use? Is it a random signal? Is it a sinusoid? very different signals which require very different processing to estimate RMS. Additional information may simplify problem. A point of clarification. Do you want the RMS value of a narrow signal with 10 Hz BW which you have squared and now average or do want the RMS value of a broadband signal (so 20 kHz BW) which you have squared and then want to filter down with a post detection averager to reduce the 1-sigma bar around your estimated value of average.  If you can confine the question to your desired result we can reduce the wok to get you to that result 


sdr_2007_narrowband_IIR_filters.pdf  

[ - ]
Reply by Mil1oJuly 27, 2018

The input is 48KHz audio signal. In the side chain I am want to measure the rms in low frequencies so first I apply a low pass filter (around 200 Hz). (I can downsample it if I want to). Next: X.^2 => Biquads => sqrt to give me the rms. This rms is downsampled and applied to 2 ms frame of signal.
What I am most concerned is tradeoff between low latency in the signal path (below 10 ms) and fluctuations in rms estimate. 

I am not too worried about precision since it is not fixed point arithmetic. I want to measure rms

[ - ]
Reply by Tim WescottJuly 28, 2018

As I posted below in reply to someone, no, it probably won't help.

However -- do you mean actual real-time delay, or do you mean group delay that varies with frequency?  I.e, are you concerned that the signal will get "smeared out" more than it needs to be, but it doesn't matter if it's a bit late in chronological time, or are you concerned about the actual physical delay from the moment that some event occurs until the moment that you can detect that event in your hardware or software?