Esempio n. 1
0
	def set_usrp_rate(self, usrp_rate):
		self.usrp_rate = usrp_rate
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.usrp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_1.set_taps(firdes.band_pass(1, self.usrp_rate, 23e3, 53e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.gr_sig_source_x_0.set_sampling_freq(self.usrp_rate)
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.usrp_rate)
Esempio n. 2
0
 def set_st_gain(self, st_gain):
     self.st_gain = st_gain
     self._st_gain_slider.set_value(self.st_gain)
     self._st_gain_text_box.set_value(self.st_gain)
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(self.st_gain, self.mpx_rate, 23000, 53000, 2000,
                          firdes.WIN_HAMMING, 6.76))
 def set_pass_high(self, pass_high):
     self.pass_high = pass_high
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76
         )
     )
Esempio n. 4
0
	def set_srate(self, srate):
		self.srate = srate
		self.single_pole_iir_filter_xx_0.set_taps(1.0/((self.srate/10)*self.integ))
		self.blocks_keep_one_in_n_0.set_n(int(self.srate/20))
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.srate, 200e3, 24e3, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.srate)
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.srate/5, self.bp_low, self.bp_high, 24e3, firdes.WIN_HAMMING, 6.76))
Esempio n. 5
0
 def set_usrp_rate(self, usrp_rate):
     self.usrp_rate = usrp_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.usrp_rate, 54e3, 60e3, 3e3,
                          firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_1.set_taps(
         firdes.band_pass(1, self.usrp_rate, 23e3, 53e3, 2e3,
                          firdes.WIN_HAMMING, 6.76))
     self.gr_sig_source_x_0.set_sampling_freq(self.usrp_rate)
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING,
                         6.76))
     self.low_pass_filter_0_0.set_taps(
         firdes.low_pass(1, self.usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING,
                         6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.usrp_rate)
Esempio n. 6
0
 def set_mpx_rate(self, mpx_rate):
     self.mpx_rate = mpx_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(self.st_gain, self.mpx_rate, 23000, 53000, 2000,
                          firdes.WIN_HAMMING, 6.76))
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(self.Mono_gain, self.mpx_rate, 15000, 2000,
                         firdes.WIN_HAMMING, 6.76))
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76))
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76
         )
     )
Esempio n. 8
0
 def set_bandpass_transition_width(self, bandpass_transition_width):
     self.bandpass_transition_width = bandpass_transition_width
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate,
                          self.freq_offset - self.bandpass_bandwidth / 2,
                          self.freq_offset + self.bandpass_bandwidth / 2,
                          self.bandpass_transition_width,
                          firdes.WIN_HAMMING, 6.76))
Esempio n. 9
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate,
                          self.freq_offset - self.bandpass_bandwidth / 2,
                          self.freq_offset + self.bandpass_bandwidth / 2,
                          self.bandpass_transition_width,
                          firdes.WIN_HAMMING, 6.76))
     self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
Esempio n. 10
0
 def set_freq_offset(self, freq_offset):
     self.freq_offset = freq_offset
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate,
                          self.freq_offset - self.bandpass_bandwidth / 2,
                          self.freq_offset + self.bandpass_bandwidth / 2,
                          self.bandpass_transition_width,
                          firdes.WIN_HAMMING, 6.76))
     self.uhd_usrp_source_0.set_center_freq(915000000 - self.freq_offset, 0)
Esempio n. 11
0
 def set_beat(self, beat):
     self.beat = beat
     self._beat_slider.set_value(self.beat)
     self._beat_text_box.set_value(self.beat)
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate / 10, (self.beat * 1000) - 100,
                          (self.beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                          6.76))
     self.analog_sig_source_x_0.set_frequency(122e3 - (self.beat * 1000))
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING, 6.76))
		self.blocks_throttle_0.set_sample_rate(self.samp_rate)
		self.blocks_keep_one_in_n_0.set_n(int(self.samp_rate/20))
		self.single_pole_iir_filter_xx_0.set_taps(1.0/((self.samp_rate/10)*self.integ))
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate/10, (self.beat*1000)-100, (self.beat*1000)+100, 50, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate/10)
		self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
		self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
Esempio n. 13
0
 def __init__(self, samprate=48000, cutoff_low=300, cutoff_high=3000, 
     transit=100):
 #   ------------------------------------------------------------------------
     super(BandpassAdapter, self).__init__()
     self.filter = gr.fir_filter_fff(1, firdes.band_pass(
         1, samprate, cutoff_low, cutoff_high, transit, firdes.WIN_HAMMING, 
         6.76))
     self.samprate = samprate
     self.cutoff_low = cutoff_low
     self.cutoff_high = cutoff_high
     self.transit = transit
	def __init__(self):
		gr.top_block.__init__(self, "CW/SSB Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.pass_trans = pass_trans = 600
		self.pass_low = pass_low = 300
		self.pass_high = pass_high = 1200
		self.freq = freq = 144800000
		self.af_gain = af_gain = 5
		self.sat_file_name = sat_file_name = "Undefined"

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((af_gain, ))
		self.gr_complex_to_real_0 = gr.complex_to_real(1)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 20.8e-6, 0.3, 1.0, 0.0)
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-10)
		    
		self.band_pass_filter_0 = gr.fir_filter_ccf(2, firdes.band_pass(
			1, samp_rate, pass_low, pass_high, pass_trans, firdes.WIN_HAMMING, 6.76))
		self.audio_sink = audio.sink(48000, "", True)

		self.wavfile_sink = gr.wavfile_sink(self.sat_file_name, 1, 11025, 16)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=11025,
			decimation=48000,
			taps=None,
			fractional_bw=None,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
		self.connect((self.xlating_fir_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_complex_to_real_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_complex_to_real_0, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 1))
		self.connect((self.gr_complex_to_real_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.wavfile_sink, 0))
Esempio n. 15
0
 def ProcessCommand(self, command):
 #   ------------------------------------------------------------------------
     if command[0] == "cutoff-low":
         self.cutoff_low = int(command[1])
     if command[0] == "cutoff-high":
         self.cutoff_high = int(command[1])
     if command[0] == "transit":
         self.transit = int(command[1])
     self.filter.set_taps(
         firdes.band_pass(
             1, self.samprate, self.cutoff_low, self.cutoff_high, 
             self.transit, firdes.WIN_HAMMING, 6.76))
     
Esempio n. 16
0
 def set_bandpass_transition_width(self, bandpass_transition_width):
     self.bandpass_transition_width = bandpass_transition_width
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1,
             self.samp_rate,
             self.freq_offset - self.bandpass_bandwidth / 2,
             self.freq_offset + self.bandpass_bandwidth / 2,
             self.bandpass_transition_width,
             firdes.WIN_HAMMING,
             6.76,
         )
     )
Esempio n. 17
0
 def set_freq_offset(self, freq_offset):
     self.freq_offset = freq_offset
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1,
             self.samp_rate,
             self.freq_offset - self.bandpass_bandwidth / 2,
             self.freq_offset + self.bandpass_bandwidth / 2,
             self.bandpass_transition_width,
             firdes.WIN_HAMMING,
             6.76,
         )
     )
     self.uhd_usrp_source_0.set_center_freq(915000000 - self.freq_offset, 0)
Esempio n. 18
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(
             1,
             self.samp_rate,
             self.freq_offset - self.bandpass_bandwidth / 2,
             self.freq_offset + self.bandpass_bandwidth / 2,
             self.bandpass_transition_width,
             firdes.WIN_HAMMING,
             6.76,
         )
     )
     self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
Esempio n. 19
0
 def set_samp_rate(self, samp_rate):
     self.samp_rate = samp_rate
     self.low_pass_filter_0.set_taps(
         firdes.low_pass(1, self.samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING,
                         6.76))
     self.blocks_throttle_0.set_sample_rate(self.samp_rate)
     self.blocks_keep_one_in_n_0.set_n(int(self.samp_rate / 20))
     self.single_pole_iir_filter_xx_0.set_taps(
         1.0 / ((self.samp_rate / 10) * self.integ))
     self.band_pass_filter_0.set_taps(
         firdes.band_pass(1, self.samp_rate / 10, (self.beat * 1000) - 100,
                          (self.beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                          6.76))
     self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate / 10)
     self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)
     self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
