Beispiel #1
0
	def setup_scopes(self):			
		#Input FFT
		if self.scopes.count("I"):
			self.input_fft_scope = fftsink2.fft_sink_c (self.panel, fft_size=1024, sample_rate=self.input_rate)
			self.connect(self.source, self.input_fft_scope)

		#Filter FFT
		if self.scopes.count("F"):
			self.filter_fft_scope = fftsink2.fft_sink_c (self.panel, fft_size=1024, sample_rate=self.input_rate)
			self.connect(self.filter, self.filter_fft_scope)

		#Burst Scope
		if self.scopes.count("b"):
			self.burst_scope = scopesink2.scope_sink_f(self.panel, sample_rate=self.gsm_symb_rate,v_scale=1)
			self.connect(self.v2s, self.burst_scope)
							
		#burst_f options
		if self.options.decoder.count("f"):
			if self.scopes.count("d"):
				self.demod_scope = scopesink2.scope_sink_f(self.panel, sample_rate=self.input_rate)
				self.connect(self.demod, self.demod_scope)

			if self.scopes.count("c"):
				#f_flowgraph
				self.clocked_scope = scopesink2.scope_sink_f(self.panel, sample_rate=self.gsm_symb_rate,v_scale=1)
				self.connect(self.clocker, self.clocked_scope)
Beispiel #2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ofdm Power4")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 10e3

        ##################################################
        # Blocks
        ##################################################
        self.thr = gr.throttle(gr.sizeof_float * 1, samp_rate)
        self.src = gr.vector_source_f(([float(n) - 50 for n in range(100)]), True, 1)
        self.sink2 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Output",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0.002,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.sink2.win)
        self.sink = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Input",
            sample_rate=samp_rate,
            v_scale=20,
            v_offset=0,
            t_scale=0.002,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.sink.win)
        self.ofdm_power4_ff_0 = ofdm.ofdm_swig.power4_ff()

        ##################################################
        # Connections
        ##################################################
        self.connect((self.src, 0), (self.thr, 0))
        self.connect((self.thr, 0), (self.sink, 0))
        self.connect((self.thr, 0), (self.ofdm_power4_ff_0, 0))
        self.connect((self.ofdm_power4_ff_0, 0), (self.sink2, 0))
Beispiel #3
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Lab 1")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.my_var = my_var = 5 + 6 # this is a + b
        self.freq = freq = 1e3

        ##################################################
        # Blocks
        ##################################################
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label="Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=0,
        	maximum=16e3,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        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, freq, 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.wxgui_scopesink2_0, 0))    
Beispiel #4
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=125,
			v_scale=0,
			v_offset=0,
			t_scale=1000,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_udp_source_1 = gr.udp_source(gr.sizeof_short*1, "127.0.0.1", 1235, 2, True, True)
		self.gr_short_to_float_0_0 = gr.short_to_float()

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_udp_source_1, 0), (self.gr_short_to_float_0_0, 0))
		self.connect((self.gr_short_to_float_0_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #5
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Replay")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8832000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/tmp/aaa", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #6
0
	def __init__(self, decim=16, N_id_1=134, N_id_2=0):
		grc_wxgui.top_block_gui.__init__(self, title="Sss Corr Gui")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.decim = decim
		self.N_id_1 = N_id_1
		self.N_id_2 = N_id_2

		##################################################
		# Variables
		##################################################
		self.sss_start_ts = sss_start_ts = 10608 - 2048 - 144
		self.samp_rate = samp_rate = 30720e3/decim

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=200,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, 2048/decim)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate*decim)
		self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, 2048/decim)
		self.gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, sss_start_ts)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((gen_sss_fd(N_id_1, N_id_2, 2048/decim).get_sss_conj_rev()))
		self.gr_integrate_xx_0 = gr.integrate_cc(2048/decim)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/user/git/gr-lte/gr-lte/test/traces/lte_02_796m_30720k_frame.cfile", True)
		self.gr_fft_vxx_0 = gr.fft_vcc(2048/decim, True, (window.blackmanharris(1024)), True, 1)
		self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
		self.fir_filter_xxx_0 = filter.fir_filter_ccc(decim, (firdes.low_pass(1, decim*samp_rate, 550e3, 100e3)))

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
		self.connect((self.gr_fft_vxx_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_vector_to_stream_0, 0))
		self.connect((self.gr_vector_to_stream_0, 0), (self.gr_integrate_xx_0, 0))
		self.connect((self.gr_integrate_xx_0, 0), (self.gr_complex_to_mag_0, 0))
		self.connect((self.gr_complex_to_mag_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_skiphead_0, 0))
		self.connect((self.gr_skiphead_0, 0), (self.fir_filter_xxx_0, 0))
		self.connect((self.fir_filter_xxx_0, 0), (self.gr_stream_to_vector_0, 0))
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Howto Square")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 10e3

		##################################################
		# Blocks
		##################################################
		self.sink = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Input",
			sample_rate=samp_rate,
			v_scale=20,
			v_offset=0,
			t_scale=0.002,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.Add(self.sink.win)
		self.sink2 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Output",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0.002,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.Add(self.sink2.win)
		self.sqr = howto.square_ff()
		self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1)
		self.thr = gr.throttle(gr.sizeof_float*1, samp_rate)

		##################################################
		# Connections
		##################################################
		self.connect((self.thr, 0), (self.sqr, 0))
		self.connect((self.src, 0), (self.thr, 0))
		self.connect((self.thr, 0), (self.sink, 0))
		self.connect((self.sqr, 0), (self.sink2, 0))
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000
		self.remove_head = remove_head = 0

		##################################################
		# Blocks
		##################################################
		self._remove_head_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.remove_head,
			callback=self.set_remove_head,
			label="Remove Head",
			choices=[0,1],
			labels=[],
			style=wx.RA_HORIZONTAL,
		)
		self.Add(self._remove_head_chooser)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_udp_source_0 = gr.udp_source(gr.sizeof_short*1, "192.168.2.200", 9997, 590, False, True)
		self.gr_short_to_float_0_0 = gr.short_to_float(1, 1)
		self.gr_short_to_float_0 = gr.short_to_float(1, 1)
		self.gr_file_sink_0_1_0 = gr.file_sink(gr.sizeof_short*1, "/home/cgardner/sandbox/gr-csg/gr-fp/grc_testfp/test_fp_odd.bin")
		self.gr_file_sink_0_1_0.set_unbuffered(True)
		self.gr_file_sink_0_1 = gr.file_sink(gr.sizeof_short*1, "/home/cgardner/sandbox/gr-csg/gr-fp/grc_testfp/test_raw_even.bin")
		self.gr_file_sink_0_1.set_unbuffered(True)
		self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_short*1)
		self.fpgnu_fpdata_sink_0 = fpgnu_swig.fpdata_sink(remove_head)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_udp_source_0, 0), (self.fpgnu_fpdata_sink_0, 0))
		self.connect((self.gr_short_to_float_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_deinterleave_0, 1), (self.gr_file_sink_0_1_0, 0))
		self.connect((self.fpgnu_fpdata_sink_0, 0), (self.gr_deinterleave_0, 0))
		self.connect((self.gr_deinterleave_0, 0), (self.gr_file_sink_0_1, 0))
		self.connect((self.gr_short_to_float_0_0, 0), (self.wxgui_scopesink2_0, 1))
		self.connect((self.gr_deinterleave_0, 1), (self.gr_short_to_float_0_0, 0))
		self.connect((self.gr_deinterleave_0, 0), (self.gr_short_to_float_0, 0))
Beispiel #9
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 50000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 1000, 1, firdes.WIN_HAMMING, 6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/students/btech/b13236/EE304P/Lab_2/sample_signal", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_0, 0))    
Beispiel #10
0
    def top_block_maker(frame, panel, vbox, arg):
      # TODO: compute correct rate, change to _c on demand?
      if isComplex:
        sink = scopesink2.scope_sink_c(panel, sample_rate=1e3)
      else:
        sink = scopesink2.scope_sink_f(panel, sample_rate=1e3)

      top_block.connect(data_block, sink)
      vbox.Add(sink.win, 10, wx.EXPAND)
      return top_block
Beispiel #11
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/home/pfb/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.gr_char_to_float_0 = gr.char_to_float()
		self.gr_scrambler_bb_0 = gr.scrambler_bb(0x8A, 0x7F, 7)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_char*1, samp_rate)
		self.gr_vector_source_x_0 = gr.vector_source_b((0, 0, 0), True, 1)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=50,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=1,
			v_offset=0,
			t_scale=0005,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.Add(self.wxgui_scopesink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_scrambler_bb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_scrambler_bb_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #12
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)

        sample_rate = 122880000
        ampl = 1

        #src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 2000000, ampl)
        src = iio.fmcomms_source()
        my_fft = scopesink2.scope_sink_f(panel, title="Osciloscope", sample_rate=sample_rate)
        self.connect(src, my_fft)
        vbox.Add(my_fft.win, 1, wx.EXPAND)
Beispiel #13
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="RTTY decoder example")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 44100

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate/40,
			v_scale=1,
			v_offset=0,
			t_scale=25e-3,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.rtty_decode_ff_0 = rtty.decode_ff(
		  samp_rate=samp_rate/40, 
		  baud_rate=45.45, 
		  polarity=True,
		)
		self.low_pass_filter_0 = gr.fir_filter_fff(40, firdes.low_pass(
			100, samp_rate, 45.45*3, 20, firdes.WIN_HANN, 6.76))
		self.gr_wavfile_source_0 = gr.wavfile_source("/home/nick/Downloads/ksm_rtty.wav", False)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
		self.gr_moving_average_xx_0 = gr.moving_average_ff(5000, 1.0/5000, 20000)
		self.gr_hilbert_fc_0 = gr.hilbert_fc(64)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "/home/nick/Desktop/rtty/test.dat")
		self.gr_file_sink_0.set_unbuffered(False)

		##################################################
		# Connections
		##################################################
		self.connect((self.low_pass_filter_0, 0), (self.gr_moving_average_xx_0, 0))
		self.connect((self.gr_moving_average_xx_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.gr_sub_xx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.rtty_decode_ff_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.rtty_decode_ff_0, 0))
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.gr_hilbert_fc_0, 0), (self.gr_quadrature_demod_cf_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.gr_hilbert_fc_0, 0))
Beispiel #14
0
	def _build_gui(self, vbox, usrp_rate, audio_rate):

		def _form_set_freq(kv):
			return self.set_freq(kv['freq'])

		if 1:
			self.fft = fftsink2.fft_sink_f (self.panel, title="Post FM Demod",
				fft_size=512, sample_rate=usrp_rate, y_per_div=10, ref_level=0)
			self.connect (self.fm_demod, self.fft)
			vbox.Add (self.fft.win, 4, wx.EXPAND)
		if 0:
			self.scope = scopesink2.scope_sink_f(self.panel, title="RDS timedomain",
				sample_rate=usrp_rate, num_inputs=2)
			self.connect (self.rds_bb_filter, (rds_scope,1))
			self.connect (self.rds_clock, (rds_scope,0))
			vbox.Add(self.scope.win, 4, wx.EXPAND)

		self.rdspanel = rdsPanel(self.msgq, self.panel)
		vbox.Add(self.rdspanel, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 20)

		# control area form at bottom
		self.myform = form.form()

		# 1st line
		hbox = wx.BoxSizer(wx.HORIZONTAL)
		self.myform.btn_down = wx.Button(self.panel, -1, "<<")
		self.myform.btn_down.Bind(wx.EVT_BUTTON, self.Seek_Down)
		hbox.Add(self.myform.btn_down, 0)
		self.myform['freq'] = form.float_field(
			parent=self.panel, sizer=hbox, label="Freq", weight=0,
			callback=self.myform.check_input_and_call(_form_set_freq, self._set_status_msg))
		hbox.Add((5,0), 0)
		self.myform.btn_up = wx.Button(self.panel, -1, ">>")
		self.myform.btn_up.Bind(wx.EVT_BUTTON, self.Seek_Up)
		hbox.Add(self.myform.btn_up, 0)
		self.myform['freq_slider'] = form.quantized_slider_field(
			parent=self.panel, sizer=hbox, weight=3,
			range=(87.5e6, 108e6, 0.1e6), callback=self.set_freq)
		hbox.Add((5,0), 0)
		vbox.Add(hbox, 0, wx.EXPAND)


		# 2nd line
		hbox = wx.BoxSizer(wx.HORIZONTAL)
		hbox.Add((5,0), 0)
		self.myform['volume'] = form.quantized_slider_field(parent=self.panel, sizer=hbox,
			label="Volume", weight=3, range=self.volume_range(), callback=self.set_vol)
		hbox.Add((5,0), 1)
		self.myform['gain'] = form.quantized_slider_field(parent=self.panel, sizer=hbox,
			label="Gain", weight=3, range=self.subdev.gain_range(), callback=self.set_gain)
		hbox.Add((5,0), 0)
		vbox.Add(hbox, 0, wx.EXPAND)
Beispiel #15
0
    def __init__(self,frame,panel,vbox,argv):
        stdgui2.std_top_block.__init__(self,frame,panel,vbox,argv)
        
        fft = fftsink2.fft_sink_f(panel, title="FFT display", fft_size=512, sample_rate=100000)
        vbox.Add(fft.win,4,wx.EXPAND)
        

        scope = scopesink2.scope_sink_f(panel, title="Oscilloscope", sample_rate=100000)
        vbox.Add(scope.win,4,wx.EXPAND)
        
        signal = gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
        throttle = gr.throttle(gr.sizeof_float,100000)
        self.connect(signal,throttle)
        self.connect(throttle,fft)
        self.connect(throttle,scope)
Beispiel #16
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Ais Demod Grc")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.sps = sps = 6
		self.samp_rate = samp_rate = 100e3
		self.nfilts = nfilts = 32
		self.data_rate = data_rate = 9600

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate/sps,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_2.win)
		self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate*sps)
		self.gr_quadrature_demod_cf_0 = gr.quadrature_demod_cf(1)
		self.gr_map_bb_0 = gr.map_bb(([-1, 1]))
		self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 0.004, (gr.firdes.gaussian(nfilts, float(nfilts)/sps, 0.4,  int(11*nfilts*sps))), nfilts, nfilts/2, 1.5, 1)
		self.digital_pfb_clock_sync_xxx_0.set_beta((0.004**2)*0.25)
		self.digital_gmskmod_bc_0 = digital.gmskmod_bc(sps, 0.4, 4)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_quadrature_demod_cf_0, 0), (self.wxgui_scopesink2_2, 0))
		self.connect((self.gr_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
		self.connect((self.digital_gmskmod_bc_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.random_source_x_0, 0), (self.gr_map_bb_0, 0))
		self.connect((self.gr_map_bb_0, 0), (self.digital_gmskmod_bc_0, 0))
		self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.gr_quadrature_demod_cf_0, 0))
Beispiel #17
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32e3

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.digital_map_bb_0 = digital.map_bb(([1, -1]))
        self.blocks_vector_source_x_0 = blocks.vector_source_i((1, 1, 1, 0), True, 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_int*1, samp_rate,True)
        self.blocks_int_to_float_0 = blocks.int_to_float(1, 1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_ctrlport_monitor_performance_0 = not True or monitor("gr-perf-monitorx")
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_float_to_char_0, 0))    
        self.connect((self.blocks_char_to_float_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_float_to_char_0, 0), (self.digital_map_bb_0, 0))    
        self.connect((self.blocks_int_to_float_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.blocks_int_to_float_0, 0))    
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.digital_map_bb_0, 0), (self.blocks_char_to_float_0, 0))    
Beispiel #18
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd((0.000005, ), ([1,1]), True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(100000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_phase_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.analog_phase_modulator_fc_0, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Set Offset With Message")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.messageutils_add_const_msg_0 = messageutils.add_const_msg(gr.sizeof_float, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "localhost", "52001", 10000)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.messageutils_add_const_msg_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.messageutils_add_const_msg_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.blocks_socket_pdu_0, "pdus", self.messageutils_add_const_msg_0, "msg")
Beispiel #20
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Joystick 101")

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

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.openavionics_joystick_interface_0 = openavionics.joystick_interface()
		self.openavionics_audio_ptt_0 = openavionics.audio_ptt()
		self.blocks_tag_debug_0 = blocks.tag_debug(gr.sizeof_float*1, "")
		self.audio_sink_0 = audio.sink(48000, "", True)
		self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 0.2, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.openavionics_audio_ptt_0, 0), (self.blocks_tag_debug_0, 0))
		self.connect((self.openavionics_audio_ptt_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.openavionics_audio_ptt_0, 0), (self.audio_sink_0, 0))
		self.connect((self.analog_sig_source_x_0, 0), (self.openavionics_audio_ptt_0, 0))

		##################################################
		# Asynch Message Connections
		##################################################
		self.msg_connect(self.openavionics_joystick_interface_0, "out", self.openavionics_audio_ptt_0, "in2")
Beispiel #21
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel

        parser = OptionParser(option_class=eng_option)
        parser.add_option("-W", "--waterfall", action="store_true", default=False,
                          help="Enable waterfall display")
        parser.add_option("-S", "--oscilloscope", action="store_true", default=False,
                          help="Enable oscilloscope display")
        parser.add_option("-I", "--audio-input", type="string", default="",
                          help="pcm input device name.  E.g., hw:0,0 or /dev/dsp")
        parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
                          help="set sample rate to RATE (48000)")

        (options, args) = parser.parse_args()
	sample_rate = int(options.sample_rate)

	if len(args) != 0:
            parser.print_help()
            sys.exit(1)

        self.show_debug_info = True

        # build the graph
        if options.waterfall:
            self.scope = \
              waterfallsink2.waterfall_sink_f (panel, fft_size=1024, sample_rate=sample_rate)
        elif options.oscilloscope:
            self.scope = scopesink2.scope_sink_f(panel, sample_rate=sample_rate)
        else:
            self.scope = fftsink2.fft_sink_f (panel, fft_size=1024, sample_rate=sample_rate, fft_rate=30,
					      ref_scale=1.0, ref_level=0, y_divs=12)

	self.src = audio.source (sample_rate, options.audio_input)

        self.connect(self.src, self.scope)

        self._build_gui(vbox)
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block Boxtest")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=2,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.container_float2float_0 = container.float2float("TTCTask_student")
        (self.container_float2float_0).set_processor_affinity([0])
        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.container_float2float_0, 0))
        self.connect((self.container_float2float_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.wxgui_scopesink2_0, 1))
Beispiel #23
0
	def _build_gui(self, vbox, usrp_rate, audio_rate):

		def _form_set_freq(kv):
			return self.set_freq(kv['freq'])

		if 1:
			self.fft = fftsink2.fft_sink_f (self.panel, title="Post FM Demod",
				fft_size=512, sample_rate=usrp_rate, y_per_div=10, ref_level=0)
			self.connect (self.fm_demod, self.fft)
			vbox.Add (self.fft.win, 4, wx.EXPAND)
		if 0:
			self.scope = scopesink2.scope_sink_f(self.panel, title="RDS timedomain",
				sample_rate=usrp_rate, num_inputs=2)
			self.connect (self.rds_bb_filter, (rds_scope,1))
			self.connect (self.rds_clock, (rds_scope,0))
			vbox.Add(self.scope.win, 4, wx.EXPAND)

		self.rdspanel = rdsPanel(self.msgq, self.panel)
		vbox.Add(self.rdspanel, 1, wx.EXPAND|wx.TOP|wx.BOTTOM, 20)

		# control area form at bottom
		self.myform = form.form()
Beispiel #24
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Corr Test Gui")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_vector_source_x_0 = gr.vector_source_f((concatenate((ones(10),zeros(200)),1)), True, 1)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.fir_filter_xxx_0 = filter.fir_filter_fff(1, (ones(10)))

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.fir_filter_xxx_0, 0))
		self.connect((self.fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.wxgui_scopesink2_0, 1))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Tcp Server")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_float*1,
        	addr='0.0.0.0',
        	port=12345,
        	server=True,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_tcp_source_0, 0), (self.wxgui_scopesink2_0, 0))
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 32000

		##################################################
		# Blocks
		##################################################
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.step_offset_0 = step_hierblock.HierBlock(1,1,100)
		    
		self.multiorder_tf_0 = gnuradio.multiorder_tf.multiorder_tf()
		self.multiorder_tf_0.set_parameters(0, 0, 0, 0, 0,0, 0.00137, 0, 1,3.30579, 4.78533, 1)
		    

		##################################################
		# Connections
		##################################################
		self.connect((self.step_offset_0, 0), (self.multiorder_tf_0, 0))
		self.connect((self.multiorder_tf_0, 0), (self.wxgui_scopesink2_0, 0))
Beispiel #27
0
 def __init__(self, parent, channels=1):
 #   ------------------------------------------------------------------------
     """
     Initialize, create and place wrapped Gnuradio object onto the underlying
     wx.Panel.
     """
     super(ScopeControl, self).__init__(parent)
     self.sink = scopesink2.scope_sink_f(
         self,
         title="Scope Plot",
         sample_rate=48000,
         v_scale=0.2,
         v_offset=0,
         t_scale=0.01,
         ac_couple=False,
         xy_mode=False,
         num_inputs=channels,
         trig_mode=gr.gr_TRIG_MODE_AUTO,
         y_axis_label="Amplitude",
     )
     self.sink.set_autorange(False)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(self.sink.win, proportion=1, flag=wx.EXPAND)
     self.SetSizer(sizer)
Beispiel #28
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Lab 3")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = int(48e3)
        self.freq = freq = 1e3

        ##################################################
        # Blocks
        ##################################################
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label="Frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=0,
            maximum=16e3,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, freq, 0.7, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.wxgui_scopesink2_0, 0))
