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

The symbol_mapper class. More...

#include <symbol_mapper.h>

Public Member Functions

 symbol_mapper ()
 Constructor for symbol mapper class. More...
 
std::vector< std::complex
< double > > 
map (std::vector< std::complex< double > > data_samples)
 Maps the data, pilots, and nulls to their respective subcarriers. More...
 
std::vector< std::complex
< double > > 
demap (std::vector< std::complex< double > > samples)
 Extracts the data from the symbols throwing out the nulls and pilots. More...
 
std::vector< unsigned char > get_active_map ()
 Gets the current active map of data, pilots, and nulls. More...
 

Private Attributes

int m_data_subcarrier_count
 Number of data subcarriers. More...
 
int m_pilot_count
 Number of pilot subcarriers. More...
 

Static Private Attributes

static const std::vector
< unsigned char > 
m_active_map
 The current map of data, pilots, and nulls. More...
 
static const double POLARITY [127]
 The Pilot Polarity Sequence. More...
 
static const std::complex< double > PILOTS [4]
 The 4 Pilot symbols. More...
 

Detailed Description

The symbol_mapper class.

The symbol mapper class takes the stream of modulated data and maps it into symbols by mapping the data, pilots, and nulls onto their respective subcarriers. Conversely it also extracts the data from received symbols.

Definition at line 24 of file symbol_mapper.h.

Constructor & Destructor Documentation

fun::symbol_mapper::symbol_mapper ( )

Constructor for symbol mapper class.

-Initializations

Definition at line 68 of file symbol_mapper.cpp.

68  :
70  m_pilot_count(4)
71  {
72  }

Member Function Documentation

std::vector< std::complex< double > > fun::symbol_mapper::demap ( std::vector< std::complex< double > >  samples)

Extracts the data from the symbols throwing out the nulls and pilots.

Parameters
samplesVector of symbols to extract data from
Returns
Vector of data samples

Takes in a vector of samples and extracts the 48 data subcarriers while throwing away the nulls and the pilots. The input must be an integer multiple of 64 (the size of one symbol) in length so that we do not have partial symbols which wouldn't make sense. The output is simply a stream of received data however it will be an integer multiple of 48.

Definition at line 128 of file symbol_mapper.cpp.

References m_active_map, and m_data_subcarrier_count.

129  {
130  assert(samples.size() % m_active_map.size() == 0);
131 
132  std::vector<std::complex<double> > data_samples(samples.size() * m_data_subcarrier_count / m_active_map.size());
133  int out_index = 0;
134  for(int x = 0; x < samples.size(); x++)
135  {
136  int index = x % m_active_map.size();
137  if(m_active_map[index] == 1)
138  data_samples[out_index++] = samples[x];
139  }
140 
141  return data_samples;
142  }
std::vector< unsigned char > fun::symbol_mapper::get_active_map ( )

Gets the current active map of data, pilots, and nulls.

Returns
The current active map.

Definition at line 145 of file symbol_mapper.cpp.

References m_active_map.

146  {
147  return m_active_map;
148  }
std::vector< std::complex< double > > fun::symbol_mapper::map ( std::vector< std::complex< double > >  data_samples)

Maps the data, pilots, and nulls to their respective subcarriers.

Parameters
data_samplesVector of modulated data to be mapped into symbols
Returns
Vector of symbols with data, pilots, and nulls

Takes a vector of modulated data samples and maps them into OFDM symbols. The vector of data samples must be an integer multiple of 48 so that an integer number of symbols can be created since there are 48 data subcarriers. It also inserts the 4 pilot subcarriers and 12 null subcarriers. The output is a vector of samples with each set of 64 samples constituting one symbol.

Definition at line 81 of file symbol_mapper.cpp.

References m_active_map, m_data_subcarrier_count, PILOTS, and POLARITY.

Referenced by fun::frame_builder::build_frame().

82  {
83  assert(data_samples.size() % m_data_subcarrier_count == 0);
84 
85  std::complex<double> pilot_value = std::complex<double>(1, 0);
86  std::complex<double> null_value = std::complex<double>(0, 0);
87 
88  std::vector<std::complex<double> > samples(data_samples.size() * m_active_map.size() / m_data_subcarrier_count);
89  int out_index = 0, in_index = 0;
90  int symbol_count = 0;
91 
92  for(int x = 0; x < data_samples.size(); x+= m_data_subcarrier_count)
93  {
94  int pilot_index = 0;
95  for(int s = 0; s < m_active_map.size(); s++)
96  {
97  switch(m_active_map[s])
98  {
99  // Null subcarrier
100  case 0:
101  samples[out_index++] = null_value;
102  break;
103 
104  // Data subcarrier
105  case 1:
106  samples[out_index++] = data_samples[in_index++];
107  break;
108 
109  // Pilot subcarrier
110  case 2:
111  samples[out_index++] = PILOTS[pilot_index++] * POLARITY[symbol_count % 127];
112  break;
113  }
114  }
115  symbol_count++;
116  }
117 
118  return samples;
119  }

Member Data Documentation

const std::vector< unsigned char > fun::symbol_mapper::m_active_map
staticprivate
Initial value:
=
{
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
}

The current map of data, pilots, and nulls.

The map for where the data, pilots, and null subcarriers go.

  • Legend:
    • 0 -> null
    • 1 -> data
    • 2 -> pilot

Definition at line 56 of file symbol_mapper.h.

Referenced by demap(), get_active_map(), and map().

int fun::symbol_mapper::m_data_subcarrier_count
private

Number of data subcarriers.

Definition at line 62 of file symbol_mapper.h.

Referenced by demap(), and map().

int fun::symbol_mapper::m_pilot_count
private

Number of pilot subcarriers.

Definition at line 64 of file symbol_mapper.h.

const std::complex< double > fun::symbol_mapper::PILOTS
staticprivate
Initial value:
=
{
{ 1, 0},
{ 1, 0},
{ 1, 0},
{-1, 0}
}

The 4 Pilot symbols.

The pilots are always BPSK modulated, or in other words they are always (1 + 0j) or (-1 + 0j). Also, the first three pilots are always the same with the 4th pilot being inverted.

Definition at line 60 of file symbol_mapper.h.

Referenced by map().

const double fun::symbol_mapper::POLARITY
staticprivate
Initial value:
=
{
1, 1, 1, 1,-1,-1,-1, 1,-1,-1,-1,-1, 1, 1,-1, 1,
-1,-1, 1, 1,-1, 1, 1,-1, 1, 1, 1, 1, 1, 1,-1, 1,
1, 1,-1, 1, 1,-1,-1, 1, 1, 1,-1, 1,-1,-1,-1, 1,
-1, 1,-1,-1, 1,-1,-1, 1, 1, 1, 1, 1,-1,-1, 1, 1,
-1,-1, 1,-1, 1,-1, 1, 1,-1,-1,-1, 1, 1,-1,-1,-1,
-1, 1,-1,-1, 1,-1, 1, 1, 1, 1,-1, 1,-1, 1,-1, 1,
-1,-1,-1,-1,-1, 1,-1, 1, 1,-1, 1,-1, 1, 1, 1,-1,
-1, 1,-1,-1,-1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1
}

The Pilot Polarity Sequence.

The polarity sequence that is multiplied by the pilot sample for each OFDM symbol beginning with the signal symbol. For example, the pilots in the signal symbol will all be multipled by POLARITY0. The next symbol will be multipled by POLARITY[1], and so on. If the number of symbols is longer than 127 then the sequence just wraps back around to the beginning. The modulus (%) operator is very useful for achieving this effect.

Definition at line 58 of file symbol_mapper.h.

Referenced by map().


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