def __init__(self, rx_callback, options): gr.hier_block2.__init__(self, "receive_path", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(0, 0, 0)) options = copy.copy(options) # make a copy so we can destructively modify self._verbose = options.verbose self._log = options.log self._rx_callback = rx_callback # this callback is fired when there's a packet available # receiver self.ofdm_rx = digital.ofdm_demod(options, callback=self._rx_callback) # Carrier Sensing Blocks alpha = 0.001 thresh = 30 # in dB, will have to adjust self.probe = analog.probe_avg_mag_sqrd_c(thresh,alpha) self.connect(self, self.ofdm_rx) self.connect(self.ofdm_rx, self.probe) # Display some information about the setup if self._verbose: self._print_verbage()
class receive_path(gr.hier_block2): def __init__(self, rx_callback, options): gr.hier_block2.__init__(self, "receive_path", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(1, 1, gr.sizeof_float * 1)) options = copy.copy( options) # make a copy so we can destructively modify self._verbose = options.verbose self._log = options.log self._rx_callback = rx_callback # this callback is fired when there's a packet available self.variable_function_probe_0 = variable_function_probe_0 = 0 #self.samp_rate = samp_rate = 640000 self.blocks_probe_signal_x_0 = blocks.probe_signal_f() def _variable_function_probe_0_probe(): while True: val = self.blocks_probe_signal_x_0.level() try: self.set_variable_function_probe_0(val) except AttributeError, e: pass time.sleep(1.0 / (1000000)) _variable_function_probe_0_thread = threading.Thread( target=_variable_function_probe_0_probe) _variable_function_probe_0_thread.daemon = True _variable_function_probe_0_thread.start() self.featuredetect_0 = featuredetect(collectingtime=1, ) # receiver self.ofdm_rx = digital.ofdm_demod(options, callback=self._rx_callback) # Carrier Sensing Blocks alpha = 1 # the time interval of collecting data thresh = 30 # in dB, will have to adjust self.probe = analog.probe_avg_mag_sqrd_c(thresh, alpha) self.csprobe = analog.probe_avg_mag_sqrd_c(25, alpha) self.connect((self, 0), self.ofdm_rx) self.connect(self.ofdm_rx, self.probe) self.connect((self, 0), (self.featuredetect_0, 0)) self.connect((self.featuredetect_0, 0), (self.blocks_probe_signal_x_0, 0)) self.connect((self.featuredetect_0, 0), (self, 0)) # Display some information about the setup if self._verbose: self._print_verbage()
def _build(self, callback, input_signature, output_signature): """ Implementation of UHDRxPktArch abstract method. @param callback Function called when a packet is received. @param input_signature A gr.io_signature instance. @param output_signature A gr.io_signature instance. """ return digital.ofdm_demod(options=grc_blks2.options(modulation="qam64", fft_length=512, occupied_tones=200, cp_length=128, snr=30, log=None, verbose=None, ), callback=callback)
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 = 10e6 ################################################## # Blocks ################################################## self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate) self.gr_file_source_0 = gr.file_source( gr.sizeof_gr_complex * 1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/received_p.txt", True) self.gr_file_sink_0 = gr.file_sink( gr.sizeof_char * 1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/output.txt") self.gr_file_sink_0.set_unbuffered(False) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b( digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.digital_ofdm_demod_0, 0))
def __init__(self, rx_callback, options): gr.hier_block2.__init__(self, "receive_path", gr.io_signature(1, 1, gr.sizeof_gr_complex), gr.io_signature(0, 0, 0)) options = copy.copy(options) # make a copy so we can destructively modify self._verbose = options.verbose self._log = options.log self._rx_callback = rx_callback # this callback is fired when there's a packet available # receiver self.ofdm_rx = digital.ofdm_demod(options, callback=self._rx_callback) self.connect(self, self.ofdm_rx) self.connect(self.ofdm_rx, self.probe) # Display some information about the setup if self._verbose: self._print_verbage()
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 = 10e6 ################################################## # Blocks ################################################## self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/received_p.txt", True) self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/home/traviscollins/git/BLISS/GNURadio/OFDM/output.txt") self.gr_file_sink_0.set_unbuffered(False) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ), ) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.digital_ofdm_demod_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Ofdmqam") _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 self.ampNoise = ampNoise = 0 ################################################## # Blocks ################################################## _ampNoise_sizer = wx.BoxSizer(wx.VERTICAL) self._ampNoise_text_box = forms.text_box( parent=self.GetWin(), sizer=_ampNoise_sizer, value=self.ampNoise, callback=self.set_ampNoise, label='ampNoise', converter=forms.float_converter(), proportion=0, ) self._ampNoise_slider = forms.slider( parent=self.GetWin(), sizer=_ampNoise_sizer, value=self.ampNoise, callback=self.set_ampNoise, minimum=0, maximum=100, num_steps=1, style=wx.SL_VERTICAL, cast=float, proportion=1, ) self.Add(_ampNoise_sizer) 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="FFT Transmissao", peak_hold=False, ) self.GridAdd(self.wxgui_fftsink2_0.win, 1, 1, 1, 1) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f( digital.ofdm_mod(options=grc_blks2.options( modulation="bpsk", fft_length=64, occupied_tones=52, cp_length=16, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f( digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=64, occupied_tones=52, cp_length=16, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1, samp_rate) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_float * 1, "/home/luan/Documentos/GNU/ofdmQamLuan_TxRx_File/lena_Tx.jpeg", True) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_float * 1, "/home/luan/Documentos/GNU/ofdmQamLuan_TxRx_File/lena_Rx.jpeg", False) self.blocks_file_sink_0.set_unbuffered(False) self.blocks_add_xx_0 = blocks.add_vcc(1) self.analog_noise_source_x_0 = analog.noise_source_c( analog.GR_GAUSSIAN, ampNoise, 0) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_mod_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_0, 1)) self.connect((self.blocks_file_source_0, 0), (self.digital_ofdm_mod_0, 0)) self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_add_xx_0, 0), (self.digital_ofdm_demod_0, 0))
def __init__(self): gr.top_block.__init__(self, "QAM16") Qt.QWidget.__init__(self) self.setWindowTitle("QAM16") self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) 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) ################################################## # Variables ################################################## self.variable_qtgui_range_0 = variable_qtgui_range_0 = 474e6 self.samp_rate = samp_rate = 44100 self.Useful_Carriers = Useful_Carriers = 1024 self.Transmission_Frequency = Transmission_Frequency = 474e6 self.OFDM_Symbols = OFDM_Symbols = 2048 self.Guard_Interval = Guard_Interval = 4 self.Gain = Gain = 20 self.Packets_Number = 2048 ################################################## # My code... print(atsc.ATSC_MPEG_PKT_LENGTH); print(atsc.MPEG_SYNC_BYTE); self.ts = self.make_fake_transport_stream_packet(self.Packets_Number) # make 2048 packets of 188 each one. print(len(self.ts)) ################################################## ################################################## # Blocks ################################################## self._variable_qtgui_range_0_layout = Qt.QVBoxLayout() self._variable_qtgui_range_0_tool_bar = Qt.QToolBar(self) self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_tool_bar) self._variable_qtgui_range_0_tool_bar.addWidget(Qt.QLabel("Transmission_Frequency"+": ")) self._variable_qtgui_range_0_counter = Qwt.QwtCounter() self._variable_qtgui_range_0_counter.setRange(470e6, 478e6, 1e3) self._variable_qtgui_range_0_counter.setNumButtons(2) self._variable_qtgui_range_0_counter.setValue(self.variable_qtgui_range_0) self._variable_qtgui_range_0_tool_bar.addWidget(self._variable_qtgui_range_0_counter) self._variable_qtgui_range_0_counter.valueChanged.connect(self.set_variable_qtgui_range_0) self._variable_qtgui_range_0_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot) self._variable_qtgui_range_0_slider.setRange(470e6, 478e6, 1e3) self._variable_qtgui_range_0_slider.setValue(self.variable_qtgui_range_0) self._variable_qtgui_range_0_slider.setMinimumWidth(200) self._variable_qtgui_range_0_slider.valueChanged.connect(self.set_variable_qtgui_range_0) self._variable_qtgui_range_0_layout.addWidget(self._variable_qtgui_range_0_slider) self.top_layout.addLayout(self._variable_qtgui_range_0_layout) self.qtgui_sink_x_0 = qtgui.sink_c( OFDM_Symbols, #fftsize firdes.WIN_BLACKMAN_hARRIS, #wintype Transmission_Frequency, #fc 8e6, #bw "QT GUI Plot", #name True, #plotfreq False, #plotwaterfall True, #plottime False, #plotconst ) self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_sink_x_0_win) self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate) #self.gr_file_source_0 = gr.file_source(gr.sizeof_float*1, "/home/katsikas/katsikas-repo/Gnuradio/Common/Text.txt", True) self.gr_vector_source_0 = gr.vector_source_f(self.ts, True, 1) self.gr_file_sink_0 = gr.file_sink(gr.sizeof_float*1, "/home/katsikas/katsikas-repo/Gnuradio/Common/Results.txt") self.gr_file_sink_0.set_unbuffered(False) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(digital.ofdm_mod( options=grc_blks2.options( modulation="qam64", fft_length=OFDM_Symbols, occupied_tones=Useful_Carriers, cp_length=OFDM_Symbols/Guard_Interval, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(digital.ofdm_demod( options=grc_blks2.options( modulation="qam64", fft_length=OFDM_Symbols, occupied_tones=Useful_Carriers, cp_length=OFDM_Symbols/Guard_Interval, snr=20, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ), ) ################################################## # Connections ################################################## self.connect((self.gr_throttle_0, 0), (self.qtgui_sink_x_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.gr_throttle_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.digital_ofdm_demod_0, 0)) #self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0)) self.connect((self.gr_vector_source_0, 0), (self.digital_ofdm_mod_0, 0)) self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Video Receiver") _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 = 1000000 self.variable_slider_0 = variable_slider_0 = 50 self.freq_slider = freq_slider = 4900e6 self.freq = freq = 2450e6 self.FILT_0 = FILT_0 = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76) self.FILT = FILT = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76) ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=90e6, 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) _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='variable_slider_0', 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) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(90e6, 0) self.uhd_usrp_source_0.set_gain(15, 0) self.uhd_usrp_source_0.set_antenna("J2", 0) _freq_slider_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_slider_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_slider_sizer, value=self.freq_slider, callback=self.set_freq_slider, label='freq_slider', converter=forms.float_converter(), proportion=0, ) self._freq_slider_slider = forms.slider( parent=self.GetWin(), sizer=_freq_slider_sizer, value=self.freq_slider, callback=self.set_freq_slider, minimum=2450e6, maximum=5000e6, num_steps=10, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_slider_sizer) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod( options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ), ) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/csc773/vid1.ts", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_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 = 10000000 ################################################## # 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.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="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.random_source_x_0 = gr.vector_source_b( map(int, numpy.random.randint(0, 2, 1000)), True) self.gr_vector_to_stream_0 = gr.vector_to_stream( gr.sizeof_gr_complex * 1, 512) self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate) self.gr_sub_xx_0 = gr.sub_cc(512) self.gr_stream_to_vector_0 = gr.stream_to_vector( gr.sizeof_gr_complex * 1, 512) self.gr_file_source_1 = gr.file_source( gr.sizeof_gr_complex * 512, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt", True) self.gr_file_source_0 = gr.file_source( gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt", True) self.gr_file_sink_0 = gr.file_sink( gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt" ) self.gr_file_sink_0.set_unbuffered(False) self.gr_add_xx_0 = gr.add_vcc(1) self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)), True, 1) self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)), True, 1) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f( digital.ofdm_mod(options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f( digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2, excess_bw=0.35, gray_coded=True, verbose=False, log=False) ################################################## # Connections ################################################## self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0)) self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.random_source_x_0, 0), (self.digital_dxpsk_mod_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0)) self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1)) self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0)) self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0)) self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1)) self.connect((self.gr_vector_to_stream_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.gr_vector_to_stream_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0)) self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0)) self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_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 = 10000000 ################################################## # 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.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="FFT Plot", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True) self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex * 1, 512) self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate) self.gr_sub_xx_0 = gr.sub_cc(512) self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex * 1, 512) self.gr_file_source_1 = gr.file_source( gr.sizeof_gr_complex * 512, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt", True ) self.gr_file_source_0 = gr.file_source( gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt", True ) self.gr_file_sink_0 = gr.file_sink( gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt" ) self.gr_file_sink_0.set_unbuffered(False) self.gr_add_xx_0 = gr.add_vcc(1) self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)), True, 1) self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)), True, 1) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f( digital.ofdm_mod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ) ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f( digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ) ) self.digital_dxpsk_mod_0 = digital.dbpsk_mod( samples_per_symbol=2, excess_bw=0.35, gray_coded=True, verbose=False, log=False ) ################################################## # Connections ################################################## self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0)) self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0)) self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0)) self.connect((self.random_source_x_0, 0), (self.digital_dxpsk_mod_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0)) self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1)) self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0)) self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0)) self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1)) self.connect((self.gr_vector_to_stream_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.gr_vector_to_stream_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0)) self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0)) self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter Loopback") _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 = 5000 self.samp_rate = samp_rate = 384000 self.rfgain = rfgain = 0 self.freq = freq = 12e6 ################################################## # 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=32e6, 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='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=50, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_rfgain_sizer) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b( digital.ofdm_mod(options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b( digital.ofdm_demod( options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate, True) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_char * 1, "/home/ece775/video1.ts", True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, "/home/ece775/sink.ts", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.digital_ofdm_mod_0, 0))
def __init__(self): gr.top_block.__init__(self, "Ofdm_Usrp_Rx") Qt.QWidget.__init__(self) self.setWindowTitle("Ofdm_Usrp_Rx") 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", "ofdmUsrpRx") self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables ################################################## self.usrp_freq = usrp_freq = 474e6 self.samp_rate = samp_rate = 1000000 ################################################## # Blocks ################################################## self.uhd_usrp_source_0 = uhd.usrp_source( ",".join(("", "")), uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(usrp_freq, 0) self.uhd_usrp_source_0.set_gain(10, 0) 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(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_layout.addWidget(self._qtgui_freq_sink_x_0_win) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f( digital.ofdm_demod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_float * 1, "/home/alunos/Documentos/ofdm_Usrp_Luan/file_Rx.txt", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_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 = 150000 ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=60000, 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_source_0 = uhd.usrp_source( device_addr="serial=4925e275", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(60000, 0) self.uhd_usrp_source_0.set_gain(0, 0) self.uhd_usrp_source_0.set_bandwidth(10000, 0) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_c(digital.ofdm_demod( options=grc_blks2.options( modulation="qpsk", fft_length=1024, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ), ) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/capstone/output") self.blocks_file_sink_0.set_unbuffered(True) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Video Receiver") _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 = 1000000 self.variable_slider_0 = variable_slider_0 = 50 self.freq_slider = freq_slider = 4900e6 self.freq = freq = 2450e6 self.FILT_0 = FILT_0 = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76) self.FILT = FILT = firdes.low_pass(1, samp_rate, 10000, 1000, firdes.WIN_HAMMING, 6.76) ################################################## # Blocks ################################################## self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=90e6, 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) _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='variable_slider_0', 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) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", otw_format="sc16", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(90e6, 0) self.uhd_usrp_source_0.set_gain(15, 0) self.uhd_usrp_source_0.set_antenna("J2", 0) _freq_slider_sizer = wx.BoxSizer(wx.VERTICAL) self._freq_slider_text_box = forms.text_box( parent=self.GetWin(), sizer=_freq_slider_sizer, value=self.freq_slider, callback=self.set_freq_slider, label='freq_slider', converter=forms.float_converter(), proportion=0, ) self._freq_slider_slider = forms.slider( parent=self.GetWin(), sizer=_freq_slider_sizer, value=self.freq_slider, callback=self.set_freq_slider, minimum=2450e6, maximum=5000e6, num_steps=10, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_freq_slider_sizer) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b( digital.ofdm_demod( options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0. recv_pkt(ok, payload), ), ) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1, "/home/csc773/vid1.ts", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Video Transmitter Loopback") _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 = 5000 self.samp_rate = samp_rate = 384000 self.rfgain = rfgain = 0 self.freq = freq = 12e6 ################################################## # 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=32e6, 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='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=50, num_steps=100, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_rfgain_sizer) self.digital_ofdm_mod_0 = grc_blks2.packet_mod_b(digital.ofdm_mod( options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) self.digital_ofdm_demod_0 = grc_blks2.packet_demod_b(digital.ofdm_demod( options=grc_blks2.options( modulation="qpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None, ), callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload), ), ) self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_char*1, samp_rate,True) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/ece775/video1.ts", True) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/ece775/sink.ts", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.digital_ofdm_demod_0, 0), (self.blocks_file_sink_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0_0, 0)) self.connect((self.digital_ofdm_mod_0, 0), (self.digital_ofdm_demod_0, 0)) self.connect((self.blocks_throttle_0_0, 0), (self.digital_ofdm_mod_0, 0))