| 1 | [[TracNav(WARPLab/TOC)]] |
| 2 | = WARPLab 7 Example: SISO OFDM = |
| 3 | File: [source:/ResearchApps/PHY/WARPLAB/WARPLab7/M_Code_Examples/wl_example_siso_ofdm_txrx.m wl_example_siso_ofdm_txrx.m] |
| 4 | |
| 5 | This WARPLab example implements a simple OFDM transmitter and receiver. The script can run with or without WARP hardware in the loop and does not require any extra MATLAB toolboxes. |
| 6 | |
| 7 | '''Important:''' this script is not intended as a tutorial of OFDM. If you're not already familiar with the basics of OFDM please start with one of the many good [https://www.google.com/search?q=ofdm+tutorial OFDM tutorials] available online. You will need to know the basics of OFDM before understanding the Tx and Rx processing in this example. |
| 8 | |
| 9 | == Transmitter == |
| 10 | [[Image(wl_ofdm_blkDiag_Tx.png, nolink)]] |
| 11 | |
| 12 | The OFDM transmitter code implements the following functions: |
| 13 | * Random data generation |
| 14 | * Modulation of random data to complex constellation symbols |
| 15 | * Mapping of symbols to data-bearing subcarriers |
| 16 | * Insertion of pilot tones in pilot subcarriers |
| 17 | * Inverse fast Fourier transform (IFFT) |
| 18 | * Cyclic prefix insertion |
| 19 | * Preamble construction and insertion |
| 20 | * Interpolation by 2x |
| 21 | |
| 22 | |
| 23 | == Receiver == |
| 24 | [[Image(wl_ofdm_blkDiag_Rx.png, nolink)]] |
| 25 | |
| 26 | The OFDM receiver code implements the following functions: |
| 27 | * LTS correlation for synchronization |
| 28 | * CFO estimation and correcting use time-domain estimation from LTS |
| 29 | * Cyclic prefix removal |
| 30 | * Fast Fourier transform (FFT) |
| 31 | * Channel estimation from frequency-domain LTS |
| 32 | * Residual phase error estimation from frequency-domain pilot tones |
| 33 | * Equalization of data-bearing subcarriers using channel estimates and phase error estimates |
| 34 | * Demodulation of complex symbols to data values |
| 35 | |
| 36 | == Running the Example == |
| 37 | The WARPLab OFDM example can be used in simulation only mode and in hardware-in-the-loop mode. |
| 38 | |
| 39 | === Simulation === |
| 40 | To use the example in simulation mode set the top-level param {{{USE_WARPLAB_TXRX = 0;}}}, then run the m-script. When the script finishes 6 plots will show: |
| 41 | ||||||= '''Simulation Plots''' =|| |
| 42 | || [[Image(wl_ofdm_plots_sim_txIQ.png,width=250)]][[BR]]Transmitted waveform || [[Image(wl_ofdm_plots_sim_rxIQ.png,width=250)]] [[BR]]Received waveform || [[Image(wl_ofdm_plots_sim_ltsCorr.png,width=250)]] [[BR]]Preamble correlation results[[BR]](peaks indicate locations of preamble LTS) || |
| 43 | || [[Image(wl_ofdm_plots_sim_chanEst.png,width=250)]] [[BR]]Channel estimate per subcarrier[[BR]](I/Q components and complex magnitude) || [[Image(wl_ofdm_plots_sim_phaseError.png,width=250)]] [[BR]]Phase error estimates[[BR]](per OFDM symbol) || [[Image(wl_ofdm_plots_sim_constellations.png,width=250)]] [[BR]]Tx and Rx constellations || |
| 44 | ||||||= [[BR]] =|| |
| 45 | |
| 46 | By default the simulation script applies AWGN with an arbitrary fixed SNR. You can change the simulated propagation characteristics in the m-code. Search for {{{AWGN}}} and apply whatever Tx->Rx degradations you like. |
| 47 | |
| 48 | For example to simulate a perfect (noiseless) link, set the noise power to zero: |
| 49 | {{{ |
| 50 | rx_vec_air = tx_vec_air + 0*complex(randn(1,length(tx_vec_air)), randn(1,length(tx_vec_air))); |
| 51 | }}} |
| 52 | |
| 53 | The script also prints statistics about the experiment to the MATLAB command prompt: |
| 54 | {{{ |
| 55 | Results: |
| 56 | Num Bytes: 4560 |
| 57 | Sym Errors: 0 (of 9120 total symbols) |
| 58 | Bit Errors: 0 (of 36480 total bits) |
| 59 | EVM: 3.779% |
| 60 | LTS CFO Est: -0.07 kHz |
| 61 | }}} |
| 62 | |
| 63 | === Hardware in the Loop === |
| 64 | |
| 65 | '''Requirements: 2 WARP v3 kits, 1 antenna each.''' |
| 66 | |
| 67 | To use the example with WARP hardware you will need two WARP nodes each running WARPLab 7.3 (or later) and a WARPLab environment setup on your PC. Refer to the [wiki:../../QuickStart WARPLab Quick Start] if you have not yet setup WARPLab. |
| 68 | |
| 69 | To target WARP hardware set the top-level param {{{USE_WARPLAB_TXRX = 1;}}}, then run the m-script. When the script finishes 6 plots will show: |
| 70 | |
| 71 | ||||||= '''Hardware in the Loop Plots''' =|| |
| 72 | || [[Image(wl_ofdm_plots_hw_txIQ.png,width=250)]][[BR]]Transmitted waveform || [[Image(wl_ofdm_plots_hw_rxIQ.png,width=250)]] [[BR]]Received waveform || [[Image(wl_ofdm_plots_hw_ltsCorr.png,width=250)]] [[BR]]Preamble correlation results[[BR]](peaks indicate locations of preamble LTS) || |
| 73 | || [[Image(wl_ofdm_plots_hw_chanEst.png,width=250)]] [[BR]]Channel estimate per subcarrier[[BR]](I/Q components and complex magnitude) || [[Image(wl_ofdm_plots_hw_phaseError.png,width=250)]] [[BR]]Phase error estimates[[BR]](per OFDM symbol) || [[Image(wl_ofdm_plots_hw_constellations.png,width=250)]] [[BR]]Tx and Rx constellations || |
| 74 | ||||||= [[BR]] =|| |
| 75 | |
| 76 | The script also prints statistics about the experiment to the MATLAB command prompt: |
| 77 | {{{ |
| 78 | Results: |
| 79 | Num Bytes: 4560 |
| 80 | Sym Errors: 0 (of 9120 total symbols) |
| 81 | Bit Errors: 0 (of 36480 total bits) |
| 82 | EVM: 4.541% |
| 83 | LTS CFO Est: 2.64 kHz |
| 84 | }}} |
| 85 | |
| 86 | |
| 87 | == Limitations == |
| 88 | This example is intended as a starting point for researchers wishing to use WARPLab to prototype a wireless communications link. This examples does not implement some some blocks common in deployed OFDM systems, such as scrambling, interleaving and error correcting coding. For an example of a real-time OFDM implementation that implements all of these subsystems, please see the PHY in the [wiki:802.11 802.11 Reference Design]. |