예제 #1
0
     def __init__(self):
         gr.top_block.__init__(self)     # otra vez la herencia		
		
         sample_rate = 32000
	 
	 fftsize = 2048

	 ampl = 10
 
         self.sin0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 1000, ampl)
         self.sin1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 1500, ampl)
	 play = audio.sink(sample_rate, "")

	 self.add = blocks.add_ff()
         self.thr = blocks.throttle(4, sample_rate, True)
         self.snk = qtgui.sink_f(
 	    fftsize, #fftsize
            firdes.WIN_BLACKMAN_hARRIS, #wintype
            0, #fc
            sample_rate, #bw
            "", #name
            True, #plotfreq
            True, #plotwaterfall
            True, #plottime
            True, #plotconst
	 )
	 
         self.connect(self.sin0, (play, 0))
         self.connect(self.sin1, (play, 1))
  	 self.connect(self.sin0, (self.add, 0))
         self.connect(self.sin1, (self.add, 1))
         self.connect(self.add, self.thr, self.snk)

	 self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
         self.pyobj.show()
예제 #2
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

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(False)

        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
예제 #3
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 = 384000

        ##################################################
        # Blocks
        ##################################################
        self.sdrstick_sdrstick_source_s_0 = sdrstick.sdrstick_source_s(gr.sizeof_short*1, "192.168.1.200", "192.168.1.26", 8001, 1)
        self.sdrstick_sdrstick_source_s_0.set_freq(1580000)
            
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	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.set_update_time(1.0/10)
        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.blocks_short_to_float_0 = blocks.short_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.sdrstick_sdrstick_source_s_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.qtgui_sink_x_0, 0))
예제 #4
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 = 80000
        self.test1_dds_fpga_0 = test1.dds_fpga(8192 * 2, "/dev/iqram")
        ##################################################
        # Blocks
        ##################################################
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate,
            audio_decimation=5,
        )

        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / 5,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1)
        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)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.test1_dds_fpga_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_sink_x_0, 0))
예제 #5
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 = 80000
	self.test1_dds_fpga_0 = test1.dds_fpga(8192*2, "/dev/iqram")
        ##################################################
        # Blocks
        ##################################################
	self.analog_wfm_rcv_0 = analog.wfm_rcv(
		quad_rate=samp_rate,
		audio_decimation=5,
	)        

	self.qtgui_sink_x_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate/5, #bw
        	"QT GUI Plot", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1)
        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)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.test1_dds_fpga_0, 0), (self.analog_wfm_rcv_0, 0))
	self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_sink_x_0, 0))	
예제 #6
0
	def init_sink(self):
		if args.output_dir:
			self.logfiles = {}
			logdirpath = os.path.join(args.output_dir, 'unknown-frequency.log')
			self.logfiles['unknown'] = open(logdirpath, 'w+')
			self.push_text('All messages will be saved in "%s". One file for each frequency.'
					% args.output_dir)
		self.topblock.stop()
		self.topblock.wait()
		self.enable_selector_buttons(False)
		#
		# Source/premodulation
		#
		# Create the selector and connect the source to it
		self.sel_c = stream_selector(3, gr.sizeof_gr_complex)
		self.topblock.connect(self.topblock.source, (self.sel_c.ss, 0))
		self.srcsink.source_source_radio.setEnabled(True)
		self.sel_c.set_output(0)
		# Add the sink
		self.srcsink.grsink = qtgui.sink_c(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
			self.topblock.source.get_center_freq(), self.topblock.source.get_sample_rate(),
			"Source Signal", True, True, True, False)
		self.srcsink.grsink.set_update_time(0.1)
		self.topblock.connect(self.sel_c.ss, self.srcsink.grsink)
		self.srcsink.sink = sip.wrapinstance(self.srcsink.grsink.pyqwidget(), QtGui.QWidget)
		self.srcsink.horizontalLayout.addWidget(self.srcsink.sink)
		# add a button group for the radio buttons
		self.waveselc = QtGui.QButtonGroup(self.srcsink.verticalLayout)
		self.waveselc.addButton(self.srcsink.source_source_radio, 0)
		self.waveselc.addButton(self.srcsink.source_xlating_radio, 1)
		self.waveselc.addButton(self.srcsink.source_interpolator_radio, 2)
		self.waveselc.buttonClicked[int].connect(self.waveselc_toggled)
		self.srcsink.source_source_radio.setChecked(True)
		#
		# Demodulation
		#
		# Add the sink
		self.sel_f = stream_selector(4, gr.sizeof_float)
		self.sel_f.set_output(0)
		self.demodsink.grsink = qtgui.sink_f(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
			0, self.args.symrate * SPS, "Demodulated Signal", True, True, True, False)
		self.demodsink.grsink.set_update_time(0.1)
		self.topblock.connect(self.sel_f.ss, self.demodsink.grsink)
		self.demodsink.sink = sip.wrapinstance(self.demodsink.grsink.pyqwidget(), QtGui.QWidget)
		self.demodsink.horizontalLayout.addWidget(self.demodsink.sink)
		# Add the button group
		self.waveself = QtGui.QButtonGroup(self.demodsink.verticalLayout)
		self.waveself.addButton(self.demodsink.demodulation_quaddemod_radio, 0)
		self.waveself.addButton(self.demodsink.demodulation_lowpass_radio, 1)
		self.waveself.addButton(self.demodsink.demodulation_clockrecovery_radio, 2)
		self.waveself.addButton(self.demodsink.demodulation_bits_radio, 3)
		self.waveself.buttonClicked[int].connect(self.waveself_toggled)
		self.demodsink.demodulation_quaddemod_radio.setChecked(True)
		#
		self.topblock.start()
예제 #7
0
	def init_sink(self):
		self.topblock.stop()
		self.topblock.wait()
		self.enable_selector_buttons(False)
		#
		# Source/premodulation
		#
		# Create the selector and connect the source to it
		self.sel_c = stream_selector(3, gr.sizeof_gr_complex)
		self.topblock.connect(self.topblock.source, (self.sel_c.ss, 0))
		self.srcsink.source_source_radio.setEnabled(True)
		self.sel_c.set_output(0)
		# Add the sink
		self.srcsink.grsink = qtgui.sink_c(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
			self.topblock.source.get_center_freq(), self.topblock.source.get_sample_rate(),
			"Source Signal", True, True, True, False)
		self.srcsink.grsink.set_update_time(0.1)
		self.topblock.connect(self.sel_c.ss, self.srcsink.grsink)
		self.srcsink.sink = sip.wrapinstance(self.srcsink.grsink.pyqwidget(), QtGui.QWidget)
		self.srcsink.horizontalLayout.addWidget(self.srcsink.sink)
		# add a button group for the radio buttons
		self.waveselc = QtGui.QButtonGroup(self.srcsink.verticalLayout)
		self.waveselc.addButton(self.srcsink.source_source_radio, 0)
		self.waveselc.addButton(self.srcsink.source_xlating_radio, 1)
		self.waveselc.addButton(self.srcsink.source_interpolator_radio, 2)
		self.waveselc.buttonClicked[int].connect(self.waveselc_toggled)
		self.srcsink.source_source_radio.setChecked(True)
		#
		# Demodulation
		#
		# Add the sink
		self.sel_f = stream_selector(4, gr.sizeof_float)
		self.sel_f.set_output(0)
		self.demodsink.grsink = qtgui.sink_f(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
			0, self.args.symrate * SPS, "Demodulated Signal", True, True, True, False)
		self.demodsink.grsink.set_update_time(0.1)
		self.topblock.connect(self.sel_f.ss, self.demodsink.grsink)
		self.demodsink.sink = sip.wrapinstance(self.demodsink.grsink.pyqwidget(), QtGui.QWidget)
		self.demodsink.horizontalLayout.addWidget(self.demodsink.sink)
		# Add the button group
		self.waveself = QtGui.QButtonGroup(self.demodsink.verticalLayout)
		self.waveself.addButton(self.demodsink.demodulation_quaddemod_radio, 0)
		self.waveself.addButton(self.demodsink.demodulation_lowpass_radio, 1)
		self.waveself.addButton(self.demodsink.demodulation_clockrecovery_radio, 2)
		self.waveself.addButton(self.demodsink.demodulation_bits_radio, 3)
		self.waveself.buttonClicked[int].connect(self.waveself_toggled)
		self.demodsink.demodulation_quaddemod_radio.setChecked(True)
		#
		self.topblock.start()
예제 #8
0
    def __init__(self):
        gr.top_block.__init__(self)

        ################################################
        ###   EL FLUJOGRAMA                          ###
        ################################################

        # Las variables
        samp_rate = 32000
        fftsize = 2048
        ampl = 8

        # Los bloques
        self.src0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 350,
                                        ampl)
        self.src1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 440,
                                        ampl)
        self.dst = audio.sink(samp_rate, "")
        #self.nse = analog.noise_source_c(analog.GR_GAUSSIAN, 0.1)
        self.add = blocks.add_ff(vlen=1)
        self.thr = blocks.throttle(4, samp_rate, True)
        self.snk = qtgui.sink_f(
            fftsize,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )

        # Las conexiones
        self.connect(self.src0, (self.dst, 0))
        self.connect(self.src1, (self.dst, 1))
        self.connect(self.src0, (self.add, 0))
        self.connect(self.src1, (self.add, 1))
        self.connect(self.add, self.thr, self.snk)

        # La configuracion para graficar
        self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
        self.pyobj.show()
예제 #9
0
    def __init__(self):
        gr.top_block.__init__(self)

        Rs = 8000
        f1 = 1000
        f2 = 2000

        fftsize = 2048

        self.qapp = QtGui.QApplication(sys.argv)

        src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
        src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
        src  = blocks.add_ff()
        thr = blocks.throttle(gr.sizeof_float, 100*fftsize)
        noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001)
        add = blocks.add_ff()
        self.snk1 = qtgui.sink_f(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS,
                                 0, Rs,
                                 "Float Signal Example",
                                 True, True, True, False)

        self.connect(src1, (src,0))
        self.connect(src2, (src,1))
        self.connect(src, thr, (add,0))
        self.connect(noise, (add,1))
        self.connect(add, self.snk1)

        self.ctrl_win = control_box()
        self.ctrl_win.attach_signal1(src1)
        self.ctrl_win.attach_signal2(src2)

        # Get the reference pointer to the SpectrumDisplayForm QWidget
        pyQt  = self.snk1.pyqwidget()

        # Wrap the pointer as a PyQt SIP object
        # This can now be manipulated as a PyQt4.QtGui.QWidget
        pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)

        self.main_box = dialog_box(pyWin, self.ctrl_win)

        self.main_box.show()
    def __init__(self):
        gr.top_block.__init__(self)

        Rs = 8000
        f1 = 1000
        f2 = 2000

        fftsize = 2048

        self.qapp = QtWidgets.QApplication(sys.argv)

        src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
        src2 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
        src  = blocks.add_ff()
        thr = blocks.throttle(gr.sizeof_float, 100*fftsize)
        noise = analog.noise_source_f(analog.GR_GAUSSIAN, 0.001)
        add = blocks.add_ff()
        self.snk1 = qtgui.sink_f(fftsize, filter.firdes.WIN_BLACKMAN_hARRIS,
                                 0, Rs,
                                 "Float Signal Example",
                                 True, True, True, False, None)

        self.connect(src1, (src,0))
        self.connect(src2, (src,1))
        self.connect(src, thr, (add,0))
        self.connect(noise, (add,1))
        self.connect(add, self.snk1)

        self.ctrl_win = control_box()
        self.ctrl_win.attach_signal1(src1)
        self.ctrl_win.attach_signal2(src2)

        # Get the reference pointer to the SpectrumDisplayForm QWidget
        pyQt  = self.snk1.pyqwidget()

        # Wrap the pointer as a PyQt SIP object
        # This can now be manipulated as a PyQt5.QtWidgets.QWidget
        pyWin = sip.wrapinstance(pyQt, QtWidgets.QWidget)

        self.main_box = dialog_box(pyWin, self.ctrl_win)

        self.main_box.show()
