コード例 #1
0
ファイル: watterson_tap.py プロジェクト: gvanhoy/gr-hf
    def __init__(self, doppler_spread_hz=.001, delay_spread_s=2, num_taps=100):
        gr.top_block.__init__(self, "Watterson Tap Generation")

        ##################################################
        # Variables
        ##################################################
        self.num_taps = num_taps
        self.doppler_spread_hz = doppler_spread_hz
        self.delay_spread_s = delay_spread_s
        self.taps = taps = gen_taps(doppler_spread_hz, delay_spread_s,
                                    num_taps)
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, taps)
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.block_0 = blocks.probe_signal_c()
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 1, np.random.randint(0, 10000))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.block_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.blocks_throttle_0, 0))
コード例 #2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self)
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.base_freq = base_freq = 121250000
        self.t = 0
        self.volume_min = 0.001
        self.volume = volume = self.volume_min
        self.volume_max = 0.6
        self.squelch = squelch = -26
        self.samp_rate = samp_rate = 2400000
        self.freq_corr = freq_corr = 31
        self.freq = freq = base_freq
        self.frq_choices = [
            121250000, 121500000, 122200000, 123450000, 124175000, 124925000,
            125450000, 130875000, 132700000, 134225000, 134925000, 136050000,
            136575000, 169000000
        ]
        # EPSD Port 122700000      EP Przelotowa 124500000      Air-To-Air 2 136975000
        #self.frq_choices = [134225000]
        self.frq_labels = [
            'EPSC TWR', 'EP EMRG', 'EPSD Kwadrat', 'Air-To-Air',
            'Mueritz EDWW Radar', 'B FIR Warszawa', 'EPWW Radar 2',
            'EPWW Radar 3', 'EPWW Radar 4', 'D FIR Warszawa', 'EPWW Radar',
            'Mark EDWW Radar', 'E FIR Warszawa', 'Lotnicze Pogotowie Ratunkowe'
        ]
        #self.frq_labels = ['D FIR Warszawa']
        self.j = 0

        ##################################################
        # Blocks
        ##################################################

        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(freq_corr, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(49.6, 0)
        self.rtlsdr_source_0.set_if_gain(1, 0)
        self.rtlsdr_source_0.set_bb_gain(1, 0)
        self.rtlsdr_source_0.set_antenna("RX", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.signal_probe = blocks.probe_signal_c()
        #self.signal_probe = analog.probe_avg_mag_sqrd_c(0, 1)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            50, (firdes.low_pass_2(1, samp_rate, 25e3, 10e3, 40)), 0,
            samp_rate)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.audio_sink_0 = audio.sink(48000, "hw:0,1", True)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(
            squelch, 0.1, 0, False)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=48000,
            audio_decim=1,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 0.1e-4, 1.0, 0)
        self.analog_agc2_xx_0.set_max_gain(5)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0), (self.signal_probe, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.analog_agc2_xx_0, 0))