Beispiel #29
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Dsd Grc")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self._config_freq_config = ConfigParser.ConfigParser()
		self._config_freq_config.read(".grc_op25")
		try: config_freq = self._config_freq_config.getfloat("main", "freq")
		except: config_freq = 489900000
		self.config_freq = config_freq
		self.freq = freq = config_freq
		self._config_xlate_offset_config = ConfigParser.ConfigParser()
		self._config_xlate_offset_config.read(".grc_op25")
		try: config_xlate_offset = self._config_xlate_offset_config.getfloat("main", "xlate_offset")
		except: config_xlate_offset = 0
		self.config_xlate_offset = config_xlate_offset
		self.click_freq = click_freq = freq-config_xlate_offset
		self.xlate_offset_fine = xlate_offset_fine = 0
		self.xlate_offset = xlate_offset = freq-click_freq
		self.samp_rate = samp_rate = 1000000
		self.samp_per_sym = samp_per_sym = 10
		self.decim = decim = 20
		self._config_xlate_bandwidth_config = ConfigParser.ConfigParser()
		self._config_xlate_bandwidth_config.read(".grc_op25")
		try: config_xlate_bandwidth = self._config_xlate_bandwidth_config.getfloat("main", "xlate_bandwidth")
		except: config_xlate_bandwidth = 24000
		self.config_xlate_bandwidth = config_xlate_bandwidth
		self.auto_tune_offset = auto_tune_offset = 0
		self.xlate_bandwidth = xlate_bandwidth = config_xlate_bandwidth
		self.variable_static_text_0 = variable_static_text_0 = freq+xlate_offset+xlate_offset_fine+auto_tune_offset
		self.squelch = squelch = -65
		self.pre_channel_rate = pre_channel_rate = samp_rate/decim
		self.gain = gain = 25
		self.fine_click_freq = fine_click_freq = 0
		self.channel_rate = channel_rate = 4800*samp_per_sym
		self.audio_mul = audio_mul = 0

		##################################################
		# Blocks
		##################################################
		_xlate_offset_fine_sizer = wx.BoxSizer(wx.VERTICAL)
		self._xlate_offset_fine_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_xlate_offset_fine_sizer,
			value=self.xlate_offset_fine,
			callback=self.set_xlate_offset_fine,
			label="Fine Offset",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._xlate_offset_fine_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_xlate_offset_fine_sizer,
			value=self.xlate_offset_fine,
			callback=self.set_xlate_offset_fine,
			minimum=-10000,
			maximum=10000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_xlate_offset_fine_sizer)
		self._xlate_offset_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.xlate_offset,
			callback=self.set_xlate_offset,
			label="Xlate Offset",
			converter=forms.float_converter(),
		)
		self.Add(self._xlate_offset_text_box)
		_xlate_bandwidth_sizer = wx.BoxSizer(wx.VERTICAL)
		self._xlate_bandwidth_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_xlate_bandwidth_sizer,
			value=self.xlate_bandwidth,
			callback=self.set_xlate_bandwidth,
			label="Xlate BW",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._xlate_bandwidth_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_xlate_bandwidth_sizer,
			value=self.xlate_bandwidth,
			callback=self.set_xlate_bandwidth,
			minimum=5000,
			maximum=50000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_xlate_bandwidth_sizer)
		self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB-1")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB-2")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "Xlate-1")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "Xlate-2")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "4FSK")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "Dibits")
		self.nb.AddPage(grc_wxgui.Panel(self.nb), "Traffic")
		self.Add(self.nb)
		_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_gain_sizer,
			value=self.gain,
			callback=self.set_gain,
			label="Gain",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_gain_sizer,
			value=self.gain,
			callback=self.set_gain,
			minimum=0,
			maximum=50,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_gain_sizer)
		self._freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.freq,
			callback=self.set_freq,
			label="Frequency",
			converter=forms.float_converter(),
		)
		self.Add(self._freq_text_box)
		_audio_mul_sizer = wx.BoxSizer(wx.VERTICAL)
		self._audio_mul_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_audio_mul_sizer,
			value=self.audio_mul,
			callback=self.set_audio_mul,
			label="Audio mul",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._audio_mul_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_audio_mul_sizer,
			value=self.audio_mul,
			callback=self.set_audio_mul,
			minimum=-30,
			maximum=10,
			num_steps=40,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_audio_mul_sizer)
		self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
			self.nb.GetPage(3).GetWin(),
			baseband_freq=0,
			dynamic_range=100,
			ref_level=50,
			ref_scale=2.0,
			sample_rate=channel_rate,
			fft_size=512,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Waterfall Plot",
		)
		self.nb.GetPage(3).Add(self.wxgui_waterfallsink2_0_0.win)
		self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
			self.nb.GetPage(1).GetWin(),
			baseband_freq=freq,
			dynamic_range=100,
			ref_level=50,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=512,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Waterfall Plot",
		)
		self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
		self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
			self.nb.GetPage(4).GetWin(),
			title="Scope Plot",
			sample_rate=channel_rate,
			v_scale=1.5,
			v_offset=0,
			t_scale=0.05,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.nb.GetPage(4).Add(self.wxgui_scopesink2_1.win)
		self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
			self.nb.GetPage(2).GetWin(),
			baseband_freq=fine_click_freq,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=channel_rate,
			fft_size=1024,
			fft_rate=30,
			average=True,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0.win)
		def wxgui_fftsink2_0_0_callback(x, y):
			self.set_fine_click_freq(x)
		
		self.wxgui_fftsink2_0_0.set_callback(wxgui_fftsink2_0_0_callback)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.nb.GetPage(0).GetWin(),
			baseband_freq=freq,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=True,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
		def wxgui_fftsink2_0_callback(x, y):
			self.set_click_freq(x)
		
		self.wxgui_fftsink2_0.set_callback(wxgui_fftsink2_0_callback)
		self._variable_static_text_0_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.variable_static_text_0,
			callback=self.set_variable_static_text_0,
			label="Final freq",
			converter=forms.float_converter(),
		)
		self.Add(self._variable_static_text_0_static_text)
		_squelch_sizer = wx.BoxSizer(wx.VERTICAL)
		self._squelch_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_squelch_sizer,
			value=self.squelch,
			callback=self.set_squelch,
			label="Squelch",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._squelch_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_squelch_sizer,
			value=self.squelch,
			callback=self.set_squelch,
			minimum=-100,
			maximum=100,
			num_steps=40,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_squelch_sizer)
		self.osmosdr_source_c_0 = osmosdr.source_c( args="nchan=" + str(1) + " " + "hackrf=0" )
		self.osmosdr_source_c_0.set_sample_rate(samp_rate)
		self.osmosdr_source_c_0.set_center_freq(freq, 0)
		self.osmosdr_source_c_0.set_freq_corr(0, 0)
		self.osmosdr_source_c_0.set_dc_offset_mode(0, 0)
		self.osmosdr_source_c_0.set_iq_balance_mode(0, 0)
		self.osmosdr_source_c_0.set_gain_mode(0, 0)
		self.osmosdr_source_c_0.set_gain(14, 0)
		self.osmosdr_source_c_0.set_if_gain(gain, 0)
		self.osmosdr_source_c_0.set_bb_gain(gain, 0)
		self.osmosdr_source_c_0.set_antenna("", 0)
		self.osmosdr_source_c_0.set_bandwidth(0, 0)
		  
		self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(decim, (firdes.low_pass(1, samp_rate, xlate_bandwidth/2, 6000)), xlate_offset+xlate_offset_fine-fine_click_freq, samp_rate)
		self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ((1.0/samp_per_sym,)*samp_per_sym))
		self.dsd_block_ff_0 = dsd.block_ff(dsd.dsd_FRAME_P25_PHASE_1,dsd.dsd_MOD_C4FM,3,3,True)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10.**(audio_mul/10.), ))
		self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_ccc(
			interpolation=channel_rate,
			decimation=pre_channel_rate,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=44100,
			decimation=8000,
			taps=None,
			fractional_bw=None,
		)
		self.audio_sink_0 = audio.sink(44100, "", True)
		self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1.6)

		##################################################
		# Connections
		##################################################
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.wxgui_fftsink2_0_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.wxgui_waterfallsink2_0_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.osmosdr_source_c_0, 0), (self.wxgui_waterfallsink2_0, 0))
		self.connect((self.osmosdr_source_c_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.dsd_block_ff_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.analog_quadrature_demod_cf_0, 0), (self.fir_filter_xxx_0, 0))
		self.connect((self.fir_filter_xxx_0, 0), (self.wxgui_scopesink2_1, 0))
		self.connect((self.fir_filter_xxx_0, 0), (self.dsd_block_ff_0, 0))
		self.connect((self.osmosdr_source_c_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.analog_quadrature_demod_cf_0, 0))
Beispiel #30
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="VA3RFT")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1920000
        self.offset = offset = 50000
        self.gain = gain = 40
        self.fsk_deviation_hz = fsk_deviation_hz = 8000
        self.freq = freq = 444475000
        self.corr = corr = 0

        ##################################################
        # Blocks
        ##################################################
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='RX gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=49.6,
            num_steps=124,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            label='Freq. correction',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._corr_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            minimum=-150,
            maximum=150,
            num_steps=300,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_corr_sizer)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=0,
            dynamic_range=50,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=48000,
            fft_size=512,
            fft_rate=3,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
        )
        self.Add(self.wxgui_waterfallsink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=48000,
            v_scale=0.25,
            v_offset=0,
            t_scale=0.001,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        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(freq - offset, 0)
        self.osmosdr_source_0.set_freq_corr(corr, 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(gain, 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_1 = filter.fir_filter_fff(
            1, firdes.low_pass(1, 48000, 8000, 2000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            40,
            firdes.low_pass(20, samp_rate, 3500, 2000, firdes.WIN_HAMMING,
                            6.76))
        self.dsd_block_ff_0 = dsd.dsd_block_ff(dsd.dsd_FRAME_DMR_MOTOTRBO,
                                               dsd.dsd_MOD_AUTO_SELECT, 3,
                                               True, 2)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.audio_sink_0 = audio.sink(8000, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -offset, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.dsd_block_ff_0, 0), (self.audio_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.low_pass_filter_1, 0), (self.dsd_block_ff_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
Beispiel #31
0
	def __init__(self, ppm=30, srate=2.4e6, fftsize=8192):
		grc_wxgui.top_block_gui.__init__(self, title="Tp Modes")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.ppm = ppm
		self.srate = srate
		self.fftsize = fftsize

		##################################################
		# Variables
		##################################################
		self.prefix = prefix = "/home/superkuh/vsrt_"
		self.recfile = recfile = prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".log"
		self.freq = freq = 1600e6
		self.bp_width = bp_width = 30e3
		self.bp_low = bp_low = 90e3
		self.actual_lower_freq = actual_lower_freq = 10.7e9
		self.IF_lower_freq = IF_lower_freq = 950e6
		self.scope_rate = scope_rate = 2.0
		self.record = record = False
		self.realfreq_display = realfreq_display = actual_lower_freq + (freq - IF_lower_freq)
		self.integ = integ = 1
		self.capture_file = capture_file = recfile
		self.bp_high = bp_high = bp_low+bp_width

		##################################################
		# Blocks
		##################################################
		self._record_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.record,
			callback=self.set_record,
			label="Record",
			true=True,
			false=False,
		)
		self.GridAdd(self._record_check_box, 0, 1, 1, 1)
		_integ_sizer = wx.BoxSizer(wx.VERTICAL)
		self._integ_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			label="Integration Time (Sec)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._integ_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			minimum=1,
			maximum=30,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_integ_sizer)
		self._capture_file_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.capture_file,
			callback=self.set_capture_file,
			label=" ",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._capture_file_text_box, 0, 2, 1, 1)
		_bp_low_sizer = wx.BoxSizer(wx.VERTICAL)
		self._bp_low_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_bp_low_sizer,
			value=self.bp_low,
			callback=self.set_bp_low,
			label="Bandpass Low End",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._bp_low_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_bp_low_sizer,
			value=self.bp_low,
			callback=self.set_bp_low,
			minimum=80e3,
			maximum=100e3,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_bp_low_sizer)
		self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="count of LNBF beat frequency bins",
			sample_rate=scope_rate,
			v_scale=0,
			v_offset=0,
			t_scale=450,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=srate,
			fft_size=2048,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="Total Power FFT Spectrum",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((srate/10)*integ), 1)
		self.rtl2832_source_0 = baz.rtl_source_c(defer_creation=True, output_size=gr.sizeof_gr_complex)
		self.rtl2832_source_0.set_verbose(True)
		self.rtl2832_source_0.set_vid(0x0)
		self.rtl2832_source_0.set_pid(0x0)
		self.rtl2832_source_0.set_tuner_name("r820t")
		self.rtl2832_source_0.set_default_timeout(0)
		self.rtl2832_source_0.set_use_buffer(True)
		self.rtl2832_source_0.set_fir_coefficients(([]))
		
		self.rtl2832_source_0.set_read_length(0)
		
		
		
		
		if self.rtl2832_source_0.create() == False: raise Exception("Failed to create RTL2832 Source: rtl2832_source_0")
		
		
		self.rtl2832_source_0.set_sample_rate(scope_rate)
		
		self.rtl2832_source_0.set_frequency(IF_lower_freq)
		
		
		
		self.rtl2832_source_0.set_auto_gain_mode(True)
		self.rtl2832_source_0.set_relative_gain(True)
		self.rtl2832_source_0.set_gain(0)
		  
		self._realfreq_display_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.realfreq_display,
			callback=self.set_realfreq_display,
			label="Actual Frequency",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._realfreq_display_static_text, 0, 0, 1, 1)
		self.low_pass_filter_0 = gr.fir_filter_fff(int(srate/24e4), firdes.low_pass(
			1, srate, 200e3, 24e3, firdes.WIN_HAMMING, 6.76))
		_freq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._freq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_freq_sizer,
			value=self.freq,
			callback=self.set_freq,
			label="Frequency",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._freq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_freq_sizer,
			value=self.freq,
			callback=self.set_freq,
			minimum=950e6,
			maximum=2150e6,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_freq_sizer)
		self._bp_width_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.bp_width,
			callback=self.set_bp_width,
			label="BP Width",
			converter=forms.int_converter(),
		)
		self.GridAdd(self._bp_width_text_box, 0, 4, 1, 1)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, int(srate/20))
		self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_float*1, "/dev/null" if record == False else capture_file)
		self.blocks_file_sink_1.set_unbuffered(True)
		self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
		self.band_pass_filter_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, srate/5, bp_low, bp_high, 24e3, firdes.WIN_HAMMING, 6.76))

		##################################################
		# Connections
		##################################################
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_scopesink2_0_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_file_sink_1, 0))
		self.connect((self.rtl2832_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
Beispiel #32
0
    def __init__(self, options, hostname, msgq):
        grc_wxgui.top_block_gui.__init__(self, title="receiver_block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
        ##################################################
        # Variables
        ##################################################
        """
        window_size = options.window_size
        sync_length = options.sync_length
        gain = options.gain
        freq = options.freq
        samp_rate = options.bandwidth
        """
        self.window_size = window_size = 48
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 10e6
        self.lo_offset = lo_offset = 11e6
        self.gain = gain = 20
        self.freq = freq = 5.89e9
        self.chan_est = chan_est = 1
        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.samp_rate,
            callback=self.set_samp_rate,
            label="Sample Rate",
            choices=[5e6, 10e6, 20e6],
            labels=["5 MHz", "10 MHz", "20 MHz"],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._samp_rate_chooser)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation")
        self.Add(self.nb)
        self._lo_offset_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.lo_offset,
            callback=self.set_lo_offset,
            label="LO Offset",
            choices=[0, 6e6, 11e6],
            labels=['0 MHz', '6 MHz', '11 MHz'],
        )
        self.Add(self._lo_offset_chooser)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='gain',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self._freq_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label="Channel",
            choices=[
                2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0,
                2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0,
                2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0,
                2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0,
                5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0,
                5230000000.0, 5240000000.0, 5260000000.0, 5280000000.0,
                5300000000.0, 5320000000.0, 5500000000.0, 5520000000.0,
                5540000000.0, 5560000000.0, 5580000000.0, 5600000000.0,
                5620000000.0, 5640000000.0, 5660000000.0, 5680000000.0,
                5700000000.0, 5745000000.0, 5765000000.0, 5785000000.0,
                5805000000.0, 5825000000.0, 5860000000.0, 5870000000.0,
                5880000000.0, 5890000000.0, 5900000000.0, 5910000000.0,
                5920000000.0
            ],
            labels=[
                '  1 | 2412.0 | 11g', '  2 | 2417.0 | 11g',
                '  3 | 2422.0 | 11g', '  4 | 2427.0 | 11g',
                '  5 | 2432.0 | 11g', '  6 | 2437.0 | 11g',
                '  7 | 2442.0 | 11g', '  8 | 2447.0 | 11g',
                '  9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g',
                ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g',
                ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g',
                ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a',
                ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a',
                ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a',
                ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a',
                ' 52 | 5260.0 | 11a', ' 56 | 5280.0 | 11a',
                ' 58 | 5300.0 | 11a', ' 60 | 5320.0 | 11a',
                '100 | 5500.0 | 11a', '104 | 5520.0 | 11a',
                '108 | 5540.0 | 11a', '112 | 5560.0 | 11a',
                '116 | 5580.0 | 11a', '120 | 5600.0 | 11a',
                '124 | 5620.0 | 11a', '128 | 5640.0 | 11a',
                '132 | 5660.0 | 11a', '136 | 5680.0 | 11a',
                '140 | 5700.0 | 11a', '149 | 5745.0 | 11a',
                '153 | 5765.0 | 11a', '157 | 5785.0 | 11a',
                '161 | 5805.0 | 11a', '165 | 5825.0 | 11a',
                '172 | 5860.0 | 11p', '174 | 5870.0 | 11p',
                '176 | 5880.0 | 11p', '178 | 5890.0 | 11p',
                '180 | 5900.0 | 11p', '182 | 5910.0 | 11p',
                '184 | 5920.0 | 11p'
            ],
        )
        self.Add(self._freq_chooser)
        self._chan_est_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.chan_est,
            callback=self.set_chan_est,
            label='chan_est',
            choices=[0, 1],
            labels=["LMS", "Linear Comb"],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chan_est_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.nb.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_scopesink1 = scopesink2.scope_sink_c(
            self.nb.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=12500,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=True,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(0).Add(self.wxgui_scopesink1.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit="%",
            minval=0,
            maxval=100,
            factor=1.0,
            decimal_places=2,
            ref_level=0,
            sample_rate=1,
            number_rate=15,
            average=True,
            avg_alpha=0.02,
            label="Frame Error Rate",
            peak_hold=False,
            show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(
            uhd.tune_request(freq,
                             rf_freq=freq - lo_offset,
                             rf_freq_policy=uhd.tune_request.POLICY_MANUAL), 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)

        self.ieee802_11_ofdm_sync_short_0 = ieee802_11.ofdm_sync_short(
            0.56, 2, False, False)
        self.ieee802_11_ofdm_sync_long_0 = ieee802_11.ofdm_sync_long(
            sync_length, True, False)
        self.ieee802_11_ofdm_parse_mac_0 = ieee802_11.ofdm_parse_mac(
            False, True)
        self.ieee802_11_ofdm_equalize_symbols_0 = ieee802_11.ofdm_equalize_symbols(
            chan_est, False)
        self.ieee802_11_ofdm_decode_signal_0 = ieee802_11.ofdm_decode_signal(
            True, False)
        self.ieee802_11_ofdm_decode_mac_0 = ieee802_11.ofdm_decode_mac(
            True, False)
        self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(
            window_size + 16)
        self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(
            window_size)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True,
                                     1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, 48)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 64)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.float_t, "packet_len")
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1,
                                           sync_length)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_11_ofdm_decode_mac_0, 'out'),
                         (self.ieee802_11_ofdm_parse_mac_0, 'in'))
        self.msg_connect((self.ieee802_11_ofdm_parse_mac_0, 'fer'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_divide_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.ieee802_11_moving_average_xx_1, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_delay_0, 0),
                     (self.ieee802_11_ofdm_sync_long_0, 1))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 0))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 2))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.ieee802_11_moving_average_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.wxgui_scopesink1, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.ieee802_11_ofdm_equalize_symbols_0, 0))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.ieee802_11_ofdm_sync_short_0, 1))
        self.connect((self.ieee802_11_moving_average_xx_1, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.ieee802_11_ofdm_decode_signal_0, 0),
                     (self.ieee802_11_ofdm_decode_mac_0, 0))
        self.connect((self.ieee802_11_ofdm_equalize_symbols_0, 0),
                     (self.ieee802_11_ofdm_decode_signal_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_long_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.ieee802_11_ofdm_sync_short_0, 0),
                     (self.ieee802_11_ofdm_sync_long_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
Beispiel #33
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 500000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title='Constellation Plot',
            sample_rate=samp_rate,
            frame_rate=5,
            const_size=2048,
            M=4,
            theta=0,
            loop_bw=6.28 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=samp_rate / 4.,
            omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_0.win)
        self.digital_qam_mod_0 = digital.qam.qam_mod(
            constellation_points=16,
            mod_code="gray",
            differential=True,
            samples_per_symbol=4,
            excess_bw=0.90,
            verbose=False,
            log=False,
        )
        self.digital_qam_demod_0 = digital.qam.qam_demod(
            constellation_points=16,
            differential=True,
            samples_per_symbol=4,
            excess_bw=0.90,
            freq_bw=6.28 / 100.0,
            timing_bw=6.28 / 100.0,
            phase_bw=6.28 / 100.0,
            mod_code="gray",
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_xx_0_2 = 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_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_complex_to_imag_0_0 = blocks.complex_to_imag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 25000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 25000, 1, 0)
        self.analog_random_source_x_0 = blocks.vector_source_s(
            map(int, numpy.random.randint(0, 2, 2000000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_short_to_float_0, 0))
        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, 0))
        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_2, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_xx_0_2, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_imag_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.digital_qam_mod_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.digital_qam_demod_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_xx_0_2, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.digital_qam_demod_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.digital_qam_mod_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.digital_qam_mod_0, 0),
                     (self.blocks_complex_to_imag_0_0, 0))
        self.connect((self.digital_qam_mod_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960e3

        ##################################################
        # Blocks
        ##################################################
        self.notebook = self.notebook = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "modulated")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "FFT modulated")
        self.Add(self.notebook)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook.GetPage(0).GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.notebook.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd((1 / samp_rate, ),
                                                      ([1, 0.99]), True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_SIN_WAVE, 100e3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(6.28 *
                                                                     75e3)

        ##################################################
        # Connections
        ##################################################
        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.iir_filter_xxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.iir_filter_xxx_0, 0),
                     (self.analog_phase_modulator_fc_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.bf_weight = bf_weight = 1
        self.variable_static_text_0 = variable_static_text_0 = bf_weight
        self.tx_gain = tx_gain = 75
        self.tx_freq = tx_freq = 892e6
        self.samp_rate = samp_rate = 200000
        self.rx_freq = rx_freq = 2425.7275e6
        self.fsk_deviation_hz = fsk_deviation_hz = 38e3

        ##################################################
        # Blocks
        ##################################################
        self.EnergyBeamforming_randphpert4_f_0 = EnergyBeamforming.randphpert4_f(
            10, 1)
        _tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tx_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tx_gain_sizer,
            value=self.tx_gain,
            callback=self.set_tx_gain,
            label="tx_gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._tx_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tx_gain_sizer,
            value=self.tx_gain,
            callback=self.set_tx_gain,
            minimum=-30,
            maximum=100,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_tx_gain_sizer)

        def _bf_weight_probe():
            while True:
                val = self.EnergyBeamforming_randphpert4_f_0.poll_complex_gain(
                )
                try:
                    self.set_bf_weight(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (200000))

        _bf_weight_thread = threading.Thread(target=_bf_weight_probe)
        _bf_weight_thread.daemon = True
        _bf_weight_thread.start()
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self._variable_static_text_0_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.variable_static_text_0,
            callback=self.set_variable_static_text_0,
            label='variable_static_text_0',
            converter=forms.str_converter(),
        )
        self.Add(self._variable_static_text_0_static_text)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("serial=30BC5F6", "")),
            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(
            uhd.tune_request(rx_freq,
                             dsp_freq=0,
                             dsp_freq_policy=uhd.tune_request.POLICY_MANUAL),
            0)
        self.uhd_usrp_source_0.set_gain(60, 0)
        self.uhd_usrp_source_0.set_antenna("RX2", 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("serial=30BC5F6", "")),
            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(
            uhd.tune_request(tx_freq,
                             dsp_freq=0,
                             dsp_freq_policy=uhd.tune_request.POLICY_MANUAL),
            0)
        self.uhd_usrp_sink_0.set_gain(tx_gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_1 = filter.fir_filter_fff(
            17,
            firdes.low_pass(1, samp_rate, 2400, 1200, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 60000, 25000, firdes.WIN_HAMMING,
                            6.76))
        self.digital_clock_recovery_mm_xx_1 = digital.clock_recovery_mm_ff(
            8.33, 0.01, 0, 0.1, 0.01)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            samp_rate / (2 * math.pi * fsk_deviation_hz / 8.0))
        self.EnergyBeamforming_tx_packet_source_0 = EnergyBeamforming.tx_packet_source(
            samp_rate, 0.040, 1500, rx_freq, tx_freq)
        self.EnergyBeamforming_multi_slicer_fi_0 = EnergyBeamforming.multi_slicer_fi(
            5.5, -10)
        self.EnergyBeamforming_lo_estimation_cf_0 = EnergyBeamforming.lo_estimation_cf(
            samp_rate, 0.00001, 1200, 512, 192)
        self.EnergyBeamforming_ekf_ff_0 = EnergyBeamforming.ekf_ff(
            samp_rate, 0.050, 0, (0.05, 1, 1, 38),
            (0.0000000225, 0.0000000225, 100))
        self.EnergyBeamforming_bfweight_cc_0 = EnergyBeamforming.bfweight_cc(
            bf_weight)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.EnergyBeamforming_bfweight_cc_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.EnergyBeamforming_ekf_ff_0, 1),
                     (self.EnergyBeamforming_tx_packet_source_0, 1))
        self.connect((self.EnergyBeamforming_ekf_ff_0, 0),
                     (self.EnergyBeamforming_tx_packet_source_0, 0))
        self.connect((self.EnergyBeamforming_ekf_ff_0, 3),
                     (self.EnergyBeamforming_tx_packet_source_0, 3))
        self.connect((self.EnergyBeamforming_ekf_ff_0, 2),
                     (self.EnergyBeamforming_tx_packet_source_0, 2))
        self.connect((self.EnergyBeamforming_lo_estimation_cf_0, 2),
                     (self.EnergyBeamforming_ekf_ff_0, 2))
        self.connect((self.EnergyBeamforming_lo_estimation_cf_0, 4),
                     (self.EnergyBeamforming_ekf_ff_0, 4))
        self.connect((self.EnergyBeamforming_lo_estimation_cf_0, 0),
                     (self.EnergyBeamforming_ekf_ff_0, 0))
        self.connect((self.EnergyBeamforming_lo_estimation_cf_0, 1),
                     (self.EnergyBeamforming_ekf_ff_0, 1))
        self.connect((self.EnergyBeamforming_lo_estimation_cf_0, 3),
                     (self.EnergyBeamforming_ekf_ff_0, 3))
        self.connect((self.EnergyBeamforming_multi_slicer_fi_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.EnergyBeamforming_tx_packet_source_0, 0),
                     (self.EnergyBeamforming_bfweight_cc_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.EnergyBeamforming_randphpert4_f_0, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.wxgui_scopesink2_1, 0))
        self.connect((self.digital_clock_recovery_mm_xx_1, 0),
                     (self.EnergyBeamforming_multi_slicer_fi_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.EnergyBeamforming_lo_estimation_cf_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.digital_clock_recovery_mm_xx_1, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
Beispiel #36
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="General I/Q Receiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2500000
        self.rf_gain = rf_gain = 7
        self.if_gain = if_gain = 7
        self.f_c = f_c = 1000
        self.bb_gain = bb_gain = 7
        self.ReceiverGain = ReceiverGain = 30

        ##################################################
        # Blocks
        ##################################################
        _rf_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rf_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rf_gain_sizer,
            value=self.rf_gain,
            callback=self.set_rf_gain,
            label='RF',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rf_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rf_gain_sizer,
            value=self.rf_gain,
            callback=self.set_rf_gain,
            minimum=0,
            maximum=90,
            num_steps=90,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_rf_gain_sizer, 9, 2, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Scope Plot")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Magnitude")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Phase")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Real")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Imaginary")
        self.Add(self.notebook_0)
        _if_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._if_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_if_gain_sizer,
            value=self.if_gain,
            callback=self.set_if_gain,
            label='IF',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._if_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_if_gain_sizer,
            value=self.if_gain,
            callback=self.set_if_gain,
            minimum=0,
            maximum=60,
            num_steps=60,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_if_gain_sizer, 9, 1, 1, 1)
        _bb_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._bb_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_bb_gain_sizer,
            value=self.bb_gain,
            callback=self.set_bb_gain,
            label='BB',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._bb_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_bb_gain_sizer,
            value=self.bb_gain,
            callback=self.set_bb_gain,
            minimum=0,
            maximum=90,
            num_steps=90,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_bb_gain_sizer, 9, 3, 1, 1)
        self.wxgui_scopesink3 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=.05,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=True,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink3.win)
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(4).GetWin(),
            title='Imaginary',
            sample_rate=samp_rate,
            v_scale=0.05,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook_0.GetPage(4).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(3).GetWin(),
            title='Real',
            sample_rate=samp_rate,
            v_scale=.05,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_scopesink2 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            title='Phase',
            sample_rate=samp_rate,
            v_scale=1,
            v_offset=0,
            t_scale=0.002,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_scopesink2.win)
        self.wxgui_scopesink1 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            title='Magnitude',
            sample_rate=samp_rate,
            v_scale=.05,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink1.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=4,
            taps=None,
            fractional_bw=None,
        )
        self.osmosdr_source_1 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               'airspy')
        self.osmosdr_source_1.set_sample_rate(samp_rate)
        self.osmosdr_source_1.set_center_freq(200000000, 0)
        self.osmosdr_source_1.set_freq_corr(0, 0)
        self.osmosdr_source_1.set_dc_offset_mode(0, 0)
        self.osmosdr_source_1.set_iq_balance_mode(0, 0)
        self.osmosdr_source_1.set_gain_mode(False, 0)
        self.osmosdr_source_1.set_gain(rf_gain, 0)
        self.osmosdr_source_1.set_if_gain(if_gain, 0)
        self.osmosdr_source_1.set_bb_gain(bb_gain, 0)
        self.osmosdr_source_1.set_antenna('', 0)
        self.osmosdr_source_1.set_bandwidth(0, 0)

        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        _ReceiverGain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ReceiverGain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ReceiverGain_sizer,
            value=self.ReceiverGain,
            callback=self.set_ReceiverGain,
            label='ReceiverGain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ReceiverGain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ReceiverGain_sizer,
            value=self.ReceiverGain,
            callback=self.set_ReceiverGain,
            minimum=0,
            maximum=38,
            num_steps=38,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_ReceiverGain_sizer)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.wxgui_scopesink2, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.wxgui_scopesink2_2, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.wxgui_scopesink1, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.osmosdr_source_1, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_complex_to_arg_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_mag_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.wxgui_scopesink3, 0))
