def __init__(self):

        gr.top_block.__init__(self, "Top Block")
        self.vector = blocks.vector_source_f((5, 6, 7), True, 1, [])
        self.packet = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
            samples_per_symbol=2,
            bits_per_symbol=1,
            preamble="",
            access_code="",
            pad_for_usrp=True),
                                             payload_length=256)
        self.mod = digital.gmsk_mod(samples_per_symbol=2,
                                    bt=0.35,
                                    verbose=False,
                                    log=False)
        self.sender = osmosdr.sink(args="numchan" + str(1) + "" + "")

        self.sender.set_sample_rate(1e6)
        self.sender.set_center_freq(100e6)
        self.sender.set_freq_corr(0, 0)
        self.sender.set_gain_mode(False, 0)
        self.sender.set_gain(20, 0)
        self.sender.set_if_gain(30, 0)
        self.sender.set_bb_gain(30, 0)
        self.sender.set_antenna("", 0)
        self.sender.set_bandwidth(0, 0)

        #connection

        self.connect((self.vector, 0), (self.packet, 0))
        self.connect((self.packet, 0), (self.mod, 0))
        self.connect((self.mod, 0), (self.sender, 0))
Beispiel #2
0
    def __init__(self):
        gr.top_block.__init__(self, "Acoust Out")

        ##################################################
        # Variables
        ##################################################
        self.transistion = transistion = 100
        self.sps = sps = 2
        self.sideband_rx = sideband_rx = 1000
        self.sideband = sideband = 1000
        self.samp_rate = samp_rate = 48000
        self.payload = payload = 20
        self.interpolation = interpolation = 200
        self.fd = fd = 0
        self.carrier = carrier = 13000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=interpolation,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.band_pass (0.50,samp_rate,carrier-sideband,carrier+sideband,transistion)), -carrier, samp_rate)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=sps,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=9000,
        	server=True,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=sps,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=payload,
        )
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_real_0, 0), (self.audio_sink_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.blks2_packet_encoder_0, 0))
Beispiel #3
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################

        self.variable_cc_encoder_def_0 = variable_cc_encoder_def_0 = map(
            (lambda a: fec.cc_encoder_make(4096, 7, 2, ([79, 109]), 0, fec.
                                           CC_STREAMING, False)), range(0, 1))

        self.variable_cc_decoder_def_0 = variable_cc_decoder_def_0 = map(
            (lambda a: fec.cc_decoder.make(4096, 7, 2, ([79, 109]), 0, -1, fec.
                                           CC_STREAMING, False)), range(0, 1))
        self.samp_rate = samp_rate = 50000
        self.code1 = code1 = '010110011011101100010101011111101001001110001011010001101010001'

        ##################################################
        # Blocks
        ##################################################
        self.limesdr_sink_0 = limesdr.sink('1D4984C0B2BBE9', 0, '', '')
        self.limesdr_sink_0.set_sample_rate(samp_rate)
        self.limesdr_sink_0.set_center_freq(1.43e9, 0)
        self.limesdr_sink_0.set_bandwidth(5e6, 0)
        self.limesdr_sink_0.set_digital_filter(samp_rate, 0)
        self.limesdr_sink_0.set_gain(60, 0)
        self.limesdr_sink_0.set_antenna(255, 0)

        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, 32000,
                                                 True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, '/home/pi/Desktop/Despar/Shade/spon.jpg',
            False)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=4,
                bits_per_symbol=1,
                preamble='',
                access_code=code1,
                pad_for_usrp=False,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.limesdr_sink_0, 0))
Beispiel #4
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("addr=192.168.10.2", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(2.415e9, 0)
        self.uhd_usrp_sink_0.set_gain(15, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(8.7e6, 0)
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     mod_code="gray",
                                                     verbose=False,
                                                     log=False)

        self.blocks_vector_source_x_0 = blocks.vector_source_b((1, 1, 1, 1),
                                                               True, 1, [])
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((.500, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.Spread_ds_spreader_0 = Spread.ds_spreader(2, (1, 1, 0, 1),
                                                       (1, 1, 1))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_ds_spreader_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.Spread_ds_spreader_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 800000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink = uhd.usrp_sink(
            ",".join(('serial=319B8D3', 'serial=319B8D3')),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink.set_samp_rate(samp_rate)
        self.uhd_usrp_sink.set_time_now(uhd.time_spec(time.time()),
                                        uhd.ALL_MBOARDS)
        self.uhd_usrp_sink.set_center_freq(2400000000, 0)
        self.uhd_usrp_sink.set_gain(70, 0)
        self.uhd_usrp_sink.set_antenna('TX/RX', 0)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/spring2021/Desktop/Gnu radio code/backup2/File_recevie_send/Txt_sent.txt',
            False)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=4,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.uhd_usrp_sink, 0))
Beispiel #6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Transmisor")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100
        self.fcmod = fcmod = 0
        self.fc = fc = 0

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_time_source("gpsdo", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(fc, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=4,
          mod_code="gray",
          differential=True,
          samples_per_symbol=2,
          excess_bw=0.35,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((127, ))
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=0,
        )
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fcmod, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0))
Beispiel #7
0
    def __init__(self, options):
        gr.top_block.__init__(self)

        # Setup USRP
        self.u = uhd.usrp_sink(options.args, uhd.stream_args('fc32'), "packet_len")
        if(options.spec):
            self.u.set_subdev_spec(options.spec, 0)
        if(options.antenna):
            self.u.set_antenna(options.antenna, 0)
        self.u.set_samp_rate(options.rate)
        # Gain is set in the hopper block
        if options.gain is None:
            g = self.u.get_gain_range()
            options.gain = float(g.start()+g.stop())/2.0
        print "-- Setting gain to {} dB".format(options.gain)
        r = self.u.set_center_freq(options.freq)
        if not r:
            print '[ERROR] Failed to set base frequency.'
            raise SystemExit, 1
        hopper_block = FrequencyHopperSrc(
                options.num_bursts, options.num_channels,
                options.freq_delta, options.freq,
                options.samp_per_burst, 1.0, options.hop_time / 1000.,
                options.post_tuning,
                options.gain,
                options.verbose,
        )

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
#        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(1, samp_rate, 1, 0.35, 11*samp_rate))

        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )

        self.blocks_vector_source_x_0 = blocks.vector_source_b((1,1,1,1), True, 1, [])
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((.500, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="11111111",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
    
        self.connect(self.blocks_vector_source_x_0, self.blks2_packet_encoder_0, self.digital_gfsk_mod_0, self.blocks_multiply_const_vxx_0, hopper_block, self.u)
Beispiel #8
0
    def __init__(self, options):
        gr.top_block.__init__(self)

        # Setup USRP
        self.u = uhd.usrp_sink(options.args, uhd.stream_args('fc32'), "packet_len")
        if(options.spec):
            self.u.set_subdev_spec(options.spec, 0)
        if(options.antenna):
            self.u.set_antenna(options.antenna, 0)
        self.u.set_samp_rate(options.rate)
        # Gain is set in the hopper block
        if options.gain is None:
            g = self.u.get_gain_range()
            options.gain = float(g.start()+g.stop())/2.0
        print "-- Setting gain to {} dB".format(options.gain)
        r = self.u.set_center_freq(options.freq)
        if not r:
            print '[ERROR] Failed to set base frequency.'
            raise SystemExit, 1
        hopper_block = FrequencyHopperSrc(
                options.num_bursts, options.num_channels,
                options.freq_delta, options.freq,
                options.samp_per_burst, 1.0, options.hop_time / 1000.,
                options.post_tuning,
                options.gain,
                options.verbose,
        )

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
#        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(1, samp_rate, 1, 0.35, 11*samp_rate))

        self.digital_dxpsk_mod_0 = digital.dqpsk_mod(
        	samples_per_symbol=4,
        	excess_bw=0.35,
        	mod_code="gray",
        	verbose=False,
        	log=False)

        self.blocks_vector_source_x_0 = blocks.vector_source_b((1, 0), True, 1, [])
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.500, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="11111111",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
    
        self.connect(self.blocks_vector_source_x_0, self.blks2_packet_encoder_0, self.digital_dxpsk_mod_0, self.blocks_multiply_const_vxx_0, hopper_block, self.u)
Beispiel #9
0
    def __init__(self, freq, filename, gain):
        gr.top_block.__init__(self, "Radio Transmit")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 200e3
        self.freq = freq
        self.filename = filename
        self.bandwidth = bandwidth = 10e6

        ##################################################
        # Blocks
        ##################################################
        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(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(bandwidth, 0)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       filename, True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
Beispiel #10
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.3", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(32e3)
        self.uhd_usrp_sink_0.set_center_freq(2.417e9, 0)
        self.uhd_usrp_sink_0.set_gain(20, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(3e6, 0)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_crc32_bb_0 = digital.crc32_bb(False, "packet_len")
        self.blocks_vector_source_x_0 = blocks.vector_source_b((1,0,1,0), True, 1, [])
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, 8, "packet_len")
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.Spread_ds_spreader_0 = Spread.ds_spreader(2, (1, 1, 0, 1), (1, 1, 1))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_ds_spreader_0, 0), (self.digital_gfsk_mod_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))    
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_crc32_bb_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_crc32_bb_0, 0), (self.Spread_ds_spreader_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.uhd_usrp_sink_0, 0))    
    def __init__(self, b_freq, gain, dt):
        gr.top_block.__init__(self, "Transmit Busy Tone")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 200000
        self.b_freq = b_freq

        ##################################################
        # Blocks
        ##################################################
        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(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(b_freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_bandwidth(10e6, 0)
        self.digital_dxpsk_mod_1 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     mod_code="gray",
                                                     verbose=False,
                                                     log=False)

        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((10, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SQR_WAVE, 500, 10, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_dxpsk_mod_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_dxpsk_mod_1, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #12
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Gmsk Send")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 200e3

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_char, 1, "tcp://127.0.0.1:5558", 1000, False)
        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(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(102.3e6, 0)
        self.uhd_usrp_sink_0.set_gain(75, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(200e3, 0)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=2,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=19,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.zeromq_sub_source_0, 0), (self.blks2_packet_encoder_0, 0))    

	###
    	t = Thread(target=sub, args=(self.change_freq,))
    	t.start()
Beispiel #13
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(145.6e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(10, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=4,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/david/Projects/telemetrum_sim/teledata.dat", False)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=32,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.osmosdr_sink_0, 0))
	def __init__(self):
		gr.top_block.__init__(self, "Audio Transmitter")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 125000
		self.audio_rate = audio_rate = 8000

		##################################################
		# Blocks
		##################################################
		self.vocoder_cvsd_encode_fb_0 = vocoder.cvsd_encode_fb(2,0.5)
		self.uhd_usrp_sink_0 = uhd.usrp_sink(
			device_addr="",
			stream_args=uhd.stream_args(
				cpu_format="fc32",
				channels=range(1),
			),
		)
		self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
		self.uhd_usrp_sink_0.set_center_freq(915e6, 0)
		self.uhd_usrp_sink_0.set_gain(30, 0)
		self.digital_gmsk_mod_0 = digital.gmsk_mod(
			samples_per_symbol=2,
			bt=0.35,
			verbose=False,
			log=False,
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.audio_source_0 = audio.source(audio_rate, "plughw:0,0", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.vocoder_cvsd_encode_fb_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.audio_source_0, 0), (self.vocoder_cvsd_encode_fb_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
		self.connect((self.digital_gmsk_mod_0, 0), (self.uhd_usrp_sink_0, 0))
Beispiel #15
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Packet Encoder Decoder")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32E3
        self.code2 = code2 = '11011010110111011000110011110101100010010011110111'
        self.code1 = code1 = '010110011011101100010101011111101001001110001011010001101010001'

        ##################################################
        # Blocks
        ##################################################
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/zijianzh/Desktop/acoustic_radio/test_input.txt', False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/home/zijianzh/Desktop/acoustic_radio/debug.dat', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=2,
        		preamble='',
        		access_code='',
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code='',
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.blks2_packet_decoder_0, 0))
Beispiel #16
0
    def __init__(self):
        gr.top_block.__init__(self, "plutotransmitter")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.freq = freq = 2400000000

        ##################################################
        # Blocks
        ##################################################
        self.pluto_sink_0 = iio.pluto_sink('', 2400000000, freq, 500000,
                                           0x8000, False, 10.0, '', True)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
            samples_per_symbol=2,
            sensitivity=1.0,
            bt=.75,
            verbose=False,
            log=False,
        )
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, '/home/esft/datafiles/packet', True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.pluto_sink_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Dig Sic Off Psk")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Dig Sic Off Psk")
        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", "dig_sic_off_psk")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.rx_message = rx_message = "This is a message from the remote radio"
        self.usrp_delay = usrp_delay = 29
        self.throttle = throttle = 50e3
        self.sps = sps = 2
        self.samp_rate = samp_rate = 10e6
        self.rx_pay_len = rx_pay_len = len(rx_message) + len(' (000000000)\n')
        self.rem_strength = rem_strength = 0
        self.rem_signal = rem_signal = -55
        self.file_usrp_out = file_usrp_out = "usrp_out"
        self.file_usrp_in = file_usrp_in = "usrp_in"
        self.constellation = constellation = 4
        self.access_code_tx = access_code_tx = "0011110011100011000001111111"
        self.access_code_rx = access_code_rx = "0011110011100011000001111111"

        ##################################################
        # Blocks
        ##################################################
        self._rem_strength_range = Range(0, 5, 0.02, 0, 200)
        self._rem_strength_win = RangeWidget(self._rem_strength_range,
                                             self.set_rem_strength,
                                             'Remote Signal Power', "counter",
                                             float)
        self.top_layout.addWidget(self._rem_strength_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            900e6,  #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_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(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(True)

        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 = ['RX', 'SIC Out', '', '', '', '', '', '', '', '']
        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.func_print_msg = func_print_msg.print_fd_message(display=1)
        self.func_print_desired_msg = func_print_desired_msg.print_fd_message(
            display=1)
        self.func_desired_msg = func_desired_msg.rx_fd_message(
            message=rx_message)
        self.digital_psk_mod_0_0 = digital.psk.psk_mod(
            constellation_points=4,
            mod_code="gray",
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.digital_psk_demod_0_0 = digital.psk.psk_demod(
            constellation_points=constellation,
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.35,
            phase_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.digital_psk_demod_0 = digital.psk.psk_demod(
            constellation_points=constellation,
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.35,
            phase_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                   throttle, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 throttle, True)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc(
            (10**((rem_signal + 35) * 50e-3) * rem_strength, ))
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, file_usrp_out, False)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, file_usrp_in, True)
        self.blocks_delay_0_0_0_0_0_0 = blocks.delay(gr.sizeof_gr_complex * 1,
                                                     usrp_delay)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_packet_encoder_0_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble='',
                access_code=access_code_tx,
                pad_for_usrp=False,
            ),
            payload_length=rx_pay_len,
        )
        self.blks2_packet_decoder_0_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=access_code_tx,
                threshold=0,
                callback=lambda ok, payload: self.blks2_packet_decoder_0_0.
                recv_pkt(ok, payload),
            ), )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=access_code_tx,
                threshold=0,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.func_print_desired_msg, 0))
        self.connect((self.blks2_packet_decoder_0_0, 0),
                     (self.func_print_msg, 0))
        self.connect((self.blks2_packet_encoder_0_0_0, 0),
                     (self.digital_psk_mod_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.digital_psk_demod_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_delay_0_0_0_0_0_0, 0),
                     (self.digital_psk_demod_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_delay_0_0_0_0_0_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.digital_psk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_psk_demod_0_0, 0),
                     (self.blks2_packet_decoder_0_0, 0))
        self.connect((self.digital_psk_mod_0_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.func_desired_msg, 0),
                     (self.blks2_packet_encoder_0_0_0, 0))
