diff options
Diffstat (limited to 'gr-digital/python')
-rw-r--r-- | gr-digital/python/ofdm.py | 22 | ||||
-rw-r--r-- | gr-digital/python/ofdm_packet_utils.py | 3 | ||||
-rw-r--r-- | gr-digital/python/ofdm_receiver.py | 39 |
3 files changed, 36 insertions, 28 deletions
diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py index 806f0a7ad..ba49c6250 100644 --- a/gr-digital/python/ofdm.py +++ b/gr-digital/python/ofdm.py @@ -24,6 +24,7 @@ import math from gnuradio import gr import digital_swig import ofdm_packet_utils +from ofdm_receiver import ofdm_receiver import gnuradio.gr.gr_threading as _threading import psk, qam @@ -206,13 +207,13 @@ class ofdm_demod(gr.hier_block2): # hard-coded known symbols preambles = (ksfreq,) - + symbol_length = self._fft_length + self._cp_length - self.ofdm_recv = digital_swig.ofdm_receiver(self._fft_length, - self._cp_length, - self._occupied_tones, - self._snr, preambles, - options.log) + self.ofdm_recv = ofdm_receiver(self._fft_length, + self._cp_length, + self._occupied_tones, + self._snr, preambles, + options.log) mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256} arity = mods[self._modulation] @@ -243,9 +244,12 @@ class ofdm_demod(gr.hier_block2): self.connect(self.ofdm_recv.chan_filt, self) if options.log: - self.connect(self.ofdm_demod, gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones, "ofdm_frame_sink_c.dat")) + self.connect(self.ofdm_demod, + gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones, + "ofdm_frame_sink_c.dat")) else: - self.connect(self.ofdm_demod, gr.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) + self.connect(self.ofdm_demod, + gr.null_sink(gr.sizeof_gr_complex*self._occupied_tones)) if options.verbose: self._print_verbage() @@ -264,6 +268,8 @@ class ofdm_demod(gr.hier_block2): help="set the number of occupied FFT bins [default=%default]") expert.add_option("", "--cp-length", type="intx", default=128, help="set the number of bits in the cyclic prefix [default=%default]") + expert.add_option("", "--snr", type="float", default=30.0, + help="SNR estimate [default=%default]") # Make a static method to call before instantiation add_options = staticmethod(add_options) diff --git a/gr-digital/python/ofdm_packet_utils.py b/gr-digital/python/ofdm_packet_utils.py index ccd4be27c..d0000e6db 100644 --- a/gr-digital/python/ofdm_packet_utils.py +++ b/gr-digital/python/ofdm_packet_utils.py @@ -22,7 +22,6 @@ import struct import numpy from gnuradio import gru -import digital_swig import crc def conv_packed_binary_string_to_1_0_string(s): @@ -182,7 +181,7 @@ def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=1): else: payload_with_crc = whitened_payload_with_crc - ok, payload = gru.check_crc32(payload_with_crc) + ok, payload = crc.check_crc32(payload_with_crc) if 0: print "payload_with_crc =", string_to_hex_list(payload_with_crc) diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py index d89c79c4d..6c19cb32e 100644 --- a/gr-digital/python/ofdm_receiver.py +++ b/gr-digital/python/ofdm_receiver.py @@ -23,7 +23,10 @@ import math from numpy import fft from gnuradio import gr -import digital_swig +from ofdm_sync_pn import ofdm_sync_pn +from ofdm_sync_fixed import ofdm_sync_fixed +from ofdm_sync_pnac import ofdm_sync_pnac +from ofdm_sync_ml import ofdm_sync_ml class ofdm_receiver(gr.hier_block2): """ @@ -83,22 +86,22 @@ class ofdm_receiver(gr.hier_block2): SYNC = "pn" if SYNC == "ml": nco_sensitivity = -1.0/fft_length # correct for fine frequency - self.ofdm_sync = digital_swig.ofdm_sync_ml(fft_length, - cp_length, - snr, - ks0time, - logging) + self.ofdm_sync = ofdm_sync_ml(fft_length, + cp_length, + snr, + ks0time, + logging) elif SYNC == "pn": nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = digital_swig.ofdm_sync_pn(fft_length, - cp_length, - logging) + self.ofdm_sync = ofdm_sync_pn(fft_length, + cp_length, + logging) elif SYNC == "pnac": nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = digital_swig.ofdm_sync_pnac(fft_length, - cp_length, - ks0time, - logging) + self.ofdm_sync = ofdm_sync_pnac(fft_length, + cp_length, + ks0time, + logging) # for testing only; do not user over the air # remove filter and filter delay for this elif SYNC == "fixed": @@ -106,11 +109,11 @@ class ofdm_receiver(gr.hier_block2): nsymbols = 18 # enter the number of symbols per packet freq_offset = 0.0 # if you use a frequency offset, enter it here nco_sensitivity = -2.0/fft_length # correct for fine frequency - self.ofdm_sync = digital_swig.ofdm_sync_fixed(fft_length, - cp_length, - nsymbols, - freq_offset, - logging) + self.ofdm_sync = ofdm_sync_fixed(fft_length, + cp_length, + nsymbols, + freq_offset, + logging) # Set up blocks |