Beispiel #37
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Funtenna Demod")

        ##################################################
        # Variables
        ##################################################
        self.symbol_threshold = symbol_threshold = .4
        self.sample_threshold = sample_threshold = 115
        self.samp_rate = samp_rate = 250000
        self.initial_dec = initial_dec = 20
        self.complex_dec = complex_dec = 10
        self.center_freq = center_freq = 29494830
        self.bandwidth = bandwidth = 550
        self.amplitude_filter = amplitude_filter = 10
        self.amplitude_dec = amplitude_dec = 1

        ##################################################
        # Blocks
        ##################################################
        self._symbol_threshold_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.symbol_threshold,
            callback=self.set_symbol_threshold,
            label="Amplitude Threshold (n)",
            converter=forms.float_converter(),
        )
        self.Add(self._symbol_threshold_text_box)
        self._sample_threshold_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.sample_threshold,
            callback=self.set_sample_threshold,
            label="Sample Threshold",
            converter=forms.float_converter(),
        )
        self.Add(self._sample_threshold_text_box)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab1")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab2")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tab3")
        self.Add(self.notebook_0)
        self._initial_dec_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.initial_dec,
            callback=self.set_initial_dec,
            label="Initial Decimation",
            converter=forms.float_converter(),
        )
        self.Add(self._initial_dec_text_box)
        _complex_dec_sizer = wx.BoxSizer(wx.VERTICAL)
        self._complex_dec_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_complex_dec_sizer,
            value=self.complex_dec,
            callback=self.set_complex_dec,
            label="Complex Filter Decimation",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._complex_dec_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_complex_dec_sizer,
            value=self.complex_dec,
            callback=self.set_complex_dec,
            minimum=1,
            maximum=400,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_complex_dec_sizer)
        self._center_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.center_freq,
            callback=self.set_center_freq,
            label="Center Frequency",
            converter=forms.float_converter(),
        )
        self.Add(self._center_freq_text_box)
        self._bandwidth_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.bandwidth,
            callback=self.set_bandwidth,
            label="Bandwidth",
            converter=forms.float_converter(),
        )
        self.Add(self._bandwidth_text_box)
        self._amplitude_filter_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.amplitude_filter,
            callback=self.set_amplitude_filter,
            label="Amplitude Filter (Hz)",
            converter=forms.float_converter(),
        )
        self.Add(self._amplitude_filter_text_box)
        _amplitude_dec_sizer = wx.BoxSizer(wx.VERTICAL)
        self._amplitude_dec_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_amplitude_dec_sizer,
            value=self.amplitude_dec,
            callback=self.set_amplitude_dec,
            label="Amplitude Decimation",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._amplitude_dec_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_amplitude_dec_sizer,
            value=self.amplitude_dec,
            callback=self.set_amplitude_dec,
            minimum=0,
            maximum=1000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_amplitude_dec_sizer)
        self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / initial_dec,
            fft_size=256,
            fft_rate=65,
            average=False,
            avg_alpha=None,
            title="Decimated IQ",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_waterfallsink2_0_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(0).GetWin(),
            title="Filtered Magnitude",
            sample_rate=samp_rate / initial_dec / complex_dec / amplitude_dec,
            v_scale=.000000005,
            v_offset=0,
            t_scale=.5,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            title="Pre-demod",
            sample_rate=samp_rate / initial_dec / complex_dec / amplitude_dec,
            v_scale=1,
            v_offset=.00000,
            t_scale=0.5,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            amplitude_dec,
            firdes.low_pass(1, (samp_rate / initial_dec) / complex_dec,
                            amplitude_filter, 50, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            complex_dec,
            firdes.low_pass(1, samp_rate / initial_dec, bandwidth, 20,
                            firdes.WIN_HAMMING, 6.76))
        self.funtenna_ook_demod_funtenna_demod_1 = funtenna_ook_demod.funtenna_demod(
            sample_threshold)
        self.funtenna_ook_demod_funtenna_decode_1 = funtenna_ook_demod.funtenna_decode(
            ([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            initial_dec, (1, ), center_freq, samp_rate)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(
            .000000001 * symbol_threshold, .000000001 * symbol_threshold, 0)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "./funtenna_iq.bin", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "./funtenna_out.txt", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.funtenna_ook_demod_funtenna_demod_1, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_waterfallsink2_0_0, 0))
        self.connect((self.funtenna_ook_demod_funtenna_decode_1, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.funtenna_ook_demod_funtenna_demod_1, 0),
                     (self.funtenna_ook_demod_funtenna_decode_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.wxgui_scopesink2_1, 0))
Beispiel #38
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="low_pass_filter")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 10000
        self.f1 = f1 = 800
        self.f0 = f0 = 1000
        self.amp1 = amp1 = 0.5
        self.amp0 = amp0 = 0.5

        ##################################################
        # Blocks
        ##################################################
        self.nbook = self.nbook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nbook.AddPage(grc_wxgui.Panel(self.nbook), "tab1")
        self.nbook.AddPage(grc_wxgui.Panel(self.nbook), "tab2")
        self.Add(self.nbook)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
        	self.nbook.GetPage(0).GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        )
        self.nbook.GetPage(0).Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nbook.GetPage(1).GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        )
        self.nbook.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
        	self.nbook.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        )
        self.nbook.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.nbook.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        )
        self.nbook.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 1000, 200, firdes.WIN_HAMMING, 6.76))
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, f1, amp1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, f0, amp0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_throttle_0_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.blocks_throttle_0_0, 0), (self.wxgui_fftsink2_0_0, 0))    
        self.connect((self.blocks_throttle_0_0, 0), (self.wxgui_scopesink2_0_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))    
Beispiel #39
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM Stereo Receiver")

        ##################################################
        # Variables
        ##################################################
        self.smux_filt_samprate = smux_filt_samprate = 256e3
        self.smux_decim = smux_decim = 8
        self.samp_rate = samp_rate = 2.048e6
        self.right_gain = right_gain = 3
        self.left_gain = left_gain = 3
        self.bpf_base = bpf_base = 23e3
        self.RF_Gain = RF_Gain = 45
        self.CF = CF = 99.3e6

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.samp_rate,
            callback=self.set_samp_rate,
            label=
            "Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._samp_rate_text_box, 1, 0, 1, 1)
        _right_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._right_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_right_gain_sizer,
            value=self.right_gain,
            callback=self.set_right_gain,
            label="R Audio Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._right_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_right_gain_sizer,
            value=self.right_gain,
            callback=self.set_right_gain,
            minimum=0,
            maximum=5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_right_gain_sizer, 0, 1, 1, 1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "BB Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Demod Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Stereo Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Stereo Signal")
        self.GridAdd(self.notebook_0, 2, 0, 1, 2)
        _left_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._left_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_left_gain_sizer,
            value=self.left_gain,
            callback=self.set_left_gain,
            label="L Audio Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._left_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_left_gain_sizer,
            value=self.left_gain,
            callback=self.set_left_gain,
            minimum=0,
            maximum=5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_left_gain_sizer, 0, 0, 1, 1)
        _RF_Gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_Gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_RF_Gain_sizer,
            value=self.RF_Gain,
            callback=self.set_RF_Gain,
            label="RF Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._RF_Gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_RF_Gain_sizer,
            value=self.RF_Gain,
            callback=self.set_RF_Gain,
            minimum=0,
            maximum=100,
            num_steps=45,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 1, 1, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Baseband Waterfall",
            size=(800, 100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 3,
                                           0, 1, 2)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=32e3,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
            size=(800, 500),
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=32e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Difference FFT ",
            peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / 8,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Demodulated FFT",
            peak_hold=False,
            size=(800, 800),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Baseband FFT",
            peak_hold=False,
            size=(800, 100),
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_fftsink2_0_0.win, 2, 0,
                                           1, 2)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=32e3,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Sum FFT",
            peak_hold=False,
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.rfgain = blocks.multiply_const_vcc((RF_Gain, ))
        self.low_pass_filter_1_0 = filter.fir_filter_fff(
            smux_decim,
            firdes.low_pass(1, smux_filt_samprate, 15e3, 500,
                            firdes.WIN_HAMMING, 1))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            2,
            firdes.low_pass(2, samp_rate / 4, 100e3, 500, firdes.WIN_KAISER,
                            6.76))
        self.iir_filter_xxx_0 = filter.iir_filter_ccf(
            (-0.00266, 0.00504, -0.00309, -0.00136, 0.00663, -0.01052, 0.01103,
             -0.00731, 0.00016, 0.00800, -0.01396, 0.01490, -0.00971, -0.00035,
             0.01173, -0.01979, 0.02054, -0.01240, -0.00273, 0.01960, -0.03122,
             0.03124, -0.01669, -0.01017, 0.04137, -0.06448, 0.06476, -0.02634,
             -0.07449, 0.33571, -0.00000, -0.33571, 0.07449, 0.02634, -0.06476,
             0.06448, -0.04137, 0.01017, 0.01669, -0.03124, 0.03122, -0.01960,
             0.00273, 0.01240, -0.02054, 0.01979, -0.01173, 0.00035, 0.00971,
             -0.01490, 0.01396, -0.00800, -0.00016, 0.00731, -0.01103, 0.01052,
             -0.00663, 0.00136, 0.00309, -0.00504, 0.00266), (1, ), False)
        self.fir_filter_xxx_0_0 = filter.fir_filter_ccf(4, (1, 1, 1, 1))
        self.fir_filter_xxx_0_0.declare_sample_delay(0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (right_gain, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (left_gain, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/Users/bretttt/iCloud_drive/16S/engs110/project/radio_dat/IQ_Data_STEREO1",
            True)
        self.blocks_divide_xx_1 = blocks.divide_cc(1)
        self.blocks_delay_2 = blocks.delay(gr.sizeof_gr_complex * 1, 30)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_imag_0 = blocks.complex_to_imag(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0.1, ))
        self.baseband_LPF = filter.fir_filter_fff(
            smux_decim,
            firdes.low_pass(1, smux_filt_samprate, 15e3, 500,
                            firdes.WIN_KAISER, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_fcc(
            1,
            firdes.complex_band_pass(1, smux_filt_samprate, 18000, 20000, 1000,
                                     firdes.WIN_KAISER, 1))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, smux_filt_samprate, bpf_base, bpf_base + 30e3,
                             500, firdes.WIN_KAISER, 6.76))
        self.audio_sink_0_0_0_0 = audio.sink(32000, "", True)
        self.analog_pll_refout_cc_0_0 = analog.pll_refout_cc(
            3.14 / 100, 0.152 * 3.14, 0.144 * 3.14)
        self.analog_fm_deemph_0_0 = analog.fm_deemph(fs=samp_rate / 8,
                                                     tau=75e-6)
        self.analog_fm_deemph_0 = analog.fm_deemph(fs=samp_rate / 8, tau=75e-6)
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        _CF_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CF_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_CF_sizer,
            value=self.CF,
            callback=self.set_CF,
            label="Center Frequency",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._CF_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_CF_sizer,
            value=self.CF,
            callback=self.set_CF,
            minimum=80e6,
            maximum=108e6,
            num_steps=280,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_CF_sizer, 3, 0, 1, 2)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_fm_deemph_0, 0),
                     (self.audio_sink_0_0_0_0, 0))
        self.connect((self.analog_fm_deemph_0_0, 0),
                     (self.audio_sink_0_0_0_0, 1))
        self.connect((self.analog_pll_refout_cc_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 0))
        self.connect((self.analog_pll_refout_cc_0_0, 0),
                     (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0),
                     (self.analog_pll_refout_cc_0_0, 0))
        self.connect((self.baseband_LPF, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.baseband_LPF, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_divide_xx_1, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.band_pass_filter_0_0_0, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.baseband_LPF, 0))
        self.connect((self.blocks_complex_to_imag_0, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_delay_2, 0),
                     (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.blocks_divide_xx_1, 0), (self.blocks_delay_2, 0))
        self.connect((self.blocks_divide_xx_1, 0), (self.iir_filter_xxx_0, 0))
        self.connect((self.blocks_file_source_0_0, 0), (self.rfgain, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0),
                     (self.blocks_complex_to_imag_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_fm_deemph_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.analog_fm_deemph_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.wxgui_fftsink2_0_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.fir_filter_xxx_0_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.iir_filter_xxx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_divide_xx_1, 0))
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.rfgain, 0), (self.blocks_throttle_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.m = m = 50
        self.kf = kf = 17
        self.fm = fm = 1.1e3

        ##################################################
        # Blocks
        ##################################################
        _kf_sizer = wx.BoxSizer(wx.VERTICAL)
        self._kf_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_kf_sizer,
            value=self.kf,
            callback=self.set_kf,
            label='kf',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._kf_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_kf_sizer,
            value=self.kf,
            callback=self.set_kf,
            minimum=0,
            maximum=25,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_kf_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.message_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE,
                                             11e3, 0.5, 0)
        self.message = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE,
                                           1.1e3, 0.5, 0)
        _m_sizer = wx.BoxSizer(wx.VERTICAL)
        self._m_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_m_sizer,
            value=self.m,
            callback=self.set_m,
            label='m',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._m_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_m_sizer,
            value=self.m,
            callback=self.set_m,
            minimum=1,
            maximum=80,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_m_sizer)
        self.iir_filter_xxx_2 = filter.iir_filter_ffd(([1.0]), ([1, 0.95]),
                                                      True)
        self.iir_filter_xxx_1 = filter.iir_filter_ffd(([1, -0.95]), ([1.0]),
                                                      True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd(([1.0 / samp_rate]),
                                                      ([1, 1]), True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10e3, ))
        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_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 100e3, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(kf)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_1, 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_multiply_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.iir_filter_xxx_1, 0))
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.iir_filter_xxx_2, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_phase_modulator_fc_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.iir_filter_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.iir_filter_xxx_1, 0), (self.iir_filter_xxx_0, 0))
        self.connect((self.iir_filter_xxx_2, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.message, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.message_0, 0), (self.blocks_add_xx_0, 1))