예제 #11
0
 def __init__(self):
     gr.top_block.__init__(self)
     
     fftsize = 2048
     
     ampl = 1
     
     self.rand = analog.noise_source_f(analog.GR_GAUSSIAN, ampl, 0)
     self.snk = qtgui.sink_f(
         fftsize,
         firdes.WIN_BLACKMAN_hARRIS,
         0,
         32000,
         "",
         True,
         True,
         True,
         True,
     )
     self.connect(self.rand, self.snk)
     
     self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
     self.pyobj.show()
예제 #12
0
    def __init__(self):
        gr.top_block.__init__(self)
        self.qapp = Qt.QApplication(sys.argv)

        sample_rate = 32000
        samp_rate = 16e3
        fftsize = 2048
	ampl = 0.1
        self.src0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 350, ampl)
        self.src1 = analog.noise_source_f(analog.GR_GAUSSIAN, ampl)
        self.dst = audio.sink(sample_rate, "")
        self.add = blocks.add_ff()
        self.thr = blocks.throttle(gr.sizeof_gr_complex, samp_rate, True)

        self.snk = qtgui.sink_f(fftsize,firdes.WIN_BLACKMAN_hARRIS,0,samp_rate,"",True,True,True,True)

        self.connect(self.src0, (self.dst, 0))
        self.connect(self.src1, (self.dst, 1))
        self.connect(self.src0, (self.add, 0))
        self.connect(self.src1, (self.add, 1))
        self.connect(self.add, self.snk)
        # Se establece como deseamos ver los resultados graficos
        self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), Qt.QWidget)
        self.pyobj.show()
예제 #13
0
    def __init__(self):
        gr.top_block.__init__(self, "QO-100 ssb and CW resever")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("QO-100 ssb and CW resever")
        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", "qo_100_ssb_cw_rx")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.variable_slider_1 = variable_slider_1 = 0.01
        self.variable_slider_0 = variable_slider_0 = 11.5e3
        self.variable_chooser_0 = variable_chooser_0 = 0
        self.samp_rate = samp_rate = 1.2e6

        ##################################################
        # Blocks
        ##################################################
        self._variable_slider_1_range = Range(0, 1, 0.1, 0.01, 200)
        self._variable_slider_1_win = RangeWidget(
            self._variable_slider_1_range, self.set_variable_slider_1,
            'Audio gain', "counter_slider", float)
        self.top_grid_layout.addWidget(self._variable_slider_1_win)
        self._variable_slider_0_range = Range(-24e3, 24e3, 1, 11.5e3, 200)
        self._variable_slider_0_win = RangeWidget(
            self._variable_slider_0_range, self.set_variable_slider_0,
            'Frequency', "counter_slider", float)
        self.top_grid_layout.addWidget(self._variable_slider_0_win)
        # Create the options list
        self._variable_chooser_0_options = (
            0,
            1,
            2,
            3,
        )
        # Create the labels list
        self._variable_chooser_0_labels = (
            '900',
            '500',
            '200',
            'SSB (2.7khz)',
        )
        # Create the combo box
        # Create the radio buttons
        self._variable_chooser_0_group_box = Qt.QGroupBox('Filter - CW' + ": ")
        self._variable_chooser_0_box = Qt.QVBoxLayout()

        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)

            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)

        self._variable_chooser_0_button_group = variable_chooser_button_group()
        self._variable_chooser_0_group_box.setLayout(
            self._variable_chooser_0_box)
        for i, _label in enumerate(self._variable_chooser_0_labels):
            radio_button = Qt.QRadioButton(_label)
            self._variable_chooser_0_box.addWidget(radio_button)
            self._variable_chooser_0_button_group.addButton(radio_button, i)
        self._variable_chooser_0_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._variable_chooser_0_button_group, "updateButtonChecked",
            Qt.Q_ARG("int", self._variable_chooser_0_options.index(i)))
        self._variable_chooser_0_callback(self.variable_chooser_0)
        self._variable_chooser_0_button_group.buttonClicked[int].connect(
            lambda i: self.set_variable_chooser_0(
                self._variable_chooser_0_options[i]))
        self.top_grid_layout.addWidget(self._variable_chooser_0_group_box)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=1, decimation=8, taps=None, fractional_bw=None)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [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 range(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            48000,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               'rtl=0')
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(145.825e6, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            25, firdes.low_pass(1, 48000, 500, 50), variable_slider_0, 1.2e6)
        self.blocks_selector_0 = blocks.selector(gr.sizeof_float * 1,
                                                 variable_chooser_0, 0)
        self.blocks_selector_0.set_enabled(True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(
            variable_slider_1)
        self.blocks_complex_to_float_1 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_2_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 100, 2700, 50, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_2 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 600, 800, 50, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 450, 950, 100, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, 48000, 300, 1100, 100, firdes.WIN_HAMMING,
                             6.76))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            48000, analog.GR_COS_WAVE, 700, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            48000, analog.GR_SIN_WAVE, 700, 1, 0, 0)
        self.analog_agc2_xx_0 = analog.agc2_ff(1e-3, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.blocks_selector_0, 0))
        self.connect((self.band_pass_filter_1, 0), (self.blocks_selector_0, 1))
        self.connect((self.band_pass_filter_2, 0), (self.blocks_selector_0, 2))
        self.connect((self.band_pass_filter_2_0, 0),
                     (self.blocks_selector_0, 3))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_1, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_2, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_2_0, 0))
        self.connect((self.blocks_complex_to_float_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_float_1, 1),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_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_selector_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.blocks_selector_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_complex_to_float_1, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_sink_x_0, 0))
예제 #14
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 = 960000

        ##################################################
        # 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, 'Orig')
        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, 'Mod')
        self.top_layout.addWidget(self.tab)
        self.qtgui_sink_x_1 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_HAMMING, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	False, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_1.enable_rf_freq(False)



        self.m = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0.8)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_const_source_x_1 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.m, 0), (self.blocks_multiply_xx_0, 0))
예제 #15
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())

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	256, #fftsize
        	firdes.WIN_HANN, #wintype
        	50, #fc
        	250, #bw
        	"", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/100)
        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)
          
        #test_source = TestSource()
        test_source = blocks.udp_source(gr.sizeof_float*1, "127.0.0.1", 9999, 1472, True)

        src = UDPSource()

        # Signal Conditioning: DC Block and 50 Hz Notch Filter
        ch1 = NotchFilter(src.channel1)
        ch1 = DCBlock(ch1)

        #notched = NotchFilter(notched)
        #notched = NotchFilter(notched)
        alpha = BandPass(ch1, 8, 12)
        alpha.color = 'green'
        alpha = RMS(alpha, 0.02)
        #alpha = ExponentialAverage(alpha, 5.1)

        smrlevel = RMS(BandPass(ch1, 9.5, 12.5), 0.02)

        oscclient = OSCSend(smrlevel, '/0x00/filter')

        osci = Oscilloscope(alpha)
        spec = BarSpectrogram(ch1, hi=42)

        self.top_layout.addWidget(osci.widget)
        self.top_layout.addWidget(spec.widget)

        visited = self.wireup(osci)
        visited = self.wireup(oscclient, visited)
        self.wireup(spec, visited)
예제 #16
0
    def __init__(self):
        gr.top_block.__init__(self, "P25 Tx Gui")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("P25 Tx Gui")
        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", "p25_tx_gui")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        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, 4)

        self.qtgui_time_sink_x_0.set_y_label('Symbol Stream', "")

        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 = [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)
        self.qtgui_sink_x_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            'C4FM Signal',  #name
            False,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            False,  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_1.enable_rf_freq(False)

        (self.qtgui_sink_x_1).set_block_alias("C4FM")
        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            False,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.p25_c4fm_transmitter_fc_0 = p25_c4fm_transmitter_fc(
            output_rate=samp_rate, )
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/janakj/Downloads/sentence2.wav', True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.p25_c4fm_transmitter_fc_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.p25_c4fm_transmitter_fc_0, 2),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.p25_c4fm_transmitter_fc_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.p25_c4fm_transmitter_fc_0, 1),
                     (self.qtgui_sink_x_1, 0))