Esempio n. 20
0
	def __init__(self):
		gr.top_block.__init__(self, "CW/SSB Receiver")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 96000
		self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76)
		self.sql_lev = sql_lev = -100
		self.rf_gain = rf_gain = 20
		self.pass_trans = pass_trans = 600
		self.pass_low = pass_low = 300
		self.pass_high = pass_high = 1200
		self.freq = freq = 144800000
		self.af_gain = af_gain = 5

		##################################################
		# Blocks
		##################################################
		self.xlating_fir_filter = gr.freq_xlating_fir_filter_ccc(1, (xlate_filter_taps), 0, samp_rate)
		self.gr_simple_squelch_cc_0 = gr.simple_squelch_cc(sql_lev, 1)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((af_gain, ))
		self.gr_complex_to_real_0 = gr.complex_to_real(1)
		self.gr_agc2_xx_0 = gr.agc2_cc(1e-1, 20.8e-6, 0.3, 1.0, 0.0)
		self.fcd_source_c_1 = fcd.source_c("hw:1")
		self.fcd_source_c_1.set_freq(freq)
		self.fcd_source_c_1.set_freq_corr(-10)
		    
		self.band_pass_filter_0 = gr.fir_filter_ccf(2, firdes.band_pass(
			1, samp_rate, pass_low, pass_high, pass_trans, firdes.WIN_HAMMING, 6.76))
		self.audio_sink = audio.sink(48000, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.fcd_source_c_1, 0), (self.xlating_fir_filter, 0))
		self.connect((self.xlating_fir_filter, 0), (self.gr_simple_squelch_cc_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_agc2_xx_0, 0))
		self.connect((self.gr_complex_to_real_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_agc2_xx_0, 0), (self.gr_complex_to_real_0, 0))
		self.connect((self.gr_simple_squelch_cc_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.audio_sink, 1))
Esempio n. 21
0
	def set_asrate(self, asrate):
		self.asrate = asrate
		self.gr_single_pole_iir_filter_xx_0.set_taps(1.0/(self.asrate/3))
		self.gr_keep_one_in_n_0.set_n(int(self.asrate/3))
		self.gr_fractional_interpolator_xx_0.set_interp_ratio(self.asrate/self.farate)
		self.gr_fft_filter_xxx_1.set_taps((firdes.low_pass(self.tone_low/10.0,self.asrate,1.2e3,500,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_1_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_1_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,15.0e3,5.0e3,firdes.WIN_HAMMING)))
		self.band_pass_filter_2_0.set_taps(firdes.band_pass(20, self.asrate, 17.5e3, 17.9e3, 250, firdes.WIN_HAMMING, 6.76))
		self.gr_fractional_interpolator_xx_0_0.set_interp_ratio(self.asrate/self.farate)
		self.band_pass_filter_2.set_taps(firdes.band_pass(10, self.asrate, 18.8e3, 19.2e3, 350, firdes.WIN_HAMMING, 6.76))
		self.wxgui_fftsink2_0.set_sample_rate(self.asrate)
		self.gr_fft_filter_xxx_0.set_taps((firdes.low_pass(self.tone_low/10.0,self.asrate,1.2e3,500,firdes.WIN_HAMMING)))
		self.gr_fft_filter_xxx_0_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,13.5e3,3.5e3,firdes.WIN_HAMMING)))
		self.low_pass_filter_0.set_taps(firdes.low_pass(3, self.asrate, 10e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_1.set_taps(firdes.low_pass(3, self.asrate/5, 1e3, 200, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_2.set_taps(firdes.low_pass(3, self.asrate/50, 100, 30, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_3.set_taps(firdes.low_pass(3, self.asrate/500, 10, 3, firdes.WIN_HAMMING, 6.76))
		self.gr_single_pole_iir_filter_xx_1.set_taps(2.5/(self.asrate/500))
		self.gr_fft_filter_xxx_0_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
		self.band_pass_filter_0_0.set_taps(firdes.band_pass(1, self.asrate, 38e3-(15e3), 38e3+(15e3), 4.0e3, firdes.WIN_HAMMING, 6.76))
Esempio n. 22
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Rds Tx")
        _icon_path = "/home/azimout/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.usrp_interp = usrp_interp = 500
        self.dac_rate = dac_rate = 128e6
        self.wav_rate = wav_rate = 44100
        self.usrp_rate = usrp_rate = int(dac_rate / usrp_interp)
        self.fm_max_dev = fm_max_dev = 120e3

        ##################################################
        # Blocks
        ##################################################
        self.band_pass_filter_0 = gr.interp_fir_filter_fff(
            1,
            firdes.band_pass(1, usrp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING,
                             6.76))
        self.band_pass_filter_1 = gr.interp_fir_filter_fff(
            1,
            firdes.band_pass(1, usrp_rate, 23e3, 53e3, 2e3, firdes.WIN_HAMMING,
                             6.76))
        self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
            interpolation=usrp_rate,
            decimation=wav_rate,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_1_0 = blks2.rational_resampler_fff(
            interpolation=usrp_rate,
            decimation=wav_rate,
            taps=None,
            fractional_bw=None,
        )
        self.gr_add_xx_0 = gr.add_vff(1)
        self.gr_add_xx_1 = gr.add_vff(1)
        self.gr_char_to_float_0 = gr.char_to_float()
        self.gr_diff_encoder_bb_0 = gr.diff_encoder_bb(2)
        self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(
            2 * math.pi * fm_max_dev / usrp_rate)
        self.gr_map_bb_0 = gr.map_bb(([-1, 1]))
        self.gr_map_bb_1 = gr.map_bb(([1, 2]))
        self.gr_multiply_xx_0 = gr.multiply_vff(1)
        self.gr_multiply_xx_1 = gr.multiply_vff(1)
        self.gr_rds_data_encoder_0 = rds.data_encoder(
            "/media/dimitris/mywork/gr/dimitris/rds/trunk/src/test/rds_data.xml"
        )
        self.gr_rds_rate_enforcer_0 = rds.rate_enforcer(256000)
        self.gr_sig_source_x_0 = gr.sig_source_f(usrp_rate, gr.GR_COS_WAVE,
                                                 19e3, 0.3, 0)
        self.gr_sub_xx_0 = gr.sub_ff(1)
        self.gr_unpack_k_bits_bb_0 = gr.unpack_k_bits_bb(2)
        self.gr_wavfile_source_0 = gr.wavfile_source(
            "/media/dimitris/mywork/gr/dimitris/rds/trunk/src/python/limmenso_stereo.wav",
            True)
        self.low_pass_filter_0 = gr.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_0_0 = gr.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
        self.usrp_simple_sink_x_0 = grc_usrp.simple_sink_c(which=0, side="A")
        self.usrp_simple_sink_x_0.set_interp_rate(500)
        self.usrp_simple_sink_x_0.set_frequency(107.2e6, verbose=True)
        self.usrp_simple_sink_x_0.set_gain(0)
        self.usrp_simple_sink_x_0.set_enable(True)
        self.usrp_simple_sink_x_0.set_auto_tr(True)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=20,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=usrp_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)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_sig_source_x_0, 0),
                     (self.gr_rds_rate_enforcer_0, 1))
        self.connect((self.gr_char_to_float_0, 0),
                     (self.gr_rds_rate_enforcer_0, 0))
        self.connect((self.gr_map_bb_0, 0), (self.gr_char_to_float_0, 0))
        self.connect((self.gr_frequency_modulator_fc_0, 0),
                     (self.usrp_simple_sink_x_0, 0))
        self.connect((self.gr_add_xx_1, 0),
                     (self.gr_frequency_modulator_fc_0, 0))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_add_xx_1, 1))
        self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_1, 2))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 1))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 0))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 3))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 2))
        self.connect((self.blks2_rational_resampler_xxx_1_0, 0),
                     (self.gr_add_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_add_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1_0, 0),
                     (self.gr_sub_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_sub_xx_0, 0))
        self.connect((self.gr_wavfile_source_0, 1),
                     (self.blks2_rational_resampler_xxx_1_0, 0))
        self.connect((self.gr_wavfile_source_0, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.gr_rds_data_encoder_0, 0),
                     (self.gr_diff_encoder_bb_0, 0))
        self.connect((self.gr_diff_encoder_bb_0, 0), (self.gr_map_bb_1, 0))
        self.connect((self.gr_map_bb_1, 0), (self.gr_unpack_k_bits_bb_0, 0))
        self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_map_bb_0, 0))
        self.connect((self.gr_rds_rate_enforcer_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 0))
        self.connect((self.gr_multiply_xx_1, 0), (self.band_pass_filter_1, 0))
        self.connect((self.band_pass_filter_1, 0), (self.gr_add_xx_1, 3))
        self.connect((self.gr_add_xx_1, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.gr_add_xx_1, 2))
