示例#1
0
    def __init__(self, modulator_class, options):
        '''
        See below for what options should hold
        '''
        gr.hier_block2.__init__(self, "transmit_path",
                                gr.io_signature(0, 0, 0),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        options = copy.copy(
            options)  # make a copy so we can destructively modify

        self._verbose = options.verbose
        self._tx_amplitude = options.tx_amplitude  # digital amplitude sent to USRP
        self._bitrate = options.bitrate  # desired bit rate
        self._mod_class = modulator_class  # the modulator_class we are using

        # Get mod_kwargs
        mod_kwargs = self._mod_class.extract_kwargs_from_options(options)

        # Transmitter
        self.modulator = self._mod_class(**mod_kwargs)

        self.packet_transmitter = digital.mod_pkts(self.modulator,
                                                   access_code=None,
                                                   msgq_limit=4)

        self.amp = blocks.multiply_const_cc(1)
        self.set_tx_amplitude(self._tx_amplitude)

        # Display some information about the setup
        #if self._verbose:
        #    self._print_verbage()

        # Connect components in the flowgraph
        self.connect(self.packet_transmitter, self.amp, self)
示例#2
0
    def __init__(self):
        gr.top_block.__init__(self)
        ## Modulator
        self.modulator = digital.qpsk_mod(mod_code="gray",
                                          differential=True,
                                          samples_per_symbol=4,
                                          excess_bw=0.35,
                                          verbose=False,
                                          log=False)

        ## USRP Sink
        self.u = uhd.usrp_sink(device_addr="",
                               stream_args=uhd.stream_args('fc32'))
        self.u.set_samp_rate(500e3)
        self.u.set_center_freq(5.04e9, 0)
        self.u.set_gain(35, 0)
        self.u.set_antenna("TX/RX", 0)

        ## Packet Transmitter
        self.packet_transmitter = digital.mod_pkts(self.modulator,
                                                   access_code=None,
                                                   msgq_limit=4,
                                                   pad_for_usrp=True)

        ## Connects
        self.connect(self.packet_transmitter, self.u)
示例#3
0
    def __init__(self, modulator_class, options):
        '''
        See below for what options should hold
        '''
	gr.hier_block2.__init__(self, "transmit_path",
				gr.io_signature(0,0,0),
				gr.io_signature(1,1,gr.sizeof_gr_complex))
        
        options = copy.copy(options)    # make a copy so we can destructively modify

        self._verbose      = options.verbose
        self._tx_amplitude = options.tx_amplitude   # digital amplitude sent to USRP
        self._bitrate      = options.bitrate        # desired bit rate
        self._modulator_class = modulator_class     # the modulator_class we are using

        # Get mod_kwargs
        mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
        
        # transmitter
	self.modulator = self._modulator_class(**mod_kwargs)
        
        self.packet_transmitter = \
            digital.mod_pkts(self.modulator,
                             access_code=None,
                             msgq_limit=4,
                             pad_for_usrp=True)

        self.amp = gr.multiply_const_cc(1)
        self.set_tx_amplitude(self._tx_amplitude)

        # Display some information about the setup
        if self._verbose:
            self._print_verbage()

        # Connect components in the flowgraph
        self.connect(self.packet_transmitter, self.amp, self)
    def __init__(self, modulator_class, options):
        '''
        See below for what options should hold
        '''
	gr.hier_block2.__init__(self, "transmit_path",
				gr.io_signature(0,0,0),
				gr.io_signature(1,1,gr.sizeof_gr_complex))
        
        options = copy.copy(options)    # make a copy so we can destructively modify

        self._verbose      = options.verbose
        self._tx_amplitude = options.tx_amplitude   # digital amplitude sent to USRP
        self._bitrate      = options.bitrate        # desired bit rate
        self._modulator_class = modulator_class     # the modulator_class we are using

        # Get mod_kwargs
        mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
        
        # transmitter
	self.modulator = self._modulator_class(**mod_kwargs)
        
        self.packet_transmitter = \
            digital.mod_pkts(self.modulator,
                             access_code=None,
                             msgq_limit=4,
                             pad_for_usrp=True)

        self.amp = gr.multiply_const_cc(1)
        self.set_tx_amplitude(self._tx_amplitude)

        # Figure out how to calculate symbol_rate later
        symbol_rate = 5000000

        # Hardcoding rx_freq and rx_gain
	self.source = uhd_receiver(options.args, symbol_rate,
				   options.samples_per_symbol,
				   options.tx_freq-1250000, 30, 
				   options.spec, options.antenna,
				   options.verbose)
	options.samples_per_symbol = self.source._sps

        # Display some information about the setup
        if self._verbose:
            self._print_verbage()

        low_pass_taps = [
	   -0.0401, 
	    0.0663, 
	    0.0468, 
	   -0.0235, 
	   -0.0222, 
	    0.0572, 
	    0.0299, 
	   -0.1001, 
	   -0.0294, 
	    0.3166, 
	    0.5302, 
	    0.3166, 
	   -0.0294, 
	   -0.1001, 
	    0.0299, 
	    0.0572, 
	   -0.0222, 
	   -0.0235, 
	    0.0468, 
	    0.0663,
	   -0.0401]

        high_pass_taps = [
	   -0.0389,
	   -0.0026, 
	    0.0302, 
	    0.0181,
	   -0.0357,
	   -0.0394,
	    0.0450,
	    0.0923,
	   -0.0472,
	   -0.3119,
	    0.5512,
	   -0.3119,
	   -0.0472,
	    0.0923,
	    0.0450,
	   -0.0394,
	   -0.0357,
	    0.0181,
	    0.0302,
	   -0.0026,
	   -0.0389]

        # Carrier Sensing Blocks
        alpha = 0.001
        thresh = 30   # in dB, will have to adjust
        self.probe_lp = gr.probe_avg_mag_sqrd_c(thresh,alpha)
        self.probe_hp = gr.probe_avg_mag_sqrd_c(thresh,alpha)

        self.lp = gr.fft_filter_ccc(65536, low_pass_taps)
        self.hp = gr.fft_filter_ccc(65536, high_pass_taps)

        self.connect(self.source, self.lp)
        self.connect(self.lp, self.probe_lp)

        self.connect(self.source, self.hp)
        self.connect(self.hp, self.probe_hp)

        # Connect components in the flowgraph
        self.connect(self.packet_transmitter, self.amp, self)