Ejemplo n.º 1
0
    def __init__(self):
        gr.top_block.__init__(self, "Example5 Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example5 Tx")
        qtgui.util.check_set_qss()
        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", "example5_tx")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.time_preamble = time_preamble = [
            0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j,
            -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j,
            0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j,
            -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j,
            0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j,
            0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j,
            0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j,
            -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j,
            -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j,
            0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j,
            -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j,
            -0.538848 + 0.320228j, -0.111440 + 0.093688j,
            -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j,
            0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j,
            0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j,
            0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j,
            0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j,
            -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j,
            -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j,
            0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j,
            -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j,
            -0.495528 - 0.114832j, 0.522104 + 0.148216j
        ]
        self.time_offset = time_offset = 1
        self.samp_rate = samp_rate = 500000
        self.preamble_len = preamble_len = 64
        self.packet_len = packet_len = 1024
        self.noise = noise = 0
        self.length = length = 96
        self.freq_offset = freq_offset = 0

        ##################################################
        # Blocks
        ##################################################
        self._time_offset_range = Range(0.999, 1.001, 0.00001, 1, 200)
        self._time_offset_win = RangeWidget(self._time_offset_range,
                                            self.set_time_offset,
                                            'Time offset', "counter_slider",
                                            float)
        self.top_grid_layout.addWidget(self._time_offset_win, 2, 0, 1, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(2, 3)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self._noise_range = Range(0, 0.2, 0.001, 0, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise,
                                      'Noise', "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_win, 0, 0, 1, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 1)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self._freq_offset_range = Range(0, 0.02, 0.0001, 0, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            'Freq offset', "counter_slider",
                                            float)
        self.top_grid_layout.addWidget(self._freq_offset_win, 1, 0, 1, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(1, 2)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self.qtgui_freq_sink_x_0_0_0_0 = qtgui.freq_sink_c(
            2048,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Real Spectrum",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0.set_y_axis(-80, -20)
        self.qtgui_freq_sink_x_0_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0_0_0.set_plot_pos_half(not True)

        labels = ['MySVL Signal', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_win, 3,
                                       0, 1, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(3, 4)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self.mysvl_svl_1 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            './inputs/spectrum_maps/example1b_tx.txt',
            './inputs/parameters/example1a-c_tx.txt')
        self.low_pass_filter_0_0 = filter.interp_fir_filter_ccf(
            2,
            firdes.low_pass(1, samp_rate, samp_rate / 4 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, samp_rate / 2 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=64,
            cp_len=16,
            packet_length_tag_key='length',
            bps_header=1,
            bps_payload=2,
            rolloff=0,
            debug_log=False,
            scramble_bits=False)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise,
            frequency_offset=freq_offset,
            epsilon=time_offset,
            taps=(1 + 1j, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            time_preamble, True, 1, [])
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                 '127.0.0.1', 4000, 1472 * 32,
                                                 True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, length, "length")
        self.blocks_stream_mux_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1, (preamble_len, packet_len))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc((0.1, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            (2.0 / 4, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_char * 1, './inputs/Memory_and_Forgetting.mp3', True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, './inputs/Memory_and_Forgetting.mp3', True)
        self.blks2_packet_encoder_1 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.mysvl_svl_1, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.mysvl_svl_1, 1))
        self.connect((self.mysvl_svl_1, 0), (self.blocks_stream_mux_0, 1))
Ejemplo n.º 2
0
    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.freq = freq = 2375e6
        self.udp_len = udp_len = 1472*16
        self.time_preamble = time_preamble =  [0.125000+0.000000j, 0.522104-0.148216j, -0.495528+0.114832j, -0.267916+0.091700j, 0.236544-0.138456j, -0.098500+0.473800j, 0.476480-0.225344j, -0.187516+0.035372j, 0.051776-0.353552j, -0.104936+0.059916j,  0.228684+0.117504j, -0.530912+0.560756j, 0.359128+0.015872j, -0.132852+0.632840j, -0.105164-0.368872j, 0.368272-0.032412j, 0.125000+0.750000j, 0.463968+0.457792j, 0.151476-0.430948j, 0.685052+0.238524j, 0.494428+0.119428j, -0.557540-0.050056j, 0.416348+0.017368j, 0.104256-0.568836j, -0.301776-0.353552j, 0.079812+0.451516j, 0.439152+0.528072j, 0.642060+0.178484j, -0.090096+0.465096j, -0.446492+0.305776j, -0.111440-0.093688j, -0.538848-0.320228j, 0.125000+0.000000j, -0.538848+0.320228j, -0.111440+0.093688j, -0.446492-0.305776j, -0.090096-0.465096j, 0.642060-0.178484j, 0.439152-0.528072j, 0.079812-0.451516j, -0.301776+0.353552j, 0.104256+0.568836j, 0.416348-0.017368j, -0.557540+0.050056j, 0.494428-0.119428j, 0.685052-0.238524j, 0.151476+0.430948j, 0.463968-0.457792j, 0.125000-0.750000j, 0.368272+0.032412j, -0.105164+0.368872j, -0.132852-0.632840j, 0.359128-0.015872j, -0.530912-0.560756j, 0.228684-0.117504j, -0.104936-0.059916j, 0.051776+0.353552j, -0.187516-0.035372j, 0.476480+0.225344j, -0.098500-0.473800j, 0.236544+0.138456j, -0.267916-0.091700j, -0.495528-0.114832j, 0.522104+0.148216j]
        self.samp_rate = samp_rate = 1200000
        self.preamble_len = preamble_len = 128
        self.padding = padding = 12
        self.packet_len = packet_len = 1024*4
        self.number_len = number_len = 6*4*8
        self.new_time_preamble = new_time_preamble = [52.000000 +0.000000j, -5.919279 -8.536566j, -4.260753 -12.607212j,8.939880 -6.125765j,0.884604 -4.096587j,-6.474256 -3.434596j,-4.174710 -0.578714j,3.791506 +1.235053j,0.279833 -0.109122j,5.530533-0.567199j,-1.929208 -7.317350j,-1.378117 +3.190803j,2.805871 -7.702256j,-5.711313 -1.701914j,-2.966432 +1.741682j,-0.247675 +4.490168j,-3.292893 -1.707107j,2.883898 +2.676192j,5.619135 +0.751750j,-4.115069 +2.814674j,-2.589373 -7.294397j,4.612185 +5.259877j,1.197091 +3.742967j,-0.979906 -3.882719j,-1.890878 +1.962808j,4.160219 -3.353154j,-0.540289 +6.005091j,-2.112620 -3.003023j,-3.042150 +2.611726j,1.802848 +4.135673j,5.298560 +4.620461j,0.703246 +3.450126j,5.000000 -1.000000j,5.157142 -0.379740j,3.726040 -3.647292j,-2.997688 +3.323755j,4.889909 -1.616118j,4.836721 +0.468047j,0.992839 -6.866692j,2.704855 -0.610792j,-6.351763 -2.279833j,-1.939613 +0.731610j,7.529818 +3.181252j,-4.310881 -0.784855j,3.354740 -3.048814j,-3.174640 +4.788060j,1.959678 +1.522812j,7.693754 -1.672790j,-4.707107 +0.292893j,5.049252 +3.458181j,1.552404 -4.513244j,3.323670 -1.959693j,-3.571238 +2.200182j,3.211846 +2.977140j,2.428551 -5.636953j,4.723748 +2.769317j,-0.037192 -4.351763j,-4.334488 -2.957252j,2.495908 +3.419032j,3.958268 +0.210689j,-2.732363 -2.667578j,4.275458 -3.511993j,-2.928632 +2.726462j,-1.663484 -3.392583j,2.000000 +0.000000j,-1.663484 +3.392583j,-2.928632 -2.726462j,4.275458 +3.511993j,-2.732363 +2.667578j,3.958268 -0.210689j,2.495908 -3.419032j,-4.334488 +2.957252j,-0.037192 +4.351763j,4.723748 -2.769317j,2.428551 +5.636953j,3.211846 -2.977140j,-3.571238 -2.200182j,3.323670 +1.959693j,1.552404 +4.513244j,5.049252 -3.458181j,-4.707107 -0.292893j,7.693754 +1.672790j,1.959678 -1.522812j,-3.174640 -4.788060j,3.354740 +3.048814j,-4.310881 +0.784855j,7.529818 -3.181252j,-1.939613 -0.731610j,-6.351763 +2.279833j,2.704855 +0.610792j,0.992839 +6.866692j,4.836721 -0.468047j,4.889909 +1.616118j,-2.997688 -3.323755j,3.726040 +3.647292j,5.157142 +0.379740j,5.000000 +1.000000j,0.703246 -3.450126j,5.298560 -4.620461j,1.802848-4.135673j,-3.042150 -2.611726j,-2.112620 +3.003023j,-0.540289 -6.005091j,4.160219 +3.353154j,-1.890878 -1.962808j,-0.979906 +3.882719j,1.197091 -3.742967j,4.612185 -5.259877j,-2.589373 +7.294397j,-4.115069 -2.814674j,5.619135 -0.751750j,2.883898 -2.676192j,-3.292893 +1.707107j,-0.247675 -4.490168j,-2.966432 -1.741682j,-5.711313 +1.701914j,2.805871 +7.702256j,-1.378117 -3.190803j,-1.929208 +7.317350j,5.530533 +0.567199j,0.279833 +0.109122j,3.791506 -1.235053j,-4.174710 +0.578714j,-6.474256 +3.434596j,0.884604 +4.096587j,8.939880 +6.125765j,-4.260753 +12.607212j,-5.919279 +8.536566j]
        self.length = length = 96
        self.gain2 = gain2 = 0.6
        self.gain = gain = 0.7
        self.freq2 = freq2 = freq+5e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0_0 = uhd.usrp_sink(
        	",".join(("", "serial= 30C6272")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0_0.set_subdev_spec("A:B", 0)
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0_0.set_normalized_gain(gain, 0)
        self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "serial=30C628B")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_subdev_spec("A:A", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq2, 0)
        self.uhd_usrp_sink_0.set_normalized_gain(gain2, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.qtgui_freq_sink_x_0_1 = qtgui.freq_sink_c(
        	512, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1.enable_grid(False)
        self.qtgui_freq_sink_x_0_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0_1.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0_1.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_1_win, 0, 0, 1, 2)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
        	512, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 1, 1, 1, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	512, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 0, 1, 1)
        self.mysvl_svl_1 = mysvl.svl(gr.sizeof_gr_complex*1, 1, "./inputs/spectrum_maps/one_many_tx.txt", "./inputs/parameters/one_many_tx.txt")
        self.mysvl_stream_demux_0_0 = mysvl.stream_demux(gr.sizeof_gr_complex*1, (1,packet_len-2,1), False)
        self.mysvl_stream_demux_0 = mysvl.stream_demux(gr.sizeof_gr_complex*1, (1,packet_len-2,1), False)
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
        	  fft_len=64, cp_len=16,
        	  packet_length_tag_key="length",
        	  bps_header=1,
        	  bps_payload=1,
        	  rolloff=0,
        	  debug_log=False,
        	  scramble_bits=False
        	 )
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_vector_source_x_1_0 = blocks.vector_source_b(range(1,65), True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_c(new_time_preamble, True, 1, [])
        self.blocks_vector_source_x_0 = blocks.vector_source_c(new_time_preamble, True, 1, [])
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_char*1, "127.0.0.1", 3000, 1472, True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, length, "length")
        self.blocks_stream_mux_1_0 = blocks.stream_mux(gr.sizeof_gr_complex*1, (padding+1, packet_len-2,padding+1))
        self.blocks_stream_mux_1 = blocks.stream_mux(gr.sizeof_gr_complex*1, (padding+1, packet_len-2,padding+1))
        self.blocks_stream_mux_0_0 = blocks.stream_mux(gr.sizeof_gr_complex*1, (preamble_len, number_len, packet_len+2*padding))
        self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_gr_complex*1, (preamble_len, number_len,packet_len+2*padding))
        self.blocks_repeat_0_1 = blocks.repeat(gr.sizeof_gr_complex*1, padding+1)
        self.blocks_repeat_0_0_0 = blocks.repeat(gr.sizeof_gr_complex*1, padding+1)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex*1, padding+1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, padding+1)
        self.blocks_multiply_const_vxx_0_0_0_0 = blocks.multiply_const_vcc((0.25, ))
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vcc((0.25, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.mysvl_svl_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0), (self.blocks_stream_mux_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_0_0_0, 0), (self.blocks_stream_mux_0_0, 1))    
        self.connect((self.blocks_repeat_0, 0), (self.blocks_stream_mux_1, 2))    
        self.connect((self.blocks_repeat_0_0, 0), (self.blocks_stream_mux_1, 0))    
        self.connect((self.blocks_repeat_0_0_0, 0), (self.blocks_stream_mux_1_0, 0))    
        self.connect((self.blocks_repeat_0_1, 0), (self.blocks_stream_mux_1_0, 2))    
        self.connect((self.blocks_stream_mux_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.blocks_stream_mux_0, 0), (self.uhd_usrp_sink_0_0, 0))    
        self.connect((self.blocks_stream_mux_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0))    
        self.connect((self.blocks_stream_mux_0_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.blocks_stream_mux_1, 0), (self.blocks_stream_mux_0, 2))    
        self.connect((self.blocks_stream_mux_1_0, 0), (self.blocks_stream_mux_0_0, 2))    
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_ofdm_tx_0, 0))    
        self.connect((self.blocks_udp_source_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 0))    
        self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_stream_mux_0_0, 0))    
        self.connect((self.blocks_vector_source_x_1_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_0_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_0_0_0, 0))    
        self.connect((self.digital_ofdm_tx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.digital_ofdm_tx_0, 0), (self.qtgui_freq_sink_x_0_1, 0))    
        self.connect((self.mysvl_stream_demux_0, 2), (self.blocks_repeat_0, 0))    
        self.connect((self.mysvl_stream_demux_0, 0), (self.blocks_repeat_0_0, 0))    
        self.connect((self.mysvl_stream_demux_0, 1), (self.blocks_stream_mux_1, 1))    
        self.connect((self.mysvl_stream_demux_0_0, 0), (self.blocks_repeat_0_0_0, 0))    
        self.connect((self.mysvl_stream_demux_0_0, 2), (self.blocks_repeat_0_1, 0))    
        self.connect((self.mysvl_stream_demux_0_0, 1), (self.blocks_stream_mux_1_0, 1))    
        self.connect((self.mysvl_svl_1, 0), (self.mysvl_stream_demux_0, 0))    
        self.connect((self.mysvl_svl_1, 1), (self.mysvl_stream_demux_0_0, 0))    