Esempio n. 23
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Rds Tx")
		_icon_path = "/home/azimout/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.usrp_interp = usrp_interp = 500
		self.dac_rate = dac_rate = 128e6
		self.wav_rate = wav_rate = 44100
		self.usrp_rate = usrp_rate = int(dac_rate/usrp_interp)
		self.fm_max_dev = fm_max_dev = 120e3

		##################################################
		# Blocks
		##################################################
		self.band_pass_filter_0 = gr.interp_fir_filter_fff(1, firdes.band_pass(
			1, usrp_rate, 54e3, 60e3, 3e3, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_1 = gr.interp_fir_filter_fff(1, firdes.band_pass(
			1, usrp_rate, 23e3, 53e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
			interpolation=usrp_rate,
			decimation=wav_rate,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_1_0 = blks2.rational_resampler_fff(
			interpolation=usrp_rate,
			decimation=wav_rate,
			taps=None,
			fractional_bw=None,
		)
		self.gr_add_xx_0 = gr.add_vff(1)
		self.gr_add_xx_1 = gr.add_vff(1)
		self.gr_char_to_float_0 = gr.char_to_float()
		self.gr_diff_encoder_bb_0 = gr.diff_encoder_bb(2)
		self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*fm_max_dev/usrp_rate)
		self.gr_map_bb_0 = gr.map_bb(([-1,1]))
		self.gr_map_bb_1 = gr.map_bb(([1,2]))
		self.gr_multiply_xx_0 = gr.multiply_vff(1)
		self.gr_multiply_xx_1 = gr.multiply_vff(1)
		self.gr_rds_data_encoder_0 = rds.data_encoder("/media/dimitris/mywork/gr/dimitris/rds/trunk/src/test/rds_data.xml")
		self.gr_rds_rate_enforcer_0 = rds.rate_enforcer(256000)
		self.gr_sig_source_x_0 = gr.sig_source_f(usrp_rate, gr.GR_COS_WAVE, 19e3, 0.3, 0)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_unpack_k_bits_bb_0 = gr.unpack_k_bits_bb(2)
		self.gr_wavfile_source_0 = gr.wavfile_source("/media/dimitris/mywork/gr/dimitris/rds/trunk/src/python/limmenso_stereo.wav", True)
		self.low_pass_filter_0 = gr.interp_fir_filter_fff(1, firdes.low_pass(
			1, usrp_rate, 1.5e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0_0 = gr.interp_fir_filter_fff(1, firdes.low_pass(
			1, usrp_rate, 15e3, 2e3, firdes.WIN_HAMMING, 6.76))
		self.usrp_simple_sink_x_0 = grc_usrp.simple_sink_c(which=0, side="A")
		self.usrp_simple_sink_x_0.set_interp_rate(500)
		self.usrp_simple_sink_x_0.set_frequency(107.2e6, verbose=True)
		self.usrp_simple_sink_x_0.set_gain(0)
		self.usrp_simple_sink_x_0.set_enable(True)
		self.usrp_simple_sink_x_0.set_auto_tr(True)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=20,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=usrp_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)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_rds_rate_enforcer_0, 1))
		self.connect((self.gr_char_to_float_0, 0), (self.gr_rds_rate_enforcer_0, 0))
		self.connect((self.gr_map_bb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_frequency_modulator_fc_0, 0), (self.usrp_simple_sink_x_0, 0))
		self.connect((self.gr_add_xx_1, 0), (self.gr_frequency_modulator_fc_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_add_xx_1, 1))
		self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_1, 2))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_1, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 3))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 2))
		self.connect((self.blks2_rational_resampler_xxx_1_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_add_xx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_1_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.gr_wavfile_source_0, 1), (self.blks2_rational_resampler_xxx_1_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
		self.connect((self.gr_rds_data_encoder_0, 0), (self.gr_diff_encoder_bb_0, 0))
		self.connect((self.gr_diff_encoder_bb_0, 0), (self.gr_map_bb_1, 0))
		self.connect((self.gr_map_bb_1, 0), (self.gr_unpack_k_bits_bb_0, 0))
		self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_map_bb_0, 0))
		self.connect((self.gr_rds_rate_enforcer_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 0))
		self.connect((self.gr_multiply_xx_1, 0), (self.band_pass_filter_1, 0))
		self.connect((self.band_pass_filter_1, 0), (self.gr_add_xx_1, 3))
		self.connect((self.gr_add_xx_1, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0_0, 0))
		self.connect((self.low_pass_filter_0_0, 0), (self.gr_add_xx_1, 2))
