Esempio n. 1
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="rx-PSK")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 24000

        ##################################################
        # Blocks
        ##################################################
        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.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(415e6, 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.digital_psk_demod_0 = digital.psk.psk_demod(
          constellation_points=8,
          differential=True,
          samples_per_symbol=2,
          excess_bw=0.35,
          phase_bw=6.28/100.0,
          timing_bw=6.28/100.0,
          mod_code="gray",
          verbose=True,
          log=True,
          )
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/Users/majora/Code/BasicSloth/in.dat", False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_psk_demod_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.digital_psk_demod_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_constellationsink2_0, 0))    
Esempio n. 2
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Qpsk Tx Uhd")
        _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 = 320e3
        self.gain = gain = 30
        self.freq = freq = 2.421e9

        ##################################################
        # Blocks
        ##################################################
        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_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=4,
          mod_code="gray",
          differential=True,
          samples_per_symbol=2,
          excess_bw=350e-3,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.5, ))
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 255, 10000000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_const_vxx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM radio FFT example")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_sample_rate_0 = variable_sample_rate_0 = 1.000E6
        self.xlatecenter = xlatecenter = 0
        self.xlate_filter = xlate_filter = firdes.low_pass(1, variable_sample_rate_0, 125000, 25000, firdes.WIN_HAMMING, 6.76)
        self.variable_static_text_0 = variable_static_text_0 = 'RTL R820T'
        self.variable_1 = variable_1 = 0
        self.transition = transition = 1e6
        self.samp_rate = samp_rate = 48000
        self.quadrature = quadrature = 500000
        self.cutoff = cutoff = 1e5
        self.audio_interp = audio_interp = 4
        self.RF_Gain = RF_Gain = 13
        self.CF = CF = 88.5e6

        ##################################################
        # Blocks
        ##################################################
        _xlatecenter_sizer = wx.BoxSizer(wx.VERTICAL)
        self._xlatecenter_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_xlatecenter_sizer,
        	value=self.xlatecenter,
        	callback=self.set_xlatecenter,
        	label="center2",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._xlatecenter_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_xlatecenter_sizer,
        	value=self.xlatecenter,
        	callback=self.set_xlatecenter,
        	minimum=-1e6,
        	maximum=1e6,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_xlatecenter_sizer, 8, 0, 1, 5)
        self._variable_sample_rate_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.variable_sample_rate_0,
        	callback=self.set_variable_sample_rate_0,
        	label="Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._variable_sample_rate_0_text_box, 7, 0, 1, 5)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Waterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Scope")
        self.GridAdd(self.notebook_0, 1, 0, 4, 5)
        _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=45,
        	num_steps=45,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 6, 0, 1, 5)
        _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=87.9e6,
        	maximum=90e6,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_CF_sizer, 5, 0, 1, 5)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=CF,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=variable_sample_rate_0,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        	size=(575, 600),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.notebook_0.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=variable_sample_rate_0,
        	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_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=CF,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=variable_sample_rate_0,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        	size=(575, 600),
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
        	self.notebook_0.GetPage(2).GetWin(),
        	title="Constellation Plot",
        	sample_rate=variable_sample_rate_0,
        	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=variable_sample_rate_0/4.,
        	omega_limit=0.005,
        	size=(575, 600),
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_constellationsink2_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="SDR ",
        	converter=forms.str_converter(),
        )
        self.GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 5)
        self.rational_resampler_xxx_1_0 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=50,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=50,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=samp_rate * audio_interp,
                decimation=int(variable_sample_rate_0),
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, variable_sample_rate_0, 5000, 8000, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(5, (xlate_filter), xlatecenter, variable_sample_rate_0)
        self.audio_sink_1_0 = audio.sink(48000, "Radio:NFM-Center", True)
        self.audio_sink_1 = audio.sink(48000, "Radio:NFM", True)
        self.audio_sink_0 = audio.sink(48000, "Radio:WFM", False)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate * audio_interp,
        	audio_decimation=audio_interp,
        )
        self.analog_nbfm_rx_0_0 = analog.nbfm_rx(
        	audio_rate=50000,
        	quad_rate=int(variable_sample_rate_0/5),
        	tau=75e-6,
        	max_dev=12500,
        )
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=50000,
        	quad_rate=int(variable_sample_rate_0/5),
        	tau=75e-6,
        	max_dev=12500,
        )
        self.RTL820T = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.RTL820T.set_sample_rate(variable_sample_rate_0)
        self.RTL820T.set_center_freq(CF, 0)
        self.RTL820T.set_freq_corr(0, 0)
        self.RTL820T.set_dc_offset_mode(2, 0)
        self.RTL820T.set_iq_balance_mode(0, 0)
        self.RTL820T.set_gain_mode(False, 0)
        self.RTL820T.set_gain(RF_Gain, 0)
        self.RTL820T.set_if_gain(20, 0)
        self.RTL820T.set_bb_gain(20, 0)
        self.RTL820T.set_antenna("", 0)
        self.RTL820T.set_bandwidth(1e6, 0)
          

        ##################################################
        # Connections
        ##################################################
        self.connect((self.RTL820T, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
        self.connect((self.RTL820T, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.RTL820T, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_constellationsink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.analog_nbfm_rx_0, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.analog_nbfm_rx_0_0, 0), (self.rational_resampler_xxx_1_0, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_nbfm_rx_0_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_rcv_0, 0))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_1, 0))    
        self.connect((self.rational_resampler_xxx_1_0, 0), (self.audio_sink_1_0, 0))    
Esempio n. 4
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.variable_slider_2 = variable_slider_2 = 0
        self.variable_slider_0 = variable_slider_0 = 50000
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        _variable_slider_2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_2_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_variable_slider_2_sizer,
        	value=self.variable_slider_2,
        	callback=self.set_variable_slider_2,
        	label="label_variable_slider_0 NOise amplitude",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._variable_slider_2_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_variable_slider_2_sizer,
        	value=self.variable_slider_2,
        	callback=self.set_variable_slider_2,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_variable_slider_2_sizer)
        _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_variable_slider_0_sizer,
        	value=self.variable_slider_0,
        	callback=self.set_variable_slider_0,
        	label="label_variable_slider_MULITIPLICACION_VOZ",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._variable_slider_0_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_variable_slider_0_sizer,
        	value=self.variable_slider_0,
        	callback=self.set_variable_slider_0,
        	minimum=0,
        	maximum=1e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
        	self.GetWin(),
        	title="Constellation Plot",
        	sample_rate=samp_rate,
        	frame_rate=256,
        	const_size=4,
        	M=2,
        	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.vocoder_g723_40_encode_sb_0 = vocoder.g723_40_encode_sb()
        self.digital_qam_mod_0 = digital.qam.qam_mod(
          constellation_points=4,
          mod_code="gray",
          differential=True,
          samples_per_symbol=256,
          excess_bw=0.35,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((variable_slider_0, ))
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, variable_slider_2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_short_0, 0))
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_float_to_short_0, 0), (self.vocoder_g723_40_encode_sb_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.vocoder_g723_40_encode_sb_0, 0), (self.digital_qam_mod_0, 0))
        self.connect((self.digital_qam_mod_0, 0), (self.blocks_add_xx_0, 0))
