commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r5710 - gnuradio/branches/features/ofdm/sync/gnuradio-


From: trondeau
Subject: [Commit-gnuradio] r5710 - gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl
Date: Wed, 6 Jun 2007 13:12:51 -0600 (MDT)

Author: trondeau
Date: 2007-06-06 13:12:51 -0600 (Wed, 06 Jun 2007)
New Revision: 5710

Modified:
   
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
   
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_receiver.py
   
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_sync_pn.py
Log:
fixed bug with creating the first doubled-up preamble and enabled logging

Modified: 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
===================================================================
--- 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
 2007-06-06 15:24:41 UTC (rev 5709)
+++ 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_pkt.py
 2007-06-06 19:12:51 UTC (rev 5710)
@@ -58,38 +58,52 @@
 
         win = [] #[1 for i in range(self._fft_length)]
 
-        preamble0 = options.occupied_tones*[0,]
-        for i in range(options.occupied_tones//2):
-            preamble0[i*2] = known_symbols_4512_3[i] 
+        # Use freq domain to get doubled-up known symbol for correlation in 
time domain
+        zeros_on_left = int(math.ceil((options.fft_length - 
options.occupied_tones)/2.0))
+        ksfreq = known_symbols_4512_3[0:options.occupied_tones]
+        for i in range(len(ksfreq)):
+            if((zeros_on_left + i) & 1):
+                ksfreq[i] = 0        
 
-        f = open("tx_preamble_freq.txt", "w")
-        print >> f, preamble0
+        # hard-coded known symbols
+        preambles = (ksfreq,
+                     known_symbols_4512_1[0:options.occupied_tones],
+                     known_symbols_4512_2[0:options.occupied_tones])
         
-        # hard-coded known symbols
         if 1:
-            preambles = (preamble0,
-                         known_symbols_4512_1[0:options.occupied_tones],
-                         known_symbols_4512_2[0:options.occupied_tones])
+            unoccupied_carriers = options.fft_length - options.occupied_tones
+            zeros_on_left = int(math.ceil(unoccupied_carriers/2.0))\
 
-        if 0:
-            unoccupied_tones = options.fft_length - options.occupied_tones
-            unocc_2 = unoccupied_tones // 2
-            padded_preambles = len(preambles)*[options.fft_length*[0,]]
-            for padded,pre in zip(padded_preambles, preambles):
-                padded[unocc_2:options.fft_length - unocc_2] = pre        
+            padded_preambles = list()
+            for pre in preambles:
+                padded = options.fft_length*[0,]
+                padded[zeros_on_left : zeros_on_left + options.occupied_tones] 
= pre
+                padded_preambles.append(padded)
+                print padded
             
         symbol_length = options.fft_length + options.cp_length
 
         # accepts messages from the outside world
-        self._pkt_input = gr.ofdm_bpsk_mapper(msgq_limit,
-                                              options.occupied_tones, 
options.fft_length,
-                                              preambles)
-        self.ifft = gr.fft_vcc(options.fft_length, False, win, True)
-        self.cp_adder = gr.ofdm_cyclic_prefixer(options.fft_length, 
symbol_length)
-        self.scale = gr.multiply_const_cc(1.0 / math.sqrt(options.fft_length))
+        if 0:
+            self._pkt_input = gr.ofdm_bpsk_mapper(msgq_limit,
+                                                  options.occupied_tones, 
options.fft_length,
+                                                  preambles)
+            self.ifft = gr.fft_vcc(options.fft_length, False, win, True)
+            self.cp_adder = gr.ofdm_cyclic_prefixer(options.fft_length, 
symbol_length)
+            self.scale = gr.multiply_const_cc(1.0 / 
math.sqrt(options.fft_length))
 
-        fg.connect(self._pkt_input, self.ifft, self.cp_adder, self.scale)
+            fg.connect(self._pkt_input, self.ifft, self.cp_adder, self.scale)
+        else:
+            self._pkt_input = gr.ofdm_bpsk_mapper(msgq_limit, 
options.occupied_tones, options.fft_length)
+            self.preambles = gr.ofdm_insert_preamble(options.fft_length, 
padded_preambles)
+            self.ifft = gr.fft_vcc(options.fft_length, False, win, True)
+            self.cp_adder = gr.ofdm_cyclic_prefixer(options.fft_length, 
symbol_length)
+            self.scale = gr.multiply_const_cc(1.0 / 
math.sqrt(options.fft_length))
 
+            fg.connect((self._pkt_input, 0), (self.preambles, 0))
+            fg.connect((self._pkt_input, 1), (self.preambles, 1))
+            fg.connect(self.preambles, self.ifft, self.cp_adder, self.scale)
+
         if options.verbose:
             self._print_verbage()
 
@@ -171,22 +185,25 @@
        """
         self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
 
-        # doubled-up known symbol for correlation in time domain
-        preamble0 = options.fft_length*[0,]
-        unocc_2 = (options.fft_length - options.occupied_tones) // 2
-        for i in range(options.occupied_tones//2):
-            preamble0[unocc_2 + i*2] = known_symbols_4512_3[i] 
+        # Use freq domain to get doubled-up known symbol for correlation in 
time domain
+        ksfreq = known_symbols_4512_3[0:options.occupied_tones]
+        for i in range(len(ksfreq)):
+            if(i&1):
+                ksfreq[i] = 0        
+
+        zeros_on_left = int(math.ceil((options.fft_length - 
options.occupied_tones)/2.0))
+        zeros_on_right = options.fft_length - options.occupied_tones - 
zeros_on_left
+        ks0 = zeros_on_left*[0.0,]
+        ks0.extend(ksfreq)
+        ks0.extend(zeros_on_right*[0.0,])
         
-        preamble0_time = (fft.ifft(preamble0))
-        preamble0_time = preamble0_time.tolist()
-        preamble0_time_scaled = [p * math.sqrt(options.fft_length) for p in 
preamble0_time]
+        ks0time = fft.ifft(ks0)
+        # ADD SCALING FACTOR
+        ks0time = ks0time.tolist()
 
-        f = open("rx_preamble_time.txt", "w")
-        print >> f, preamble0_time_scaled
-
         # hard-coded known symbols
         if 1:
-            preambles = (preamble0_time_scaled,
+            preambles = (ks0time,
                          known_symbols_4512_1[0:options.occupied_tones],
                          known_symbols_4512_2[0:options.occupied_tones])
         

Modified: 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_receiver.py
===================================================================
--- 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_receiver.py
    2007-06-06 15:24:41 UTC (rev 5709)
+++ 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_receiver.py
    2007-06-06 19:12:51 UTC (rev 5710)
@@ -58,7 +58,7 @@
             self.fg.connect(self.chan_filt, self.ofdm_sync_pn, self.fft_demod, 
self.ofdm_corr)
             #self.fg.connect(self.chan_filt, self.ofdm_sync_pnac)
         
-        if 0:
+        if 1:
             self.fg.connect(self.chan_filt, gr.file_sink(gr.sizeof_gr_complex, 
"chan_filt_c.dat"))
             self.fg.connect(self.fft_demod, 
gr.file_sink(gr.sizeof_gr_complex*fft_length, "fft_out_c.dat"))
             self.fg.connect(self.ofdm_corr, 
gr.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_corr_out_c.dat"))

Modified: 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_sync_pn.py
===================================================================
--- 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_sync_pn.py
     2007-06-06 15:24:41 UTC (rev 5709)
+++ 
gnuradio/branches/features/ofdm/sync/gnuradio-core/src/python/gnuradio/blksimpl/ofdm_sync_pn.py
     2007-06-06 19:12:51 UTC (rev 5710)
@@ -46,7 +46,7 @@
         self.corr = gr.multiply_cc();
 
         # Create a moving sum filter for the corr output
-        if 0:
+        if 1:
             moving_sum_taps = [1.0 for i in range(fft_length//2)]
             self.moving_sum_filter = gr.fir_filter_ccf(1,moving_sum_taps)
         else:
@@ -57,7 +57,7 @@
         self.inputmag2 = gr.complex_to_mag_squared()
         movingsum2_taps = [1.0 for i in range(fft_length//2)]
 
-        if 0:
+        if 1:
             self.inputmovingsum = gr.fir_filter_fff(1,movingsum2_taps)
         else:
             self.inputmovingsum = gr.fft_filter_fff(1,movingsum2_taps)
@@ -114,16 +114,16 @@
         self.fg.connect(self.pk_detect, (self.sample_and_hold,1))
 
 
-        if 0:
+        if 1:
             self.fg.connect(self.matched_filter, gr.file_sink(gr.sizeof_float, 
"ofdm_sync_pn-mf_f.dat"))
             self.fg.connect(self.normalize, gr.file_sink(gr.sizeof_float, 
"ofdm_sync_pn-theta_f.dat"))
-            #self.fg.connect(self.angle, gr.file_sink(gr.sizeof_float, 
"ofdm_sync_pn-epsilon_f.dat"))
+            self.fg.connect(self.angle, gr.file_sink(gr.sizeof_float, 
"ofdm_sync_pn-epsilon_f.dat"))
             self.fg.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, 
"ofdm_sync_pn-peaks_b.dat"))
             self.fg.connect(self.regen, gr.file_sink(gr.sizeof_char, 
"ofdm_sync_pn-regen_b.dat"))
-            #self.fg.connect(self.sigmix, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-sigmix_c.dat"))
+            self.fg.connect(self.sigmix, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-sigmix_c.dat"))
             self.fg.connect(self.sampler, 
gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_sync_pn-sampler_c.dat"))
             self.fg.connect(self.sample_and_hold, 
gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat"))
-            #self.fg.connect(self.nco, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-nco_c.dat"))
-            #self.fg.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-input_c.dat"))
+            self.fg.connect(self.nco, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-nco_c.dat"))
+            self.fg.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, 
"ofdm_sync_pn-input_c.dat"))
 
         gr.hier_block.__init__(self, fg, self.input, self.sampler)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]