Ejemplo n.º 3
0
    def __init__(self):
        gr.top_block.__init__(self, "Example1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example1")
        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", "example1")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 10000000
        self.length = length = 96

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Demodulated GMSK  Data",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ["Bytes", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1,
                                       2)
        self.qtgui_freq_sink_x_0_0_0_1 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual Spectrum 2",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_1.set_y_axis(-80, -20)
        self.qtgui_freq_sink_x_0_0_0_1.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_1.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_1.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0_0_1.set_plot_pos_half(not True)

        labels = ["GMSK Signal", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_1_win, 0,
                                       1, 1, 1)
        self.qtgui_freq_sink_x_0_0_0_0 = qtgui.freq_sink_c(
            2048,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Real Spectrum",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0.set_y_axis(-80, -20)
        self.qtgui_freq_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0_0_0.set_plot_pos_half(not True)

        labels = ["MySVL Signal", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_win, 1,
                                       0, 1, 2)
        self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual Spectrum 1",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0.set_y_axis(-80, -20)
        self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0_0.set_plot_pos_half(not True)

        labels = ["OFDM Signal", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win, 0, 0,
                                       1, 1)
        self.mysvl_svl_1 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            "./inputs/spectrum_maps/example1a_tx.txt",
            "./inputs/parameters/example1a-c_tx.txt")
        self.mysvl_svl_0_0 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            "./inputs/spectrum_maps/example1a_rx.txt",
            "./inputs/parameters/example1a-c_rx.txt")
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=64,
            cp_len=16,
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=2,
            rolloff=0,
            debug_log=False,
            scramble_bits=False)
        self.digital_ofdm_rx_0 = digital.ofdm_rx(
            fft_len=64,
            cp_len=16,
            frame_length_tag_key='frame_' + "length",
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=2,
            debug_log=False,
            scramble_bits=False)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, length, "length")
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            (2.0 / 4, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_char * 1, "./inputs/Memory_and_Forgetting.mp3", True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "./inputs/Memory_and_Forgetting.mp3", True)
        self.blocks_file_sink_0_0 = blocks.file_sink(
            gr.sizeof_char * 1, "./outputs/output_audio1.mp3", False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, "./outputs/output_audio2.mp3", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blks2_packet_encoder_1 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=False,
            ),
            payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.mysvl_svl_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.mysvl_svl_1, 1))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.mysvl_svl_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.mysvl_svl_0_0, 1), (self.digital_gmsk_demod_0, 0))
        self.connect((self.mysvl_svl_0_0, 0), (self.digital_ofdm_rx_0, 0))
        self.connect((self.mysvl_svl_1, 0), (self.blocks_throttle_0, 0))