Esempio n. 5
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.const_type = const_type = 1
        self.variable_static_text_0 = variable_static_text_0 = {
            0: 'BPSK',
            1: 'QPSK',
            2: '8-PSK'
        }[const_type] + " - Change const_type for different constellation types!"
        self.samp_rate = samp_rate = 100000
        self.const = const = (digital.constellation_bpsk(),
                              digital.constellation_qpsk(),
                              digital.constellation_8psk())
        self.EbN0 = EbN0 = 10

        ##################################################
        # Blocks
        ##################################################
        _EbN0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._EbN0_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_EbN0_sizer,
            value=self.EbN0,
            callback=self.set_EbN0,
            label='Eb / N0 (dB)',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._EbN0_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_EbN0_sizer,
            value=self.EbN0,
            callback=self.set_EbN0,
            minimum=-10,
            maximum=200,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_EbN0_sizer)
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
            self.GetWin(),
            unit='%',
            minval=0,
            maxval=1,
            factor=100,
            decimal_places=4,
            ref_level=0,
            sample_rate=100000,
            number_rate=15,
            average=True,
            avg_alpha=None,
            label='BER',
            peak_hold=False,
            show_gauge=False,
        )
        self.GridAdd(self.wxgui_numbersink2_0.win, 1, 0, 1, 1)
        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=2,
            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.GridAdd(self.wxgui_constellationsink2_0.win, 2, 0, 1, 1)
        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='Constellation Type',
            converter=forms.float_converter(),
        )
        self.Add(self._variable_static_text_0_static_text)
        self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(
            const[const_type].base())
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (const[const_type].points()), 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, samp_rate,
                                                 True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blks2_error_rate_0 = grc_blks2.error_rate(
            type='BER',
            win_size=int(10e6),
            bits_per_symbol=const[const_type].bits_per_symbol(),
        )
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int,
                numpy.random.randint(0, const[const_type].arity(), int(10e6))),
            True)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 1.0 / math.sqrt(
                2.0 * const[const_type].bits_per_symbol() * 10**(EbN0 / 10)),
            42)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blks2_error_rate_0, 0),
                     (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.digital_constellation_decoder_cb_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blks2_error_rate_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.digital_constellation_decoder_cb_0, 0),
                     (self.blks2_error_rate_0, 1))
Esempio n. 6
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Udp Rx")
        _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 = 2e6
        self.RFGain_rx = RFGain_rx = 10
        self.IFGain_tx = IFGain_tx = 30
        self.IFGain_rx = IFGain_rx = 30
        self.CenterFreq_tx = CenterFreq_tx = 500e6
        self.CenterFreq_rx = CenterFreq_rx = 520e6
        self.BBGain_tx = BBGain_tx = 30
        self.BBGain_rx = BBGain_rx = 30

        ##################################################
        # Blocks
        ##################################################
        _RFGain_rx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RFGain_rx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_RFGain_rx_sizer,
        	value=self.RFGain_rx,
        	callback=self.set_RFGain_rx,
        	label='RFGain_rx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._RFGain_rx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_RFGain_rx_sizer,
        	value=self.RFGain_rx,
        	callback=self.set_RFGain_rx,
        	minimum=1,
        	maximum=40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_RFGain_rx_sizer)
        _IFGain_rx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._IFGain_rx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_IFGain_rx_sizer,
        	value=self.IFGain_rx,
        	callback=self.set_IFGain_rx,
        	label='IFGain_rx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._IFGain_rx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_IFGain_rx_sizer,
        	value=self.IFGain_rx,
        	callback=self.set_IFGain_rx,
        	minimum=1,
        	maximum=40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_IFGain_rx_sizer)
        _CenterFreq_rx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CenterFreq_rx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_CenterFreq_rx_sizer,
        	value=self.CenterFreq_rx,
        	callback=self.set_CenterFreq_rx,
        	label='CenterFreq_rx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._CenterFreq_rx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_CenterFreq_rx_sizer,
        	value=self.CenterFreq_rx,
        	callback=self.set_CenterFreq_rx,
        	minimum=450e6,
        	maximum=600e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_CenterFreq_rx_sizer)
        _BBGain_rx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._BBGain_rx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_BBGain_rx_sizer,
        	value=self.BBGain_rx,
        	callback=self.set_BBGain_rx,
        	label='BBGain_rx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._BBGain_rx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_BBGain_rx_sizer,
        	value=self.BBGain_rx,
        	callback=self.set_BBGain_rx,
        	minimum=1,
        	maximum=40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_BBGain_rx_sizer)
        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.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'hackrf=2a8068cd' )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(CenterFreq_rx, 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(RFGain_rx, 0)
        self.osmosdr_source_0.set_if_gain(IFGain_rx, 0)
        self.osmosdr_source_0.set_bb_gain(BBGain_rx, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, '192.168.8.100', 56050, 1472, True)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code='',
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        _IFGain_tx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._IFGain_tx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_IFGain_tx_sizer,
        	value=self.IFGain_tx,
        	callback=self.set_IFGain_tx,
        	label='IFGain_tx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._IFGain_tx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_IFGain_tx_sizer,
        	value=self.IFGain_tx,
        	callback=self.set_IFGain_tx,
        	minimum=1,
        	maximum=40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_IFGain_tx_sizer)
        _CenterFreq_tx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._CenterFreq_tx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_CenterFreq_tx_sizer,
        	value=self.CenterFreq_tx,
        	callback=self.set_CenterFreq_tx,
        	label='CenterFreq_tx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._CenterFreq_tx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_CenterFreq_tx_sizer,
        	value=self.CenterFreq_tx,
        	callback=self.set_CenterFreq_tx,
        	minimum=450e6,
        	maximum=600e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_CenterFreq_tx_sizer)
        _BBGain_tx_sizer = wx.BoxSizer(wx.VERTICAL)
        self._BBGain_tx_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_BBGain_tx_sizer,
        	value=self.BBGain_tx,
        	callback=self.set_BBGain_tx,
        	label='BBGain_tx',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._BBGain_tx_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_BBGain_tx_sizer,
        	value=self.BBGain_tx,
        	callback=self.set_BBGain_tx,
        	minimum=1,
        	maximum=40,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_BBGain_tx_sizer)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_udp_sink_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_constellationsink2_0, 0))
Esempio n. 7
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

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

        ##################################################
        # Blocks
        ##################################################
        _amplitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._amplitude_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_amplitude_sizer,
            value=self.amplitude,
            callback=self.set_amplitude,
            label='amplitude',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._amplitude_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_amplitude_sizer,
            value=self.amplitude,
            callback=self.set_amplitude,
            minimum=0,
            maximum=0.6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_amplitude_sizer)
        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.epy_block_0 = epy_block_0.blk(power_param=1.0)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_random_uniform_source_x_0 = analog.random_uniform_source_i(
            0, 4, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, amplitude, 42)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_random_uniform_source_x_0, 0),
                     (self.epy_block_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.epy_block_0, 0), (self.blocks_add_xx_0, 0))