Beispiel #41
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="USRP FLEX Pager Receiver (Single Channel)")

        ##################################################
        # Variables
        ##################################################
        self.config_filename = config_filename = os.environ[
            "HOME"] + "/.gnuradio/config.conf"
        self.symbol_rate = symbol_rate = 3200
        self._saved_channel_config = ConfigParser.ConfigParser()
        self._saved_channel_config.read(config_filename)
        try:
            saved_channel = self._saved_channel_config.getint(
                "gr-pager", "channel")
        except:
            saved_channel = 25
        self.saved_channel = saved_channel
        self._saved_band_freq_config = ConfigParser.ConfigParser()
        self._saved_band_freq_config.read(config_filename)
        try:
            saved_band_freq = self._saved_band_freq_config.getfloat(
                "gr-pager", "band_center")
        except:
            saved_band_freq = 930.5125e6
        self.saved_band_freq = saved_band_freq
        self.deviation = deviation = 4800
        self.decim = decim = 20
        self.adc_rate = adc_rate = 64e6
        self.sample_rate = sample_rate = adc_rate / decim
        self.passband = passband = 2 * (deviation + symbol_rate)
        self.channel_rate = channel_rate = 8 * 3200
        self.channel = channel = saved_channel
        self.band_freq = band_freq = saved_band_freq
        self._saved_rx_gain_config = ConfigParser.ConfigParser()
        self._saved_rx_gain_config.read(config_filename)
        try:
            saved_rx_gain = self._saved_rx_gain_config.getint(
                "gr-pager", "rx_gain")
        except:
            saved_rx_gain = 40
        self.saved_rx_gain = saved_rx_gain
        self._saved_offset_config = ConfigParser.ConfigParser()
        self._saved_offset_config.read(config_filename)
        try:
            saved_offset = self._saved_offset_config.getfloat(
                "gr-pager", "freq_offset")
        except:
            saved_offset = 0
        self.saved_offset = saved_offset
        self.freq = freq = band_freq + (channel - 61) * 25e3
        self.channel_taps = channel_taps = firdes.low_pass(
            10, sample_rate, passband / 2.0, (channel_rate - passband) / 2.0)
        self.rx_gain = rx_gain = saved_rx_gain
        self.offset = offset = saved_offset
        self.nchan_taps = nchan_taps = len(channel_taps)
        self.ma_ntaps = ma_ntaps = int(channel_rate / symbol_rate)
        self.freq_text = freq_text = freq
        self.demod_k = demod_k = 3 * channel_rate / (2 * math.pi * deviation)
        self.channel_decim = channel_decim = int(sample_rate / channel_rate)
        self.bb_interp = bb_interp = 5
        self.bb_decim = bb_decim = 8
        self.baseband_rate = baseband_rate = 16000

        ##################################################
        # Notebooks
        ##################################################
        self.displays = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.displays.AddPage(grc_wxgui.Panel(self.displays), "RX Spectrum")
        self.displays.AddPage(grc_wxgui.Panel(self.displays), "Baseband")
        self.GridAdd(self.displays, 1, 0, 1, 5)

        ##################################################
        # Controls
        ##################################################
        _channel_sizer = wx.BoxSizer(wx.VERTICAL)
        self._channel_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_channel_sizer,
            value=self.channel,
            callback=self.set_channel,
            label="Channel",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._channel_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_channel_sizer,
            value=self.channel,
            callback=self.set_channel,
            minimum=1,
            maximum=120,
            num_steps=119,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.GridAdd(_channel_sizer, 0, 1, 1, 1)
        self._band_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.band_freq,
            callback=self.set_band_freq,
            label="Band Freq.",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._band_freq_text_box, 0, 0, 1, 1)
        _rx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rx_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rx_gain_sizer,
            value=self.rx_gain,
            callback=self.set_rx_gain,
            label="Analog Gain",
            converter=forms.int_converter(),
            proportion=0,
        )
        self._rx_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rx_gain_sizer,
            value=self.rx_gain,
            callback=self.set_rx_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.GridAdd(_rx_gain_sizer, 0, 4, 1, 1)
        _offset_sizer = wx.BoxSizer(wx.VERTICAL)
        self._offset_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_offset_sizer,
            value=self.offset,
            callback=self.set_offset,
            label="Freq. Offset",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._offset_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_offset_sizer,
            value=self.offset,
            callback=self.set_offset,
            minimum=-12.5e3,
            maximum=12.5e3,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_offset_sizer, 0, 3, 1, 1)
        self._freq_text_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.freq_text,
            callback=self.set_freq_text,
            label="Ch. Freq",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_text_static_text, 0, 2, 1, 1)

        ##################################################
        # Blocks
        ##################################################
        self.fm_demod = gr.quadrature_demod_cf(demod_k)
        self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(
            channel_decim, (channel_taps), band_freq - freq + offset,
            sample_rate)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_int * 1)
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_int * 1)
        self.blocks_null_sink_0_1 = blocks.null_sink(gr.sizeof_int * 1)
        self.blocks_null_sink_0_2 = blocks.null_sink(gr.sizeof_int * 1)
        self.pager_flex_deinterleave_0 = pager.flex_deinterleave()
        self.pager_flex_deinterleave_0_0 = pager.flex_deinterleave()
        self.pager_flex_deinterleave_0_1 = pager.flex_deinterleave()
        self.pager_flex_deinterleave_0_1_0 = pager.flex_deinterleave()
        self.pager_flex_sync_0 = pager.flex_sync()
        self.pager_slicer_fb_0 = pager.slicer_fb(1e-6)
        self.resampler = filter.rational_resampler_fff(
            interpolation=bb_interp,
            decimation=bb_decim,
            taps=([
                1.0 / ma_ntaps,
            ] * ma_ntaps * bb_interp),
            fractional_bw=None,
        )
        self.usrp_source = grc_usrp.simple_source_c(which=0,
                                                    side="A",
                                                    rx_ant="RXA")
        self.usrp_source.set_decim_rate(decim)
        self.usrp_source.set_frequency(band_freq, verbose=True)
        self.usrp_source.set_gain(rx_gain)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.displays.GetPage(0).GetWin(),
            baseband_freq=band_freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=65536,
            sample_rate=sample_rate,
            fft_size=1024,
            fft_rate=30,
            average=False,
            avg_alpha=None,
            title="FLEX Spectrum",
            peak_hold=False,
        )
        self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 1, 1)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
            self.displays.GetPage(0).GetWin(),
            baseband_freq=freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=65536,
            sample_rate=channel_rate,
            fft_size=1024,
            fft_rate=30,
            average=False,
            avg_alpha=None,
            title="Channel Spectrum",
            peak_hold=False,
        )
        self.displays.GetPage(0).GridAdd(self.wxgui_fftsink2_1.win, 1, 0, 1, 1)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
            self.displays.GetPage(1).GetWin(),
            title="Baseband",
            sample_rate=16e3,
            v_scale=1,
            v_offset=0,
            t_scale=40.0 / 16e3,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
        )
        self.displays.GetPage(1).GridAdd(self.wxgui_scopesink2_0_0.win, 0, 0,
                                         1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.usrp_source, 0),
                     (self.gr_freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.usrp_source, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0),
                     (self.fm_demod, 0))
        self.connect((self.resampler, 0), (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.fm_demod, 0), (self.resampler, 0))
        self.connect((self.pager_slicer_fb_0, 0), (self.pager_flex_sync_0, 0))
        self.connect((self.resampler, 0), (self.pager_slicer_fb_0, 0))
        self.connect((self.pager_flex_sync_0, 1),
                     (self.pager_flex_deinterleave_0_1_0, 0))
        self.connect((self.pager_flex_sync_0, 2),
                     (self.pager_flex_deinterleave_0_1, 0))
        self.connect((self.pager_flex_sync_0, 0),
                     (self.pager_flex_deinterleave_0, 0))
        self.connect((self.pager_flex_sync_0, 3),
                     (self.pager_flex_deinterleave_0_0, 0))
        self.connect((self.pager_flex_deinterleave_0, 0),
                     (self.blocks_null_sink_0, 0))
        self.connect((self.pager_flex_deinterleave_0_1_0, 0),
                     (self.blocks_null_sink_0_0, 0))
        self.connect((self.pager_flex_deinterleave_0_1, 0),
                     (self.blocks_null_sink_0_1, 0))
        self.connect((self.pager_flex_deinterleave_0_0, 0),
                     (self.blocks_null_sink_0_2, 0))
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel

        self.offset = 0.0

        parser = OptionParser(option_class=eng_option)
        parser.add_option(
            "-R",
            "--rx-subdev-spec",
            type="subdev",
            default=None,
            help=
            "select USRP Rx side A or B (default=first one with a daughterboard)"
        )
        parser.add_option(
            "-d",
            "--decim",
            type="int",
            default=256,
            help="set fgpa decimation rate to DECIM [default=%default]")
        parser.add_option("-f",
                          "--freq",
                          type="eng_float",
                          default=None,
                          help="set frequency to FREQ",
                          metavar="FREQ")
        parser.add_option(
            "-p",
            "--protocol",
            type="int",
            default=0,
            help="set protocol: 0 = RDLAP 19.2kbps (default); 1 = APCO25")
        parser.add_option("-g",
                          "--gain",
                          type="eng_float",
                          default=None,
                          help="set gain in dB (default is midpoint)")
        parser.add_option("-8",
                          "--width-8",
                          action="store_true",
                          default=False,
                          help="Enable 8-bit samples across USB")
        parser.add_option("--no-hb",
                          action="store_true",
                          default=False,
                          help="don't use halfband filter in usrp")
        parser.add_option(
            "-C",
            "--basic-complex",
            action="store_true",
            default=False,
            help=
            "Use both inputs of a basicRX or LFRX as a single Complex input channel"
        )
        parser.add_option(
            "-D",
            "--basic-dualchan",
            action="store_true",
            default=False,
            help=
            "Use both inputs of a basicRX or LFRX as seperate Real input channels"
        )
        parser.add_option(
            "-n",
            "--frame-decim",
            type="int",
            default=1,
            help="set oscope frame decimation factor to n [default=1]")
        parser.add_option(
            "-v",
            "--v-scale",
            type="eng_float",
            default=1000,
            help="set oscope initial V/div to SCALE [default=%default]")
        parser.add_option(
            "-t",
            "--t-scale",
            type="eng_float",
            default=49e-6,
            help="set oscope initial s/div to SCALE [default=50us]")
        (options, args) = parser.parse_args()
        if len(args) != 0:
            parser.print_help()
            sys.exit(1)

        self.show_debug_info = True

        # build the graph
        if options.basic_dualchan:
            self.num_inputs = 2
        else:
            self.num_inputs = 1
        if options.no_hb or (options.decim < 8):
            #Min decimation of this firmware is 4.
            #contains 4 Rx paths without halfbands and 0 tx paths.
            self.fpga_filename = "std_4rx_0tx.rbf"
            self.u = usrp.source_c(nchan=self.num_inputs,
                                   decim_rate=options.decim,
                                   fpga_filename=self.fpga_filename)
        else:
            #Min decimation of standard firmware is 8.
            #standard fpga firmware "std_2rxhb_2tx.rbf"
            #contains 2 Rx paths with halfband filters and 2 tx paths (the default)
            self.u = usrp.source_c(nchan=self.num_inputs,
                                   decim_rate=options.decim)

        if options.rx_subdev_spec is None:
            options.rx_subdev_spec = pick_subdevice(self.u)

        if options.width_8:
            width = 8
            shift = 8
            format = self.u.make_format(width, shift)
            #print "format =", hex(format)
            r = self.u.set_format(format)
            #print "set_format =", r

        # determine the daughterboard subdevice we're using
        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
        if (options.basic_complex or options.basic_dualchan):
            if ((self.subdev.dbid() == usrp_dbid.BASIC_RX)
                    or (self.subdev.dbid() == usrp_dbid.LF_RX)):
                side = options.rx_subdev_spec[0]  # side A = 0, side B = 1
                if options.basic_complex:
                    #force Basic_RX and LF_RX in complex mode (use both I and Q channel)
                    print "Receiver daughterboard forced in complex mode. Both inputs will combined to form a single complex channel."
                    self.dualchan = False
                    if side == 0:
                        self.u.set_mux(
                            0x00000010
                        )  #enable adc 0 and 1 to form a single complex input on side A
                    else:  #side ==1
                        self.u.set_mux(
                            0x00000032
                        )  #enable adc 3 and 2 to form a single complex input on side B
                elif options.basic_dualchan:
                    #force Basic_RX and LF_RX in dualchan mode (use input A  for channel 0 and input B for channel 1)
                    print "Receiver daughterboard forced in dualchannel mode. Each input will be used to form a seperate channel."
                    self.dualchan = True
                    if side == 0:
                        self.u.set_mux(
                            gru.hexint(0xf0f0f1f0)
                        )  #enable adc 0, side A to form a real input on channel 0 and adc1,side A to form a real input on channel 1
                    else:  #side ==1
                        self.u.set_mux(
                            0xf0f0f3f2
                        )  #enable adc 2, side B to form a real input on channel 0 and adc3,side B to form a real input on channel 1
            else:
                sys.stderr.write(
                    'options basic_dualchan or basic_complex is only supported for Basic Rx or LFRX at the moment\n'
                )
                sys.exit(1)
        else:
            self.dualchan = False
            self.u.set_mux(
                usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))

        input_rate = self.u.adc_freq() / self.u.decim_rate()

        self.scope = scopesink2.scope_sink_c(panel,
                                             sample_rate=input_rate,
                                             frame_decim=options.frame_decim,
                                             v_scale=options.v_scale,
                                             t_scale=options.t_scale,
                                             num_inputs=self.num_inputs)

        if self.dualchan:
            # deinterleave two channels from FPGA
            self.di = gr.deinterleave(gr.sizeof_gr_complex)
            self.connect(self.u, self.di)
            self.connect((self.di, 0), (self.scope, 0))
            self.connect((self.di, 1), (self.scope, 1))
        else:
            self.connect(self.u, self.scope)

        self.msgq = gr.msg_queue(2)  # queue that holds a maximum of 2 messages
        self.queue_watcher = queue_watcher(self.msgq, self.adjust_freq_norm)

        #-------------------------------------------------------------------------------

        if options.protocol == 0:

            # ---------- RD-LAP 19.2 kbps (9600 ksps), 25kHz channel,
            self.symbol_rate = 9600  # symbol rate; at 2 bits/symbol this corresponds to 19.2kbps
            self.channel_decimation = 10  # decimation (final rate should be at least several symbol rate)
            self.max_frequency_offset = 12000.0  # coarse carrier tracker leash, ~ half a channel either way
            self.symbol_deviation = 1200.0  # this is frequency offset from center of channel to +1 / -1 symbols
            self.input_sample_rate = 64e6 / options.decim  # for USRP: 64MHz / FPGA decimation rate
            self.protocol_processing = fsk4.rdlap_f(
                self.msgq,
                0)  # desired protocol processing block selected here

            self.channel_rate = self.input_sample_rate / self.channel_decimation

            # channel selection filter characteristics
            channel_taps = optfir.low_pass(
                1.0,  # Filter gain
                self.input_sample_rate,  # Sample rate
                10000,  # One-sided modulation bandwidth
                12000,  # One-sided channel bandwidth
                0.1,  # Passband ripple
                60)  # Stopband attenuation

            # symbol shaping filter characteristics
            symbol_coeffs = gr.firdes.root_raised_cosine(
                1.0,  # gain
                self.channel_rate,  # sampling rate
                self.symbol_rate,  # symbol rate
                0.2,  # width of trans. band
                500)  # filter type

        if options.protocol == 1:

            # ---------- APCO-25 C4FM Test Data
            self.symbol_rate = 4800  # symbol rate; at 2 bits/symbol this corresponds to 19.2kbps
            self.channel_decimation = 20  # decimation
            self.max_frequency_offset = 6000.0  # coarse carrier tracker leash
            self.symbol_deviation = 600.0  # this is frequency offset from center of channel to +1 / -1 symbols
            self.input_sample_rate = 64e6 / options.decim  # for USRP: 64MHz / FPGA decimation rate
            self.protocol_processing = fsk4.apco25_f(self.msgq, 0)
            self.channel_rate = self.input_sample_rate / self.channel_decimation

            # channel selection filter
            channel_taps = optfir.low_pass(
                1.0,  # Filter gain
                self.input_sample_rate,  # Sample rate
                5000,  # One-sided modulation bandwidth
                6500,  # One-sided channel bandwidth
                0.1,  # Passband ripple
                60)  # Stopband attenuation

            # symbol shaping filter
            symbol_coeffs = gr.firdes.root_raised_cosine(
                1.0,  # gain
                self.channel_rate,  # sampling rate
                self.symbol_rate,  # symbol rate
                0.2,  # width of trans. band
                500)  # filter type

        # ----------------- End of setup block

        self.chan = gr.freq_xlating_fir_filter_ccf(
            self.channel_decimation,  # Decimation rate
            channel_taps,  # Filter taps
            0.0,  # Offset frequency
            self.input_sample_rate)  # Sample rate

        self.scope2 = scopesink2.scope_sink_f(panel,
                                              sample_rate=self.symbol_rate,
                                              frame_decim=1,
                                              v_scale=2,
                                              t_scale=0.025,
                                              num_inputs=self.num_inputs)

        # also note:
        # this specifies the nominal frequency deviation for the 4-level fsk signal
        self.fm_demod_gain = self.channel_rate / (2.0 * pi *
                                                  self.symbol_deviation)
        self.fm_demod = gr.quadrature_demod_cf(self.fm_demod_gain)
        symbol_decim = 1
        self.symbol_filter = gr.fir_filter_fff(symbol_decim, symbol_coeffs)

        # eventually specify: sample rate, symbol rate
        self.demod_fsk4 = fsk4.demod_ff(self.msgq, self.channel_rate,
                                        self.symbol_rate)

        #self.rdlap_processing = fsk4.rdlap_f(self.msgq, 0)

        self.connect(self.u, self.chan, self.fm_demod, self.symbol_filter,
                     self.demod_fsk4, self.protocol_processing)

        self.connect(self.demod_fsk4, self.scope2)

        # --------------- End of most of the 4L-FSK hack & slash

        self._build_gui(vbox)

        # set initial values

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            g = self.subdev.gain_range()
            options.gain = float(g[0] + g[1]) / 2

        if options.freq is None:
            if ((self.subdev.dbid() == usrp_dbid.BASIC_RX)
                    or (self.subdev.dbid() == usrp_dbid.LF_RX)):
                #for Basic RX and LFRX if no freq is specified you probably want 0.0 Hz and not 45 GHz
                options.freq = 0.0
            else:
                # if no freq was specified, use the mid-point
                r = self.subdev.freq_range()
                options.freq = float(r[0] + r[1]) / 2

        self.set_gain(options.gain)

        if self.show_debug_info:
            #            self.myform['decim'].set_value(self.u.decim_rate())
            self.myform['fs@usb'].set_value(self.u.adc_freq() /
                                            self.u.decim_rate())
            self.myform['dbname'].set_value(self.subdev.name())
            self.myform['baseband'].set_value(0)
            self.myform['ddc'].set_value(0)
            if self.num_inputs == 2:
                self.myform['baseband2'].set_value(0)
                self.myform['ddc2'].set_value(0)

        if not (self.set_freq(options.freq)):
            self._set_status_msg("Failed to set initial frequency")
        if self.num_inputs == 2:
            if not (self.set_freq2(options.freq)):
                self._set_status_msg(
                    "Failed to set initial frequency for channel 2")
Beispiel #43
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dial Tone")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.src_freq_1 = src_freq_1 = 350
        self.samp_rate = samp_rate = 32000
        self.noise_amp = noise_amp = .005
        self.Src_freq_2 = Src_freq_2 = 440

        ##################################################
        # Blocks
        ##################################################
        _src_freq_1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._src_freq_1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_src_freq_1_sizer,
            value=self.src_freq_1,
            callback=self.set_src_freq_1,
            label='Src_Freq_1',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._src_freq_1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_src_freq_1_sizer,
            value=self.src_freq_1,
            callback=self.set_src_freq_1,
            minimum=0,
            maximum=1000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_src_freq_1_sizer)
        _noise_amp_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_amp_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_amp_sizer,
            value=self.noise_amp,
            callback=self.set_noise_amp,
            label='noise_amp',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_amp_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_amp_sizer,
            value=self.noise_amp,
            callback=self.set_noise_amp,
            minimum=0,
            maximum=0.1,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_amp_sizer)
        _Src_freq_2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._Src_freq_2_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_Src_freq_2_sizer,
            value=self.Src_freq_2,
            callback=self.set_Src_freq_2,
            label='Src_Freq_2',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._Src_freq_2_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_Src_freq_2_sizer,
            value=self.Src_freq_2,
            callback=self.set_Src_freq_2,
            minimum=0,
            maximum=1000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_Src_freq_2_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, Src_freq_2, 0.1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, src_freq_1, .1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_f(
            analog.GR_GAUSSIAN, noise_amp, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.analog_sig_source_x_1, 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.wxgui_scopesink2_0, 0))