Ejemplo n.º 4
0
    def __init__(self):
        gr.top_block.__init__(self, "Example5 Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example5 Rx")
        qtgui.util.check_set_qss()
        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", "example5_rx")

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.time_preamble = time_preamble = [
            0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j,
            -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j,
            0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j,
            -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j,
            0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j,
            0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j,
            0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j,
            -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j,
            -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j,
            0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j,
            -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j,
            -0.538848 + 0.320228j, -0.111440 + 0.093688j,
            -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j,
            0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j,
            0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j,
            0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j,
            0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j,
            -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j,
            -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j,
            0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j,
            -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j,
            -0.495528 - 0.114832j, 0.522104 + 0.148216j
        ]
        self.threshold = threshold = 1
        self.samp_rate = samp_rate = 500000
        self.preamble_len = preamble_len = 64
        self.packet_len = packet_len = 1024
        self.length = length = 96

        ##################################################
        # Blocks
        ##################################################
        self._threshold_range = Range(0, 2, 0.01, 1, 200)
        self._threshold_win = RangeWidget(self._threshold_range,
                                          self.set_threshold, 'Threshold',
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._threshold_win, 0, 0, 1, 2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 1)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=2,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            preamble_len + packet_len,  #size
            samp_rate,  #samp_rate
            "Synchronization",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-0.2, 2)

        self.qtgui_time_sink_x_1.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_1.enable_tags(-1, False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(False)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_1.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_win, 1, 0, 1,
                                       2)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(1, 2)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 2)]
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            512,  #size
            samp_rate,  #samp_rate
            "Demodulated OFDM  Data",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0_0.enable_tags(-1, False)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                    qtgui.TRIG_SLOPE_POS, 0.0,
                                                    0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['Bytes', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 2, 1,
                                       1, 1)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(2, 3)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(1, 2)]
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            512,  #size
            samp_rate,  #samp_rate
            "Demodulated GMSK  Data",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label('Amplitude', "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['Bytes', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1,
                                       1)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(2, 3)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(0, 1)]
        self.mysvl_triggered_demux_0 = mysvl.triggered_demux(
            gr.sizeof_gr_complex * 1, gr.sizeof_float,
            (preamble_len, packet_len), 1, True)
        self.mysvl_svl_0_0 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            './inputs/spectrum_maps/example1b_rx.txt',
            './inputs/parameters/example1a-c_rx.txt')
        self.digital_ofdm_rx_0 = digital.ofdm_rx(
            fft_len=64,
            cp_len=16,
            frame_length_tag_key='frame_' + "length",
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=2,
            debug_log=False,
            scramble_bits=False)
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.digital_corr_est_cc_0 = digital.corr_est_cc((time_preamble), 1, 0,
                                                         0.99)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1,
                                                     '127.0.0.1', 4000,
                                                     1472 * 32, True)
        (self.blocks_udp_source_0).set_min_output_buffer(1000000)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(
            threshold, threshold, 0)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_file_sink_0_0 = blocks.file_sink(
            gr.sizeof_char * 1, './outputs/output_audio1.mp3', False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, './outputs/output_audio2.mp3', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_abs_xx_1 = blocks.abs_ff(1)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, threshold)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.qtgui_time_sink_x_1, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.blocks_abs_xx_1, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_abs_xx_1, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_abs_xx_1, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.mysvl_triggered_demux_0, 1))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.digital_corr_est_cc_0, 0))
        self.connect((self.digital_corr_est_cc_0, 1),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_corr_est_cc_0, 0),
                     (self.mysvl_triggered_demux_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.mysvl_svl_0_0, 1),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.mysvl_svl_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.mysvl_triggered_demux_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.mysvl_triggered_demux_0, 1),
                     (self.mysvl_svl_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.digital_ofdm_rx_0, 0))
