Showing posts with label Adaptive filtering GNURADIO USRP. Show all posts
Showing posts with label Adaptive filtering GNURADIO USRP. Show all posts

Saturday, October 20, 2012

Generating Echo

Step-1 Taking a recorded data of wcdma signal with following specs

sample rate - 12.5MSPS
center frequency - 2.15149GHz
power level - (-65dB)
number of complex samples - 1e7

File is located in /home/sumit/wcdma_data_dump

Step-2 Reading the data in matlab with the following process

cd /home/sumit/wcdma_data_dump/ % go to current directory

fid = fopen('/home/sumit/wcdma_data_dump/wcdma_65','rb'); % open file descriptor

wcdma_matlab_65 = fread(fid,20000000,'float32'); % read the binary file as 32 bit complex float
% i.e. 32 bits for I and 32 bits for Q

fclose(fid); % close the file descriptor essentially
save('wcdma_matlab_65.mat','wcdma_matlab_65'); % save the current data in .mat format
% now we will ignore first 400000 samples because there was a peak there
% because of the LO leakage



wcdma_noleak_65 = wcdma_matlab_65(800000:20000000);
% I have taken 800000 because the samples are here in the format of I and Q
% cascaded


save('wcdma_noleak_65.mat','wcdma_noleak_65');
% creating the data with no LO leakage


temp1 = wcdma_noleak_65; 

cd /home/sumit/wcdma_data_dump/


fid = fopen('temp1.bin','wb');


fwrite(fid,temp1,'float32'); % created binary file for the no LO leakage data


fclose(fid);


Step-3 Echo generation

Xecho(t-delay) = X(t-0) + X(t-delay)

I made following flow graph
Step-4 Echo Visualization 

Echo affected signal looks like this





While the original signal looked like this




Thursday, October 11, 2012

Adaptive Filtering with GNURADIO & USRP : Part-4

Lets see what is inside the gr_adaptive_fir_ccc class
There are two files c++ and header file.

Its declaration can be found in the header  gr_adaptive_fir_ccc.h

