Sunday, October 14, 2012

Something Important about usrp_spectrum_sense.py

gr_bin_statistics_f just keeps track of the maximum power in each FFT bin

--tune-delay  :  should include time for the front end PLL to settle, plus time for the  new samples to propagate through the pipeline.  The default is 1ms,  which is probably in the ballpark on the RFX-* boards.  The TVRX  board is much slower.  The tuner data sheets says it could take 100ms to  settle.

--dwell-delay :  says how long you want to "stare" at any particular window.

m.center_freq is the current tunning/tunned freq

m.data is the mag-squared of the FFT.

http://gnuradio.4.n7.nabble.com/attachment/13587/0/graph.JPG
Output from m.data is from the center frequency to the maximum frequency and half way it flips to the minimum frequency and increases back to the center frequency.

In other words : 

The first half of the array contains the positive baseband frequencies,  which corresponds to the passband center frequency out to the maximum  passband frequency.

The second half of the array contains the negative baseband frequencies,
which correspond to the lowest passband frequency up to the passband
center frequency.

This format is due to the output format of the underlying fftw library we use to calculate FFTs.

You can rotate the values by swapping the first and second halves of the array and end up with it going from lowest passband frequency to highest passband frequency.

If you have taken 512 point FFT then , for each 512 bins, (m.data[0]) to (m.data[255]) are mag_squared values for (m.center[0]) to (m.center[0] +freq_step/2), and (m.data[256]) to (m.data[511]) are mag_squared values for (m.center[0]-freq_step/2) to (m.center[0]).

USRP is capable to monitor 32MHz theoritically but because of USB it can send only 8MHz of bandwidth to the CPU.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a line in the usrp_spectrum_sense.py

self.msgq = gr.msg_queue(16) ,

Here 16 means the number of messages in the queue

If you set it to 0 , that means no limit

If the queue is full, an attempt to add a message will block until there's room.

gr_message_sink also has an option that will have it drop messages if the message queue is full

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

log = gr.nlog10_ff(10, self.fft_size, -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)). 

** This formula is used to convert the FFT output value to dB. This is relative conversion and the values does not mean actual power because the actuall power value  depends on other factors such as RF gain used. 


** What is meant by relative, is that if the input signal power is (for example) -20dBm and we measured it in this formula as (say) 50dB, then when we change the signal power to -30dBm, we get 40dB from the output of this formula. So, lowering signal power level by 10dBm result a 10dB value reduction from the formula output. 

** So, what is the factors that effect dB conversion?. The first value is the FFT size, so that when we change the FFT size, the formula should compensate for this. Second we should compensate for the taps of the window used for FFT (Hanning, Hamming,...etc).   

 

2 comments:

  1. Wow.. nice description.. BTW, how many blogs are u maintaining man??

    ReplyDelete
  2. Senthil , this is just a scratch pad before I put something on the main blog :)

    ReplyDelete