コード例 #3
0
    def __init__(self, address="addr=192.168.10.2", tx_gain=0, cfreq=450e6):
        gr.top_block.__init__(self, "Bs Main")

        ##################################################
        # Parameters
        ##################################################
        self.address = address
        self.tx_gain = tx_gain
        self.cfreq = cfreq

        ##################################################
        # Variables
        ##################################################
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.packet_length_tag_key = packet_length_tag_key = "packet_len"
        self.occupied_carriers = occupied_carriers = (
            range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) +
            range(8, 21) + range(22, 27), )
        self.length_tag_key = length_tag_key = "frame_len"
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.fft_len = fft_len = 64
        self.sync_word2 = sync_word2 = [
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1,
            1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1,
            1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1,
            -1, 0, 0, 0, 0, 0
        ]
        self.sync_word1 = sync_word1 = [
            0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0.,
            -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            0., 0., 0., 0., 0.
        ]
        self.samp_rate = samp_rate = 500000
        self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, payload_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 1)
        self.packet_len = packet_len = 12
        self.header_formatter = header_formatter = digital.packet_header_ofdm(
            occupied_carriers,
            n_syms=1,
            len_tag_key=packet_length_tag_key,
            frame_len_tag_key=length_tag_key,
            bits_per_header_sym=header_mod.bits_per_symbol(),
            bits_per_payload_sym=payload_mod.bits_per_symbol(),
            scramble_header=False)
        self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, header_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols)
        self.h_3 = h_3 = 0
        self.h_2 = h_2 = 0
        self.h_1 = h_1 = 0
        self.h_0 = h_0 = 1.0

        ##################################################
        # Blocks
        ##################################################
        self.x_3 = blocks.probe_signal_c()
        self.x_2 = blocks.probe_signal_c()
        self.x_1 = blocks.probe_signal_c()
        self.x_0 = blocks.probe_signal_c()

        def _h_3_probe():
            while True:
                val = self.x_3.level()
                try:
                    self.set_h_3(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_3_thread = threading.Thread(target=_h_3_probe)
        _h_3_thread.daemon = True
        _h_3_thread.start()

        def _h_2_probe():
            while True:
                val = self.x_2.level()
                try:
                    self.set_h_2(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (100))

        _h_2_thread = threading.Thread(target=_h_2_probe)
        _h_2_thread.daemon = True
        _h_2_thread.start()

        def _h_1_probe():
            while True:
                val = self.x_1.level()
                try:
                    self.set_h_1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1000))

        _h_1_thread = threading.Thread(target=_h_1_probe)
        _h_1_thread.daemon = True
        _h_1_thread.start()

        def _h_0_probe():
            while True:
                val = self.x_0.level()
                try:
                    self.set_h_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_0_thread = threading.Thread(target=_h_0_probe)
        _h_0_thread.daemon = True
        _h_0_thread.start()
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(cfreq, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
            "packet_len",
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(cfreq, 0)
        self.uhd_usrp_sink_0.set_gain(tx_gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.projectGT_detect_gen_mac_b_0 = projectGT.detect_gen_mac_b(
            "packet_len")
        self.ofdm_rx_phase_1_0 = ofdm_rx_phase_1(
            pilot_carriers=pilot_carriers,
            pilot_symbols=pilot_symbols,
            header_mod=header_mod,
            payload_mod=payload_mod,
            occupied_carriers=occupied_carriers,
            sync_word2=sync_word2,
            sync_word1=sync_word1,
            fft_len=fft_len,
            packet_len=packet_len,
            samp_rate=samp_rate,
        )
        self.channels_channel_model_0_1 = channels.channel_model(
            noise_voltage=0.4,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=895,
            block_tags=False)
        self.channels_channel_model_0_0_1 = channels.channel_model(
            noise_voltage=0.15,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=8217,
            block_tags=False)
        self.channels_channel_model_0_0_0 = channels.channel_model(
            noise_voltage=0.05,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=7156,
            block_tags=False)
        self.channels_channel_model_0_0 = channels.channel_model(
            noise_voltage=1.0,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=289,
            block_tags=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.00,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(h_0 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_1 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_2 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_3 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2)))),
            noise_seed=0,
            block_tags=True)
        self.blocks_tag_debug_2 = blocks.tag_debug(gr.sizeof_char * 1,
                                                   "Data  Out", "")
        self.blocks_tag_debug_2.set_display(True)
        self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_char * 1, "", "")
        self.blocks_tag_debug_1.set_display(False)
        self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1,
                                                   "RX data", "")
        self.blocks_tag_debug_0.set_display(True)
        self.blocks_stream_to_tagged_stream_1 = blocks.stream_to_tagged_stream(
            gr.sizeof_gr_complex, 1, 720, "packet_len")
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, "packet_len")
        self.blocks_null_source_0_1 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_0_0_0 = blocks.null_source(
            gr.sizeof_gr_complex * 1)
        self.blocks_null_source_0_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 8)
        self.OFDM_TX_Phase_1_0 = OFDM_TX_Phase_1(
            fft_len=fft_len,
            pilot_carriers=pilot_carriers,
            occupied_carriers=occupied_carriers,
            packet_len=packet_len,
            header_mod=header_mod,
            payload_mod=payload_mod,
            rolloff=0,
            pilot_symbols=pilot_symbols,
            sync_word2=sync_word2,
            sync_word1=sync_word1,
            prefix=fft_len / 4,
            samp_rate=samp_rate,
        )

        ##################################################
        # Connections
        ##################################################
        self.msg_connect(self.projectGT_detect_gen_mac_b_0, "pdus",
                         self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.connect((self.OFDM_TX_Phase_1_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.blocks_stream_to_tagged_stream_1, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.channels_channel_model_0_0, 0))
        self.connect((self.blocks_null_source_0_0, 0),
                     (self.channels_channel_model_0_0_0, 0))
        self.connect((self.blocks_null_source_0_0_0, 0),
                     (self.channels_channel_model_0_0_1, 0))
        self.connect((self.blocks_null_source_0_1, 0),
                     (self.channels_channel_model_0_1, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.OFDM_TX_Phase_1_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_tag_debug_2, 0))
        self.connect((self.blocks_stream_to_tagged_stream_1, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.channels_channel_model_0_0, 0), (self.x_0, 0))
        self.connect((self.channels_channel_model_0_0_0, 0), (self.x_2, 0))
        self.connect((self.channels_channel_model_0_0_1, 0), (self.x_3, 0))
        self.connect((self.channels_channel_model_0_1, 0), (self.x_1, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0), (self.blocks_tag_debug_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1), (self.blocks_tag_debug_1, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.ofdm_rx_phase_1_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1),
                     (self.projectGT_detect_gen_mac_b_0, 0))
コード例 #4
0
    def __init__(self, port=65400, address="addr=192.168.10.2", seed1=1088):
        gr.top_block.__init__(self, "Ue")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Ue")
        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", "UE")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.port = port
        self.address = address
        self.seed1 = seed1

        ##################################################
        # Variables
        ##################################################
        self.seed2 = seed2 = seed1 + 384
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.occupied_carriers = occupied_carriers = (
            range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) +
            range(8, 21) + range(22, 27), )
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.fft_len = fft_len = 64
        self.sync_word2 = sync_word2 = [
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1,
            1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1,
            1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1,
            -1, 0, 0, 0, 0, 0
        ]
        self.sync_word1 = sync_word1 = [
            0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0.,
            -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            0., 0., 0., 0., 0.
        ]
        self.seed6 = seed6 = seed1 + 4590
        self.seed5 = seed5 = seed2 + 851
        self.seed4 = seed4 = seed1 + 9027
        self.seed3 = seed3 = seed1 + 2791
        self.samp_rate = samp_rate = 500000
        self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, payload_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.packet_length_tag_key = packet_length_tag_key = "packet_len"
        self.packet_len = packet_len = 12
        self.noise_power = noise_power = 0
        self.length_tag_key = length_tag_key = "frame_len"
        self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, header_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.h_2 = h_2 = 0
        self.h_1 = h_1 = 0
        self.h_0 = h_0 = 1

        ##################################################
        # Blocks
        ##################################################
        self.s_2 = blocks.probe_signal_c()
        self.s_1 = blocks.probe_signal_c()
        self.s_0 = blocks.probe_signal_c()
        self.noise_variance = blocks.probe_signal_f()

        def _noise_power_probe():
            while True:
                val = self.noise_variance.level()
                try:
                    self.set_noise_power(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _noise_power_thread = threading.Thread(target=_noise_power_probe)
        _noise_power_thread.daemon = True
        _noise_power_thread.start()

        def _h_2_probe():
            while True:
                val = self.s_2.level()
                try:
                    self.set_h_2(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_2_thread = threading.Thread(target=_h_2_probe)
        _h_2_thread.daemon = True
        _h_2_thread.start()

        def _h_1_probe():
            while True:
                val = self.s_1.level()
                try:
                    self.set_h_1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_1_thread = threading.Thread(target=_h_1_probe)
        _h_1_thread.daemon = True
        _h_1_thread.start()

        def _h_0_probe():
            while True:
                val = self.s_0.level()
                try:
                    self.set_h_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _h_0_thread = threading.Thread(target=_h_0_probe)
        _h_0_thread.daemon = True
        _h_0_thread.start()
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(450e6, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #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, True)
        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)

        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(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_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #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)

        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(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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        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)

        if complex == type(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.projectGT_variance_cc_0 = projectGT.variance_cc(5000)
        self.projectGT_IA_vectors_vcvc_0 = projectGT.IA_vectors_vcvc(
            fft_len, noise_power, 1, 2, (15, 25, 40, 45), length_tag_key)
        self.ofdm_rx_phase_1_0 = ofdm_rx_phase_1(
            pilot_symbols=pilot_symbols,
            header_mod=header_mod,
            payload_mod=payload_mod,
            sync_word2=sync_word2,
            sync_word1=sync_word1,
            fft_len=fft_len,
            packet_len=packet_len,
            occupied_carriers=occupied_carriers,
            pilot_carriers=pilot_carriers,
            samp_rate=samp_rate,
        )
        self.channels_channel_model_4_0 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed6,
            block_tags=False)
        self.channels_channel_model_4 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed4,
            block_tags=False)
        self.channels_channel_model_3_0 = channels.channel_model(
            noise_voltage=0.05,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed5,
            block_tags=False)
        self.channels_channel_model_3 = channels.channel_model(
            noise_voltage=0.1,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed3,
            block_tags=False)
        self.channels_channel_model_2 = channels.channel_model(
            noise_voltage=0.11,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed2,
            block_tags=False)
        self.channels_channel_model_1 = channels.channel_model(
            noise_voltage=0.12,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=seed1,
            block_tags=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.000,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=((h_0, h_1, h_2)),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_to_stream_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                 "134.214.146.135", port, 1472,
                                                 True)
        self.blocks_tag_debug_3 = blocks.tag_debug(gr.sizeof_gr_complex * 1,
                                                   "IA", "")
        self.blocks_tag_debug_3.set_display(True)
        self.blocks_tag_debug_1 = blocks.tag_debug(
            gr.sizeof_gr_complex * fft_len, "chnl_intrf", "")
        self.blocks_tag_debug_1.set_display(False)
        self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1,
                                                   "Payload_intrf", "")
        self.blocks_tag_debug_0.set_display(False)
        self.blocks_null_source_3_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_3 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_2_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_2 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_1 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_float_to_complex_1_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_3_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_3 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_2_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_2 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_1 = blocks.complex_to_mag(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_1_0 = blocks.add_const_vcc((0.0, ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vcc((0.1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.8, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.s_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.s_1, 0))
        self.connect((self.blocks_add_const_vxx_1_0, 0), (self.s_2, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_complex_to_mag_2, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_complex_to_mag_2_0, 0),
                     (self.blocks_float_to_complex_1_0, 0))
        self.connect((self.blocks_complex_to_mag_3, 0),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_complex_to_mag_3_0, 0),
                     (self.blocks_float_to_complex_1_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_float_to_complex_1_0, 0),
                     (self.blocks_add_const_vxx_1_0, 0))
        self.connect((self.blocks_null_source_0, 0),
                     (self.channels_channel_model_1, 0))
        self.connect((self.blocks_null_source_1, 0),
                     (self.channels_channel_model_2, 0))
        self.connect((self.blocks_null_source_2, 0),
                     (self.channels_channel_model_3, 0))
        self.connect((self.blocks_null_source_2_0, 0),
                     (self.channels_channel_model_3_0, 0))
        self.connect((self.blocks_null_source_3, 0),
                     (self.channels_channel_model_4, 0))
        self.connect((self.blocks_null_source_3_0, 0),
                     (self.channels_channel_model_4_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_vector_to_stream_1, 0),
                     (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ofdm_rx_phase_1_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.projectGT_variance_cc_0, 0))
        self.connect((self.channels_channel_model_1, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.channels_channel_model_2, 0),
                     (self.blocks_complex_to_mag_1, 0))
        self.connect((self.channels_channel_model_3, 0),
                     (self.blocks_complex_to_mag_2, 0))
        self.connect((self.channels_channel_model_3_0, 0),
                     (self.blocks_complex_to_mag_2_0, 0))
        self.connect((self.channels_channel_model_4, 0),
                     (self.blocks_complex_to_mag_3, 0))
        self.connect((self.channels_channel_model_4_0, 0),
                     (self.blocks_complex_to_mag_3_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 2), (self.blocks_tag_debug_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0), (self.blocks_tag_debug_1, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1),
                     (self.blocks_vector_to_stream_1, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_tag_debug_3, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.projectGT_variance_cc_0, 0),
                     (self.noise_variance, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 1),
                     (self.projectGT_IA_vectors_vcvc_0, 0))
        self.connect((self.ofdm_rx_phase_1_0, 0),
                     (self.projectGT_IA_vectors_vcvc_0, 1))
コード例 #5
0
    def __init__(self):
        gr.top_block.__init__(self, "OFDM Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("OFDM 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", "tx_ofdm_updated")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.pilot_symbols = pilot_symbols = ((1, 1, 1, -1,),)
        self.pilot_carriers = pilot_carriers = ((-21, -7, 7, 21,),)
        self.payload_mod = payload_mod = digital.constellation_bpsk()
        self.packet_length_tag_key = packet_length_tag_key = "packet_len"
        self.occupied_carriers = occupied_carriers = (list(range(-26, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 27)),)
        self.length_tag_key = length_tag_key = "packet_len"
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.fft_len = fft_len = 64
        self.tx_probe = tx_probe = 0
        self.sync_word2_0 = sync_word2_0 = [0j, 0j, 0j, 0j, 0j, 0j, (-1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1 +0j), (1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), 0j, (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (1+0j), (1+0j), (1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (1+0j), (-1+0j), (1+0j), (-1+0j), (-1+0j), (-1+0j), (-1+0j), 0j, 0j, 0j, 0j, 0j]
        self.sync_word2 = sync_word2 = [0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 0, 0, 0, 0, 0]
        self.sync_word1_0 = sync_word1_0 = [0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0.]
        self.sync_word1 = sync_word1 = [0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 0., 0., 0., 0., 0.]
        self.samp_rate = samp_rate = 50000
        self.rx_probe = rx_probe = 0
        self.rolloff = rolloff = 0
        self.pilot_symbols_0 = pilot_symbols_0 = ((1, 1, 1, -1,),)
        self.pilot_carriers_0 = pilot_carriers_0 = ((-21, -7, 7, 21,),)
        self.payload_mod_0 = payload_mod_0 = digital.constellation_qpsk()
        self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe(fft_len, payload_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols, 1)
        self.packet_len_0 = packet_len_0 = 96
        self.packet_len = packet_len = 96
        self.output_signal = output_signal = 0
        self.og_signal_probe = og_signal_probe = 0
        self.occupied_carriers_0 = occupied_carriers_0 = (list(range(-26, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 27)),)
        self.length_tag_key_0 = length_tag_key_0 = "frame_len"
        self.input_signal = input_signal = 0
        self.header_mod_0 = header_mod_0 = digital.constellation_bpsk()
        self.header_formatter = header_formatter = digital.packet_header_ofdm(occupied_carriers, n_syms=1, len_tag_key=packet_length_tag_key, frame_len_tag_key=length_tag_key, bits_per_header_sym=header_mod.bits_per_symbol(), bits_per_payload_sym=payload_mod.bits_per_symbol(), scramble_header=False)
        self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(fft_len, header_mod.base(), occupied_carriers, pilot_carriers, pilot_symbols)
        self.hdr_format = hdr_format = digital.header_format_ofdm(occupied_carriers, 1, length_tag_key,)
        self.fft_len_0 = fft_len_0 = 64
        self.decoded_probe = decoded_probe = 0

        ##################################################
        # Blocks
        ##################################################
        self.blocks_probe_signal_x_4 = blocks.probe_signal_c()
        self.blocks_probe_signal_x_3 = blocks.probe_signal_c()
        self.blocks_probe_signal_x_2 = blocks.probe_signal_b()
        self.blocks_probe_signal_x_0_1 = blocks.probe_signal_b()
        self.blocks_probe_signal_x_0_0_0 = blocks.probe_signal_c()
        self.blocks_probe_signal_x_0_0 = blocks.probe_signal_c()
        def _tx_probe_probe():
            global transmitted_data
            while True:

                val = self.blocks_probe_signal_x_0_0.level()
                transmitted_data = val
                try:
                    self.set_tx_probe(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _tx_probe_thread = threading.Thread(target=_tx_probe_probe)
        _tx_probe_thread.daemon = True
        _tx_probe_thread.start()

        def _rx_probe_probe():
            global received_data
            while True:

                val = self.blocks_probe_signal_x_3.level()
                received_data = val
                try:
                    self.set_rx_probe(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _rx_probe_thread = threading.Thread(target=_rx_probe_probe)
        _rx_probe_thread.daemon = True
        _rx_probe_thread.start()

        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            1024, #size
            samp_rate, #samp_rate
            'Scope Plot', #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(True)
        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)


        labels = ['Scope Plot', '', '', '', '',
            '', '', '', '', '']
        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]
        styles = [1, 1, 1, 1, 1,
            1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
            -1, -1, -1, -1, -1]


        for i in range(2):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            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)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024, #size
            samp_rate, #samp_rate
            'Scope Plot', #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(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)


        labels = ['Scope Plot', '', '', '', '',
            '', '', '', '', '']
        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]
        styles = [1, 1, 1, 1, 1,
            1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
            -1, -1, -1, -1, -1]


        for i in range(2):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            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)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024, #size
            firdes.WIN_BLACKMAN_hARRIS, #wintype
            0, #fc
            samp_rate, #bw
            'FFT Plot', #name
            1
        )
        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_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        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_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)



        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 range(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)
        def _output_signal_probe():
            global output_data
            while True:

                val = self.blocks_probe_signal_x_0_1.level()
                output_data = val
                try:
                    self.set_output_signal(val)
                except AttributeError:
                    pass
                # time.sleep(1.0 / (10))
                time.sleep(0.0911)
        _output_signal_thread = threading.Thread(target=_output_signal_probe)
        _output_signal_thread.daemon = True
        _output_signal_thread.start()

        def _og_signal_probe_probe():
            global encoded_data
            while True:

                val = self.blocks_probe_signal_x_0_0_0.level()
                encoded_data = val
                try:
                    self.set_og_signal_probe(val)
                except AttributeError:
                    pass
                
                time.sleep(1.0 / (10))
        _og_signal_probe_thread = threading.Thread(target=_og_signal_probe_probe)
        _og_signal_probe_thread.daemon = True
        _og_signal_probe_thread.start()

        def _input_signal_probe():
            global input_data
            while True:

                val = self.blocks_probe_signal_x_2.level()
                input_data = val
                try:
                    self.set_input_signal(val)
                except AttributeError:
                    pass
                
                time.sleep(1.0 / (10))
        _input_signal_thread = threading.Thread(target=_input_signal_probe)
        _input_signal_thread.daemon = True
        _input_signal_thread.start()

        self.fft_vxx_1 = fft.fft_vcc(fft_len, True, (), True, 1)
        self.fft_vxx_0_0 = fft.fft_vcc(fft_len, True, (), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(fft_len, False, (), True, 1)
        self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(hdr_format, length_tag_key)
        self.digital_packet_headerparser_b_0 = digital.packet_headerparser_b(header_formatter.base())
        self.digital_ofdm_sync_sc_cfb_0 = digital.ofdm_sync_sc_cfb(fft_len, fft_len//4, False, 0.9)
        self.digital_ofdm_serializer_vcc_payload = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, length_tag_key, packet_length_tag_key, 1, '', True)
        self.digital_ofdm_serializer_vcc_header = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, length_tag_key, '', 0, '', True)
        self.digital_ofdm_frame_equalizer_vcvc_1 = digital.ofdm_frame_equalizer_vcvc(payload_equalizer.base(), fft_len//4, length_tag_key, True, 0)
        self.digital_ofdm_frame_equalizer_vcvc_0 = digital.ofdm_frame_equalizer_vcvc(header_equalizer.base(), fft_len//4, length_tag_key, True, 1)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(fft_len, fft_len + fft_len//4, rolloff, length_tag_key)
        self.digital_ofdm_chanest_vcvc_0 = digital.ofdm_chanest_vcvc(sync_word1, sync_word2, 1, 0, 3, False)
        self.digital_ofdm_carrier_allocator_cvc_0 = digital.ofdm_carrier_allocator_cvc( fft_len, occupied_carriers, pilot_carriers, pilot_symbols, (sync_word1, sync_word2), length_tag_key, True)
        self.digital_header_payload_demux_0 = digital.header_payload_demux(
            3,
            fft_len,
            fft_len//4,
            length_tag_key,
            "",
            True,
            gr.sizeof_gr_complex,
            "rx_time",
            samp_rate,
            (),
            0)
        self.digital_crc32_bb_0_0 = digital.crc32_bb(True, packet_length_tag_key, True)
        self.digital_crc32_bb_0 = digital.crc32_bb(False, length_tag_key, True)
        self.digital_constellation_decoder_cb_1 = digital.constellation_decoder_cb(payload_mod.base())
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(header_mod.base())
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc(payload_mod.points(), 1)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(header_mod.points(), 1)
        def _decoded_probe_probe():
            global decoded_signal
            while True:

                val = self.blocks_probe_signal_x_4.level()
                decoded_signal = val
                try:
                    self.set_decoded_probe(val)
                except AttributeError:
                    pass
                
                # time.sleep(1.0 / (10))
                time.sleep(0.0911)
        _decoded_probe_thread = threading.Thread(target=_decoded_probe_probe)
        _decoded_probe_thread.daemon = True
        _decoded_probe_thread.start()

        self.channels_channel_model_0_0 = channels.channel_model(
            noise_voltage=0.15,
            frequency_offset=0 * 1.0/fft_len,
            epsilon=1.0,
            taps=[1.0 + 1.0j],
            noise_seed=0,
            block_tags=True)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(gr.sizeof_gr_complex*1, length_tag_key, 0)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_char*1, 'Rx Bytes', "")
        self.blocks_tag_debug_1.set_display(True)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, packet_len, length_tag_key)
        self.blocks_repack_bits_bb_0_1 = blocks.repack_bits_bb(payload_mod.bits_per_symbol(), 8, packet_length_tag_key, True, gr.GR_LSB_FIRST)
        self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(8, 1, length_tag_key, False, gr.GR_LSB_FIRST)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(8, payload_mod.bits_per_symbol(), length_tag_key, False, gr.GR_LSB_FIRST)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.05)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, fft_len+fft_len//4)
        self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 255, 1000))), True)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(-2.0/fft_len)



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_packet_headerparser_b_0, u'header_data'), (self.digital_header_payload_demux_0, u'header_data'))
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blocks_probe_signal_x_2, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_tag_gate_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.digital_header_payload_demux_0, 0))
        self.connect((self.blocks_repack_bits_bb_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.blocks_repack_bits_bb_0_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_repack_bits_bb_0_1, 0), (self.blocks_probe_signal_x_0_1, 0))
        self.connect((self.blocks_repack_bits_bb_0_1, 0), (self.digital_crc32_bb_0_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_crc32_bb_0, 0))
        self.connect((self.blocks_tag_gate_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0), (self.blocks_probe_signal_x_0_0_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0), (self.digital_ofdm_carrier_allocator_cvc_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_probe_signal_x_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_probe_signal_x_3, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.digital_ofdm_sync_sc_cfb_0, 0))
        self.connect((self.channels_channel_model_0_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_tagged_stream_mux_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.blocks_tagged_stream_mux_0, 1))
        self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_packet_headerparser_b_0, 0))
        self.connect((self.digital_constellation_decoder_cb_1, 0), (self.blocks_repack_bits_bb_0_1, 0))
        self.connect((self.digital_crc32_bb_0, 0), (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.digital_crc32_bb_0, 0), (self.digital_protocol_formatter_bb_0, 0))
        self.connect((self.digital_crc32_bb_0_0, 0), (self.blocks_tag_debug_1, 0))
        self.connect((self.digital_header_payload_demux_0, 0), (self.fft_vxx_0_0, 0))
        self.connect((self.digital_header_payload_demux_0, 1), (self.fft_vxx_1, 0))
        self.connect((self.digital_ofdm_carrier_allocator_cvc_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.digital_ofdm_chanest_vcvc_0, 0), (self.digital_ofdm_frame_equalizer_vcvc_0, 0))
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.digital_ofdm_frame_equalizer_vcvc_0, 0), (self.digital_ofdm_serializer_vcc_header, 0))
        self.connect((self.digital_ofdm_frame_equalizer_vcvc_1, 0), (self.digital_ofdm_serializer_vcc_payload, 0))
        self.connect((self.digital_ofdm_serializer_vcc_header, 0), (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_ofdm_serializer_vcc_payload, 0), (self.blocks_probe_signal_x_4, 0))
        self.connect((self.digital_ofdm_serializer_vcc_payload, 0), (self.digital_constellation_decoder_cb_1, 0))
        self.connect((self.digital_ofdm_sync_sc_cfb_0, 0), (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.digital_ofdm_sync_sc_cfb_0, 1), (self.digital_header_payload_demux_0, 1))
        self.connect((self.digital_protocol_formatter_bb_0, 0), (self.blocks_repack_bits_bb_0_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.digital_ofdm_cyclic_prefixer_0, 0))
        self.connect((self.fft_vxx_0_0, 0), (self.digital_ofdm_chanest_vcvc_0, 0))
        self.connect((self.fft_vxx_1, 0), (self.digital_ofdm_frame_equalizer_vcvc_1, 0))