Ejemplo n.º 5
0
    def __init__(self):
        gr.top_block.__init__(self, "Example3")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example3")
        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", "example3")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.udp_len = udp_len = 1472*8
        self.time_preamble = time_preamble =  [0.125000+0.000000j, 0.522104-0.148216j, -0.495528+0.114832j, -0.267916+0.091700j, 0.236544-0.138456j, -0.098500+0.473800j, 0.476480-0.225344j, -0.187516+0.035372j, 0.051776-0.353552j, -0.104936+0.059916j,  0.228684+0.117504j, -0.530912+0.560756j, 0.359128+0.015872j, -0.132852+0.632840j, -0.105164-0.368872j, 0.368272-0.032412j, 0.125000+0.750000j, 0.463968+0.457792j, 0.151476-0.430948j, 0.685052+0.238524j, 0.494428+0.119428j, -0.557540-0.050056j, 0.416348+0.017368j, 0.104256-0.568836j, -0.301776-0.353552j, 0.079812+0.451516j, 0.439152+0.528072j, 0.642060+0.178484j, -0.090096+0.465096j, -0.446492+0.305776j, -0.111440-0.093688j, -0.538848-0.320228j, 0.125000+0.000000j, -0.538848+0.320228j, -0.111440+0.093688j, -0.446492-0.305776j, -0.090096-0.465096j, 0.642060-0.178484j, 0.439152-0.528072j, 0.079812-0.451516j, -0.301776+0.353552j, 0.104256+0.568836j, 0.416348-0.017368j, -0.557540+0.050056j, 0.494428-0.119428j, 0.685052-0.238524j, 0.151476+0.430948j, 0.463968-0.457792j, 0.125000-0.750000j, 0.368272+0.032412j, -0.105164+0.368872j, -0.132852-0.632840j, 0.359128-0.015872j, -0.530912-0.560756j, 0.228684-0.117504j, -0.104936-0.059916j, 0.051776+0.353552j, -0.187516-0.035372j, 0.476480+0.225344j, -0.098500-0.473800j, 0.236544+0.138456j, -0.267916-0.091700j, -0.495528-0.114832j, 0.522104+0.148216j]
        self.time_offset2 = time_offset2 = 1
        self.time_offset = time_offset = 1
        self.samp_rate = samp_rate = 400000
        self.preamble_len = preamble_len = 64
        self.packet_len = packet_len = 1024
        self.number_len = number_len = 64*3
        self.noise2 = noise2 = 0
        self.noise = noise = 0
        self.length = length = 96
        self.freq_offset2 = freq_offset2 = 0
        self.freq_offset = freq_offset = 0

        ##################################################
        # Blocks
        ##################################################
        self._time_offset2_range = Range(0.95, 1.05, 0.00001, 1, 200)
        self._time_offset2_win = RangeWidget(self._time_offset2_range, self.set_time_offset2, "Time offset", "counter_slider", float)
        self.top_layout.addWidget(self._time_offset2_win)
        self._time_offset_range = Range(0.95, 1.05, 0.00001, 1, 200)
        self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, "Time offset", "counter_slider", float)
        self.top_layout.addWidget(self._time_offset_win)
        self._noise2_range = Range(0, 0.2, 0.0001, 0, 200)
        self._noise2_win = RangeWidget(self._noise2_range, self.set_noise2, "Noise", "counter_slider", float)
        self.top_layout.addWidget(self._noise2_win)
        self._noise_range = Range(0, 0.2, 0.0001, 0, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise, "Noise", "counter_slider", float)
        self.top_layout.addWidget(self._noise_win)
        self._freq_offset2_range = Range(0, 0.05, 0.0001, 0, 200)
        self._freq_offset2_win = RangeWidget(self._freq_offset2_range, self.set_freq_offset2, "Freq offset", "counter_slider", float)
        self.top_layout.addWidget(self._freq_offset2_win)
        self._freq_offset_range = Range(0, 0.05, 0.0001, 0, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, "Freq offset", "counter_slider", float)
        self.top_layout.addWidget(self._freq_offset_win)
        self.mysvl_svl_1 = mysvl.svl(gr.sizeof_gr_complex*1, 1, "./inputs/spectrum_maps/one_many_tx.txt", "./inputs/parameters/one_many_tx.txt")
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
        	  fft_len=64, cp_len=16,
        	  packet_length_tag_key="length",
        	  bps_header=1,
        	  bps_payload=1,
        	  rolloff=0,
        	  debug_log=False,
        	  scramble_bits=False
        	 )
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.channels_channel_model_0_0 = channels.channel_model(
        	noise_voltage=noise2,
        	frequency_offset=freq_offset2,
        	epsilon=time_offset2,
        	taps=(1+1j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise,
        	frequency_offset=freq_offset,
        	epsilon=time_offset,
        	taps=(1+1j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_vector_source_x_1_0 = blocks.vector_source_b(range(1,65), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_c(time_preamble, True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_c(time_preamble, True, 1, [])
        self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, "127.0.0.2", 4000, udp_len, True)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex*1, "127.0.0.1", 4000, udp_len, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, length, "length")
        self.blocks_stream_mux_0_0 = blocks.stream_mux(gr.sizeof_gr_complex*1, (preamble_len, number_len, packet_len))
        self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_gr_complex*1, (preamble_len, number_len,packet_len))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((0.5, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.05, ))
        self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_char*1, "./inputs/Memory_and_Forgetting.mp3", True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))    
        self.connect((self.blocks_file_source_0_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_stream_mux_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_stream_mux_0_0, 1))    
        self.connect((self.blocks_stream_mux_0, 0), (self.channels_channel_model_0_0, 0))    
        self.connect((self.blocks_stream_mux_0_0, 0), (self.channels_channel_model_0, 0))    
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_ofdm_tx_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.mysvl_svl_1, 0))    
        self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_stream_mux_0_0, 0))    
        self.connect((self.blocks_vector_source_x_0_0_0, 0), (self.blocks_stream_mux_0, 0))    
        self.connect((self.blocks_vector_source_x_1_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.blocks_udp_sink_0, 0))    
        self.connect((self.channels_channel_model_0_0, 0), (self.blocks_udp_sink_0_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))    
        self.connect((self.digital_ofdm_tx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.mysvl_svl_1, 1), (self.blocks_stream_mux_0, 2))    
        self.connect((self.mysvl_svl_1, 0), (self.blocks_stream_mux_0_0, 2))    
