6.888 Lab 1: OFDM Transceiver
Lab 1 Part A: Due Friday Sept. 20, 11:59 pm
Lab 1 Part B: Due Friday Sept. 27, 11:59 pm
Introduction
In this lab, you will learn how to design a simple OFDM physical layer chain. You will need
to design and write the code for each block of the RX and TX chains shown below. The code for
this lab will be written in matlab. We will provide you with a skeleton code. Ideally, you will only need to
modify the places where you see : "... add your code here ..." . We will provide you with wireless signals on
which you can test your code. The lab will be divided into several tasks. Each task will require you to run some
test script which will output a file or plot a figure. You will have to keep the figures and the output files
and submit them along with your src code.
For a detialed description of each block's functionality, you can refer to
chapter 3 of this THESIS, and chapter 2 of TEXTBOOK 1.
You can download a copy of the lab code here : 6.888_lab1.zip
The code has 4 subfolders:
- SRC_CODE: You need to implement these functions.
- Test_Scripts: Code to test the functions you implement.
- Mat_Files: Signals to test your code.
- Results: This folder is initially empty. The test scripts will output files in this folder
The above folders should contain the following files:
SRC_CODE | Test_Scripts | Mat_Files | Results |
tx_ofdm_chain.m | test_tx_ofdm_chain.m | Test_TX.mat Test_TX_R.mat | Result_TX_Chain.mat Result_TX_Chain.fig |
packet_detection.m | test_packet_detection.m | Test_Packets.mat Test_Packets_R.mat | Result_Pkt_Start.mat |
estimate_channel.m correct_channel.m | test_estimate_channel.m test_correct_channel.m | Test_Channel_R.mat | Result_Channel_Estimateion.mat Result_Channel.fig Result_Cons_Channel_Corr.fig |
rx_ofdm_chain_synced.m | test_rx_ofdm_chain_synched.m | Test_RX_Synced.mat Test_RX_Synced_R.mat | Result_RX_Chain_Synced.mat |
estimate_cfo.m correct_cfo.m | test_estimate_cfo.m test_correct_cfo.m | Test_CFO_R.mat | Result_CFO_estimation.mat Result_CFO_Correction.mat Result_Cons_CFO_Corr.fig |
estimate_residual_cfo_sfo.m correct_residual_cfo_sfo.m | test_phase_tracking.m | Test_Phase_Tracking_R.mat | Result_Phase_Tracking.mat Result_Phase_Tracking.fig |
rx_ofdm_chain.m | test_rx_ofdm_chain.m | Test_RX_Chain.mat Test_RX_Chain_R.mat | Result_RX_Chain.mat |
convert_bin_index_fft_to_normal.m convert_bin_index_normal_to_fft.m | . | Parameters.mat | . |
Lab 1 : Part A : OFDM Basic RX/TX
Due Friday Sept. 20, 11:59 pm
In the first part of the lab, we will assume that the transmitter and receiver oscillators are synchronized.
You do not need to estimate and correct for the carrier frequency offset (CFO) or perform
phase tracking. Hence, you do not need to implement the 2nd and 5th blocks of the RX Chain.
For the purpose of this lab, we will only use BPSK modulation. For both parts
of this lab, you will use the OFDM paramters shown in the table below. The wariables are stored in the
matlab file: Parameters.mat. The code loads these variables into the
workspace so you can immediately use them.
Parameter | Variable | Value |
Carrier Frequency | fc | 5.25 GHz |
Sampling frequency | fs | 128 MHz |
Subcarrier width | w | 1 MHz |
Number of Subcarriers / Symbol length | num_bins | 128 bins / samples |
Cyclic Prefix | cp | 51 samples |
Number of preamble symbols | num_syms_preamble | 8 |
Number of data symbols | num_syms_data | 72 |
Signal Length | num_samples | 13963 |
Number of data subcarriers | num_bins_data | 92 |
Number of pilot subcarriers | num_bins_pilots | 8 |
Pilot Subcarriers | pilots | [-39, -28, -17, -6, 6, 17, 28, 39] |
Gaurd/ Unused Subcarriers | gaurd_bins | [-64,...,-51, 0, 51,...,63] |
Preamble Bits | bits_preamble | ... |
Pilot Bits | bits_pilots | [1 0 1 0 0 0 1 0] |
Task 1: TX Chain
Implement the function tx_ofdm_chain.m. The function
should take the data bits as input and should output the complex
signal. To test your code, use the file Test_TX.mat.
This file has 2 variables: bits_data and tx_signal which is
the expected correct output.
- Run the code test_tx_ofdm_chain.m. It will output the file Result_TX_Chain.mat and will plot Result_TX_Chain.fig
Task 2: Packet Detection
Implement the function packet_detection.m.
It should take a complex signal as input and return the index of the first sample in the packet.
You can use the signals in Test_Packets.mat to check if your
packet detection works. This file has two variables: signals which has 100 different received complex wireless signals and
packets_start_index which has 100 indicies correponding to the start of each packet.
- Run the code test_packet_detection.m. It will output the file Result_Pkt_Start.mat
Task 3: Channel Estimation
Implement the function estimate_channel.m. The function
should take as input two received OFDM symbols and should
output the complex wireless channel estimate. Then, implement
correct_channel.m. The function should take an OFDM
symbol in the frequency domain along with an estimate of the channel and should output
the symbol after compensating for the channel.
- Run the code test_estimate_channel.m. It will output a file Result_Channel_Estimation.mat and a figure Result_Channel.fig.
- Run the code test_correct_channel.m. It will output the figure Result_Cons_Channel_Corr.fig.
Task 4: RX Chain
Implement the function rx_ofdm_chain_synced.m. The function
should take as input a complex signal and output the data bits (you can assume that the pilots are data bits for this task).
To test your code, use the file Test_RX_Synced.mat.
This file has 2 variables: bits_data and rx_signal.
- Run the code test_rx_ofdm_chain_synced.m. It will output the file Result_RX_Chain_Synced.mat
Hints:
- There are 8 preamble symbols. The first 4 are for packet detection. The next 2 are for CFO estimation and
the last 2 are for channel estimation.
- Make sure you add cyclic prefix for each symbols starting with the last preamble symbol.
- Make sure to use the proper mapping between bits and symbols in your modulation and demodulation. 0 maps to 1, 1 maps to -1.
- Make sure to use the proper subcarrier indicies. Because of fftshit, the index of the subcarrier
in the fft (1 to 128) is not the same as its normal index (-64 to 63). For example, the subcarrier with index -1 becomes
128 after the fftshift. Use the supplied functions convert_bin_index_fft_to_normal.m
and convert_bin_index_normal_to_fft.m to move between the two.
- The preamble does not need pilots and thus the variable bits_preamble
has hundred bits
- For the variabls bits_preamble and bits_data,
the first bit should map to the first subcarrier in the fft subcarrier indexing and so on (e.g. bits_preamble(1) is assigned
to fft subcarrier index 2 and bits_preamble(51) is assigned to fft subcarrier index 75). However, for the variable
bits_pilots, the first bit should map to the first subcarrier in the normal indexing
(i.e. [1 0 1 0 0 0 1 0] are assigned to normal subcarrier indicies [-39, -28, -17, -6, 6, 17, 28, 39] respectively).
- For the double sliding window packet detection, you can use a detection thershold of 6. You can also try
different thresholds and pick the one with the least error.
- Idealy, you need only 2 preamble symbols for packet detection use double sliding window. You can
use 4 preambles to improve the accuracy by using a larger window or implementing the delay and correlate
packet detection on the next 2 preamble symbols.
- In channel estimation and correction, make sure to ignore the unused subcarriers.
- In this part of the lab, you can ignore the pilot subcarriers while decoding the signal in the RX chain but not while encode the signal in the TX chain.
- Make sure to compenstate fo the cyclic prefix bofore you run the FFT in the RX chain.
- Make sure to skip enough samples of the cyclic prefix (3/4 of cp) to avoid inter symbol interference.
Submit:
Submit your code via the class's submission website, located here:
https://haithamh.scripts.mit.edu:444/6.888/handin.py
You may use your MIT Certificate or request an API key via email to log in for the first time.
Compress you folder and name it lab1a-handin.zip.
Upload that file to the submission website via the webpage or use curl and your API key:
$ curl -F file=@lab1a-handin.zip \
http://haithamh.scripts.mit.edu/6.888/handin.py/upload
Lab 1 : Part B : OFDM Phase Tracking
Due Friday Sept. 27, 11:59 pm
In this lab, you will implement the CFO estimation and correction block and the phase tracking block.
Task 1: CFO Estimation and Correction
Implement the function estimate_cfo.m. The function
should take as input two received OFDM symbols and
output an estimate of the CFO. Then, implement
correct_cfo.m. The function should take a signal
in the time domain along with an estimate of the CFO and should output
the signal compensating for the CFO.
- Run the code test_estimate_cfo.m. It will output the file Result_CFO_estimation.mat.
- Run the code test_correct_cfo.m. It will output the file Result_CFO_Correction.mat
and the figure Result_Cons_CFO_Corr.fig
which shows the constellation before and after CFO correction but before channel estimation.
Task 2: Phase Tracking
Implement the function estimate_residual_cfo_sfo.m. The function
should take as input a received OFDM symbol in the frequency domain along with an estimate of the
the channel and should output an estimate of the residual CFO and SFO. Then, implement
correct_residual_cfo_sfo.m. The function should take as input
an estimate of the channel along with the residual CFO and SFO and should output a
new estimate of the channel after compensating for CFO and SFO.
- Run the code test_phase_tracking.m. It will output the file Result_Phase_Tracking.mat and
the figure Result_Cons_Phase_Track.fig
which shows the constellation with and without phase tracking.
.
Task 3: RX Chain
Implement the function rx_ofdm_chain.m. The function
should take as input a complex signal and output the data bits.
To test your code, use the file Test_RX.mat.
This file has 2 variables: bits_data and rx_signal.
- Run the code test_rx_ofdm_chain.m. It will output the file Result_RX_Chain.mat
Hints:
- Incorporate the phase tracking correction in the channel value i.e. update the channel h from symbol to symbol so that the phase
does not accumulate so much that it starts wraping around 2pi. This also will allows us to automatically correct for the initial channel
as well as all the accumulated phase when we run correct_channel.m.
- In phase tracking, when estimating the slope make sure that the indicies of the pilot subcarriers are in the normal -64...63
- In phase tracking, you can use the builtin matlab functions regress( ) or robustfit( ) for estimating the slope of the
phase.
Submit:
Submit your code via the class's submission website, located here:
https://haithamh.scripts.mit.edu:444/6.888/handin.py
You may use your MIT Certificate or request an API key via email to log in for the first time.
Compress you folder and name it lab1b-handin.zip.
Upload that file to the submission website via the webpage or use curl and your API key:
$ curl -F file=@lab1b-handin.zip \
http://haithamh.scripts.mit.edu/6.888/handin.py/upload