예제 #17
0
    def __init__(self):
        gr.top_block.__init__(self, "Mpsk Sim")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Mpsk Sim")
        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_sim")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.n = n = 4
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.m = m = n
        self.eb = eb = 0.35
        self.timing_loop_bw = timing_loop_bw = 0.01
        self.time_offset = time_offset = 1.00
        self.taps = taps = [1.0, 0.25-0.25j, 0.50 + 0.10j, -0.3 + 0.2j]
        self.samp_rate = samp_rate = 32000
        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_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.preamble = preamble = [1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1]
        self.phase_bw = phase_bw = 0.1
        self.payload_size = payload_size = 100*n*m
        self.packed_preamble = packed_preamble = [83, 34, 91, 29, 13, 115, 223, 3]
        self.noise_volt = noise_volt = 0
        self.matched_filter = matched_filter = firdes.root_raised_cosine(nfilts, nfilts, 1, eb, int(11*sps*nfilts))
        self.freq_offset = freq_offset = 0
        self.excess_bw = excess_bw = 0.35
        self.eq_gain = eq_gain = 0.01
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.controls = Qt.QTabWidget()
        self.controls_widget_0 = Qt.QWidget()
        self.controls_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.controls_widget_0)
        self.controls_grid_layout_0 = Qt.QGridLayout()
        self.controls_layout_0.addLayout(self.controls_grid_layout_0)
        self.controls.addTab(self.controls_widget_0, "Transmitter")
        self.controls_widget_1 = Qt.QWidget()
        self.controls_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.controls_widget_1)
        self.controls_grid_layout_1 = Qt.QGridLayout()
        self.controls_layout_1.addLayout(self.controls_grid_layout_1)
        self.controls.addTab(self.controls_widget_1, "Receiver")
        self.top_grid_layout.addWidget(self.controls, 0,0,1,2)
        self._timing_loop_bw_layout = Qt.QVBoxLayout()
        self._timing_loop_bw_label = Qt.QLabel("Time: BW")
        self._timing_loop_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._timing_loop_bw_slider.setRange(0.0, 0.2, 0.005)
        self._timing_loop_bw_slider.setValue(self.timing_loop_bw)
        self._timing_loop_bw_slider.setMinimumWidth(200)
        self._timing_loop_bw_slider.valueChanged.connect(self.set_timing_loop_bw)
        self._timing_loop_bw_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_label)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_slider)
        self.controls_grid_layout_1.addLayout(self._timing_loop_bw_layout, 0,0,1,1)
        self._time_offset_layout = Qt.QVBoxLayout()
        self._time_offset_tool_bar = Qt.QToolBar(self)
        self._time_offset_layout.addWidget(self._time_offset_tool_bar)
        self._time_offset_tool_bar.addWidget(Qt.QLabel("Timing Offset"+": "))
        self._time_offset_counter = Qwt.QwtCounter()
        self._time_offset_counter.setRange(0.999, 1.001, 0.0001)
        self._time_offset_counter.setNumButtons(2)
        self._time_offset_counter.setValue(self.time_offset)
        self._time_offset_tool_bar.addWidget(self._time_offset_counter)
        self._time_offset_counter.valueChanged.connect(self.set_time_offset)
        self._time_offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._time_offset_slider.setRange(0.999, 1.001, 0.0001)
        self._time_offset_slider.setValue(self.time_offset)
        self._time_offset_slider.setMinimumWidth(200)
        self._time_offset_slider.valueChanged.connect(self.set_time_offset)
        self._time_offset_layout.addWidget(self._time_offset_slider)
        self.controls_grid_layout_0.addLayout(self._time_offset_layout,  0,2,1,1)
        self._phase_bw_layout = Qt.QVBoxLayout()
        self._phase_bw_label = Qt.QLabel("Phase: Bandwidth")
        self._phase_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._phase_bw_slider.setRange(0.0, 1.0, 0.01)
        self._phase_bw_slider.setValue(self.phase_bw)
        self._phase_bw_slider.setMinimumWidth(200)
        self._phase_bw_slider.valueChanged.connect(self.set_phase_bw)
        self._phase_bw_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._phase_bw_layout.addWidget(self._phase_bw_label)
        self._phase_bw_layout.addWidget(self._phase_bw_slider)
        self.controls_grid_layout_1.addLayout(self._phase_bw_layout, 0,2,1,1)
        self._noise_volt_layout = Qt.QVBoxLayout()
        self._noise_volt_tool_bar = Qt.QToolBar(self)
        self._noise_volt_layout.addWidget(self._noise_volt_tool_bar)
        self._noise_volt_tool_bar.addWidget(Qt.QLabel("Noise Voltage"+": "))
        self._noise_volt_counter = Qwt.QwtCounter()
        self._noise_volt_counter.setRange(0, 1, 0.01)
        self._noise_volt_counter.setNumButtons(2)
        self._noise_volt_counter.setValue(self.noise_volt)
        self._noise_volt_tool_bar.addWidget(self._noise_volt_counter)
        self._noise_volt_counter.valueChanged.connect(self.set_noise_volt)
        self._noise_volt_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._noise_volt_slider.setRange(0, 1, 0.01)
        self._noise_volt_slider.setValue(self.noise_volt)
        self._noise_volt_slider.setMinimumWidth(200)
        self._noise_volt_slider.valueChanged.connect(self.set_noise_volt)
        self._noise_volt_layout.addWidget(self._noise_volt_slider)
        self.controls_grid_layout_0.addLayout(self._noise_volt_layout,  0,0,1,1)
        self._freq_offset_layout = Qt.QVBoxLayout()
        self._freq_offset_tool_bar = Qt.QToolBar(self)
        self._freq_offset_layout.addWidget(self._freq_offset_tool_bar)
        self._freq_offset_tool_bar.addWidget(Qt.QLabel("Frequency Offset"+": "))
        self._freq_offset_counter = Qwt.QwtCounter()
        self._freq_offset_counter.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_counter.setNumButtons(2)
        self._freq_offset_counter.setValue(self.freq_offset)
        self._freq_offset_tool_bar.addWidget(self._freq_offset_counter)
        self._freq_offset_counter.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._freq_offset_slider.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_slider.setValue(self.freq_offset)
        self._freq_offset_slider.setMinimumWidth(200)
        self._freq_offset_slider.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_layout.addWidget(self._freq_offset_slider)
        self.controls_grid_layout_0.addLayout(self._freq_offset_layout,  0,1,1,1)
        self._eq_gain_layout = Qt.QVBoxLayout()
        self._eq_gain_label = Qt.QLabel("Equalizer: rate")
        self._eq_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._eq_gain_slider.setRange(0.0, 0.1, 0.001)
        self._eq_gain_slider.setValue(self.eq_gain)
        self._eq_gain_slider.setMinimumWidth(200)
        self._eq_gain_slider.valueChanged.connect(self.set_eq_gain)
        self._eq_gain_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._eq_gain_layout.addWidget(self._eq_gain_label)
        self._eq_gain_layout.addWidget(self._eq_gain_slider)
        self.controls_grid_layout_1.addLayout(self._eq_gain_layout, 0,1,1,1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
        	1024, #size
        	samp_rate, #samp_rate
        	"QT GUI Plot", #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.controls_grid_layout_0.addWidget(self._qtgui_time_sink_x_0_win, 1,0,2,2)
        self.qtgui_sink_x_1 = 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_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.controls_grid_layout_1.addWidget(self._qtgui_sink_x_1_win, 1,0,2,2)
        
        
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	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.set_update_time(1.0/10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.controls_grid_layout_1.addWidget(self._qtgui_sink_x_0_win, 3,0,2,2)
        
        
        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)
        self.digital_correlate_and_sync_cc_0 = digital.correlate_and_sync_cc((preamble), (matched_filter), sps)
        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.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise_volt,
        	frequency_offset=freq_offset,
        	epsilon=time_offset,
        	taps=([1]),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_vector_source_x_0_0 = blocks.vector_source_b(map(lambda x: (-x+1)/2, preamble), True, 1, [])
        self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(int(math.log(arity,2)))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        self.blocks_stream_mux_0_0_0 = blocks.stream_mux(gr.sizeof_char*1, (len(preamble)/8,payload_size))
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(8)
        self.blocks_pack_k_bits_bb_0 = blocks.pack_k_bits_bb(8)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/franchz/Documents/UTFPR/10o_periodo/TCC2/projeto/tcc/gnuradio/tx_teste.txt", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/franchz/Documents/UTFPR/10o_periodo/TCC2/projeto/tcc/gnuradio/rx_teste.txt", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_stream_mux_0_0_0, 0), (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_0, 0), (self.blocks_stream_mux_0_0_0, 0))
        self.connect((self.blocks_vector_source_x_0_0, 0), (self.blocks_pack_k_bits_bb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.digital_correlate_and_sync_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_pack_k_bits_bb_1, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_pack_k_bits_bb_1, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_stream_mux_0_0_0, 1))
예제 #18
0
 def test02(self):
     self.qtsnk = qtgui.sink_f(1024, 5,
                               0, 1, "Test",
                               True, True, True, True)
예제 #19
0
    def __init__(self):
        gr.top_block.__init__(self, "If Psk Rx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("If Psk 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", "if_psk_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.if_decimation = if_decimation = 2
        self.sound_card_sample_rate = sound_card_sample_rate = 11025
        self.samples_per_symbol = samples_per_symbol = 16 / if_decimation
        self.symbol_rate = symbol_rate = sound_card_sample_rate / if_decimation / samples_per_symbol
        self.bits_per_symbol = bits_per_symbol = 2
        self.rolloff = rolloff = 0.5
        self.hdlc_packet_overhead = hdlc_packet_overhead = 6 * 8
        self.hdlc_packet_length = hdlc_packet_length = 16 * 8
        self.channel_bit_rate = channel_bit_rate = symbol_rate * bits_per_symbol

        self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine(
            1, sound_card_sample_rate / if_decimation, symbol_rate, rolloff,
            11 * samples_per_symbol)

        self.source_bit_rate = source_bit_rate = channel_bit_rate * hdlc_packet_length / (
            hdlc_packet_overhead + hdlc_packet_length)
        self.if_frequency = if_frequency = sound_card_sample_rate / 4

        ##################################################
        # Blocks
        ##################################################
        self.raspi_decoder_psk_constellation_decoder_0 = raspi_decoder.psk_constellation_decoder(
            bits_per_symbol=bits_per_symbol,
            differential=True,
            mod_code="gray",
            debug=False,
        )
        self.qtgui_time_sink_x_1_0 = qtgui.time_sink_f(
            1024,  #size
            source_bit_rate,  #samp_rate
            "Received packets",  #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(True)
        self.qtgui_time_sink_x_1_0.enable_grid(False)
        self.qtgui_time_sink_x_1_0.enable_control_panel(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
            channel_bit_rate,  #samp_rate
            "Decoded bits",  #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(True)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_control_panel(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_0 = qtgui.time_sink_f(
            1024,  #size
            sound_card_sample_rate / if_decimation,  #samp_rate
            "Frequency synchronizer state",  #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_control_panel(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ["Frequency", "Phase", "Error", "", "", "", "", "", "", ""]
        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_f(
            1024,  #size
            symbol_rate,  #samp_rate
            "Symbol synchronizer state",  #name
            3  #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 = ["Error", "Rate", "Phase", "", "", "", "", "", "", ""]
        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(3):
            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_sink_x_0_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate / if_decimation,  #bw
            "Phase synchronized baseband signal",  #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.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate / if_decimation,  #bw
            "Baseband I&Q signal",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(False)

        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "Synchronized symbols",  #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(True)
        self.qtgui_const_sink_x_0.enable_grid(False)

        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.low_pass_filter_0_0 = filter.fir_filter_fff(
            if_decimation,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            symbol_rate * (1 + rolloff),
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            if_decimation,
            firdes.low_pass(1.66, sound_card_sample_rate,
                            symbol_rate * (1 + rolloff),
                            sound_card_sample_rate / 8, firdes.WIN_HANN, 6.76))
        self.final_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate,  #bw
            "IF received signal",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            False,  #plotconst
        )
        self.final_0.set_update_time(1.0 / 10)
        self._final_0_win = sip.wrapinstance(self.final_0.pyqwidget(),
                                             Qt.QWidget)
        self.top_layout.addWidget(self._final_0_win)

        self.final_0.enable_rf_freq(False)

        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            samples_per_symbol, 2 * math.pi / 100, (variable_rrc_filter_taps),
            32, 0, 3, 1)
        self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(
            hdlc_packet_length / 8, hdlc_packet_length)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            2 * math.pi / 100 * 2, 8, True)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "rx_signal.wav", False)
        self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 sound_card_sample_rate, True)
        self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink(
            gr.sizeof_char * 1, source_bit_rate)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, "burst")
        self.blocks_multiply_xx_0_0 = 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.analog_sig_source_x_0_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_COS_WAVE, if_frequency, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            sound_card_sample_rate, analog.GR_SIN_WAVE, if_frequency, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_tagged_file_sink_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_uchar_to_float_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_uchar_to_float_0_0, 0),
                     (self.qtgui_time_sink_x_1_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.final_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.qtgui_sink_x_0_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 1),
                     (self.qtgui_time_sink_x_0_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, 1),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 3),
                     (self.qtgui_time_sink_x_0, 2))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 2),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.raspi_decoder_psk_constellation_decoder_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0),
                     (self.blocks_uchar_to_float_0, 0))
        self.connect((self.raspi_decoder_psk_constellation_decoder_0, 0),
                     (self.digital_hdlc_deframer_bp_0, 0))