Ejemplo n.º 6
0
    def __init__(self):
        gr.top_block.__init__(self, "Example4 Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example4 Rx")
        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", "example4_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2500000
        self.length = length = 96
        self.gain = gain = 0.3
        self.freq = freq = 2375e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0_0 = uhd.usrp_source(
        	",".join(("", "serial=30C62C3")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0_0.set_subdev_spec("A:B", 0)
        self.uhd_usrp_source_0_0.set_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_source_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0_0.set_gain(gain, 0)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=2,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"Demodulated OFDM  Data", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0_0.enable_tags(-1, False)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0.disable_legend()
        
        labels = ["Bytes", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 1,0,1,4)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	512, #size
        	samp_rate, #samp_rate
        	"Demodulated GMSK  Data", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["Bytes", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 0,2,1,2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"GMSK Constellation", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        
        if not True:
          self.qtgui_const_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "red", "red", "red",
                  "red", "red", "red", "red", "red"]
        styles = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0,
                   0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0,0,1,2)
        self.mysvl_svl_0_0 = mysvl.svl(gr.sizeof_gr_complex*1, 1, "./inputs/spectrum_maps/example1a_rx.txt", "./inputs/parameters/example1a-c_rx.txt")
        self.digital_ofdm_rx_0 = digital.ofdm_rx(
        	  fft_len=64, cp_len=16,
        	  frame_length_tag_key='frame_'+"length",
        	  packet_length_tag_key="length",
        	  bps_header=1,
        	  bps_payload=2,
        	  debug_log=False,
        	  scramble_bits=False
        	 )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "./outputs/output_audio1.mp3", False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "./outputs/output_audio2.mp3", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0_0, 0))    
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_char_to_float_0_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_char_to_float_0_0, 0))    
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.mysvl_svl_0_0, 1), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.mysvl_svl_0_0, 0), (self.rational_resampler_xxx_0_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_const_sink_x_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.digital_ofdm_rx_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.mysvl_svl_0_0, 0))    
        self.connect((self.uhd_usrp_source_0_0, 0), (self.qtgui_freq_sink_x_0, 0))    