Beispiel #18
0
    def __init__(self,
                 hdr_format=digital.header_format_default(
                     digital.packet_utils.default_access_code, 0)):
        grc_wxgui.top_block_gui.__init__(self, title="QPSK")

        ##################################################
        # Parameters
        ##################################################
        self.hdr_format = hdr_format

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.excess_bw = excess_bw = 0.35
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            1, sps, 1, excess_bw, 45)

        self.qpsk1 = qpsk1 = digital.constellation_qpsk().base()

        self.our_txt = our_txt = 0
        self.code1 = code1 = '010110011011101100010101011111101001001110001011010001101010001'

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_2.win)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0_0.win)
        self.pluto_source_0 = iio.pluto_source('ip:pluto.local',
                                               int(800000000), int(2084000),
                                               int(20000000), 0x8000, True,
                                               True, True, "manual", 15, '',
                                               True)
        self.pluto_sink_2 = iio.pluto_sink('ip:pluto.local', int(800000000),
                                           int(2084000), int(20000000), 0x8000,
                                           False, 0, '', True)
        self._our_txt_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.our_txt,
            callback=self.set_our_txt,
            label='our_txt',
            converter=forms.str_converter(),
        )
        self.Add(self._our_txt_text_box)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3")
        self.Add(self.notebook_0)
        self.low_pass_filter_2 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, 2084000, 1000000, 500000, firdes.WIN_HAMMING,
                            6.76))
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, 0.0682, (rrc_taps), 64, 16, 1.5, sps)
        self.digital_map_bb_0 = digital.map_bb(([0, 1, 2, 3]))
        self.digital_lms_dd_equalizer_cc_0 = digital.lms_dd_equalizer_cc(
            21, 0.050, sps, qpsk1)
        self.digital_diff_decoder_bb_1 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(0.0628, 4, True)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=qpsk1,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=excess_bw,
            verbose=False,
            log=False,
        )
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(
            qpsk1)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/Users/cake/Desktop/Projects/plutoSDR/2byte.txt', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_1 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/Users/cake/Desktop/Projects/plutoSDR/out.txt', False)
        self.blocks_file_sink_1.set_unbuffered(True)
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble='',
                access_code=code1,
                pad_for_usrp=False,
            ),
            payload_length=8,
        )
        self.blks2_packet_decoder_0_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=code1,
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0_0, 0),
                     (self.blocks_file_sink_1, 0))
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.wxgui_scopesink2_2, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blks2_packet_decoder_0_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.digital_map_bb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.pluto_sink_2, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.digital_diff_decoder_bb_1, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_map_bb_0, 0),
                     (self.digital_diff_decoder_bb_1, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_lms_dd_equalizer_cc_0, 0))
        self.connect((self.low_pass_filter_2, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.pluto_source_0, 0), (self.low_pass_filter_2, 0))
Beispiel #19
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 150000
        self.filter_width = filter_width = 5000
        self.carrier = carrier = 40000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=10,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_time_sink_x_0_0_1 = qtgui.time_sink_c(
            2048,  #size
            samp_rate / 10,  #samp_rate
            "Decimated PSK Mod",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_1.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_0_0_1.disable_legend()

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

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

        self._qtgui_time_sink_x_0_0_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_1_win)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            4096,  #size
            samp_rate,  #samp_rate
            "PSK Mod",  #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(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

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

        for i in xrange(2):
            if len(labels[i]) == 0:
                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_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            4096,  #size
            samp_rate,  #samp_rate
            "carrier x psk mod",  #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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

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

        for i in xrange(2):
            if len(labels[i]) == 0:
                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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            8192,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #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(-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(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

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

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(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_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

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

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="gray",
            differential=True,
            samples_per_symbol=2,
            excess_bw=0.1,
            verbose=False,
            log=False,
        )
        self.digital_psk_demod_0 = digital.psk.psk_demod(
            constellation_points=2,
            differential=True,
            samples_per_symbol=2,
            excess_bw=0.1,
            phase_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
            itemsize=gr.sizeof_char * 1,
            addr='127.0.0.1',
            port=1234,
            server=True,
        )
        self.blks2_tcp_sink_0 = grc_blks2.tcp_sink(
            itemsize=gr.sizeof_char * 1,
            addr='127.0.0.1',
            port=9989,
            server=False,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.band_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.band_pass(1, samp_rate, carrier - (filter_width / 2),
                             carrier + (filter_width / 2), 100,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, carrier, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.qtgui_freq_sink_x_0, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blks2_tcp_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blks2_tcp_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.digital_psk_demod_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.digital_psk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_time_sink_x_0_0_1, 0))
Beispiel #20
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Gfsk Hackrf Tx")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.IFgain = IFgain = 30
        self.CenterFreq = CenterFreq = 2.4e9
        self.BBgain = BBgain = 30

        ##################################################
        # Blocks
        ##################################################
        _IFgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._IFgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_IFgain_sizer,
            value=self.IFgain,
            callback=self.set_IFgain,
            label='IFgain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._IFgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_IFgain_sizer,
            value=self.IFgain,
            callback=self.set_IFgain,
            minimum=1,
            maximum=40,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_IFgain_sizer)
        _CenterFreq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CenterFreq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_CenterFreq_sizer,
            value=self.CenterFreq,
            callback=self.set_CenterFreq,
            label='CenterFreq',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._CenterFreq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_CenterFreq_sizer,
            value=self.CenterFreq,
            callback=self.set_CenterFreq,
            minimum=2.35e9,
            maximum=2.6e9,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_CenterFreq_sizer)
        _BBgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._BBgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_BBgain_sizer,
            value=self.BBgain,
            callback=self.set_BBgain,
            label='BBgain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._BBgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_BBgain_sizer,
            value=self.BBgain,
            callback=self.set_BBgain,
            minimum=1,
            maximum=40,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_BBgain_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                           'hackrf')
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(CenterFreq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(0, 0)
        self.osmosdr_sink_0.set_if_gain(IFgain, 0)
        self.osmosdr_sink_0.set_bb_gain(BBgain, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)

        self.digital_gfsk_mod_0 = digital.gfsk_mod(
            samples_per_symbol=2,
            sensitivity=1.0,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/xxno/code/hackrf_GFSK_Transmit_Text/xx.txt', True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=200,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #21
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 8*2**10
		self.nsps_mod = nsps_mod = 4
		self.noise = noise = .1
		self.freq_off = freq_off = 0
		self.ebw_mod = ebw_mod = 0.35

		##################################################
		# Notebooks
		##################################################
		self.n0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab1")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab2")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab3")
		self.Add(self.n0)

		##################################################
		# Controls
		##################################################
		_nsps_mod_sizer = wx.BoxSizer(wx.VERTICAL)
		self._nsps_mod_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_nsps_mod_sizer,
			value=self.nsps_mod,
			callback=self.set_nsps_mod,
			label="Samples per symbol for DPSK modulator",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._nsps_mod_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_nsps_mod_sizer,
			value=self.nsps_mod,
			callback=self.set_nsps_mod,
			minimum=2,
			maximum=32,
			num_steps=31,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_nsps_mod_sizer)
		_noise_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			label="Noise",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_sizer)
		_freq_off_sizer = wx.BoxSizer(wx.VERTICAL)
		self._freq_off_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_freq_off_sizer,
			value=self.freq_off,
			callback=self.set_freq_off,
			label="Freq Offset",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._freq_off_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_freq_off_sizer,
			value=self.freq_off,
			callback=self.set_freq_off,
			minimum=-.5,
			maximum=.5,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_freq_off_sizer)
		_ebw_mod_sizer = wx.BoxSizer(wx.VERTICAL)
		self._ebw_mod_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_ebw_mod_sizer,
			value=self.ebw_mod,
			callback=self.set_ebw_mod,
			label="Excess BW for DPSK modulator",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._ebw_mod_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_ebw_mod_sizer,
			value=self.ebw_mod,
			callback=self.set_ebw_mod,
			minimum=00.01,
			maximum=10.00,
			num_steps=10*100-1,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_ebw_mod_sizer)

		##################################################
		# Blocks
		##################################################
		self.blks2_dxpsk2_mod_0 = blks2.dqpsk2_mod(
			samples_per_symbol=nsps_mod,
			excess_bw=ebw_mod,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
				samples_per_symbol=1,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 1e-2, 1.0, 1.0, 1e3)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=noise,
			frequency_offset=freq_off,
			epsilon=1.0,
			taps=(16.0, ),
			noise_seed=42,
		)
		self.gr_throttle_1_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate*nsps_mod*8)
		self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
		self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
			self.n0.GetPage(1).GetWin(),
			title="Constellation Plot",
			sample_rate=samp_rate*8*nsps_mod/2,
			frame_rate=5,
			const_size=512,
			M=4,
			theta=0,
			alpha=0.005,
			fmax=0.5,
			mu=0.5,
			gain_mu=0.005,
			symbol_rate=samp_rate*8/2,
			omega_limit=0.005,
		)
		self.n0.GetPage(1).Add(self.wxgui_constellationsink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.blks2_packet_encoder_0, 0), (self.blks2_dxpsk2_mod_0, 0))
		self.connect((self.random_source_x_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_throttle_1_0, 0), (self.wxgui_constellationsink2_0, 0))
		self.connect((self.blks2_dxpsk2_mod_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_throttle_1_0, 0))
Beispiel #22
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.samp_rate = samp_rate = 1000000

        ##################################################
        # Blocks
        ##################################################
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 350000, 50000, firdes.WIN_HAMMING, 6.76))
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=2,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((10, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/yq/Desktop/test.txt", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/home/yq/Downloads/testrx.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.digital_gmsk_demod_0, 0))    
    def __init__(self):
        gr.top_block.__init__(self, "Sv Transmitter Gmsk")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Sv Transmitter Gmsk")
        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", "SV_transmitter_GMSK")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 800000
        self.samp_per_sym = samp_per_sym = 2
        self.car_freq = car_freq = 600000
        self.bit_per_sym = bit_per_sym = 1

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0_0 = uhd.usrp_sink(
        	",".join(("", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0_0.set_center_freq(car_freq, 0)
        self.uhd_usrp_sink_0_0.set_gain(0, 0)
        self.qtgui_sink_x_0_0 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"QT GUI Plot", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0_0.set_update_time(1.0/10)
        self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_0_win)
        
        self.qtgui_sink_x_0_0.enable_rf_freq(False)
        
        
          
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=samp_per_sym,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc((0.6, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "./txfifo.ogg", False)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=samp_per_sym,
        		bits_per_symbol=bit_per_sym,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.uhd_usrp_sink_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.qtgui_sink_x_0_0, 0))
Beispiel #24
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.samp_rate = samp_rate = 16000
        self.repeat = repeat = samp_rate/80

        ##################################################
        # Blocks
        ##################################################
        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.blocks_unpacked_to_packed_xx_1 = blocks.unpacked_to_packed_bb(8, gr.GR_MSB_FIRST)
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(8)
        self.blocks_uchar_to_float_0_0_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_short_to_char_0 = blocks.short_to_char(1)
        self.blocks_rms_xx_0_0 = blocks.rms_ff(1)
        self.blocks_rms_xx_0 = blocks.rms_ff(1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, repeat)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(1, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_short*1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_0_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vss((256, ))
        self.blocks_integrate_xx_1 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0_1 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0_0 = blocks.integrate_ff(repeat)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(repeat)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_short*1, "/home/sidekiq/Documents/Documentation_SDR/sdr.in", True)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_char*1, "/home/sidekiq/Documents/Documentation_SDR/text_output", False)
        self.blocks_file_sink_0_0.set_unbuffered(True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_argmax_xx_0 = blocks.argmax_fs(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.blocks_abs_xx_0_2 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_1 = blocks.abs_ff(1)
        self.blocks_abs_xx_0_0 = blocks.abs_ff(1)
        self.blocks_abs_xx_0 = blocks.abs_ff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="11111000",
        		access_code="11111111",
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.audio_sink_1 = audio.sink(16000, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 1330, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 2720, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 2720, 1, 0)
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(100)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_2, 0))    
        self.connect((self.analog_sig_source_x_0_1, 0), (self.blocks_multiply_xx_0_1, 0))    
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_unpacked_to_packed_xx_1, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))    
        self.connect((self.blocks_abs_xx_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_abs_xx_0_0, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_abs_xx_0_1, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_abs_xx_0_2, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_add_const_vxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_rms_xx_0, 0))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.blocks_rms_xx_0_0, 0))    
        self.connect((self.blocks_argmax_xx_0, 0), (self.blocks_null_sink_1, 0))    
        self.connect((self.blocks_argmax_xx_0, 1), (self.blocks_short_to_float_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_1, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_1, 1))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0_2, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_abs_xx_0_2, 0))    
        self.connect((self.blocks_integrate_xx_0_0, 0), (self.blocks_abs_xx_0, 0))    
        self.connect((self.blocks_integrate_xx_0_1, 0), (self.blocks_abs_xx_0_0, 0))    
        self.connect((self.blocks_integrate_xx_1, 0), (self.blocks_abs_xx_0_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_short_to_char_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_integrate_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_integrate_xx_1, 0))    
        self.connect((self.blocks_multiply_xx_0_1, 0), (self.blocks_integrate_xx_0_1, 0))    
        self.connect((self.blocks_multiply_xx_0_2, 0), (self.blocks_integrate_xx_0_0, 0))    
        self.connect((self.blocks_repack_bits_bb_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_uchar_to_float_0_0_0, 0))    
        self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_rms_xx_0, 0), (self.blocks_argmax_xx_0, 1))    
        self.connect((self.blocks_rms_xx_0_0, 0), (self.blocks_argmax_xx_0, 0))    
        self.connect((self.blocks_short_to_char_0, 0), (self.blocks_repack_bits_bb_0, 0))    
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_uchar_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_uchar_to_float_0, 0))    
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_uchar_to_float_0_0_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_repeat_0, 0))    
        self.connect((self.blocks_unpacked_to_packed_xx_1, 0), (self.blocks_file_sink_0_0, 0))    