Esempio n. 8
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.decim = decim = 64
        self._config_xlate_offset_config = ConfigParser.ConfigParser()
        self._config_xlate_offset_config.read(".grc_udp_fac")
        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.adc_rate = adc_rate = 64000000
        self.xlate_offset_fine = xlate_offset_fine = 0
        self.xlate_offset = xlate_offset = config_xlate_offset
        self.xlate_decim = xlate_decim = 4
        self.xlate_bandwidth = xlate_bandwidth = 250000
        self.samp_rate = samp_rate = adc_rate / decim
        self._config_xlate_bandwidth_config = ConfigParser.ConfigParser()
        self._config_xlate_bandwidth_config.read(".grc_udp_fac")
        try:
            config_xlate_bandwidth = self._config_xlate_bandwidth_config.getfloat(
                "main", "xlate_bandwidth")
        except:
            config_xlate_bandwidth = 250000
        self.config_xlate_bandwidth = config_xlate_bandwidth
        self.baseband_rate = baseband_rate = 250000

        ##################################################
        # 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), "BB")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook),
                                   "Demod")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Xtra")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "FAC")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook),
                                   "Waterfall")
        self.main_notebook.AddPage(grc_wxgui.Panel(self.main_notebook), "Quad")
        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 BW",
            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=12500,
            maximum=500000,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.main_notebook.GetPage(0).Add(_xlate_bandwidth_sizer)
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(
            ("0.0.0.0", 8080), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        self.xmlrpc_server_0_thread = threading.Thread(
            target=self.xmlrpc_server_0.serve_forever)
        self.xmlrpc_server_0_thread.daemon = True
        self.xmlrpc_server_0_thread.start()
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.main_notebook.GetPage(4).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=50,
            ref_scale=2.0,
            sample_rate=250000,
            fft_size=512,
            fft_rate=25,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
        )
        self.main_notebook.GetPage(4).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0_1 = scopesink2.scope_sink_f(
            self.main_notebook.GetPage(5).GetWin(),
            title="Scope Plot",
            sample_rate=250000,
            v_scale=10,
            v_offset=0,
            t_scale=.001,
            ac_couple=True,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.main_notebook.GetPage(5).Add(self.wxgui_scopesink2_0_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.main_notebook.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=250000,
            v_scale=10,
            v_offset=0,
            t_scale=.001,
            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=250000,
            fft_size=1024,
            fft_rate=30,
            average=True,
            avg_alpha=.25,
            title="FFT Plot",
            peak_hold=False,
        )
        self.main_notebook.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.main_notebook.GetPage(2).GetWin(),
            title="Constellation Plot",
            sample_rate=54000,
            frame_rate=15,
            const_size=2048,
            M=4,
            theta=.785398,
            loop_bw=5 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=18000,
            omega_limit=0.005,
        )
        self.main_notebook.GetPage(2).Add(self.wxgui_constellationsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=54000,
            decimation=250000,
            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.facsink_0 = facsink.fac_sink_c(
            self.main_notebook.GetPage(3).GetWin(),
            title="Fast AutoCorrelation",
            sample_rate=samp_rate,
            baseband_freq=0,
            y_per_div=10,
            ref_level=50,
            fac_size=131072,
            fac_rate=facsink.default_fac_rate,
            average=True,
            avg_alpha=0,
            peak_hold=False,
        )
        self.main_notebook.GetPage(3).Add(self.facsink_0.win)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_short * 1, 2)
        self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex(
            False, False)
        self.baz_udp_source_0 = baz.udp_source(gr.sizeof_short * 2, "0.0.0.0",
                                               28888, 16384, True, True, True,
                                               True)
        self._baseband_rate_static_text = forms.static_text(
            parent=self.GetWin(),
            value=self.baseband_rate,
            callback=self.set_baseband_rate,
            label="BB Rate",
            converter=forms.float_converter(),
        )
        self.Add(self._baseband_rate_static_text)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.wxgui_scopesink2_0_1, 0))
        self.connect((self.baz_udp_source_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_interleaved_short_to_complex_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_interleaved_short_to_complex_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.facsink_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.wxgui_constellationsink2_0, 0))
Esempio n. 9
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM radio FFT example")

        ##################################################
        # Variables
        ##################################################
        self.variable_static_text_0 = variable_static_text_0 = 'RTL R820T'
        self.variable_sample_rate_0 = variable_sample_rate_0 = 1.024E6
        self.RF_Gain = RF_Gain = 13
        self.CF = CF = 106.7e6

        ##################################################
        # Blocks
        ##################################################
        self._variable_sample_rate_0_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.variable_sample_rate_0,
        	callback=self.set_variable_sample_rate_0,
        	label='Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M',
        	converter=forms.float_converter(),
        )
        self.GridAdd(self._variable_sample_rate_0_text_box, 7, 0, 1, 5)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Waterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Scope")
        self.GridAdd(self.notebook_0, 1, 0, 4, 5)
        _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=87.9e6,
        	maximum=107.9e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_CF_sizer, 5, 0, 1, 5)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=CF,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=variable_sample_rate_0,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='Waterfall Plot',
        	size=(575, 600),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
        	self.notebook_0.GetPage(3).GetWin(),
        	title='Scope Plot',
        	sample_rate=variable_sample_rate_0,
        	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_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=CF,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=2048000,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        	size=(575, 600),
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
        	self.notebook_0.GetPage(2).GetWin(),
        	title='Constellation Plot',
        	sample_rate=variable_sample_rate_0,
        	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=variable_sample_rate_0/4.,
        	omega_limit=0.005,
        	size=(575, 600),
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_constellationsink2_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='SDR ',
        	converter=forms.str_converter(),
        )
        self.GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 5)
        self.low_pass_filter_0 = filter.fir_filter_ccf(10, firdes.low_pass(
        	2, 2048000, 100000, 100000, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=204800,
        	audio_decimation=4,
        )
        self.RTL820T = osmosdr.source( args="numchan=" + str(1) + " " + 'driver=rtlsdr,rtl=1' )
        self.RTL820T.set_sample_rate(2048000)
        self.RTL820T.set_center_freq(100, 0)
        self.RTL820T.set_freq_corr(0, 0)
        self.RTL820T.set_dc_offset_mode(1, 0)
        self.RTL820T.set_iq_balance_mode(1, 0)
        self.RTL820T.set_gain_mode(False, 0)
        self.RTL820T.set_gain(10, 0)
        self.RTL820T.set_if_gain(20, 0)
        self.RTL820T.set_bb_gain(20, 0)
        self.RTL820T.set_antenna('', 0)
        self.RTL820T.set_bandwidth(0, 0)
          
        _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=45,
        	num_steps=45,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 6, 0, 1, 5)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.RTL820T, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_constellationsink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.RTL820T, 0), (self.wxgui_waterfallsink2_0, 0))    
        self.connect((self.analog_wfm_rcv_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))    