Esempio n. 24
0
	def __init__(self, ppm=30, srate=2.4e6, fftsize=8192):
		grc_wxgui.top_block_gui.__init__(self, title="Tp Modes")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

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

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

		##################################################
		# Connections
		##################################################
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_scopesink2_0_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_file_sink_1, 0))
		self.connect((self.rtl2832_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
Esempio n. 25
0
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Fm Stereo Tx")

		##################################################
		# Variables
		##################################################
		self.st_gain = st_gain = 10
		self.samp_rate = samp_rate = 195.312e3
		self.pilot_gain = pilot_gain = 80e-3
		self.mpx_rate = mpx_rate = 160e3
		self.Mono_gain = Mono_gain = 300e-3
		self.FM_freq = FM_freq = 96.5e6

		##################################################
		# Blocks
		##################################################
		_st_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._st_gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_st_gain_sizer,
			value=self.st_gain,
			callback=self.set_st_gain,
			label='st_gain',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._st_gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_st_gain_sizer,
			value=self.st_gain,
			callback=self.set_st_gain,
			minimum=0,
			maximum=100,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_st_gain_sizer)
		_pilot_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._pilot_gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_pilot_gain_sizer,
			value=self.pilot_gain,
			callback=self.set_pilot_gain,
			label='pilot_gain',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._pilot_gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_pilot_gain_sizer,
			value=self.pilot_gain,
			callback=self.set_pilot_gain,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_pilot_gain_sizer)
		self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FM")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "audio")
		self.Add(self.notebook_0)
		_Mono_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._Mono_gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_Mono_gain_sizer,
			value=self.Mono_gain,
			callback=self.set_Mono_gain,
			label='Mono_gain',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._Mono_gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_Mono_gain_sizer,
			value=self.Mono_gain,
			callback=self.set_Mono_gain,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_Mono_gain_sizer)
		_FM_freq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._FM_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_FM_freq_sizer,
			value=self.FM_freq,
			callback=self.set_FM_freq,
			label='FM_freq',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._FM_freq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_FM_freq_sizer,
			value=self.FM_freq,
			callback=self.set_FM_freq,
			minimum=88e6,
			maximum=108e6,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_FM_freq_sizer)
		self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
			self.notebook_0.GetPage(1).GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.notebook_0.GetPage(0).GetWin(),
			baseband_freq=FM_freq,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=15,
			average=False,
			avg_alpha=None,
			title="FFT Plot",
			peak_hold=False,
		)
		self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
		self.uhd_usrp_sink_0 = uhd.usrp_sink(
			device_addr="addr=192.168.10.2",
			stream_args=uhd.stream_args(
				cpu_format="fc32",
				channels=range(1),
			),
		)
		self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
		self.uhd_usrp_sink_0.set_center_freq(FM_freq, 0)
		self.uhd_usrp_sink_0.set_gain(0, 0)
		self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
		self.low_pass_filter_0 = gr.fir_filter_fff(1, firdes.low_pass(
			Mono_gain, mpx_rate, 15000, 2000, firdes.WIN_HAMMING, 6.76))
		self.gr_vector_to_streams_0 = gr.vector_to_streams(gr.sizeof_short*1, 2)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_sig_source_x_1 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 19000, pilot_gain, 0)
		self.gr_sig_source_x_0 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 38000, 30e-3, 0)
		self.gr_short_to_float_1 = gr.short_to_float(1, 1)
		self.gr_short_to_float_0 = gr.short_to_float(1, 1)
		self.gr_multiply_xx_0 = gr.multiply_vff(1)
		self.gr_multiply_const_vxx_2 = gr.multiply_const_vcc((32.768e3, ))
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((30e-6, ))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((30e-6, ))
		self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(980e-3)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_short*2, "/home/kranthi/Documents/project/FM Transceiver/FM Transmitter/test.raw", True)
		self.gr_add_xx_1 = gr.add_vff(1)
		self.gr_add_xx_0 = gr.add_vff(1)
		self.blks2_rational_resampler_xxx_2 = blks2.rational_resampler_fff(
			interpolation=4,
			decimation=1,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
			interpolation=5,
			decimation=1,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=5,
			decimation=1,
			taps=None,
			fractional_bw=None,
		)
		self.blks2_fm_preemph_0 = blks2.fm_preemph(fs=mpx_rate, tau=50e-6)
		self.band_pass_filter_0 = gr.fir_filter_fff(1, firdes.band_pass(
			st_gain, mpx_rate, 23000, 53000, 2000, firdes.WIN_HAMMING, 6.76))

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_vector_to_streams_0, 0))
		self.connect((self.gr_vector_to_streams_0, 0), (self.gr_short_to_float_0, 0))
		self.connect((self.gr_vector_to_streams_0, 1), (self.gr_short_to_float_1, 0))
		self.connect((self.gr_short_to_float_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_short_to_float_1, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.blks2_rational_resampler_xxx_1, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.gr_sig_source_x_1, 0), (self.gr_add_xx_1, 0))
		self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 1))
		self.connect((self.low_pass_filter_0, 0), (self.gr_add_xx_1, 2))
		self.connect((self.gr_add_xx_1, 0), (self.blks2_fm_preemph_0, 0))
		self.connect((self.blks2_fm_preemph_0, 0), (self.blks2_rational_resampler_xxx_2, 0))
		self.connect((self.blks2_rational_resampler_xxx_2, 0), (self.gr_frequency_modulator_fc_0, 0))
		self.connect((self.gr_frequency_modulator_fc_0, 0), (self.gr_multiply_const_vxx_2, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.uhd_usrp_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.wxgui_fftsink2_1, 0))
Esempio n. 26
0
	def set_st_gain(self, st_gain):
		self.st_gain = st_gain
		self._st_gain_slider.set_value(self.st_gain)
		self._st_gain_text_box.set_value(self.st_gain)
		self.band_pass_filter_0.set_taps(firdes.band_pass(self.st_gain, self.mpx_rate, 23000, 53000, 2000, firdes.WIN_HAMMING, 6.76))
Esempio n. 27
0
	def set_mpx_rate(self, mpx_rate):
		self.mpx_rate = mpx_rate
		self.band_pass_filter_0.set_taps(firdes.band_pass(self.st_gain, self.mpx_rate, 23000, 53000, 2000, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0.set_taps(firdes.low_pass(self.Mono_gain, self.mpx_rate, 15000, 2000, firdes.WIN_HAMMING, 6.76))
Esempio n. 28
0
	def set_bp_low(self, bp_low):
		self.bp_low = bp_low
		self.set_bp_high(self.bp_low+self.bp_width)
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.srate/5, self.bp_low, self.bp_high, 24e3, firdes.WIN_HAMMING, 6.76))
		self._bp_low_slider.set_value(self.bp_low)
		self._bp_low_text_box.set_value(self.bp_low)
Esempio n. 29
0
	def set_samp_rate(self, samp_rate):
		self.samp_rate = samp_rate
		self.set_xlate_filter_taps(firdes.low_pass(1, self.samp_rate, 48000, 5000, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76))
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Intensity Interferometer")
		_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 = 250e3
		self.magnitude = magnitude = 0.05
		self.integ = integ = 1
		self.beat = beat = 1

		##################################################
		# Blocks
		##################################################
		_magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
		self._magnitude_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_magnitude_sizer,
			value=self.magnitude,
			callback=self.set_magnitude,
			label="Magnitude",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._magnitude_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_magnitude_sizer,
			value=self.magnitude,
			callback=self.set_magnitude,
			minimum=0.05,
			maximum=0.5,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_magnitude_sizer)
		_integ_sizer = wx.BoxSizer(wx.VERTICAL)
		self._integ_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			label="Integration Time (Sec)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._integ_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_integ_sizer,
			value=self.integ,
			callback=self.set_integ,
			minimum=1,
			maximum=30,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_integ_sizer)
		_beat_sizer = wx.BoxSizer(wx.VERTICAL)
		self._beat_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_beat_sizer,
			value=self.beat,
			callback=self.set_beat,
			label="Beat Frequency (kHz)",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._beat_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_beat_sizer,
			value=self.beat,
			callback=self.set_beat,
			minimum=1,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_beat_sizer)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.GetWin(),
			title="2nd detector power level",
			sample_rate=2,
			v_scale=0,
			v_offset=0,
			t_scale=450,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_STRIPCHART,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=samp_rate/10,
			fft_size=1024,
			fft_rate=8,
			average=True,
			avg_alpha=0.1,
			title="First Detector Spectrum",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/((samp_rate/10)*integ), 1)
		self.low_pass_filter_0 = gr.fir_filter_fff(int(samp_rate/25e3), firdes.low_pass(
			1, samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING, 6.76))
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate)
		self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
		self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, int(samp_rate/20))
		self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
		self.blocks_add_xx_0 = blocks.add_vcc(1)
		self.band_pass_filter_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, samp_rate/10, (beat*1000)-100, (beat*1000)+100, 50, firdes.WIN_HAMMING, 6.76))
		self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 122e3, magnitude, 0)
		self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 122e3-(beat*1000), magnitude, 0)
		self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.2, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 2))
		self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_add_xx_0, 1))
		self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 0))
		self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 0))
		self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_xx_0, 1))
		self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.blocks_multiply_xx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
Esempio n. 31
0
    def __init__(self,
                 agc_max=100,
                 agc_decay=0.1,
                 freq_offset=1000000,
                 outfile="datafifo",
                 bandpass_bandwidth=20,
                 threshold_buffer=0.25,
                 threshold_center=0.5,
                 agc_attack=0.1,
                 bandpass_transition_width=1000000):
        gr.top_block.__init__(self, "Collect")

        ##################################################
        # Parameters
        ##################################################
        self.agc_max = agc_max
        self.agc_decay = agc_decay
        self.freq_offset = freq_offset
        self.outfile = outfile
        self.bandpass_bandwidth = bandpass_bandwidth
        self.threshold_buffer = threshold_buffer
        self.threshold_center = threshold_center
        self.agc_attack = agc_attack
        self.bandpass_transition_width = bandpass_transition_width

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 64000000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="",
            io_type=uhd.io_type.COMPLEX_FLOAT32,
            num_channels=1,
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(915000000 - freq_offset, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.gr_threshold_ff_0 = gr.threshold_ff(
            threshold_center - threshold_buffer,
            threshold_center + threshold_buffer, 0)
        self.gr_map_bb_0 = gr.map_bb(([48, 49]))
        self.gr_float_to_char_0 = gr.float_to_char()
        self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char * 1, outfile)
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
        self.gr_agc2_xx_0_0 = gr.agc2_cc(agc_attack, agc_decay, 1.0, 1.0,
                                         agc_max)
        self.band_pass_filter_0 = gr.fir_filter_ccf(
            1,
            firdes.band_pass(1, samp_rate,
                             freq_offset - bandpass_bandwidth / 2,
                             freq_offset + bandpass_bandwidth / 2,
                             bandpass_transition_width, firdes.WIN_HAMMING,
                             6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_float_to_char_0, 0), (self.gr_map_bb_0, 0))
        self.connect((self.gr_map_bb_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.gr_agc2_xx_0_0, 0))
        self.connect((self.gr_agc2_xx_0_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.gr_threshold_ff_0, 0), (self.gr_float_to_char_0, 0))
        self.connect((self.gr_complex_to_mag_0, 0),
                     (self.gr_threshold_ff_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.gr_complex_to_mag_0, 0))