Beispiel #25
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.tunefreq = tunefreq = 0
		self.samp_rate = samp_rate = 1000000

		##################################################
		# Notebooks
		##################################################
		self.n0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t1")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t2")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t3")
		self.Add(self.n0)

		##################################################
		# Controls
		##################################################
		_tunefreq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tunefreq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tunefreq_sizer,
			value=self.tunefreq,
			callback=self.set_tunefreq,
			label="tunefreq",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._tunefreq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tunefreq_sizer,
			value=self.tunefreq,
			callback=self.set_tunefreq,
			minimum=-100,
			maximum=100,
			num_steps=200,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_tunefreq_sizer)

		##################################################
		# Blocks
		##################################################
		self.blks2_dxpsk_demod_0 = blks2.dbpsk_demod(
			samples_per_symbol=2,
			excess_bw=0.35,
			costas_alpha=0.175,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_dxpsk_mod_0 = blks2.dbpsk_mod(
			samples_per_symbol=4,
			excess_bw=0.35,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
			),
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=False,
			),
			payload_length=0,
		)
		self.gr_char_to_float_1 = gr.char_to_float()
		self.gr_sig_source_x_0 = gr.sig_source_f(samp_rate/2/2, gr.GR_SAW_WAVE, 1000, 127, 0)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_char*1, samp_rate/2)
		self.gr_throttle_0_0 = gr.throttle(gr.sizeof_char*1, samp_rate/2)
		self.gr_throttle_2 = gr.throttle(gr.sizeof_float*1, samp_rate/4/4)
		self.gr_throttle_2_0 = gr.throttle(gr.sizeof_float*1, samp_rate/4/4)
		self.wxgui_constellationsink2_1 = constsink_gl.const_sink_c(
			self.GetWin(),
			title="Constellation Plot",
			sample_rate=samp_rate/2*2*8,
			frame_rate=5,
			const_size=2048,
			M=4,
			theta=0,
			alpha=0.005,
			fmax=0.06,
			mu=0.5,
			gain_mu=0.005,
			symbol_rate=samp_rate/2*2*8/4,
			omega_limit=0.005,
		)
		self.Add(self.wxgui_constellationsink2_1.win)
		self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
			self.n0.GetPage(1).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate/2/2,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.n0.GetPage(1).Add(self.wxgui_scopesink2_1.win)
		self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
			self.n0.GetPage(0).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.n0.GetPage(0).Add(self.wxgui_scopesink2_2.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.blks2_dxpsk_mod_0, 0))
		self.connect((self.blks2_dxpsk_demod_0, 0), (self.gr_throttle_0_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0_0, 0), (self.blks2_packet_decoder_0, 0))
		self.connect((self.blks2_packet_decoder_0, 0), (self.gr_throttle_2, 0))
		self.connect((self.gr_throttle_2, 0), (self.wxgui_scopesink2_1, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_2_0, 0))
		self.connect((self.gr_throttle_2_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.blks2_dxpsk_mod_0, 0), (self.blks2_dxpsk_demod_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_char_to_float_1, 0))
		self.connect((self.gr_char_to_float_1, 0), (self.wxgui_scopesink2_2, 0))
		self.connect((self.blks2_dxpsk_mod_0, 0), (self.wxgui_constellationsink2_1, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_s_sensing")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.variable_funcion = variable_funcion = 2.5e6
        self.show_test_statistics = show_test_statistics = False
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.funcion_prove_showts_edge = funcion_prove_showts_edge = 0
        self.freq_offset = freq_offset = variable_funcion
        self.decimation = decimation = 40
        self.cosenito = cosenito = 20e3
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 2000
        self.ENABLE_TX1_variable_check_box = ENABLE_TX1_variable_check_box = True

        ##################################################
        # Blocks
        ##################################################
        _show_test_statistics_check_box = Qt.QCheckBox("Show Test Statistics (ReL and Rs)")
        self._show_test_statistics_choices = {True: True, False: False}
        self._show_test_statistics_choices_inv = dict((v,k) for k,v in self._show_test_statistics_choices.iteritems())
        self._show_test_statistics_callback = lambda i: Qt.QMetaObject.invokeMethod(_show_test_statistics_check_box, "setChecked", Qt.Q_ARG("bool", self._show_test_statistics_choices_inv[i]))
        self._show_test_statistics_callback(self.show_test_statistics)
        _show_test_statistics_check_box.stateChanged.connect(lambda i: self.set_show_test_statistics(self._show_test_statistics_choices[bool(i)]))
        self.top_layout.addWidget(_show_test_statistics_check_box)
        self.probe = blocks.probe_signal_f()
        def _variable_funcion_probe():
            while True:
                val = self.probe.level()
                try:
                    self.set_variable_funcion(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.01))
        _variable_funcion_thread = threading.Thread(target=_variable_funcion_probe)
        _variable_funcion_thread.daemon = True
        _variable_funcion_thread.start()
        self.spectsensing_ss_edge_plot_0 = spectsensing.ss_edge_plot(show_test_statistics, " " )
        self._spectsensing_ss_edge_plot_0_win = self.spectsensing_ss_edge_plot_0;
        self.top_layout.addWidget(self._spectsensing_ss_edge_plot_0_win) 
        
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1;
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_subband_selector_0 = spectsensing.subband_selector(40, "Selection", 2.5e6 , samp_rate)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(nfft, samp_rate, 1024 )
        self.spectsensing_compute_statistics_0 = spectsensing.compute_statistics(nfft, samp_rate, 0.0065, 1e-9, 1e-9, 40, 54)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	8E3, #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(False)
        self.qtgui_time_sink_x_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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_c(
        	2**15, #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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_0.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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_S_S = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,3)
        self.nutaq_rtdex_source_S_S.set_type(0)
        self.nutaq_rtdex_source_S_S.set_packet_size(1200)
        self.nutaq_rtdex_source_S_S.set_channels("3")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq )
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(3)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(4)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(10)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_default_value(int((2e6)/samp_rate*(2**32)))
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.101")
        def _funcion_prove_showts_edge_probe():
            while True:
                val = self.spectsensing_ss_edge_plot_0.update_variable_show_Ts(self.show_test_statistics)
                try:
                    self.set_funcion_prove_showts_edge(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.1))
        _funcion_prove_showts_edge_thread = threading.Thread(target=_funcion_prove_showts_edge_probe)
        _funcion_prove_showts_edge_thread.daemon = True
        _funcion_prove_showts_edge_thread.start()
        self._freq_offset_range = Range(-1e7, 1e7, 1e4, variable_funcion, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, "freq_offset", "slider")
        self.top_layout.addWidget(self._freq_offset_win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=oversampling,
        	bt=0.71,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=oversampling,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self._cosenito_range = Range(-250e3, 250e3, 1e3, 20e3, 200)
        self._cosenito_win = RangeWidget(self._cosenito_range, self.set_cosenito, "cosenito", "counter_slider")
        self.top_layout.addWidget(self._cosenito_win)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, "192.168.0.122", 1234, 1472, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, 2*4e3 + 0*samp_rate/40/(oversampling*8*2),True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_null_sink_1_3 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_2 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_1_0 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_1 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float*40)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_short*1)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_multiply_const_vxx_0_1_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        _ENABLE_TX1_variable_check_box_check_box = Qt.QCheckBox("Enable Transmission")
        self._ENABLE_TX1_variable_check_box_choices = {True: True, False: False}
        self._ENABLE_TX1_variable_check_box_choices_inv = dict((v,k) for k,v in self._ENABLE_TX1_variable_check_box_choices.iteritems())
        self._ENABLE_TX1_variable_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(_ENABLE_TX1_variable_check_box_check_box, "setChecked", Qt.Q_ARG("bool", self._ENABLE_TX1_variable_check_box_choices_inv[i]))
        self._ENABLE_TX1_variable_check_box_callback(self.ENABLE_TX1_variable_check_box)
        _ENABLE_TX1_variable_check_box_check_box.stateChanged.connect(lambda i: self.set_ENABLE_TX1_variable_check_box(self._ENABLE_TX1_variable_check_box_choices[bool(i)]))
        self.top_layout.addWidget(_ENABLE_TX1_variable_check_box_check_box)
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0 = DataConversion.reint_short_float()
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(1024)
        self.DataConversion_eaver_resynchronizer_0 = DataConversion.eaver_resynchronizer(decimation)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.spectsensing_compute_statistics_0, 'spec_sens_pdus'), (self.spectsensing_ss_edge_plot_0, 'pdus'))    
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'), (self.spectsensing_xs_plot_1, 'pdus'))    
        self.connect((self.DataConversion_eaver_resynchronizer_0, 0), (self.spectsensing_compute_statistics_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0, 1), (self.spectsensing_compute_statistics_0, 1))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0), (self.spectsensing_ss_pds_plot_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1), (self.spectsensing_ss_pds_plot_0, 1))    
        self.connect((self.DataConversion_reint_short_float_0, 0), (self.DataConversion_eaver_resynchronizer_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0), (self.blocks_multiply_const_vxx_0_3, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1, 0), (self.blocks_multiply_const_vxx_0_1_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0), (self.blocks_multiply_const_vxx_0_1_0_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2, 0), (self.blocks_multiply_const_vxx_0_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0), (self.blocks_multiply_const_vxx_0_1_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_3, 0), (self.DataConversion_eaver_resynchronizer_0_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_udp_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.DataConversion_eaver_resynchronizer_0, 1))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.DataConversion_eaver_resynchronizer_0_0, 1))    
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 0), (self.DataConversion_reint_short_float_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 1), (self.DataConversion_reint_short_float_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0, 3), (self.DataConversion_reint_short_float_0_1, 0))    
        self.connect((self.blocks_deinterleave_0_0, 2), (self.DataConversion_reint_short_float_0_2, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 1), (self.blocks_short_to_float_0_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 0), (self.blocks_short_to_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 1), (self.DataConversion_reint_short_float_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 3), (self.DataConversion_reint_short_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 2), (self.DataConversion_reint_short_float_0_2_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 0), (self.DataConversion_reint_short_float_0_3, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_1, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0, 0), (self.blocks_add_xx_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0), (self.blocks_add_xx_0_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_short_to_float_0_0_0_0, 0), (self.blocks_float_to_complex_0_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_1_0, 0), (self.blocks_float_to_complex_0_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_2, 0))    
        self.connect((self.nutaq_rtdex_source_0_0_0, 0), (self.blocks_deinterleave_0_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S, 0), (self.blocks_deinterleave_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S_0, 0), (self.blocks_deinterleave_0_0_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 0), (self.blocks_null_sink_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 5), (self.blocks_null_sink_1_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 2), (self.blocks_null_sink_1_1, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 3), (self.blocks_null_sink_1_1_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 4), (self.blocks_null_sink_1_2, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 6), (self.blocks_null_sink_1_3, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 3), (self.spectsensing_subband_selector_0, 2))    
        self.connect((self.spectsensing_compute_statistics_0, 7), (self.spectsensing_subband_selector_0, 0))    
        self.connect((self.spectsensing_compute_statistics_0, 1), (self.spectsensing_subband_selector_0, 1))    
        self.connect((self.spectsensing_subband_selector_0, 0), (self.probe, 0))    
Beispiel #27
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Occam Generated")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.stdValG = stdValG = 0.40
		self.seedValG = seedValG = 0L
		self.samplingRate2 = samplingRate2 = 640000
		self.samplingRate = samplingRate = 320000
		self.rfGain2 = rfGain2 = 25.0
		self.rfGain = rfGain = 1.0
		self.recvThresh = recvThresh = 0.3
		self.rcFiltCoeff = rcFiltCoeff = 1.0
		self.meanValG = meanValG = 0.0
		self.gaussGain = gaussGain = 0.3
		self.excessBw = excessBw = 0.35
		self.dataName = dataName = 1.0
		self.dataGain = dataGain = 10.0
		self.carrierFreq = carrierFreq = 462562500.0
		self.bbGain2 = bbGain2 = 1.0
		self.bbGain = bbGain = 1.3

		##################################################
		# Blocks
		##################################################
		self.throttle = gr.throttle(gr.sizeof_float*1, samplingRate)
		self.gaussScale = blocks.multiply_const_vcc((gaussGain, ))
		self.gauss = analog.noise_source_c(analog.GR_GAUSSIAN, 0.3, 0)
		self.dbpskMod = digital.dbpsk_mod(
			samples_per_symbol=samplingRate2/samplingRate,
			excess_bw=0.35,
			gray_coded=True,
			verbose=False,
			log=False)
			
		self.dbpskEnc = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=samplingRate2/samplingRate,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.dbpskDemod = digital.dbpsk_demod(
			samples_per_symbol=samplingRate2/samplingRate,
			excess_bw=0.35,
			freq_bw=6.28/100.0,
			phase_bw=6.28/100.0,
			timing_bw=6.28/100.0,
			gray_coded=True,
			verbose=False,
			log=False
		)
		self.dbpskDec = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.dbpskDec.recv_pkt(ok, payload),
			),
		)
		self.dataSrc = gr.file_source(gr.sizeof_float*1, "music-tx1.0.dat", False)
		self.dataOut = gr.file_sink(gr.sizeof_float*1, "music-rx1.0.dat")
		self.dataOut.set_unbuffered(False)
		self.channelFilter2 = blocks.multiply_const_vcc((1.0, ))
		self.channelFilter = blocks.multiply_const_vcc((1.0, ))
		self.basebandScale2 = blocks.multiply_const_vcc((bbGain2, ))
		self.basebandScale = blocks.multiply_const_vcc((bbGain, ))
		self.add = blocks.add_vcc(1)

		##################################################
		# Connections
		##################################################
		self.connect((self.dataSrc, 0), (self.throttle, 0))
		self.connect((self.throttle, 0), (self.dbpskEnc, 0))
		self.connect((self.dbpskMod, 0), (self.channelFilter, 0))
		self.connect((self.dbpskDemod, 0), (self.dbpskDec, 0))
		self.connect((self.basebandScale, 0), (self.add, 0))
		self.connect((self.gauss, 0), (self.gaussScale, 0))
		self.connect((self.basebandScale2, 0), (self.channelFilter2, 0))
		self.connect((self.add, 0), (self.basebandScale2, 0))
		self.connect((self.dbpskDec, 0), (self.dataOut, 0))
		self.connect((self.dbpskEnc, 0), (self.dbpskMod, 0))
		self.connect((self.gaussScale, 0), (self.add, 1))
		self.connect((self.channelFilter, 0), (self.basebandScale, 0))
		self.connect((self.channelFilter2, 0), (self.dbpskDemod, 0))