예제 #20
0
    def __init__(self):
        gr.top_block.__init__(self, "Read/Write Tests for real-valued signals")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Read/Write Tests for real-valued signals")
        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",
                                     "read_writeTests_real_gr38_001")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.Fs3 = Fs3 = 22050
        self.Fs23 = Fs23 = 44100
        self.Fs22 = Fs22 = 48000
        self.Fs2 = Fs2 = 32000

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_0_1_0_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            Fs23,  #bw
            "y23t",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0_1_0_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_0_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0_1_0_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_0_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_sink_x_0_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            Fs22,  #bw
            "y22t",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0_1.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_sink_x_0_0 = qtgui.sink_f(
            4096,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            Fs3,  #bw
            "y3t",  #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.qtgui_sink_x_0_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_0_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.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            Fs2,  #bw
            "y2t",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            'sig_x3t_PAMint16_Fs22050.wav', True)
        self.blocks_throttle_0_0_0_0_0 = blocks.throttle(
            gr.sizeof_float * 1, Fs23, True)
        self.blocks_throttle_0_0_0 = blocks.throttle(gr.sizeof_float * 1, Fs22,
                                                     True)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float * 1, Fs3,
                                                   True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1, Fs2,
                                                 True)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_float * 1, 'sig_x2t_float32_Fs32000.bin', True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_f(
            Fs23, analog.GR_SAW_WAVE, 100, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            Fs22, analog.GR_SIN_WAVE, 1000, 1, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_throttle_0_0_0_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.qtgui_sink_x_0_0, 0))
        self.connect((self.blocks_throttle_0_0_0, 0),
                     (self.qtgui_sink_x_0_1, 0))
        self.connect((self.blocks_throttle_0_0_0_0_0, 0),
                     (self.qtgui_sink_x_0_1_0_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0_0, 0))
예제 #21
0
    def __init__(self):
        gr.top_block.__init__(self, "Wbfm Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Wbfm 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", "wbfm_tx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 400000

        ##################################################
        # 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(2.45e9, 0)
        self.uhd_usrp_sink_0.set_gain(60, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(200000, 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(False)

        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/camellia/Downloads/disco_dancing.wav', True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex * 1,
                                                   '', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.audio_sink_0_0 = audio.sink(48000, '', True)
        self.analog_wfm_tx_0 = analog.wfm_tx(
            audio_rate=22000,
            quad_rate=44000,
            tau=75e-6,
            max_dev=75e3,
            fh=-1.0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_tx_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.analog_wfm_tx_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_wfm_tx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_sink_x_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Lab 3 Task 0")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 3 Task 0")
        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", "lab3_task0")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5000000
        self.samp_msg = samp_msg = 44100

        ##################################################
        # 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, 'Message')
        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, 'Modulated')
        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, 'Demodulated')
        self.top_grid_layout.addWidget(self.tab)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=samp_msg,
            decimation=samp_rate,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=samp_rate,
            decimation=samp_msg,
            taps=None,
            fractional_bw=None)
        self.qtgui_sink_x_1 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Modulated',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_1.enable_rf_freq(False)

        self.tab_layout_1.addWidget(self._qtgui_sink_x_1_win)
        self.qtgui_sink_x_0_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_msg,  #bw
            'Message',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0_1.enable_rf_freq(False)

        self.tab_layout_0.addWidget(self._qtgui_sink_x_0_1_win)
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_msg,  #bw
            'Demodulated',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.tab_layout_2.addWidget(self._qtgui_sink_x_0_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 12000, 1000, firdes.WIN_KAISER,
                            6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ffd([0, 1 / samp_msg],
                                                      [1, 1], True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(20000, True)
        self.blocks_throttle_1_0 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_msg, True)
        self.blocks_throttle_1 = blocks.throttle(gr.sizeof_float * 1, samp_msg,
                                                 True)
        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_0 = blocks.multiply_const_ff(1 / 6.28)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(100)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_1_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 100000, 2, 0, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_msg, analog.GR_COS_WAVE, 11000, 0.5, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_msg, analog.GR_COS_WAVE, 1100, 0.5, 0, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(2 * 3.14 *
                                                                     75 * 1000)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_phase_modulator_fc_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_1, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_add_xx_1, 1))
        self.connect((self.analog_sig_source_x_1_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_throttle_1, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.iir_filter_xxx_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_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_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_throttle_1, 0), (self.qtgui_sink_x_0_1, 0))
        self.connect((self.blocks_throttle_1_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.iir_filter_xxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_phase_modulator_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
예제 #23
0
    def __init__(self):
        gr.top_block.__init__(self, "Rx Top")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Rx Top")
        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", "rx_top")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sound_card_sample_rate = sound_card_sample_rate = 44000
        self.samples_per_symbol = samples_per_symbol = 19
        self.symbol_rate = symbol_rate = sound_card_sample_rate / samples_per_symbol
        self.bits_per_symbol = bits_per_symbol = 1

        self.variable_rrc_filter_taps = variable_rrc_filter_taps = firdes.root_raised_cosine(
            1, sound_card_sample_rate, symbol_rate, 0.5, 70)

        self.bit_rate = bit_rate = symbol_rate / bits_per_symbol

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_time_sink_x_1_2_0 = qtgui.time_sink_f(
            500,  #size
            sound_card_sample_rate,  #samp_rate
            "Filtered signal",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_2_0.set_update_time(0.10)
        self.qtgui_time_sink_x_1_2_0.set_y_axis(-1, 1)

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

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

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

        self._qtgui_time_sink_x_1_2_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_2_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_0_win)
        self.qtgui_time_sink_x_1_2 = qtgui.time_sink_f(
            500,  #size
            symbol_rate,  #samp_rate
            "Synchronization phase",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1_2.set_update_time(0.10)
        self.qtgui_time_sink_x_1_2.set_y_axis(-1, 1)

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

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

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

        self._qtgui_time_sink_x_1_2_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_2_win)
        self.qtgui_time_sink_x_1_1 = qtgui.time_sink_f(
            500,  #size
            symbol_rate,  #samp_rate
            "Synchronization 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(True)
        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)

        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(
            500,  #size
            symbol_rate,  #samp_rate
            "Synchronization error",  #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(True)
        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)

        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(
            50,  #size
            symbol_rate,  #samp_rate
            "Received symbols",  #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(True)
        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)

        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_sink_x_0_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate,  #bw
            "sync symbols",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_1_win)

        self.qtgui_sink_x_0_1.enable_rf_freq(False)

        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            sound_card_sample_rate,  #bw
            "received-symbol",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(False)

        self.fft_filter_xxx_0 = filter.fft_filter_fff(
            1, (variable_rrc_filter_taps), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_fff(
            samples_per_symbol, 0.5, (variable_rrc_filter_taps), 32, 0, 1.5, 1)
        self.digital_hdlc_deframer_bp_0 = digital.hdlc_deframer_bp(32, 500)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 sound_card_sample_rate, True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(-0.01, 0.01, 0)
        self.blocks_tagged_file_sink_0 = blocks.tagged_file_sink(
            gr.sizeof_char * 1, bit_rate)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'burst')
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.audio_source_0 = audio.source(sound_card_sample_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.audio_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.audio_source_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.digital_hdlc_deframer_bp_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_tagged_file_sink_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.fft_filter_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.qtgui_sink_x_0_1, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.qtgui_time_sink_x_1, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 1),
                     (self.qtgui_time_sink_x_1_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 2),
                     (self.qtgui_time_sink_x_1_1, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 3),
                     (self.qtgui_time_sink_x_1_2, 0))
        self.connect((self.fft_filter_xxx_0, 0),
                     (self.qtgui_time_sink_x_1_2_0, 0))
예제 #24
0
    def __init__(self):
        gr.top_block.__init__(self, "Zmq Stream")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Zmq Stream")
        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", "zmq_stream")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 125e6

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_sub_source_0 = zeromq.sub_source(
            gr.sizeof_short, 1, 'tcp://192.168.0.200:9901', 200, False, -1)
        self.qtgui_sink_x_0_0 = qtgui.sink_f(
            8192,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_0.set_update_time(1.0 / 1)
        self._qtgui_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_0_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)

        self.qtgui_sink_x_0_0.enable_rf_freq(False)

        self.qtgui_sink_x_0 = qtgui.sink_f(
            8192,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 1)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_deinterleave_0 = blocks.deinterleave(
            gr.sizeof_float * 1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_deinterleave_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_deinterleave_0, 1),
                     (self.qtgui_sink_x_0_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_deinterleave_0, 0))
        self.connect((self.zeromq_sub_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
예제 #25
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.samp_rate = samp_rate = 960e3

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccf(
            interpolation=1,
            decimation=30,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_sink_x_0_1_1_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / 30,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_1_1_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_1_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_1_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_1_0_win)

        self.qtgui_sink_x_0_1_1_0.enable_rf_freq(False)

        self.qtgui_sink_x_0_1_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / 30,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_1_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_1_win)

        self.qtgui_sink_x_0_1_1.enable_rf_freq(False)

        self.qtgui_sink_x_0_1_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / 30,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_1_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_0_win)

        self.qtgui_sink_x_0_1_0.enable_rf_freq(False)

        self.qtgui_sink_x_0_1 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / 30,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_1_win)

        self.qtgui_sink_x_0_1.enable_rf_freq(False)

        self.low_pass_filter_0_0_0_0 = filter.fir_filter_fff(
            1, firdes.low_pass(1, samp_rate, 700, 150, firdes.WIN_HAMMING,
                               6.76))
        self.low_pass_filter_0_0_0 = filter.fir_filter_fff(
            1, firdes.low_pass(1, samp_rate, 700, 150, firdes.WIN_HAMMING,
                               6.76))
        self.blocks_throttle_0_1 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_rate / 30, True)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_rate / 30, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate / 30, True)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0_1_0 = 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_vcc((10, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_float * 1,
            '/media/aaronjs/New Volume/IITB_Files/Annual_Academic_Files/Year_3/Semester_5/EE340/EndSem/Given_Files/q1-file.bin',
            True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate, 300e3 - 900, 300e3 + 900, 50,
                             firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 300e3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 300e3, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.blocks_throttle_0_1, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_throttle_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.low_pass_filter_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_1_0, 0),
                     (self.low_pass_filter_0_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0_1, 0))
        self.connect((self.blocks_throttle_0_0, 0),
                     (self.qtgui_sink_x_0_1_1, 0))
        self.connect((self.blocks_throttle_0_1, 0),
                     (self.qtgui_sink_x_0_1_0, 0))
        self.connect((self.low_pass_filter_0_0_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.low_pass_filter_0_0_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.low_pass_filter_0_0_0_0, 0),
                     (self.qtgui_sink_x_0_1_1_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_throttle_0, 0))