Esempio n. 10
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.tunefreq = tunefreq = 0
		self.samp_rate = samp_rate = 1000000

		##################################################
		# Notebooks
		##################################################
		self.n0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t1")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t2")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "t3")
		self.Add(self.n0)

		##################################################
		# Controls
		##################################################
		_tunefreq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tunefreq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tunefreq_sizer,
			value=self.tunefreq,
			callback=self.set_tunefreq,
			label="tunefreq",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._tunefreq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tunefreq_sizer,
			value=self.tunefreq,
			callback=self.set_tunefreq,
			minimum=-100,
			maximum=100,
			num_steps=200,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_tunefreq_sizer)

		##################################################
		# Blocks
		##################################################
		self.blks2_dxpsk_demod_0 = blks2.dbpsk_demod(
			samples_per_symbol=2,
			excess_bw=0.35,
			costas_alpha=0.175,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_dxpsk_mod_0 = blks2.dbpsk_mod(
			samples_per_symbol=4,
			excess_bw=0.35,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
			),
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=False,
			),
			payload_length=0,
		)
		self.gr_char_to_float_1 = gr.char_to_float()
		self.gr_sig_source_x_0 = gr.sig_source_f(samp_rate/2/2, gr.GR_SAW_WAVE, 1000, 127, 0)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_char*1, samp_rate/2)
		self.gr_throttle_0_0 = gr.throttle(gr.sizeof_char*1, samp_rate/2)
		self.gr_throttle_2 = gr.throttle(gr.sizeof_float*1, samp_rate/4/4)
		self.gr_throttle_2_0 = gr.throttle(gr.sizeof_float*1, samp_rate/4/4)
		self.wxgui_constellationsink2_1 = constsink_gl.const_sink_c(
			self.GetWin(),
			title="Constellation Plot",
			sample_rate=samp_rate/2*2*8,
			frame_rate=5,
			const_size=2048,
			M=4,
			theta=0,
			alpha=0.005,
			fmax=0.06,
			mu=0.5,
			gain_mu=0.005,
			symbol_rate=samp_rate/2*2*8/4,
			omega_limit=0.005,
		)
		self.Add(self.wxgui_constellationsink2_1.win)
		self.wxgui_scopesink2_1 = scopesink2.scope_sink_f(
			self.n0.GetPage(1).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate/2/2,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
		)
		self.n0.GetPage(1).Add(self.wxgui_scopesink2_1.win)
		self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
			self.n0.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,
		)
		self.n0.GetPage(0).Add(self.wxgui_scopesink2_2.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.blks2_dxpsk_mod_0, 0))
		self.connect((self.blks2_dxpsk_demod_0, 0), (self.gr_throttle_0_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_throttle_0_0, 0), (self.blks2_packet_decoder_0, 0))
		self.connect((self.blks2_packet_decoder_0, 0), (self.gr_throttle_2, 0))
		self.connect((self.gr_throttle_2, 0), (self.wxgui_scopesink2_1, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_2_0, 0))
		self.connect((self.gr_throttle_2_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.blks2_dxpsk_mod_0, 0), (self.blks2_dxpsk_demod_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_char_to_float_1, 0))
		self.connect((self.gr_char_to_float_1, 0), (self.wxgui_scopesink2_2, 0))
		self.connect((self.blks2_dxpsk_mod_0, 0), (self.wxgui_constellationsink2_1, 0))
Esempio n. 11
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Mpsk Stage1")

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 32
        self.excess_bw = excess_bw = 0.35
        self.samp_rate = samp_rate = 32000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            1, sps, 1, excess_bw, 45)
        self.qpsk = qpsk = digital.constellation_rect(([
            0.707 + 0.707j, -0.707 + 0.707j, -0.707 - 0.707j, 0.707 - 0.707j
        ]), ([0, 1, 2, 3]), 4, 2, 2, 1, 1).base()
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            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.fir_filter_xxx_0 = filter.fir_filter_ccc(1, (rrc_taps))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=qpsk,
            differential=True,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=excess_bw,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 256, 10000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0))
Esempio n. 12
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Udp Tx Rx Sim")
        _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 = 2e6

        ##################################################
        # Blocks
        ##################################################
        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_gmsk_mod_0 = digital.gmsk_mod(
        	samples_per_symbol=2,
        	bt=0.35,
        	verbose=False,
        	log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=0.0,
        	frequency_offset=0.0,
        	epsilon=1.0,
        	taps=(1.0, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_char*1, '224.0.0.88', 26363, 1472, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/steve-wang/test.txt', True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/home/steve-wang/rx.txt', False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=1,
        		bits_per_symbol=1,
        		preamble='',
        		access_code='',
        		pad_for_usrp=False,
        	),
        	payload_length=1024,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code='',
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_udp_sink_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.channels_channel_model_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0), (self.wxgui_constellationsink2_0, 0))
Esempio n. 13
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 = 32000
        self.noise_amplitude = noise_amplitude = .01

        ##################################################
        # Blocks
        ##################################################
        _noise_amplitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_amplitude_text_box = forms.text_box(
        	parent=self.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.GetWin(),
        	sizer=_noise_amplitude_sizer,
        	value=self.noise_amplitude,
        	callback=self.set_noise_amplitude,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_noise_amplitude_sizer)
        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/2.,
        	omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_0.win)
        self.tutorial_my_qpsk_demod_cb_0 = tutorial.my_qpsk_demod_cb(True)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=4,
          mod_code="gray",
          differential=True,
          samples_per_symbol=2,
          excess_bw=.35,
          verbose=False,
          log=False,
          )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_head_0 = blocks.head(gr.sizeof_char*1, 100)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "./examples/qpsk_demod_sink.dat", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 4, 10000)), True)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, noise_amplitude, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.analog_random_source_x_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.tutorial_my_qpsk_demod_cb_0, 0))
        self.connect((self.tutorial_my_qpsk_demod_cb_0, 0), (self.blocks_head_0, 0))
Esempio n. 14
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 = 32000
        self.noise_amplitude = noise_amplitude = .01

        ##################################################
        # Blocks
        ##################################################
        _noise_amplitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_amplitude_text_box = forms.text_box(
            parent=self.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.GetWin(),
            sizer=_noise_amplitude_sizer,
            value=self.noise_amplitude,
            callback=self.set_noise_amplitude,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_amplitude_sizer)
        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 / 2.,
            omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_0.win)
        self.tutorial_my_qpsk_demod_cb_0 = tutorial.my_qpsk_demod_cb(True)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=4,
            mod_code="gray",
            differential=True,
            samples_per_symbol=2,
            excess_bw=.35,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_head_0 = blocks.head(gr.sizeof_char * 1, 100)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_char * 1, "./examples/qpsk_demod_sink.dat", False)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 4, 10000)), True)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, noise_amplitude, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_head_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.tutorial_my_qpsk_demod_cb_0, 0))
        self.connect((self.tutorial_my_qpsk_demod_cb_0, 0),
                     (self.blocks_head_0, 0))
Esempio n. 15
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 = 32000

        ##################################################
        # Blocks
        ##################################################
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "tab1")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "tab2")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "tab3")
        self.Add(self.nb)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_f(
            self.nb.GetPage(1).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",
        )
        self.nb.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_fftsink2_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=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.nb.GetPage(2).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.nb.GetPage(0).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.nb.GetPage(0).Add(self.wxgui_constellationsink2_0.win)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            "/home/gareth/tmp/SDRSharp_20160305_114954Z_27619080Hz_IQ.wav",
            True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_throttle_0, 0))