Esempio n. 32
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fm Stereo Tx")

        ##################################################
        # Variables
        ##################################################
        self.st_gain = st_gain = 10
        self.samp_rate = samp_rate = 195.312e3
        self.pilot_gain = pilot_gain = 80e-3
        self.mpx_rate = mpx_rate = 160e3
        self.Mono_gain = Mono_gain = 300e-3
        self.FM_freq = FM_freq = 96.5e6

        ##################################################
        # Blocks
        ##################################################
        _st_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._st_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_st_gain_sizer,
            value=self.st_gain,
            callback=self.set_st_gain,
            label='st_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._st_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_st_gain_sizer,
            value=self.st_gain,
            callback=self.set_st_gain,
            minimum=0,
            maximum=100,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_st_gain_sizer)
        _pilot_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._pilot_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            label='pilot_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._pilot_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_pilot_gain_sizer,
            value=self.pilot_gain,
            callback=self.set_pilot_gain,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_pilot_gain_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(),
                                                        style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "FM")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "audio")
        self.Add(self.notebook_0)
        _Mono_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._Mono_gain_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_Mono_gain_sizer,
            value=self.Mono_gain,
            callback=self.set_Mono_gain,
            label='Mono_gain',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._Mono_gain_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_Mono_gain_sizer,
            value=self.Mono_gain,
            callback=self.set_Mono_gain,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_Mono_gain_sizer)
        _FM_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._FM_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_FM_freq_sizer,
            value=self.FM_freq,
            callback=self.set_FM_freq,
            label='FM_freq',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._FM_freq_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_FM_freq_sizer,
            value=self.FM_freq,
            callback=self.set_FM_freq,
            minimum=88e6,
            maximum=108e6,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_FM_freq_sizer)
        self.wxgui_fftsink2_1 = fftsink2.fft_sink_f(
            self.notebook_0.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_fftsink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.notebook_0.GetPage(0).GetWin(),
            baseband_freq=FM_freq,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(FM_freq, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.low_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.low_pass(Mono_gain, mpx_rate, 15000, 2000,
                            firdes.WIN_HAMMING, 6.76))
        self.gr_vector_to_streams_0 = gr.vector_to_streams(
            gr.sizeof_short * 1, 2)
        self.gr_sub_xx_0 = gr.sub_ff(1)
        self.gr_sig_source_x_1 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 19000,
                                                 pilot_gain, 0)
        self.gr_sig_source_x_0 = gr.sig_source_f(160000, gr.GR_SIN_WAVE, 38000,
                                                 30e-3, 0)
        self.gr_short_to_float_1 = gr.short_to_float(1, 1)
        self.gr_short_to_float_0 = gr.short_to_float(1, 1)
        self.gr_multiply_xx_0 = gr.multiply_vff(1)
        self.gr_multiply_const_vxx_2 = gr.multiply_const_vcc((32.768e3, ))
        self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((30e-6, ))
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((30e-6, ))
        self.gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(980e-3)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_short * 2,
            "/home/kranthi/Documents/project/FM Transceiver/FM Transmitter/test.raw",
            True)
        self.gr_add_xx_1 = gr.add_vff(1)
        self.gr_add_xx_0 = gr.add_vff(1)
        self.blks2_rational_resampler_xxx_2 = blks2.rational_resampler_fff(
            interpolation=4,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_1 = blks2.rational_resampler_fff(
            interpolation=5,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=5,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.blks2_fm_preemph_0 = blks2.fm_preemph(fs=mpx_rate, tau=50e-6)
        self.band_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.band_pass(st_gain, mpx_rate, 23000, 53000, 2000,
                             firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0),
                     (self.gr_vector_to_streams_0, 0))
        self.connect((self.gr_vector_to_streams_0, 0),
                     (self.gr_short_to_float_0, 0))
        self.connect((self.gr_vector_to_streams_0, 1),
                     (self.gr_short_to_float_1, 0))
        self.connect((self.gr_short_to_float_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_short_to_float_1, 0),
                     (self.gr_multiply_const_vxx_1, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.gr_multiply_const_vxx_1, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.gr_add_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.gr_sub_xx_0, 1))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_sub_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.gr_add_xx_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.gr_sig_source_x_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.gr_multiply_xx_0, 1))
        self.connect((self.gr_multiply_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.gr_sig_source_x_1, 0), (self.gr_add_xx_1, 0))
        self.connect((self.band_pass_filter_0, 0), (self.gr_add_xx_1, 1))
        self.connect((self.low_pass_filter_0, 0), (self.gr_add_xx_1, 2))
        self.connect((self.gr_add_xx_1, 0), (self.blks2_fm_preemph_0, 0))
        self.connect((self.blks2_fm_preemph_0, 0),
                     (self.blks2_rational_resampler_xxx_2, 0))
        self.connect((self.blks2_rational_resampler_xxx_2, 0),
                     (self.gr_frequency_modulator_fc_0, 0))
        self.connect((self.gr_frequency_modulator_fc_0, 0),
                     (self.gr_multiply_const_vxx_2, 0))
        self.connect((self.gr_multiply_const_vxx_2, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.gr_multiply_const_vxx_2, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_multiply_const_vxx_1, 0),
                     (self.wxgui_fftsink2_1, 0))
Esempio n. 33
0
    def __init__(
        self,
        agc_max=100,
        agc_decay=0.1,
        freq_offset=1000000,
        outfile="datafifo",
        bandpass_bandwidth=20,
        threshold_buffer=0.25,
        threshold_center=0.5,
        agc_attack=0.1,
        bandpass_transition_width=1000000,
    ):
        gr.top_block.__init__(self, "Collect")

        ##################################################
        # Parameters
        ##################################################
        self.agc_max = agc_max
        self.agc_decay = agc_decay
        self.freq_offset = freq_offset
        self.outfile = outfile
        self.bandpass_bandwidth = bandpass_bandwidth
        self.threshold_buffer = threshold_buffer
        self.threshold_center = threshold_center
        self.agc_attack = agc_attack
        self.bandpass_transition_width = bandpass_transition_width

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 64000000

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(device_addr="", io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=1)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(915000000 - freq_offset, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.gr_threshold_ff_0 = gr.threshold_ff(
            threshold_center - threshold_buffer, threshold_center + threshold_buffer, 0
        )
        self.gr_map_bb_0 = gr.map_bb(([48, 49]))
        self.gr_float_to_char_0 = gr.float_to_char()
        self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char * 1, outfile)
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_complex_to_mag_0 = gr.complex_to_mag(1)
        self.gr_agc2_xx_0_0 = gr.agc2_cc(agc_attack, agc_decay, 1.0, 1.0, agc_max)
        self.band_pass_filter_0 = gr.fir_filter_ccf(
            1,
            firdes.band_pass(
                1,
                samp_rate,
                freq_offset - bandpass_bandwidth / 2,
                freq_offset + bandpass_bandwidth / 2,
                bandpass_transition_width,
                firdes.WIN_HAMMING,
                6.76,
            ),
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_float_to_char_0, 0), (self.gr_map_bb_0, 0))
        self.connect((self.gr_map_bb_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.gr_agc2_xx_0_0, 0))
        self.connect((self.gr_agc2_xx_0_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.gr_threshold_ff_0, 0), (self.gr_float_to_char_0, 0))
        self.connect((self.gr_complex_to_mag_0, 0), (self.gr_threshold_ff_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.gr_complex_to_mag_0, 0))