예제 #26
0
    def __init__(self):
        gr.top_block.__init__(self, "Not titled yet")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Not titled yet")
        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", "OOK_test")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e5
        self.samp_per_symbol = samp_per_symbol = 600
        self.freq_0 = freq_0 = 20e3
        self.data = data = (1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1,
                            0)

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_1.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_1_win)
        self.blocks_vector_source_x_0 = blocks.vector_source_c(
            data, True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, 600)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            '/Users/kesenheimer/Documents/Basteln/SDR/gnuRadio_modules/gr-OOK_demodulator/apps/OOK_test.bin',
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.OOKDemodulator_1 = OOKDemodulator(
            freq_0=freq_0,
            gain=2,
            low_pass_cutoff=5000,
            offset=0.5,
            samp_per_sym=600,
            samp_rate=samp_rate,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.OOKDemodulator_1, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.OOKDemodulator_1, 1), (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.OOKDemodulator_1, 0))
        self.connect((self.blocks_vector_source_x_0, 0),
                     (self.blocks_repeat_0, 0))
예제 #27
0
    def __init__(self):
        gr.top_block.__init__(self, "Polyglot")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Polyglot")
        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", "polyglot")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.samp_rate = samp_rate = 32000
        self.psk_samp_rate = psk_samp_rate = 31.25
        self.fsk_scale = fsk_scale = 1.2
        self.freq = freq = 1000
        self.bw = bw = 75

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=int(samp_rate / (sps * psk_samp_rate)),
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_sink_x_0 = qtgui.sink_f(
            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.set_update_time(1.0 / 10)
        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.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="none",
            differential=True,
            samples_per_symbol=sps,
            excess_bw=0.01,
            verbose=False,
            log=False,
        )
        self.blocks_not_xx_0 = blocks.not_ii()
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_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_vcc((0.9, ))
        self.blocks_int_to_float_0_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_int_to_float_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_file_source_0_0_0 = blocks.file_source(
            gr.sizeof_int * 1, "baudotmessage.bin", True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char * 1,
                                                       "varicodemessage.bin",
                                                       True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_0_1 = filter.interp_fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate, 500, 1500, 10, firdes.WIN_HAMMING,
                             6.76))
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, freq + bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, freq - bw, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_int_to_float_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0),
                     (self.blocks_not_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_int_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0),
                     (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0_1, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.blocks_not_xx_0, 0),
                     (self.blocks_int_to_float_0_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 0))
예제 #28
0
파일: sdrSim.py 프로젝트: franchenstein/tcc
        self._freq_offset_counter.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_counter.setNumButtons(2)
        self._freq_offset_counter.setValue(self.freq_offset)
        self._freq_offset_tool_bar.addWidget(self._freq_offset_counter)
        self._freq_offset_counter.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._freq_offset_slider.setRange(-0.1, 0.1, 0.001)
        self._freq_offset_slider.setValue(self.freq_offset)
        self._freq_offset_slider.setMinimumWidth(200)
        self._freq_offset_slider.valueChanged.connect(self.set_freq_offset)
        self._freq_offset_layout.addWidget(self._freq_offset_slider)
        self.top_layout.addLayout(self._freq_offset_layout)
        self.sdrTX_0 = sdrTX()
        self.sdrRX_0 = sdrRX()
<<<<<<< HEAD
        self.qtgui_sink_x_0 = qtgui.sink_f(
=======
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"BER", #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_sink_x_0_0 = qtgui.sink_c(
        	1024, #fftsize
예제 #29
0
    def __init__(self):
        gr.top_block.__init__(self, "Lab 1 Task 3")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 1 Task 3")
        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", "lab1_task3")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.band5 = band5 = 0
        self.band4 = band4 = 0
        self.band3 = band3 = 0
        self.band2 = band2 = 0
        self.band1 = band1 = 0

        ##################################################
        # Blocks
        ##################################################
        self._band5_range = Range(0, 100, 1, 0, 200)
        self._band5_win = RangeWidget(self._band5_range, self.set_band5,
                                      '9kHz - 15kHz', "slider", float)
        self.top_grid_layout.addWidget(self._band5_win)
        self._band4_range = Range(0, 100, 1, 0, 200)
        self._band4_win = RangeWidget(self._band4_range, self.set_band4,
                                      '6kHz - 9kHz', "slider", float)
        self.top_grid_layout.addWidget(self._band4_win)
        self._band3_range = Range(0, 100, 1, 0, 200)
        self._band3_win = RangeWidget(self._band3_range, self.set_band3,
                                      '3kHz - 6kHz', "slider", float)
        self.top_grid_layout.addWidget(self._band3_win)
        self._band2_range = Range(0, 100, 1, 0, 200)
        self._band2_win = RangeWidget(self._band2_range, self.set_band2,
                                      '500Hz - 3kHz', "slider", float)
        self.top_grid_layout.addWidget(self._band2_win)
        self._band1_range = Range(0, 100, 1, 0, 200)
        self._band1_win = RangeWidget(self._band1_range, self.set_band1,
                                      '20Hz - 500Hz', "slider", float)
        self.top_grid_layout.addWidget(self._band1_win)
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/ipsit/Documents/EE 340/Lab 1/Bach.wav', True)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            '/home/ipsit/Documents/EE 340/Lab 1/equalizer.wav', 1, samp_rate,
            8)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_4 = filter.fir_filter_fff(
            1,
            firdes.band_pass(band2, samp_rate, 500, 3000, 10,
                             firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_3 = filter.fir_filter_fff(
            1,
            firdes.band_pass(band3, samp_rate, 3000, 6000, 10,
                             firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_2 = filter.fir_filter_fff(
            1,
            firdes.band_pass(band4, samp_rate, 6000, 9000, 10,
                             firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.band_pass(band5, samp_rate, 9000, 15000, 10,
                             firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.band_pass(band1, samp_rate, 20, 500, 10, firdes.WIN_KAISER,
                             6.76))
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.band_pass_filter_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.band_pass_filter_1, 0), (self.blocks_add_xx_0, 4))
        self.connect((self.band_pass_filter_2, 0), (self.blocks_add_xx_0, 3))
        self.connect((self.band_pass_filter_3, 0), (self.blocks_add_xx_0, 2))
        self.connect((self.band_pass_filter_4, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.band_pass_filter_1, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.band_pass_filter_2, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.band_pass_filter_3, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.band_pass_filter_4, 0))
예제 #30
0
    def __init__(self):
        gr.top_block.__init__(self, "Polyglot")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Polyglot")
        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", "polyglot")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.samp_rate = samp_rate = 32000
        self.psk_samp_rate = psk_samp_rate = 31.25
        self.fsk_scale = fsk_scale = 1.2
        self.freq = freq = 1000
        self.bw = bw = 75

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=int(samp_rate/(sps*psk_samp_rate)),
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	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.set_update_time(1.0/10)
        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.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=2,
          mod_code="none",
          differential=True,
          samples_per_symbol=sps,
          excess_bw=0.01,
          verbose=False,
          log=False,
          )
        self.blocks_not_xx_0 = blocks.not_ii()
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_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_vcc((0.9, ))
        self.blocks_int_to_float_0_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_int_to_float_0 = blocks.int_to_float(1, fsk_scale)
        self.blocks_file_source_0_0_0 = blocks.file_source(gr.sizeof_int*1, "baudotmessage.bin", True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "varicodemessage.bin", True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.band_pass_filter_0_1 = filter.interp_fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate, 500, 1500, 10, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, freq+bw, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, freq-bw, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_int_to_float_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_not_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_int_to_float_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_file_source_0_0_0, 0), (self.blocks_int_to_float_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0_1, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.blocks_not_xx_0, 0), (self.blocks_int_to_float_0_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.blocks_file_source_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_1, 0))
예제 #31
0
    def __init__(self, antenna="RX2", args="", fft_size=1024, freq=2.45e9, gain=20, samp_rate=1e6, spec="", stream_args="", update_rate=.1, wire_format=""):
        gr.top_block.__init__(self, "UHD FFT")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("UHD FFT")
        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", "astrotest12")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.args = args
        self.fft_size = fft_size
        self.freq = freq
        self.gain = gain
        self.samp_rate = samp_rate
        self.spec = spec
        self.stream_args = stream_args
        self.update_rate = update_rate
        self.wire_format = wire_format

        ##################################################
        # Variables
        ##################################################
        self.freq_c = freq_c = freq
        self.chan0_lo_locked = chan0_lo_locked = uhd.sensor_value("", False, "")
        self.usrp_device_info = usrp_device_info = uhd.get_version_string()
        self.uhd_version_info = uhd_version_info = uhd.get_version_string()
        self.samp_rate_ = samp_rate_ = samp_rate
        self.lo_locked_probe = lo_locked_probe = chan0_lo_locked.to_bool()
        self.gain_ = gain_ = gain
        self.current_freq_c = current_freq_c = freq_c
        self.ant = ant = antenna

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate__tool_bar = Qt.QToolBar(self)
        self._samp_rate__tool_bar.addWidget(Qt.QLabel("Sampling Rate"+": "))
        self._samp_rate__line_edit = Qt.QLineEdit(str(self.samp_rate_))
        self._samp_rate__tool_bar.addWidget(self._samp_rate__line_edit)
        self._samp_rate__line_edit.returnPressed.connect(
        	lambda: self.set_samp_rate_(eng_notation.str_to_num(str(self._samp_rate__line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._samp_rate__tool_bar, 3,2,1,2)
        self._gain__range = Range(0, 31.5, .5, gain, 200)
        self._gain__win = RangeWidget(self._gain__range, self.set_gain_, "RX Gain", "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain__win, 2,0,1,4)
        self._freq_c_tool_bar = Qt.QToolBar(self)
        self._freq_c_tool_bar.addWidget(Qt.QLabel("RX Tune Frequency"+": "))
        self._freq_c_line_edit = Qt.QLineEdit(str(self.freq_c))
        self._freq_c_tool_bar.addWidget(self._freq_c_line_edit)
        self._freq_c_line_edit.returnPressed.connect(
        	lambda: self.set_freq_c(eng_notation.str_to_num(str(self._freq_c_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._freq_c_tool_bar, 3,0,1,2)
        self._ant_options = ("RX2", "TX/RX", "J1", "J2", )
        self._ant_labels = ("RX2", "TX/RX", "J1", "J2", )
        self._ant_tool_bar = Qt.QToolBar(self)
        self._ant_tool_bar.addWidget(Qt.QLabel("Antenna"+": "))
        self._ant_combo_box = Qt.QComboBox()
        self._ant_tool_bar.addWidget(self._ant_combo_box)
        for label in self._ant_labels: self._ant_combo_box.addItem(label)
        self._ant_callback = lambda i: Qt.QMetaObject.invokeMethod(self._ant_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._ant_options.index(i)))
        self._ant_callback(self.ant)
        self._ant_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_ant(self._ant_options[i]))
        self.top_grid_layout.addWidget(self._ant_tool_bar, 4,2,1,2)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join((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(float(freq_c), 0)
        self.uhd_usrp_source_0.set_gain(gain_, 0)
        self.uhd_usrp_source_0.set_antenna(ant, 0)
        self.uhd_usrp_source_0.set_bandwidth(samp_rate, 0)
        self.volume = blocks.multiply_const_vcc((20, ))
        self._usrp_device_info_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._usrp_device_info_formatter = None
        else:
          self._usrp_device_info_formatter = lambda x: x
        
        self._usrp_device_info_tool_bar.addWidget(Qt.QLabel("Device Information"+": "))
        self._usrp_device_info_label = Qt.QLabel(str(self._usrp_device_info_formatter(self.usrp_device_info)))
        self._usrp_device_info_tool_bar.addWidget(self._usrp_device_info_label)
        self.top_grid_layout.addWidget(self._usrp_device_info_tool_bar, 1,2,1,2)
          
        self._uhd_version_info_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._uhd_version_info_formatter = None
        else:
          self._uhd_version_info_formatter = lambda x: x
        
        self._uhd_version_info_tool_bar.addWidget(Qt.QLabel("UHD Version"+": "))
        self._uhd_version_info_label = Qt.QLabel(str(self._uhd_version_info_formatter(self.uhd_version_info)))
        self._uhd_version_info_tool_bar.addWidget(self._uhd_version_info_label)
        self.top_grid_layout.addWidget(self._uhd_version_info_tool_bar, 1,0,1,2)
          
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	freq, #fc
        	samp_rate_, #bw
        	"", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/10)
        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.qtgui_sink_x_0.enable_rf_freq(False)
        
        
          
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 200e3, 30e3, firdes.WIN_HANN, 6.76))
        self._lo_locked_probe_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._lo_locked_probe_formatter = None
        else:
          self._lo_locked_probe_formatter = lambda x: x
        
        self._lo_locked_probe_tool_bar.addWidget(Qt.QLabel("LO locked"+": "))
        self._lo_locked_probe_label = Qt.QLabel(str(self._lo_locked_probe_formatter(self.lo_locked_probe)))
        self._lo_locked_probe_tool_bar.addWidget(self._lo_locked_probe_label)
        self.top_grid_layout.addWidget(self._lo_locked_probe_tool_bar, 4,0,1,2)
          
        def _current_freq_c_probe():
            while True:
                val = self.uhd_usrp_source_0.get_sensor('lo_locked')
                try:
                    self.set_current_freq_c(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _current_freq_c_thread = threading.Thread(target=_current_freq_c_probe)
        _current_freq_c_thread.daemon = True
        _current_freq_c_thread.start()
        def _chan0_lo_locked_probe():
            while True:
                val = self.uhd_usrp_source_0.get_sensor('lo_locked')
                try:
                    self.set_chan0_lo_locked(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))
        _chan0_lo_locked_thread = threading.Thread(target=_chan0_lo_locked_probe)
        _chan0_lo_locked_thread.daemon = True
        _chan0_lo_locked_thread.start()
        self.analog_wfm_rcv = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=10,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv, 0), (self.qtgui_sink_x_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.volume, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.volume, 0), (self.analog_wfm_rcv, 0))    
예제 #32
0
파일: mpsk_rx.py 프로젝트: NoelM1920/lpo
    def __init__(self):
        gr.top_block.__init__(self, "MPSK Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("MPSK Receiver")
        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_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.eb = eb = 0.35
        self.usrp_gain = usrp_gain = 40
        self.timing_loop_bw = timing_loop_bw = 0.01
        self.samp_rate = samp_rate = 1e6
        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_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.preamble = preamble = [
            1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1,
            -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1,
            -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1,
            1, 1, 1, 1, 1, -1, -1
        ]
        self.phase_bw = phase_bw = 0.1
        self.n = n = 4
        self.matched_filter = matched_filter = firdes.root_raised_cosine(
            nfilts, nfilts, 1, eb, int(11 * sps * nfilts))
        self.eq_gain = eq_gain = 0.01
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self._usrp_gain_layout = Qt.QVBoxLayout()
        self._usrp_gain_tool_bar = Qt.QToolBar(self)
        self._usrp_gain_layout.addWidget(self._usrp_gain_tool_bar)
        self._usrp_gain_tool_bar.addWidget(Qt.QLabel("USRP Gain" + ": "))
        self._usrp_gain_counter = Qwt.QwtCounter()
        self._usrp_gain_counter.setRange(0, 100, 1)
        self._usrp_gain_counter.setNumButtons(2)
        self._usrp_gain_counter.setValue(self.usrp_gain)
        self._usrp_gain_tool_bar.addWidget(self._usrp_gain_counter)
        self._usrp_gain_counter.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                               Qwt.QwtSlider.BottomScale,
                                               Qwt.QwtSlider.BgSlot)
        self._usrp_gain_slider.setRange(0, 100, 1)
        self._usrp_gain_slider.setValue(self.usrp_gain)
        self._usrp_gain_slider.setMinimumWidth(200)
        self._usrp_gain_slider.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_layout.addWidget(self._usrp_gain_slider)
        self.top_layout.addLayout(self._usrp_gain_layout)
        self._timing_loop_bw_layout = Qt.QVBoxLayout()
        self._timing_loop_bw_label = Qt.QLabel("Time: BW")
        self._timing_loop_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                                    Qwt.QwtSlider.BottomScale,
                                                    Qwt.QwtSlider.BgSlot)
        self._timing_loop_bw_slider.setRange(0.0, 0.2, 0.005)
        self._timing_loop_bw_slider.setValue(self.timing_loop_bw)
        self._timing_loop_bw_slider.setMinimumWidth(200)
        self._timing_loop_bw_slider.valueChanged.connect(
            self.set_timing_loop_bw)
        self._timing_loop_bw_label.setAlignment(Qt.Qt.AlignBottom
                                                | Qt.Qt.AlignHCenter)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_label)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_slider)
        self.top_grid_layout.addLayout(self._timing_loop_bw_layout, 0, 0, 1, 1)
        self._phase_bw_layout = Qt.QVBoxLayout()
        self._phase_bw_label = Qt.QLabel("Phase: Bandwidth")
        self._phase_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                              Qwt.QwtSlider.BottomScale,
                                              Qwt.QwtSlider.BgSlot)
        self._phase_bw_slider.setRange(0.0, 1.0, 0.01)
        self._phase_bw_slider.setValue(self.phase_bw)
        self._phase_bw_slider.setMinimumWidth(200)
        self._phase_bw_slider.valueChanged.connect(self.set_phase_bw)
        self._phase_bw_label.setAlignment(Qt.Qt.AlignBottom
                                          | Qt.Qt.AlignHCenter)
        self._phase_bw_layout.addWidget(self._phase_bw_label)
        self._phase_bw_layout.addWidget(self._phase_bw_slider)
        self.top_grid_layout.addLayout(self._phase_bw_layout, 0, 2, 1, 1)
        self._eq_gain_layout = Qt.QVBoxLayout()
        self._eq_gain_label = Qt.QLabel("Equalizer: rate")
        self._eq_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal,
                                             Qwt.QwtSlider.BottomScale,
                                             Qwt.QwtSlider.BgSlot)
        self._eq_gain_slider.setRange(0.0, 0.1, 0.001)
        self._eq_gain_slider.setValue(self.eq_gain)
        self._eq_gain_slider.setMinimumWidth(200)
        self._eq_gain_slider.valueChanged.connect(self.set_eq_gain)
        self._eq_gain_label.setAlignment(Qt.Qt.AlignBottom
                                         | Qt.Qt.AlignHCenter)
        self._eq_gain_layout.addWidget(self._eq_gain_label)
        self._eq_gain_layout.addWidget(self._eq_gain_slider)
        self.top_grid_layout.addLayout(self._eq_gain_layout, 0, 1, 1, 1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            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(2.4e9, 0)
        self.uhd_usrp_source_0.set_gain(usrp_gain, 0)
        self.qtgui_sink_x_1 = 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_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_0 = qtgui.sink_f(
            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.set_update_time(1.0 / 10)
        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.frame_detection_deinterleaver_bb_0 = frame_detection.deinterleaver_bb(
            n, n)
        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)
        self.digital_correlate_and_sync_cc_0 = digital.correlate_and_sync_cc(
            (preamble), (matched_filter), sps)
        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_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(8)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/home/ubuntu/rx_message",
                                                   False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 1),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0),
                     (self.blocks_pack_k_bits_bb_1, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_correlate_and_sync_cc_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.digital_constellation_decoder_cb_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),
                     (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_pack_k_bits_bb_1, 0),
                     (self.frame_detection_deinterleaver_bb_0, 0))
        self.connect((self.frame_detection_deinterleaver_bb_0, 0),
                     (self.blocks_file_sink_0, 0))