Esempio n. 16
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.rfid = rfid = 13.56e6
        self.subport = subport = rfid / 16
        self.sym_rate = sym_rate = subport / 8
        self.samp_rate = samp_rate = rfid / 8
        self.dec = dec = 4
        self.upconv = upconv = 125e6
        self.samp_per_sym = samp_per_sym = (samp_rate / dec) / (sym_rate)

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title="Constellation Plot",
            sample_rate=samp_rate / dec,
            frame_rate=5,
            const_size=2048,
            M=2,
            theta=0,
            loop_bw=6.28 / 100.0,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=sym_rate,
            omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_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(rfid + upconv + subport, 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(0, 0)
        self.rtlsdr_source_0.set_gain(-2, 0)
        self.rtlsdr_source_0.set_if_gain(-2, 0)
        self.rtlsdr_source_0.set_bb_gain(-2, 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=1,
            decimation=dec,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, subport / 8, 10e3,
                            firdes.WIN_BLACKMAN, 6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate / dec)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(0.15, 0.4, 0)
        self.blocks_probe_signal_x_0 = blocks.probe_signal_f()
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((8, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.low_pass_filter_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_threshold_ff_0, 0),
                     (self.blocks_probe_signal_x_0, 0))
Esempio n. 17
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 = 8*2**10
		self.nsps_mod = nsps_mod = 4
		self.noise = noise = .1
		self.freq_off = freq_off = 0
		self.ebw_mod = ebw_mod = 0.35

		##################################################
		# Notebooks
		##################################################
		self.n0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab1")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab2")
		self.n0.AddPage(grc_wxgui.Panel(self.n0), "tab3")
		self.Add(self.n0)

		##################################################
		# Controls
		##################################################
		_nsps_mod_sizer = wx.BoxSizer(wx.VERTICAL)
		self._nsps_mod_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_nsps_mod_sizer,
			value=self.nsps_mod,
			callback=self.set_nsps_mod,
			label="Samples per symbol for DPSK modulator",
			converter=forms.int_converter(),
			proportion=0,
		)
		self._nsps_mod_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_nsps_mod_sizer,
			value=self.nsps_mod,
			callback=self.set_nsps_mod,
			minimum=2,
			maximum=32,
			num_steps=31,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_nsps_mod_sizer)
		_noise_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			label="Noise",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_sizer)
		_freq_off_sizer = wx.BoxSizer(wx.VERTICAL)
		self._freq_off_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_freq_off_sizer,
			value=self.freq_off,
			callback=self.set_freq_off,
			label="Freq Offset",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._freq_off_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_freq_off_sizer,
			value=self.freq_off,
			callback=self.set_freq_off,
			minimum=-.5,
			maximum=.5,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_freq_off_sizer)
		_ebw_mod_sizer = wx.BoxSizer(wx.VERTICAL)
		self._ebw_mod_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_ebw_mod_sizer,
			value=self.ebw_mod,
			callback=self.set_ebw_mod,
			label="Excess BW for DPSK modulator",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._ebw_mod_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_ebw_mod_sizer,
			value=self.ebw_mod,
			callback=self.set_ebw_mod,
			minimum=00.01,
			maximum=10.00,
			num_steps=10*100-1,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_ebw_mod_sizer)

		##################################################
		# Blocks
		##################################################
		self.blks2_dxpsk2_mod_0 = blks2.dqpsk2_mod(
			samples_per_symbol=nsps_mod,
			excess_bw=ebw_mod,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
				samples_per_symbol=1,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 1e-2, 1.0, 1.0, 1e3)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=noise,
			frequency_offset=freq_off,
			epsilon=1.0,
			taps=(16.0, ),
			noise_seed=42,
		)
		self.gr_throttle_1_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate*nsps_mod*8)
		self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
		self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
			self.n0.GetPage(1).GetWin(),
			title="Constellation Plot",
			sample_rate=samp_rate*8*nsps_mod/2,
			frame_rate=5,
			const_size=512,
			M=4,
			theta=0,
			alpha=0.005,
			fmax=0.5,
			mu=0.5,
			gain_mu=0.005,
			symbol_rate=samp_rate*8/2,
			omega_limit=0.005,
		)
		self.n0.GetPage(1).Add(self.wxgui_constellationsink2_0.win)

		##################################################
		# Connections
		##################################################
		self.connect((self.blks2_packet_encoder_0, 0), (self.blks2_dxpsk2_mod_0, 0))
		self.connect((self.random_source_x_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_throttle_1_0, 0), (self.wxgui_constellationsink2_0, 0))
		self.connect((self.blks2_dxpsk2_mod_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_throttle_1_0, 0))
Esempio n. 18
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="MPSK Demod Demo")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samps_per_sym = samps_per_sym = 4
        self.samp_rate = samp_rate = 32000
        self.noise = noise = 0.1
        self.freq_on = freq_on = 0

        ##################################################
        # Blocks
        ##################################################
        _noise_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_noise_sizer,
        	value=self.noise,
        	callback=self.set_noise,
        	label='Noise',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._noise_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_noise_sizer,
        	value=self.noise,
        	callback=self.set_noise,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_noise_sizer)
        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), "FFT")
        self.Add(self.nb)
        _freq_on_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_on_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_on_sizer,
        	value=self.freq_on,
        	callback=self.set_freq_on,
        	label='freq_on',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_on_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_on_sizer,
        	value=self.freq_on,
        	callback=self.set_freq_on,
        	minimum=-0.5,
        	maximum=0.5,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_on_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=32000,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        	win=window.blackmanharris,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	title='Constellation Plot',
        	sample_rate=samp_rate,
        	frame_rate=5,
        	const_size=1024,
        	M=4,
        	theta=0,
        	loop_bw=0.030,
        	fmax=0.06,
        	mu=0.5,
        	gain_mu=0.005,
        	symbol_rate=samp_rate/4.,
        	omega_limit=0.005,
        )
        self.nb.GetPage(0).Add(self.wxgui_constellationsink2_0.win)
        self.digital_constellation_8psk_sptr = digital.dbpsk_mod(
        	samples_per_symbol=4,
        	excess_bw=0.35,
        	mod_code="gray",
        	verbose=False,
        	log=True)

        self.channels_channel_model_0 = channels.channel_model(
        	noise_voltage=noise,
        	frequency_offset=freq_on,
        	epsilon=1.0,
        	taps=(1.0 + 1.0j, ),
        	noise_seed=0,
        	block_tags=False
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2**8, 10000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_8psk_sptr, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.channels_channel_model_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.digital_constellation_8psk_sptr, 0), (self.channels_channel_model_0, 0))
Esempio n. 19
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 = 2e6

        ##################################################
        # Blocks
        ##################################################
        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.limesdr_source_0 = limesdr.source('0009081C05C10C24', 0, '')
        self.limesdr_source_0.set_sample_rate(samp_rate)
        self.limesdr_source_0.set_center_freq(500e6, 0)
        self.limesdr_source_0.set_bandwidth(5e6, 0)
        self.limesdr_source_0.set_gain(30, 0)
        self.limesdr_source_0.set_antenna(2, 0)
        self.limesdr_source_0.calibrate(5e6, 0)

        self.limesdr_sink_0 = limesdr.sink('0009081C05C10C24', 0, '', '')
        self.limesdr_sink_0.set_sample_rate(samp_rate)
        self.limesdr_sink_0.set_center_freq(520e6, 0)
        self.limesdr_sink_0.set_bandwidth(5e6, 0)
        self.limesdr_sink_0.set_gain(30, 0)
        self.limesdr_sink_0.set_antenna(1, 0)
        self.limesdr_sink_0.calibrate(5e6, 0)

        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_char * 1,
                                                     '192.168.8.100', 10000,
                                                     1472, True)
        self.blocks_udp_sink_1 = blocks.udp_sink(gr.sizeof_char * 1,
                                                 '192.168.8.100', 10000, 1472,
                                                 True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, ))
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=2,
                preamble='',
                access_code='',
                pad_for_usrp=False,
            ),
            payload_length=30,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(
            grc_blks2.packet_decoder(
                access_code='',
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_udp_sink_1, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.limesdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blks2_packet_encoder_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.limesdr_source_0, 0),
                     (self.digital_gmsk_demod_0, 0))