Ejemplo n.º 7
0
    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.time_preamble = time_preamble = [
            0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j,
            -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j,
            0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j,
            -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j,
            0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j,
            0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j,
            0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j,
            -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j,
            -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j,
            0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j,
            -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j,
            -0.538848 + 0.320228j, -0.111440 + 0.093688j,
            -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j,
            0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j,
            0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j,
            0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j,
            0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j,
            -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j,
            -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j,
            0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j,
            -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j,
            -0.495528 - 0.114832j, 0.522104 + 0.148216j
        ]
        self.samp_rate = samp_rate = 2000000
        self.preamble_len = preamble_len = 64
        self.padding = padding = 12
        self.packet_len = packet_len = 1024 * 4
        self.length = length = 96
        self.gain = gain = 0.6850
        self.freq = freq = 3550e6

        ##################################################
        # Blocks
        ##################################################
        self._gain_range = Range(0, 1, 0.001, 0.6850, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain",
                                     "counter_slider", float)
        self.top_layout.addWidget(self._gain_win)
        self.uhd_usrp_sink_0_0 = uhd.usrp_sink(
            ",".join(("", "serial= 30C6272")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0_0.set_subdev_spec("A:A", 0)
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0_0.set_normalized_gain(gain, 0)
        self.uhd_usrp_sink_0_0.set_antenna("TX/RX", 0)
        self.qtgui_freq_sink_x_0_1 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual spectrum 2 at Tx",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_1.set_y_axis(-95, -25)
        self.qtgui_freq_sink_x_0_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_1.enable_grid(False)
        self.qtgui_freq_sink_x_0_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_1.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_1.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_1_win, 2, 1,
                                       1, 1)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Real Spectrum at the Transmitter",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-95, -25)
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 3, 0,
                                       1, 2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Virtual spectrum 1 at Tx",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-95, -25)
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ["MySVL Tx", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1,
                                       1)
        self.mysvl_svl_0 = mysvl.svl(
            gr.sizeof_gr_complex * 1, 1,
            "/home/jonathan/Dropbox/repos/gr-mysvl/demo/inputs/maps/demo1b_tx.txt",
            "/home/jonathan/Dropbox/repos/gr-mysvl/demo/inputs/params/demo1b_tx.txt"
        )
        self.mysvl_stream_demux_0 = mysvl.stream_demux(
            gr.sizeof_gr_complex * 1, (1, packet_len - 2, 1), False)
        self.low_pass_filter_1_0 = filter.interp_fir_filter_ccf(
            4,
            firdes.low_pass(1, samp_rate, samp_rate / 8 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.interp_fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, samp_rate / 2 - samp_rate / 32,
                            samp_rate / 32, firdes.WIN_HAMMING, 6.76))
        self.foo_packet_pad_0_0 = foo.packet_pad(False, False, 0.001, 1000, 0)
        self.foo_burst_tagger_0_0 = foo.burst_tagger(pmt.intern("len"), 1)
        self.digital_ofdm_tx_0 = digital.ofdm_tx(
            fft_len=64,
            cp_len=16,
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=1,
            rolloff=0,
            debug_log=False,
            scramble_bits=False)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            time_preamble, True, 1, [])
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_char * 1,
                                                     "127.0.0.1", 3000, 1472,
                                                     True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, length, "length")
        self.blocks_stream_mux_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (padding + 1, packet_len - 2, padding + 1))
        self.blocks_stream_mux_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1, (preamble_len, packet_len + padding * 2))
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                               padding + 1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1,
                                             padding + 1)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vcc(
            (0.3, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.025, ))
        self.blocks_file_source_0_0_1 = blocks.file_source(
            gr.sizeof_char * 1,
            "/home/jonathan/Dropbox/repos/gr-mysvl/examples/inputs/Memory_and_Forgetting.mp3",
            True)
        self.blks2_packet_encoder_1 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=False,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0_0_1, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_stream_mux_1, 2))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_stream_mux_1, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.uhd_usrp_sink_0_0, 0))
        self.connect((self.blocks_stream_mux_1, 0),
                     (self.blocks_stream_mux_0, 1))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.foo_burst_tagger_0_0, 0),
                     (self.foo_packet_pad_0_0, 0))
        self.connect((self.foo_packet_pad_0_0, 0), (self.mysvl_svl_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.foo_burst_tagger_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.low_pass_filter_1_0, 0), (self.mysvl_svl_0, 0))
        self.connect((self.low_pass_filter_1_0, 0),
                     (self.qtgui_freq_sink_x_0_1, 0))
        self.connect((self.mysvl_stream_demux_0, 2), (self.blocks_repeat_0, 0))
        self.connect((self.mysvl_stream_demux_0, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.mysvl_stream_demux_0, 1),
                     (self.blocks_stream_mux_1, 1))
        self.connect((self.mysvl_svl_0, 0), (self.mysvl_stream_demux_0, 0))