Beispiel #28
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")

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

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 45
        self.nfilts = nfilts = 25
        self.samp_rate = samp_rate = 44.1E3
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), 0.35, 45*nfilts)
        self.fc_slider = fc_slider = 2200

        self.BPSK = BPSK = digital.constellation_calcdist(([-1, 1]), ([0, 1]), 4, 1).base()


        ##################################################
        # Blocks
        ##################################################
        self._fc_slider_range = Range(0, 18200, 200, 2200, 150)
        self._fc_slider_win = RangeWidget(self._fc_slider_range, self.set_fc_slider, 'fc', "counter_slider", float)
        self.top_layout.addWidget(self._fc_slider_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
        	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_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(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.digital_constellation_modulator_0 = digital.generic_mod(
          constellation=BPSK,
          differential=True,
          samples_per_symbol=sps,
          pre_diff_code=True,
          excess_bw=0.25,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr='127.0.0.1',
        	port=1235,
        	server=True,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble='',
        		access_code='',
        		pad_for_usrp=False,
        	),
        	payload_length=1,
        )
        self.audio_sink_0 = audio.sink(44100, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fc_slider, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_char_to_float_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_constellation_modulator_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_complex_to_real_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_1, 0))
        self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_multiply_xx_0, 0))
Beispiel #29
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.samp_rate = samp_rate = 32000
        self.noise_level = noise_level = 0

        ##################################################
        # Blocks
        ##################################################
        self._noise_level_layout = Qt.QVBoxLayout()
        self._noise_level_tool_bar = Qt.QToolBar(self)
        self._noise_level_layout.addWidget(self._noise_level_tool_bar)
        self._noise_level_tool_bar.addWidget(Qt.QLabel("noise_level"+": "))
        self._noise_level_counter = Qwt.QwtCounter()
        self._noise_level_counter.setRange(0, 2, 0.01)
        self._noise_level_counter.setNumButtons(2)
        self._noise_level_counter.setValue(self.noise_level)
        self._noise_level_tool_bar.addWidget(self._noise_level_counter)
        self._noise_level_counter.valueChanged.connect(self.set_noise_level)
        self._noise_level_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._noise_level_slider.setRange(0, 2, 0.01)
        self._noise_level_slider.setValue(self.noise_level)
        self._noise_level_slider.setMinimumWidth(200)
        self._noise_level_slider.valueChanged.connect(self.set_noise_level)
        self._noise_level_layout.addWidget(self._noise_level_slider)
        self.top_layout.addLayout(self._noise_level_layout)
        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.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_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_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=4,
          mod_code="gray",
          differential=False,
          samples_per_symbol=4,
          excess_bw=0.35,
          verbose=False,
          log=False,
          )
        self.digital_psk_demod_0 = digital.psk.psk_demod(
          constellation_points=4,
          differential=False,
          samples_per_symbol=4,
          excess_bw=0.35,
          phase_bw=6.28/100.0,
          timing_bw=6.28/100.0,
          mod_code="gray",
          verbose=False,
          log=False,
          )
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
        		samples_per_symbol=4,
        		bits_per_symbol=2,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
        self.Gausssion = analog.noise_source_c(analog.GR_GAUSSIAN, noise_level, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Gausssion, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.digital_psk_demod_0, 0))
        self.connect((self.digital_psk_demod_0, 0), (self.blks2_packet_decoder_1, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.qtgui_const_sink_x_0, 0))
Beispiel #30
0
    def __init__(self):
        gr.top_block.__init__(self, "Audio Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Audio 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", "audio_tx")

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

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 1
        self.nfilts = nfilts = 25
        self.samp_rate = samp_rate = 32E3
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts)
        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.phase_bw = phase_bw = 6.28 / 100.0
        self.excess_bw = excess_bw = 0.35

        self.BPSK = BPSK = digital.constellation_qpsk().base()

        ##################################################
        # Blocks
        ##################################################
        self._phase_bw_range = Range(0.0, 1.0, 0.01, 6.28 / 100.0, 200)
        self._phase_bw_win = RangeWidget(self._phase_bw_range,
                                         self.set_phase_bw, 'Phase: Bandwidth',
                                         "slider", float)
        self.top_layout.addWidget(self._phase_bw_win)
        self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1_1.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_1_1.disable_legend()

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

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

        self._qtgui_time_sink_x_1_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_1_win)
        self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_0.set_y_axis(-1, 1)

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

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

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

        self._qtgui_time_sink_x_1_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_0_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

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

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

        if not True:
            self.qtgui_time_sink_x_1.disable_legend()

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

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

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        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_const_sink_x_0_0 = qtgui.const_sink_c(
            1024,  #size
            "demod",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                     qtgui.TRIG_SLOPE_POS, 0.0,
                                                     0, "")
        self.qtgui_const_sink_x_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0.enable_grid(True)
        self.qtgui_const_sink_x_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0.disable_legend()

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

        self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_const_sink_x_0_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "Rx",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(True)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

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

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 0, 1, 1,
                                       1)
        [self.top_grid_layout.setRowStretch(r, 1) for r in range(0, 1)]
        [self.top_grid_layout.setColumnStretch(c, 1) for c in range(1, 2)]
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 1.6E3, .6E3, firdes.WIN_HAMMING,
                            6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, .063, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_lms_dd_equalizer_cc_0 = digital.lms_dd_equalizer_cc(
            8, .01, 1, BPSK)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            phase_bw, 4, False)
        self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb(
            BPSK, phase_bw, 0, 2 * 3.14)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=BPSK,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=2,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_xx_3_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/peter/Desktop/acoustic_radio/test_input.txt', True)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, '/home/peter/Desktop/output.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_imag_1 = blocks.complex_to_imag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_3 = blocks.add_vff(1)
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=sps,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.analog_sig_source_x_0_1_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_1_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 4E3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 4E3, 1, 0)
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(
            1024, 1.55)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, -1)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, -1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 1))
        self.connect((self.analog_feedforward_agc_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_3_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_3, 0))
        self.connect((self.analog_sig_source_x_0_1, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.analog_sig_source_x_0_1_0, 0),
                     (self.blocks_multiply_xx_2_0, 1))
        self.connect((self.analog_sig_source_x_0_1_0_0, 0),
                     (self.blocks_multiply_xx_2_0_0, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_xx_2_1, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_add_xx_3, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_complex_to_imag_1, 0),
                     (self.blocks_add_xx_3, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_multiply_xx_2_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_multiply_xx_2_0_0, 0),
                     (self.blocks_complex_to_imag_1, 0))
        self.connect((self.blocks_multiply_xx_2_1, 0),
                     (self.blocks_add_xx_3, 0))
        self.connect((self.blocks_multiply_xx_3, 0),
                     (self.blocks_multiply_xx_2_1, 1))
        self.connect((self.blocks_multiply_xx_3_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 4),
                     (self.qtgui_const_sink_x_0_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 3),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 1),
                     (self.qtgui_time_sink_x_1_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 2),
                     (self.qtgui_time_sink_x_1_1, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_lms_dd_equalizer_cc_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.digital_constellation_receiver_cb_0, 0))
        self.connect((self.digital_lms_dd_equalizer_cc_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_multiply_xx_2_0, 0))
        self.connect((self.hilbert_fc_0, 0),
                     (self.blocks_multiply_xx_2_0_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_feedforward_agc_cc_0, 0))
Beispiel #31
0
    def __init__(self):
        gr.top_block.__init__(self, "Gen Data Psk")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Gen Data Psk")
        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", "gen_data_psk")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.tx_message = tx_message = "This is a message from the FD radio"
        self.tx_pay_len = tx_pay_len = len(tx_message) + len(' (000000000)\n')
        self.tx_access_code = tx_access_code = "0011110011100011000001111111"
        self.sps = sps = 2
        self.signal_scope = signal_scope = 200
        self.samp_rate = samp_rate = 10e6
        self.file_usrp_in = file_usrp_in = "usrp_in"
        self.constellation = constellation = 4
        self.bits_scope = bits_scope = 200

        ##################################################
        # 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, 'Bits')
        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, 'Signals Time')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Signals Freq')
        self.top_layout.addWidget(self.tab)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            signal_scope,  #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)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(True)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

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

        for i in xrange(2):
            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.tab_layout_1.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            bits_scope,  #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_TAG,
                                                  qtgui.TRIG_SLOPE_POS, 0.0,
                                                  0.2 * bits_scope / samp_rate,
                                                  0, 'usrp_input')
        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(True)

        if not True:
            self.qtgui_time_sink_x_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(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.tab_layout_0.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_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(True)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_freq_sink_x_0_win)
        self.func_self_msg = func_self_msg.tx_fd_message(message=tx_message)
        self.func_print_msg = func_print_msg.print_fd_message(display=1)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=constellation,
            mod_code="gray",
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.digital_psk_demod_0_0 = digital.psk.psk_demod(
            constellation_points=constellation,
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.35,
            phase_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.digital_correlate_access_code_tag_bb_0_0_0 = digital.correlate_access_code_tag_bb(
            tx_access_code, 0, 'usrp_input')
        self.blocks_throttle_0_0_0_0_0 = blocks.throttle(
            gr.sizeof_char * 1, samp_rate, True)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.3, ))
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   file_usrp_in, False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble='',
                access_code=tx_access_code,
                pad_for_usrp=False,
            ),
            payload_length=tx_pay_len,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=tx_access_code,
                threshold=0,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.func_print_msg, 0))
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.digital_psk_demod_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_throttle_0_0_0_0_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.digital_correlate_access_code_tag_bb_0_0_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_psk_demod_0_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_psk_demod_0_0, 0),
                     (self.digital_correlate_access_code_tag_bb_0_0_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.func_self_msg, 0),
                     (self.blocks_throttle_0_0_0_0_0, 0))
Beispiel #32
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Vid")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_slider_1 = variable_slider_1 = 500
        self.variable_slider_0 = variable_slider_0 = 0
        self.snr = snr = 0
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        _variable_slider_1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_variable_slider_1_sizer,
            value=self.variable_slider_1,
            callback=self.set_variable_slider_1,
            label="signal",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._variable_slider_1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_variable_slider_1_sizer,
            value=self.variable_slider_1,
            callback=self.set_variable_slider_1,
            minimum=0,
            maximum=1000,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_1_sizer)
        _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_0_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_variable_slider_0_sizer,
            value=self.variable_slider_0,
            callback=self.set_variable_slider_0,
            label="noise",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._variable_slider_0_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_variable_slider_0_sizer,
            value=self.variable_slider_0,
            callback=self.set_variable_slider_0,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_0_sizer)

        def _snr_probe():
            while True:
                val = self.my_block_0.get_number()
                try:
                    self.set_snr(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _snr_thread = threading.Thread(target=_snr_probe)
        _snr_thread.daemon = True
        _snr_thread.start()

        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_probe_signal_x_0 = blocks.probe_signal_f()
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((500, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       "video1.ts", False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   "video2.ts", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_c(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 2500)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_nlog10_ff_0, 0))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_nlog10_ff_0, 0),
                     (self.blocks_probe_signal_x_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #33
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.sps = sps = 8
		self.samp_rate = samp_rate = 10000
		self.freq_error = freq_error = 0
		self.freq = freq = 500
		self.fm_sensitivity = fm_sensitivity = 1.0

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="GFSK Demod Spectrum",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=1./freq,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0_0.win)
		self.quadrature_demod_0 = quadrature_demod()
		self.ieee_802_15_4_gfsk_mod_0 = ieee_802_15_1_gfsk_mod.gfsk_mod(
				samples_per_symbol=8,
				sensitivity=1.0,
				bt=0.35,
				verbose=False,
				log=False,
				)
			
		self.gr_vector_source_x_0 = gr.vector_source_f((0, 0, 0, 0, 1, 1, 1), True, 1)
		self.gr_throttle_0_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps*(1+freq_error), 0.25*0.175, 0.5, 0.175, 0.005)
		self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.blks2_packet_decoder_0_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.blks2_packet_decoder_0_0.recv_pkt(ok, payload),
			),
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.ieee_802_15_4_gfsk_mod_0, 0))
		self.connect((self.ieee_802_15_4_gfsk_mod_0, 0), (self.quadrature_demod_0, 0))
		self.connect((self.quadrature_demod_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
		self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
		self.connect((self.digital_binary_slicer_fb_0, 0), (self.blks2_packet_decoder_0_0, 0))
		self.connect((self.blks2_packet_decoder_0_0, 0), (self.wxgui_scopesink2_0_0, 0))
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_throttle_0_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Packet Encoder Decoder By Aaron")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_gain = tx_gain = 0
        self.samp_rate_0 = samp_rate_0 = 1000000
        self.samp_rate = samp_rate = 32E3
        self.rx_gain = rx_gain = 0
        self.rfgain = rfgain = 0
        self.code2 = code2 = '11011010110111011000110011110101100010010011110111'
        self.code1 = code1 = '010110011011101100010101011111101001001110001011010001101010001'
        self.center_freq = center_freq = 1250000
        self.band_w = band_w = 75000

        ##################################################
        # Blocks
        ##################################################
        self.serial_port_0 = grpyserial.serial_port('/dev/ttyUSB0',0,9600,0,1,False)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rfgain_sizer,
        	value=self.rfgain,
        	callback=self.set_rfgain,
        	label='rfgain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rfgain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rfgain_sizer,
        	value=self.rfgain,
        	callback=self.set_rfgain,
        	minimum=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/home/vmatusic/Documents/VLC/gnuradio_codes/CSNDSP/received_data_Aaron.txt', False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble='',
        		access_code=code1,
        		pad_for_usrp=False,
        	),
        	payload_length=4,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code=code1,
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.analog_const_source_x_0 = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.serial_port_0, 0))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))    
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_diff_encoder_bb_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_packet_encoder_0_0, 0))    
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.digital_diff_encoder_bb_0, 0), (self.digital_diff_decoder_bb_0, 0))    
        self.connect((self.serial_port_0, 0), (self.blocks_throttle_0, 0))    