Esempio n. 20
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM radio FFT example")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.variable_static_text_0 = variable_static_text_0 = 'RTL R820T'
        self.variable_sample_rate_0 = variable_sample_rate_0 = 1.024E6
        self.RF_Gain = RF_Gain = 13
        self.CF = CF = 106.7e6

        ##################################################
        # Blocks
        ##################################################
        self._variable_sample_rate_0_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.variable_sample_rate_0,
            callback=self.set_variable_sample_rate_0,
            label=
            "Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._variable_sample_rate_0_text_box, 7, 0, 1, 5)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Waterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Scope")
        self.GridAdd(self.notebook_0, 1, 0, 4, 5)
        _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=45,
            num_steps=45,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 6, 0, 1, 5)
        _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=87.9e6,
            maximum=107.9e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_CF_sizer, 5, 0, 1, 5)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=CF,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=variable_sample_rate_0,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
            size=(575, 600),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=variable_sample_rate_0,
            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_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=CF,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=variable_sample_rate_0,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
            size=(575, 600),
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Constellation Plot",
            sample_rate=variable_sample_rate_0,
            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=variable_sample_rate_0 / 4.,
            omega_limit=0.005,
            size=(575, 600),
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_constellationsink2_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="SDR ",
            converter=forms.str_converter(),
        )
        self.GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 5)
        self.RTL820T = osmosdr.source(args="numchan=" + str(1) + " " + "")
        self.RTL820T.set_sample_rate(variable_sample_rate_0)
        self.RTL820T.set_center_freq(CF, 0)
        self.RTL820T.set_freq_corr(0, 0)
        self.RTL820T.set_dc_offset_mode(0, 0)
        self.RTL820T.set_iq_balance_mode(0, 0)
        self.RTL820T.set_gain_mode(False, 0)
        self.RTL820T.set_gain(RF_Gain, 0)
        self.RTL820T.set_if_gain(20, 0)
        self.RTL820T.set_bb_gain(20, 0)
        self.RTL820T.set_antenna("", 0)
        self.RTL820T.set_bandwidth(0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.RTL820T, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_fftsink2_0, 0))
Esempio n. 21
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Gmsk Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.target_freq = target_freq = 871.75e6
        self.channel_wigth = channel_wigth = 2e6
        self.samp_rate = samp_rate = 10e6
        self.center_freq = center_freq = target_freq - channel_wigth

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title="Constellation Plot",
            sample_rate=samp_rate / 2,
            frame_rate=20,
            const_size=1024,
            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.osmosdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                               "")
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(
            2,
            firdes.low_pass(1, samp_rate, 1e6, 1.5e6, firdes.WIN_HAMMING,
                            6.76))
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_float * 1, "/home/twilight/GMSK_test/test_data_in.txt",
            False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -channel_wigth, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_packet_decoder_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_gmsk_demod_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
Esempio n. 22
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Tx Module Test")
        _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 = 16
        self.nfilts = nfilts = 32
        self.taps_0 = taps_0 = [1.0, 0.25 - 0.25j, 0.50 + 0.10j, -0.3 + 0.2j]
        self.taps = taps = [
            1.0 + 0.0j,
        ]
        self.samp_rate_0 = samp_rate_0 = 10e3
        self.samp_rate = samp_rate = 44100
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), 0.35, 11 * sps * nfilts)
        self.qpsk = qpsk = digital.constellation_rect(
            ([1 + 1j, -1 + 1j, -1 - 1j, 1 - 1j]), ([0, 1, 2, 3]), 4, 2, 2, 1,
            1).base()
        self.excess_bw = excess_bw = 0.35
        self.center_freq = center_freq = 5e3
        self.arity = arity = 4

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title='Constellation Plot',
            sample_rate=samp_rate,
            frame_rate=10,
            const_size=2048 / 4,
            M=4,
            theta=0,
            loop_bw=5e-3,
            fmax=0.06,
            mu=0.5,
            gain_mu=0.005,
            symbol_rate=samp_rate / sps * 1.0,
            omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_0.win)
        self.digital_constellation_modulator_0 = digital.generic_mod(
            constellation=qpsk,
            differential=False,
            samples_per_symbol=sps,
            pre_diff_code=True,
            excess_bw=excess_bw,
            verbose=True,
            log=False,
        )
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            '/home/peterzhu/Desktop/acoustic_radio/Testings/output.wav', 1,
            44100, 8)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char * 1, 2e4, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff(
            (0.8, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/home/peterzhu/Desktop/acoustic_radio/Testings/test_input.txt',
            True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(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_SIN_WAVE, center_freq, -1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, center_freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.blocks_wavfile_sink_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_throttle_0, 0),
                     (self.digital_constellation_modulator_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.digital_constellation_modulator_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
Esempio n. 23
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.variable_slider_2 = variable_slider_2 = 0
        self.variable_slider_0 = variable_slider_0 = 50000
        self.samp_rate = samp_rate = 32000

        ##################################################
        # Blocks
        ##################################################
        _variable_slider_2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_2_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_variable_slider_2_sizer,
            value=self.variable_slider_2,
            callback=self.set_variable_slider_2,
            label="label_variable_slider_0 NOise amplitude",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._variable_slider_2_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_variable_slider_2_sizer,
            value=self.variable_slider_2,
            callback=self.set_variable_slider_2,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_2_sizer)
        _variable_slider_0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._variable_slider_0_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_variable_slider_0_sizer,
            value=self.variable_slider_0,
            callback=self.set_variable_slider_0,
            label="label_variable_slider_MULITIPLICACION_VOZ",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._variable_slider_0_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_variable_slider_0_sizer,
            value=self.variable_slider_0,
            callback=self.set_variable_slider_0,
            minimum=0,
            maximum=1e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_variable_slider_0_sizer)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title="Constellation Plot",
            sample_rate=samp_rate,
            frame_rate=256,
            const_size=4,
            M=2,
            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.vocoder_g723_40_encode_sb_0 = vocoder.g723_40_encode_sb()
        self.digital_qam_mod_0 = digital.qam.qam_mod(
            constellation_points=4,
            mod_code="gray",
            differential=True,
            samples_per_symbol=256,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (variable_slider_0, ))
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, variable_slider_2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.vocoder_g723_40_encode_sb_0, 0))
        self.connect((self.audio_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.vocoder_g723_40_encode_sb_0, 0),
                     (self.digital_qam_mod_0, 0))
        self.connect((self.digital_qam_mod_0, 0), (self.blocks_add_xx_0, 0))