Ejemplo n.º 8
0
    def __init__(self):
        gr.top_block.__init__(self, "Example5B Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example5B Rx")
        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", "example5b_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.udp_len = udp_len = 1472 * 8
        self.time_preamble = time_preamble = [
            0.125000 + 0.000000j, 0.522104 - 0.148216j, -0.495528 + 0.114832j,
            -0.267916 + 0.091700j, 0.236544 - 0.138456j, -0.098500 + 0.473800j,
            0.476480 - 0.225344j, -0.187516 + 0.035372j, 0.051776 - 0.353552j,
            -0.104936 + 0.059916j, 0.228684 + 0.117504j, -0.530912 + 0.560756j,
            0.359128 + 0.015872j, -0.132852 + 0.632840j, -0.105164 - 0.368872j,
            0.368272 - 0.032412j, 0.125000 + 0.750000j, 0.463968 + 0.457792j,
            0.151476 - 0.430948j, 0.685052 + 0.238524j, 0.494428 + 0.119428j,
            -0.557540 - 0.050056j, 0.416348 + 0.017368j, 0.104256 - 0.568836j,
            -0.301776 - 0.353552j, 0.079812 + 0.451516j, 0.439152 + 0.528072j,
            0.642060 + 0.178484j, -0.090096 + 0.465096j, -0.446492 + 0.305776j,
            -0.111440 - 0.093688j, -0.538848 - 0.320228j, 0.125000 + 0.000000j,
            -0.538848 + 0.320228j, -0.111440 + 0.093688j,
            -0.446492 - 0.305776j, -0.090096 - 0.465096j, 0.642060 - 0.178484j,
            0.439152 - 0.528072j, 0.079812 - 0.451516j, -0.301776 + 0.353552j,
            0.104256 + 0.568836j, 0.416348 - 0.017368j, -0.557540 + 0.050056j,
            0.494428 - 0.119428j, 0.685052 - 0.238524j, 0.151476 + 0.430948j,
            0.463968 - 0.457792j, 0.125000 - 0.750000j, 0.368272 + 0.032412j,
            -0.105164 + 0.368872j, -0.132852 - 0.632840j, 0.359128 - 0.015872j,
            -0.530912 - 0.560756j, 0.228684 - 0.117504j, -0.104936 - 0.059916j,
            0.051776 + 0.353552j, -0.187516 - 0.035372j, 0.476480 + 0.225344j,
            -0.098500 - 0.473800j, 0.236544 + 0.138456j, -0.267916 - 0.091700j,
            -0.495528 - 0.114832j, 0.522104 + 0.148216j
        ]
        self.threshold = threshold = 9.5
        self.samp_rate = samp_rate = 400000
        self.preamble_len = preamble_len = 64
        self.packet_len = packet_len = 1024
        self.number_len = number_len = 64 * 3
        self.length = length = 96

        ##################################################
        # Blocks
        ##################################################
        self._threshold_range = Range(0, 25, 0.25, 9.5, 200)
        self._threshold_win = RangeWidget(self._threshold_range,
                                          self.set_threshold, "Threshold",
                                          "counter_slider", float)
        self.top_grid_layout.addWidget(self._threshold_win, 0, 0, 1, 2)
        self.qtgui_time_sink_x_0_0_0_2 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_2.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_2.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_0_2.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0_0_0_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_2.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0_2.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_2.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_2.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0_2.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0_0_0_2.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_0_2.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_0_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_2.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_2_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0_2.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_2_win, 2,
                                       0, 1, 1)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0_0_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0_0.disable_legend()

        labels = ["", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0_0_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0_0_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win, 1, 0,
                                       1, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Demodulated OFDM  Data",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ["Bytes", "", "", "", "", "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 5, 0, 1,
                                       2)
        self.mysvl_triggered_demux_0_0 = mysvl.triggered_demux(
            gr.sizeof_gr_complex * 1, gr.sizeof_float,
            (preamble_len, number_len, packet_len), 1, True)
        self.mysvl_triggered_demux_0 = mysvl.triggered_demux(
            gr.sizeof_gr_complex * 1, gr.sizeof_float,
            (preamble_len, number_len, packet_len), 1, True)
        self.mysvl_sync_channels_0 = mysvl.sync_channels(1024)
        self.mysvl_svl_1 = mysvl.svl(gr.sizeof_gr_complex * 1, 1,
                                     "./inputs/spectrum_maps/one_many_rx.txt",
                                     "./inputs/parameters/one_many_rx.txt")
        self.mysvl_drop_packet_0_0 = mysvl.drop_packet(1024)
        self.mysvl_drop_packet_0 = mysvl.drop_packet(1024)
        self.digital_ofdm_rx_0 = digital.ofdm_rx(
            fft_len=64,
            cp_len=16,
            frame_length_tag_key='frame_' + "length",
            packet_length_tag_key="length",
            bps_header=1,
            bps_payload=1,
            debug_log=False,
            scramble_bits=False)
        self.digital_gfsk_demod_0_0 = digital.gfsk_demod(
            samples_per_symbol=2,
            sensitivity=1.0,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.digital_gfsk_demod_0 = digital.gfsk_demod(
            samples_per_symbol=2,
            sensitivity=1.0,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.digital_corr_est_cc_0_0 = digital.corr_est_cc((time_preamble), 1,
                                                           0, 0.99)
        self.digital_corr_est_cc_0 = digital.corr_est_cc((time_preamble), 1, 0,
                                                         0.99)
        self.blocks_udp_source_0_0 = blocks.udp_source(
            gr.sizeof_gr_complex * 1, "127.0.0.2", 4000, udp_len, True)
        (self.blocks_udp_source_0_0).set_min_output_buffer(1000000)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_gr_complex * 1,
                                                     "127.0.0.1", 4000,
                                                     udp_len, True)
        (self.blocks_udp_source_0).set_min_output_buffer(1000000)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1,
                                                 "127.0.0.1", 3001, 1472, True)
        self.blocks_threshold_ff_0_0 = blocks.threshold_ff(
            threshold, threshold, 0)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(
            threshold, threshold, 0)
        self.blocks_tag_gate_1 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                 False)
        self.blocks_tag_gate_0_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                   False)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                 False)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0_0_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_abs_xx_1_0 = blocks.abs_ff(1)
        self.blocks_abs_xx_1 = blocks.abs_ff(1)
        self.blks2_packet_decoder_0_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0_0.
                recv_pkt(ok, payload),
            ), )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_char_to_float_0_0_0, 0))
        self.connect((self.blks2_packet_decoder_0_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_abs_xx_1, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_abs_xx_1_0, 0),
                     (self.blocks_threshold_ff_0_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.mysvl_drop_packet_0_0, 1))
        self.connect((self.blocks_char_to_float_0_0_0, 0),
                     (self.mysvl_drop_packet_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_abs_xx_1, 0))
        self.connect((self.blocks_complex_to_float_0_0, 0),
                     (self.blocks_abs_xx_1_0, 0))
        self.connect((self.blocks_tag_gate_0, 0),
                     (self.mysvl_triggered_demux_0, 0))
        self.connect((self.blocks_tag_gate_0_0, 0),
                     (self.mysvl_triggered_demux_0_0, 0))
        self.connect((self.blocks_tag_gate_1, 0), (self.digital_ofdm_rx_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.mysvl_triggered_demux_0, 1))
        self.connect((self.blocks_threshold_ff_0_0, 0),
                     (self.mysvl_triggered_demux_0_0, 1))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.digital_corr_est_cc_0, 0))
        self.connect((self.blocks_udp_source_0_0, 0),
                     (self.digital_corr_est_cc_0_0, 0))
        self.connect((self.digital_corr_est_cc_0, 1),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_corr_est_cc_0, 0),
                     (self.blocks_tag_gate_0, 0))
        self.connect((self.digital_corr_est_cc_0_0, 1),
                     (self.blocks_complex_to_float_0_0, 0))
        self.connect((self.digital_corr_est_cc_0_0, 0),
                     (self.blocks_tag_gate_0_0, 0))
        self.connect((self.digital_gfsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gfsk_demod_0_0, 0),
                     (self.blks2_packet_decoder_0_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_udp_sink_0, 0))
        self.connect((self.mysvl_drop_packet_0, 0),
                     (self.mysvl_sync_channels_0, 0))
        self.connect((self.mysvl_drop_packet_0_0, 0),
                     (self.mysvl_sync_channels_0, 1))
        self.connect((self.mysvl_svl_1, 0), (self.blocks_tag_gate_1, 0))
        self.connect((self.mysvl_sync_channels_0, 0), (self.mysvl_svl_1, 0))
        self.connect((self.mysvl_sync_channels_0, 1), (self.mysvl_svl_1, 1))
        self.connect((self.mysvl_triggered_demux_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.mysvl_triggered_demux_0, 1),
                     (self.digital_gfsk_demod_0, 0))
        self.connect((self.mysvl_triggered_demux_0, 2),
                     (self.mysvl_drop_packet_0, 0))
        self.connect((self.mysvl_triggered_demux_0, 2),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.mysvl_triggered_demux_0_0, 0),
                     (self.blocks_null_sink_1_0, 0))
        self.connect((self.mysvl_triggered_demux_0_0, 1),
                     (self.digital_gfsk_demod_0_0, 0))
        self.connect((self.mysvl_triggered_demux_0_0, 2),
                     (self.mysvl_drop_packet_0_0, 0))
        self.connect((self.mysvl_triggered_demux_0_0, 2),
                     (self.qtgui_time_sink_x_0_0_0_2, 0))