コード例 #6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Hop on Demand")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_samp_rate = tx_samp_rate = 50e3
        self.tx_freq = tx_freq = 100e6
        self.sps = sps = 4
        self.rx_samp_rate = rx_samp_rate = 2e6
        self.rx_freq = rx_freq = 100e6
        self.qpsk = qpsk = digital.constellation_rect(([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base()
        self.excess_bw = excess_bw = 0.35

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_gr_complex, 1, "tcp://127.0.0.1:5557", 1000, False, -1)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=rx_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=rx_samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=True,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=True,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(rx_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(rx_freq, 0)
        self.uhd_usrp_source_0.set_gain(15, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(tx_samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(tx_freq, 0)
        self.uhd_usrp_sink_0.set_gain(30, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, rx_samp_rate, 1e6, 30e3, firdes.WIN_HAMMING, 6.76))
        self.digital_constellation_modulator_0 = digital.generic_mod(
          constellation=qpsk,
          differential=True,
          samples_per_symbol=sps,
          pre_diff_code=True,
          excess_bw=excess_bw,
          verbose=False,
          log=False,
          )
        self.blocks_probe_signal_x_0 = blocks.probe_signal_c()
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 256, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0))    
        self.connect((self.digital_constellation_modulator_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.zeromq_sub_source_0, 0), (self.blocks_probe_signal_x_0, 0))

	### Added by Bill Urrego ###
    	t = Thread(target=sub, args=(self.change_freq,))
    	t.start()
コード例 #7
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self)
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.base_freq = base_freq = 134225000
        self.t = 0
        self.volume = volume = 0.5
        self.volume_max = 1.0
        self.squelch = squelch = -30
        self.samp_rate = samp_rate = 2400000
        self.freq_corr = freq_corr = 96
        self.freq = freq = base_freq
        self.frq_choices = 26960000
        self.j = 0

        ##################################################
        # Blocks
        ##################################################

        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(freq_corr, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(49.6, 0)
        self.rtlsdr_source_0.set_if_gain(1, 0)
        self.rtlsdr_source_0.set_bb_gain(1, 0)
        self.rtlsdr_source_0.set_antenna("RX", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.signal_probe = blocks.probe_signal_c()
        #self.signal_probe = analog.probe_avg_mag_sqrd_c(0, 1)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            50, (firdes.low_pass_2(1, samp_rate, 25e3, 10e3, 40)), 0,
            samp_rate)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.audio_sink_0 = audio.sink(48000, "hw:0,1", True)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(
            squelch, 0.1, 0, False)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=48000,
            audio_decim=1,
            audio_pass=5000,
            audio_stop=5500,
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 0.1e-4, 1.0, 0)
        self.analog_agc2_xx_0.set_max_gain(5)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0), (self.signal_probe, 0))