Beispiel #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.noise_volt = noise_volt = 10e-3
        self.mult_const = mult_const = 1
        self.cutoff = cutoff = 10.7e3

        ##################################################
        # Blocks
        ##################################################
        _noise_volt_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_volt_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_noise_volt_sizer,
        	value=self.noise_volt,
        	callback=self.set_noise_volt,
        	label="Noise Voltage",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._noise_volt_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_noise_volt_sizer,
        	value=self.noise_volt,
        	callback=self.set_noise_volt,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_noise_volt_sizer)
        _mult_const_sizer = wx.BoxSizer(wx.VERTICAL)
        self._mult_const_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_mult_const_sizer,
        	value=self.mult_const,
        	callback=self.set_mult_const,
        	label="Amplifier",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._mult_const_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_mult_const_sizer,
        	value=self.mult_const,
        	callback=self.set_mult_const,
        	minimum=0,
        	maximum=2,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_mult_const_sizer)
        _cutoff_sizer = wx.BoxSizer(wx.VERTICAL)
        self._cutoff_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_cutoff_sizer,
        	value=self.cutoff,
        	callback=self.set_cutoff,
        	label="Cutoff Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._cutoff_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_cutoff_sizer,
        	value=self.cutoff,
        	callback=self.set_cutoff,
        	minimum=5e3,
        	maximum=16e3,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_cutoff_sizer)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Tx",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Rx",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, cutoff, 100, firdes.WIN_HAMMING, 6.76))
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise_volt,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=42,
        	block_tags=False
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((mult_const, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, 10000, 1, 0)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 256, 512)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_throttle_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_withFPGAdecimation")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600

        ##################################################
        # Blocks
        ##################################################
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1;
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(nfft, samp_rate, 1024 )
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",gr.sizeof_short,1,7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_tx_0 = nutaq.radio420_tx("nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_tx_0.set_default_calibrate(1)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-4)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(14)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(1)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_1_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_1_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_1 = nutaq.custom_register("nutaq_carrier_perseus_TX",36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_update_rate(1)
          
        self.nutaq_custom_register_0_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_TX",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_TX = nutaq.carrier(0,"nutaq_carrier_perseus_TX", "192.168.0.101")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=oversampling,
        	bt=0.71,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=oversampling,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, "192.168.0.100", 1234, 1472, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, 2*4e3 + 0*samp_rate/40/(oversampling*8*2),True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff((2.0**(16*2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc((amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff((2.0**(16*0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff((2.0**(16*1), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(gr.sizeof_short*1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float()
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float()
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(1024)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'), (self.spectsensing_xs_plot_1, 'pdus'))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0), (self.spectsensing_ss_pds_plot_0, 0))    
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1), (self.spectsensing_ss_pds_plot_0, 1))    
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0), (self.blocks_multiply_const_vxx_0_3, 0))    
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0), (self.blocks_multiply_const_vxx_0_1_0_0, 0))    
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0), (self.blocks_multiply_const_vxx_0_1_1, 0))    
        self.connect((self.DataConversion_reint_short_float_0_3, 0), (self.DataConversion_eaver_resynchronizer_0_0, 0))    
        self.connect((self.blks2_packet_decoder_1, 0), (self.blocks_udp_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))    
        self.connect((self.blocks_add_xx_0_0, 0), (self.DataConversion_eaver_resynchronizer_0_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 1), (self.blocks_short_to_float_0_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_0, 0), (self.blocks_short_to_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 1), (self.DataConversion_reint_short_float_0_0_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 3), (self.DataConversion_reint_short_float_0_1_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 2), (self.DataConversion_reint_short_float_0_2_0, 0))    
        self.connect((self.blocks_deinterleave_0_0_1, 0), (self.DataConversion_reint_short_float_0_3, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_float_to_complex_0_0_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0), (self.blocks_add_xx_0_0, 2))    
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0), (self.blocks_add_xx_0_0, 1))    
        self.connect((self.blocks_multiply_const_vxx_0_2, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0_3, 0), (self.blocks_add_xx_0_0, 0))    
        self.connect((self.blocks_short_to_float_0_0_0_0, 0), (self.blocks_float_to_complex_0_0_0, 1))    
        self.connect((self.blocks_short_to_float_0_1_0, 0), (self.blocks_float_to_complex_0_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))    
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_multiply_const_vxx_0_2, 0))    
        self.connect((self.nutaq_rtdex_source_0_0_0, 0), (self.blocks_deinterleave_0_0_0, 0))    
        self.connect((self.nutaq_rtdex_source_S_S_0, 0), (self.blocks_deinterleave_0_0_1, 0))    
Beispiel #37
0
Datei: tx.py Projekt: jm-/voiz
    def __init__(   self,
                    carrier,
                    sideband,
                    transition,
                    sps,
                    interpolation,
                    looutdev):

        gr.top_block.__init__(self, "Transmit block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = SAMPLE_RATE

        self.carrier = carrier
        self.sideband = sideband
        self.transition = transition
        self.sps = sps
        self.interpolation = interpolation

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=interpolation,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.band_pass (0.50,SAMPLE_RATE,carrier-sideband,carrier+sideband,transition)), -carrier, SAMPLE_RATE)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
            samples_per_symbol=sps,
            sensitivity=1.0,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
                samples_per_symbol=sps,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=False,
            ),
            payload_length=PAYLOAD_LEN,
        )
        self.audio_sink_0 = audio.sink(SAMPLE_RATE, looutdev, True)

        self.source_queue = gr.msg_queue()
        self.msg_source = blocks.message_source(gr.sizeof_char, self.source_queue)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.msg_source, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.audio_sink_0, 0))
Beispiel #38
0
    def __init__(self):
        gr.hier_block2.__init__(
            self, "Hier Tx Ch Rx",
            gr.io_signature(1, 1, gr.sizeof_char*1),
            gr.io_signature(1, 1, gr.sizeof_char*1),
        )

        ##################################################
        # Variables
        ##################################################
        self.samp_per_sym = samp_per_sym = 3
        self.n_filts = n_filts = 32
        self.len_sym_srrc = len_sym_srrc = 7
        self.alfa = alfa = 0.35
        self.pulso = pulso = firdes.root_raised_cosine(samp_per_sym,samp_per_sym,1.0,alfa,samp_per_sym*len_sym_srrc)
        self.gain = gain = 15
        self.frec = frec = 850e3
        self.filtro_srrc = filtro_srrc = firdes.root_raised_cosine(n_filts,samp_per_sym*n_filts,1.0,alfa,samp_per_sym*len_sym_srrc*n_filts)
        self.bits_per_sym = bits_per_sym = 2

        ##################################################
        # Blocks
        ##################################################
        self.pfb_interpolator_ccf_0 = pfb.interpolator_ccf(
        	  samp_per_sym,
        	  (pulso),
        	  100)
        	
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(samp_per_sym, 2*math.pi/100, (filtro_srrc), n_filts, 16, 5, 1)
        self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(samp_per_sym, alfa, len_sym_srrc*samp_per_sym, math.pi/1600)
        self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2**bits_per_sym)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2**bits_per_sym)
        self.digital_costas_loop_cc_0_0_0 = digital.costas_loop_cc(2*math.pi/100, 2**bits_per_sym)
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb( digital.constellation_calcdist([-1-1j, 1-1j, 1+1j, -1+1j], [], 4, 1).base())
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc(([-1-1j,1-1j, 1+1j, -1+1j]), 1)
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.0,
        	frequency_offset=0.0,
        	epsilon=1.00,
        	taps=(1+0.5j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(bits_per_sym)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(bits_per_sym, gr.GR_MSB_FIRST)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0.4, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=samp_per_sym,
        		bits_per_symbol=bits_per_sym,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=1,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.pfb_interpolator_ccf_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.digital_diff_encoder_bb_0, 0), (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0), (self.pfb_interpolator_ccf_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.channels_channel_model_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_diff_encoder_bb_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blks2_packet_decoder_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0), (self, 0))
        self.connect((self, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_costas_loop_cc_0_0_0, 0), (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.analog_agc2_xx_0, 0), (self.digital_fll_band_edge_cc_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_costas_loop_cc_0_0_0, 0))
Beispiel #39
0
    def __init__(self):
        gr.top_block.__init__(self, "Example1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example1")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

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

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

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

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

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

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

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

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

        if not True:
            self.qtgui_freq_sink_x_0_0_0_1.disable_legend()

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

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

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

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0.disable_legend()

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

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

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

        if not True:
            self.qtgui_freq_sink_x_0_0_0.disable_legend()

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

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

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

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.mysvl_svl_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.mysvl_svl_1, 1))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.mysvl_svl_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_ofdm_rx_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.mysvl_svl_0_0, 1), (self.digital_gmsk_demod_0, 0))
        self.connect((self.mysvl_svl_0_0, 0), (self.digital_ofdm_rx_0, 0))
        self.connect((self.mysvl_svl_1, 0), (self.blocks_throttle_0, 0))
Beispiel #40
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="DVB Simulator (GMSK)")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.signal = signal = 1
		self.samp_rate = samp_rate = 32000
		self.noise = noise = 10

		##################################################
		# Blocks
		##################################################
		_signal_sizer = wx.BoxSizer(wx.VERTICAL)
		self._signal_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_signal_sizer,
			value=self.signal,
			callback=self.set_signal,
			label="Signal",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._signal_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_signal_sizer,
			value=self.signal,
			callback=self.set_signal,
			minimum=0,
			maximum=1000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_signal_sizer)
		_noise_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			label="Noise",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			minimum=0,
			maximum=1000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_sizer)
		self.gr_wavfile_source_0 = gr.wavfile_source("/home/traviscollins/GNURADIO/tfc_models/test.wav", False)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise, 42)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((signal, ))
		self.gr_file_sink_1_0 = gr.file_sink(gr.sizeof_float*1, "/home/traviscollins/GNURADIO/tfc_models/output_txt.wav")
		self.gr_file_sink_1_0.set_unbuffered(False)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=20,
			frequency_offset=0.0,
			epsilon=1.0,
			taps=(1.0 + 1.0j, ),
			noise_seed=42,
		)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.digital_gmsk_mod_0 = digital.gmsk_mod(
			samples_per_symbol=2,
			bt=0.35,
			verbose=False,
			log=False,
		)
		self.digital_gmsk_demod_0 = digital.gmsk_demod(
			samples_per_symbol=2,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			freq_error=0.0,
			verbose=False,
			log=False,
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
			),
		)
		self.audio_sink_0 = audio.sink(samp_rate, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.gr_add_xx_0, 0), (self.digital_gmsk_demod_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
		self.connect((self.digital_gmsk_mod_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_1_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.blks2_packet_decoder_0, 0), (self.audio_sink_0, 0))
Beispiel #41
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")

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

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 45
        self.nfilts = nfilts = 25
        self.samp_rate = samp_rate = 44.1E3
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts)
        self.fc_slider = fc_slider = 2200

        self.BPSK = BPSK = digital.constellation_qpsk().base()

        ##################################################
        # Blocks
        ##################################################
        self._fc_slider_range = Range(0, 18200, 200, 2200, 150)
        self._fc_slider_win = RangeWidget(self._fc_slider_range,
                                          self.set_fc_slider, 'fc',
                                          "counter_slider", float)
        self.top_layout.addWidget(self._fc_slider_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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        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.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=BPSK,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=0.25,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_1 = blocks.complex_to_real(1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
            itemsize=gr.sizeof_char * 1,
            addr='127.0.0.1',
            port=1233,
            server=False,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=1,
        )
        self.audio_sink_0 = audio.sink(44100, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, fc_slider, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blks2_tcp_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_complex_to_real_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_complex_to_real_1, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_1, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_multiply_xx_0, 0))
Beispiel #42
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_freq = tx_freq = 2.407e9
        self.samp_rate = samp_rate = 32e3

        ##################################################
        # Blocks
        ##################################################
        self._tx_freq_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.tx_freq,
        	callback=self.set_tx_freq,
        	label="tx_freq",
        	choices=[2.407e9, 2.41e9, 2.413e9, 2.416e9, 2.419e9, 2.422e9, 2.425e9, 2.427e9, 2.429e9, 2.431e9, 2.433e9, 2.436e9, 2.439e9, 2.441e9, 2.443e9,2.422e9, 2.446e9, 2.449e9, 2.452e9, 2.455e9,  2.458e9, 2.460e9, 2.463e9, 2.466e9, 2.469e9, 2.472e9, 2.475e9, 2.478e9 ],
        	labels=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],
        )
        self.Add(self._tx_freq_chooser)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(32e3)
        self.uhd_usrp_sink_0.set_center_freq(tx_freq, 0)
        self.uhd_usrp_sink_0.set_gain(20, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(3e6, 0)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_b((1,0,1,0), True, 1, [])
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.Spread_ds_spreader_0 = Spread.ds_spreader(2, (1, 1, 0, 1), (1, 1, 1))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_ds_spreader_0, 0), (self.digital_gfsk_mod_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.Spread_ds_spreader_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.uhd_usrp_sink_0, 0))    
Beispiel #43
0
    def __init__(self, options):
        gr.top_block.__init__(self)

        
        # Setup USRP
        self.u = uhd.usrp_sink(options.args, uhd.stream_args('fc32'), "packet_len")
        if(options.spec):
            self.u.set_subdev_spec(options.spec, 0)
        if(options.antenna):
            self.u.set_antenna(options.antenna, 0)
        self.u.set_samp_rate(options.rate)
        # Gain is set in the hopper block
        if options.gain is None:
            g = self.u.get_gain_range()
            options.gain = float(g.start()+g.stop())/2.0
        print "-- Setting gain to {} dB".format(options.gain)
        r = self.u.set_center_freq(options.freq)
        if not r:
            print '[ERROR] Failed to set base frequency.'
            raise SystemExit, 1
        hopper_block = FrequencyHopperSrc(
                options.num_bursts, options.num_channels,
                options.freq_delta, options.freq,
                options.samp_per_burst, 1.0, options.hop_time / 1000.,
                options.post_tuning,
                options.gain,
                options.verbose,
        )

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.samp_rate = samp_rate = 400e3
        self.registers = registers = 3
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(samp_sym * 500)


        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )

        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=64,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_b((0, 1, 0, 1), True, 1, [])
    
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 9000, samp_rate, (generator), (init))


        self.connect(self.blocks_vector_source_x_0, self.blks2_packet_encoder_0, self.digital_gfsk_mod_0, self.Spread_synthesizer_0, hopper_block, self.u)