예제 #33
0
    def __init__(self,
                 parameter_0="addr=192.168.10.2",
                 parameter_1="addr=192.168.10.3"):
        gr.top_block.__init__(self, "BPSK_radios")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("BPSK_radios")
        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", "BPSK_radios")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.parameter_0 = parameter_0
        self.parameter_1 = parameter_1

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.variable_qtgui_range_0 = variable_qtgui_range_0 = 630e-3
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 45 * nfilts)
        self.freq = freq = 2e9
        self.bw = bw = 5e6
        self.Tx_Gain = Tx_Gain = 3
        self.Rx_Gain = Rx_Gain = 30

        ##################################################
        # Blocks
        ##################################################
        self.vocoder_alaw_encode_sb_0 = vocoder.alaw_encode_sb()
        self.vocoder_alaw_decode_bs_0 = vocoder.alaw_decode_bs()
        self._variable_qtgui_range_0_range = Range(0, 1, 1, 630e-3, 200)
        self._variable_qtgui_range_0_win = RangeWidget(
            self._variable_qtgui_range_0_range,
            self.set_variable_qtgui_range_0, "variable_qtgui_range_0",
            "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_0_win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("addr=192.168.10.3", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate * 10)
        self.uhd_usrp_source_0.set_time_now(uhd.time_spec(time.time()),
                                            uhd.ALL_MBOARDS)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(Rx_Gain, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_bandwidth(bw / 5, 0)
        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 * 10)
        self.uhd_usrp_sink_0.set_time_now(uhd.time_spec(time.time()),
                                          uhd.ALL_MBOARDS)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(Tx_Gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(bw / 5, 0)
        self.qtgui_sink_x_1 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            freq,  #fc
            samp_rate,  #bw
            "Recieved signal",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 5)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_1.enable_rf_freq(False)

        self.qtgui_sink_x_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_KAISER,  #wintype
            freq,  #fc
            samp_rate,  #bw
            "Modulator output",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(True)

        self.qtgui_number_sink_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                     qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("BER")

        labels = ["", "", "", "", "", "", "", "", "", ""]
        units = ["", "", "", "", "", "", "", "", "", ""]
        colors = [("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black"), ("black", "black"), ("black", "black"),
                  ("black", "black")]
        factor = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        for i in xrange(1):
            self.qtgui_number_sink_0.set_min(i, -1)
            self.qtgui_number_sink_0.set_max(i, 1)
            self.qtgui_number_sink_0.set_color(i, colors[i][0], colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0.set_label(i, labels[i])
            self.qtgui_number_sink_0.set_unit(i, units[i])
            self.qtgui_number_sink_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_win)
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            8, (filter.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 22)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.fec_ber_bf_0 = fec.ber_bf(False, 100, -7.0)
        self.digital_simple_framer_0 = digital.simple_framer(20)
        self.digital_simple_correlator_0 = digital.simple_correlator(20)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            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=2,
            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_wavfile_source_0 = blocks.wavfile_source(
            "/home/ettus/Música/bensound-photoalbum.wav", True)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            "testBPSK_sonido.wav", 1, 44100, 16)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_const_vxx_4 = blocks.multiply_const_vcc((2, ))
        self.blocks_multiply_const_vxx_3 = blocks.multiply_const_vff(
            (30.5176e-6, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((2, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc(
            (630e-3, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (32.768e3, ))
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.audio_sink_0 = audio.sink(44100, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.vocoder_alaw_encode_sb_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_3, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_4, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_const_vxx_4, 0),
                     (self.digital_psk_demod_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_3, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.digital_psk_demod_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.digital_psk_demod_0, 0), (self.fec_ber_bf_0, 1))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.digital_simple_correlator_0, 0),
                     (self.vocoder_alaw_decode_bs_0, 0))
        self.connect((self.digital_simple_framer_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.digital_simple_framer_0, 0), (self.fec_ber_bf_0, 0))
        self.connect((self.fec_ber_bf_0, 0), (self.qtgui_number_sink_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.digital_simple_correlator_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_multiply_const_vxx_4, 0))
        self.connect((self.vocoder_alaw_decode_bs_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.vocoder_alaw_encode_sb_0, 0),
                     (self.digital_simple_framer_0, 0))
예제 #34
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())

        ##################################################
        # Blocks
        ##################################################
        self.qtgui_sink_x_0 = qtgui.sink_f(
            256,  #fftsize
            firdes.WIN_HANN,  #wintype
            50,  #fc
            250,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 100)
        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)

        #test_source = TestSource()
        test_source = blocks.udp_source(gr.sizeof_float * 1, "127.0.0.1", 9999,
                                        1472, True)

        src = UDPSource()

        # Signal Conditioning: DC Block and 50 Hz Notch Filter
        ch1 = NotchFilter(src.channel1)
        #ch1 = src.channel1
        #ch1 = NotchFilter(ch1, freq=100)
        ch1 = DCBlock(ch1)

        #ch1 = BandPass(ch1, 1, 40)

        #notched = NotchFilter(notched)
        #notched = NotchFilter(notched)
        alpha = BandPass(ch1, 8, 12)
        alpha.color = 'green'
        alpha = RMS(alpha, 0.02)
        #alpha = ExponentialAverage(alpha, 5.1)

        smr = BandPass(ch1, 9.5, 12.5)

        sigs = alpha, smr
        rmss = map(RMS, sigs)

        #threshold = Threshold(rmss[1], 'increase')
        #oscclient = OSCSend(threshold.ratio, '/0x00/filter')
        #oscclient = OSCSend(rmss[1], '/0x00/filter')

        audio = BandPass(ch1, 7, 12)
        audio = ch1

        #osci = Oscilloscope(rmss[1])
        #osci = Oscilloscope(threshold.ratio)
        spec = BarSpectrogram(ch1, lo=0, hi=127, bins=256)

        vec = Stream2Vector(ch1)
        fft = FFT(vec)
        waterfall = WaterfallLines(fft.bins)
        #fft = FFT(Stream2Vector(ch1))

        osci = Oscilloscope(ch1)
        #self.top_layout.addWidget(waterfall.widget)
        waterfall.widget.show()

        self.top_layout.addWidget(osci.widget)

        audiosink = AudioSink(audio)

        hlayout = Qt.QHBoxLayout()
        hlayout.addWidget(osci.widget)
        #\hlayout.addWidget(threshold.widget)
        #widget = Qt.QWidget()
        #widget.addLayout(hlayout)

        #self.top_layout.addLayout(hlayout)

        self.top_layout.addWidget(spec.widget)

        visited = self.wireup(osci)
        #visited = self.wireup(osci0, visited)
        #visited = self.wireup(oscclient, visited)
        #        visited = self.wireup(threshold, visited)
        visited = self.wireup(spec, visited)

        visited = self.wireup(waterfall, visited)
예제 #35
0
    def __init__(self):
        gr.top_block.__init__(self, "GUI sink demonstration")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("GUI sink demonstration")
        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", "gui_sink_demonstration")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.waveform1 = waveform1 = 102
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self._waveform1_options = (
            101,
            102,
            103,
            104,
            105,
        )
        self._waveform1_labels = (
            'Sine',
            'Cosine',
            'Rectangular',
            'Triangular',
            'Saw tooth',
        )
        self._waveform1_tool_bar = Qt.QToolBar(self)
        self._waveform1_tool_bar.addWidget(
            Qt.QLabel('Waveform of signal source 1' + ": "))
        self._waveform1_combo_box = Qt.QComboBox()
        self._waveform1_tool_bar.addWidget(self._waveform1_combo_box)
        for label in self._waveform1_labels:
            self._waveform1_combo_box.addItem(label)
        self._waveform1_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._waveform1_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._waveform1_options.index(i)))
        self._waveform1_callback(self.waveform1)
        self._waveform1_combo_box.currentIndexChanged.connect(
            lambda i: self.set_waveform1(self._waveform1_options[i]))
        self.top_grid_layout.addWidget(self._waveform1_tool_bar, 0, 0, 1, 1)
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "",  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        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.qtgui_sink_x_0.enable_rf_freq(False)

        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, waveform1, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_0, 0))
예제 #36
0
    def __init__(self):
        gr.top_block.__init__(self, "MPSK Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("MPSK Receiver")
        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_rx")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 4
        self.nfilts = nfilts = 32
        self.eb = eb = 0.35
        self.usrp_gain = usrp_gain = 40
        self.timing_loop_bw = timing_loop_bw = 0.01
        self.samp_rate = samp_rate = 1e6
        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_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.preamble = preamble = [1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,1,1,1,1,-1,-1]
        self.phase_bw = phase_bw = 0.1
        self.n = n = 4
        self.matched_filter = matched_filter = firdes.root_raised_cosine(nfilts, nfilts, 1, eb, int(11*sps*nfilts))
        self.eq_gain = eq_gain = 0.01
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self._usrp_gain_layout = Qt.QVBoxLayout()
        self._usrp_gain_tool_bar = Qt.QToolBar(self)
        self._usrp_gain_layout.addWidget(self._usrp_gain_tool_bar)
        self._usrp_gain_tool_bar.addWidget(Qt.QLabel("USRP Gain"+": "))
        self._usrp_gain_counter = Qwt.QwtCounter()
        self._usrp_gain_counter.setRange(0, 100, 1)
        self._usrp_gain_counter.setNumButtons(2)
        self._usrp_gain_counter.setValue(self.usrp_gain)
        self._usrp_gain_tool_bar.addWidget(self._usrp_gain_counter)
        self._usrp_gain_counter.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._usrp_gain_slider.setRange(0, 100, 1)
        self._usrp_gain_slider.setValue(self.usrp_gain)
        self._usrp_gain_slider.setMinimumWidth(200)
        self._usrp_gain_slider.valueChanged.connect(self.set_usrp_gain)
        self._usrp_gain_layout.addWidget(self._usrp_gain_slider)
        self.top_layout.addLayout(self._usrp_gain_layout)
        self._timing_loop_bw_layout = Qt.QVBoxLayout()
        self._timing_loop_bw_label = Qt.QLabel("Time: BW")
        self._timing_loop_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._timing_loop_bw_slider.setRange(0.0, 0.2, 0.005)
        self._timing_loop_bw_slider.setValue(self.timing_loop_bw)
        self._timing_loop_bw_slider.setMinimumWidth(200)
        self._timing_loop_bw_slider.valueChanged.connect(self.set_timing_loop_bw)
        self._timing_loop_bw_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_label)
        self._timing_loop_bw_layout.addWidget(self._timing_loop_bw_slider)
        self.top_grid_layout.addLayout(self._timing_loop_bw_layout, 0,0,1,1)
        self._phase_bw_layout = Qt.QVBoxLayout()
        self._phase_bw_label = Qt.QLabel("Phase: Bandwidth")
        self._phase_bw_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._phase_bw_slider.setRange(0.0, 1.0, 0.01)
        self._phase_bw_slider.setValue(self.phase_bw)
        self._phase_bw_slider.setMinimumWidth(200)
        self._phase_bw_slider.valueChanged.connect(self.set_phase_bw)
        self._phase_bw_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._phase_bw_layout.addWidget(self._phase_bw_label)
        self._phase_bw_layout.addWidget(self._phase_bw_slider)
        self.top_grid_layout.addLayout(self._phase_bw_layout, 0,2,1,1)
        self._eq_gain_layout = Qt.QVBoxLayout()
        self._eq_gain_label = Qt.QLabel("Equalizer: rate")
        self._eq_gain_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._eq_gain_slider.setRange(0.0, 0.1, 0.001)
        self._eq_gain_slider.setValue(self.eq_gain)
        self._eq_gain_slider.setMinimumWidth(200)
        self._eq_gain_slider.valueChanged.connect(self.set_eq_gain)
        self._eq_gain_label.setAlignment(Qt.Qt.AlignBottom | Qt.Qt.AlignHCenter)
        self._eq_gain_layout.addWidget(self._eq_gain_label)
        self._eq_gain_layout.addWidget(self._eq_gain_slider)
        self.top_grid_layout.addLayout(self._eq_gain_layout, 0,1,1,1)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	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(2.4e9, 0)
        self.uhd_usrp_source_0.set_gain(usrp_gain, 0)
        self.qtgui_sink_x_1 = 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_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_win)
        
        
        self.qtgui_sink_x_0 = qtgui.sink_f(
        	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.set_update_time(1.0/10)
        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.frame_detection_deinterleaver_bb_0 = frame_detection.deinterleaver_bb(n, n)
        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)
        self.digital_correlate_and_sync_cc_0 = digital.correlate_and_sync_cc((preamble), (matched_filter), sps)
        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_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2)
        self.blocks_pack_k_bits_bb_1 = blocks.pack_k_bits_bb(8)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/ubuntu/rx_message", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0), (self.blocks_unpack_k_bits_bb_0, 0))
        self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_pack_k_bits_bb_1, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.digital_correlate_and_sync_cc_0, 0))
        self.connect((self.digital_correlate_and_sync_cc_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0))
        self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_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), (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_pack_k_bits_bb_1, 0), (self.frame_detection_deinterleaver_bb_0, 0))
        self.connect((self.frame_detection_deinterleaver_bb_0, 0), (self.blocks_file_sink_0, 0))