コード例 #8
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.variable_function_probe_0 = variable_function_probe_0 = 0
        self.systemfs = systemfs = 38400000
        self.samp_rate = samp_rate = 38400000
        self.mu = mu = 0.0005
        self.f3 = f3 = 0.1
        self.f2 = f2 = 0
        self.f1 = f1 = -0.1
        self.beta7_real = beta7_real = 0
        self.beta7_imag = beta7_imag = 0
        self.beta5_real = beta5_real = 0
        self.beta5_imag = beta5_imag = 0
        self.beta3_real = beta3_real = 0.02
        self.beta3_imag = beta3_imag = 0.01
        self.beta1_real = beta1_real = 1
        self.beta1_imag = beta1_imag = 0
        self.alpha_real = alpha_real = 0
        self.alpha_imag = alpha_imag = 0
        self.a3 = a3 = 1
        self.a2 = a2 = 1
        self.a1 = a1 = 1
        self.ScalingForPA = ScalingForPA = 5.485960502027843
        self.LoopDelay = LoopDelay = 51

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, "Carrier Positions and Amplitudes")
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, "PA Paramters")
        self.top_grid_layout.addWidget(self.tab, 1, 0, 3, 4)
        self.probe_signal = blocks.probe_signal_c()
        self._f3_range = Range(-0.5, 0.5, 0.001, 0.1, 200)
        self._f3_win = RangeWidget(self._f3_range, self.set_f3, "f3",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._f3_win, 0, 2, 1, 1)
        self._f2_range = Range(-0.5, 0.5, 0.001, 0, 200)
        self._f2_win = RangeWidget(self._f2_range, self.set_f2, "f2",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._f2_win, 0, 1, 1, 1)
        self._f1_range = Range(-0.5, 0.5, 0.001, -0.1, 200)
        self._f1_win = RangeWidget(self._f1_range, self.set_f1, "f1",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._f1_win, 0, 0, 1, 1)
        self._beta7_real_range = Range(-0.1, 0.1, 0.0001, 0, 200)
        self._beta7_real_win = RangeWidget(self._beta7_real_range,
                                           self.set_beta7_real, "beta7_real",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta7_real_win, 0, 3, 1, 1)
        self._beta7_imag_range = Range(-0.1, 0.1, 0.0001, 0, 200)
        self._beta7_imag_win = RangeWidget(self._beta7_imag_range,
                                           self.set_beta7_imag, "beta7_imag",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta7_imag_win, 1, 3, 1, 1)
        self._beta5_real_range = Range(-0.1, 0.1, 0.0001, 0, 200)
        self._beta5_real_win = RangeWidget(self._beta5_real_range,
                                           self.set_beta5_real, "beta5_real",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta5_real_win, 0, 2, 1, 1)
        self._beta5_imag_range = Range(-1, 1, 0.0001, 0, 200)
        self._beta5_imag_win = RangeWidget(self._beta5_imag_range,
                                           self.set_beta5_imag, "beta5_imag",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta5_imag_win, 1, 2, 1, 1)
        self._beta3_real_range = Range(-0.5, 0.5, 0.001, 0.02, 200)
        self._beta3_real_win = RangeWidget(self._beta3_real_range,
                                           self.set_beta3_real, "beta3_real",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta3_real_win, 0, 1, 1, 1)
        self._beta3_imag_range = Range(-1, 1, 0.001, 0.01, 200)
        self._beta3_imag_win = RangeWidget(self._beta3_imag_range,
                                           self.set_beta3_imag, "beta3_imag",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta3_imag_win, 1, 1, 1, 1)
        self._beta1_real_range = Range(-1, 1, 0.01, 1, 200)
        self._beta1_real_win = RangeWidget(self._beta1_real_range,
                                           self.set_beta1_real, "beta1_real",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta1_real_win, 0, 0, 1, 1)
        self._beta1_imag_range = Range(-1, 1, 0.01, 0, 200)
        self._beta1_imag_win = RangeWidget(self._beta1_imag_range,
                                           self.set_beta1_imag, "beta1_imag",
                                           "counter_slider", float)
        self.tab_grid_layout_1.addWidget(self._beta1_imag_win, 1, 0, 1, 1)
        self._a3_range = Range(0, 2, 0.01, 1, 200)
        self._a3_win = RangeWidget(self._a3_range, self.set_a3, "a3",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._a3_win, 1, 2, 1, 1)
        self._a2_range = Range(0, 2, 0.01, 1, 200)
        self._a2_win = RangeWidget(self._a2_range, self.set_a2, "a2",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._a2_win, 1, 1, 1, 1)
        self._a1_range = Range(0, 2, 0.01, 1, 200)
        self._a1_win = RangeWidget(self._a1_range, self.set_a1, "a1",
                                   "counter_slider", float)
        self.tab_grid_layout_0.addWidget(self._a1_win, 1, 0, 1, 1)

        def _variable_function_probe_0_probe():
            while True:
                val = self.probe_signal.level()
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (38400000 / 10000))

        _variable_function_probe_0_thread = threading.Thread(
            target=_variable_function_probe_0_probe)
        _variable_function_probe_0_thread.daemon = True
        _variable_function_probe_0_thread.start()
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_HAMMING,  #wintype
            0,  #fc
            samp_rate,  #bw
            "IM3+ DPD Spectrum",  #name
            2  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-100, -15)
        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(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.2)
        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 = ["Original", "PostPA", "", "", "", "", "", "", "", ""]
        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(2):
            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, 0, 0, 1,
                                       4)
        self.fir_filter_xxx_1 = filter.fir_filter_ccc(4, (1, ))
        self.fir_filter_xxx_1.declare_sample_delay(0)
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(1, ([
            -0.00074031, -0.00033842, -0.00030921, -0.00018513, 4.4823e-05,
            0.00037567, 0.00078312, 0.0012225, 0.0016318, 0.0019373, 0.0020639,
            0.0019464, 0.0015426, 0.00084479, -0.00011139, -0.0012438,
            -0.0024268, -0.0035019, -0.0042951, -0.0046403, -0.0044043,
            -0.0035124, -0.0019696, 0.00012618, 0.0025822, 0.0051217,
            0.0074091, 0.0090859, 0.0098156, 0.0093326, 0.0074905, 0.0042989,
            -5.3308e-05, -0.0051921, -0.010575, -0.015536, -0.019337,
            -0.021248, -0.020626, -0.016993, -0.010107, -6.0453e-06, 0.012968,
            0.028176, 0.044727, 0.061543, 0.077452, 0.091293, 0.10202, 0.10882,
            0.11114, 0.10882, 0.10202, 0.091293, 0.077452, 0.061543, 0.044727,
            0.028176, 0.012968, -6.0453e-06, -0.010107, -0.016993, -0.020626,
            -0.021248, -0.019337, -0.015536, -0.010575, -0.0051921,
            -5.3308e-05, 0.0042989, 0.0074905, 0.0093326, 0.0098156, 0.0090859,
            0.0074091, 0.0051217, 0.0025822, 0.00012618, -0.0019696,
            -0.0035124, -0.0044043, -0.0046403, -0.0042951, -0.0035019,
            -0.0024268, -0.0012438, -0.00011139, 0.00084479, 0.0015426,
            0.0019464, 0.0020639, 0.0019373, 0.0016318, 0.0012225, 0.00078312,
            0.00037567, 4.4823e-05, -0.00018513, -0.00030921, -0.00033842,
            -0.00074031
        ]))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.channels_channel_model_0_0_0 = channels.channel_model(
            noise_voltage=0.0,
            frequency_offset=f3,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=0,
            block_tags=False)
        self.channels_channel_model_0_0 = channels.channel_model(
            noise_voltage=0.0,
            frequency_offset=f2,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=0,
            block_tags=False)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=0.0,
            frequency_offset=f1,
            epsilon=1.0,
            taps=(1.0, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_4 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_2_1 = blocks.multiply_const_vcc((a2, ))
        self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vcc((a3, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc((a1, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((mu, ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc(
            (ScalingForPA, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            (ScalingForPA, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (ScalingForPA, ))
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_1_0 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC3_real.bin",
            True)
        self.blocks_file_source_0_1 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC2_real.bin",
            True)
        self.blocks_file_source_0_0_1 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC3_imag.bin",
            True)
        self.blocks_file_source_0_0_0 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC1_imag.bin",
            True)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC1_imag.bin",
            True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_float * 1,
            "/home/chance/Documents/Git/GNURadioDPD/InputData/CC1_real.bin",
            True)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, LoopDelay)
        self.blocks_conjugate_cc_2 = blocks.conjugate_cc()
        self.blocks_conjugate_cc_1 = blocks.conjugate_cc()
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_add_xx_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, alpha_imag)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, alpha_real)
        self.Test_W_LMS_0 = Test.W_LMS()
        self.Test_TotalFreqShift_0_0_0_0 = Test.TotalFreqShift(0, systemfs, 1)
        self.Test_TotalFreqShift_0_0_0 = Test.TotalFreqShift(
            9000000 * 2, systemfs, -1)
        self.Test_MeanCorrelation_0 = Test.MeanCorrelation()
        self.Test_ConfigurablePA_0 = Test.ConfigurablePA(
            complex(beta1_real, beta1_imag), complex(beta3_real, beta3_imag),
            complex(beta5_real, beta5_imag), complex(beta7_real, beta7_imag),
            0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Test_ConfigurablePA_0, 0),
                     (self.blocks_multiply_xx_3, 0))
        self.connect((self.Test_ConfigurablePA_0, 0),
                     (self.qtgui_freq_sink_x_0, 1))
        self.connect((self.Test_MeanCorrelation_0, 0),
                     (self.fir_filter_xxx_1, 0))
        self.connect((self.Test_TotalFreqShift_0_0_0, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.Test_TotalFreqShift_0_0_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 1))
        self.connect((self.Test_W_LMS_0, 0), (self.blocks_conjugate_cc_2, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.Test_ConfigurablePA_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_conjugate_cc_1, 0),
                     (self.Test_MeanCorrelation_0, 0))
        self.connect((self.blocks_conjugate_cc_2, 0), (self.probe_signal, 0))
        self.connect((self.blocks_delay_0, 0),
                     (self.Test_MeanCorrelation_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_file_source_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.blocks_file_source_0_0_1, 0),
                     (self.blocks_float_to_complex_0_0_0, 1))
        self.connect((self.blocks_file_source_0_1, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_file_source_0_1_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.channels_channel_model_0_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.channels_channel_model_0_0_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_multiply_xx_4, 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_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.Test_W_LMS_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_const_vxx_2_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0),
                     (self.blocks_multiply_xx_4, 1))
        self.connect((self.blocks_multiply_xx_3, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_3_0, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_4, 0),
                     (self.blocks_multiply_xx_3_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.channels_channel_model_0_0, 0),
                     (self.blocks_multiply_const_vxx_2_1, 0))
        self.connect((self.channels_channel_model_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_2_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.blocks_conjugate_cc_1, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
コード例 #9
0
ファイル: top_block.py プロジェクト: asemwal/real_time_packet
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32e3
        self.freq = freq = 434278100

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_range = Range(1e3, 60e3, 200, 32e3, 200)
        self._samp_rate_win = RangeWidget(self._samp_rate_range,
                                          self.set_samp_rate, "samp_rate",
                                          "counter_slider", float)
        self.top_layout.addWidget(self._samp_rate_win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=4,
            decimation=3,
            taps=None,
            fractional_bw=0.45,
        )
        self.qtgui_tab_widget_0 = Qt.QTabWidget()
        self.qtgui_tab_widget_0_widget_0 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_0 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_0)
        self.qtgui_tab_widget_0_grid_layout_0 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_0.addLayout(
            self.qtgui_tab_widget_0_grid_layout_0)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_0,
                                       "LPDemodulatedSignal")
        self.qtgui_tab_widget_0_widget_1 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_1 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_1)
        self.qtgui_tab_widget_0_grid_layout_1 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_1.addLayout(
            self.qtgui_tab_widget_0_grid_layout_1)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_1,
                                       "FrequencyDomainOfDemodulatedSignal")
        self.qtgui_tab_widget_0_widget_2 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_2 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_2)
        self.qtgui_tab_widget_0_grid_layout_2 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_2.addLayout(
            self.qtgui_tab_widget_0_grid_layout_2)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_2,
                                       "TimeRepresentationOfCarrier")
        self.qtgui_tab_widget_0_widget_3 = Qt.QWidget()
        self.qtgui_tab_widget_0_layout_3 = Qt.QBoxLayout(
            Qt.QBoxLayout.TopToBottom, self.qtgui_tab_widget_0_widget_3)
        self.qtgui_tab_widget_0_grid_layout_3 = Qt.QGridLayout()
        self.qtgui_tab_widget_0_layout_3.addLayout(
            self.qtgui_tab_widget_0_grid_layout_3)
        self.qtgui_tab_widget_0.addTab(self.qtgui_tab_widget_0_widget_3,
                                       "TimeDomainForDemodSignal")
        self.top_layout.addWidget(self.qtgui_tab_widget_0)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1, firdes.low_pass(1, samp_rate, 4000, 1, firdes.WIN_HAMMING,
                               6.76))
        self.blocks_probe_signal_x_0 = blocks.probe_signal_c()
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/asemwal/github/real_time_packet/signal/H.sig", True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            900e6, analog.GR_COS_WAVE, 434278100, 10, 0)
        self.TimeDomainForDemodSignal_0 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.TimeDomainForDemodSignal_0.set_update_time(0.01)
        self.TimeDomainForDemodSignal_0.set_y_axis(-1.2, 1.2)

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

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

        if not True:
            self.TimeDomainForDemodSignal_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.TimeDomainForDemodSignal_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.TimeDomainForDemodSignal_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            else:
                self.TimeDomainForDemodSignal_0.set_line_label(i, labels[i])
            self.TimeDomainForDemodSignal_0.set_line_width(i, widths[i])
            self.TimeDomainForDemodSignal_0.set_line_color(i, colors[i])
            self.TimeDomainForDemodSignal_0.set_line_style(i, styles[i])
            self.TimeDomainForDemodSignal_0.set_line_marker(i, markers[i])
            self.TimeDomainForDemodSignal_0.set_line_alpha(i, alphas[i])

        self._TimeDomainForDemodSignal_0_win = sip.wrapinstance(
            self.TimeDomainForDemodSignal_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._TimeDomainForDemodSignal_0_win)
        self.TimeDomainForDemodSignal = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.TimeDomainForDemodSignal.set_update_time(0.01)
        self.TimeDomainForDemodSignal.set_y_axis(-1.2, 1.2)

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

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

        if not True:
            self.TimeDomainForDemodSignal.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(1):
            if len(labels[i]) == 0:
                self.TimeDomainForDemodSignal.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.TimeDomainForDemodSignal.set_line_label(i, labels[i])
            self.TimeDomainForDemodSignal.set_line_width(i, widths[i])
            self.TimeDomainForDemodSignal.set_line_color(i, colors[i])
            self.TimeDomainForDemodSignal.set_line_style(i, styles[i])
            self.TimeDomainForDemodSignal.set_line_marker(i, markers[i])
            self.TimeDomainForDemodSignal.set_line_alpha(i, alphas[i])

        self._TimeDomainForDemodSignal_win = sip.wrapinstance(
            self.TimeDomainForDemodSignal.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._TimeDomainForDemodSignal_win)
        self.LPDemodulatedSignal_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            1e9,  #bw
            "",  #name
            1  #number of inputs
        )
        self.LPDemodulatedSignal_0.set_update_time(0.10)
        self.LPDemodulatedSignal_0.set_y_axis(-140, 10)
        self.LPDemodulatedSignal_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.LPDemodulatedSignal_0.enable_autoscale(True)
        self.LPDemodulatedSignal_0.enable_grid(True)
        self.LPDemodulatedSignal_0.set_fft_average(1.0)
        self.LPDemodulatedSignal_0.enable_control_panel(True)

        if not True:
            self.LPDemodulatedSignal_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.LPDemodulatedSignal_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.LPDemodulatedSignal_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.LPDemodulatedSignal_0.set_line_label(i, labels[i])
            self.LPDemodulatedSignal_0.set_line_width(i, widths[i])
            self.LPDemodulatedSignal_0.set_line_color(i, colors[i])
            self.LPDemodulatedSignal_0.set_line_alpha(i, alphas[i])

        self._LPDemodulatedSignal_0_win = sip.wrapinstance(
            self.LPDemodulatedSignal_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._LPDemodulatedSignal_0_win)
        self.LPDemodulatedSignal = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            433.92e6,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.LPDemodulatedSignal.set_update_time(0.10)
        self.LPDemodulatedSignal.set_y_axis(-140, 10)
        self.LPDemodulatedSignal.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.LPDemodulatedSignal.enable_autoscale(True)
        self.LPDemodulatedSignal.enable_grid(True)
        self.LPDemodulatedSignal.set_fft_average(1.0)
        self.LPDemodulatedSignal.enable_control_panel(True)

        if not True:
            self.LPDemodulatedSignal.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.LPDemodulatedSignal.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.LPDemodulatedSignal.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.LPDemodulatedSignal.set_line_label(i, labels[i])
            self.LPDemodulatedSignal.set_line_width(i, widths[i])
            self.LPDemodulatedSignal.set_line_color(i, colors[i])
            self.LPDemodulatedSignal.set_line_alpha(i, alphas[i])

        self._LPDemodulatedSignal_win = sip.wrapinstance(
            self.LPDemodulatedSignal.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._LPDemodulatedSignal_win)
        self.FrequencyDomainOfDemodulatedSignal = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            1000e6,  #bw
            "",  #name
            1  #number of inputs
        )
        self.FrequencyDomainOfDemodulatedSignal.set_update_time(0.10)
        self.FrequencyDomainOfDemodulatedSignal.set_y_axis(-140, 10)
        self.FrequencyDomainOfDemodulatedSignal.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.FrequencyDomainOfDemodulatedSignal.enable_autoscale(True)
        self.FrequencyDomainOfDemodulatedSignal.enable_grid(True)
        self.FrequencyDomainOfDemodulatedSignal.set_fft_average(1.0)
        self.FrequencyDomainOfDemodulatedSignal.enable_control_panel(True)

        if not True:
            self.FrequencyDomainOfDemodulatedSignal.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.FrequencyDomainOfDemodulatedSignal.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.FrequencyDomainOfDemodulatedSignal.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.FrequencyDomainOfDemodulatedSignal.set_line_label(
                    i, labels[i])
            self.FrequencyDomainOfDemodulatedSignal.set_line_width(
                i, widths[i])
            self.FrequencyDomainOfDemodulatedSignal.set_line_color(
                i, colors[i])
            self.FrequencyDomainOfDemodulatedSignal.set_line_alpha(
                i, alphas[i])

        self._FrequencyDomainOfDemodulatedSignal_win = sip.wrapinstance(
            self.FrequencyDomainOfDemodulatedSignal.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._FrequencyDomainOfDemodulatedSignal_win)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.LPDemodulatedSignal_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.TimeDomainForDemodSignal_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.FrequencyDomainOfDemodulatedSignal, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_probe_signal_x_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.LPDemodulatedSignal, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.TimeDomainForDemodSignal, 0))