Esempio n. 24
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))
Esempio n. 25
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Gmsk Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.target_freq = target_freq = 871.75e6
        self.channel_wigth = channel_wigth = 2e6
        self.samp_rate = samp_rate = 10e6
        self.center_freq = center_freq = target_freq-channel_wigth

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
        	self.GetWin(),
        	title="Constellation Plot",
        	sample_rate=samp_rate/2,
        	frame_rate=20,
        	const_size=1024,
        	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.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna("", 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)
          
        self.low_pass_filter_0 = filter.fir_filter_ccf(2, firdes.low_pass(
        	1, samp_rate, 1e6, 1.5e6, firdes.WIN_HAMMING, 6.76))
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=2,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.005,
        	freq_error=0.0,
        	verbose=False,
        	log=False,
        )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, "/home/twilight/GMSK_test/test_data_in.txt", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -channel_wigth, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.digital_gmsk_demod_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_constellationsink2_0, 0))    
        self.connect((self.osmosdr_source_0, 0), (self.blocks_multiply_xx_0, 0))    
Esempio n. 26
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="QPSK Transmitter")
        _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 = 5e6
        self.gain = gain = 30
        self.freq = freq = 2.421e9
        self.constellation_size = constellation_size = 2048

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.GetWin(),
            title='Constellation Plot',
            sample_rate=samp_rate,
            frame_rate=5,
            const_size=constellation_size,
            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_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=4,
            mod_code="gray",
            differential=True,
            samples_per_symbol=2,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.5, ))
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 255, 10000000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Esempio n. 27
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block Mfsk")
        _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 = 44100

        ##################################################
        # Blocks
        ##################################################
        self.notebook_2 = self.notebook_2 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_2.AddPage(grc_wxgui.Panel(self.notebook_2), "FFT")
        self.notebook_2.AddPage(grc_wxgui.Panel(self.notebook_2), "SCOPE")
        self.Add(self.notebook_2)
        self.notebook_1 = self.notebook_1 = wx.Notebook(
            self.notebook_2.GetPage(0).GetWin(), style=wx.NB_TOP)
        self.notebook_1.AddPage(grc_wxgui.Panel(self.notebook_1), "fftSource")
        self.notebook_1.AddPage(grc_wxgui.Panel(self.notebook_1),
                                "fftDemodulated")
        self.notebook_2.GetPage(0).Add(self.notebook_1)
        self.notebook_0 = self.notebook_0 = wx.Notebook(
            self.notebook_2.GetPage(1).GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "ScopeRx")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "ScopeSource")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "ScopeConstellation")
        self.notebook_2.GetPage(1).Add(self.notebook_0)
        self.wxgui_scopesink2_1 = 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=True,
            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_1.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(0).GetWin(),
            title="Scope Plot - Source - Modulated - Demodulated",
            sample_rate=samp_rate,
            v_scale=4,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=3,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook_1.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 Source",
            peak_hold=False,
        )
        self.notebook_1.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.notebook_1.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=30,
            ref_scale=4,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot Demodulated",
            peak_hold=False,
        )
        self.notebook_1.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Constellation Plot Modulated",
            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_0.GetPage(2).Add(self.wxgui_constellationsink2_0_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Constellation Plot Demodulated",
            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_0.GetPage(3).Add(self.wxgui_constellationsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, 8000, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_vector_source_x_0_0_0_2 = blocks.vector_source_b(
            (1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0), True, 1, [])
        self.blocks_vector_source_x_0_0_0_1 = blocks.vector_source_b(
            (1, 1), True, 1, [])
        self.blocks_vector_source_x_0_0_0_0 = blocks.vector_source_b(
            (1, 0), True, 1, [])
        self.blocks_vector_source_x_0_0_0 = blocks.vector_source_b((0, 1),
                                                                   True, 1, [])
        self.blocks_vector_source_x_0_0 = blocks.vector_source_b((0, 0), True,
                                                                 1, [])
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_sub_xx_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0 = blocks.sub_cc(1)
        self.blocks_repeat_0_2 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_1_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_1 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char * 1, 100)
        self.blocks_multiply_xx_0_1_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1)
        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_vcc((-1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, ))
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_2 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_1_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_2 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0_1_0 = blocks.char_to_float(1, 1)
        self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 2)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 2)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.analog_sig_source_x_0_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 100, 1, 0)
        self.analog_sig_source_x_0_0_0_2 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 50, 1, 0)
        self.analog_sig_source_x_0_0_0_1_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate, 1, 0)
        self.analog_sig_source_x_0_0_0_1_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 10, 1, 0)
        self.analog_sig_source_x_0_0_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, samp_rate / 25, 1, 0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(-100)
        self.analog_const_source_x_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 3)
        self.analog_const_source_x_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.analog_const_source_x_0_0, 0),
                     (self.blocks_sub_xx_1, 1))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1, 0),
                     (self.blocks_multiply_xx_0_1_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.analog_sig_source_x_0_0_0_1_1, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0_2, 0),
                     (self.blocks_multiply_xx_0_1_0, 0))
        self.connect((self.analog_sig_source_x_0_0_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.wxgui_constellationsink2_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.blocks_char_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_char_to_float_0_1, 0),
                     (self.blocks_float_to_complex_0_1, 0))
        self.connect((self.blocks_char_to_float_0_1_0, 0),
                     (self.blocks_float_to_complex_0_1_0, 0))
        self.connect((self.blocks_char_to_float_0_1_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_char_to_float_0_2, 0),
                     (self.blocks_float_to_complex_0_2, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_char_to_float_1, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.wxgui_scopesink2_0, 2))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.blocks_multiply_xx_0_1_0, 1))
        self.connect((self.blocks_float_to_complex_0_1, 0),
                     (self.blocks_multiply_xx_0_1_0_0, 1))
        self.connect((self.blocks_float_to_complex_0_1_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0_2, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.wxgui_constellationsink2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_sub_xx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.blocks_add_xx_0, 4))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_xx_0_1_0, 0),
                     (self.blocks_add_xx_0, 3))
        self.connect((self.blocks_multiply_xx_0_1_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_repeat_0, 0),
                     (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_repeat_0_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_repeat_0_1, 0),
                     (self.blocks_char_to_float_0_1, 0))
        self.connect((self.blocks_repeat_0_1_0, 0),
                     (self.blocks_char_to_float_0_1_0, 0))
        self.connect((self.blocks_repeat_0_2, 0),
                     (self.blocks_char_to_float_0_2, 0))
        self.connect((self.blocks_sub_xx_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_sub_xx_1, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_vector_source_x_0_0, 0),
                     (self.blocks_repeat_0, 0))
        self.connect((self.blocks_vector_source_x_0_0_0, 0),
                     (self.blocks_repeat_0_1, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_0, 0),
                     (self.blocks_repeat_0_2, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_1, 0),
                     (self.blocks_repeat_0_0, 0))
        self.connect((self.blocks_vector_source_x_0_0_0_2, 0),
                     (self.blocks_repeat_0_1_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_char_to_float_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))