Esempio n. 34
0
	def set_pass_high(self, pass_high):
		self.pass_high = pass_high
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, self.pass_low, self.pass_high, self.pass_trans, firdes.WIN_HAMMING, 6.76))
Esempio n. 35
0
	def __init__(self, devid="type=b100", rdsfile="rds_fifo", gain=35.0, freq=101.1e6, xmlport=13777, arate=int(48e3), mute=-15.0, ftune=0, ant="J1", subdev="A:0", ahw="pulse", deemph=75.0e-6, prenames='["UWRF","89.3","950","WEVR"]', prefreqs="[88.715e6,89.3e6,950.735e6,106.317e6]", volume=1.0):
		grc_wxgui.top_block_gui.__init__(self, title="Simple FM (Stereo) Receiver")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.devid = devid
		self.rdsfile = rdsfile
		self.gain = gain
		self.freq = freq
		self.xmlport = xmlport
		self.arate = arate
		self.mute = mute
		self.ftune = ftune
		self.ant = ant
		self.subdev = subdev
		self.ahw = ahw
		self.deemph = deemph
		self.prenames = prenames
		self.prefreqs = prefreqs
		self.volume = volume

		##################################################
		# Variables
		##################################################
		self.pthresh = pthresh = 350
		self.preselect = preselect = eval(prefreqs)[0]
		self.pilot_level = pilot_level = 0
		self.ifreq = ifreq = freq
		self.stpilotdet = stpilotdet = True if (pilot_level > pthresh) else False
		self.stereo = stereo = True
		self.rf_pwr_lvl = rf_pwr_lvl = 0
		self.cur_freq = cur_freq = simple_fm_helper.freq_select(ifreq,preselect)
		self.vol = vol = volume
		self.variable_static_text_0 = variable_static_text_0 = 10.0*math.log(rf_pwr_lvl+1.0e-11)/math.log(10)
		self.tone_med = tone_med = 5
		self.tone_low = tone_low = 5
		self.tone_high = tone_high = 5
		self.stereo_0 = stereo_0 = stpilotdet
		self.st_enabled = st_enabled = 1 if (stereo == True and pilot_level > pthresh) else 0
		self.squelch_probe = squelch_probe = 0
		self.sq_thresh = sq_thresh = mute
		self.samp_rate = samp_rate = 250e3
		self.rtext_0 = rtext_0 = cur_freq
		self.record = record = False
		self.rdsrate = rdsrate = 25e3
		self.osmo_taps = osmo_taps = firdes.low_pass(1.0,1.00e6,95e3,20e3,firdes.WIN_HAMMING,6.76)
		self.mod_reset = mod_reset = 0
		self.igain = igain = gain
		self.fine = fine = ftune
		self.farate = farate = arate
		self.dm = dm = deemph
		self.discrim_dc = discrim_dc = 0
		self.capture_file = capture_file = "capture.wav"
		self.asrate = asrate = 125e3

		##################################################
		# Blocks
		##################################################
		_sq_thresh_sizer = wx.BoxSizer(wx.VERTICAL)
		self._sq_thresh_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_sq_thresh_sizer,
			value=self.sq_thresh,
			callback=self.set_sq_thresh,
			label="Mute Level",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._sq_thresh_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_sq_thresh_sizer,
			value=self.sq_thresh,
			callback=self.set_sq_thresh,
			minimum=-30.0,
			maximum=-5.0,
			num_steps=40,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_sq_thresh_sizer, 1, 5, 1, 1)
		self.input_power = gr.probe_avg_mag_sqrd_c(sq_thresh, 1.0/(samp_rate/10))
		self.dc_level = gr.probe_signal_f()
		_vol_sizer = wx.BoxSizer(wx.VERTICAL)
		self._vol_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			label="Volume",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._vol_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_vol_sizer,
			value=self.vol,
			callback=self.set_vol,
			minimum=0,
			maximum=11,
			num_steps=110,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_vol_sizer, 0, 3, 1, 1)
		_tone_med_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_med_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_med_sizer,
			value=self.tone_med,
			callback=self.set_tone_med,
			label="1Khz-4Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_med_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_med_sizer,
			value=self.tone_med,
			callback=self.set_tone_med,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_med_sizer, 1, 3, 1, 1)
		_tone_low_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_low_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_low_sizer,
			value=self.tone_low,
			callback=self.set_tone_low,
			label="0-1Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_low_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_low_sizer,
			value=self.tone_low,
			callback=self.set_tone_low,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_low_sizer, 1, 2, 1, 1)
		_tone_high_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tone_high_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tone_high_sizer,
			value=self.tone_high,
			callback=self.set_tone_high,
			label="4Khz-15Khz",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tone_high_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tone_high_sizer,
			value=self.tone_high,
			callback=self.set_tone_high,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_tone_high_sizer, 1, 4, 1, 1)
		def _squelch_probe_probe():
			while True:
				val = self.input_power.unmuted()
				try: self.set_squelch_probe(val)
				except AttributeError, e: pass
				time.sleep(1.0/(10))
		_squelch_probe_thread = threading.Thread(target=_squelch_probe_probe)
		_squelch_probe_thread.daemon = True
		_squelch_probe_thread.start()
		self._record_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.record,
			callback=self.set_record,
			label="Record Audio",
			true=True,
			false=False,
		)
		self.GridAdd(self._record_check_box, 2, 2, 1, 1)
		self.pilot_probe = gr.probe_signal_f()
		_fine_sizer = wx.BoxSizer(wx.VERTICAL)
		self._fine_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_fine_sizer,
			value=self.fine,
			callback=self.set_fine,
			label="Fine Tuning",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._fine_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_fine_sizer,
			value=self.fine,
			callback=self.set_fine,
			minimum=-50.0e3,
			maximum=50.e03,
			num_steps=400,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_fine_sizer, 1, 0, 1, 1)
		def _discrim_dc_probe():
			while True:
				val = self.dc_level.level()
				try: self.set_discrim_dc(val)
				except AttributeError, e: pass
				time.sleep(1.0/(2.5))
		_discrim_dc_thread = threading.Thread(target=_discrim_dc_probe)
		_discrim_dc_thread.daemon = True
		_discrim_dc_thread.start()
		self._capture_file_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.capture_file,
			callback=self.set_capture_file,
			label="Record Filename",
			converter=forms.str_converter(),
		)
		self.GridAdd(self._capture_file_text_box, 2, 0, 1, 2)
		self.Main = self.Main = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
		self.Main.AddPage(grc_wxgui.Panel(self.Main), "L/R")
		self.Main.AddPage(grc_wxgui.Panel(self.Main), "FM Demod Spectrum")
		self.Add(self.Main)
		self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
			self.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.Add(self.wxgui_waterfallsink2_0.win)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
			self.Main.GetPage(0).GetWin(),
			title="Audio Channels (L and R)",
			sample_rate=farate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Rel. Audio Level",
		)
		self.Main.GetPage(0).Add(self.wxgui_scopesink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
			self.Main.GetPage(1).GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=asrate,
			fft_size=1024,
			fft_rate=6,
			average=True,
			avg_alpha=0.1,
			title="FM Demod Spectrum",
			peak_hold=False,
		)
		self.Main.GetPage(1).Add(self.wxgui_fftsink2_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="RF Power ",
			converter=forms.float_converter(formatter=lambda x: "%4.1f" % x),
		)
		self.GridAdd(self._variable_static_text_0_static_text, 0, 2, 1, 1)
		self._stereo_0_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.stereo_0,
			callback=self.set_stereo_0,
			label="Stereo Detect",
			true=True,
			false=False,
		)
		self.GridAdd(self._stereo_0_check_box, 2, 5, 1, 1)
		self._stereo_check_box = forms.check_box(
			parent=self.GetWin(),
			value=self.stereo,
			callback=self.set_stereo,
			label="Stereo",
			true=True,
			false=False,
		)
		self.GridAdd(self._stereo_check_box, 2, 4, 1, 1)
		self.rtl2832_source_0 = baz.rtl_source_c(defer_creation=True)
		self.rtl2832_source_0.set_verbose(True)
		self.rtl2832_source_0.set_vid(0x0)
		self.rtl2832_source_0.set_pid(0x0)
		self.rtl2832_source_0.set_tuner_name("")
		self.rtl2832_source_0.set_default_timeout(0)
		self.rtl2832_source_0.set_use_buffer(True)
		self.rtl2832_source_0.set_fir_coefficients(([]))
		
		
		
		
		
		if self.rtl2832_source_0.create() == False: raise Exception("Failed to create RTL2832 Source: rtl2832_source_0")
		
		
		self.rtl2832_source_0.set_sample_rate(1.0e6)
		
		self.rtl2832_source_0.set_frequency(cur_freq+200e3)
		
		
		self.rtl2832_source_0.set_auto_gain_mode(False)
		self.rtl2832_source_0.set_relative_gain(True)
		self.rtl2832_source_0.set_gain(gain)
		  
		self._rtext_0_static_text = forms.static_text(
			parent=self.GetWin(),
			value=self.rtext_0,
			callback=self.set_rtext_0,
			label="CURRENT FREQUENCY>>",
			converter=forms.float_converter(),
		)
		self.GridAdd(self._rtext_0_static_text, 0, 1, 1, 1)
		def _rf_pwr_lvl_probe():
			while True:
				val = self.input_power.level()
				try: self.set_rf_pwr_lvl(val)
				except AttributeError, e: pass
				time.sleep(1.0/(2))
		_rf_pwr_lvl_thread = threading.Thread(target=_rf_pwr_lvl_probe)
		_rf_pwr_lvl_thread.daemon = True
		_rf_pwr_lvl_thread.start()
		self._preselect_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.preselect,
			callback=self.set_preselect,
			label='preselect',
			choices=eval(prefreqs),
			labels=eval(prenames),
			style=wx.RA_HORIZONTAL,
		)
		self.GridAdd(self._preselect_chooser, 0, 4, 1, 1)
		def _pilot_level_probe():
			while True:
				val = self.pilot_probe.level()
				try: self.set_pilot_level(val)
				except AttributeError, e: pass
				time.sleep(1.0/(5))
		_pilot_level_thread = threading.Thread(target=_pilot_level_probe)
		_pilot_level_thread.daemon = True
		_pilot_level_thread.start()
		self.low_pass_filter_3 = gr.fir_filter_fff(1, firdes.low_pass(
			3, asrate/500, 10, 3, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_2 = gr.fir_filter_fff(10, firdes.low_pass(
			3, asrate/50, 100, 30, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_1 = gr.fir_filter_fff(10, firdes.low_pass(
			3, asrate/5, 1e3, 200, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0 = gr.fir_filter_fff(5, firdes.low_pass(
			3, asrate, 10e3, 2e3, firdes.WIN_HAMMING, 6.76))
		_igain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._igain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_igain_sizer,
			value=self.igain,
			callback=self.set_igain,
			label="RF Gain",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._igain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_igain_sizer,
			value=self.igain,
			callback=self.set_igain,
			minimum=0,
			maximum=50,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_igain_sizer, 1, 1, 1, 1)
		_ifreq_sizer = wx.BoxSizer(wx.VERTICAL)
		self._ifreq_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_ifreq_sizer,
			value=self.ifreq,
			callback=self.set_ifreq,
			label="Center Frequency",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._ifreq_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_ifreq_sizer,
			value=self.ifreq,
			callback=self.set_ifreq,
			minimum=88.1e6,
			maximum=108.1e6,
			num_steps=200,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.GridAdd(_ifreq_sizer, 0, 0, 1, 1)
		self.gr_wavfile_sink_0 = gr.wavfile_sink("/dev/null" if record == False else capture_file, 2, int(farate), 16)
		self.gr_sub_xx_0 = gr.sub_ff(1)
		self.gr_single_pole_iir_filter_xx_1 = gr.single_pole_iir_filter_ff(2.5/(asrate/500), 1)
		self.gr_single_pole_iir_filter_xx_0 = gr.single_pole_iir_filter_ff(1.0/(asrate/3), 1)
		self.gr_multiply_xx_1 = gr.multiply_vff(1)
		self.gr_multiply_xx_0_0 = gr.multiply_vff(1)
		self.gr_multiply_xx_0 = gr.multiply_vff(1)
		self.gr_multiply_const_vxx_3 = gr.multiply_const_vff((3.16e3 if st_enabled else 0, ))
		self.gr_multiply_const_vxx_2 = gr.multiply_const_vff((1.0 if st_enabled else 1.414, ))
		self.gr_multiply_const_vxx_1_0 = gr.multiply_const_vff((0 if st_enabled else 1, ))
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vff((0 if squelch_probe == 0 else 1.0, ))
		self.gr_multiply_const_vxx_0_0 = gr.multiply_const_vff((vol*1.5*10.0, ))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vff((vol*1.5*10.0 if st_enabled else 0, ))
		self.gr_keep_one_in_n_0 = gr.keep_one_in_n(gr.sizeof_float*1, int(asrate/3))
		self.gr_freq_xlating_fir_filter_xxx_0 = gr.freq_xlating_fir_filter_ccc(4, (osmo_taps), 200e3+fine+(-12e3*discrim_dc), 1.0e6)
		self.gr_fractional_interpolator_xx_0_0 = gr.fractional_interpolator_ff(0, asrate/farate)
		self.gr_fractional_interpolator_xx_0 = gr.fractional_interpolator_ff(0, asrate/farate)
		self.gr_fft_filter_xxx_1_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_high/10.0,asrate,3.5e3,15.0e3,5.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_1_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_med/10.0,asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_1 = gr.fft_filter_fff(1, (firdes.low_pass(tone_low/10.0,asrate,1.2e3,500,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_high/10.0,asrate,3.5e3,13.5e3,3.5e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0_0 = gr.fft_filter_fff(1, (firdes.band_pass(tone_med/10.0,asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)), 1)
		self.gr_fft_filter_xxx_0 = gr.fft_filter_fff(1, (firdes.low_pass(tone_low/10.0,asrate,1.2e3,500,firdes.WIN_HAMMING)), 1)
		self.gr_divide_xx_0 = gr.divide_ff(1)
		self.gr_agc_xx_1 = gr.agc_cc(1e-2, 0.35, 1.0, 5000)
		self.gr_add_xx_2_0 = gr.add_vff(1)
		self.gr_add_xx_2 = gr.add_vff(1)
		self.gr_add_xx_1 = gr.add_vff(1)
		self.gr_add_xx_0 = gr.add_vff(1)
		self.gr_add_const_vxx_0 = gr.add_const_vff((1.0e-7, ))
		self._dm_chooser = forms.radio_buttons(
			parent=self.GetWin(),
			value=self.dm,
			callback=self.set_dm,
			label="FM Deemphasis",
			choices=[75.0e-6, 50.0e-6],
			labels=["NA", "EU"],
			style=wx.RA_HORIZONTAL,
		)
		self.GridAdd(self._dm_chooser, 0, 5, 1, 1)
		self.blks2_wfm_rcv_0 = blks2.wfm_rcv(
			quad_rate=samp_rate,
			audio_decimation=2,
		)
		self.blks2_fm_deemph_0_0 = blks2.fm_deemph(fs=farate, tau=deemph)
		self.blks2_fm_deemph_0 = blks2.fm_deemph(fs=farate, tau=deemph)
		self.band_pass_filter_2_0 = gr.fir_filter_fff(1, firdes.band_pass(
			20, asrate, 17.5e3, 17.9e3, 250, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_2 = gr.fir_filter_fff(1, firdes.band_pass(
			10, asrate, 18.8e3, 19.2e3, 350, firdes.WIN_HAMMING, 6.76))
		self.band_pass_filter_0_0 = gr.fir_filter_fff(1, firdes.band_pass(
			1, asrate, 38e3-(15e3), 38e3+(15e3), 4.0e3, firdes.WIN_HAMMING, 6.76))
		self.audio_sink_0 = audio.sink(int(farate), "" if ahw == "Default" else ahw, True)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_add_xx_1, 0), (self.gr_fractional_interpolator_xx_0, 0))
		self.connect((self.gr_sub_xx_0, 0), (self.gr_fractional_interpolator_xx_0_0, 0))
		self.connect((self.band_pass_filter_0_0, 0), (self.gr_multiply_xx_1, 0))
		self.connect((self.gr_multiply_const_vxx_1_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.band_pass_filter_2_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.band_pass_filter_2_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_multiply_xx_0_0, 0), (self.gr_divide_xx_0, 0))
		self.connect((self.gr_divide_xx_0, 0), (self.gr_single_pole_iir_filter_xx_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.gr_add_const_vxx_0, 0))
		self.connect((self.gr_add_const_vxx_0, 0), (self.gr_divide_xx_0, 1))
		self.connect((self.gr_single_pole_iir_filter_xx_0, 0), (self.gr_keep_one_in_n_0, 0))
		self.connect((self.gr_keep_one_in_n_0, 0), (self.pilot_probe, 0))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_1, 2))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.gr_add_xx_1, 0))
		self.connect((self.gr_multiply_const_vxx_2, 0), (self.gr_sub_xx_0, 0))
		self.connect((self.gr_multiply_const_vxx_3, 0), (self.gr_sub_xx_0, 1))
		self.connect((self.gr_multiply_const_vxx_3, 0), (self.gr_add_xx_1, 1))
		self.connect((self.gr_fractional_interpolator_xx_0, 0), (self.gr_multiply_const_vxx_0_0, 0))
		self.connect((self.gr_fractional_interpolator_xx_0_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0, 0))
		self.connect((self.gr_fft_filter_xxx_1, 0), (self.gr_add_xx_2, 0))
		self.connect((self.gr_fft_filter_xxx_1_0, 0), (self.gr_add_xx_2, 1))
		self.connect((self.gr_fft_filter_xxx_1_0_0, 0), (self.gr_add_xx_2, 2))
		self.connect((self.gr_add_xx_2, 0), (self.gr_multiply_const_vxx_2, 0))
		self.connect((self.gr_add_xx_2_0, 0), (self.gr_multiply_const_vxx_3, 0))
		self.connect((self.gr_fft_filter_xxx_0, 0), (self.gr_add_xx_2_0, 0))
		self.connect((self.gr_fft_filter_xxx_0_0, 0), (self.gr_add_xx_2_0, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0_0, 0))
		self.connect((self.gr_fft_filter_xxx_0_0_0, 0), (self.gr_add_xx_2_0, 2))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_fft_filter_xxx_0_0_0, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.gr_multiply_const_vxx_1_0, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.gr_wavfile_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.gr_fft_filter_xxx_1_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_multiply_const_vxx_0_0, 0), (self.blks2_fm_deemph_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.audio_sink_0, 1))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.blks2_fm_deemph_0_0, 0))
		self.connect((self.blks2_fm_deemph_0_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.band_pass_filter_2, 0), (self.gr_multiply_xx_0_0, 1))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_2, 0))
		self.connect((self.blks2_fm_deemph_0, 0), (self.audio_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_2_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.band_pass_filter_0_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_wavfile_sink_0, 1))
		self.connect((self.blks2_fm_deemph_0, 0), (self.wxgui_scopesink2_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.wxgui_scopesink2_0, 1))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.gr_agc_xx_1, 0), (self.blks2_wfm_rcv_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.gr_agc_xx_1, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.input_power, 0))
		self.connect((self.blks2_wfm_rcv_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.low_pass_filter_0, 0), (self.low_pass_filter_1, 0))
		self.connect((self.low_pass_filter_1, 0), (self.low_pass_filter_2, 0))
		self.connect((self.low_pass_filter_2, 0), (self.low_pass_filter_3, 0))
		self.connect((self.gr_single_pole_iir_filter_xx_1, 0), (self.dc_level, 0))
		self.connect((self.low_pass_filter_3, 0), (self.gr_single_pole_iir_filter_xx_1, 0))
		self.connect((self.rtl2832_source_0, 0), (self.gr_freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.gr_freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_waterfallsink2_0, 0))
