commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6108 - gnuradio/branches/developers/trondeau/ofdm_mod


From: trondeau
Subject: [Commit-gnuradio] r6108 - gnuradio/branches/developers/trondeau/ofdm_mod/gnuradio-core/src/python/gnuradio/blksimpl
Date: Fri, 3 Aug 2007 07:22:55 -0600 (MDT)

Author: trondeau
Date: 2007-08-03 07:22:55 -0600 (Fri, 03 Aug 2007)
New Revision: 6108

Modified:
   
gnuradio/branches/developers/trondeau/ofdm_mod/gnuradio-core/src/python/gnuradio/blksimpl/ofdm.py
Log:
OFDM mod/demod take in costellations from psk.py or qam.py to pass to the new 
mapper and frammers

Modified: 
gnuradio/branches/developers/trondeau/ofdm_mod/gnuradio-core/src/python/gnuradio/blksimpl/ofdm.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/ofdm_mod/gnuradio-core/src/python/gnuradio/blksimpl/ofdm.py
   2007-08-03 13:20:24 UTC (rev 6107)
+++ 
gnuradio/branches/developers/trondeau/ofdm_mod/gnuradio-core/src/python/gnuradio/blksimpl/ofdm.py
   2007-08-03 13:22:55 UTC (rev 6108)
@@ -82,30 +82,22 @@
             padded_preambles.append(padded)
             
         symbol_length = options.fft_length + options.cp_length
-
-        if 1:
-            mods = {"bpsk": 2, "qpsk": 4, "8psk": 8}
-            arity = mods[self._modulation]
-
-            rot = 1
-            if self._modulation == "qpsk":
-                rot = (0.707+0.707j)
-                
+        
+        mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, 
"qam64": 64, "qam256": 256}
+        arity = mods[self._modulation]
+        
+        rot = 1
+        if self._modulation == "qpsk":
+            rot = (0.707+0.707j)
+            
+        if(self._modulation.find("psk") >= 0):
             rotated_const = map(lambda pt: pt * rot, 
psk.gray_constellation[arity])
-            print rotated_const
-            self._pkt_input = gr.ofdm_mapper_bcv(rotated_const, msgq_limit,
+        elif(self._modulation.find("qam") >= 0):
+            rotated_const = map(lambda pt: pt * rot, qam.constellation[arity])
+        #print rotated_const
+        self._pkt_input = gr.ofdm_mapper_bcv(rotated_const, msgq_limit,
                                                  options.occupied_tones, 
options.fft_length)
-        else:
-            if self._modulation == "bpsk":
-                self._pkt_input = gr.ofdm_bpsk_mapper(msgq_limit,
-                                                      options.occupied_tones, 
options.fft_length)
-            elif self._modulation == "qpsk":
-                self._pkt_input = gr.ofdm_qpsk_mapper(msgq_limit,
-                                                      options.occupied_tones, 
options.fft_length)
-            else:
-                print "Modulation type not supported (must be \"bpsk\" or 
\"qpsk\""
-                exit(1)
-
+        
         self.preambles = gr.ofdm_insert_preamble(self._fft_length, 
padded_preambles)
         self.ifft = gr.fft_vcc(self._fft_length, False, win, True)
         self.cp_adder = gr.ofdm_cyclic_prefixer(self._fft_length, 
symbol_length)
@@ -135,8 +127,8 @@
             msg = gr.message(1) # tell self._pkt_input we're not sending any 
more packets
         else:
             # print "original_payload =", string_to_hex_list(payload)
-            pkt = ofdm_packet_utils.make_packet(payload, 1, 1, 
self._pad_for_usrp)
-
+            pkt = ofdm_packet_utils.make_packet(payload, 1, 1, 
self._pad_for_usrp, whitening=True)
+            
             #print "pkt =", string_to_hex_list(pkt)
             msg = gr.message_from_string(pkt)
         self._pkt_input.msgq().insert_tail(msg)
@@ -225,23 +217,21 @@
                                        self._occupied_tones, self._snr, 
preambles,
                                        options.log)
 
-        if 1:
-            mods = {"bpsk": 2, "qpsk": 4, "8psk": 8}
-            arity = mods[self._modulation]
-            
-            rot = 1
-            if self._modulation == "qpsk":
-                rot = (0.707+0.707j)
-                
+        mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, 
"qam64": 64, "qam256": 256}
+        arity = mods[self._modulation]
+        
+        rot = 1
+        if self._modulation == "qpsk":
+            rot = (0.707+0.707j)
+
+        if(self._modulation.find("psk") >= 0):
             rotated_const = map(lambda pt: pt * rot, 
psk.gray_constellation[arity])
-            print rotated_const
-            self.ofdm_demod = gr.ofdm_frame_sink(rotated_const, range(arity),
-                                                 self._rcvd_pktq,
-                                                 self._occupied_tones)
-        else:
-            self.ofdm_demod = gr.ofdm_frame_sink(self._rcvd_pktq,
-                                                 self._occupied_tones,
-                                                 self._modulation)
+        elif(self._modulation.find("qam") >= 0):
+            rotated_const = map(lambda pt: pt * rot, qam.constellation[arity])
+        #print rotated_const
+        self.ofdm_demod = gr.ofdm_frame_sink(rotated_const, range(arity),
+                                             self._rcvd_pktq,
+                                             self._occupied_tones)
         
         fg.connect((self.ofdm_recv, 0), (self.ofdm_demod, 0))
         fg.connect((self.ofdm_recv, 1), (self.ofdm_demod, 1))





reply via email to

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