예제 #37
0
 def test02(self):
     self.qtsnk = qtgui.sink_f(1024, 5, 0, 1, "Test", True, True, True,
                               True, None)
예제 #38
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").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.working_samp_rate = working_samp_rate = 400e3
        self.volume = volume = 1
        self.transition_width = transition_width = 10e3
        self.samp_rate = samp_rate = 8e6
        self.freq = freq = 94.9e6
        self.channel_width = channel_width = 150e3
        self.center_freq = center_freq = 96e6
        self.audio_cutoff = audio_cutoff = 20e3

        ##################################################
        # Blocks
        ##################################################
        self._volume_range = Range(0, 11, 1, 1, 200)
        self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "counter_slider", float)
        self.top_layout.addWidget(self._volume_win)
        self._freq_tool_bar = Qt.QToolBar(self)
        self._freq_tool_bar.addWidget(Qt.QLabel("freq"+": "))
        self._freq_line_edit = Qt.QLineEdit(str(self.freq))
        self._freq_tool_bar.addWidget(self._freq_line_edit)
        self._freq_line_edit.returnPressed.connect(
        	lambda: self.set_freq(eng_notation.str_to_num(str(self._freq_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._freq_tool_bar)
        self._center_freq_tool_bar = Qt.QToolBar(self)
        self._center_freq_tool_bar.addWidget(Qt.QLabel('center_freq'+": "))
        self._center_freq_line_edit = Qt.QLineEdit(str(self.center_freq))
        self._center_freq_tool_bar.addWidget(self._center_freq_line_edit)
        self._center_freq_line_edit.returnPressed.connect(
        	lambda: self.set_center_freq(eng_notation.str_to_num(str(self._center_freq_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._center_freq_tool_bar)
        self._audio_cutoff_tool_bar = Qt.QToolBar(self)
        self._audio_cutoff_tool_bar.addWidget(Qt.QLabel("audio_cutoff"+": "))
        self._audio_cutoff_line_edit = Qt.QLineEdit(str(self.audio_cutoff))
        self._audio_cutoff_tool_bar.addWidget(self._audio_cutoff_line_edit)
        self._audio_cutoff_line_edit.returnPressed.connect(
        	lambda: self.set_audio_cutoff(eng_notation.str_to_num(str(self._audio_cutoff_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._audio_cutoff_tool_bar)
        self.spectrum = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	center_freq, #fc
        	samp_rate, #bw
        	'spectrum', #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.spectrum.set_update_time(1.0/10)
        self._spectrum_win = sip.wrapinstance(self.spectrum.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._spectrum_win)

        self.spectrum.enable_rf_freq(True)



        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=48000,
                decimation=int(working_samp_rate),
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_sink_x_1_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	center_freq, #fc
        	working_samp_rate, #bw
        	'demod', #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_1_0.set_update_time(1.0/10)
        self._qtgui_sink_x_1_0_win = sip.wrapinstance(self.qtgui_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_0_win)

        self.qtgui_sink_x_1_0.enable_rf_freq(False)



        self.qtgui_sink_x_1 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	center_freq, #fc
        	working_samp_rate, #bw
        	'FIR out', #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0/10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_1_win)

        self.qtgui_sink_x_1.enable_rf_freq(False)



        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, working_samp_rate, audio_cutoff, 1e3, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate/working_samp_rate), (firdes.low_pass(1, samp_rate, channel_width, transition_width)), freq - center_freq, samp_rate)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, ))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=working_samp_rate,
        	audio_decimation=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.qtgui_sink_x_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.spectrum, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
예제 #39
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").toByteArray())


        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 10
        self.samp_rate = samp_rate = 48000
        self.noise = noise = 1

        ##################################################
        # Blocks
        ##################################################
        self._volume_range = Range(1, 100, 1, 10, 200)
        self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "counter_slider", float)
        self.top_grid_layout.addWidget(self._volume_win)
        self._noise_range = Range(0, 10, 1, 1, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise, "noise", "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_win)
        self.wavsource = blocks.wavfile_source('C:\\Users\\sksha\\Desktop\\20190802132\\bciao.wav', True)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=100,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=100,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_sink_x_0_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #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_grid_layout.addWidget(self._qtgui_sink_x_0_0_win)

        self.qtgui_sink_x_0_0.enable_rf_freq(False)



        self.qtgui_sink_x_0 = qtgui.sink_c(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(False)



        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((volume, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0, ))
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_source_0 = audio.source(samp_rate, '', True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)
        self.analog_wfm_tx_0_0 = analog.wfm_tx(
        	audio_rate=samp_rate,
        	quad_rate=samp_rate,
        	tau=75e-6,
        	max_dev=5000,
        	fh=-1.0,
        )
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=1,
        )



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.analog_wfm_tx_0_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.analog_wfm_tx_0_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.analog_wfm_tx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_sink_x_0_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.wavsource, 0), (self.blocks_add_xx_0, 0))
예제 #40
0
    def __init__(self):
        gr.top_block.__init__(self, "Lab 3 Task 1B")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 3 Task 1B")
        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", "lab3_task1b")

        try:
            if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
                self.restoreGeometry(
                    self.settings.value("geometry").toByteArray())
            else:
                self.restoreGeometry(self.settings.value("geometry"))
        except:
            pass

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 3528000
        self.samp_msg = samp_msg = 44100

        ##################################################
        # 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, 'Modulated')
        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, 'Demodulated')
        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, 'Demodulated (only Real)')
        self.tab_widget_3 = Qt.QWidget()
        self.tab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_3)
        self.tab_grid_layout_3 = Qt.QGridLayout()
        self.tab_layout_3.addLayout(self.tab_grid_layout_3)
        self.tab.addTab(self.tab_widget_3, 'Demodulated (only Imag)')
        self.top_grid_layout.addWidget(self.tab)
        self.rational_resampler_xxx_0_0_0_0 = filter.rational_resampler_fff(
            interpolation=samp_msg,
            decimation=samp_rate,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_fff(
            interpolation=samp_msg,
            decimation=samp_rate,
            taps=None,
            fractional_bw=None)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=samp_msg,
            decimation=samp_rate,
            taps=None,
            fractional_bw=None)
        self.qtgui_sink_x_1 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Modulated',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_1.set_update_time(1.0 / 10)
        self._qtgui_sink_x_1_win = sip.wrapinstance(
            self.qtgui_sink_x_1.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_1.enable_rf_freq(False)

        self.tab_layout_0.addWidget(self._qtgui_sink_x_1_win)
        self.qtgui_sink_x_0_0_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_msg,  #bw
            'Demodulated (only Imag)',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0_0_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_0_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0_0_0.enable_rf_freq(False)

        self.tab_layout_3.addWidget(self._qtgui_sink_x_0_0_0_win)
        self.qtgui_sink_x_0_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_msg,  #bw
            'Demodulated (only Real)',  #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.qtgui_sink_x_0_0.enable_rf_freq(False)

        self.tab_layout_2.addWidget(self._qtgui_sink_x_0_0_win)
        self.qtgui_sink_x_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_msg,  #bw
            'Demodulated',  #name
            True,  #plotfreq
            True,  #plotwaterfall
            True,  #plottime
            True  #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0 / 10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)

        self.qtgui_sink_x_0.enable_rf_freq(False)

        self.tab_layout_1.addWidget(self._qtgui_sink_x_0_win)
        self.low_pass_filter_1_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 15000, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_1 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 15000, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 15000, 1000, firdes.WIN_KAISER,
                            6.76))
        self.iir_filter_xxx_2_0_0 = filter.iir_filter_ffd([1], [1, -0.95],
                                                          False)
        self.iir_filter_xxx_2_0 = filter.iir_filter_ffd([1], [1, -0.95], False)
        self.iir_filter_xxx_2 = filter.iir_filter_ffd([1], [1, -0.95], False)
        self.iir_filter_xxx_0_0 = filter.iir_filter_ffd([1, -1], [1], False)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd([1, -1], [1], True)
        self.dc_blocker_xx_0_0_0 = filter.dc_blocker_ff(10000, True)
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(32000, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(10000, True)
        self.blocks_wavfile_sink_0_0_0 = blocks.wavfile_sink(
            '/home/ipsit/Documents/EE 340/Lab 3/task1bi.wav', 1, samp_msg, 8)
        self.blocks_wavfile_sink_0_0 = blocks.wavfile_sink(
            '/home/ipsit/Documents/EE 340/Lab 3/task1br.wav', 1, samp_msg, 8)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            '/home/ipsit/Documents/EE 340/Lab 3/task1b.wav', 1, samp_msg, 8)
        self.blocks_throttle_1_0_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                       samp_msg, True)
        self.blocks_throttle_1_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                     samp_msg, True)
        self.blocks_throttle_1_0 = blocks.throttle(gr.sizeof_float * 1,
                                                   samp_msg, True)
        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_const_vxx_0_1_0 = blocks.multiply_const_ff(10)
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_ff(10)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_ff(1 / 6.28)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(100)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/ipsit/Documents/EE 340/Lab 3/task2b.dat', True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1, 1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_abs_xx_0_0 = blocks.abs_ff(1)
        self.blocks_abs_xx_0 = blocks.abs_ff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_abs_xx_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.blocks_abs_xx_0_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.iir_filter_xxx_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.iir_filter_xxx_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_throttle_1_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1_0, 0),
                     (self.blocks_throttle_1_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_sink_x_1, 0))
        self.connect((self.blocks_throttle_1_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_throttle_1_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_throttle_1_0_0, 0),
                     (self.blocks_wavfile_sink_0_0, 0))
        self.connect((self.blocks_throttle_1_0_0, 0),
                     (self.qtgui_sink_x_0_0, 0))
        self.connect((self.blocks_throttle_1_0_0_0, 0),
                     (self.blocks_wavfile_sink_0_0_0, 0))
        self.connect((self.blocks_throttle_1_0_0_0, 0),
                     (self.qtgui_sink_x_0_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.dc_blocker_xx_0_0_0, 0),
                     (self.rational_resampler_xxx_0_0_0_0, 0))
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_abs_xx_0, 0))
        self.connect((self.iir_filter_xxx_0_0, 0), (self.blocks_abs_xx_0_0, 0))
        self.connect((self.iir_filter_xxx_2, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.iir_filter_xxx_2_0, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.iir_filter_xxx_2_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_1_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.dc_blocker_xx_0_0, 0))
        self.connect((self.low_pass_filter_1_0, 0),
                     (self.dc_blocker_xx_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.iir_filter_xxx_2, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.iir_filter_xxx_2_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0_0, 0),
                     (self.iir_filter_xxx_2_0_0, 0))