Beispiel #44
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_1 = variable_1 = 0
        self.variable_0 = variable_0 = 0
        self.sideband_rx = sideband_rx = 1000
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=4800,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=500,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(100e6, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(10, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (filter.firdes.low_pass(1, samp_rate, sideband_rx,100)), -2300, 4800)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=2,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_gr_complex*1,
        	addr="127.0.0.1",
        	port=3009,
        	server=True,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_c(grc_blks2.packet_encoder(
        		samples_per_symbol=9,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=8,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.osmosdr_sink_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.blks2_packet_encoder_0, 0))
Beispiel #45
0
    def __init__(self):
        gr.top_block.__init__(self, "Usrp Packet Encoder Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Usrp Packet Encoder Tx")
        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", "usrp_packet_encoder_tx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32E3
        self.payload_len = payload_len = 4
        self.gain = gain = 25
        self.freq = freq = 2.41e9
        self.bits_per_symbol = bits_per_symbol = 2

        ##################################################
        # Blocks
        ##################################################
        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(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       "hello_in.txt", True)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=bits_per_symbol,
                bits_per_symbol=1,
                preamble="",
                access_code="",
                pad_for_usrp=False,
            ),
            payload_length=payload_len,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Perseus Voice GMSK")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.data_rate = data_rate = 14.40e6/2

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=data_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=True,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        	size=((450,300)),
        )
        self.GridAdd(self.wxgui_scopesink2_1.win, 1, 1, 1, 1)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=48e3,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        	size=((450,300)),
        )
        self.GridAdd(self.wxgui_fftsink2_1.win, 1, 2, 1, 1)
        self.nutaq_rtdex_source_0 = nutaq.rtdex_source("nutaq_carrier_perseus_0",gr.sizeof_short,1,3)
        self.nutaq_rtdex_source_0.set_type(0)
        self.nutaq_rtdex_source_0.set_packet_size(1024)
        self.nutaq_rtdex_source_0.set_channels("1")
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_0",gr.sizeof_short,1,2)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(1024)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx("nutaq_carrier_perseus_0", 1, 0)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(943e6)
        self.nutaq_radio420_tx_0_0.set_default_reference(0)
        self.nutaq_radio420_tx_0_0.set_default_datarate(data_rate*2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(6)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_radio420_rx_0 = nutaq.radio420_rx("nutaq_carrier_perseus_0", 1, 1)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(943e6)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(data_rate*2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(1)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(16)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(5)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(6)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)
          
        self.nutaq_custom_register_0_0 = nutaq.custom_register("nutaq_carrier_perseus_0",5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_update_rate(1)
          
        self.nutaq_custom_register_0 = nutaq.custom_register("nutaq_carrier_perseus_0",4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(6)
        self.nutaq_custom_register_0.set_update_rate(1)
          
        self.nutaq_carrier_perseus_0 = nutaq.carrier(0,"nutaq_carrier_perseus_0", "192.168.0.102")
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=2,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_short_to_float_0_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 2**11-1)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_short*1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )
        self.audio_source_0 = audio.source(48000, "", True)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.nutaq_rtdex_source_0, 0), (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_short_to_float_0_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_short_to_float_0_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))
Beispiel #47
0
    def __init__(self,
                 address='addr=192.168.10.4',
                 freq=2.45e9,
                 gain=0,
                 samp_rate=32e3):
        gr.top_block.__init__(self, "UHD TX DPSK")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("UHD TX DPSK")
        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", "uhd_tx_dpsk")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.address = address
        self.freq = freq
        self.gain = gain
        self.samp_rate = samp_rate

        ##################################################
        # Variables
        ##################################################
        self.tun_gain = tun_gain = 0
        self.tun_freq = tun_freq = 2.45e9
        self.samps_per_sym = samps_per_sym = 4
        self.ampl = ampl = 0.3

        ##################################################
        # Blocks
        ##################################################
        self._tun_freq_range = Range(2.4e9, 2.5e9, 1, 2.45e9, 200)
        self._tun_freq_win = RangeWidget(self._tun_freq_range,
                                         self.set_tun_freq, 'UHD Freq (Hz)',
                                         "counter_slider", float)
        self.top_layout.addWidget(self._tun_freq_win)
        self._ampl_range = Range(0, 1, 0.01, 0.3, 200)
        self._ampl_win = RangeWidget(self._ampl_range, self.set_ampl,
                                     'Amplitude', "counter_slider", float)
        self.top_layout.addWidget(self._ampl_win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join((address, "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(tun_freq, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self._tun_gain_range = Range(0, 20, 1, 0, 200)
        self._tun_gain_win = RangeWidget(self._tun_gain_range,
                                         self.set_tun_gain, 'UHD Tx Gain',
                                         "counter_slider", float)
        self.top_layout.addWidget(self._tun_gain_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            tun_freq,  #fc
            samp_rate,  #bw
            'Transmit Spectrum',  #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_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)

        if not False:
            self.qtgui_freq_sink_x_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.digital_dxpsk_mod_0 = digital.dqpsk_mod(
            samples_per_symbol=samps_per_sym,
            excess_bw=0.35,
            mod_code="gray",
            verbose=False,
            log=False)

        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((ampl, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, 'C:\\Users\\ericj\\Desktop\\USRP_TX\\test.txt',
            True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=samps_per_sym,
                bits_per_symbol=2,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Beispiel #48
0
    def __init__(self, frame_sz_bytes=30):
        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())

        ##################################################
        # Parameters
        ##################################################
        self.frame_sz_bytes = frame_sz_bytes

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 50e3
        
        
        self.ccsds_encoder_var = ccsds_encoder_var = fec.ccsds_encoder_make(frame_sz_bytes * 8, 0, fec.CC_TAILBITING)
            
        
        
        self.cc_decoder_var = cc_decoder_var = fec.cc_decoder.make(frame_sz_bytes * 8, 7, 2, ([109,79]), 0, -1, fec.CC_TAILBITING, False)
            

        ##################################################
        # Blocks
        ##################################################
        self.fec_extended_encoder_0 = fec.extended_encoder(encoder_obj_list=ccsds_encoder_var, threading='capillary', puncpat='11')
        self.fec_extended_decoder_0 = fec.extended_decoder(decoder_obj_list=cc_decoder_var, threading='capillary', ann=None, puncpat='11', integration_period=10000)
        self.digital_map_bb_0 = digital.map_bb((-1,1))
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
        	samples_per_symbol=2,
        	excess_bw=0.35,
        	mod_code="gray",
        	verbose=False,
        	log=False)
        	
        self.digital_dxpsk_demod_0 = digital.dbpsk_demod(
        	samples_per_symbol=2,
        	excess_bw=0.35,
        	freq_bw=6.28/100.0,
        	phase_bw=6.28/100.0,
        	timing_bw=6.28/100.0,
        	mod_code="gray",
        	verbose=False,
        	log=False
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.5,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(16)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True)
        self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(16)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/jeff/EE420/FinalProj/testdat.txt', True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/home/jeff/EE420/Repo/EE420SDR/FinalProj/fecout.txt', False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blks2_packet_encoder_1 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		preamble='',
        		access_code='',
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code='',
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_1.recv_pkt(ok, payload),
        	),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_1, 0), (self.digital_map_bb_0, 0))    
        self.connect((self.blks2_packet_encoder_1, 0), (self.digital_dxpsk_mod_0, 0))    
        self.connect((self.blocks_char_to_float_0, 0), (self.fec_extended_decoder_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))    
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.fec_extended_encoder_0, 0))    
        self.connect((self.channels_channel_model_0, 0), (self.digital_dxpsk_demod_0, 0))    
        self.connect((self.digital_dxpsk_demod_0, 0), (self.blks2_packet_decoder_1, 0))    
        self.connect((self.digital_dxpsk_mod_0, 0), (self.channels_channel_model_0, 0))    
        self.connect((self.digital_map_bb_0, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.fec_extended_decoder_0, 0), (self.blocks_pack_k_bits_bb_0, 0))    
        self.connect((self.fec_extended_encoder_0, 0), (self.blks2_packet_encoder_1, 0))    
Beispiel #49
0
    def __init__(self):
        gr.top_block.__init__(self, "Mpsk Stage1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Mpsk Stage1")
        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", "mpsk_stage1")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 2
        self.excess_bw = excess_bw = 0.10
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(1, sps, 1, excess_bw, 45)
        self.bpsk = bpsk = digital.constellation_rect(([0.707+0.707j, -0.707+0.707j]), ([0, 1,]), 2, 2, 0, 1, 0).base()
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(2.4175e9, 0)
        self.uhd_usrp_sink_0.set_gain(28, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(100e3, 0)
        self.digital_crc32_bb_0 = digital.crc32_bb(False, "packet_len")
        self.digital_constellation_modulator_0 = digital.generic_mod(
          constellation=bpsk,
          differential=True,
          samples_per_symbol=sps,
          pre_diff_code=True,
          excess_bw=excess_bw,
          verbose=False,
          log=False,
          )
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(gr.sizeof_char, 1, 8, "packet_len")
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=8,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 256, 10000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.blocks_stream_to_tagged_stream_0, 0))    
        self.connect((self.blocks_stream_to_tagged_stream_0, 0), (self.digital_crc32_bb_0, 0))    
        self.connect((self.digital_constellation_modulator_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.digital_crc32_bb_0, 0), (self.digital_constellation_modulator_0, 0))    
