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

The frame_builder class. More...

#include <frame_builder.h>

Public Member Functions

 frame_builder ()
 Constructor for frame_builder class. More...
 
std::vector< std::complex
< double > > 
build_frame (std::vector< unsigned char > payload, Rate rate)
 Main function for building a PHY frame. More...
 

Private Attributes

fft m_ifft
 The fft instance used to perform the inverse FFT on the OFDM symbols. More...
 

Detailed Description

The frame_builder class.

Inputs vector of unsigned chars representing the payload (MPDU) and the transmission PHY transmission rate.

Outputs vector of raw complex samples representing the digital base-band time domain signal to be passed to the usrp class for up-conversion and transmission over the air.

This class takes input data (MPDUs) and builds PHY layer frames by first prepending a PHY header and appending an IEEE CRC-32 checksum to the data. It then encodes the data by scrambling, convolutional coding the data at the coding rate specified (this may or may not require puncturing), and interleaving the data. It then modulates the data as specified. The modulated data is then mapped into symbols with the data being mapped to the respective data subcarriers with pilots and nulls being mapped to their respective subcarriers. Each symbol is then run through an IFFT to convert it to time domain an a cyclic prefix is attached to each symbol. Finally, the symbols are concatenated together and a preamble is prepended to complete the frame. The frame is then returned so that it can be passed to the USRP for transmission.

Definition at line 46 of file frame_builder.h.

Constructor & Destructor Documentation

fun::frame_builder::frame_builder ( )

Constructor for frame_builder class.

-Initializations

  • m_ifft -> 64 point IFFT object

Definition at line 40 of file frame_builder.cpp.

40  :
41  m_ifft(64)
42  {
43  }

Member Function Documentation

std::vector< std::complex< double > > fun::frame_builder::build_frame ( std::vector< unsigned char >  payload,
Rate  rate 
)

Main function for building a PHY frame.

Parameters
payload(MPDU) the data that needs to be transmitted over the air.
ratethe PHY transmission rate at which to transmit the respective data at.
Returns
A vector of complex doubles representing the digital base-band time domain signal to be passed to the usrp class for up-conversion and transmission over the air.

The build_frame function is the main function where the input data is converted to the raw output samples. The ppdu class is used to append the PHY header, scramble, convolutional code, interleaves, and modulates the input data. The symbol mapper converts the modulated data into symbols and maps the data, pilots, and nulls to their respective subcarriers. The IFFT performs and IFFT (go figure). The cyclic prefixes are added and finally the preamble is prepended to complete the frame which is then returned to be passed to the usrp block.

Definition at line 53 of file frame_builder.cpp.

References fun::ppdu::encode(), fun::fft::inverse(), m_ifft, fun::symbol_mapper::map(), and fun::PREAMBLE_SAMPLES.

Referenced by fun::transmitter::send_packet(), and test_sim().

54  {
55  //Append header, scramble, code, interleave, & modulate
56  ppdu ppdu_frame(payload, rate);
57  std::vector<std::complex<double> > samples = ppdu_frame.encode();
58 
59  // Map the subcarriers and insert pilots
60  symbol_mapper mapper = symbol_mapper();
61  std::vector<std::complex<double> > mapped = mapper.map(samples);
62 
63  // Perform the IFFT
64  m_ifft.inverse(mapped);
65 
66  // Add the cyclic prefixes
67  std::vector<std::complex<double> > prefixed(mapped.size() * 80 / 64);
68  for(int x = 0; x < mapped.size() / 64; x++)
69  {
70  memcpy(&prefixed[x*80], &mapped[x*64+48], 16*sizeof(std::complex<double>));
71  memcpy(&prefixed[x*80+16], &mapped[x*64], 64*sizeof(std::complex<double>));
72  }
73 
74  // Prepend the preamble
75  std::vector<std::complex<double> > frame(prefixed.size() + 320);
76 
77  memcpy(&frame[0], &PREAMBLE_SAMPLES[0], 320 * sizeof(std::complex<double>));
78  memcpy(&frame[320], &prefixed[0], prefixed.size() * sizeof(std::complex<double>));
79 
80  // Return the samples
81  return frame;
82  }

Member Data Documentation

fft fun::frame_builder::m_ifft
private

The fft instance used to perform the inverse FFT on the OFDM symbols.

Definition at line 66 of file frame_builder.h.

Referenced by build_frame().


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