Beispiel #44
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(
            self, title="Stereo FM receiver and RDS Decoder")

        ##################################################
        # Variables
        ##################################################
        self.xlate_decim = xlate_decim = 4
        self.samp_rate = samp_rate = 1000000
        self.freq_offset = freq_offset = 250e3
        self.freq = freq = 88.5e6
        self.baseband_rate = baseband_rate = samp_rate / xlate_decim
        self.audio_decim = audio_decim = 4
        self.xlate_bandwidth = xlate_bandwidth = 250e3
        self.volume = volume = 0
        self.loop_bw = loop_bw = 16e3 * 0 + 18e3 * 1
        self.gain = gain = 10
        self.freq_tune = freq_tune = freq - freq_offset
        self.audio_rate = audio_rate = 48000
        self.audio_decim_rate = audio_decim_rate = baseband_rate / audio_decim
        self.antenna = antenna = 'TX/RX'

        ##################################################
        # Message Queues
        ##################################################
        gr_rds_data_decoder_0_msgq_out = gr_rds_panel_0_msgq_in = gr.msg_queue(
            2)

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=-20,
            maximum=10,
            num_steps=300,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Demod")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L+R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Pilot")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "DSBSC")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS Raw")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "L-R")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RDS")
        self.Add(self.nb)
        _loop_bw_sizer = wx.BoxSizer(wx.VERTICAL)
        self._loop_bw_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_loop_bw_sizer,
            value=self.loop_bw,
            callback=self.set_loop_bw,
            label="Loop BW",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._loop_bw_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_loop_bw_sizer,
            value=self.loop_bw,
            callback=self.set_loop_bw,
            minimum=0,
            maximum=baseband_rate,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_loop_bw_sizer)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label="Gain",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=50,
            num_steps=50,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self._freq_offset_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.freq_offset,
            callback=self.set_freq_offset,
            label="Freq Offset",
            converter=forms.float_converter(),
        )
        self.Add(self._freq_offset_text_box)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            label="Freq",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_freq_sizer,
            value=self.freq,
            callback=self.set_freq,
            minimum=87.5e6,
            maximum=108e6,
            num_steps=205,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_freq_sizer)
        self._antenna_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.antenna,
            callback=self.set_antenna,
            label="Antenna",
            choices=['TX/RX', 'RX2'],
            labels=[],
        )
        self.Add(self._antenna_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.nb.GetPage(3).GetWin(),
            title="Pilot",
            sample_rate=baseband_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0_0_1_0_1 = fftsink2.fft_sink_f(
            self.nb.GetPage(7).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=-50,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="RDS",
            peak_hold=False,
        )
        self.nb.GetPage(7).Add(self.wxgui_fftsink2_0_0_0_1_0_1.win)
        self.wxgui_fftsink2_0_0_0_1_0_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(6).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=-50,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="L-R",
            peak_hold=False,
        )
        self.nb.GetPage(6).Add(self.wxgui_fftsink2_0_0_0_1_0_0.win)
        self.wxgui_fftsink2_0_0_0_1_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(5).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="RDS",
            peak_hold=False,
        )
        self.nb.GetPage(5).Add(self.wxgui_fftsink2_0_0_0_1_0.win)
        self.wxgui_fftsink2_0_0_0_1 = fftsink2.fft_sink_f(
            self.nb.GetPage(4).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="DSBSC Sub-carrier",
            peak_hold=False,
        )
        self.nb.GetPage(4).Add(self.wxgui_fftsink2_0_0_0_1.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=audio_decim_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="L+R",
            peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
            self.nb.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.8,
            title="FM Demod",
            peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.nb.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=-30,
            ref_scale=2.0,
            sample_rate=baseband_rate,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=0.8,
            title="Baseband",
            peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        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(freq_tune, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna(antenna, 0)
        self.gr_rds_panel_0 = rds.rdsPanel(gr_rds_panel_0_msgq_in, freq,
                                           self.GetWin())
        self.Add(self.gr_rds_panel_0)
        self.gr_rds_freq_divider_0 = rds.freq_divider(16)
        self.gr_rds_data_decoder_0 = rds.data_decoder(
            gr_rds_data_decoder_0_msgq_out)
        self.gr_rds_bpsk_demod_0 = rds.bpsk_demod(audio_decim_rate)
        self.gr_pll_freqdet_cf_0 = gr.pll_freqdet_cf(
            1.0 * 0 + (loop_bw * 2 * math.pi / baseband_rate),
            +(2.0 * math.pi * 90e3 / baseband_rate),
            -(2.0 * math.pi * 90e3 / baseband_rate))
        self.gr_multiply_const_vxx_0_0 = gr.multiply_const_vff(
            (10**(1. * volume / 10), ))
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vff(
            (10**(1. * volume / 10), ))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            xlate_decim,
            (firdes.low_pass(1, samp_rate, xlate_bandwidth / 2, 1000)),
            freq_offset, samp_rate)
        self.fir_filter_xxx_7 = filter.fir_filter_fff(
            audio_decim, (firdes.low_pass(1, baseband_rate, 1.2e3, 1.5e3,
                                          firdes.WIN_HAMMING)))
        self.fir_filter_xxx_6 = filter.fir_filter_fff(
            audio_decim, (firdes.low_pass(1, baseband_rate, 1.5e3, 2e3,
                                          firdes.WIN_HAMMING)))
        self.fir_filter_xxx_5 = filter.fir_filter_fff(
            audio_decim, (firdes.low_pass(1.0, baseband_rate, 15e3, 1e3,
                                          firdes.WIN_HAMMING)))
        self.fir_filter_xxx_4 = filter.fir_filter_fff(
            1, (firdes.band_pass(1.0, baseband_rate, 57e3 - 3e3, 57e3 + 3e3,
                                 3e3, firdes.WIN_HAMMING)))
        self.fir_filter_xxx_3 = filter.fir_filter_fff(
            1, (firdes.band_pass(1.0, baseband_rate, 38e3 - 15e3 / 2,
                                 38e3 + 15e3 / 2, 1e3, firdes.WIN_HAMMING)))
        self.fir_filter_xxx_2 = filter.fir_filter_fff(
            1, (firdes.band_pass(1.0, baseband_rate, 19e3 - 500, 19e3 + 500,
                                 1e3, firdes.WIN_HAMMING)))
        self.fir_filter_xxx_1 = filter.fir_filter_fff(
            audio_decim, (firdes.low_pass(1.0, baseband_rate, 15e3, 1e3,
                                          firdes.WIN_HAMMING)))
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(1, (firdes.low_pass(
            1.0, baseband_rate, 80e3, 35e3, firdes.WIN_HAMMING)))
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blks2_rational_resampler_xxx_0_0 = blks2.rational_resampler_fff(
            interpolation=audio_rate,
            decimation=audio_decim_rate,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=audio_rate,
            decimation=audio_decim_rate,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_fm_deemph_0_0_0 = blks2.fm_deemph(fs=baseband_rate,
                                                     tau=75e-6)
        self.blks2_fm_deemph_0_0 = blks2.fm_deemph(fs=baseband_rate, tau=75e-6)
        self.audio_sink_0 = audio.sink(audio_rate, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.gr_pll_freqdet_cf_0, 0))
        self.connect((self.gr_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_1, 0))
        self.connect((self.gr_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_2, 0))
        self.connect((self.gr_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_4, 0))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.fir_filter_xxx_3, 0),
                     (self.blocks_multiply_xx_0, 2))
        self.connect((self.fir_filter_xxx_4, 0),
                     (self.blocks_multiply_xx_0_0, 3))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.blocks_multiply_xx_0_0, 2))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.fir_filter_xxx_2, 0),
                     (self.gr_rds_freq_divider_0, 0))
        self.connect((self.fir_filter_xxx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.fir_filter_xxx_5, 0))
        self.connect((self.gr_pll_freqdet_cf_0, 0), (self.fir_filter_xxx_3, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_0_0, 0),
                     (self.audio_sink_0, 1))
        self.connect((self.gr_multiply_const_vxx_0_0, 0),
                     (self.blks2_rational_resampler_xxx_0_0, 0))
        self.connect((self.gr_rds_freq_divider_0, 0),
                     (self.fir_filter_xxx_7, 0))
        self.connect((self.fir_filter_xxx_7, 0), (self.gr_rds_bpsk_demod_0, 1))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.gr_rds_data_decoder_0, 0))
        self.connect((self.gr_rds_bpsk_demod_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.fir_filter_xxx_6, 0), (self.gr_rds_bpsk_demod_0, 0))
        self.connect((self.fir_filter_xxx_2, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.fir_filter_xxx_1, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.fir_filter_xxx_3, 0),
                     (self.wxgui_fftsink2_0_0_0_1, 0))
        self.connect((self.fir_filter_xxx_4, 0),
                     (self.wxgui_fftsink2_0_0_0_1_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.fir_filter_xxx_6, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_fftsink2_0_0_0_1_0_0, 0))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.fir_filter_xxx_5, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.wxgui_fftsink2_0_0_0_1_0_1, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blks2_fm_deemph_0_0, 0))
        self.connect((self.blks2_fm_deemph_0_0, 0),
                     (self.gr_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blks2_fm_deemph_0_0_0, 0))
        self.connect((self.blks2_fm_deemph_0_0_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_pll_freqdet_cf_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
Beispiel #45
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ask")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1.2e6
        self.offset = offset = 50000
        self.gain = gain = 50
        self.freq = freq = 441e6
        self.decim = decim = 5
        self.corr = corr = 0

        ##################################################
        # Blocks
        ##################################################
        _corr_sizer = wx.BoxSizer(wx.VERTICAL)
        self._corr_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            label='corr',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._corr_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_corr_sizer,
            value=self.corr,
            callback=self.set_corr,
            minimum=-100,
            maximum=100,
            num_steps=200,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_corr_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate / decim,
            v_scale=0.25,
            v_offset=0,
            t_scale=0.001,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.osmosdr_source_1 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_1.set_time_source("gpsdo", 0)
        self.osmosdr_source_1.set_sample_rate(samp_rate)
        self.osmosdr_source_1.set_center_freq(freq - offset, 0)
        self.osmosdr_source_1.set_freq_corr(corr, 0)
        self.osmosdr_source_1.set_dc_offset_mode(0, 0)
        self.osmosdr_source_1.set_iq_balance_mode(0, 0)
        self.osmosdr_source_1.set_gain_mode(False, 0)
        self.osmosdr_source_1.set_gain(1, 0)
        self.osmosdr_source_1.set_if_gain(30, 0)
        self.osmosdr_source_1.set_bb_gain(30, 0)
        self.osmosdr_source_1.set_antenna("", 0)
        self.osmosdr_source_1.set_bandwidth(2000000, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            decim,
            firdes.low_pass(1, samp_rate, 50000, 25000, firdes.WIN_HAMMING,
                            6.76))
        self.ham_varicode_rx_0 = ham.varicode_rx()
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=50,
            num_steps=125,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            (samp_rate / 5 / 9600), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(320, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/dev/stdout", False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -offset, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.ham_varicode_rx_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.ham_varicode_rx_0, 0), (self.blocks_file_sink_1, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.osmosdr_source_1, 0),
                     (self.blocks_multiply_xx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Mono FM Radio")

        ##################################################
        # Variables
        ##################################################
        self.usrp_freq = usrp_freq = 2414e6
        self.samp_rate = samp_rate = 500e3
        self.rx_freq = rx_freq = usrp_freq
        self.rf_gain = rf_gain = 30
        self.filter_taps = filter_taps = firdes.low_pass(1, samp_rate, 250000, 20000, firdes.WIN_HAMMING, 6.76)
        self.af_gain = af_gain = 0.5

        ##################################################
        # Blocks
        ##################################################
        _usrp_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._usrp_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_usrp_freq_sizer,
        	value=self.usrp_freq,
        	callback=self.set_usrp_freq,
        	label='USRP frequency',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._usrp_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_usrp_freq_sizer,
        	value=self.usrp_freq,
        	callback=self.set_usrp_freq,
        	minimum=2000e6,
        	maximum=2500e6,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_usrp_freq_sizer)
        self._rx_freq_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.rx_freq,
        	callback=self.set_rx_freq,
        	label='Receive',
        	converter=forms.float_converter(),
        )
        self.Add(self._rx_freq_static_text)
        _rf_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rf_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rf_gain_sizer,
        	value=self.rf_gain,
        	callback=self.set_rf_gain,
        	label='RF',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rf_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rf_gain_sizer,
        	value=self.rf_gain,
        	callback=self.set_rf_gain,
        	minimum=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_rf_gain_sizer)
        self.nbook = self.nbook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nbook.AddPage(grc_wxgui.Panel(self.nbook), "Receiver")
        self.nbook.AddPage(grc_wxgui.Panel(self.nbook), "Audio")
        self.Add(self.nbook)
        _af_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._af_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_af_gain_sizer,
        	value=self.af_gain,
        	callback=self.set_af_gain,
        	label='AF',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._af_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_af_gain_sizer,
        	value=self.af_gain,
        	callback=self.set_af_gain,
        	minimum=0,
        	maximum=10,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_af_gain_sizer)
        self.xlating_fir_filter = filter.freq_xlating_fir_filter_ccc(1, (filter_taps), 98.1, samp_rate)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.nbook.GetPage(1).GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        	size=(400,400),
        )
        self.nbook.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(('', '')),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(usrp_freq, 0)
        self.uhd_usrp_source_0.set_gain(rf_gain, 0)
        self.uhd_usrp_source_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_source_0.set_auto_dc_offset(False, 0)
        self.uhd_usrp_source_0.set_auto_iq_balance(False, 0)
        self.rr_stereo_right = filter.rational_resampler_fff(
                interpolation=48,
                decimation=50,
                taps=None,
                fractional_bw=None,
        )
        self.fftsink_rf = fftsink2.fft_sink_c(
        	self.nbook.GetPage(0).GetWin(),
        	baseband_freq=rx_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=-30,
        	ref_scale=1.0,
        	sample_rate=samp_rate/2,
        	fft_size=512,
        	fft_rate=10,
        	average=True,
        	avg_alpha=0.5,
        	title='Baseband',
        	peak_hold=False,
        	size=(400,400),
        )
        self.nbook.GetPage(0).Add(self.fftsink_rf.win)
        self.audio_sink = audio.sink(48000, '', True)
        self.analog_wfm_rcv = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=10,
        )
        self.af_gain_stereo_left = blocks.multiply_const_vff((af_gain, ))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.af_gain_stereo_left, 0), (self.audio_sink, 0))
        self.connect((self.af_gain_stereo_left, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.analog_wfm_rcv, 0), (self.rr_stereo_right, 0))
        self.connect((self.rr_stereo_right, 0), (self.af_gain_stereo_left, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.xlating_fir_filter, 0))
        self.connect((self.xlating_fir_filter, 0), (self.analog_wfm_rcv, 0))
        self.connect((self.xlating_fir_filter, 0), (self.fftsink_rf, 0))
Beispiel #47
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.var_sample_rate = var_sample_rate = 2500000
        self.var_reverse_fft_size = var_reverse_fft_size = 32
        self.var_freq = var_freq = 433000000
        self.var_fft_size = var_fft_size = 2048

        ##################################################
        # Blocks
        ##################################################
        _var_sample_rate_sizer = wx.BoxSizer(wx.VERTICAL)
        self._var_sample_rate_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_var_sample_rate_sizer,
            value=self.var_sample_rate,
            callback=self.set_var_sample_rate,
            label='var_sample_rate',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._var_sample_rate_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_var_sample_rate_sizer,
            value=self.var_sample_rate,
            callback=self.set_var_sample_rate,
            minimum=1000000,
            maximum=20000000,
            num_steps=40,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_var_sample_rate_sizer)
        self._var_reverse_fft_size_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.var_reverse_fft_size,
            callback=self.set_var_reverse_fft_size,
            label='var_reverse_fft_size',
            converter=forms.int_converter(),
        )
        self.Add(self._var_reverse_fft_size_text_box)
        self._var_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.var_freq,
            callback=self.set_var_freq,
            label='var_freq',
            converter=forms.float_converter(),
        )
        self.Add(self._var_freq_text_box)
        self._var_fft_size_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.var_fft_size,
            callback=self.set_var_fft_size,
            label='var_fft_size',
            converter=forms.int_converter(),
        )
        self.Add(self._var_fft_size_text_box)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_RIGHT)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Before filter")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "After filter")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Post-FM")
        self.Add(self.notebook_0)
        self.wxgui_waterfallsink2_1_0_0 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=var_sample_rate * var_reverse_fft_size / var_fft_size,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="From auto-tune",
        )
        self.Add(self.wxgui_waterfallsink2_1_0_0.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=var_freq,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=var_sample_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
            win=window.hanning,
        )
        self.notebook_0.GetPage(0).GridAdd(self.wxgui_waterfallsink2_0.win, 0,
                                           0, 1, 1)
        self.wxgui_scopesink2_1_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="After C2M2",
            sample_rate=var_sample_rate * var_reverse_fft_size / var_fft_size,
            v_scale=20,
            v_offset=0,
            t_scale=1,
            ac_couple=True,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_NORM,
            y_axis_label="Amplitude",
        )
        self.Add(self.wxgui_scopesink2_1_0.win)
        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "hackrf=0")
        self.osmosdr_source_0.set_sample_rate(var_sample_rate)
        self.osmosdr_source_0.set_center_freq(var_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 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.fft_vxx_1_0 = fft.fft_vcc(var_reverse_fft_size, False, (), True,
                                       4)
        self.fft_vxx_0 = fft.fft_vcc(var_fft_size, True, (), False, 4)
        self.dc_blocker_xx_0 = filter.dc_blocker_cc(32, True)
        self.blocks_vector_to_stream_1_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, var_reverse_fft_size)
        self.blocks_stream_to_vector_2 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, var_reverse_fft_size)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, var_fft_size)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/mike/source/gr-autotune/examples/to-grc.fifo", False)
        self.blocks_file_sink_2 = blocks.file_sink(
            gr.sizeof_gr_complex * var_fft_size,
            "/home/mike/source/gr-autotune/examples/from-grc.fifo", True)
        self.blocks_file_sink_2.set_unbuffered(False)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.wxgui_scopesink2_1_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_stream_to_vector_2, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_stream_to_vector_2, 0),
                     (self.fft_vxx_1_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0, 0),
                     (self.wxgui_waterfallsink2_1_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_file_sink_2, 0))
        self.connect((self.fft_vxx_1_0, 0),
                     (self.blocks_vector_to_stream_1_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.dc_blocker_xx_0, 0))
Beispiel #48
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dsbfc Am Modulation Demodulation")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 320000

        ##################################################
        # Blocks
        ##################################################
        self.lab2_part1 = self.lab2_part1 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "scope")
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "fft")
        self.lab2_part1.AddPage(grc_wxgui.Panel(self.lab2_part1), "fft1")
        self.Add(self.lab2_part1)
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
        	self.lab2_part1.GetPage(0).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.lab2_part1.GetPage(0).Add(self.wxgui_scopesink2_0_0.win)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_c(
        	self.lab2_part1.GetPage(2).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.lab2_part1.GetPage(2).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.lab2_part1.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.lab2_part1.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 30000, 100, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.5, ))
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((1, ))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0))
    def _build_gui(self, vbox, usrp_rate, demod_rate, audio_rate):
        def _form_set_freq(kv):
            return self.set_freq(kv['freq'])

        if 1:
            self.src_fft = fftsink2.fft_sink_c(self.panel,
                                               title="Data from USRP",
                                               fft_size=512,
                                               sample_rate=usrp_rate,
                                               ref_scale=32768.0,
                                               ref_level=0,
                                               y_divs=12)
            self.connect(self.u, self.src_fft)
            vbox.Add(self.src_fft.win, 4, wx.EXPAND)

        if 1:
            post_fm_demod_fft = fftsink2.fft_sink_f(self.panel,
                                                    title="Post FM Demod",
                                                    fft_size=512,
                                                    sample_rate=demod_rate,
                                                    y_per_div=10,
                                                    ref_level=0)
            self.connect(self.guts.fm_demod, post_fm_demod_fft)
            vbox.Add(post_fm_demod_fft.win, 4, wx.EXPAND)

        if 0:
            post_stereo_carrier_generator_fft = fftsink2.fft_sink_c(
                self.panel,
                title="Post Stereo_carrier_generator",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0)
            self.connect(self.guts.stereo_carrier_generator,
                         post_stereo_carrier_generator_fft)
            vbox.Add(post_stereo_carrier_generator_fft.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_left = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Left",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=0)
            self.connect(self.guts.deemph_Left, post_deemphasis_left)
            vbox.Add(post_deemphasis_left.win, 4, wx.EXPAND)

        if 0:
            post_deemphasis_right = fftsink2.fft_sink_f(
                self.panel,
                title="Post_Deemphasis_Right",
                fft_size=512,
                sample_rate=audio_rate,
                y_per_div=10,
                ref_level=-20)
            self.connect(self.guts.deemph_Left, post_deemphasis_right)
            vbox.Add(post_deemphasis_right.win, 4, wx.EXPAND)

        if 0:
            LmR_fft = fftsink2.fft_sink_f(self.panel,
                                          title="LmR",
                                          fft_size=512,
                                          sample_rate=audio_rate,
                                          y_per_div=10,
                                          ref_level=-20)
            self.connect(self.guts.LmR_real, LmR_fft)
            vbox.Add(LmR_fft.win, 4, wx.EXPAND)

        if 0:
            self.scope = scopesink2.scope_sink_f(self.panel,
                                                 sample_rate=demod_rate)
            self.connect(self.guts.fm_demod, self.scope)
            vbox.Add(self.scope.win, 4, wx.EXPAND)

        # control area form at bottom
        self.myform = myform = form.form()

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)
        myform['freq'] = form.float_field(parent=self.panel,
                                          sizer=hbox,
                                          label="Freq",
                                          weight=1,
                                          callback=myform.check_input_and_call(
                                              _form_set_freq,
                                              self._set_status_msg))

        hbox.Add((5, 0), 0)
        myform['freq_slider'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, weight=3,
                                        range=(self.fm_freq_min, self.fm_freq_max, 0.1e6),
                                        callback=self.set_freq)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add((5, 0), 0)

        myform['volume'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Volume",
                                        weight=3, range=self.volume_range(),
                                        callback=self.set_vol)
        hbox.Add((5, 0), 1)

        g = self.u.get_gain_range()
        myform['gain'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                        weight=3, range=(g.start(), g.stop(), g.step()),
                                        callback=self.set_gain)
        hbox.Add((5, 0), 0)

        myform['sqlch_thrsh'] = \
            form.quantized_slider_field(parent=self.panel, sizer=hbox, label="Stereo Squelch Threshold",
                                        weight=3, range=(0.0,1.0,0.01),
                                        callback=self.set_squelch)
        hbox.Add((5, 0), 0)
        vbox.Add(hbox, 0, wx.EXPAND)

        try:
            self.knob = powermate.powermate(self.frame)
            self.rot = 0
            powermate.EVT_POWERMATE_ROTATE(self.frame, self.on_rotate)
            powermate.EVT_POWERMATE_BUTTON(self.frame, self.on_button)
        except:
            print "FYI: No Powermate or Contour Knob found"