Beispiel #50
0
    def __init__(self):
        gr.top_block.__init__(self, "Perseus Spectrum Sensing")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Perseus Spectrum Sensing")
        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", "perseus_s_sensing")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_funcion = variable_funcion = 0
        self.show_test_statistics = show_test_statistics = False
        self.samp_rate = samp_rate = 20e6
        self.packet_size = packet_size = 8192
        self.oversampling = oversampling = 4
        self.nfft = nfft = 2**15
        self.freq_offset = freq_offset = variable_funcion
        self.decimation = decimation = 40
        self.amplitude = amplitude = 0.125
        self.RF_freq = RF_freq = 943e6
        self.PSD_averaging = PSD_averaging = 600
        self.ENABLE_TX1_variable_check_box = ENABLE_TX1_variable_check_box = True

        ##################################################
        # Blocks
        ##################################################
        self.probe = blocks.probe_signal_f()

        def _variable_funcion_probe():
            while True:
                val = self.probe.level()
                try:
                    self.set_variable_funcion(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (0.1))

        _variable_funcion_thread = threading.Thread(
            target=_variable_funcion_probe)
        _variable_funcion_thread.daemon = True
        _variable_funcion_thread.start()
        _show_test_statistics_check_box = Qt.QCheckBox(
            "Show Test Statistics (ReL and Rs)")
        self._show_test_statistics_choices = {True: True, False: False}
        self._show_test_statistics_choices_inv = dict(
            (v, k) for k, v in self._show_test_statistics_choices.iteritems())
        self._show_test_statistics_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _show_test_statistics_check_box, "setChecked",
            Qt.Q_ARG("bool", self._show_test_statistics_choices_inv[i]))
        self._show_test_statistics_callback(self.show_test_statistics)
        _show_test_statistics_check_box.stateChanged.connect(
            lambda i: self.set_show_test_statistics(
                self._show_test_statistics_choices[bool(i)]))
        self.top_layout.addWidget(_show_test_statistics_check_box)
        self.spectsensing_xs_plot_1 = spectsensing.xs_plot("")
        self._spectsensing_xs_plot_1_win = self.spectsensing_xs_plot_1
        self.top_layout.addWidget(self._spectsensing_xs_plot_1_win)
        self.spectsensing_subband_selector_0 = spectsensing.subband_selector(
            40, "Selection", 0, samp_rate)
        self.spectsensing_ss_subband_plot_0_0 = spectsensing.ss_subband_plot(
            show_test_statistics, "")
        self._spectsensing_ss_subband_plot_0_0_win = self.spectsensing_ss_subband_plot_0_0
        self.top_layout.addWidget(self._spectsensing_ss_subband_plot_0_0_win)
        self.spectsensing_ss_pds_plot_0 = spectsensing.ss_pds_plot(
            nfft, samp_rate, 1024)
        self.spectsensing_ss_edge_plot_0 = spectsensing.ss_edge_plot(
            show_test_statistics, " ")
        self._spectsensing_ss_edge_plot_0_win = self.spectsensing_ss_edge_plot_0
        self.top_layout.addWidget(self._spectsensing_ss_edge_plot_0_win)

        self.spectsensing_compute_statistics_0 = spectsensing.compute_statistics(
            nfft, samp_rate, 0.0065, 1e-9, 1e-9, 40, 54)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1020 * 64,  #size
            samp_rate / 40,  #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(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

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

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.nutaq_rtdex_source_S_S_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 0)
        self.nutaq_rtdex_source_S_S_0.set_type(0)
        self.nutaq_rtdex_source_S_S_0.set_packet_size(1300)
        self.nutaq_rtdex_source_S_S_0.set_channels("0")
        self.nutaq_rtdex_source_S_S = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 3)
        self.nutaq_rtdex_source_S_S.set_type(0)
        self.nutaq_rtdex_source_S_S.set_packet_size(1200)
        self.nutaq_rtdex_source_S_S.set_channels("3")
        self.nutaq_rtdex_source_0_0_0 = nutaq.rtdex_source(
            "nutaq_carrier_perseus_TX", gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_source_0_0_0.set_type(0)
        self.nutaq_rtdex_source_0_0_0.set_packet_size(packet_size)
        self.nutaq_rtdex_source_0_0_0.set_channels("2")
        (self.nutaq_rtdex_source_0_0_0).set_min_output_buffer(16384)
        self.nutaq_rtdex_sink_0 = nutaq.rtdex_sink("nutaq_carrier_perseus_TX",
                                                   gr.sizeof_short, 1, 7)
        self.nutaq_rtdex_sink_0.set_type(0)
        self.nutaq_rtdex_sink_0.set_packet_size(packet_size)
        self.nutaq_rtdex_sink_0.set_channels("1")
        self.nutaq_radio420_tx_0_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 2, 1)
        self.nutaq_radio420_tx_0_0.set_default_enable(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0_0.set_default_reference(1)
        self.nutaq_radio420_tx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0_0.set_default_band(0)
        self.nutaq_radio420_tx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_tx_0 = nutaq.radio420_tx(
            "nutaq_carrier_perseus_TX", 1, 0)
        self.nutaq_radio420_tx_0.set_default_enable(1)
        self.nutaq_radio420_tx_0.set_default_tx_freq(RF_freq)
        self.nutaq_radio420_tx_0.set_default_reference(0)
        self.nutaq_radio420_tx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_tx_0.set_default_calibrate(0)
        self.nutaq_radio420_tx_0.set_default_band(0)
        self.nutaq_radio420_tx_0.set_default_update_rate(1)
        self.nutaq_radio420_tx_0.set_default_tx_vga1_gain(-10)
        self.nutaq_radio420_tx_0.set_default_tx_vga2_gain(15)
        self.nutaq_radio420_tx_0.set_default_tx_gain3(3)
        self.nutaq_radio420_tx_0.set_default_tx_lpf_bandwidth(2)
        self.nutaq_radio420_tx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_tx_gain_ctrl(0)
        self.nutaq_radio420_tx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 2, 3)
        self.nutaq_radio420_rx_0_0.set_default_enable(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0_0.set_default_reference(1)
        self.nutaq_radio420_rx_0_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0_0.set_default_band(0)
        self.nutaq_radio420_rx_0_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_radio420_rx_0 = nutaq.radio420_rx(
            "nutaq_carrier_perseus_TX", 1, 2)
        self.nutaq_radio420_rx_0.set_default_enable(1)
        self.nutaq_radio420_rx_0.set_default_rx_freq(RF_freq)
        self.nutaq_radio420_rx_0.set_default_reference(0)
        self.nutaq_radio420_rx_0.set_default_datarate(samp_rate * 2)
        self.nutaq_radio420_rx_0.set_default_calibrate(0)
        self.nutaq_radio420_rx_0.set_default_band(0)
        self.nutaq_radio420_rx_0.set_default_update_rate(1)
        self.nutaq_radio420_rx_0.set_default_rx_lna_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_vga1_gain(2)
        self.nutaq_radio420_rx_0.set_default_rx_gain2(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain3(-8)
        self.nutaq_radio420_rx_0.set_default_rx_rf_filter(2)
        self.nutaq_radio420_rx_0.set_default_rx_lpf_bandwidth(2)
        self.nutaq_radio420_rx_0.set_default_ref_clk_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rf_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_rx_gain_ctrl(0)
        self.nutaq_radio420_rx_0.set_default_pll_cpld_ctrl(0)

        self.nutaq_custom_register_0_1_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 9)
        self.nutaq_custom_register_0_1_1.set_index(6)
        self.nutaq_custom_register_0_1_1.set_default_value(PSD_averaging)
        self.nutaq_custom_register_0_1_1.set_update_rate(1)

        self.nutaq_custom_register_0_1_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 7)
        self.nutaq_custom_register_0_1_0.set_index(2)
        self.nutaq_custom_register_0_1_0.set_update_rate(1)

        self.nutaq_custom_register_0_1 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 36)
        self.nutaq_custom_register_0_1.set_index(0)
        self.nutaq_custom_register_0_1.set_update_rate(1)

        self.nutaq_custom_register_0_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 8)
        self.nutaq_custom_register_0_0_0.set_index(3)
        self.nutaq_custom_register_0_0_0.set_default_value(7)
        self.nutaq_custom_register_0_0_0.set_update_rate(1)

        self.nutaq_custom_register_0_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 5)
        self.nutaq_custom_register_0_0.set_index(4)
        self.nutaq_custom_register_0_0.set_default_value(1)
        self.nutaq_custom_register_0_0.set_update_rate(1)

        self.nutaq_custom_register_0 = nutaq.custom_register(
            "nutaq_carrier_perseus_TX", 4)
        self.nutaq_custom_register_0.set_index(1)
        self.nutaq_custom_register_0.set_default_value(3)
        self.nutaq_custom_register_0.set_update_rate(1)

        self.nutaq_carrier_perseus_TX = nutaq.carrier(
            0, "nutaq_carrier_perseus_TX", "192.168.0.101")
        self._freq_offset_range = Range(-1e7, 1e7, 1e4, variable_funcion, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            "freq_offset", "slider")
        self.top_layout.addWidget(self._freq_offset_win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=oversampling,
            bt=0.71,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=oversampling,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char * 1,
                                                 "192.168.0.100", 1234, 1472,
                                                 True)
        self.blocks_throttle_0 = blocks.throttle(
            gr.sizeof_char * 1,
            2 * 4e3 + 0 * samp_rate / 40 / (oversampling * 8 * 2), True)
        self.blocks_short_to_float_0_1_0 = blocks.short_to_float(1, 2**11)
        self.blocks_short_to_float_0_0_0_0 = blocks.short_to_float(1, 2**11)
        self.blocks_null_sink_1_3 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_2 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_1 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float * 40)
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vff(
            (2.0**(16 * 2), ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc(
            (amplitude, ))
        self.blocks_multiply_const_vxx_0_1_1 = blocks.multiply_const_vff(
            (2.0**(16 * 0), ))
        self.blocks_multiply_const_vxx_0_1_0_0 = blocks.multiply_const_vff(
            (2.0**(16 * 1), ))
        self.blocks_multiply_const_vxx_0_1_0 = blocks.multiply_const_vff(
            (2.0**(16 * 1), ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff(
            (2.0**(16 * 0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (2.0**(16 * 2), ))
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short * 1, 1)
        self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11 - 1)
        self.blocks_float_to_complex_0_0_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1, "/home/juan/Music/de_mi.mp3", True)
        self.blocks_deinterleave_0_0_1 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_deinterleave_0_0_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_deinterleave_0_0 = blocks.deinterleave(
            gr.sizeof_short * 1, 1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=8,
                preamble="",
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=128,
        )
        self.blks2_packet_decoder_1 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_1.
                recv_pkt(ok, payload),
            ), )
        _ENABLE_TX1_variable_check_box_check_box = Qt.QCheckBox(
            "Enable Transmission")
        self._ENABLE_TX1_variable_check_box_choices = {
            True: True,
            False: False
        }
        self._ENABLE_TX1_variable_check_box_choices_inv = dict(
            (v, k) for k, v in
            self._ENABLE_TX1_variable_check_box_choices.iteritems())
        self._ENABLE_TX1_variable_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(
            _ENABLE_TX1_variable_check_box_check_box, "setChecked",
            Qt.Q_ARG("bool", self._ENABLE_TX1_variable_check_box_choices_inv[i]
                     ))
        self._ENABLE_TX1_variable_check_box_callback(
            self.ENABLE_TX1_variable_check_box)
        _ENABLE_TX1_variable_check_box_check_box.stateChanged.connect(
            lambda i: self.set_ENABLE_TX1_variable_check_box(
                self._ENABLE_TX1_variable_check_box_choices[bool(i)]))
        self.top_layout.addWidget(_ENABLE_TX1_variable_check_box_check_box)
        self.DataConversion_reint_short_float_0_3 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_2_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_2 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_1_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_1 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_0_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_reint_short_float_0 = DataConversion.reint_short_float(
        )
        self.DataConversion_eaver_resynchronizer_0_0 = DataConversion.eaver_resynchronizer(
            1024)
        self.DataConversion_eaver_resynchronizer_0 = DataConversion.eaver_resynchronizer(
            decimation)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect(
            (self.spectsensing_compute_statistics_0, 'spec_sens_pdus'),
            (self.spectsensing_ss_edge_plot_0, 'pdus'))
        self.msg_connect(
            (self.spectsensing_compute_statistics_0, 'spec_sens_pdus'),
            (self.spectsensing_ss_subband_plot_0_0, 'pdus'))
        self.msg_connect((self.spectsensing_ss_pds_plot_0, 'psd_pdu'),
                         (self.spectsensing_xs_plot_1, 'pdus'))
        self.connect((self.DataConversion_eaver_resynchronizer_0, 1),
                     (self.spectsensing_compute_statistics_0, 1))
        self.connect((self.DataConversion_eaver_resynchronizer_0, 0),
                     (self.spectsensing_compute_statistics_0, 0))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 0),
                     (self.spectsensing_ss_pds_plot_0, 0))
        self.connect((self.DataConversion_eaver_resynchronizer_0_0, 1),
                     (self.spectsensing_ss_pds_plot_0, 1))
        self.connect((self.DataConversion_reint_short_float_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_3, 0))
        self.connect((self.DataConversion_reint_short_float_0_1, 0),
                     (self.blocks_multiply_const_vxx_0_1_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_1_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_0_0, 0))
        self.connect((self.DataConversion_reint_short_float_0_2, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.DataConversion_reint_short_float_0_2_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_1, 0))
        self.connect((self.DataConversion_reint_short_float_0_3, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 0))
        self.connect((self.blks2_packet_decoder_1, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0, 1))
        self.connect((self.blocks_add_xx_0_0, 0),
                     (self.DataConversion_eaver_resynchronizer_0_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_short_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_float_to_short_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 0),
                     (self.DataConversion_reint_short_float_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 1),
                     (self.DataConversion_reint_short_float_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0, 3),
                     (self.DataConversion_reint_short_float_0_1, 0))
        self.connect((self.blocks_deinterleave_0_0, 2),
                     (self.DataConversion_reint_short_float_0_2, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 1),
                     (self.blocks_short_to_float_0_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_0, 0),
                     (self.blocks_short_to_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 1),
                     (self.DataConversion_reint_short_float_0_0_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 3),
                     (self.DataConversion_reint_short_float_0_1_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 2),
                     (self.DataConversion_reint_short_float_0_2_0, 0))
        self.connect((self.blocks_deinterleave_0_0_1, 0),
                     (self.DataConversion_reint_short_float_0_3, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_float_to_complex_0_0_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0),
                     (self.blocks_interleave_0, 0))
        self.connect((self.blocks_float_to_short_0_0_0, 0),
                     (self.blocks_interleave_0, 1))
        self.connect((self.blocks_interleave_0, 0),
                     (self.nutaq_rtdex_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_1_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_1_0_0, 0),
                     (self.blocks_add_xx_0_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_1_1, 0),
                     (self.blocks_add_xx_0_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_2, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_3, 0),
                     (self.blocks_add_xx_0_0, 0))
        self.connect((self.blocks_short_to_float_0_0_0_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 1))
        self.connect((self.blocks_short_to_float_0_1_0, 0),
                     (self.blocks_float_to_complex_0_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_1, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_2, 0))
        self.connect((self.nutaq_rtdex_source_0_0_0, 0),
                     (self.blocks_deinterleave_0_0_0, 0))
        self.connect((self.nutaq_rtdex_source_S_S, 0),
                     (self.blocks_deinterleave_0_0, 0))
        self.connect((self.nutaq_rtdex_source_S_S_0, 0),
                     (self.blocks_deinterleave_0_0_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 0),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 5),
                     (self.blocks_null_sink_1_0, 0))
        self.connect((self.spectsensing_compute_statistics_0, 2),
                     (self.blocks_null_sink_1_1, 0))
        self.connect((self.spectsensing_compute_statistics_0, 4),
                     (self.blocks_null_sink_1_2, 0))
        self.connect((self.spectsensing_compute_statistics_0, 6),
                     (self.blocks_null_sink_1_3, 0))
        self.connect((self.spectsensing_compute_statistics_0, 7),
                     (self.spectsensing_subband_selector_0, 0))
        self.connect((self.spectsensing_compute_statistics_0, 1),
                     (self.spectsensing_subband_selector_0, 1))
        self.connect((self.spectsensing_compute_statistics_0, 3),
                     (self.spectsensing_subband_selector_0, 2))
        self.connect((self.spectsensing_subband_selector_0, 0),
                     (self.probe, 0))
