GNU Radio 3.5.3.2 C++ API
|
Polyphase filterbank channelizer with gr_complex input, gr_complex output and float taps. More...
#include <gr_pfb_channelizer_ccf.h>
Public Member Functions | |
~gr_pfb_channelizer_ccf () | |
void | set_taps (const std::vector< float > &taps) |
void | print_taps () |
int | general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) |
compute output items from input items | |
Friends | |
GR_CORE_API gr_pfb_channelizer_ccf_sptr | gr_make_pfb_channelizer_ccf (unsigned int numchans, const std::vector< float > &taps, float oversample_rate) |
Polyphase filterbank channelizer with gr_complex input, gr_complex output and float taps.
This block takes in complex inputs and channelizes it to M channels of equal bandwidth. Each of the resulting channels is decimated to the new rate that is the input sampling rate fs divided by the number of channels, M.
The PFB channelizer code takes the taps generated above and builds a set of filters. The set contains M number of filters and each filter contains ceil(taps.size()/decim) number of taps. Each tap from the filter prototype is sequentially inserted into the next filter. When all of the input taps are used, the remaining filters in the filterbank are filled out with 0's to make sure each filter has the same number of taps.
Each filter operates using the gr_fir filter classs of GNU Radio, which takes the input stream at i and performs the inner product calculation to i+(n-1) where n is the number of filter taps. To efficiently handle this in the GNU Radio structure, each filter input must come from its own input stream. So the channelizer must be provided with M streams where the input stream has been deinterleaved. This is most easily done using the gr_stream_to_streams block.
The output is then produced as a vector, where index i in the vector is the next sample from the ith channel. This is most easily handled by sending the output to a gr_vector_to_streams block to handle the conversion and passing M streams out.
The input and output formatting is done using a hier_block2 called pfb_channelizer_ccf. This can take in a single stream and outputs M streams based on the behavior described above.
The filter's taps should be based on the input sampling rate.
For example, using the GNU Radio's firdes utility to building filters, we build a low-pass filter with a sampling rate of fs, a 3-dB bandwidth of BW and a transition bandwidth of TB. We can also specify the out-of-band attenuation to use, ATT, and the filter window function (a Blackman-harris window in this case). The first input is the gain of the filter, which we specify here as unity.
self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)
The filter output can also be overs ampled. The over sampling rate is the ratio of the the actual output sampling rate to the normal output sampling rate. It must be rationally related to the number of channels as N/i for i in [1,N], which gives an outputsample rate of [fs/N, fs] where fs is the input sample rate and N is the number of channels.
For example, for 6 channels with fs = 6000 Hz, the normal rate is 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2, so the output rate would be 1200 Hz.
The theory behind this block can be found in Chapter 6 of the following book.
f. harris, "Multirate Signal Processing for Communication Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.
gr_pfb_channelizer_ccf::~gr_pfb_channelizer_ccf | ( | ) |
int gr_pfb_channelizer_ccf::general_work | ( | int | noutput_items, |
gr_vector_int & | ninput_items, | ||
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [virtual] |
compute output items from input items
noutput_items | number of output items to write on each output stream |
ninput_items | number of input items available on each input stream |
input_items | vector of pointers to the input items, one entry per input stream |
output_items | vector of pointers to the output items, one entry per output stream |
general_work must call consume or consume_each to indicate how many items were consumed on each input stream.
Implements gr_block.
void gr_pfb_channelizer_ccf::print_taps | ( | ) |
Print all of the filterbank taps to screen.
void gr_pfb_channelizer_ccf::set_taps | ( | const std::vector< float > & | taps | ) |
Resets the filterbank's filter taps with the new prototype filter
taps | (vector/list of floats) The prototype filter to populate the filterbank. |
GR_CORE_API gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf | ( | unsigned int | numchans, |
const std::vector< float > & | taps, | ||
float | oversample_rate | ||
) | [friend] |
Build the polyphase filterbank decimator.
numchans | (unsigned integer) Specifies the number of channels M |
taps | (vector/list of floats) The prototype filter to populate the filterbank. |
oversample_rate | (float) The over sampling rate is the ratio of the the actual output sampling rate to the normal output sampling rate. It must be rationally related to the number of channels as N/i for i in [1,N], which gives an outputsample rate of [fs/N, fs] where fs is the input sample rate and N is the number of channels. |
For example, for 6 channels with fs = 6000 Hz, the normal rate is 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample ratio is 6000 Hz, or 6 times the normal 1000 Hz.