(http://gnuradio.org/doc/doxygen-3.5/gr__adaptive__fir__ccc_8h_source.html)

The line in header

class GR_CORE_API gr_adaptive_fir_ccc : public gr_sync_decimator

Tells that gr_adaptive_fir_ccc is a publickly derived class of the base class gr_sync_decimator

There are two private variables
(http://plusplussee.blogspot.com/2012/10/difference-between-public-private-and.html)

private:
std::vector  d_new_taps; // vector type gr_complex
bool                     d_updated; // bool

One is of type gr_complex and another is of type bool.
To see the data types in gnuradio please refer to gr_types.h in /usr/local/include/gnuradio

There are two protected variables also
(http://plusplussee.blogspot.com/2012/10/difference-between-public-private-and.html)

protected:
gr_complex               d_error; // gr_complex type
std::vector  d_taps; // vector type gr_complex

There are two virtual functions
virtual gr_complex error(const gr_complex &out) = 0;
virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0;

whose definition can be overridden to calculate the error signal per output and
to calculate new weight from old, corresponding input respectively.

These two virtual functions are also protected.

There are two public functions
void set_taps(const std::vector &taps);
 int work(int noutput_items,
          gr_vector_const_void_star &input_items,
          gr_vector_void_star &output_items);

for setting the tap weights and calling the work function.


 


Adaptive Filtering with GNURADIO & USRP : Part-3

There are following files in gnuradio which can help me for adaptive filtering :


In the downloads folder there are following :

/Downloads/gnuradio/build/gr-filter/python/qa_adaptive_fir_filter_test.sh

/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.cc
/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.h
/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccc.i
/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.cc
/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.h
/Downloads/gnuradio/gnuradio-core/src/lib/filter/gr_adaptive_fir_ccf.i
/Downloads/gnuradio/gr-filter/include/filter/adaptive_fir_ccc.h
/Downloads/gnuradio/gr-filter/include/filter/adaptive_fir_ccf.h
/Downloads/gnuradio/gr-filter/lib/adaptive_fir_ccc_impl.cc
/Downloads/gnuradio/gr-filter/lib/adaptive_fir_ccc_impl.h
/Downloads/gnuradio/gr-filter/lib/adaptive_fir_ccf_impl.cc
/Downloads/gnuradio/gr-filter/lib/adaptive_fir_ccf_impl.h
/Downloads/gnuradio/gr-filter/python/qa_adaptive_fir_filter.py

In the installation folder there are following :


/usr/local/include/gnuradio/gr_adaptive_fir_ccc.h
/usr/local/include/gnuradio/gr_adaptive_fir_ccf.h
/usr/local/include/gnuradio/filter/adaptive_fir_ccc.h
/usr/local/include/gnuradio/filter/adaptive_fir_ccf.h

I asked in the gnuradio community regarding these two versions of the adaptive_fir_filter classes i.e.  gr_adaptive_fir_ccc.cc & adaptive_fir_ccc.cc.

I got the reply as :

In many cases where we have functionality that we might want to use
other than as a GNU Radio block, we create an implementation class,
which we then create a gr_ class that wraps around this to bring the
implementation into an actual gr_block. So in this case, both are
valid, but one is a gr_block the other is the algorithm used inside of
the gr_block.

Tom 


http://gnuradio.4.n7.nabble.com/Reg-gr-adaptive-fir-ccc-amp-adaptive-fir-ccc-impl-tt37943.html

This means that gr_adaptive_fir_ccc makes the adaptive filter block while adaptive_fir_ccf_impl contains the implementational details of the same.


Lets look into them one by one :


Starting from  gr_adaptive_fir_ccc.cc in /Downloads/gnuradio/gnuradio-core/src/lib/filter/  and its header gr_adaptive_fir_ccc.h in /usr/local/include/gnuradio/


Dependency graph for gr_adaptive_fir_ccc.h can be found at http://gnuradio.org/doc/doxygen/gr__adaptive__fir__ccc_8h.html

Dependency graph tells us what headers they include in a hierarchical manner.

Inside the header a class named "gr_adaptive_fir_ccc" has been declared

The class reference can be found at http://gnuradio.org/doc/doxygen/classgr__adaptive__fir__ccc.html#details


So it seems that this class is used in three examples :

digital_cma_equalizer_cc

digital_kurtotic_equalizer_cc

digital_lms_dd_equalizer_cc











Adaptive Filtering with GNURADIO & USRP : Part-2

Here I will discuss how I recorded the WCDMA signals from the nearby tower in my institute. Equipments which I am having with me are USRP-2, SBX daughter board(both from Ettus research), Spectran HF6065 hand-held spectrum analyser. Spectran spectrum analyser came with a wide band antenna 100MHz -6GHz.

                                                           USRP-2 
                                                            SBX


                                                   Spectran HF6065 

Here is the screen shot of the strong WCDMA signal in my campus. I am using Spectran HF6065 and a PC suite MCS given by them :


You can see the strong WCDMA signals at 2.151GHz and 2.161GHz

For collecting the WCDMA data I connected USRP-2 with my linux based system. There is a good script in GNURADIO uhd_rx_cfile , it can collect the signals from air very simply.

For a standard GNURADIO installation it is located in /usr/local/bin

I recorded it with the following arguments

uhd_rc_cfile  -f 2.151G --gain 50 --nsamples 2000000 --samp-rate 10000000 /home/sumit/wcdma.dat

So I collected 2M samples at the sampling rate of 10MSPS.




 

Adaptive Filtering with GNURADIO & USRP : Part-1

I have started working on a project which aims to cancel the echo generated at the WCDMA on-frequency repeater stations.

The project is supported by a telecom giant(cant mention the name here)

The project will mostly consist of adaptive filtering methods. I am trying to do something using GNURADIO and  USRP.

Aim of this project is to minimize the reverse coupling between the transmit and receive antennas of the on-frequency repeater. Mostly we will go with sub-band adaptive filtering techniques.

Details of the echo (which also sometimes called reverse coupling) problem in WCDMA repeaters can be found in there papers :

1. Adaptive Echo Cancellation for an On-Frequency RF Repeater using a Weighted Power Spectrum. R. Neil Braithwaite and Scott Carichner
Powerwave Technologies, Santa Ana, CA 92705 USA

2. Echo Cancellation for a Wide Bandwidth Mixed-mode WCDMA/GSM Repeater with Digital Sub-band Filtering R. Neil Braithwaite, Scott Carichner, and Mark Cope* Powerwave Technologies, Santa Ana, CA 92705 USA and (*) Bristol UK

3. The Repeater for WCDMA Cellular Mobile Telecommunication Systems
He Songbai, Wang Bin, You Fei, Yan Xiaohuan, Bao Jingfu School of Electronic Engineering, University of Electronic Science and Technology, Chengdu 610054, China E-mail: sbhe@uestc.edu.cn

4. The use of Constant Modulus Normalization for Digital Echo Cancellation within RF Repeaters , R. Neil Braithwaite Powerwave Technologies, Santa Ana, CA 92705 USA

5. Estimation and Compensation of Radiated Feedback Coupling in a High Gain Repeater Using Gain Dithering R. Neil Braithwaite Powerwave Technologies, Santa Ana, CA 92705 USA

6. Antenna Isolation Considerations in WCDMA Repeater Deployment Azah Syafiah Mohd Marzuki, Amir RazifAbd Rahim, Benyazwar Mohmd, Khaidir Khalil, Amran Naemat and Azlinda Tee

7. A New Low-Complex Interference Cancellation Scheme for WCDMA Indoor Repeaters Moohong Lee*, Byungjik Keum*, Yunmok Son*, Joo-Wan Kim†, and Hwang Soo Lee* * Korea Advanced Institute of Science and Technology / the School of EECS, Daejeon, Korea, wildgoosemh@mmpc.kaist.ac.kr † SK Telesys, Seongnam, Korea, kjw@sktelesys.com

8. An Efficient Hardware Simulator for the Design of a WCDMA Interference Cancellation Repeater Moohong Lee, Byungjik Keum, Yunmok Son, and Hwang Soo Lee, Member, IEEE Division of Electrical Engineering of EECS KAIST, Daejeon 305-701, Korea wildgoosemh@mmpc.kaist.ac.kr , Ju Tae Song and Joo-Wan Kim, Member, IEEE R&D Center, SK Telesys Seongnam, Gyeonggi-Do 463-825, Korea kjw@sktelesys.com

9. Feedback Interference Cancellation System for WCDMA Radio Repeater
Akkarawut Thepworachai and Chaiyod Pirak The Sirindhorn International Thai-German Graduate School of Engineering (TGGS) King Mongkut's University of Technology North Bangkok 1518 Pibulsongkram Road, Bangsue, Bangkok 10800, Thailand