From: trondeau Date: Wed, 16 Apr 2008 17:12:13 +0000 (+0000) Subject: to complete what I started, this makes the ofdm_sync_fixed block work again in the... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=8bce0d9e3f61b4af7799ed519109b83b926d4e12;p=debian%2Fgnuradio to complete what I started, this makes the ofdm_sync_fixed block work again in the OFDM receiver. Its only used for testing in the simulation mode if you want to remove any affects of the synchronization blocks. You have to manually edit the number of symbols and any fractional frequency offset you might want to use. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8213 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_receiver.py b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_receiver.py index d315fd00..56ae0c0f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_receiver.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_receiver.py @@ -93,9 +93,12 @@ class ofdm_receiver(gr.hier_block2): elif SYNC == "pnac": nco_sensitivity = -2.0/fft_length # correct for fine frequency self.ofdm_sync = ofdm_sync_pnac(fft_length, cp_length, ks0time, logging) - elif SYNC == "fixed": + elif SYNC == "fixed": # for testing only; do not user over the air + self.chan_filt = gr.multiply_const_cc(1.0) # remove filter and filter delay for this + 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 = ofdm_sync_fixed(fft_length, cp_length, logging) + self.ofdm_sync = ofdm_sync_fixed(fft_length, cp_length, nsymbols, freq_offset, logging) # Set up blocks diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_sync_fixed.py b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_sync_fixed.py index 74acc8fd..9bac789b 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_sync_fixed.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/ofdm_sync_fixed.py @@ -24,26 +24,27 @@ import math from gnuradio import gr class ofdm_sync_fixed(gr.hier_block2): - def __init__(self, fft_length, cp_length, logging=False): + def __init__(self, fft_length, cp_length, nsymbols, freq_offset, logging=False): gr.hier_block2.__init__(self, "ofdm_sync_fixed", gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature2(2, 2, gr.sizeof_gr_complex*fft_length, gr.sizeof_char)) # Output signature + gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature # Use a fixed trigger point instead of sync block symbol_length = fft_length + cp_length - data = (symbol_length)*[0,] + pkt_length = nsymbols*symbol_length + data = (pkt_length)*[0,] data[(symbol_length)-1] = 1 self.peak_trigger = gr.vector_source_b(data, True) - self.sampler = gr.ofdm_sampler(fft_length, symbol_length) - self.connect(self, (self.sampler,0)) - self.connect(self.peak_trigger, (self.sampler,1)) - self.connect(self.sampler, (self,0)) + # Use a pre-defined frequency offset + foffset = (pkt_length)*[math.pi*freq_offset,] + self.frequency_offset = gr.vector_source_f(foffset, True) + + self.connect(self, gr.null_sink(gr.sizeof_gr_complex)) + self.connect(self.frequency_offset, (self,0)) self.connect(self.peak_trigger, (self,1)) if logging: self.connect(self.peak_trigger, gr.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat")) - self.connect(self.sampler, gr.file_sink(gr.sizeof_gr_complex*fft_length, - "ofdm_sync_fixed-sampler_c.dat"))