#!/usr/bin/env python # # Copyright 2004 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # from gnuradio import gr, gr_unittest import ofdm, inspect class qa_ofdm (gr_unittest.TestCase): def setUp (self): self.fg = gr.flow_graph () def tearDown (self): self.fg = None def test_001_square_ff (self): fft_len = 32 # fails for higher values (eg. 512) gi_len = 4 ofdm_sym_len = fft_len+gi_len; ofdm_tx = ofdm.ofdm_do_tx_cc (ofdm_sym_len, gi_len, 0) print ofdm_tx.output_multiple() print ofdm_tx.relative_rate() s2p = gr.serial_to_parallel (gr.sizeof_gr_complex, fft_len) p2s = gr.parallel_to_serial (gr.sizeof_gr_complex, ofdm_sym_len) dst = gr.file_sink(gr.sizeof_gr_complex, "ofdm_sym_out") SNR=10 src = gr.noise_source_c(gr.GR_GAUSSIAN, pow(10.0,-SNR/20.0)) self.fg.connect(src, s2p) self.fg.connect(s2p, ofdm_tx) self.fg.connect(ofdm_tx, p2s) self.fg.connect(p2s, dst) self.fg.run() if __name__ == '__main__': gr_unittest.main ()