Beispiel #50
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Keyless Live")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.vol = vol = 1
        self.samp_rate = samp_rate = 2e6
        self.gain = gain = 50
        self.fine_freq = fine_freq = 0
        self.cutoff = cutoff = 100e3
        self.alpha = alpha = 0.5

        ##################################################
        # Blocks
        ##################################################
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label='gain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_gain_sizer)
        _fine_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._fine_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_fine_freq_sizer,
        	value=self.fine_freq,
        	callback=self.set_fine_freq,
        	label='fine_freq',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._fine_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_fine_freq_sizer,
        	value=self.fine_freq,
        	callback=self.set_fine_freq,
        	minimum=-500e3,
        	maximum=500e3,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_fine_freq_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title="Scope Plot",
        	sample_rate=50e3,
        	v_scale=1,
        	v_offset=0,
        	t_scale=1e-3,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        _vol_sizer = wx.BoxSizer(wx.VERTICAL)
        self._vol_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_vol_sizer,
        	value=self.vol,
        	callback=self.set_vol,
        	label='vol',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._vol_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_vol_sizer,
        	value=self.vol,
        	callback=self.set_vol,
        	minimum=1,
        	maximum=25,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_vol_sizer)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(315e6+fine_freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(2, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(gain, 0)
        self.rtlsdr_source_0.set_if_gain(60, 0)
        self.rtlsdr_source_0.set_bb_gain(60, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.low_pass_filter_0 = filter.fir_filter_ccf(40, firdes.low_pass(
        	1, samp_rate, cutoff, 2*cutoff, firdes.WIN_HAMMING, 6.76))
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/home/triskelion/Documents/Demo/Keyless/data/keyless_mag_fifo", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        _alpha_sizer = wx.BoxSizer(wx.VERTICAL)
        self._alpha_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_alpha_sizer,
        	value=self.alpha,
        	callback=self.set_alpha,
        	label='alpha',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._alpha_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_alpha_sizer,
        	value=self.alpha,
        	callback=self.set_alpha,
        	minimum=0.1,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_alpha_sizer)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_file_sink_0, 0))
Beispiel #51
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.vec_length = vec_length = int(100e3)
        self.samp_rate = samp_rate = 2e6
        self.folder = folder = "/home/erik/Dev/mini-hackathon/HackaCurtain/data/test/"
        self.center_freq = center_freq = 433.3e6

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
        	self.GetWin(),
        	title='Scope Plot',
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_2.win)
        self.trigger_trigger_ff_0_0 = trigger.trigger_ff(0.01, 1000)
        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(2, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(30, 0)
        self.osmosdr_source_0.set_if_gain(40, 0)
        self.osmosdr_source_0.set_bb_gain(30, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 200e3, 10e4, firdes.WIN_HAMMING, 6.76))
        self.blocks_threshold_ff_0 = blocks.threshold_ff(1.33, 1.4, 0)
        self.blocks_tagged_file_sink_0_0 = blocks.tagged_file_sink(gr.sizeof_float*1, int(samp_rate))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10000, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(1000, 1.0/10000, 40, 1)
        self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_burst_tagger_0_0 = blocks.burst_tagger(gr.sizeof_float)
        self.blocks_burst_tagger_0_0.set_true_tag('burst',True)
        self.blocks_burst_tagger_0_0.set_false_tag('burst',False)




        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_burst_tagger_0_0, 0), (self.blocks_tagged_file_sink_0_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_burst_tagger_0_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_burst_tagger_0_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.wxgui_scopesink2_2, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.trigger_trigger_ff_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.trigger_trigger_ff_0_0, 0), (self.blocks_float_to_short_0_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Am Xmit Multi Carrier Fl2K")
        _icon_path = "/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.rf_sample_rate = rf_sample_rate = 8192e3
        self.fir_interp = fir_interp = 512
        self.fgain = fgain = 128
        self.af_sample_rate = af_sample_rate = 16e3

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=rf_sample_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=rf_sample_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_5 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_4 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_3 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_2 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_1 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_5 = blocks.wavfile_source(
            "Jackbenny-390101Goodbye1938Hello1939.wav", True)
        self.blocks_wavfile_source_4 = blocks.wavfile_source(
            "Jackbenny-390115JacksScreenGuildTheatrePerformance.wav", True)
        self.blocks_wavfile_source_3 = blocks.wavfile_source(
            "Jackbenny-390122EncyclopediaBritannica.wav", True)
        self.blocks_wavfile_source_2 = blocks.wavfile_source(
            "Jackbenny-390129BennyVsAllenFight.wav", True)
        self.blocks_wavfile_source_1 = blocks.wavfile_source(
            "Jackbenny-390129JackChallengesFredToFight.wav", True)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "Jackbenny-390205JackChallengesFredAllenToABoxingMatch.wav", True)
        self.blocks_multiply_xx_5 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_4 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_3 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_6 = blocks.multiply_const_vff((.045, ))
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 128)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "am_xmit_fl2k.dat", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.blocks_add_const_vxx_5 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_4 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_3 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_2 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((1, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_5 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 590.006e3, 1, 0)
        self.analog_sig_source_x_4 = analog.sig_source_f(
            rf_sample_rate, analog.GR_COS_WAVE, 570.005e3, 1, 0)
        self.analog_sig_source_x_3 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 560.004e3, 1, 0)
        self.analog_sig_source_x_2 = analog.sig_source_f(
            rf_sample_rate, analog.GR_COS_WAVE, 550.003e3, 1, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 540.002e3, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            rf_sample_rate, analog.GR_COS_WAVE, 530.001e3, 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_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_2, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.analog_sig_source_x_3, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.analog_sig_source_x_4, 0),
                     (self.blocks_multiply_xx_4, 1))
        self.connect((self.analog_sig_source_x_5, 0),
                     (self.blocks_multiply_xx_5, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_add_const_vxx_2, 0),
                     (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_add_const_vxx_3, 0),
                     (self.blocks_multiply_xx_3, 0))
        self.connect((self.blocks_add_const_vxx_4, 0),
                     (self.blocks_multiply_xx_4, 0))
        self.connect((self.blocks_add_const_vxx_5, 0),
                     (self.blocks_multiply_xx_5, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_6, 0))
        self.connect((self.blocks_float_to_char_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_6, 0),
                     (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_multiply_const_vxx_6, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_6, 0),
                     (self.wxgui_scopesink2_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_multiply_xx_2, 0), (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_xx_3, 0), (self.blocks_add_xx_0, 3))
        self.connect((self.blocks_multiply_xx_4, 0), (self.blocks_add_xx_0, 4))
        self.connect((self.blocks_multiply_xx_5, 0), (self.blocks_add_xx_0, 5))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_wavfile_source_1, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_wavfile_source_2, 0),
                     (self.low_pass_filter_2, 0))
        self.connect((self.blocks_wavfile_source_3, 0),
                     (self.low_pass_filter_3, 0))
        self.connect((self.blocks_wavfile_source_4, 0),
                     (self.low_pass_filter_4, 0))
        self.connect((self.blocks_wavfile_source_5, 0),
                     (self.low_pass_filter_5, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.blocks_add_const_vxx_1, 0))
        self.connect((self.low_pass_filter_2, 0),
                     (self.blocks_add_const_vxx_2, 0))
        self.connect((self.low_pass_filter_3, 0),
                     (self.blocks_add_const_vxx_3, 0))
        self.connect((self.low_pass_filter_4, 0),
                     (self.blocks_add_const_vxx_4, 0))
        self.connect((self.low_pass_filter_5, 0),
                     (self.blocks_add_const_vxx_5, 0))

        # start manual block add
        # block 6
        self.low_pass_filter_6 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_6 = blocks.wavfile_source(
            "Jackbenny-390212LoveFindsAnnieHardy.wav", True)
        self.blocks_multiply_xx_6 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_6 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_6 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 600.006e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_6, 0),
                     (self.blocks_multiply_xx_6, 1))
        self.connect((self.blocks_add_const_vxx_6, 0),
                     (self.blocks_multiply_xx_6, 0))
        self.connect((self.blocks_multiply_xx_6, 0), (self.blocks_add_xx_0, 6))
        self.connect((self.blocks_wavfile_source_6, 0),
                     (self.low_pass_filter_6, 0))
        self.connect((self.low_pass_filter_6, 0),
                     (self.blocks_add_const_vxx_6, 0))
        # block 7
        self.low_pass_filter_7 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_7 = blocks.wavfile_source(
            "Jackbenny-390219CarmichaelThePolarBear.wav", True)
        self.blocks_multiply_xx_7 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_7 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_7 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 620.005e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_7, 0),
                     (self.blocks_multiply_xx_7, 1))
        self.connect((self.blocks_add_const_vxx_7, 0),
                     (self.blocks_multiply_xx_7, 0))
        self.connect((self.blocks_multiply_xx_7, 0), (self.blocks_add_xx_0, 7))
        self.connect((self.blocks_wavfile_source_7, 0),
                     (self.low_pass_filter_7, 0))
        self.connect((self.low_pass_filter_7, 0),
                     (self.blocks_add_const_vxx_7, 0))
        # block 8
        self.low_pass_filter_8 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_8 = blocks.wavfile_source(
            "Jackbenny-390226JesseJamespartOne.wav", True)
        self.blocks_multiply_xx_8 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_8 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_8 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 630.004e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_8, 0),
                     (self.blocks_multiply_xx_8, 1))
        self.connect((self.blocks_add_const_vxx_8, 0),
                     (self.blocks_multiply_xx_8, 0))
        self.connect((self.blocks_multiply_xx_8, 0), (self.blocks_add_xx_0, 8))
        self.connect((self.blocks_wavfile_source_8, 0),
                     (self.low_pass_filter_8, 0))
        self.connect((self.low_pass_filter_8, 0),
                     (self.blocks_add_const_vxx_8, 0))
        # block 9
        self.low_pass_filter_9 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_9 = blocks.wavfile_source(
            "Jackbenny-390305JesseJamespartTwo.wav", True)
        self.blocks_multiply_xx_9 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_9 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_9 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 640.003e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_9, 0),
                     (self.blocks_multiply_xx_9, 1))
        self.connect((self.blocks_add_const_vxx_9, 0),
                     (self.blocks_multiply_xx_9, 0))
        self.connect((self.blocks_multiply_xx_9, 0), (self.blocks_add_xx_0, 9))
        self.connect((self.blocks_wavfile_source_9, 0),
                     (self.low_pass_filter_9, 0))
        self.connect((self.low_pass_filter_9, 0),
                     (self.blocks_add_const_vxx_9, 0))
        # block 10
        self.low_pass_filter_10 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_10 = blocks.wavfile_source(
            "Jackbenny-390312CarmichaelThePolarBearIsSick.wav", True)
        self.blocks_multiply_xx_10 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_10 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_10 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 650.002e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_10, 0),
                     (self.blocks_multiply_xx_10, 1))
        self.connect((self.blocks_add_const_vxx_10, 0),
                     (self.blocks_multiply_xx_10, 0))
        self.connect((self.blocks_multiply_xx_10, 0),
                     (self.blocks_add_xx_0, 10))
        self.connect((self.blocks_wavfile_source_10, 0),
                     (self.low_pass_filter_10, 0))
        self.connect((self.low_pass_filter_10, 0),
                     (self.blocks_add_const_vxx_10, 0))
        # block 11
        self.low_pass_filter_11 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_11 = blocks.wavfile_source(
            "Jackbenny-390319JackHasACold.wav", True)
        self.blocks_multiply_xx_11 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_11 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_11 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 660.002e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_11, 0),
                     (self.blocks_multiply_xx_11, 1))
        self.connect((self.blocks_add_const_vxx_11, 0),
                     (self.blocks_multiply_xx_11, 0))
        self.connect((self.blocks_multiply_xx_11, 0),
                     (self.blocks_add_xx_0, 11))
        self.connect((self.blocks_wavfile_source_11, 0),
                     (self.low_pass_filter_11, 0))
        self.connect((self.low_pass_filter_11, 0),
                     (self.blocks_add_const_vxx_11, 0))
        # block 12
        self.low_pass_filter_12 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_12 = blocks.wavfile_source(
            "Jackbenny-390326GuestEdSullivan.wav", True)
        self.blocks_multiply_xx_12 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_12 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_12 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 670.001e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_12, 0),
                     (self.blocks_multiply_xx_12, 1))
        self.connect((self.blocks_add_const_vxx_12, 0),
                     (self.blocks_multiply_xx_12, 0))
        self.connect((self.blocks_multiply_xx_12, 0),
                     (self.blocks_add_xx_0, 12))
        self.connect((self.blocks_wavfile_source_12, 0),
                     (self.low_pass_filter_12, 0))
        self.connect((self.low_pass_filter_12, 0),
                     (self.blocks_add_const_vxx_12, 0))
        # block 13
        self.low_pass_filter_13 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_13 = blocks.wavfile_source(
            "Jackbenny-390402AprilFools.wav", True)
        self.blocks_multiply_xx_13 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_13 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_13 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 690.000e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_13, 0),
                     (self.blocks_multiply_xx_13, 1))
        self.connect((self.blocks_add_const_vxx_13, 0),
                     (self.blocks_multiply_xx_13, 0))
        self.connect((self.blocks_multiply_xx_13, 0),
                     (self.blocks_add_xx_0, 13))
        self.connect((self.blocks_wavfile_source_13, 0),
                     (self.low_pass_filter_13, 0))
        self.connect((self.low_pass_filter_13, 0),
                     (self.blocks_add_const_vxx_13, 0))
        # block 14
        self.low_pass_filter_14 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_14 = blocks.wavfile_source(
            "Jackbenny-390409FourGirlsInWhite.wav", True)
        self.blocks_multiply_xx_14 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_14 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_14 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 700.001e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_14, 0),
                     (self.blocks_multiply_xx_14, 1))
        self.connect((self.blocks_add_const_vxx_14, 0),
                     (self.blocks_multiply_xx_14, 0))
        self.connect((self.blocks_multiply_xx_14, 0),
                     (self.blocks_add_xx_0, 14))
        self.connect((self.blocks_wavfile_source_14, 0),
                     (self.low_pass_filter_14, 0))
        self.connect((self.low_pass_filter_14, 0),
                     (self.blocks_add_const_vxx_14, 0))
        # block 15
        self.low_pass_filter_15 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_15 = blocks.wavfile_source(
            "Jackbenny-390416PhilShootsAMovieBehindJacksBack.wav", True)
        self.blocks_multiply_xx_15 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_15 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_15 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 710.002e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_15, 0),
                     (self.blocks_multiply_xx_15, 1))
        self.connect((self.blocks_add_const_vxx_15, 0),
                     (self.blocks_multiply_xx_15, 0))
        self.connect((self.blocks_multiply_xx_15, 0),
                     (self.blocks_add_xx_0, 15))
        self.connect((self.blocks_wavfile_source_15, 0),
                     (self.low_pass_filter_15, 0))
        self.connect((self.low_pass_filter_15, 0),
                     (self.blocks_add_const_vxx_15, 0))
        # block 16
        self.low_pass_filter_16 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_16 = blocks.wavfile_source(
            "Jackbenny-390423GuestBinnieBarnesAndMarkSandrich.wav", True)
        self.blocks_multiply_xx_16 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_16 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_16 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 720.003e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_16, 0),
                     (self.blocks_multiply_xx_16, 1))
        self.connect((self.blocks_add_const_vxx_16, 0),
                     (self.blocks_multiply_xx_16, 0))
        self.connect((self.blocks_multiply_xx_16, 0),
                     (self.blocks_add_xx_0, 16))
        self.connect((self.blocks_wavfile_source_16, 0),
                     (self.low_pass_filter_16, 0))
        self.connect((self.low_pass_filter_16, 0),
                     (self.blocks_add_const_vxx_16, 0))
        # block 17
        self.low_pass_filter_17 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_17 = blocks.wavfile_source(
            "Jackbenny-390430SeventhAnniversaryShow.wav", True)
        self.blocks_multiply_xx_17 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_17 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_17 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 730.004e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_17, 0),
                     (self.blocks_multiply_xx_17, 1))
        self.connect((self.blocks_add_const_vxx_17, 0),
                     (self.blocks_multiply_xx_17, 0))
        self.connect((self.blocks_multiply_xx_17, 0),
                     (self.blocks_add_xx_0, 17))
        self.connect((self.blocks_wavfile_source_17, 0),
                     (self.low_pass_filter_17, 0))
        self.connect((self.low_pass_filter_17, 0),
                     (self.blocks_add_const_vxx_17, 0))
        # block 18
        self.low_pass_filter_18 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_18 = blocks.wavfile_source(
            "Jackbenny-390507TheKentuckyDerby.wav", True)
        self.blocks_multiply_xx_18 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_18 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_18 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 740.005e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_18, 0),
                     (self.blocks_multiply_xx_18, 1))
        self.connect((self.blocks_add_const_vxx_18, 0),
                     (self.blocks_multiply_xx_18, 0))
        self.connect((self.blocks_multiply_xx_18, 0),
                     (self.blocks_add_xx_0, 18))
        self.connect((self.blocks_wavfile_source_18, 0),
                     (self.low_pass_filter_18, 0))
        self.connect((self.low_pass_filter_18, 0),
                     (self.blocks_add_const_vxx_18, 0))
        # block 19
        self.low_pass_filter_19 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_19 = blocks.wavfile_source(
            "Jackbenny-390514GungaDin.wav", True)
        self.blocks_multiply_xx_19 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_19 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_19 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 750.006e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_19, 0),
                     (self.blocks_multiply_xx_19, 1))
        self.connect((self.blocks_add_const_vxx_19, 0),
                     (self.blocks_multiply_xx_19, 0))
        self.connect((self.blocks_multiply_xx_19, 0),
                     (self.blocks_add_xx_0, 19))
        self.connect((self.blocks_wavfile_source_19, 0),
                     (self.low_pass_filter_19, 0))
        self.connect((self.low_pass_filter_19, 0),
                     (self.blocks_add_const_vxx_19, 0))
        # block 20
        self.low_pass_filter_20 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_20 = blocks.wavfile_source(
            "Jackbenny-390521MoreGungaDin.wav", True)
        self.blocks_multiply_xx_20 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_20 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_20 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 760.005e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_20, 0),
                     (self.blocks_multiply_xx_20, 1))
        self.connect((self.blocks_add_const_vxx_20, 0),
                     (self.blocks_multiply_xx_20, 0))
        self.connect((self.blocks_multiply_xx_20, 0),
                     (self.blocks_add_xx_0, 20))
        self.connect((self.blocks_wavfile_source_20, 0),
                     (self.low_pass_filter_20, 0))
        self.connect((self.low_pass_filter_20, 0),
                     (self.blocks_add_const_vxx_20, 0))
        # block 21
        self.low_pass_filter_21 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_21 = blocks.wavfile_source(
            "Jackbenny-390528AlexanderGrahamBell.wav", True)
        self.blocks_multiply_xx_21 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_21 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_21 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 770.004e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_21, 0),
                     (self.blocks_multiply_xx_21, 1))
        self.connect((self.blocks_add_const_vxx_21, 0),
                     (self.blocks_multiply_xx_21, 0))
        self.connect((self.blocks_multiply_xx_21, 0),
                     (self.blocks_add_xx_0, 21))
        self.connect((self.blocks_wavfile_source_21, 0),
                     (self.low_pass_filter_21, 0))
        self.connect((self.low_pass_filter_21, 0),
                     (self.blocks_add_const_vxx_21, 0))
        # block 22
        self.low_pass_filter_22 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_22 = blocks.wavfile_source(
            "Jackbenny-390604PreviewOfHoundOfTheBaskervilles.wav", True)
        self.blocks_multiply_xx_22 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_22 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_22 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 780.003e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_22, 0),
                     (self.blocks_multiply_xx_22, 1))
        self.connect((self.blocks_add_const_vxx_22, 0),
                     (self.blocks_multiply_xx_22, 0))
        self.connect((self.blocks_multiply_xx_22, 0),
                     (self.blocks_add_xx_0, 22))
        self.connect((self.blocks_wavfile_source_22, 0),
                     (self.low_pass_filter_22, 0))
        self.connect((self.low_pass_filter_22, 0),
                     (self.blocks_add_const_vxx_22, 0))
        # block 23
        self.low_pass_filter_23 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_23 = blocks.wavfile_source(
            "Jackbenny-390618FathersDayLeavingForWaukegan.wav", True)
        self.blocks_multiply_xx_23 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_23 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_23 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 790.002e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_23, 0),
                     (self.blocks_multiply_xx_23, 1))
        self.connect((self.blocks_add_const_vxx_23, 0),
                     (self.blocks_multiply_xx_23, 0))
        self.connect((self.blocks_multiply_xx_23, 0),
                     (self.blocks_add_xx_0, 23))
        self.connect((self.blocks_wavfile_source_23, 0),
                     (self.low_pass_filter_23, 0))
        self.connect((self.low_pass_filter_23, 0),
                     (self.blocks_add_const_vxx_23, 0))
        # block 24
        self.low_pass_filter_24 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_24 = blocks.wavfile_source(
            "Jackbenny-390625LastShowOfTheSeasonFromWaukegan.wav", True)
        self.blocks_multiply_xx_24 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_24 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_24 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 800.001e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_24, 0),
                     (self.blocks_multiply_xx_24, 1))
        self.connect((self.blocks_add_const_vxx_24, 0),
                     (self.blocks_multiply_xx_24, 0))
        self.connect((self.blocks_multiply_xx_24, 0),
                     (self.blocks_add_xx_0, 24))
        self.connect((self.blocks_wavfile_source_24, 0),
                     (self.low_pass_filter_24, 0))
        self.connect((self.low_pass_filter_24, 0),
                     (self.blocks_add_const_vxx_24, 0))
        # block 25
        self.low_pass_filter_25 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_25 = blocks.wavfile_source(
            "Jackbenny-391008DennisDaysFirstShow.wav", True)
        self.blocks_multiply_xx_25 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_25 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_25 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 810.000e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_25, 0),
                     (self.blocks_multiply_xx_25, 1))
        self.connect((self.blocks_add_const_vxx_25, 0),
                     (self.blocks_multiply_xx_25, 0))
        self.connect((self.blocks_multiply_xx_25, 0),
                     (self.blocks_add_xx_0, 25))
        self.connect((self.blocks_wavfile_source_25, 0),
                     (self.low_pass_filter_25, 0))
        self.connect((self.low_pass_filter_25, 0),
                     (self.blocks_add_const_vxx_25, 0))
        # block 26
        self.low_pass_filter_26 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_26 = blocks.wavfile_source(
            "Jackbenny-391015DennissMotherInterferes.wav", True)
        self.blocks_multiply_xx_26 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_26 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_26 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 820.001e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_26, 0),
                     (self.blocks_multiply_xx_26, 1))
        self.connect((self.blocks_add_const_vxx_26, 0),
                     (self.blocks_multiply_xx_26, 0))
        self.connect((self.blocks_multiply_xx_26, 0),
                     (self.blocks_add_xx_0, 26))
        self.connect((self.blocks_wavfile_source_26, 0),
                     (self.low_pass_filter_26, 0))
        self.connect((self.low_pass_filter_26, 0),
                     (self.blocks_add_const_vxx_26, 0))
        # block 27
        self.low_pass_filter_27 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_27 = blocks.wavfile_source(
            "Jackbenny-391022StanleyAndLivingstone.wav", True)
        self.blocks_multiply_xx_27 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_27 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_27 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 830.002e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_27, 0),
                     (self.blocks_multiply_xx_27, 1))
        self.connect((self.blocks_add_const_vxx_27, 0),
                     (self.blocks_multiply_xx_27, 0))
        self.connect((self.blocks_multiply_xx_27, 0),
                     (self.blocks_add_xx_0, 27))
        self.connect((self.blocks_wavfile_source_27, 0),
                     (self.low_pass_filter_27, 0))
        self.connect((self.low_pass_filter_27, 0),
                     (self.blocks_add_const_vxx_27, 0))
        # block 28
        self.low_pass_filter_28 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_28 = blocks.wavfile_source(
            "Jackbenny-391029TheHalloweenMasqueradeParty.wav", True)
        self.blocks_multiply_xx_28 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_28 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_28 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 840.003e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_28, 0),
                     (self.blocks_multiply_xx_28, 1))
        self.connect((self.blocks_add_const_vxx_28, 0),
                     (self.blocks_multiply_xx_28, 0))
        self.connect((self.blocks_multiply_xx_28, 0),
                     (self.blocks_add_xx_0, 28))
        self.connect((self.blocks_wavfile_source_28, 0),
                     (self.low_pass_filter_28, 0))
        self.connect((self.low_pass_filter_28, 0),
                     (self.blocks_add_const_vxx_28, 0))
        # block 29
        self.low_pass_filter_29 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_29 = blocks.wavfile_source(
            "Jackbenny-391105TheWomen.wav", True)
        self.blocks_multiply_xx_29 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_29 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_29 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 850.004e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_29, 0),
                     (self.blocks_multiply_xx_29, 1))
        self.connect((self.blocks_add_const_vxx_29, 0),
                     (self.blocks_multiply_xx_29, 0))
        self.connect((self.blocks_multiply_xx_29, 0),
                     (self.blocks_add_xx_0, 29))
        self.connect((self.blocks_wavfile_source_29, 0),
                     (self.low_pass_filter_29, 0))
        self.connect((self.low_pass_filter_29, 0),
                     (self.blocks_add_const_vxx_29, 0))
        # block 30
        self.low_pass_filter_30 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_30 = blocks.wavfile_source(
            "Jackbenny-391112JacksToothache.wav", True)
        self.blocks_multiply_xx_30 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_30 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_30 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 860.005e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_30, 0),
                     (self.blocks_multiply_xx_30, 1))
        self.connect((self.blocks_add_const_vxx_30, 0),
                     (self.blocks_multiply_xx_30, 0))
        self.connect((self.blocks_multiply_xx_30, 0),
                     (self.blocks_add_xx_0, 30))
        self.connect((self.blocks_wavfile_source_30, 0),
                     (self.low_pass_filter_30, 0))
        self.connect((self.low_pass_filter_30, 0),
                     (self.blocks_add_const_vxx_30, 0))
        # block 31
        self.low_pass_filter_31 = filter.interp_fir_filter_fff(
            fir_interp,
            firdes.low_pass(fgain, rf_sample_rate, 8e3, 4e3,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_wavfile_source_31 = blocks.wavfile_source(
            "Jackbenny-391119MarysThanksgivingPoem.wav", True)
        self.blocks_multiply_xx_31 = blocks.multiply_vff(1)
        self.blocks_add_const_vxx_31 = blocks.add_const_vff((1, ))
        self.analog_sig_source_x_31 = analog.sig_source_f(
            rf_sample_rate, analog.GR_SIN_WAVE, 870.006e3, 1, 0)
        # connections
        self.connect((self.analog_sig_source_x_31, 0),
                     (self.blocks_multiply_xx_31, 1))
        self.connect((self.blocks_add_const_vxx_31, 0),
                     (self.blocks_multiply_xx_31, 0))
        self.connect((self.blocks_multiply_xx_31, 0),
                     (self.blocks_add_xx_0, 31))
        self.connect((self.blocks_wavfile_source_31, 0),
                     (self.low_pass_filter_31, 0))
        self.connect((self.low_pass_filter_31, 0),
                     (self.blocks_add_const_vxx_31, 0))
Beispiel #53
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960e3
        self.m = m = 0.5
        self.fm = fm = 1e3
        self.fc = fc = 100e3

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.message = analog.sig_source_f(samp_rate, analog.GR_CONST_WAVE,
                                           1000, 1, 0)
        self.iir_filter_xxx_1 = filter.iir_filter_ffd(
            ([1 / samp_rate, -1 / samp_rate]), ([1]), True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd(([1 / samp_rate]),
                                                      ([1, 1]), True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (2 * 3.14 * m * fm, ))
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_arg_1 = blocks.complex_to_arg(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(
            30,
            firdes.band_pass(20, samp_rate, 20, 20e3, 1000, firdes.WIN_HAMMING,
                             6.76))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, fc, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(1)

        ##################################################
        # Connections
        ##################################################
        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_multiply_xx_0, 1))
        self.connect((self.band_pass_filter_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_complex_to_arg_1, 0),
                     (self.iir_filter_xxx_1, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_phase_modulator_fc_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_arg_1, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.iir_filter_xxx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.iir_filter_xxx_1, 0), (self.band_pass_filter_0, 0))
        self.connect((self.message, 0), (self.iir_filter_xxx_0, 0))
Beispiel #54
0
    def __init__(self,
                 freq_corr=0,
                 avg_frames=1,
                 decim=16,
                 N_id_2=0,
                 N_id_1=134):
        grc_wxgui.top_block_gui.__init__(self, title="Sss Corr6 Gui")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.freq_corr = freq_corr
        self.avg_frames = avg_frames
        self.decim = decim
        self.N_id_2 = N_id_2
        self.N_id_1 = N_id_1

        ##################################################
        # Variables
        ##################################################
        self.vec_half_frame = vec_half_frame = 30720 * 5 / decim
        self.symbol_start = symbol_start = 144 / decim
        self.slot_0_10 = slot_0_10 = 1
        self.samp_rate = samp_rate = 30720e3 / decim
        self.rot = rot = 0
        self.noise_level = noise_level = 0
        self.fft_size = fft_size = 2048 / decim
        self.N_re = N_re = 62

        ##################################################
        # Blocks
        ##################################################
        _rot_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rot_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            label='rot',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rot_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rot_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS ML")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS rerot")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS equ")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS in")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "PSS equ")
        self.Add(self.notebook_0)
        _noise_level_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_level_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            label='noise_level',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_level_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            minimum=0,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_level_sizer)
        self.wxgui_scopesink2_0_1_0_0_0_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(4).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(4).Add(self.wxgui_scopesink2_0_1_0_0_0_0.win)
        self.wxgui_scopesink2_0_1_0_0_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0_1_0_0_0.win)
        self.wxgui_scopesink2_0_1_0_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_scopesink2_0_1_0_0.win)
        self.wxgui_scopesink2_0_1_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0_1_0.win)
        self.wxgui_scopesink2_0_1 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=100 / avg_frames,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_0_1.win)
        _symbol_start_sizer = wx.BoxSizer(wx.VERTICAL)
        self._symbol_start_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_symbol_start_sizer,
            value=self.symbol_start,
            callback=self.set_symbol_start,
            label='symbol_start',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._symbol_start_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_symbol_start_sizer,
            value=self.symbol_start,
            callback=self.set_symbol_start,
            minimum=0,
            maximum=144 / decim,
            num_steps=144 / decim,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_symbol_start_sizer)
        self.sss_ml_fd2_0 = sss_ml_fd2(avg_frames=avg_frames, )
        self.sss_fd_vec_2 = gr.vector_source_c(
            (gen_sss_fd(N_id_1, N_id_2, N_re).get_sss(slot_0_10 == 0)), True,
            N_re)
        self.sss_fd_vec_1 = gr.vector_source_c(
            (gen_sss_fd(N_id_1, N_id_2, N_re).get_sss(slot_0_10 != 0)), True,
            N_re)
        self.sss_equ2_0 = sss_equ2()
        self.sss_derot_0 = sss_derot()
        self.pss_fd_vec = gr.vector_source_c(
            (gen_pss_fd(N_id_2, N_re, False).get_data()), True, N_re)
        self.gr_vector_to_stream_0_0_2_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_2 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_1_0_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_1_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_1 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_stream_to_vector_0_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_stream_mux_0 = gr.stream_mux(gr.sizeof_gr_complex * 1,
                                             (N_re / 2, N_re / 2))
        self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex * 1)
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN,
                                                     noise_level, 0)
        self.gr_multiply_xx_1_0 = gr.multiply_vcc(N_re)
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc(
            (0.005 * exp(rot * 2 * numpy.pi * 1j), ))
        self.gr_keep_m_in_n_0_0 = gr.keep_m_in_n(gr.sizeof_gr_complex,
                                                 N_re / 2, fft_size,
                                                 (fft_size - N_re) / 2 - 1)
        self.gr_keep_m_in_n_0 = gr.keep_m_in_n(gr.sizeof_gr_complex, N_re / 2,
                                               fft_size, (fft_size) / 2)
        self.gr_interleave_1 = gr.interleave(gr.sizeof_gr_complex * N_re)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/user/git/gr-lte/gr-lte/test/octave/foo_sss_td_in.cfile",
            True)
        self.gr_fft_vxx_0 = gr.fft_vcc(fft_size, True,
                                       (window.blackmanharris(1024)), True, 1)
        self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_gr_complex * N_re)
        self.gr_complex_to_arg_1 = gr.complex_to_arg(1)
        self.gr_complex_to_arg_0 = gr.complex_to_arg(1)
        self.gr_channel_model_0 = gr.channel_model(
            noise_voltage=0.005 * noise_level,
            frequency_offset=0.0,
            epsilon=1,
            taps=(0.005 * exp(rot * 2 * numpy.pi * 1j), ),
            noise_seed=0,
        )
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.blks2_selector_0_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=2,
            num_outputs=1,
            input_index=0,
            output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=3,
            num_outputs=2,
            input_index=0,
            output_index=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.gr_channel_model_0, 0))
        self.connect((self.blks2_selector_0, 1), (self.gr_add_xx_0, 0))
        self.connect((self.gr_channel_model_0, 0),
                     (self.blks2_selector_0_0, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.blks2_selector_0_0, 1))
        self.connect((self.gr_file_source_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.blks2_selector_0_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_fft_vxx_0, 0), (self.gr_vector_to_stream_0, 0))
        self.connect((self.gr_stream_to_vector_0_0, 0),
                     (self.gr_deinterleave_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
        self.connect((self.gr_keep_m_in_n_0_0, 0), (self.gr_stream_mux_0, 0))
        self.connect((self.gr_keep_m_in_n_0, 0), (self.gr_stream_mux_0, 1))
        self.connect((self.gr_stream_mux_0, 0),
                     (self.gr_stream_to_vector_0_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 1))
        self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 2))
        self.connect((self.gr_vector_to_stream_0_0, 0),
                     (self.wxgui_scopesink2_0_1_0, 0))
        self.connect((self.sss_fd_vec_1, 0), (self.gr_interleave_1, 0))
        self.connect((self.sss_fd_vec_2, 0), (self.gr_interleave_1, 1))
        self.connect((self.gr_deinterleave_0, 1), (self.sss_equ2_0, 1))
        self.connect((self.sss_derot_0, 0), (self.sss_ml_fd2_0, 0))
        self.connect((self.gr_interleave_1, 0), (self.sss_derot_0, 1))
        self.connect((self.sss_equ2_0, 0), (self.sss_derot_0, 0))
        self.connect((self.gr_interleave_1, 0), (self.sss_ml_fd2_0, 1))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.gr_keep_m_in_n_0_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.gr_keep_m_in_n_0, 0))
        self.connect((self.sss_ml_fd2_0, 0), (self.wxgui_scopesink2_0_1, 0))
        self.connect((self.sss_derot_0, 0), (self.gr_vector_to_stream_0_0, 0))
        self.connect((self.sss_equ2_0, 0), (self.gr_vector_to_stream_0_0_2, 0))
        self.connect((self.gr_vector_to_stream_0_0_2, 0),
                     (self.wxgui_scopesink2_0_1_0_0, 0))
        self.connect((self.gr_deinterleave_0, 0),
                     (self.gr_vector_to_stream_0_0_2_0, 0))
        self.connect((self.gr_vector_to_stream_0_0_2_0, 0),
                     (self.wxgui_scopesink2_0_1_0_0_0, 0))
        self.connect((self.gr_deinterleave_0, 1), (self.gr_multiply_xx_1_0, 0))
        self.connect((self.sss_equ2_0, 1), (self.gr_multiply_xx_1_0, 1))
        self.connect((self.gr_multiply_xx_1_0, 0),
                     (self.gr_vector_to_stream_0_0_1, 0))
        self.connect((self.pss_fd_vec, 0),
                     (self.gr_vector_to_stream_0_0_1_0, 0))
        self.connect((self.gr_vector_to_stream_0_0_1_0, 0),
                     (self.gr_complex_to_arg_1, 0))
        self.connect((self.gr_complex_to_arg_1, 0),
                     (self.wxgui_scopesink2_0_1_0_0_0_0, 1))
        self.connect((self.gr_vector_to_stream_0_0_1, 0),
                     (self.gr_complex_to_arg_0, 0))
        self.connect((self.gr_complex_to_arg_0, 0),
                     (self.wxgui_scopesink2_0_1_0_0_0_0, 0))
        self.connect((self.gr_interleave_1, 0),
                     (self.gr_vector_to_stream_0_0_1_0_0, 0))
        self.connect((self.gr_vector_to_stream_0_0_1_0_0, 0),
                     (self.wxgui_scopesink2_0_1_0, 1))
        self.connect((self.gr_deinterleave_0, 0), (self.sss_equ2_0, 0))
        self.connect((self.pss_fd_vec, 0), (self.sss_equ2_0, 2))
