fun_ofdm  1.0
802.11a Physical Layer for USRP
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
fun::phase_tracker Class Reference

The phase_tracker block. More...

#include <phase_tracker.h>

Inheritance diagram for fun::phase_tracker:
fun::block< tagged_vector< 64 >, tagged_vector< 48 > > fun::block_base

Public Member Functions

 phase_tracker ()
 Constructor for phase_tracker block. More...
 
virtual void work ()
 Signal processing happens here. More...
 
- Public Member Functions inherited from fun::block< tagged_vector< 64 >, tagged_vector< 48 > >
 block (std::string block_name)
 constructor More...
 
- Public Member Functions inherited from fun::block_base
 block_base (std::string block_name)
 block_base constructor More...
 

Private Attributes

int m_symbol_count
 Counter used to keep track of the symbol number in the frame so as to know what pilot polarity to expect. This is reset at the beginning of each new frame. More...
 

Additional Inherited Members

- Public Attributes inherited from fun::block< tagged_vector< 64 >, tagged_vector< 48 > >
std::vector< tagged_vector< 64 > > input_buffer
 input_buffer contains new input items to be consumed More...
 
std::vector< tagged_vector< 48 > > output_buffer
 output_buffer is where the output items of the block should be placed More...
 

Detailed Description

The phase_tracker block.

Inputs tagged_vector<64> from channel_est block. Outputs tagged_vector <48> to frame_decoder block.

The phase tracker block is in charge of tracking and correcting phase rotation accross symbols in a frame using the 4 pilot subcarriers. It also removes the pilot and null subcarriers passing on only the data subcarriers after any necessary frequency corrections have been made.

Definition at line 32 of file phase_tracker.h.

Constructor & Destructor Documentation

fun::phase_tracker::phase_tracker ( )

Constructor for phase_tracker block.

Definition at line 57 of file phase_tracker.cpp.

57  :
58  block("phase_tracker"),
60 
61  {
62  }

Member Function Documentation

void fun::phase_tracker::work ( )
virtual

Signal processing happens here.

This block uses the pilot symbols to estimate phase rotation of each symbol on a per symbol basis The phase rotation of each pilot symbol is calculated then averaged together. The inverse of this rotation is the applied to each symbol. This is a fair assumption since the pilot symbols are evenly dispersed throughout the symbol.

Implements fun::block< tagged_vector< 64 >, tagged_vector< 48 > >.

Definition at line 70 of file phase_tracker.cpp.

References fun::DATA_SUBCARRIERS, fun::block< tagged_vector< 64 >, tagged_vector< 48 > >::input_buffer, m_symbol_count, fun::block< tagged_vector< 64 >, tagged_vector< 48 > >::output_buffer, fun::PILOTS, fun::POLARITY, and fun::START_OF_FRAME.

71  {
72  if(input_buffer.size() == 0) return;
73  output_buffer.resize(input_buffer.size());
74 
75  for(int i = 0; i < input_buffer.size(); i++)
76  {
77  if(input_buffer[i].tag == START_OF_FRAME)
78  {
79  m_symbol_count = 0; // Reset the symbol count
80  }
81 
82  // Calculate the phase error of this symbol based on the pilots
83  std::complex<double> phase_error = std::complex<double>(0,0);
84  for(int p = 0; p < 4; p++)
85  {
86  int pilot = PILOTS[p][1] * POLARITY[m_symbol_count % 127];
87  std::complex<double> ref_pilot_sample = std::complex<double>(pilot, 0);
88  std::complex<double> rec_pilot_sample = input_buffer[i].samples[PILOTS[p][0]];
89  phase_error += rec_pilot_sample * std::conj(ref_pilot_sample) / 4.0;
90  }
91 
92  double angle = std::arg(phase_error);
93 
94  // Apply the phase correction to the data samples
95  for(int s = 0; s < 48; s++)
96  {
97  int index = DATA_SUBCARRIERS[s];
98  output_buffer[i].samples[s] = input_buffer[i].samples[index] * std::complex<double>(std::cos(-angle), std::sin(-angle));
99  }
100 
101  output_buffer[i].tag = input_buffer[i].tag;
102  m_symbol_count++; //Keep track of the current symbol number in the frame
103  }
104 
105  }

Member Data Documentation

int fun::phase_tracker::m_symbol_count
private

Counter used to keep track of the symbol number in the frame so as to know what pilot polarity to expect. This is reset at the beginning of each new frame.

Definition at line 47 of file phase_tracker.h.

Referenced by work().


The documentation for this class was generated from the following files: