def __init__(self, options, payload=''): gr.top_block.__init__(self) if (options.tx_freq is not None): self.sink = uhd_transmitter(options.args, options.bandwidth, options.tx_freq, options.tx_gain, options.spec, options.antenna, options.verbose) elif (options.to_file is not None): self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) else: self.sink = gr.null_sink(gr.sizeof_gr_complex) options.interp = 100e6 / options.bandwidth # FTW-specific convertion # do this after for any adjustments to the options that may # occur in the sinks (specifically the UHD sink) if (options.from_file is None): self.txpath = ftw_transmit_path(options, payload) else: self.txpath = gr.file_source(gr.sizeof_gr_complex, options.from_file) # options.tx_amplitude = 1 # static value to make sure we do not exceed +-1 for the floats being sent to the sink self._tx_amplitude = options.tx_amplitude self.amp = gr.multiply_const_cc(self._tx_amplitude) # self.txpath = ftw_pnc_transmit_path(options, payload) self.connect(self.txpath, self.amp, self.sink) if options.log: self.connect( self.txpath, gr.file_sink(gr.sizeof_gr_complex, 'ftw_benchmark.dat'))
def __init__(self, options, payload=''): gr.top_block.__init__(self) if(options.tx_freq is not None): self.sink = uhd_transmitter(options.args, options.bandwidth, options.tx_freq, options.tx_gain, options.spec, options.antenna, options.verbose) elif(options.to_file is not None): self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) else: self.sink = gr.null_sink(gr.sizeof_gr_complex) options.interp = 100e6/options.bandwidth # FTW-specific convertion # do this after for any adjustments to the options that may # occur in the sinks (specifically the UHD sink) if(options.from_file is None): self.txpath = ftw_transmit_path(options, payload) else: self.txpath = gr.file_source(gr.sizeof_gr_complex, options.from_file); # options.tx_amplitude = 1 # static value to make sure we do not exceed +-1 for the floats being sent to the sink self._tx_amplitude = options.tx_amplitude self.amp = gr.multiply_const_cc(self._tx_amplitude) # self.txpath = ftw_pnc_transmit_path(options, payload) self.connect(self.txpath, self.amp, self.sink) if options.log: self.connect(self.txpath, gr.file_sink(gr.sizeof_gr_complex, 'ftw_benchmark.dat'))
def __init__(self, options): gr.top_block.__init__(self) #self._interface = options.interface # Logical network interface #self._mac_addr = options.mac_addr # USRP2 MAC address self._tx_freq = options.freq # Center frequency #self._interp = options.interp # Interpolation factor self._gain = options.txgain # Tx gain self._bw = options.bandwidth # interpolation factor self.args = options.args self._ant = options.antenna self._spec = options.spec # setup sink and connect output of transmit path to it self.u = uhd.usrp_sink(device_addr=self.args, stream_args=uhd.stream_args('fc32')) if(self._spec): self.u.set_subdev_spec(self._spec, 0) # Set the antenna if(self._ant): self.u.set_antenna(self._ant, 0) self.u.set_gain(self._gain) self.set_freq(self._tx_freq) self.rate = self.u.set_samp_rate(self._bw) self.txpath = ftw_transmit_path(options) self.connect(self.txpath, self.u) # write final baseband signal to disk if options.log: self.connect(self.txpath, gr.file_sink(gr.sizeof_gr_complex, "final.dat"))
def __init__(self, options, payload=''): gr.top_block.__init__(self) self._interface = options.interface # logical network interface self._mac_addr = options.mac_addr # MAC address self._tx_freq = options.freq # center frequency self._interp = options.interp # interpolation factor self._gain = options.gain # Tx gain # setup sink and connect output of transmitpath to it self._setup_usrp_sink() self.txpath = ftw_transmit_path(options, payload) self.connect(self.txpath, self.u) # write final baseband signal to disk if options.log: self.connect(self.txpath, gr.file_sink(gr.sizeof_gr_complex, "final.dat"))
def __init__(self, options): gr.top_block.__init__(self) #self._interface = options.interface # Logical network interface #self._mac_addr = options.mac_addr # USRP2 MAC address self._tx_freq = options.freq # Center frequency #self._interp = options.interp # Interpolation factor self._gain = options.txgain # Tx gain self._bw = options.bandwidth # interpolation factor self.args = options.args self._ant = options.antenna self._spec = options.spec # setup sink and connect output of transmit path to it self.u = uhd.usrp_sink(device_addr=self.args, stream_args=uhd.stream_args('fc32')) if (self._spec): self.u.set_subdev_spec(self._spec, 0) # Set the antenna if (self._ant): self.u.set_antenna(self._ant, 0) self.u.set_gain(self._gain) self.set_freq(self._tx_freq) self.rate = self.u.set_samp_rate(self._bw) self.txpath = ftw_transmit_path(options) self.connect(self.txpath, self.u) # write final baseband signal to disk if options.log: self.connect(self.txpath, blocks.file_sink(gr.sizeof_gr_complex, "final.dat"))