Beispiel #55
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Keyfob Rx")

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 5
        self.samp_rate = samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=3400,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=3400 * 5,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_fff(3393.75 * sps /
                                                             1000000.026491,
                                                             taps=None,
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(1000000)
        self.osmosdr_source_0.set_center_freq(434400000, 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(2, 0)
        self.osmosdr_source_0.set_if_gain(0, 0)
        self.osmosdr_source_0.set_bb_gain(0, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.keyfob_parse_packet_0 = keyfob.parse_packet()
        self.keyfob_manchester_decode_0 = keyfob.manchester_decode()
        self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb(
            "10101000", 0, "packet_start")
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            sps * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.05)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_moving_average_xx_1 = blocks.moving_average_ff(
            sps, 1.0 / sps, 4000)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(
            10000, 1.0 / 10000, 4000)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_moving_average_xx_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_moving_average_xx_1, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.blocks_moving_average_xx_1, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_divide_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.keyfob_manchester_decode_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.wxgui_scopesink2_1, 0))
        self.connect((self.digital_correlate_access_code_tag_bb_0, 0),
                     (self.keyfob_parse_packet_0, 0))
        self.connect((self.keyfob_manchester_decode_0, 0),
                     (self.digital_correlate_access_code_tag_bb_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.blocks_moving_average_xx_1, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Getting Started")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        self.lab1exp1 = self.lab1exp1 = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.lab1exp1.AddPage(grc_wxgui.Panel(self.lab1exp1), "scope")
        self.lab1exp1.AddPage(grc_wxgui.Panel(self.lab1exp1), "fft")
        self.Add(self.lab1exp1)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.lab1exp1.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_NORM,
            y_axis_label="Counts",
        )
        self.lab1exp1.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.lab1exp1.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.lab1exp1.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, 500, 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.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.audio_sink_0, 0))