Esempio n. 28
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))
Esempio n. 29
0
    def __init__(self, samp_rate=1e6, freq=2.45e9, gain=0, freq_offset=0, address="addr=192.168.10.3"):
        grc_wxgui.top_block_gui.__init__(self, title="UHD RX DPSK")

        ##################################################
        # Parameters
        ##################################################
        self.samp_rate = samp_rate
        self.freq = freq
        self.gain = gain
        self.freq_offset = freq_offset
        self.address = address

        ##################################################
        # Variables
        ##################################################
        self.tun_gain = tun_gain = gain
        self.tun_freq = tun_freq = freq
        self.timing_bw = timing_bw = 6.28/100.0
        self.samps_per_sym = samps_per_sym = 4
        self.rx_freq_off = rx_freq_off = freq_offset
        self.phase_bw = phase_bw = 6.28/100.0

        ##################################################
        # Blocks
        ##################################################
        _tun_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tun_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tun_gain_sizer,
        	value=self.tun_gain,
        	callback=self.set_tun_gain,
        	label="UHD Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tun_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tun_gain_sizer,
        	value=self.tun_gain,
        	callback=self.set_tun_gain,
        	minimum=0,
        	maximum=20,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tun_gain_sizer)
        _tun_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tun_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tun_freq_sizer,
        	value=self.tun_freq,
        	callback=self.set_tun_freq,
        	label="Freq (Hz)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tun_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tun_freq_sizer,
        	value=self.tun_freq,
        	callback=self.set_tun_freq,
        	minimum=2.4e9,
        	maximum=2.5e9,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tun_freq_sizer)
        _timing_bw_sizer = wx.BoxSizer(wx.VERTICAL)
        self._timing_bw_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_timing_bw_sizer,
        	value=self.timing_bw,
        	callback=self.set_timing_bw,
        	label="Timing Loop BW",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._timing_bw_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_timing_bw_sizer,
        	value=self.timing_bw,
        	callback=self.set_timing_bw,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_timing_bw_sizer)
        _rx_freq_off_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rx_freq_off_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_rx_freq_off_sizer,
        	value=self.rx_freq_off,
        	callback=self.set_rx_freq_off,
        	label="RX Freq Offset (Hz)",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._rx_freq_off_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_rx_freq_off_sizer,
        	value=self.rx_freq_off,
        	callback=self.set_rx_freq_off,
        	minimum=-100e3,
        	maximum=+100e3,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_rx_freq_off_sizer)
        _phase_bw_sizer = wx.BoxSizer(wx.VERTICAL)
        self._phase_bw_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_phase_bw_sizer,
        	value=self.phase_bw,
        	callback=self.set_phase_bw,
        	label="Phase Loop BW",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._phase_bw_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_phase_bw_sizer,
        	value=self.phase_bw,
        	callback=self.set_phase_bw,
        	minimum=0,
        	maximum=1.0,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_phase_bw_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=tun_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=10,
        	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_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/samps_per_sym,
        	omega_limit=0.005,
        )
        self.Add(self.wxgui_constellationsink2_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join((address, "")),
        	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(tun_freq+rx_freq_off, 0)
        self.uhd_usrp_source_0.set_gain(tun_gain, 0)
        self.digital_dxpsk_demod_0 = digital.dqpsk_demod(
        	samples_per_symbol=samps_per_sym,
        	excess_bw=0.35,
        	freq_bw=6.28/100.0,
        	phase_bw=6.28/100.0,
        	timing_bw=6.28/100.0,
        	mod_code="gray",
        	verbose=False,
        	log=False
        )
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_dxpsk_demod_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.digital_dxpsk_demod_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0))
Esempio n. 30
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="FM radio FFT example")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 0.2
        self.variable_static_text_0 = variable_static_text_0 = 'RTL R820T'
        self.variable_sample_rate_0 = variable_sample_rate_0 = 2.048E6
        self.transition = transition = 1e6
        self.quadrature = quadrature = 500e3
        self.cutoff = cutoff = 100e3
        self.audio_dec = audio_dec = 10
        self.RF_Gain = RF_Gain = 30
        self.CF = CF = 107.3e6

        ##################################################
        # 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=0.2,
            maximum=1,
            num_steps=4,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self._variable_sample_rate_0_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.variable_sample_rate_0,
            callback=self.set_variable_sample_rate_0,
            label=
            "Sample Rate: 1.024M, 1.4M, 1.8M, 1.92M, 2.048M, 2.4M & 2. 56M",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._variable_sample_rate_0_text_box, 7, 0, 1, 5)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Spectrum")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Waterfall")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0),
                                "Constellation")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "Scope")
        self.GridAdd(self.notebook_0, 1, 0, 4, 5)
        _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=45,
            num_steps=45,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_RF_Gain_sizer, 6, 0, 1, 5)
        _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=87.9e6,
            maximum=107.9e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_CF_sizer, 5, 0, 1, 5)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=CF,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=variable_sample_rate_0,
            fft_size=5120,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
            size=(575, 600),
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0.win)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=variable_sample_rate_0,
            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_0.GetPage(3).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=CF,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=variable_sample_rate_0,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
            size=(575, 600),
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.wxgui_constellationsink2_0 = constsink_gl.const_sink_c(
            self.notebook_0.GetPage(2).GetWin(),
            title="Constellation Plot",
            sample_rate=variable_sample_rate_0,
            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=variable_sample_rate_0 / 4.,
            omega_limit=0.005,
            size=(575, 600),
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_constellationsink2_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="SDR ",
            converter=forms.str_converter(),
        )
        self.GridAdd(self._variable_static_text_0_static_text, 0, 0, 1, 5)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=int(variable_sample_rate_0 / quadrature),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=int(quadrature / 1e3 / audio_dec),
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, variable_sample_rate_0, cutoff, transition,
                            firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=quadrature,
            audio_decimation=audio_dec,
        )
        self.RTL820T = osmosdr.source(args="numchan=" + str(1) + " " +
                                      "hackrf=1")
        self.RTL820T.set_sample_rate(variable_sample_rate_0)
        self.RTL820T.set_center_freq(CF, 0)
        self.RTL820T.set_freq_corr(0, 0)
        self.RTL820T.set_dc_offset_mode(0, 0)
        self.RTL820T.set_iq_balance_mode(0, 0)
        self.RTL820T.set_gain_mode(False, 0)
        self.RTL820T.set_gain(RF_Gain, 0)
        self.RTL820T.set_if_gain(20, 0)
        self.RTL820T.set_bb_gain(20, 0)
        self.RTL820T.set_antenna("", 0)
        self.RTL820T.set_bandwidth(0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.RTL820T, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_constellationsink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_scopesink2_0, 0))
        self.connect((self.RTL820T, 0), (self.wxgui_waterfallsink2_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.low_pass_filter_0, 0))