예제 #1
0
파일: bot1_rx.py 프로젝트: randyp1248/darpa
    def __init__(self, options):
        gr.top_block.__init__(self)

        if(options.rx_freq is not None):
	    symbol_rate = 500000
	    self.source = uhd_receiver(options.args, symbol_rate,
				       2,
				       options.rx_freq, 30,
				       #options.spec, "RX2",
				       options.spec, "TX/RX",
				       1) #options.verbose)
	    options.samples_per_symbol = self.source._sps

        elif(options.from_file is not None):
            sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file)))
            self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
        else:
            sys.stderr.write("No source defined, pulling samples from null source.\n\n")
            self.source = gr.null_source(gr.sizeof_gr_complex)

        # Set up receive path
	# Correlator block
        self.correlator = correlator_cc.correlator_cc()

	# Despreader block
	self.despreader = spreader.despreader_cb()
  
        # RS Decoder block
	self.decoder = rscoding_bb.decode_bb()

        # CRC RX Block
        self.crcrx = crc.crcrx()

	# Packetizer receiver
	self.packetrx = packetizer.packet_sink()

	# Print block
	self.printer = print_bb.print_bb()

	# NULL sink block
        self.nullsink = gr.null_sink(1)
 
        # RRC filter
        #nfilts = 32 
        #ntaps = nfilts * 11 * int(options.samples_per_symbol)
        #self.rrc_taps = gr.firdes.root_raised_cosine(
            #1.0, # gain
            #1000000, # sampling rate based on 32 fliters in resampler
            #symbol_rate,    # symbol rate
            #1.0,    # excess bandwidth or roll-off factor
            #ntaps)
        #self.rrc_filter = gr.pfb_arb_resampler_ccf(options.samples_per_symbol, 
        #                                           self.rrc_taps)


        # Design filter to get actual channel we want
        sw_decim = 1
        chan_coeffs = gr.firdes.low_pass (1.0,                  # gain
                                          #sw_decim * self.samples_per_symbol(), # sampling rate
                                          #1000000, # sampling rate
                                          2,
                                          #self._chbw_factor,    # midpoint of trans. band
                                          1,    # midpoint of trans. band
                                          0.5,                  # width of trans. band
                                          gr.firdes.WIN_HANN)   # filter type
        self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs)


	# Connect the blocks
        #self.connect(self.source, self.correlator)
        #self.connect(self.source, self.rrc_filter)
        #self.connect(self.rrc_filter, self.correlator)

        # connect block input to channel filter
	self.connect(self.source, self.channel_filter)
        self.connect(self.channel_filter, self.correlator)


        #self.connect(self.source, self.correlator)
        self.connect(self.correlator, self.despreader)
        self.connect(self.despreader, self.decoder)
        self.connect(self.decoder, self.crcrx)
        #self.connect(self.decoder, self.printer)
        #self.connect(self.printer, self.crcrx)
        #self.connect(self.despreader, self.printer)
        #self.connect(self.printer, self.nullsink)
        #self.connect(self.printer, self.filesink)
        #self.connect(self.crcrx, self.filesink)
        self.connect(self.crcrx, self.packetrx) 
예제 #2
0
파일: rx.py 프로젝트: randyp1248/darpa
    def __init__(self, options):
        gr.top_block.__init__(self)

        # Source block
        symbol_rate = 500000
        self.source = uhd_receiver(options.args, symbol_rate,
                                   2,
                                   options.rx_freq, 30,
                                   #options.spec, "RX2",
                                   options.spec, "TX/RX",
                                   1) #options.verbose)
        options.samples_per_symbol = self.source._sps


        RX_output_file = "RX_output_test_file"
	_RX_output_file = 'RX_output_test_file'
        #RX_output_file = "Ding_Dong2.wma"
	#_RX_output_file = 'Ding_Dong2.wma'


        RX_file_sink = gr.file_sink(gr.sizeof_char, RX_output_file)
	RX_output_filesize = os.stat(_RX_output_file).st_size
  
        #print RX_output_filesize



        self.filesink = gr.file_sink(1, "output_file")


	# Correlator block
        self.correlator = correlator_cc.correlator_cc()

	# Despreader block
	self.despreader = spreader.despreader_cb()
  
        # RS Decoder block
	self.decoder = rscoding_bb.decode_bb()

        # CRC RX Block
        self.crcrx = crc.crcrx()

	# Print block
	self.printer = print_bb.print_bb()

	# NULL sink block
        self.nullsink = gr.null_sink(1)
 
        # RRC filter
        #nfilts = 32 
        #ntaps = nfilts * 11 * int(options.samples_per_symbol)
        #self.rrc_taps = gr.firdes.root_raised_cosine(
            #1.0, # gain
            #1000000, # sampling rate based on 32 fliters in resampler
            #symbol_rate,    # symbol rate
            #1.0,    # excess bandwidth or roll-off factor
            #ntaps)
        #self.rrc_filter = gr.pfb_arb_resampler_ccf(options.samples_per_symbol, 
        #                                           self.rrc_taps)


        # Design filter to get actual channel we want
        sw_decim = 1
        chan_coeffs = gr.firdes.low_pass (1.0,                  # gain
                                          #sw_decim * self.samples_per_symbol(), # sampling rate
                                          #1000000, # sampling rate
                                          2,
                                          #self._chbw_factor,    # midpoint of trans. band
                                          1,    # midpoint of trans. band
                                          0.5,                  # width of trans. band
                                          gr.firdes.WIN_HANN)   # filter type
        self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs)


	# Connect the blocks
        #self.connect(self.source, self.correlator)
        #self.connect(self.source, self.rrc_filter)
        #self.connect(self.rrc_filter, self.correlator)

        # connect block input to channel filter
	self.connect(self.source, self.channel_filter)
        self.connect(self.channel_filter, self.correlator)


        #self.connect(self.source, self.correlator)
        self.connect(self.correlator, self.despreader)
        self.connect(self.despreader, self.decoder)
        self.connect(self.decoder, self.crcrx)
        #self.connect(self.decoder, self.printer)
        #self.connect(self.printer, self.crcrx)
        #self.connect(self.despreader, self.printer)
        #self.connect(self.printer, self.nullsink)
        #self.connect(self.printer, self.filesink)
        #self.connect(self.crcrx, self.filesink)
        self.connect(self.crcrx, RX_file_sink)