Beispiel #57
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Nbfm")

        ##################################################
        # Variables
        ##################################################
        self.decim = decim = 2
        self.adc_rate = adc_rate = 2000000
        self.xlate_offset_fine = xlate_offset_fine = 4000
        self.xlate_offset = xlate_offset = 0
        self.xlate_decim = xlate_decim = 4
        self.xlate_bandwidth = xlate_bandwidth = 12500
        self.volume = volume = 1
        self.squelch = squelch = 50
        self.samp_rate = samp_rate = adc_rate/decim
        self.main_freq = main_freq = 167.99e6
        self.audio_rate = audio_rate = 48000
        self.audio_interp = audio_interp = 4

        ##################################################
        # Blocks
        ##################################################
        self.main_notebook = self.main_notebook = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Baseband")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Scope")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Waterfall")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Quad demod")
        self.Add(self.main_notebook)
        _xlate_offset_fine_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlate_offset_fine_text_box = forms.text_box(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	sizer=_xlate_offset_fine_sizer,
        	value=self.xlate_offset_fine,
        	callback=self.set_xlate_offset_fine,
        	label="Fine Offset",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._xlate_offset_fine_slider = forms.slider(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	sizer=_xlate_offset_fine_sizer,
        	value=self.xlate_offset_fine,
        	callback=self.set_xlate_offset_fine,
        	minimum=-10000,
        	maximum=10000,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.main_notebook.GetPage(0).Add(_xlate_offset_fine_sizer)
        self._xlate_offset_text_box = forms.text_box(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	value=self.xlate_offset,
        	callback=self.set_xlate_offset,
        	label="Xlate Offset",
        	converter=forms.float_converter(),
        )
        self.main_notebook.GetPage(0).Add(self._xlate_offset_text_box)
        _xlate_bandwidth_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlate_bandwidth_text_box = forms.text_box(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	sizer=_xlate_bandwidth_sizer,
        	value=self.xlate_bandwidth,
        	callback=self.set_xlate_bandwidth,
        	label="Xlate Bandwidth",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._xlate_bandwidth_slider = forms.slider(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	sizer=_xlate_bandwidth_sizer,
        	value=self.xlate_bandwidth,
        	callback=self.set_xlate_bandwidth,
        	minimum=2500,
        	maximum=250000,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.main_notebook.GetPage(0).Add(_xlate_bandwidth_sizer)
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	label='volume',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._volume_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_volume_sizer,
        	value=self.volume,
        	callback=self.set_volume,
        	minimum=0,
        	maximum=10,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_volume_sizer)
        _squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._squelch_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	label='squelch',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._squelch_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_squelch_sizer,
        	value=self.squelch,
        	callback=self.set_squelch,
        	minimum=0,
        	maximum=100,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_squelch_sizer)
        self._main_freq_text_box = forms.text_box(
        	parent=self.main_notebook.GetPage(0).GetWin(),
        	value=self.main_freq,
        	callback=self.set_main_freq,
        	label="Main Freq",
        	converter=forms.float_converter(),
        )
        self.main_notebook.GetPage(0).Add(self._main_freq_text_box)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.main_notebook.GetPage(2).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=50,
        	ref_scale=2.0,
        	sample_rate=samp_rate/xlate_decim,
        	fft_size=512,
        	fft_rate=30,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.main_notebook.GetPage(2).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
        	self.main_notebook.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate/xlate_decim,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.main_notebook.GetPage(3).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.main_notebook.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate/xlate_decim,
        	v_scale=10,
        	v_offset=0,
        	t_scale=10000,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.main_notebook.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.main_notebook.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=50,
        	ref_scale=2.0,
        	sample_rate=samp_rate/xlate_decim,
        	fft_size=1024,
        	fft_rate=30,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.main_notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(main_freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(2, 0)
        self.rtlsdr_source_0.set_gain_mode(True, 0)
        self.rtlsdr_source_0.set_gain(50, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=audio_rate*audio_interp,
                decimation=samp_rate/xlate_decim,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(xlate_decim, (firdes.low_pass(1, samp_rate, xlate_bandwidth/2, 1000)), xlate_offset + xlate_offset_fine, samp_rate)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, ))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(squelch*-1, 1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate*audio_interp,
        	tau=75e-6,
        	max_dev=5e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.wxgui_scopesink2_1, 0))    
        self.connect((self.analog_simple_squelch_cc_0, 0), (self.analog_nbfm_rx_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_quadrature_demod_cf_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_simple_squelch_cc_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
Beispiel #58
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Wifi Rx Rftap")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.window_size = window_size = 48
        self.sync_length = sync_length = 320
        self.samp_rate = samp_rate = 20e6
        self.lo_offset = lo_offset = 0
        self.gain = gain = 80
        self.freq = freq = 5.18e9
        self.chan_est = chan_est = ieee802_11.LMS

        ##################################################
        # Blocks
        ##################################################
        self._samp_rate_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.samp_rate,
            callback=self.set_samp_rate,
            label="Sample Rate",
            choices=[5e6, 10e6, 20e6],
            labels=["5 MHz", "10 MHz", "20 MHz"],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._samp_rate_chooser)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "constellation")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "autocorrelation")
        self.Add(self.nb)
        self._freq_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label="Channel",
            choices=[
                2412000000.0, 2417000000.0, 2422000000.0, 2427000000.0,
                2432000000.0, 2437000000.0, 2442000000.0, 2447000000.0,
                2452000000.0, 2457000000.0, 2462000000.0, 2467000000.0,
                2472000000.0, 2484000000.0, 5170000000.0, 5180000000.0,
                5190000000.0, 5200000000.0, 5210000000.0, 5220000000.0,
                5230000000.0, 5240000000.0, 5250000000.0, 5260000000.0,
                5270000000.0, 5280000000.0, 5290000000.0, 5300000000.0,
                5310000000.0, 5320000000.0, 5500000000.0, 5510000000.0,
                5520000000.0, 5530000000.0, 5540000000.0, 5550000000.0,
                5560000000.0, 5570000000.0, 5580000000.0, 5590000000.0,
                5600000000.0, 5610000000.0, 5620000000.0, 5630000000.0,
                5640000000.0, 5660000000.0, 5670000000.0, 5680000000.0,
                5690000000.0, 5700000000.0, 5710000000.0, 5720000000.0,
                5745000000.0, 5755000000.0, 5765000000.0, 5775000000.0,
                5785000000.0, 5795000000.0, 5805000000.0, 5825000000.0,
                5860000000.0, 5870000000.0, 5880000000.0, 5890000000.0,
                5900000000.0, 5910000000.0, 5920000000.0
            ],
            labels=[
                '  1 | 2412.0 | 11g', '  2 | 2417.0 | 11g',
                '  3 | 2422.0 | 11g', '  4 | 2427.0 | 11g',
                '  5 | 2432.0 | 11g', '  6 | 2437.0 | 11g',
                '  7 | 2442.0 | 11g', '  8 | 2447.0 | 11g',
                '  9 | 2452.0 | 11g', ' 10 | 2457.0 | 11g',
                ' 11 | 2462.0 | 11g', ' 12 | 2467.0 | 11g',
                ' 13 | 2472.0 | 11g', ' 14 | 2484.0 | 11g',
                ' 34 | 5170.0 | 11a', ' 36 | 5180.0 | 11a',
                ' 38 | 5190.0 | 11a', ' 40 | 5200.0 | 11a',
                ' 42 | 5210.0 | 11a', ' 44 | 5220.0 | 11a',
                ' 46 | 5230.0 | 11a', ' 48 | 5240.0 | 11a',
                ' 50 | 5250.0 | 11a', ' 52 | 5260.0 | 11a',
                ' 54 | 5270.0 | 11a', ' 56 | 5280.0 | 11a',
                ' 58 | 5290.0 | 11a', ' 60 | 5300.0 | 11a',
                ' 62 | 5310.0 | 11a', ' 64 | 5320.0 | 11a',
                '100 | 5500.0 | 11a', '102 | 5510.0 | 11a',
                '104 | 5520.0 | 11a', '106 | 5530.0 | 11a',
                '108 | 5540.0 | 11a', '110 | 5550.0 | 11a',
                '112 | 5560.0 | 11a', '114 | 5570.0 | 11a',
                '116 | 5580.0 | 11a', '118 | 5590.0 | 11a',
                '120 | 5600.0 | 11a', '122 | 5610.0 | 11a',
                '124 | 5620.0 | 11a', '126 | 5630.0 | 11a',
                '128 | 5640.0 | 11a', '132 | 5660.0 | 11a',
                '134 | 5670.0 | 11a', '136 | 5680.0 | 11a',
                '138 | 5690.0 | 11a', '140 | 5700.0 | 11a',
                '142 | 5710.0 | 11a', '144 | 5720.0 | 11a',
                '149 | 5745.0 | 11a (SRD)', '151 | 5755.0 | 11a (SRD)',
                '153 | 5765.0 | 11a (SRD)', '155 | 5775.0 | 11a (SRD)',
                '157 | 5785.0 | 11a (SRD)', '159 | 5795.0 | 11a (SRD)',
                '161 | 5805.0 | 11a (SRD)', '165 | 5825.0 | 11a (SRD)',
                '172 | 5860.0 | 11p', '174 | 5870.0 | 11p',
                '176 | 5880.0 | 11p', '178 | 5890.0 | 11p',
                '180 | 5900.0 | 11p', '182 | 5910.0 | 11p',
                '184 | 5920.0 | 11p'
            ],
        )
        self.Add(self._freq_chooser)
        self._chan_est_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.chan_est,
            callback=self.set_chan_est,
            label='chan_est',
            choices=[
                ieee802_11.LS, ieee802_11.LMS, ieee802_11.STA, ieee802_11.COMB
            ],
            labels=["LS", "LMS", "STA", "Linear Comb"],
            style=wx.RA_HORIZONTAL,
        )
        self.Add(self._chan_est_chooser)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.nb.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_scopesink1 = scopesink2.scope_sink_c(
            self.nb.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=12500,
            v_scale=0.5,
            v_offset=0,
            t_scale=0.5,
            ac_couple=False,
            xy_mode=True,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.nb.GetPage(0).Add(self.wxgui_scopesink1.win)
        self.rftap_rftap_encap_0 = rftap.rftap_encap(0, -1, "")
        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(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._lo_offset_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.lo_offset,
            callback=self.set_lo_offset,
            label="LO Offset",
            choices=[0, 6e6, 11e6],
            labels=['0 MHz', '6 MHz', '11 MHz'],
        )
        self.Add(self._lo_offset_chooser)
        self.ieee802_11_sync_short_0 = ieee802_11.sync_short(
            0.56, 2, False, False)
        self.ieee802_11_sync_long_0 = ieee802_11.sync_long(
            sync_length, True, False)
        self.ieee802_11_parse_mac_0 = ieee802_11.parse_mac(True, True)
        self.ieee802_11_moving_average_xx_1 = ieee802_11.moving_average_ff(
            window_size + 16)
        self.ieee802_11_moving_average_xx_0 = ieee802_11.moving_average_cc(
            window_size)
        self.ieee802_11_frame_equalizer_0 = ieee802_11.frame_equalizer(
            chan_est, freq, samp_rate, False, False)
        self.ieee802_11_decode_mac_0 = ieee802_11.decode_mac(True, False)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            label='gain',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_gain_sizer,
            value=self.gain,
            callback=self.set_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_gain_sizer)
        self.foo_wireshark_connector_0 = foo.wireshark_connector(127, False)
        self.fft_vxx_0 = fft.fft_vcc(64, True, (window.rectangular(64)), True,
                                     1)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 64)
        self.blocks_socket_pdu_0 = blocks.socket_pdu("UDP_CLIENT", "127.0.0.1",
                                                     "52001", 10000, False)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(
            blocks.complex_t, "packet_len")
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   "/tmp/wifi.pcap", True)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_gr_complex * 1, 16)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex * 1,
                                           sync_length)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_11_decode_mac_0, 'out'),
                         (self.foo_wireshark_connector_0, 'in'))
        self.msg_connect((self.ieee802_11_decode_mac_0, 'out'),
                         (self.ieee802_11_parse_mac_0, 'in'))
        self.msg_connect((self.ieee802_11_decode_mac_0, 'out'),
                         (self.rftap_rftap_encap_0, 'in'))
        self.msg_connect((self.ieee802_11_frame_equalizer_0, 'symbols'),
                         (self.blocks_pdu_to_tagged_stream_1, 'pdus'))
        self.msg_connect((self.rftap_rftap_encap_0, 'out'),
                         (self.blocks_socket_pdu_0, 'pdus'))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_divide_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.ieee802_11_moving_average_xx_1, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_delay_0, 0),
                     (self.ieee802_11_sync_long_0, 1))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.ieee802_11_sync_short_0, 0))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.ieee802_11_sync_short_0, 2))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.ieee802_11_moving_average_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.wxgui_scopesink1, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.ieee802_11_frame_equalizer_0, 0))
        self.connect((self.foo_wireshark_connector_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.ieee802_11_frame_equalizer_0, 0),
                     (self.ieee802_11_decode_mac_0, 0))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.ieee802_11_moving_average_xx_0, 0),
                     (self.ieee802_11_sync_short_0, 1))
        self.connect((self.ieee802_11_moving_average_xx_1, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.ieee802_11_sync_long_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.ieee802_11_sync_short_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.ieee802_11_sync_short_0, 0),
                     (self.ieee802_11_sync_long_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
    def __init__(self, subdev="A:0", devid="addr=192.168.10.2", frequency=1.4125e9, fftsize=8192):
        grc_wxgui.top_block_gui.__init__(self, title="Total Power Radiometer - N200")

        ##################################################
        # Parameters
        ##################################################
        self.subdev = subdev
        self.devid = devid
        self.frequency = frequency
        self.fftsize = fftsize

        ##################################################
        # Variables
        ##################################################
        self.GUI_samp_rate = GUI_samp_rate = 10e6
        self.samp_rate = samp_rate = int(GUI_samp_rate)
        self.prefix = prefix = "tpr_"
        self.text_samp_rate = text_samp_rate = GUI_samp_rate
        self.text_deviceID = text_deviceID = subdev
        self.text_Device_addr = text_Device_addr = devid
        self.spec_data_fifo = spec_data_fifo = "spectrum_" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.spavg = spavg = 1
        self.scope_rate = scope_rate = 2
        self.recfile_tpr = recfile_tpr = prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.recfile_kelvin = recfile_kelvin = prefix+"kelvin" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat"
        self.rec_button_tpr = rec_button_tpr = 1
        self.rec_button_iq = rec_button_iq = 1
        self.noise_amplitude = noise_amplitude = .5
        self.integ = integ = 2
        self.gain = gain = 26
        self.freq = freq = frequency
        self.file_rate = file_rate = 2.0
        self.fftrate = fftrate = int(samp_rate/fftsize)
        self.det_rate = det_rate = int(20.0)
        self.dc_gain = dc_gain = 1
        self.calib_2 = calib_2 = -342.774
        self.calib_1 = calib_1 = 4.0755e3
        self.add_noise = add_noise = 0

        ##################################################
        # Blocks
        ##################################################
        self.Main = self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "N200 Control Panel")
        self.Main.AddPage(grc_wxgui.Panel(self.Main), "TPR Measurements")
        self.Add(self.Main)
        _spavg_sizer = wx.BoxSizer(wx.VERTICAL)
        self._spavg_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	label="Spectral Averaging (Seconds)",
        	converter=forms.int_converter(),
        	proportion=0,
        )
        self._spavg_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_spavg_sizer,
        	value=self.spavg,
        	callback=self.set_spavg,
        	minimum=1,
        	maximum=20,
        	num_steps=20,
        	style=wx.SL_HORIZONTAL,
        	cast=int,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_spavg_sizer, 1, 1, 1, 1)
        self._rec_button_tpr_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_tpr,
        	callback=self.set_rec_button_tpr,
        	label="Record TPR Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_tpr_chooser, 4, 1, 1, 1)
        self._rec_button_iq_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.rec_button_iq,
        	callback=self.set_rec_button_iq,
        	label="Record I/Q Data",
        	choices=[0,1],
        	labels=['Stop','Start'],
        )
        self.Main.GetPage(0).GridAdd(self._rec_button_iq_chooser, 4, 0, 1, 1)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	label="Integration Time (Seconds)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._integ_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_integ_sizer,
        	value=self.integ,
        	callback=self.set_integ,
        	minimum=1,
        	maximum=60,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_integ_sizer, 0, 2, 1, 1)
        _gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._gain_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	label="RF Gain (dB)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._gain_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_gain_sizer,
        	value=self.gain,
        	callback=self.set_gain,
        	minimum=0,
        	maximum=50,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_gain_sizer, 0, 1, 1, 1)
        self._freq_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.freq,
        	callback=self.set_freq,
        	label="Center Frequency (Hz)",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._freq_text_box, 0, 0, 1, 1)
        self._dc_gain_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.dc_gain,
        	callback=self.set_dc_gain,
        	label="DC Gain",
        	choices=[1, 10, 100, 1000, 10000],
        	labels=[],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._dc_gain_chooser, 1, 0, 1, 1)
        self._calib_2_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_2,
        	callback=self.set_calib_2,
        	label="Calibration value 2",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_2_text_box, 3, 1, 1, 1)
        self._calib_1_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.calib_1,
        	callback=self.set_calib_1,
        	label="Calibration value 1",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._calib_1_text_box, 3, 0, 1, 1)
        self._GUI_samp_rate_chooser = forms.radio_buttons(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.GUI_samp_rate,
        	callback=self.set_GUI_samp_rate,
        	label="Sample Rate (BW)",
        	choices=[1e6,2e6,5e6,10e6,25e6],
        	labels=['1 MHz','2 MHz','5 MHz','10 MHz','25 MHz'],
        	style=wx.RA_HORIZONTAL,
        )
        self.Main.GetPage(0).GridAdd(self._GUI_samp_rate_chooser, 1, 3, 1, 1)
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	title="Total Power",
        	sample_rate=2,
        	v_scale=.1,
        	v_offset=0,
        	t_scale=100,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_STRIPCHART,
        	y_axis_label="power level",
        )
        self.Main.GetPage(1).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_numbersink2_2 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="Units",
        	minval=0,
        	maxval=1,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=GUI_samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Number Plot",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_2.win)
        self.wxgui_numbersink2_0_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="",
        	minval=0,
        	maxval=.2,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=True,
        	avg_alpha=.01,
        	label="Raw Power level",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0_0.win)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.Main.GetPage(1).GetWin(),
        	unit="Kelvin",
        	minval=0,
        	maxval=400,
        	factor=1,
        	decimal_places=6,
        	ref_level=0,
        	sample_rate=scope_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="Calibrated Temperature",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Main.GetPage(1).Add(self.wxgui_numbersink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.Main.GetPage(0).GetWin(),
        	baseband_freq=freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=20,
        	ref_scale=2.0,
        	sample_rate=GUI_samp_rate,
        	fft_size=1024,
        	fft_rate=5,
        	average=True,
        	avg_alpha=0.1,
        	title="Spectrum",
        	peak_hold=False,
        	size=(800,400),
        )
        self.Main.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join((devid, "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_samp_rate(GUI_samp_rate)
        self.uhd_usrp_source_0.set_center_freq(freq, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        (self.uhd_usrp_source_0).set_processor_affinity([0])
        self._text_samp_rate_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_samp_rate,
        	callback=self.set_text_samp_rate,
        	label="Samp rate",
        	converter=forms.float_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_samp_rate_static_text, 2, 0, 1, 1)
        self._text_deviceID_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_deviceID,
        	callback=self.set_text_deviceID,
        	label="SubDev",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_deviceID_static_text, 2, 1, 1, 1)
        self._text_Device_addr_static_text = forms.static_text(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.text_Device_addr,
        	callback=self.set_text_Device_addr,
        	label="Device Address",
        	converter=forms.str_converter(),
        )
        self.Main.GetPage(0).GridAdd(self._text_Device_addr_static_text, 2, 2, 1, 1)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((samp_rate*integ)/2.0), 1)
        (self.single_pole_iir_filter_xx_0).set_processor_affinity([1])
        _noise_amplitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_amplitude_text_box = forms.text_box(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_noise_amplitude_sizer,
        	value=self.noise_amplitude,
        	callback=self.set_noise_amplitude,
        	label='noise_amplitude',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._noise_amplitude_slider = forms.slider(
        	parent=self.Main.GetPage(0).GetWin(),
        	sizer=_noise_amplitude_sizer,
        	value=self.noise_amplitude,
        	callback=self.set_noise_amplitude,
        	minimum=.01,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Main.GetPage(0).GridAdd(_noise_amplitude_sizer, 3, 2, 1, 1)
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
        	sample_rate=samp_rate,
        	fft_size=fftsize,
        	ref_scale=2,
        	frame_rate=fftrate,
        	avg_alpha=1.0/float(spavg*fftrate),
        	average=True,
        )
        self.blocks_peak_detector_xb_0 = blocks.peak_detector_fb(0.25, 0.40, 10, 0.001)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((calib_1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((dc_gain, ))
        self.blocks_keep_one_in_n_4 = blocks.keep_one_in_n(gr.sizeof_float*1, samp_rate/det_rate)
        self.blocks_keep_one_in_n_3 = blocks.keep_one_in_n(gr.sizeof_float*fftsize, fftrate)
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, int(det_rate/file_rate))
        self.blocks_file_sink_5 = blocks.file_sink(gr.sizeof_float*fftsize, spec_data_fifo, False)
        self.blocks_file_sink_5.set_unbuffered(True)
        self.blocks_file_sink_4 = blocks.file_sink(gr.sizeof_float*1, recfile_tpr, False)
        self.blocks_file_sink_4.set_unbuffered(True)
        self.blocks_file_sink_1 = blocks.file_sink(gr.sizeof_gr_complex*1, prefix+"iq_raw" + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".dat", False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, recfile_kelvin, False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_1 = blocks.complex_to_mag_squared(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((calib_2, ))
        self.blks2_valve_2 = grc_blks2.valve(item_size=gr.sizeof_gr_complex*1, open=bool(rec_button_iq))
        self.blks2_valve_1 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(0))
        self.blks2_valve_0 = grc_blks2.valve(item_size=gr.sizeof_float*1, open=bool(rec_button_tpr))
        self._add_noise_chooser = forms.button(
        	parent=self.Main.GetPage(0).GetWin(),
        	value=self.add_noise,
        	callback=self.set_add_noise,
        	label="Noise Source",
        	choices=[0,1],
        	labels=['Off','On'],
        )
        self.Main.GetPage(0).GridAdd(self._add_noise_chooser, 3, 3, 1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_valve_0, 0), (self.blocks_file_sink_4, 0))    
        self.connect((self.blks2_valve_1, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blks2_valve_2, 0), (self.blocks_file_sink_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blks2_valve_1, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.wxgui_numbersink2_0, 0))    
        self.connect((self.blocks_char_to_float_0, 0), (self.wxgui_numbersink2_2, 0))    
        self.connect((self.blocks_complex_to_mag_squared_1, 0), (self.single_pole_iir_filter_xx_0, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_peak_detector_xb_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blks2_valve_0, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.wxgui_scopesink2_2, 0))    
        self.connect((self.blocks_keep_one_in_n_3, 0), (self.blocks_file_sink_5, 0))    
        self.connect((self.blocks_keep_one_in_n_4, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_keep_one_in_n_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0))    
        self.connect((self.blocks_peak_detector_xb_0, 0), (self.blocks_char_to_float_0, 0))    
        self.connect((self.logpwrfft_x_0, 0), (self.blocks_keep_one_in_n_3, 0))    
        self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_4, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blks2_valve_2, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_mag_squared_1, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.logpwrfft_x_0, 0))    
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))    
Beispiel #60
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="TX Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.sampno = sampno = 32
        self.samp_rate_1 = samp_rate_1 = sampno * 1e3
        self.sigsource = sigsource = 100
        self.samp_rate = samp_rate = int(samp_rate_1)
        self.carfreqno = carfreqno = 1
        self.carfreq_1 = carfreq_1 = 1
        self.bbfreqno = bbfreqno = 1
        self.bbfreq_1 = bbfreq_1 = 1
        self.bb_amp = bb_amp = 0

        ##################################################
        # Blocks
        ##################################################
        self._bbfreqno_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.bbfreqno,
            callback=self.set_bbfreqno,
            label='Baseband Frequency',
            converter=forms.float_converter(),
        )
        self.GridAdd(self._bbfreqno_text_box, 0, 0, 1, 1)
        self._sigsource_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.sigsource,
            callback=self.set_sigsource,
            label='Signal Source',
            choices=[100, 101, 102, 103, 104, 105],
            labels=[
                'Constant', 'Sine Wave', 'Cosine Wave', 'Square', 'Triange',
                'Saw Tooth'
            ],
        )
        self.GridAdd(self._sigsource_chooser, 7, 0, 1, 1)
        self._sampno_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.sampno,
            callback=self.set_sampno,
            label='Sample Rate',
            converter=forms.float_converter(),
        )
        self.GridAdd(self._sampno_text_box, 4, 0, 1, 1)
        self.notebook = self.notebook = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Scope Sink")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "FFT Sink")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Histo Sink")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook), "Waterfall Sink")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "Constellation Sink")
        self.GridAdd(self.notebook, 8, 0, 1, 1)
        self._carfreqno_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.carfreqno,
            callback=self.set_carfreqno,
            label='Carrier Frequency',
            converter=forms.float_converter(),
        )
        self.GridAdd(self._carfreqno_text_box, 2, 0, 1, 1)
        self._bbfreq_1_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.bbfreq_1,
            callback=self.set_bbfreq_1,
            label=' ',
            choices=[bbfreqno, bbfreqno * 1e3, bbfreqno * 1e6, bbfreqno * 1e9],
            labels=['Hz', 'kHz', 'MHz', 'GHz'],
            style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._bbfreq_1_chooser, 1, 0, 1, 1)
        _bb_amp_sizer = wx.BoxSizer(wx.VERTICAL)
        self._bb_amp_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_bb_amp_sizer,
            value=self.bb_amp,
            callback=self.set_bb_amp,
            label='Baseband Amplitude',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._bb_amp_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_bb_amp_sizer,
            value=self.bb_amp,
            callback=self.set_bb_amp,
            minimum=-1,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_bb_amp_sizer, 6, 0, 1, 1)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
            self.notebook.GetPage(3).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='Waterfall Plot',
            win=window.hanning,
        )
        self.notebook.GetPage(3).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook.GetPage(0).GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.notebook.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_histosink2_0 = histosink_gl.histo_sink_f(
            self.notebook.GetPage(2).GetWin(),
            title='Histogram Plot',
            num_bins=27,
            frame_size=1000,
        )
        self.notebook.GetPage(2).Add(self.wxgui_histosink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
            win=window.flattop,
        )
        self.notebook.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.notebook.GetPage(4).GetWin(),
            title='Constellation Plot',
            sample_rate=samp_rate,
            frame_rate=5,
            const_size=2048,
            M=4,
            theta=0,
            loop_bw=6.28 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=samp_rate / 4.,
            omega_limit=0.005,
        )
        self.notebook.GetPage(4).Add(self.wxgui_constellationsink2_0.win)
        self._samp_rate_1_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.samp_rate_1,
            callback=self.set_samp_rate_1,
            label=' ',
            choices=[sampno, sampno * 1e3, sampno * 1e6, sampno * 1e9],
            labels=['sp/s', 'ksp/s', 'msp/s', 'gsp/s'],
            style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._samp_rate_1_chooser, 5, 0, 1, 1)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=int(samp_rate / 32000),
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self._carfreq_1_chooser = forms.radio_buttons(
            parent=self.GetWin(),
            value=self.carfreq_1,
            callback=self.set_carfreq_1,
            label=' ',
            choices=[
                carfreqno, carfreqno * 1e3, carfreqno * 1e6, carfreqno * 1e9
            ],
            labels=['Hz', 'kHz', 'MHz', 'GHz'],
            style=wx.RA_HORIZONTAL,
        )
        self.GridAdd(self._carfreq_1_chooser, 3, 0, 1, 1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            32e3, sigsource, bbfreq_1, bb_amp, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_histosink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))