コード例 #10
0
ファイル: UE.py プロジェクト: CorteXlab/demos
    def __init__(self,
                 cfreq=450e6,
                 seed1=108,
                 noise=0,
                 port=65500,
                 porti=6665,
                 portd=6664,
                 udp_address="134.214.146.135",
                 address="addr=192.168.10.2",
                 n2=0.2,
                 n1=1.0,
                 n3=0.15,
                 n4=0.1):
        gr.top_block.__init__(self, "Ue")

        ##################################################
        # Parameters
        ##################################################
        self.cfreq = cfreq
        self.seed1 = seed1
        self.noise = noise
        self.port = port
        self.porti = porti
        self.portd = portd
        self.udp_address = udp_address
        self.address = address
        self.n2 = n2
        self.n1 = n1
        self.n3 = n3
        self.n4 = n4

        ##################################################
        # Variables
        ##################################################
        self.seed2 = seed2 = seed1 + 384
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.occupied_carriers = occupied_carriers = (
            range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) +
            range(8, 21) + range(22, 27), )
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.fft_len = fft_len = 64
        self.sync_word2 = sync_word2 = [
            0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1,
            1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 0, 1, -1, 1, 1, 1, -1,
            1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1,
            -1, 0, 0, 0, 0, 0
        ]
        self.sync_word1 = sync_word1 = [
            0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0.,
            -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            0., 0., 0., 0., 0.
        ]
        self.seed6 = seed6 = seed1 + 4590
        self.seed5 = seed5 = seed2 + 851
        self.seed4 = seed4 = seed1 + 9027
        self.seed3 = seed3 = seed1 + 2791
        self.samp_rate = samp_rate = 500000
        self.payload_equalizer = payload_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, payload_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.packet_length_tag_key = packet_length_tag_key = "packet_len"
        self.packet_len = packet_len = 12
        self.noise_power = noise_power = 1.5e-6
        self.length_tag_key = length_tag_key = "frame_len"
        self.header_equalizer = header_equalizer = digital.ofdm_equalizer_simpledfe(
            fft_len, header_mod.base(), occupied_carriers, pilot_carriers,
            pilot_symbols, 0, 1)
        self.h_3 = h_3 = 0
        self.h_2 = h_2 = 0
        self.h_1 = h_1 = 0
        self.h_0 = h_0 = 1.0

        ##################################################
        # Blocks
        ##################################################
        self.x_3 = blocks.probe_signal_c()
        self.x_2 = blocks.probe_signal_c()
        self.x_1 = blocks.probe_signal_c()
        self.x_0 = blocks.probe_signal_c()
        #self.noise_variance = blocks.probe_signal_f()
        self.noise_variance = 1e-8

        def _noise_power_probe():
            while True:
                val = self.noise_variance.level()
                try:
                    self.set_noise_power(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _noise_power_thread = threading.Thread(target=_noise_power_probe)
        _noise_power_thread.daemon = True
        _noise_power_thread.start()

        def _h_3_probe():
            while True:
                val = self.x_3.level()
                try:
                    self.set_h_3(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (100))

        _h_3_thread = threading.Thread(target=_h_3_probe)
        _h_3_thread.daemon = True
        _h_3_thread.start()

        def _h_2_probe():
            while True:
                val = self.x_2.level()
                try:
                    self.set_h_2(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1000))

        _h_2_thread = threading.Thread(target=_h_2_probe)
        _h_2_thread.daemon = True
        _h_2_thread.start()

        def _h_1_probe():
            while True:
                val = self.x_1.level()
                try:
                    self.set_h_1(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (1000))

        _h_1_thread = threading.Thread(target=_h_1_probe)
        _h_1_thread.daemon = True
        _h_1_thread.start()

        def _h_0_probe():
            while True:
                val = self.x_0.level()
                try:
                    self.set_h_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (100))

        _h_0_thread = threading.Thread(target=_h_0_probe)
        _h_0_thread.daemon = True
        _h_0_thread.start()
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(cfreq, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.taps4 = channels.channel_model(noise_voltage=n4,
                                            frequency_offset=0.0,
                                            epsilon=1.0,
                                            taps=(1.0, ),
                                            noise_seed=seed4,
                                            block_tags=False)
        self.taps3 = channels.channel_model(noise_voltage=n3,
                                            frequency_offset=0.0,
                                            epsilon=1.0,
                                            taps=(1.0, ),
                                            noise_seed=seed2,
                                            block_tags=False)
        self.taps2 = channels.channel_model(noise_voltage=n2,
                                            frequency_offset=0.0,
                                            epsilon=1.0,
                                            taps=(1.0, ),
                                            noise_seed=seed3,
                                            block_tags=False)
        self.taps1 = channels.channel_model(noise_voltage=n1,
                                            frequency_offset=0.0,
                                            epsilon=1.0,
                                            taps=(1.0, ),
                                            noise_seed=seed1,
                                            block_tags=False)
        self.projectGT_IA_vectors_vcvc_0 = projectGT.IA_vectors_vcvc(
            fft_len, noise_power, 1, 1, (20, 25, 35, 40), length_tag_key)
        self.ofdm_rx_IA_phase_1_0 = ofdm_rx_IA_phase_1(
            pilot_symbols=pilot_symbols,
            header_mod=header_mod,
            payload_mod=payload_mod,
            sync_word2=sync_word2,
            sync_word1=sync_word1,
            fft_len=fft_len,
            packet_len=packet_len,
            occupied_carriers=occupied_carriers,
            pilot_carriers=pilot_carriers,
            samp_rate=samp_rate,
        )
        self.fft_web_1 = fft_web(
            fft_size=fft_len,
            power_max=0.003,
            power_min=0,
            port=porti,
            frame_rate=5,
            sample_rate=samp_rate,
            ip_address="srvwww.cortexlab.fr",
        )
        self.fft_web_0 = fft_web(
            fft_size=fft_len,
            power_max=0.003,
            power_min=0,
            port=portd,
            frame_rate=5,
            sample_rate=samp_rate,
            ip_address="srvwww.cortexlab.fr",
        )
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(h_0 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_1 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_2 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2))), h_3 /
                  (math.sqrt(0.0001 + pow(abs(h_0), 2) + pow(abs(h_1), 2) +
                             pow(abs(h_2), 2) + pow(abs(h_3), 2)))),
            noise_seed=0,
            block_tags=False)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                 udp_address, port, 1472, True)
        self.blocks_tag_debug_1 = blocks.tag_debug(gr.sizeof_gr_complex * 1,
                                                   "RX Data", "")
        self.blocks_tag_debug_1.set_display(True)
        self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_char * 1,
                                                   "Payload_intrf", "")
        self.blocks_tag_debug_0.set_display(False)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, fft_len)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, fft_len)
        self.blocks_null_source_0_1 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_0_0_0 = blocks.null_source(
            gr.sizeof_gr_complex * 1)
        self.blocks_null_source_0_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                         1)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_gr_complex *
                                                       1)
        self.blocks_complex_to_mag_squared_0_0 = blocks.complex_to_mag_squared(
            1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.blocks_null_source_0, 0), (self.taps1, 0))
        self.connect((self.blocks_null_source_0_0, 0), (self.taps3, 0))
        self.connect((self.blocks_null_source_0_0_0, 0), (self.taps4, 0))
        self.connect((self.blocks_null_source_0_1, 0), (self.taps2, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_web_1, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.fft_web_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.blocks_complex_to_mag_squared_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.ofdm_rx_IA_phase_1_0, 0))
        self.connect((self.ofdm_rx_IA_phase_1_0, 2),
                     (self.blocks_tag_debug_0, 0))
        self.connect((self.ofdm_rx_IA_phase_1_0, 1),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.ofdm_rx_IA_phase_1_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_tag_debug_1, 0))
        self.connect((self.projectGT_IA_vectors_vcvc_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.taps1, 0), (self.x_0, 0))
        self.connect((self.taps2, 0), (self.x_1, 0))
        self.connect((self.taps3, 0), (self.x_2, 0))
        self.connect((self.taps4, 0), (self.x_3, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.ofdm_rx_IA_phase_1_0, 1),
                     (self.projectGT_IA_vectors_vcvc_0, 0))
        self.connect((self.ofdm_rx_IA_phase_1_0, 0),
                     (self.projectGT_IA_vectors_vcvc_0, 1))