# Ofdm snr

**URL:** <https://www.ruby-forum.com/t/ofdm-snr/240162>\
**Category:** GNU Radio\
**Created:** [March 31, 2014, 1:06pm UTC](https://www.ruby-forum.com/t/ofdm-snr/240162 "2014-03-31T13:06:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 31, 2014, 1:06pm UTC](https://www.ruby-forum.com/t/ofdm-snr/240162/1 "2014-03-31T13:06:28Z")

</div>

Hi all,

I am trying to estimate SNR in OFDM system using USRP 2. I am using two  
URSP’s (XVCR 2450). To do that I am using Gnu radio 3.7.2 with slightly  
modify OFDM\_benchmark\_receiver (see img Rx\_snr) and transmitter (img  
Tx\_snr).

1. I want to estimate SNR using IQ samples. But when I receive IQ  
samples  
on the receiver (img iq\_samples\_eq) they are all “perfect”. So my first  
question is, is there some kind of “hard decision” in OFDM Frame  
Equalizer?  
Without OFDM Frame Equalizer (img iq\_samples\_no\_s)

2. The second problem is, that I need to have a white noise not coloured  
noise.  
And to to that i need to get rid of the equalizer part of the OFDM Frame  
Equalizer. The part of correction frequency shift on the symbols need to  
stay.  
Do You have some hints how to do that? (Just commented “//” this part ?  
// Do the equalizing  
d\_eq-\>reset();  
d\_eq-\>equalize(out, frame\_len, d\_channel\_state);  
d\_eq-\>get\_channel\_state(d\_channel\_state);

3. The 3 question is about Constellation Plot in Gnuradio. My system is  
based on BPSK so on Constellation Plot I am expecting only the +1, -1  
values. The IQ samples are showing me that this is correct +1,-1 so why  
on  
the plot i have the values (-0.7,-0.7),(0.7,0.7) (img Tx\_snr\_run) ? Why  
Constellation Plot is shifting my values?

4. Last question is about the MPSK SNR Estimator. I am wondering is  
there a  
possibility to apply this block to OFDM?

My specs of system:  
FFT length = 64  
Sample rate = 2M  
Packet length = 40 ( i tried with different packet length and 40 gave  
the  
best results)  
Modulation = BPSK  
Carrier frequency = 2.4 Ghz  
Occupied carriers = 52

Best regards,  
Piotr Potocki

---

<div class="post-metadata">

**Author:** ![Piotr\_Potocki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f8ce5/32.png) [@Piotr\_Potocki](https://www.ruby-forum.com/u/Piotr_Potocki)\
**Post date:** [March 31, 2014, 3:37pm UTC](https://www.ruby-forum.com/t/ofdm-snr/240162/2 "2014-03-31T15:37:13Z")

</div>

On 03/31/2014 01:03 PM, Piotr Potocki wrote:

> 1. I want to estimate SNR using IQ samples. But when I receive IQ  
> samples on the receiver (img iq\_samples\_eq) they are all “perfect”. So  
> my first question is, is there some kind of “hard decision” in OFDM  
> Frame Equalizer? Without OFDM Frame Equalizer (img iq\_samples\_no\_s)

Yes – the current equalizer discards soft information. That’s a clear  
shortcoming, but I simply haven’t had the time to implement a proper  
equalizer so far, and if anyone else has, they haven’t committed it  
upstream.

You can write your own equalizers by subclassing ofdm\_equalizer\_base.  
It’s pretty simple, if you already have an algorithm in C++.

> 1. The second problem is, that I need to have a white noise not coloured  
> noise.  
> And to to that i need to get rid of the equalizer part of the OFDM Frame  
> Equalizer. The part of correction frequency shift on the symbols need to  
> stay.  
> Do You have some hints how to do that? (Just commented “//” this part ?  
> // Do the equalizing  
> d\_eq-\>reset();  
> d\_eq-\>equalize(out, frame\_len, d\_channel\_state);  
> d\_eq-\>get\_channel\_state(d\_channel\_state);

That should work. The cleaner way would be to add a ‘dummy’ equalizer  
that can be dropped in.  
Note that if you leave the equalizer out, you will be able to do nothing  
but SNR estimation. I don’t know the details of those algorithms by  
heart, but some might not work either, since symbols will be phase  
rotated.  
Maybe you can intercept the channel state PMT in a custom block, modify  
that to your needs, and use the ofdm\_equalizer\_static.

> 1. The 3 question is about Constellation Plot in Gnuradio. My system is  
> based on BPSK so on Constellation Plot I am expecting only the +1, -1  
> values. The IQ samples are showing me that this is correct +1,-1 so why  
> on the plot i have the values (-0.7,-0.7),(0.7,0.7) (img Tx\_snr\_run) ?  
> Why Constellation Plot is shifting my values?

Use the scope sink in XY mode, not the constellation plot. That’ll try  
and actually rx.

> 1. Last question is about the MPSK SNR Estimator. I am wondering is  
> there a possibility to apply this block to OFDM?

If you had a flat fading channel, you could use that after the  
serialization. For more usual OFDM channels, probably not, at least not  
out-of-the box. There are several papers that modify these algorithms  
for OFDM, and I don’t think we’ve implemented any of them.

M

---

<div class="post-metadata">

**Author:** ![Piotr\_Potocki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5f8ce5/32.png) [@Piotr\_Potocki](https://www.ruby-forum.com/u/Piotr_Potocki)\
**Post date:** [April 12, 2014, 5:02am UTC](https://www.ruby-forum.com/t/ofdm-snr/240162/3 "2014-04-12T05:02:32Z")

</div>

On 04/10/2014 01:33 PM, Piotr Potocki wrote:

> find any other code that is doing this mapping.  
> So where the mapping is taking place?

Hm, this won’t work, I guess. Line 102 does the actual assignment…

> 1. Unfortunately commentating out this part is not only disabling  
> equalization but also the phase correction and frequency correction.  
> But i figure out that for SNR estimation i don’t need phase and freq  
> correction. The downside is that when i am trying to estimate SNR i  
> don’t receive correct data.

You definitely need the coarse freq offset correction. That also means  
fiddling with your phase (which shouldn’t matter for SNR estimation).  
However, that’s done in ofdm\_frame\_equalizer\_vcvc.

And yeah, of course you don’t get correct data if you don’t equalize.

> 1. Thanks for it the scope sink in XY mode works perfect. And one small  
> question, how to make constant X,Y coordinate system (set X value from  
> -2 to 2 and Y -2 to 2)?

QT or WX? Have a look at the GRC property dialogues.

> And last question is abut transferring data to Matlab. To estimate SNR i  
> need to take the complex value and ‘take’ them to mag^2.  
> But i don’t know how to read/open this .dat file in Matlab. First i was  
> trying to use block ‘complex to mag^2’ in gnuradio and then write the  
> data to a file (constellation3.dat). And then use Matlab simple function:  
> fileID\_rx=fopen(‘constellation3.dat’);  
> snr=fread(fileID\_rx,‘double’);  
> But the results are not correct.

Look at read\_float\_binary.m, also read the FAQ.

- Martin