Esempio n. 36
0
	def set_bp_high(self, bp_high):
		self.bp_high = bp_high
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.srate/5, self.bp_low, self.bp_high, 24e3, firdes.WIN_HAMMING, 6.76))
Esempio n. 37
0
	def set_tone_med(self, tone_med):
		self.tone_med = tone_med
		self.gr_fft_filter_xxx_1_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
		self._tone_med_slider.set_value(self.tone_med)
		self._tone_med_text_box.set_value(self.tone_med)
		self.gr_fft_filter_xxx_0_0.set_taps((firdes.band_pass(self.tone_med/10.0,self.asrate,1.0e3,4.0e3,2.0e3,firdes.WIN_HAMMING)))
Esempio n. 38
0
	def set_tone_high(self, tone_high):
		self.tone_high = tone_high
		self.gr_fft_filter_xxx_1_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,15.0e3,5.0e3,firdes.WIN_HAMMING)))
		self._tone_high_slider.set_value(self.tone_high)
		self._tone_high_text_box.set_value(self.tone_high)
		self.gr_fft_filter_xxx_0_0_0.set_taps((firdes.band_pass(self.tone_high/10.0,self.asrate,3.5e3,13.5e3,3.5e3,firdes.WIN_HAMMING)))
Esempio n. 39
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self,
                                         title="Intensity Interferometer")
        _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 = 250e3
        self.magnitude = magnitude = 0.05
        self.integ = integ = 1
        self.beat = beat = 1

        ##################################################
        # Blocks
        ##################################################
        _magnitude_sizer = wx.BoxSizer(wx.VERTICAL)
        self._magnitude_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            label="Magnitude",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._magnitude_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_magnitude_sizer,
            value=self.magnitude,
            callback=self.set_magnitude,
            minimum=0.05,
            maximum=0.5,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_magnitude_sizer)
        _integ_sizer = wx.BoxSizer(wx.VERTICAL)
        self._integ_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            label="Integration Time (Sec)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._integ_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_integ_sizer,
            value=self.integ,
            callback=self.set_integ,
            minimum=1,
            maximum=30,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_integ_sizer)
        _beat_sizer = wx.BoxSizer(wx.VERTICAL)
        self._beat_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            label="Beat Frequency (kHz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._beat_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_beat_sizer,
            value=self.beat,
            callback=self.set_beat,
            minimum=1,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_beat_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title="2nd detector power level",
            sample_rate=2,
            v_scale=0,
            v_offset=0,
            t_scale=450,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_STRIPCHART,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / 10,
            fft_size=1024,
            fft_rate=8,
            average=True,
            avg_alpha=0.1,
            title="First Detector Spectrum",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(
            1.0 / ((samp_rate / 10) * integ), 1)
        self.low_pass_filter_0 = gr.fir_filter_fff(
            int(samp_rate / 25e3),
            firdes.low_pass(1, samp_rate, 11e3, 2.5e3, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_float * 1, int(samp_rate / 20))
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.band_pass_filter_0 = gr.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / 10, (beat * 1000) - 100,
                             (beat * 1000) + 100, 50, firdes.WIN_HAMMING,
                             6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3, magnitude, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 122e3 - (beat * 1000), magnitude, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(
            analog.GR_GAUSSIAN, 0.2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))
	def set_beat(self, beat):
		self.beat = beat
		self._beat_slider.set_value(self.beat)
		self._beat_text_box.set_value(self.beat)
		self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate/10, (self.beat*1000)-100, (self.beat*1000)+100, 50, firdes.WIN_HAMMING, 6.76))
		self.analog_sig_source_x_0.set_frequency(122e3-(self.beat*1000))