Beispiel #51
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter")

        ##################################################
        # Variables
        ##################################################
        self.signal = signal = 30000
        self.samp_rate = samp_rate = 1000000
        self.rfgain = rfgain = 25
        self.freq = freq = 1700000000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        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(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(80, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(1000000, 0)
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            label='Signal',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._signal_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            minimum=0,
            maximum=32000,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_signal_sizer)
        _rfgain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rfgain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            label='RF',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rfgain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rfgain_sizer,
            value=self.rfgain,
            callback=self.set_rfgain,
            minimum=0,
            maximum=50,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rfgain_sizer)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((5000, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/droy/Documents/GNURadio_Files/video1.ts', False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, '/home/droy/Desktop/video1.avi', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        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", "top_block")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.variable_qtgui_range_0_1 = variable_qtgui_range_0_1 = 50
        self.variable_qtgui_range_0 = variable_qtgui_range_0 = 34
        self.timing_loop_bw = timing_loop_bw = 6.28 / 100.0
        self.time_offset = time_offset = 1.00
        self.taps_channel_model = taps_channel_model = [1.0]
        self.samp_rate = samp_rate = 250000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)

        self.qpsk = qpsk = digital.constellation_qpsk().base()

        self.phase_bw = phase_bw = 6.28 / 100.0
        self.noise_volt = noise_volt = 0.0000
        self.frequencia_usrp = frequencia_usrp = 1000000000
        self.freq_offset = freq_offset = 0
        self.excess_bw = excess_bw = 0.35
        self.eq_gain = eq_gain = 0.01
        self.documentacao = documentacao = "1010010011110010"
        self.barker_code_13 = barker_code_13 = "1111100110101"
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_range_0_1_range = Range(0, 73, 1, 50, 200)
        self._variable_qtgui_range_0_1_win = RangeWidget(
            self._variable_qtgui_range_0_1_range,
            self.set_variable_qtgui_range_0_1, 'Gain_RX', "counter_slider",
            float)
        self.top_grid_layout.addWidget(self._variable_qtgui_range_0_1_win, 0,
                                       3, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._variable_qtgui_range_0_range = Range(0, 90, 1, 34, 200)
        self._variable_qtgui_range_0_win = RangeWidget(
            self._variable_qtgui_range_0_range,
            self.set_variable_qtgui_range_0, 'Gain_TX', "counter_slider",
            float)
        self.top_grid_layout.addWidget(self._variable_qtgui_range_0_win, 0, 2,
                                       1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._timing_loop_bw_range = Range(0.0, 0.2, 0.01, 6.28 / 100.0, 200)
        self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range,
                                               self.set_timing_loop_bw,
                                               'Time: BW', "slider", float)
        self.top_grid_layout.addWidget(self._timing_loop_bw_win, 6, 3, 1, 1)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._samp_rate_range = Range(0, 10000000, 1, 250000, 200)
        self._samp_rate_win = RangeWidget(self._samp_rate_range,
                                          self.set_samp_rate, 'samp_rate',
                                          "counter_slider", int)
        self.top_grid_layout.addWidget(self._samp_rate_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._phase_bw_range = Range(0.0, 1.0, 0.01, 6.28 / 100.0, 200)
        self._phase_bw_win = RangeWidget(self._phase_bw_range,
                                         self.set_phase_bw, 'Phase: Bandwidth',
                                         "dial", float)
        self.top_grid_layout.addWidget(self._phase_bw_win, 6, 1, 1, 1)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._eq_gain_range = Range(0.0, 0.1, 0.001, 0.01, 200)
        self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain,
                                        'Equalizer: rate (Gain)', "slider",
                                        float)
        self.top_grid_layout.addWidget(self._eq_gain_win, 6, 2, 1, 1)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("serial=F5EAC0", "master_clock_rate=32e6")),
            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_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_source_0.set_center_freq(frequencia_usrp, 0)
        self.uhd_usrp_source_0.set_gain(variable_qtgui_range_0_1, 0)
        self.uhd_usrp_source_0.set_antenna('RX2', 0)
        self.uhd_usrp_source_0.set_auto_dc_offset(True, 0)
        self.uhd_usrp_source_0.set_auto_iq_balance(True, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("serial=F5EAE1", "master_clock_rate=32e6")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec())
        self.uhd_usrp_sink_0.set_center_freq(frequencia_usrp, 0)
        self.uhd_usrp_sink_0.set_gain(variable_qtgui_range_0, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.00, 200)
        self._time_offset_win = RangeWidget(self._time_offset_range,
                                            self.set_time_offset,
                                            'Timing Offset', "counter_slider",
                                            float)
        self.top_grid_layout.addWidget(self._time_offset_win, 3, 3, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_FLATTOP,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Frequencia Tratado",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0_0_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(
            self._qtgui_freq_sink_x_0_0_0_0_0_0_0_win, 1, 7, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(7, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0_0_0_0_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_FLATTOP,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Phase Tratado",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_0_0_win,
                                       1, 5, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(5, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0_0_0_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_FLATTOP,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Error Tratado",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_0_win,
                                       1, 6, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_FLATTOP,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Recebido Tratado - Constelation Rec",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_0_win, 1,
                                       4, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_FLATTOP,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Recebido Tratado",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win, 1, 3,
                                       1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Recebido",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(0.2)
        self.qtgui_freq_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 1, 2,
                                       1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Enviado",  #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_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(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_0.disable_legend()

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

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

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 1, 1, 1,
                                       1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0_0_0_0 = qtgui.const_sink_c(
            1024,  #size
            '"Recebido Tratado - Constelation Rec""',  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0_0.set_trigger_mode(
            qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_0_0_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0_0_0.enable_grid(False)
        self.qtgui_const_sink_x_0_0_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0_0_0.disable_legend()

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

        self._qtgui_const_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_0_win, 2,
                                       4, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0_0_0 = qtgui.const_sink_c(
            1024,  #size
            "Recebido Tratado",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                       qtgui.TRIG_SLOPE_POS,
                                                       0.0, 0, "")
        self.qtgui_const_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0_0.enable_grid(False)
        self.qtgui_const_sink_x_0_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0_0.disable_legend()

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

        self._qtgui_const_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_0_win, 2,
                                       3, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(3, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c(
            1024,  #size
            "Recebido",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                     qtgui.TRIG_SLOPE_POS, 0.0,
                                                     0, "")
        self.qtgui_const_sink_x_0_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0_0.enable_grid(False)
        self.qtgui_const_sink_x_0_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0_0.disable_legend()

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

        self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win, 2, 2,
                                       1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "Enviado",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

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

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 2, 1, 1,
                                       1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._noise_volt_range = Range(0, 1, 0.01, 0.0000, 200)
        self._noise_volt_win = RangeWidget(self._noise_volt_range,
                                           self.set_noise_volt,
                                           'Noise Voltage', "slider", float)
        self.top_grid_layout.addWidget(self._noise_volt_win, 3, 1, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._freq_offset_range = Range(-0.1, 0.1, 0.001, 0, 200)
        self._freq_offset_win = RangeWidget(self._freq_offset_range,
                                            self.set_freq_offset,
                                            'Frequency Offset',
                                            "counter_slider", float)
        self.top_grid_layout.addWidget(self._freq_offset_win, 3, 2, 1, 1)
        for r in range(3, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 3):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, timing_loop_bw, (rrc_taps), nfilts, nfilts / 2, 1.5, 2)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            phase_bw, arity, False)
        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.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(
            qpsk)
        self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(
            15, 1, eq_gain, 2)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(
            2, 8, "", False, gr.GR_MSB_FIRST)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_file_source_0_0_0_0 = blocks.file_source(
            gr.sizeof_char * 1, '/home/andre/Desktop/video2.mpeg', False)
        self.blocks_file_source_0_0_0_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0_1_0 = blocks.file_sink(
            gr.sizeof_char * 1, '/home/andre/Desktop/transmitido/depois.mpeg',
            False)
        self.blocks_file_sink_0_1_0.set_unbuffered(False)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=sps,
                bits_per_symbol=2,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=
                "1010110011011101101001001110001011110010100011000010000011111100",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0_1_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_file_source_0_0_0_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.blocks_repack_bits_bb_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_const_sink_x_0_0_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.qtgui_const_sink_x_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
Beispiel #53
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ud T")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.transistion = transistion = 100
        self.sps = sps = 9
        self.sideband_rx = sideband_rx = 1000
        self.sideband = sideband = 1000
        self.samp_rate = samp_rate = 48000
        self.payload = payload = 5
        self.interpolation = interpolation = 500
        self.carrier = carrier = 23000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=500,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.band_pass (0.50,samp_rate,carrier-sideband,carrier+sideband,transistion)), -carrier, samp_rate)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=sps,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=10004,
        	server=True,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=sps,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=payload,
        )
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))
        self.connect((self.blks2_tcp_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.audio_sink_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.digital_gfsk_mod_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
Beispiel #54
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.sps = sps = 8
        self.nfilts = nfilts = 128
        self.timing_loop_bandwidth = timing_loop_bandwidth = .063
        self.samp_rate = samp_rate = 1000000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts)
        self.noise_voltage = noise_voltage = .063
        self.freq_offset = freq_offset = 0
        self.code2 = code2 = '11011010110111011000110011110101100010010011110111'
        self.code1 = code1 = '010110011011101100010101011111101001001110001011010001101010001'

        self.BPSK = BPSK = digital.constellation_calcdist(([-1, 1]), ([0, 1]),
                                                          4, 1).base()

        ##################################################
        # Blocks
        ##################################################
        self._timing_loop_bandwidth_range = Range(.001, .2, .001, .063, 200)
        self._timing_loop_bandwidth_win = RangeWidget(
            self._timing_loop_bandwidth_range, self.set_timing_loop_bandwidth,
            "timing_loop_bandwidth", "counter_slider", float)
        self.top_grid_layout.addWidget(self._timing_loop_bandwidth_win, 0, 0,
                                       1, 1)
        self._noise_voltage_range = Range(0.0, 1, .001, .063, 200)
        self._noise_voltage_win = RangeWidget(self._noise_voltage_range,
                                              self.set_noise_voltage,
                                              "noise_voltage",
                                              "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_voltage_win, 0, 1, 1, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_c(
            15,  #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(False)
        self.qtgui_time_sink_x_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = [
            'Real part', 'Imaginary Part', '', '', '', '', '', '', '', ''
        ]
        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 = [0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [0, 0, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2 * 1):
            if len(labels[i]) == 0:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0_0.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, 1, 1,
                                       1, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            15,  #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(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['Binary output (1 or 0)', '', '', '', '', '', '', '', '', '']
        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 = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [0, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1,
                                       1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(False)
        self.qtgui_const_sink_x_0.enable_grid(True)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_const_sink_x_0.disable_legend()

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

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 1, 0, 1,
                                       1)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, timing_loop_bandwidth, (rrc_taps), nfilts, nfilts / 2, 1.5, 1)
        self.digital_diff_encoder_bb_0 = digital.diff_encoder_bb(2)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=BPSK,
            differential=False,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf(
            (0, 1), 1)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise_voltage,
            frequency_offset=freq_offset / samp_rate,
            epsilon=1.0,
            taps=(1, ),
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char * 1,
                                                   samp_rate, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/Users/ampoulog/Documents/gnuradio/Wireless-communication-systems-Lab/Lab3/example6/cat.png',
            True)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/Users/ampoulog/Documents/gnuradio/Wireless-communication-systems-Lab/Lab3/example8/hello_out.png',
            False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blks2_packet_encoder_0_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=1,
                bits_per_symbol=1,
                preamble='',
                access_code=code2,
                pad_for_usrp=False,
            ),
            payload_length=4,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code=code2,
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_diff_encoder_bb_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blks2_packet_encoder_0_0, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_diff_encoder_bb_0, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
Beispiel #55
0
    def __init__(self):
        gr.top_block.__init__(self, "Example5 Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Example5 Tx")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "example5_tx")

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

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

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

        if not True:
            self.qtgui_freq_sink_x_0_0_0_0.disable_legend()

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

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

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

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_encoder_1, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blks2_packet_encoder_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_ofdm_tx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_ofdm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.mysvl_svl_1, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.mysvl_svl_1, 1))
        self.connect((self.mysvl_svl_1, 0), (self.blocks_stream_mux_0, 1))
Beispiel #56
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FHSS transmit")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_sym = samp_sym = 64
        self.tx_freq = tx_freq = 2.414e9
        self.samp_rate = samp_rate = 400e3
        self.registers = registers = 3
        self.init = init = 1, 1, 1, 1
        self.generator = generator = 1, 1, 0, 0, 1
        self.code_rate = code_rate = int(samp_sym * 500)

        ##################################################
        # Blocks
        ##################################################
        self._tx_freq_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.tx_freq,
        	callback=self.set_tx_freq,
        	label="tx_freq",
        	choices=[2414000000, 2432000000, 2450000000, 2468000000],
        	labels=[1,2,3,4],
        )
        self.Add(self._tx_freq_chooser)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(tx_freq, 0)
        self.uhd_usrp_sink_0.set_gain(20, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(1.125e6, 0)
        self.digital_gfsk_mod_0 = digital.gfsk_mod(
        	samples_per_symbol=64,
        	sensitivity=1.0,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_b((0, 1, 0, 1), True, 1, [])
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble="",
        		access_code="",
        		pad_for_usrp=True,
        	),
        	payload_length=0,
        )
        self.Spread_synthesizer_0 = Spread.synthesizer(code_rate, 9000, samp_rate, (generator), (init))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Spread_synthesizer_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gfsk_mod_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blks2_packet_encoder_0, 0))    
        self.connect((self.digital_gfsk_mod_0, 0), (self.Spread_synthesizer_0, 0))    
	def __init__(self, tx_gain, samps_per_sym, pay_len, freq, samp_rate, ampl, file_source):
		gr.hier_block2.__init__(self, "transmit_path",
				gr.io_signature(0, 0, 0), # Input signature
				gr.io_signature(0, 0, 0)) # Output signature

		##################################################
		# Variables
		##################################################
		self.file_source = file_source
		self.tx_gain = tx_gain
		self.samps_per_sym = samps_per_sym
		self.samp_rate = samp_rate
		self.pay_len = pay_len
		self.freq = freq
		self.ampl = ampl


		##################################################
		# Blocks
		##################################################
		self.uhd_usrp_sink_0 = uhd.usrp_sink(
			device_addr="",
			stream_args=uhd.stream_args(
				cpu_format="fc32",
				channels=range(1),
			),
		)
		self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
		self.uhd_usrp_sink_0.set_center_freq(freq, 0)
		self.uhd_usrp_sink_0.set_gain(tx_gain, 0)


		self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
				interpolation=125,
				decimation=4,
				taps=None,
				fractional_bw=None,
		)

		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
				samples_per_symbol=samps_per_sym,
				bits_per_symbol=1,
				preamble="",
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=pay_len,
		)

		self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
			samples_per_symbol=samps_per_sym,
			excess_bw=0.35,
			mod_code="gray",
			verbose=False,
			log=False)

		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((ampl, ))

		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, file_source, False)

		##################################################
		# Connections
		##################################################
		self.connect((self.digital_dxpsk_mod_0, 0), (self.rational_resampler_xxx_0,0))
		self.connect((self.rational_resampler_xxx_0,0),(self.blocks_multiply_const_vxx_0,0))
		self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.digital_dxpsk_mod_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.uhd_usrp_sink_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit='%',
            minval=0,
            maxval=1,
            factor=1.0,
            decimal_places=10,
            ref_level=0,
            sample_rate=samp_rate,
            number_rate=15,
            average=True,
            avg_alpha=None,
            label='Number Plot',
            peak_hold=True,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_vector_source_x_0 = blocks.vector_source_b((7, 8, 9), True,
                                                               1, [])
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((12e3, ))
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1, '/home/steve-wang/test.txt', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=4,
                bits_per_symbol=2,
                preamble='',
                access_code='',
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.blks2_error_rate_0 = grc_blks2.error_rate(
            type='BER',
            win_size=1000,
            bits_per_symbol=2,
        )
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 10000, 42)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blks2_error_rate_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.blks2_error_rate_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_error_rate_0, 1))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))