def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.digital_cpmmod_bc_0 = digital.cpmmod_bc(analog.cpm.TFM, 0.5, 4, 4,
                                                     0.3)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 256, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_cpmmod_bc_0, 0))
        self.connect((self.digital_cpmmod_bc_0, 0), (self.qtgui_sink_x_0, 0))
Exemplo n.º 2
0
    def do_check_phase_shift(self, type, name):
        sps = 2
        L = 1
        in_bits = (1,) * 20
        src = blocks.vector_source_b(in_bits, False)
        cpm = digital.cpmmod_bc(type, 0.5, sps, L)
        arg = blocks.complex_to_arg()
        sink = blocks.vector_sink_f()

        self.tb.connect(src, cpm, arg, sink)
        self.tb.run()

        symbol_phases = numpy.array(sink.data()[sps*L-1::sps])
        phase_diff = numpy.mod(numpy.subtract(symbol_phases[1:], symbol_phases[:-1]),
                               (2*numpy.pi,) * (len(symbol_phases)-1))
        self.assertFloatTuplesAlmostEqual(tuple(phase_diff), (0.5 * numpy.pi,) * len(phase_diff), 5,
                                          msg="Phase shift was not correct for CPM method " + name)
Exemplo n.º 3
0
    def __init__(self, address="addr=192.168.10.2"):
        gr.top_block.__init__(self, "OFDM 256QAM")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("OFDM 256QAM")
        try:
             self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
             pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "GSM_OFDM_LTE_E300")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.address = address

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.samp_0 = samp_0 = 6.5e6
        self.CENTRAL_FREQEUNCY_USRP_Ch1 = CENTRAL_FREQEUNCY_USRP_Ch1 = 2145e6
        self.BW_USRP = BW_USRP = 50e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		args="scalar=1024",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("B:0", 0)
        self.uhd_usrp_sink_0.set_samp_rate(5e6)
        self.uhd_usrp_sink_0.set_center_freq(CENTRAL_FREQEUNCY_USRP_Ch1, 0)
        self.uhd_usrp_sink_0.set_gain(27, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(BW_USRP, 0)
        self.digital_ofdm_mod_1 = grc_blks2.packet_mod_f(digital.ofdm_mod(
        		options=grc_blks2.options(
        			modulation="bpsk",
        			fft_length=1024,
        			occupied_tones=1000,
        			cp_length=0,
        			pad_for_usrp=True,
        			log=None,
        			verbose=None,
        		),
        	),
        	payload_length=0,
        )
        self.digital_cpmmod_bc_1 = digital.cpmmod_bc(analog.cpm.LREC, 2, 2, 2, 2)
        self.blocks_vector_source_x_1 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_f((1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 1, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_f((1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,0,1, 1,0, 0, 1,0,1, 0, 1,0, 0, 1,0,1), True, 1, [])
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_float_to_char_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.digital_ofdm_mod_1, 0))    
        self.connect((self.blocks_float_to_char_0, 0), (self.digital_cpmmod_bc_1, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_add_xx_0, 2))    
        self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_vector_source_x_1, 0), (self.blocks_add_xx_0, 3))    
        self.connect((self.digital_cpmmod_bc_1, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.digital_ofdm_mod_1, 0), (self.uhd_usrp_sink_0, 0))    
Exemplo n.º 4
0
    def __init__(self, address="addr=192.168.10.2"):
        gr.top_block.__init__(self, "OFDM 256QAM")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("OFDM 256QAM")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "GSM_OFDM_LTE_E300")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.address = address

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.samp_0 = samp_0 = 6.5e6
        self.CENTRAL_FREQEUNCY_USRP_Ch1 = CENTRAL_FREQEUNCY_USRP_Ch1 = 2145e6
        self.BW_USRP = BW_USRP = 50e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                args="scalar=1024",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("B:0", 0)
        self.uhd_usrp_sink_0.set_samp_rate(5e6)
        self.uhd_usrp_sink_0.set_center_freq(CENTRAL_FREQEUNCY_USRP_Ch1, 0)
        self.uhd_usrp_sink_0.set_gain(27, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(BW_USRP, 0)
        self.digital_ofdm_mod_1 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=1024,
                occupied_tones=1000,
                cp_length=0,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_cpmmod_bc_1 = digital.cpmmod_bc(analog.cpm.LREC, 2, 2, 2,
                                                     2)
        self.blocks_vector_source_x_1 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_f(
            (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_f(
            (1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1,
             1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
             1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1), True, 1, [])
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.digital_ofdm_mod_1, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.digital_cpmmod_bc_1, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_vector_source_x_1, 0),
                     (self.blocks_add_xx_0, 3))
        self.connect((self.digital_cpmmod_bc_1, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_ofdm_mod_1, 0), (self.uhd_usrp_sink_0, 0))