Ejemplo n.º 1
0
	def __init__(self, **kwargs):
		demod_rate = 48000
		
		SimpleAudioDemodulator.__init__(self, demod_rate=demod_rate, band_filter=5000, band_filter_transition=5000, **kwargs)
	
		input_rate = self.input_rate
		audio_rate = self.audio_rate
		
		inherent_gain = 0.5  # fudge factor so that our output is similar level to narrow FM
		self.agc_block = analog.feedforward_agc_cc(int(.02 * demod_rate), inherent_gain)
		self.demod_block = blocks.complex_to_mag(1)
		self.resampler_block = make_resampler(demod_rate, audio_rate)
		
		# assuming below 40Hz is not of interest
		dc_blocker = grfilter.dc_blocker_ff(audio_rate // 40, False)
		
		self.connect(
			self,
			self.band_filter_block,
			self.rf_squelch_block,
			self.agc_block,
			self.demod_block,
			dc_blocker,
			self.resampler_block)
		self.connect(self.band_filter_block, self.rf_probe_block)
		self.connect_audio_output(self.resampler_block, self.resampler_block)
Ejemplo n.º 2
0
    def __init__(self, dc_block_len=4, rx_gain=40):
        gr.top_block.__init__(self, "Uhd Adsb 6")

        ##################################################
        # Parameters
        ##################################################
        self.dc_block_len = dc_block_len
        self.rx_gain = rx_gain

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.freq = freq = 1090e6
        self.filename = filename = "./bytes_" + str(dc_block_len) + ".csv"

        ##################################################
        # Message Queues
        ##################################################
        adsb_decoder_0_msgq_out = blocks_message_source_0_msgq_in = gr.msg_queue(
            2)
        adsb_framer_0_msgq_out = adsb_decoder_0_msgq_in = gr.msg_queue(2)

        ##################################################
        # Blocks
        ##################################################
        self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb(
            '1010000101000000', 0, 'adsb_preamble')
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_len, True)
        self.blocks_message_source_0 = blocks.message_source(
            gr.sizeof_char * 1, blocks_message_source_0_msgq_in)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/leffke/sandbox/adsb/adsb_20161212_2M_2.32fc', False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   filename, True)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.adsb_framer_0 = adsb.framer(tx_msgq=adsb_framer_0_msgq_out)
        self.adsb_decoder_0 = adsb.decoder(rx_msgq=adsb_decoder_0_msgq_in,
                                           tx_msgq=adsb_decoder_0_msgq_out,
                                           output_type="csv",
                                           check_parity=True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_message_source_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_correlate_access_code_tag_bb_0, 0))
        self.connect((self.digital_correlate_access_code_tag_bb_0, 0),
                     (self.adsb_framer_0, 0))
Ejemplo n.º 3
0
	def __init__(self, dc_block_len=1000, samp_per_sym=10, rx_bit_inv=1):
		gr.hier_block2.__init__(
			self, "GMSK Demodulator",
			gr.io_signature(1, 1, gr.sizeof_float*1),
			gr.io_signature(1, 1, gr.sizeof_char*1),
		)

		##################################################
		# Parameters
		##################################################
		self.dc_block_len = dc_block_len
		self.samp_per_sym = samp_per_sym
		self.rx_bit_inv = rx_bit_inv

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

		##################################################
		# Blocks
		##################################################
		self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(samp_per_sym*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
		self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
		self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_len, False)
		self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((rx_bit_inv, ))

		##################################################
		# Connections
		##################################################
		self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
		self.connect((self.digital_clock_recovery_mm_xx_0_0, 0), (self.digital_binary_slicer_fb_0_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.digital_clock_recovery_mm_xx_0_0, 0))
		self.connect((self.digital_binary_slicer_fb_0_0, 0), (self, 0))
		self.connect((self, 0), (self.dc_blocker_xx_0, 0))
Ejemplo n.º 4
0
    def __init__(self):
        gr.top_block.__init__(self, "Gotenna Rx Hackrf")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 500000
        self.fsk_deviation_hz = fsk_deviation_hz = 12500
        self.chan_spacing = chan_spacing = 500000
        self.baud_rate = baud_rate = 24000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " + ''
        )
        self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t())
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(915000000, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_gain(1, 0)
        self.osmosdr_source_0.set_if_gain(16, 0)
        self.osmosdr_source_0.set_bb_gain(1, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(26000000, 0)
        self.gotenna_sink = gotenna_sink.blk()
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(
            digital.TED_DANDREA_AND_MENGALI_GEN_MSK,
            float(chan_spacing) / baud_rate / 4,
            0.05,
            1.5,
            1.0,
            0.001 * float(chan_spacing) / baud_rate / 4,
            1,
            digital.constellation_bpsk().base(),
            digital.IR_MMSE_8TAP,
            128,
            [])
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(512, True)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(chan_spacing/(2*math.pi*fsk_deviation_hz))



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.gotenna_sink, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_symbol_sync_xx_0, 0))
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="AM RX")

        ##################################################
        # Variables
        ##################################################
        self.transmission_width = transmission_width = 100
        self.samp_rate = samp_rate = 256000
        self.resamp_factor = resamp_factor = 4
        self.cut_off_freq = cut_off_freq = 5000

        ##################################################
        # Blocks
        ##################################################
        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/resamp_factor,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=resamp_factor,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=resamp_factor,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, cut_off_freq, transmission_width, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/Users/ampoulog/Documents/gnuradio/Wireless-communication-systems-Lab/Lab2/example6/am_usrp710.dat', True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.audio_sink_0 = audio.sink(48000, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.rational_resampler_xxx_0_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.wxgui_fftsink2_0, 0))    
Ejemplo n.º 6
0
    def __init__(self, input_rate, sps):
        gr.hier_block2.__init__(
            self,
            "atsc_rx",
            # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_char))  # Output signature

        # ATSC receiver filter/interpolator
        rx_filt = atsc_rx_filter(input_rate, sps)

        # Lock on to pilot tone, shift to DC, then discard Q channel
        output_rate = ATSC_SYMBOL_RATE * sps
        pll = dtv.atsc_fpll(output_rate)

        # Remove pilot tone now at DC
        dcr = filter.dc_blocker_ff(4096)

        # Normalize signal to proper constellation amplitude
        agc = analog.agc_ff(1e-5, 4.0)

        # Synchronize bit and segment timing
        btl = dtv.atsc_sync(output_rate)

        # Check for correct field sync
        fsc = dtv.atsc_fs_checker()

        # Equalize channel using training sequences
        equ = dtv.atsc_equalizer()

        # Remove convolutional trellis coding
        vit = dtv.atsc_viterbi_decoder()

        # Remove convolutional interleaving
        dei = dtv.atsc_deinterleaver()

        # Reed-Solomon decode
        rsd = dtv.atsc_rs_decoder()

        # Derandomize MPEG2-TS packet
        der = dtv.atsc_derandomizer()

        # Remove padding from packet
        dep = dtv.atsc_depad()

        # Connect pipeline
        self.connect(self, rx_filt, pll, dcr, agc, btl, fsc)
        self.connect((fsc, 0), (equ, 0))
        self.connect((fsc, 1), (equ, 1))
        self.connect((equ, 0), (vit, 0))
        self.connect((equ, 1), (vit, 1))
        self.connect((vit, 0), (dei, 0))
        self.connect((vit, 1), (dei, 1))
        self.connect((dei, 0), (rsd, 0))
        self.connect((dei, 1), (rsd, 1))
        self.connect((rsd, 0), (der, 0))
        self.connect((rsd, 1), (der, 1))
        self.connect((der, 0), (dep, 0))
        self.connect((dep, 0), (self, 0))
Ejemplo n.º 7
0
    def __init__(self, freq, ppm, osmosdr_args):
        gr.top_block.__init__(self, "gr_omnicon")

        self.msgq_out = blocks_message_sink_0_msgq_out = gr.msg_queue(0)
        ##################################################
        # Variables
        ##################################################
        self.xlate_bandwidth = xlate_bandwidth = 15.0e3
        self.samp_rate = samp_rate = 1.2e6
        self.xlate_decimation = xlate_decimation = int(samp_rate/(xlate_bandwidth*3.2))
        self.baud_rate = baud_rate = 2400
        self.lowpass_decimation = lowpass_decimation = int((samp_rate/xlate_decimation)/(baud_rate*4))
        self.freq_offset = freq_offset = 250000
        self.sps = sps = (samp_rate/xlate_decimation/lowpass_decimation)/baud_rate
        self.omega_rel_limit = omega_rel_limit = ((2450.0-2400.0)/2400.0)
        self.gain_omega = gain_omega = 0
        self.gain_mu = gain_mu = 0.1
        self.freq_tune = freq_tune = freq-freq_offset

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source(args=osmosdr_args)
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq_tune, 0)
        self.rtlsdr_source_0.set_freq_corr(ppm, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(True, 0)
        self.rtlsdr_source_0.set_gain(42, 0)
        self.rtlsdr_source_0.set_if_gain(10, 0)
        self.rtlsdr_source_0.set_bb_gain(10, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.low_pass_filter_0 = filter.fir_filter_fff(lowpass_decimation, firdes.low_pass(
        	1, samp_rate/xlate_decimation, baud_rate, (baud_rate)/10, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(xlate_decimation, (firdes.low_pass(1, samp_rate, xlate_bandwidth, xlate_bandwidth/20 )), freq_offset, samp_rate)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(sps, gain_omega, 0.5, gain_mu, omega_rel_limit)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(500, True)
        self.blocks_message_sink_0 = blocks.message_sink(gr.sizeof_char*1, blocks_message_sink_0_msgq_out, False)
        self.analog_quadrature_demod_cf_0_0_0 = analog.quadrature_demod_cf(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_quadrature_demod_cf_0_0_0, 0), (self.dc_blocker_xx_0, 0))
        #self.connect((self.blocks_message_sink_0, 'msg'), (self, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_message_sink_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_quadrature_demod_cf_0_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
Ejemplo n.º 8
0
    def test_004(self):
        ''' Test impulse response - short form, ff '''
        src_data = [1,] + 100*[0,]
        expected_result = ((-0.029296875), (-0.0302734375),
                           (0.96875), (-0.0302734375),
                           (-0.029296875))

        src = blocks.vector_source_f(src_data)
        op = filter.dc_blocker_ff(32, False)
        dst = blocks.vector_sink_f()

        self.tb.connect (src, op, dst)
        self.tb.run()

        # only test samples around D-1
        result_data = dst.data()[29:34]
        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
Ejemplo n.º 9
0
    def test_003(self):
        ''' Test impulse response - long form, ff '''
        src_data = [1,] + 100*[0,]
        expected_result = ((-0.02072429656982422), (-0.02081298828125),
                           (0.979156494140625), (-0.02081298828125),
                           (-0.02072429656982422))

        src = blocks.vector_source_f(src_data)
        op = filter.dc_blocker_ff(32, True)
        dst = blocks.vector_sink_f()

        self.tb.connect (src, op, dst)
        self.tb.run()

        # only test samples around 2D-2
        result_data = dst.data()[60:65]
        self.assertFloatTuplesAlmostEqual (expected_result, result_data)
Ejemplo n.º 10
0
    def __init__(self, input_rate, sps):
        gr.hier_block2.__init__(self, "atsc_rx",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
                                gr.io_signature(1, 1, gr.sizeof_char))       # Output signature

        # ATSC receiver filter/interpolator
        rx_filt = atsc_rx_filter(input_rate, sps)

        # Lock on to pilot tone, shift to DC, then discard Q channel
        output_rate = ATSC_SYMBOL_RATE*sps
        pll = dtv.atsc_fpll(output_rate)

        # Remove pilot tone now at DC
        dcr = filter.dc_blocker_ff(4096)

        # Normalize signal to proper constellation amplitude
        agc = analog.agc_ff(1e-5, 4.0)

        # Synchronize bit and segment timing
        btl = dtv.atsc_sync(output_rate)

        # Check for correct field sync
        fsc = dtv.atsc_fs_checker()

        # Equalize channel using training sequences
        equ = dtv.atsc_equalizer()

        # Remove convolutional trellis coding
        vit = dtv.atsc_viterbi_decoder()

        # Remove convolutional interleaving
        dei = dtv.atsc_deinterleaver()

        # Reed-Solomon decode
        rsd = dtv.atsc_rs_decoder()

        # Derandomize MPEG2-TS packet
        der = dtv.atsc_derandomizer()

        # Remove padding from packet
        dep = dtv.atsc_depad()

        # Connect pipeline
        self.connect(self, rx_filt, pll, dcr, agc, btl, fsc, equ)
        self.connect(equ, vit, dei, rsd, der, dep, self)
Ejemplo n.º 11
0
    def __init__(self, use_entire_input_band=False, **kwargs):
        demod_rate = 10000

        SimpleAudioDemodulator.__init__(
            self, audio_rate=demod_rate, demod_rate=demod_rate, band_filter=5000, band_filter_transition=5000, **kwargs
        )

        self.__use_entire_input_band = bool(use_entire_input_band)
        self.__rec_freq_input = 0.0

        inherent_gain = 0.5  # fudge factor so that our output is similar level to narrow FM
        self.agc_block = analog.feedforward_agc_cc(int(0.02 * demod_rate), inherent_gain)
        self.demod_block = blocks.complex_to_mag(1)

        # assuming below 40Hz is not of interest
        self.dc_blocker = grfilter.dc_blocker_ff(demod_rate // 40, False)

        self.__do_connect()
Ejemplo n.º 12
0
    def __init__(self, mode, input_rate, context):
        channels = 2
        audio_rate = 10000
        
        gr.hier_block2.__init__(
            self, str('%s demodulator' % (mode,)),
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_float * channels))

        self.__input_rate = input_rate
        self.__rec_freq_input = 0.0
        self.__signal_type = SignalType(kind='STEREO', sample_rate=audio_rate)

        # Using agc2 rather than feedforward AGC for efficiency, because this runs at the RF rate rather than the audio rate.
        agc_block = analog.agc2_cc(reference=dB(-8))
        agc_block.set_attack_rate(8e-3)
        agc_block.set_decay_rate(8e-3)
        agc_block.set_max_gain(dB(40))
        
        self.connect(
            self,
            agc_block)
        
        channel_joiner = blocks.streams_to_vector(gr.sizeof_float, channels)
        self.connect(channel_joiner, self)
        
        for channel in six.moves.range(0, channels):
            self.connect(
                agc_block,
                grfilter.fir_filter_ccc(1, design_sawtooth_filter(decreasing=channel == 0)),
                blocks.complex_to_mag(1),
                blocks.float_to_complex(),  # So we can use the complex-input band filter. TODO eliminate this for efficiency
                MultistageChannelFilter(
                    input_rate=input_rate,
                    output_rate=audio_rate,
                    cutoff_freq=5000,
                    transition_width=5000),
                blocks.complex_to_real(),
                # assuming below 40Hz is not of interest
                grfilter.dc_blocker_ff(audio_rate // 40, False),
                (channel_joiner, channel))
Ejemplo n.º 13
0
    def __init__(self, dc_block_len=1000, samp_per_sym=10, rx_bit_inv=1):
        gr.hier_block2.__init__(
            self,
            "GMSK Demodulator",
            gr.io_signature(1, 1, gr.sizeof_float * 1),
            gr.io_signature(1, 1, gr.sizeof_char * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.dc_block_len = dc_block_len
        self.samp_per_sym = samp_per_sym
        self.rx_bit_inv = rx_bit_inv

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

        ##################################################
        # Blocks
        ##################################################
        self.digital_clock_recovery_mm_xx_0_0 = digital.clock_recovery_mm_ff(
            samp_per_sym * (1 + 0.0), 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_len, False)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (rx_bit_inv, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0), (self, 0))
        self.connect((self, 0), (self.dc_blocker_xx_0, 0))
Ejemplo n.º 14
0
    def __init__(self, mode, input_rate, context):
        channels = 2
        audio_rate = 10000
        
        gr.hier_block2.__init__(
            self, str('%s demodulator' % (mode,)),
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_float * channels))

        self.__input_rate = input_rate
        self.__rec_freq_input = 0.0
        self.__signal_type = SignalType(kind='STEREO', sample_rate=audio_rate)

        # Using agc2 rather than feedforward AGC for efficiency, because this runs at the RF rate rather than the audio rate.
        agc_block = analog.agc2_cc(reference=dB(-8))
        agc_block.set_attack_rate(8e-3)
        agc_block.set_decay_rate(8e-3)
        agc_block.set_max_gain(dB(40))
        
        self.connect(
            self,
            agc_block)
        
        channel_joiner = blocks.streams_to_vector(gr.sizeof_float, channels)
        self.connect(channel_joiner, self)
        
        for channel in xrange(0, channels):
            self.connect(
                agc_block,
                grfilter.fir_filter_ccc(1, design_sawtooth_filter(decreasing=channel == 0)),
                blocks.complex_to_mag(1),
                blocks.float_to_complex(),  # So we can use the complex-input band filter. TODO eliminate this for efficiency
                MultistageChannelFilter(
                    input_rate=input_rate,
                    output_rate=audio_rate,
                    cutoff_freq=5000,
                    transition_width=5000),
                blocks.complex_to_real(),
                # assuming below 40Hz is not of interest
                grfilter.dc_blocker_ff(audio_rate // 40, False),
                (channel_joiner, channel))
Ejemplo n.º 15
0
    def __init__(self, **kwargs):
        demod_rate = 10000

        SimpleAudioDemodulator.__init__(self,
                                        audio_rate=demod_rate,
                                        demod_rate=demod_rate,
                                        band_filter=5000,
                                        band_filter_transition=5000,
                                        **kwargs)

        inherent_gain = 0.5  # fudge factor so that our output is similar level to narrow FM
        self.agc_block = analog.feedforward_agc_cc(int(.02 * demod_rate),
                                                   inherent_gain)
        self.demod_block = blocks.complex_to_mag(1)

        # assuming below 40Hz is not of interest
        self.dc_blocker = grfilter.dc_blocker_ff(demod_rate // 40, False)

        self.connect(self, self.band_filter_block, self.rf_squelch_block,
                     self.agc_block, self.demod_block, self.dc_blocker)
        self.connect(self.band_filter_block, self.rf_probe_block)
        self.connect_audio_output(self.dc_blocker)
Ejemplo n.º 16
0
    def __init__(self, input_rate, baud):
        gr.hier_block2.__init__(
            self,
            'RTTY FSK demodulator',
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_float * 1),
        )

        self.bit_time = bit_time = input_rate / baud

        fsk_deviation_hz = 85  # TODO param or just don't care

        self.__dc_blocker = grfilter.dc_blocker_ff(
            int(bit_time * _HALF_BITS_PER_CODE * 10), False)
        self.__quadrature_demod = analog.quadrature_demod_cf(
            -input_rate / (2 * math.pi * fsk_deviation_hz))
        self.__freq_probe = blocks.probe_signal_f()

        self.connect(self, self.__quadrature_demod, self.__dc_blocker,
                     digital.binary_slicer_fb(), blocks.char_to_float(scale=1),
                     self)
        self.connect(self.__dc_blocker, self.__freq_probe)
Ejemplo n.º 17
0
 def __init__(self, input_rate, baud):
     gr.hier_block2.__init__(
         self, 'RTTY FSK demodulator',
         gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
         gr.io_signature(1, 1, gr.sizeof_float * 1),
     )
     
     self.bit_time = bit_time = input_rate / baud
     
     fsk_deviation_hz = 85  # TODO param or just don't care
     
     self.__dc_blocker = grfilter.dc_blocker_ff(int(bit_time * _HALF_BITS_PER_CODE * 10), False)
     self.__quadrature_demod = analog.quadrature_demod_cf(-input_rate / (2 * math.pi * fsk_deviation_hz))
     self.__freq_probe = blocks.probe_signal_f()
     
     self.connect(
         self,
         self.__quadrature_demod,
         self.__dc_blocker,
         digital.binary_slicer_fb(),
         blocks.char_to_float(scale=1),
         self)
     self.connect(self.__dc_blocker, self.__freq_probe)
Ejemplo n.º 18
0
    def __init__(self, freq=0):
        gr.top_block.__init__(self, "Am")

        ##################################################
        # Parameters
        ##################################################
        self.freq = freq

        ##################################################
        # Variables
        ##################################################
        self.center_freq = center_freq = 133e6

        ##################################################
        # Blocks
        ##################################################
        self.freq_xlating_fir_filter_xxx_0_0_0_0_0_0_0_0 = filter.freq_xlating_fir_filter_ccf(
            800, (firdes.low_pass(1, 10e6, 10e6 / (2 * 800), 1000)),
            (freq * 1e3) - center_freq, 10e6)
        self.dc_blocker_xx_0_0_0_0_0_0_0_0 = filter.dc_blocker_ff(32, True)
        self.blocks_wavfile_sink_0_0_0_0_0_0_0_0 = blocks.wavfile_sink(
            "/tmp/" + str(freq) + ".wav", 1, int(12.5e3), 16)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, "/tmp/decompress.iq", False)
        self.blocks_complex_to_mag_0_0_0_0_0_0_0_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0_0_0_0_0_0_0_0, 0),
                     (self.dc_blocker_xx_0_0_0_0_0_0_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0_0_0_0_0_0_0_0, 0))
        self.connect((self.dc_blocker_xx_0_0_0_0_0_0_0_0, 0),
                     (self.blocks_wavfile_sink_0_0_0_0_0_0_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0_0_0_0_0_0_0_0, 0),
                     (self.blocks_complex_to_mag_0_0_0_0_0_0_0_0, 0))
    def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=20, enable_iq_dump=0, file_path='test.ogg', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "AMSAT FOX DUV Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76)

        self.max_modulation_freq = max_modulation_freq = 3000
        self.filter_rate = filter_rate = 250000
        self.deviation = deviation = 5000
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000/doppler_correction_per_sec, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(1.2)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(32767, iq_file_path, False, enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(decoded_data_file_path, 0)
        self.satnogs_fox_telem_mm_0 = satnogs.fox_telem_mm()
        self.satnogs_decoder_8b10b_0 = satnogs.decoder_8b10b('0011111010', 960)

        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx)
        self.satnogs_ccsds_rs_decoder_mm_0 = satnogs.ccsds_rs_decoder_mm()
        self.root_raised_cosine_filter_0 = filter.fir_filter_fff(1, firdes.root_raised_cosine(
        	1, 1, 2.4, 0.5, 512))
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_1 = filter.fir_filter_fff(100, firdes.low_pass(
        	100, audio_samp_rate, 195, 10, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, audio_samp_rate, deviation+max_modulation_freq, 3000, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx)
        self.digital_clock_recovery_mm_xx_0_0_0 = digital.clock_recovery_mm_ff((audio_samp_rate/100.0) / 200, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=24,
                decimation=125,
                taps=None,
                fractional_bw=None,
        )
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1.0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ccsds_rs_decoder_mm_0, 'pdu'), (self.satnogs_fox_telem_mm_0, 'in'))
        self.msg_connect((self.satnogs_decoder_8b10b_0, 'pdu'), (self.satnogs_ccsds_rs_decoder_mm_0, 'in'))
        self.msg_connect((self.satnogs_fox_telem_mm_0, 'raw'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.low_pass_filter_1, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.root_raised_cosine_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0), (self.satnogs_decoder_8b10b_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0_0, 0), (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0), (self.digital_clock_recovery_mm_xx_0_0_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0), (self.digital_binary_slicer_fb_0_0, 0))
Ejemplo n.º 20
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "top_block")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44000
        self.resamp_factor = resamp_factor = 4
        self.gain = gain = 1.1
        self.filter_width = filter_width = 50
        self.filter_frequency = filter_frequency = 1.05e3
        self.dc_block_length = dc_block_length = 32

        ##################################################
        # Blocks
        ##################################################
        self._filter_width_range = Range(10, 1000, 1, 50, 200)
        self._filter_width_win = RangeWidget(self._filter_width_range,
                                             self.set_filter_width,
                                             'Filter Width', "counter_slider",
                                             float)
        self.top_grid_layout.addWidget(self._filter_width_win, 1, 3, 1, 1)
        self._filter_frequency_range = Range(1e2, 1e6, 10, 1.05e3, 200)
        self._filter_frequency_win = RangeWidget(self._filter_frequency_range,
                                                 self.set_filter_frequency,
                                                 'Cutoff Frequency',
                                                 "counter_slider", float)
        self.top_grid_layout.addWidget(self._filter_frequency_win, 1, 2, 1, 1)
        self._dc_block_length_range = Range(0, 1000, 2, 32, 200)
        self._dc_block_length_win = RangeWidget(self._dc_block_length_range,
                                                self.set_dc_block_length,
                                                'DC block width',
                                                "counter_slider", int)
        self.top_grid_layout.addWidget(self._dc_block_length_win, 1, 5, 1, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024 * 2,  #size
            samp_rate,  #samp_rate
            "Reconstructed Signal",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.1)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

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

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

        if not False:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_f(
            1024 * 10,  #size
            firdes.WIN_HAMMING,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Reconstructed Signal",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(1)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_AUTO, 0.0,
                                                    0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0_0.enable_grid(False)
        self.qtgui_freq_sink_x_0_0.set_fft_average(0.05)
        self.qtgui_freq_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0.enable_control_panel(False)

        if not False:
            self.qtgui_freq_sink_x_0_0.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_0_0_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, filter_frequency, filter_width,
                            firdes.WIN_HAMMING, 6.76))
        self._gain_range = Range(0, 10, .1, 1.1, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Gain',
                                     "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_win, 1, 4, 1, 1)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(dc_block_length, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((2, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/Users/Tyson/Documents/Academic/ELEN3024/Labs/Lab3/audio/modulated_single_tone_signal.dat',
            True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Ejemplo n.º 21
0
 def init(self, taps=16):
     self.gr_block = filter.dc_blocker_ff(16, long_form=False)
Ejemplo n.º 22
0
Archivo: vor2.py Proyecto: jmalsbury/oa
	def __init__(self, fm_subcarrier=9960, zero_point=-5):
		grc_wxgui.top_block_gui.__init__(self, title="VOR Receiver")

		##################################################
		# Parameters
		##################################################
		self.fm_subcarrier = fm_subcarrier
		self.zero_point = zero_point

		##################################################
		# Variables
		##################################################
		self.rf_rate = rf_rate = 1000000
		self.dir_rate = dir_rate = 10
		self.channel_rate = channel_rate = 40000
		self.audio_rate = audio_rate = 10000
		self.vor_freq = vor_freq = 113.9e6
		self.volume = volume = 0
		self.rf_scale = rf_scale = int(rf_rate/channel_rate) + rf_rate % channel_rate
		self.offset = offset = fm_subcarrier + 4000
		self.dir_scale = dir_scale = int(audio_rate/dir_rate) + audio_rate % dir_rate
		self.channel = channel = 113.9e6
		self.audio_scale = audio_scale = int(channel_rate/audio_rate) + channel_rate % audio_rate

		##################################################
		# Blocks
		##################################################
		_volume_sizer = wx.BoxSizer(wx.VERTICAL)
		self._volume_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			label='volume',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._volume_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_volume_sizer,
			value=self.volume,
			callback=self.set_volume,
			minimum=-10,
			maximum=10,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_volume_sizer)
		self._channel_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.channel,
			callback=self.set_channel,
			label="Channel (Hz)",
			converter=forms.float_converter(),
		)
		self.Add(self._channel_text_box)
		self.zeroer = blocks.add_const_vff((zero_point*(math.pi/180), ))
		self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
			self.GetWin(),
			unit="deg",
			minval=-180,
			maxval=180,
			factor=180/math.acos(-1),
			decimal_places=2,
			ref_level=0,
			sample_rate=dir_rate,
			number_rate=dir_rate,
			average=True,
			avg_alpha=.25,
			label="Direction",
			peak_hold=False,
			show_gauge=True,
		)
		self.Add(self.wxgui_numbersink2_0.win)
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=channel,
			y_per_div=10,
			y_divs=10,
			ref_level=0,
			ref_scale=2.0,
			sample_rate=channel_rate,
			fft_size=1024,
			fft_rate=15,
			average=True,
			avg_alpha=0.25,
			title="Channel",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self._vor_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.vor_freq,
			callback=self.set_vor_freq,
			label='vor_freq',
			converter=forms.float_converter(),
		)
		self.Add(self._vor_freq_text_box)
		self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
		        interpolation=40,
		        decimation=1,
		        taps=None,
		        fractional_bw=None,
		)
		self.low_pass_filter_1 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, dir_rate, 1, 2, firdes.WIN_HAMMING, 6.76))
		self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
			1, channel_rate, 10000, 4000, firdes.WIN_HAMMING, 6.76))
		self.goertzel_fc_0_0 = fft.goertzel_fc(channel_rate, dir_scale*audio_scale, 30)
		self.goertzel_fc_0 = fft.goertzel_fc(audio_rate, dir_scale, 30)
		self.freq_xlating_fir_filter_xxx_0_0 = filter.freq_xlating_fir_filter_ccc(1, (firdes.low_pass(1.0, channel_rate, 500, 100, firdes.WIN_HAMMING)), fm_subcarrier, channel_rate)
		self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(rf_scale, (firdes.low_pass(1.0, rf_rate, channel_rate, channel_rate/2, firdes.WIN_HAMMING)), 900, rf_rate)
		self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True)
		self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 1e6)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((10**(volume/10), ))
		self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
		self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/john/apps/aviation_rx/woodside_vor25.dat", True)
		self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, int(channel_rate/30*0.0))
		self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
		self.audio_sink_0 = audio.sink(audio_rate, "", True)
		self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)
		self.analog_am_demod_cf_0 = analog.am_demod_cf(
			channel_rate=40e3,
			audio_decim=4,
			audio_pass=5000,
			audio_stop=5500,
		)
		self.analog_agc2_xx_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_1.set_max_gain(65536)
		self.analog_agc2_xx_0_1_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1_0.set_max_gain(100)
		self.analog_agc2_xx_0_1 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
		self.analog_agc2_xx_0_1.set_max_gain(100)

		##################################################
		# Connections
		##################################################
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.low_pass_filter_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0, 0))
		self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_delay_0, 0))
		self.connect((self.analog_quadrature_demod_cf_0, 0), (self.goertzel_fc_0_0, 0))
		self.connect((self.goertzel_fc_0, 0), (self.analog_agc2_xx_0_1, 0))
		self.connect((self.goertzel_fc_0_0, 0), (self.analog_agc2_xx_0_1_0, 0))
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
		self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.blocks_delay_0, 0), (self.freq_xlating_fir_filter_xxx_0_0, 0))
		self.connect((self.blocks_complex_to_arg_0, 0), (self.zeroer, 0))
		self.connect((self.zeroer, 0), (self.wxgui_numbersink2_0, 0))
		self.connect((self.low_pass_filter_1, 0), (self.blocks_complex_to_arg_0, 0))
		self.connect((self.analog_agc2_xx_0_1, 0), (self.blocks_multiply_conjugate_cc_0, 0))
		self.connect((self.analog_agc2_xx_0_1_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
		self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.low_pass_filter_1, 0))
		self.connect((self.low_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.goertzel_fc_0, 0))
		self.connect((self.analog_am_demod_cf_0, 0), (self.dc_blocker_xx_0, 0))
		self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_throttle_0, 0))
		self.connect((self.blocks_file_source_0, 0), (self.rational_resampler_xxx_0, 0))
		self.connect((self.blocks_throttle_0, 0), (self.analog_agc2_xx_1, 0))
		self.connect((self.analog_agc2_xx_1, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
Ejemplo n.º 23
0
    def __init__(self, antenna=satnogs.not_set_antenna, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=1000, enable_iq_dump=0, file_path='test.wav', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', udp_IP='127.0.0.1', udp_port=16887, waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "FSK9600 AX.25 decoder ")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[rx_sdr_device]['samp_rate']
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 9600
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000, firdes.WIN_HAMMING, 6.76)

        self.modulation_index = modulation_index = deviation / (baud_rate / 2.0)
        self.filter_rate = filter_rate = 250000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.audio_gain = audio_gain = satnogs.fm_demod_settings[rx_sdr_device]['audio_gain']

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(((audio_samp_rate) / baud_rate)/(math.pi*modulation_index))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, '/tmp/iq.bin', False, enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm('GND', 0, True, False, 1024)
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) )
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, audio_samp_rate, 7850, audio_samp_rate * 0.15, firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(int(samp_rate_rx/filter_rate), (xlate_filter_taps), lo_offset, samp_rate_rx)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(2.0 * math.pi / 100.0, 2, False)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(48e3/9600, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=48000,
                decimation=int(samp_rate_rx / (int(samp_rate_rx/filter_rate))),
                taps=None,
                fractional_bw=None,
        )
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(((audio_samp_rate) / baud_rate)/(math.pi*modulation_index))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'), (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0), (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_costas_loop_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0), (self.digital_binary_slicer_fb_0, 0))
Ejemplo n.º 24
0
    def __init__(self, MTU=1500):
        gr.top_block.__init__(self, "Telemetry Rx Final")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Telemetry Rx Final")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "telemetry_rx_final")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.MTU = MTU

        ##################################################
        # Variables
        ##################################################
        self.symb_rate = symb_rate = 44643
        self.sec_dec = sec_dec = 10
        self.samp_per_symb = samp_per_symb = 10
        self.rate = rate = 2
        self.polys = polys = [109, 79]
        self.k = k = 7
        self.first_dec = first_dec = 1
        self.ss_ted_gain_range = ss_ted_gain_range = 100
        self.ss_loopbw_range = ss_loopbw_range = 0.4
        self.ss_damping_factor_range = ss_damping_factor_range = 0.5
        self.source_option = source_option = False
        self.pll_loopbw_range = pll_loopbw_range = 0.4
        self.doppler = doppler = 10000


        self.dec_cc = dec_cc = fec.cc_decoder.make(MTU*8, k, rate, (polys), 0, -1, fec.CC_TERMINATED, False)

        self.channel_bw = channel_bw = 1200000
        self.ad_samp_rate = ad_samp_rate = symb_rate*first_dec*sec_dec*samp_per_symb

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Frequency Plot')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Control Tab')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Time')
        self.tab_widget_3 = Qt.QWidget()
        self.tab_layout_3 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_3)
        self.tab_grid_layout_3 = Qt.QGridLayout()
        self.tab_layout_3.addLayout(self.tab_grid_layout_3)
        self.tab.addTab(self.tab_widget_3, 'Demoded Bits')
        self.tab_widget_4 = Qt.QWidget()
        self.tab_layout_4 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_4)
        self.tab_grid_layout_4 = Qt.QGridLayout()
        self.tab_layout_4.addLayout(self.tab_grid_layout_4)
        self.tab.addTab(self.tab_widget_4, 'Decoded Data')
        self.tab_widget_5 = Qt.QWidget()
        self.tab_layout_5 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tab_widget_5)
        self.tab_grid_layout_5 = Qt.QGridLayout()
        self.tab_layout_5.addLayout(self.tab_grid_layout_5)
        self.tab.addTab(self.tab_widget_5, 'Decrypted Data')
        self.top_grid_layout.addWidget(self.tab, 0, 0, 4, 4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._ss_ted_gain_range_range = Range(1, 1000, 1, 100, 10000)
        self._ss_ted_gain_range_win = RangeWidget(self._ss_ted_gain_range_range, self.set_ss_ted_gain_range, 'Symbol Sync TED gain', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_ted_gain_range_win, 1, 2, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(2, 3):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._ss_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._ss_loopbw_range_win = RangeWidget(self._ss_loopbw_range_range, self.set_ss_loopbw_range, 'Symbol Sync LBW', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_loopbw_range_win, 1, 0, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._ss_damping_factor_range_range = Range(0.001, 2, 0.001, 0.5, 10000)
        self._ss_damping_factor_range_win = RangeWidget(self._ss_damping_factor_range_range, self.set_ss_damping_factor_range, 'Symbol Sync DF', "dial", float)
        self.tab_grid_layout_1.addWidget(self._ss_damping_factor_range_win, 1, 1, 1, 1)
        for r in range(1, 2):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(1, 2):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._source_option_options = (True, False, )
        self._source_option_labels = ('AD9361', 'File', )
        self._source_option_group_box = Qt.QGroupBox('Source From')
        self._source_option_box = Qt.QHBoxLayout()
        class variable_chooser_button_group(Qt.QButtonGroup):
            def __init__(self, parent=None):
                Qt.QButtonGroup.__init__(self, parent)
            @pyqtSlot(int)
            def updateButtonChecked(self, button_id):
                self.button(button_id).setChecked(True)
        self._source_option_button_group = variable_chooser_button_group()
        self._source_option_group_box.setLayout(self._source_option_box)
        for i, label in enumerate(self._source_option_labels):
        	radio_button = Qt.QRadioButton(label)
        	self._source_option_box.addWidget(radio_button)
        	self._source_option_button_group.addButton(radio_button, i)
        self._source_option_callback = lambda i: Qt.QMetaObject.invokeMethod(self._source_option_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._source_option_options.index(i)))
        self._source_option_callback(self.source_option)
        self._source_option_button_group.buttonClicked[int].connect(
        	lambda i: self.set_source_option(self._source_option_options[i]))
        self.tab_grid_layout_1.addWidget(self._source_option_group_box, 2, 0, 1, 1)
        for r in range(2, 3):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._pll_loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._pll_loopbw_range_win = RangeWidget(self._pll_loopbw_range_range, self.set_pll_loopbw_range, 'PLL LBW', "dial", float)
        self.tab_grid_layout_1.addWidget(self._pll_loopbw_range_win, 0, 0, 1, 1)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 1):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self._doppler_range = Range(-50000, 50000, 1, 10000, 10000)
        self._doppler_win = RangeWidget(self._doppler_range, self.set_doppler, 'Doppler', "dial", int)
        self.tab_grid_layout_1.addWidget(self._doppler_win, 0, 1, 1, 1)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(1, 2):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self.satellites_decode_rs_general_0 = satellites.decode_rs_general(285, 0, 1, 32, False, True)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=first_dec,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	ad_samp_rate/first_dec, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(True)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not False:
          self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_0.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0 = qtgui.time_sink_f(
        	203, #size
        	1, #samp_rate
        	"GCM-AES Decryptor Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_y_axis(-10, 300)

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

        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "frm_len")
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_1_0_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_5.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_0_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_5.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_5.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1_0 = qtgui.time_sink_f(
        	255, #size
        	1, #samp_rate
        	"Viterbi Decoder Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_y_axis(-10, 300)

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

        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_1_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_4.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_4.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_1 = qtgui.time_sink_f(
        	223, #size
        	1, #samp_rate
        	"Reed-Solomon Decoder Out", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_1.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_1.set_y_axis(-10, 300)

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

        self.qtgui_time_sink_x_0_0_0_0_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_1.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_1.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_1.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_1.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_1_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_1.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_4.addWidget(self._qtgui_time_sink_x_0_0_0_0_1_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_4.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_4.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0_0_0_0 = qtgui.time_sink_f(
        	4144, #size
        	ad_samp_rate/first_dec/sec_dec/samp_per_symb, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0_0_0.set_y_axis(-1, 2)

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

        self.qtgui_time_sink_x_0_0_0_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_TAG, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "pkt_len")
        self.qtgui_time_sink_x_0_0_0_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0_0_0_0_0.enable_stem_plot(False)

        if not False:
          self.qtgui_time_sink_x_0_0_0_0_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_0_0_0_win, 2, 0, 2, 4)
        for r in range(2, 4):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
        	1024, #size
        	ad_samp_rate/first_dec/sec_dec/samp_per_symb, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-20, 20)

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

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

        if not False:
          self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_time_sink_x_0_0_win, 0, 0, 2, 2)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 2):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	ad_samp_rate/first_dec/sec_dec, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-20, 20)

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

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

        if not False:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [2, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_number_sink_0_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_NONE,
            1
        )
        self.qtgui_number_sink_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0.set_title("Decrypted Frame Counter")

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

        self.qtgui_number_sink_0_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_win = sip.wrapinstance(self.qtgui_number_sink_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_number_sink_0_0_win, 0, 3, 2, 1)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(3, 4):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_number_sink_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_NONE,
            2
        )
        self.qtgui_number_sink_0.set_update_time(0.10)
        self.qtgui_number_sink_0.set_title("Received Frame Counter")

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

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._qtgui_number_sink_0_win, 0, 2, 2, 1)
        for r in range(0, 2):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(2, 3):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	ad_samp_rate/first_dec, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-160, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
          self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._qtgui_freq_sink_x_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.tab_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_0.setColumnStretch(c, 1)
        self.low_pass_filter_0 = filter.fir_filter_ccf(sec_dec, firdes.low_pass(
        	1, ad_samp_rate/first_dec, channel_bw, channel_bw/10, firdes.WIN_HAMMING, 6.76))
        self.iustsat_zafar_telemetry_frame_extractor_1 = iustsat.zafar_telemetry_frame_extractor("pkt_len")
        self.iustsat_zafar_telemetry_derand_0 = iustsat.zafar_telemetry_derand("pkt_len")
        self.iustsat_tag_counter_0 = iustsat.tag_counter('pkt_len')
        self.iustsat_synch_detect_tag_1_0 = iustsat.synch_detect_tag(60,'pkt_len',259*2*8)
        self.iustsat_synch_detect_tag_1 = iustsat.synch_detect_tag(60,'pkt_len',259*2*8)
        self.iustsat_rs_to_decrypt_0_0 = iustsat.rs_to_decrypt('iv', ([0xCA, 0xFE, 0xBA, 0xBE, 0xFA, 0xCE, 0xDB, 0xAD, 0xDE, 0xCA, 0xF8, 0x88]), 'aad', 'auth_tag')
        self.iustsat_pdu_to_message_0 = iustsat.pdu_to_message('frm_len')
        self.iustsat_frame_analysis_0 = iustsat.frame_analysis('frm_len')
        self.iio_fmcomms2_source_0 = iio.fmcomms2_source_f32c('192.168.1.10', 436500000+doppler, ad_samp_rate, channel_bw, True, False, 0x8000, True, True, True, "fast_attack", 64.0, "manual", 64.0, "A_BALANCED", '', True)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ([1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1]))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.fec_async_decoder_0 = fec.async_decoder(dec_cc, True, False, MTU)
        self.digital_symbol_sync_xx_0 = digital.symbol_sync_ff(digital.TED_GARDNER, samp_per_symb, ss_loopbw_range, ss_damping_factor_range, ss_ted_gain_range, 1, 1, digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF, 128, ([]))
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(100000, True)
        self.crypto_auth_dec_aes_gcm_0_0 = crypto.auth_dec_aes_gcm(([0xFE, 0xFF, 0xE9, 0x92, 0x86, 0x65, 0x73, 0x1C, 0x6D, 0x6A, 0x8F, 0x94, 0x67, 0x30, 0x83, 0x08]), 16, 96)
        self.blocks_uchar_to_float_1_0 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_1 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, ad_samp_rate,True)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1, False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_pdu_to_tagged_stream_0_0_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream(blocks.float_t, 'frm_len')
        self.blocks_pdu_to_tagged_stream_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'pkt_len')
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'pkt_len')
        self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vcc((source_option, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc(((not source_option), ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((0.066666667, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(samp_per_symb, 10, 4000, 1)
        self.blocks_message_debug_0_0 = blocks.message_debug()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/iust/Documents/zafar_prj/gr-iustsat/examples/Records/REC7_GMSK.bin', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float*1, 63)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 63)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((0, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(pll_loopbw_range, 700000*6.28/(ad_samp_rate/first_dec/sec_dec), 300000*6.28/(ad_samp_rate/first_dec/sec_dec))



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_frame_analysis_0, 'in'))
        self.msg_connect((self.crypto_auth_dec_aes_gcm_0_0, 'pdus'), (self.iustsat_pdu_to_message_0, 'in'))
        self.msg_connect((self.fec_async_decoder_0, 'out'), (self.iustsat_zafar_telemetry_derand_0, 'in'))
        self.msg_connect((self.iustsat_frame_analysis_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_pdu_to_message_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0_0, 'pdus'))
        self.msg_connect((self.iustsat_rs_to_decrypt_0_0, 'out'), (self.crypto_auth_dec_aes_gcm_0_0, 'pdus'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0, 'pdus'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'), (self.satellites_decode_rs_general_0, 'in'))
        self.msg_connect((self.iustsat_zafar_telemetry_frame_extractor_1, 'out'), (self.fec_async_decoder_0, 'in'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.blocks_message_debug_0_0, 'print_pdu'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.satellites_decode_rs_general_0, 'out'), (self.iustsat_rs_to_decrypt_0_0, 'in'))
        self.connect((self.analog_pll_freqdet_cf_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.digital_symbol_sync_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.iustsat_synch_detect_tag_1, 0))
        self.connect((self.blocks_delay_0_0, 0), (self.iustsat_synch_detect_tag_1_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_2_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_uchar_to_float_1, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0, 0), (self.blocks_uchar_to_float_1_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.qtgui_number_sink_0_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0_0, 0), (self.qtgui_time_sink_x_0_0_0_0_1_0_0, 0))
        self.connect((self.blocks_tag_gate_0, 0), (self.blocks_multiply_const_vxx_2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_uchar_to_float_1, 0), (self.qtgui_time_sink_x_0_0_0_0_1, 0))
        self.connect((self.blocks_uchar_to_float_1_0, 0), (self.qtgui_time_sink_x_0_0_0_0_1_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.blocks_uchar_to_float_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_symbol_sync_xx_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.iustsat_synch_detect_tag_1, 1))
        self.connect((self.fir_filter_xxx_0, 0), (self.iustsat_synch_detect_tag_1_0, 1))
        self.connect((self.iio_fmcomms2_source_0, 0), (self.blocks_tag_gate_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_tag_counter_0, 0))
        self.connect((self.iustsat_synch_detect_tag_1, 0), (self.iustsat_zafar_telemetry_frame_extractor_1, 0))
        self.connect((self.iustsat_synch_detect_tag_1_0, 0), (self.qtgui_time_sink_x_0_0_0_0_0, 0))
        self.connect((self.iustsat_tag_counter_0, 0), (self.qtgui_number_sink_0, 0))
        self.connect((self.iustsat_tag_counter_0, 1), (self.qtgui_number_sink_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.analog_pll_freqdet_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
Ejemplo n.º 25
0
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=9600.0,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 mark_frequency=2200.0,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 samp_rate_rx=satnogs.not_set_samp_rate_rx,
                 space_frequency=1200.0,
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "AFSK1200 AX.25 decoder ")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.mark_frequency = mark_frequency
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.space_frequency = space_frequency
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.max_modulation_freq = max_modulation_freq = 3000
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 1200
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(
            ((audio_samp_rate / 10) / baud_rate) / (math.pi * 1))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.satnogs_ax25_decoder_bm_0_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, False, 1024)
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            audio_samp_rate /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.low_pass_filter_1 = filter.fir_filter_ccf(
            10,
            firdes.low_pass(10, audio_samp_rate,
                            (mark_frequency - space_frequency) / 2.0, 1000,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate,
                            deviation + max_modulation_freq, 3000,
                            firdes.WIN_HAMMING, 6.76))
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            (48e3 / 10) / baud_rate, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(
            -2.0 * math.pi *
            (lo_offset /
             satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx)))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            audio_samp_rate, analog.GR_COS_WAVE, -(1200 + 2200) / 2, 1, 0)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            (2 * math.pi * deviation) / audio_samp_rate)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            ((audio_samp_rate / 10) / baud_rate) / (math.pi * 1))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_rotator_cc_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.low_pass_filter_1, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 baudrate=9600.0,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path='test.ogg',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 samp_rate_rx=satnogs.not_set_samp_rate_rx,
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "AMSAT FOX DUV Decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.max_modulation_freq = max_modulation_freq = 3000
        self.deviation = deviation = 5000
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(1.2)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_fox_telem_mm_0 = satnogs.fox_telem_mm()
        self.satnogs_decoder_8b10b_0 = satnogs.decoder_8b10b('0011111010', 960)

        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.satnogs_ccsds_rs_decoder_mm_0 = satnogs.ccsds_rs_decoder_mm()
        self.root_raised_cosine_filter_0 = filter.fir_filter_fff(
            1, firdes.root_raised_cosine(1, 1, 2.4, 0.5, 512))
        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
            audio_samp_rate /
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
            taps=None,
            flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(
            satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.low_pass_filter_1 = filter.fir_filter_fff(
            100,
            firdes.low_pass(1, audio_samp_rate, 195, 10, firdes.WIN_HAMMING,
                            6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate,
                            deviation + max_modulation_freq, 3000,
                            firdes.WIN_HAMMING, 6.76))
        self.digital_clock_recovery_mm_xx_0_0_0 = digital.clock_recovery_mm_ff(
            (audio_samp_rate / 100.0) / 200, 0.25 * 0.175 * 0.175, 0.5, 0.175,
            0.005)
        self.digital_binary_slicer_fb_0_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(
            -2.0 * math.pi *
            (lo_offset /
             satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx)))
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(1.2)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1.0)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ccsds_rs_decoder_mm_0, 'pdu'),
                         (self.satnogs_fox_telem_mm_0, 'in'))
        self.msg_connect((self.satnogs_decoder_8b10b_0, 'pdu'),
                         (self.satnogs_ccsds_rs_decoder_mm_0, 'in'))
        self.msg_connect((self.satnogs_fox_telem_mm_0, 'raw'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_fox_telem_mm_0, 'raw'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.low_pass_filter_1, 0))
        self.connect((self.blocks_rotator_cc_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.root_raised_cosine_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0_0, 0),
                     (self.satnogs_decoder_8b10b_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0_0_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.root_raised_cosine_filter_0, 0),
                     (self.digital_clock_recovery_mm_xx_0_0_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0_0, 0))
Ejemplo n.º 27
0
	def __init__(self, filepath_in):
		gr.top_block.__init__(self)
		#grc_wxgui.top_block_gui.__init__(self, title="Top Block")

		##################################################
		# Variables
		##################################################
		self.samp_rate = samp_rate = 200e3
		self.bb_interpolation = bb_interpolation = 100
		self.bb_decimation = bb_decimation = 612
		self.samples_per_symbol = samples_per_symbol = 4
		self.gain_mu = gain_mu = 0.03
		self.bb_rate = bb_rate = float(samp_rate) * bb_interpolation / bb_decimation
		self.bb_filter_freq = bb_filter_freq = 10e3
		self.omega = omega = samples_per_symbol
		self.mu = mu = 0.5
		self.gain_omega = gain_omega = 0.25 * gain_mu * gain_mu
		self.bb_taps = bb_taps = gr.firdes.low_pass(1.0, samp_rate, bb_filter_freq, bb_filter_freq * 0.1)
		self.baud_rate = baud_rate = bb_rate / samples_per_symbol
		#self.average = average = 64

		##################################################
		# Blocks
		##################################################
		# self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f(
		# 			self.GetWin(),
		# 			title="Scope Plot",
		# 			sample_rate=baud_rate,
		# 			v_scale=0,
		# 			v_offset=0,
		# 			t_scale=0,
		# 			ac_couple=False,
		# 			xy_mode=False,
		# 			num_inputs=1,
		# 			trig_mode=gr.gr_TRIG_MODE_NORM,
		# 			y_axis_label="Counts",
		# 		)
		# self.Add(self.wxgui_scopesink2_1_0_0.win)
		#self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (bb_taps), 6e3, samp_rate)
		self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb("10101010101010101010101010101", 1)
		self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(omega, gain_omega, mu, gain_mu, 0.0002)
		self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
		self.dc_blocker_xx_0 = filter.dc_blocker_ff(64, True)
		#self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float()
		#self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
		#self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/mnt/hgfs/tmp/rf_captures/315.000m_200.000k_20130623_133451_extract_am_2.cfile", True)
		self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, filepath_in, False)
		self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
			interpolation=bb_interpolation,
			decimation=bb_decimation,
			taps=None,
			fractional_bw=None,
		)
		# _bb_filter_freq_sizer = wx.BoxSizer(wx.VERTICAL)
		# self._bb_filter_freq_text_box = forms.text_box(
		# 	parent=self.GetWin(),
		# 	sizer=_bb_filter_freq_sizer,
		# 	value=self.bb_filter_freq,
		# 	callback=self.set_bb_filter_freq,
		# 	label="BB Freq",
		# 	converter=forms.int_converter(),
		# 	proportion=0,
		# )
		# self._bb_filter_freq_slider = forms.slider(
		# 	parent=self.GetWin(),
		# 	sizer=_bb_filter_freq_sizer,
		# 	value=self.bb_filter_freq,
		# 	callback=self.set_bb_filter_freq,
		# 	minimum=5e3,
		# 	maximum=30e3,
		# 	num_steps=250,
		# 	style=wx.SL_HORIZONTAL,
		# 	cast=int,
		# 	proportion=1,
		# )
		# self.Add(_bb_filter_freq_sizer)
		# _average_sizer = wx.BoxSizer(wx.VERTICAL)
		# self._average_text_box = forms.text_box(
		# 	parent=self.GetWin(),
		# 	sizer=_average_sizer,
		# 	value=self.average,
		# 	callback=self.set_average,
		# 	label="Average Length",
		# 	converter=forms.int_converter(),
		# 	proportion=0,
		# )
		# self._average_slider = forms.slider(
		# 	parent=self.GetWin(),
		# 	sizer=_average_sizer,
		# 	value=self.average,
		# 	callback=self.set_average,
		# 	minimum=0,
		# 	maximum=256,
		# 	num_steps=256,
		# 	style=wx.SL_HORIZONTAL,
		# 	cast=int,
		# 	proportion=1,
		# )
		# self.Add(_average_sizer)

		##################################################
		# Connections
		##################################################
		self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
		self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_correlate_access_code_bb_0, 0))
		#self.connect((self.digital_correlate_access_code_bb_0, 0), (self.blocks_uchar_to_float_0_0, 0))
		#self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
		#self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0))
		self.connect((self.blocks_complex_to_mag_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.dc_blocker_xx_0, 0))
		self.connect((self.dc_blocker_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
		#self.connect((self.blocks_uchar_to_float_0_0, 0), (self.wxgui_scopesink2_1_0_0, 0))
		#self.connect((self.blocks_file_source_0_0, 0), (self.blocks_throttle_0, 0))
		#self.connect((self.blocks_file_source_0_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
		self.connect((self.blocks_file_source_0_0, 0), (self.blocks_complex_to_mag_0, 0))

		self.packetizer = Packetizer(82)
		self.connect((self.digital_correlate_access_code_bb_0, 0), (self.packetizer, 0))
Ejemplo n.º 28
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=30,
                taps=None,
                fractional_bw=None,
        )
        self.iir_filter_xxx_2 = filter.iir_filter_ffd((10, ), (1, .95), True)
        self.iir_filter_xxx_1 = filter.iir_filter_ffd((1/(5e3), ), ([1,1]), True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd(([1,0.95]), ([1,0]), False)
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(8192, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.blocks_add_xx_2 = blocks.add_vff(1)
        self.blocks_add_xx_1_0 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.audio_sink_0 = audio.sink(32000, "", True)
        self.analog_sig_source_x_3 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 1000, 1, 0)
        self.analog_sig_source_x_2_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_1_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 5000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 300000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -300000, 1, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(5e-6)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.01, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.analog_phase_modulator_fc_0, 0), (self.blocks_multiply_xx_0_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1))    
        self.connect((self.analog_sig_source_x_1_0, 0), (self.blocks_add_xx_1_0, 1))    
        self.connect((self.analog_sig_source_x_2_0, 0), (self.blocks_add_xx_2, 1))    
        self.connect((self.analog_sig_source_x_3, 0), (self.blocks_add_xx_1_0, 0))    
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_add_xx_1_0, 0), (self.blocks_add_xx_2, 0))    
        self.connect((self.blocks_add_xx_2, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.blocks_complex_to_arg_0, 0), (self.iir_filter_xxx_2, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.hilbert_fc_0, 0))    
        self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))    
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.blocks_complex_to_arg_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_delay_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))    
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.hilbert_fc_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.iir_filter_xxx_1, 0))    
        self.connect((self.iir_filter_xxx_1, 0), (self.analog_phase_modulator_fc_0, 0))    
        self.connect((self.iir_filter_xxx_2, 0), (self.rational_resampler_xxx_1, 0))    
        self.connect((self.rational_resampler_xxx_1, 0), (self.dc_blocker_xx_0, 0))    
Ejemplo n.º 29
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.quad_rate = quad_rate = 640000
        self.audio_rate = audio_rate = 40000

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "FM")
        self.n.AddPage(grc_wxgui.Panel(self.n), "FFT")
        self.Add(self.n)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.n.GetPage(0).GetWin(),
        	title="Scope Plot",
        	sample_rate=audio_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.n.GetPage(0).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.n.GetPage(1).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=audio_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.n.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=16,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_fff(16, firdes.low_pass(
        	1, quad_rate, 15000, 4000, firdes.WIN_HAMMING, 6.76))
        self.iir_filter_xxx_2 = filter.iir_filter_ffd(([1,0]), ([1,0.95]), True)
        self.iir_filter_xxx_1 = filter.iir_filter_ffd(([1,-0.95]), ([1,0]), True)
        self.iir_filter_xxx_0 = filter.iir_filter_ffd((25e-6, ), ([1,1]), True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, audio_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_1 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_sig_source_x_2 = analog.sig_source_c(quad_rate, analog.GR_COS_WAVE, 100000, 1, 0)
        self.analog_sig_source_x_1 = analog.sig_source_f(audio_rate, analog.GR_COS_WAVE, 1100, 0.5, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(audio_rate, analog.GR_COS_WAVE, 11000, .5, 0)
        self.analog_phase_modulator_fc_0 = analog.phase_modulator_fc(2*3.14*75000)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, .2, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.blocks_add_xx_1, 1))    
        self.connect((self.analog_phase_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.iir_filter_xxx_1, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_delay_0, 0))    
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_multiply_xx_1, 0))    
        self.connect((self.blocks_complex_to_real_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_conjugate_cc_0, 0), (self.blocks_multiply_xx_1, 1))    
        self.connect((self.blocks_delay_0, 0), (self.blocks_conjugate_cc_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_1, 0))    
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_complex_to_real_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.iir_filter_xxx_2, 0))    
        self.connect((self.iir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.iir_filter_xxx_1, 0), (self.iir_filter_xxx_0, 0))    
        self.connect((self.iir_filter_xxx_2, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_phase_modulator_fc_0, 0))    
Ejemplo n.º 30
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="AM_RX")

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 0.020
        self.transmission_width = transmission_width = 100
        self.samp_rate = samp_rate = 256000
        self.resamp_factor = resamp_factor = 4
        self.cut_off_freq = cut_off_freq = 5000

        ##################################################
        # Blocks
        ##################################################
        _volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            label='Audio Volume',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_volume_sizer,
            value=self.volume,
            callback=self.set_volume,
            minimum=0,
            maximum=0.050,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_volume_sizer)
        self.notebook = self.notebook = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "Bef. 1st rational sampler")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "After 1st rational sampler")
        self.notebook.AddPage(
            grc_wxgui.Panel(self.notebook),
            "Comparison of input-output of 1st rational sampler")
        self.Add(self.notebook)
        self.wxgui_fftsink2_0_0_1_0 = fftsink2.fft_sink_c(
            self.notebook.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (Before first rational sampler)',
            peak_hold=False,
        )
        self.notebook.GetPage(2).Add(self.wxgui_fftsink2_0_0_1_0.win)
        self.wxgui_fftsink2_0_0_1 = fftsink2.fft_sink_c(
            self.notebook.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (Before first rational sampler)',
            peak_hold=False,
        )
        self.notebook.GetPage(2).Add(self.wxgui_fftsink2_0_0_1.win)
        self.wxgui_fftsink2_0_0_0_0 = fftsink2.fft_sink_c(
            self.notebook.GetPage(2).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (After LPF)',
            peak_hold=False,
        )
        self.notebook.GetPage(2).Add(self.wxgui_fftsink2_0_0_0_0.win)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_c(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (After first rational sampler)',
            peak_hold=False,
        )
        self.notebook.GetPage(1).Add(self.wxgui_fftsink2_0_0_0.win)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.notebook.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (Before first rational sampler)',
            peak_hold=False,
        )
        self.notebook.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate / resamp_factor,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot (After second rational sampler)',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=resamp_factor,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=resamp_factor,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, samp_rate, cut_off_freq, transmission_width,
                            firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (volume, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/Users/ampoulog/Documents/gnuradio/Wireless-communication-systems-Lab/Lab2/example6/am_usrp710.dat',
            True)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.audio_sink_0 = audio.sink(48000, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.wxgui_fftsink2_0_0_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_fftsink2_0_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.wxgui_fftsink2_0_0_1_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.wxgui_fftsink2_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Lab 2 Task 2")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 2 Task 2")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "lab2_task2")

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=32000,
            decimation=960000,
            taps=None,
            fractional_bw=None)
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate, 15000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(100)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_float * 1,
            '/home/ipsit/Documents/EE 340/Lab 2/lab2_task2.dat', True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.audio_sink_0 = audio.sink(32000, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
Ejemplo n.º 32
0
 def __make_dc_blocker(self):
     # We use the DC blocker even when we also have a band pass filter because it is (TODO verify) cheaper than a sharp filter.
     return grfilter.dc_blocker_ff(
         self.__demod_rate // _am_lower_cutoff_freq, False)
Ejemplo n.º 33
0
    def __init__(self, filepath_in):
        gr.top_block.__init__(self)
        #grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 200e3
        self.bb_interpolation = bb_interpolation = 100
        self.bb_decimation = bb_decimation = 612
        self.samples_per_symbol = samples_per_symbol = 4
        self.gain_mu = gain_mu = 0.03
        self.bb_rate = bb_rate = float(
            samp_rate) * bb_interpolation / bb_decimation
        self.bb_filter_freq = bb_filter_freq = 10e3
        self.omega = omega = samples_per_symbol
        self.mu = mu = 0.5
        self.gain_omega = gain_omega = 0.25 * gain_mu * gain_mu
        self.bb_taps = bb_taps = gr.firdes.low_pass(1.0, samp_rate,
                                                    bb_filter_freq,
                                                    bb_filter_freq * 0.1)
        self.baud_rate = baud_rate = bb_rate / samples_per_symbol
        #self.average = average = 64

        ##################################################
        # Blocks
        ##################################################
        # self.wxgui_scopesink2_1_0_0 = scopesink2.scope_sink_f(
        # 			self.GetWin(),
        # 			title="Scope Plot",
        # 			sample_rate=baud_rate,
        # 			v_scale=0,
        # 			v_offset=0,
        # 			t_scale=0,
        # 			ac_couple=False,
        # 			xy_mode=False,
        # 			num_inputs=1,
        # 			trig_mode=gr.gr_TRIG_MODE_NORM,
        # 			y_axis_label="Counts",
        # 		)
        # self.Add(self.wxgui_scopesink2_1_0_0.win)
        #self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (bb_taps), 6e3, samp_rate)
        self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb(
            "10101010101010101010101010101", 1)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            omega, gain_omega, mu, gain_mu, 0.0002)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(64, True)
        #self.blocks_uchar_to_float_0_0 = blocks.uchar_to_float()
        #self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        #self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/mnt/hgfs/tmp/rf_captures/315.000m_200.000k_20130623_133451_extract_am_2.cfile", True)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1, filepath_in, False)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_fff(
            interpolation=bb_interpolation,
            decimation=bb_decimation,
            taps=None,
            fractional_bw=None,
        )
        # _bb_filter_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        # self._bb_filter_freq_text_box = forms.text_box(
        # 	parent=self.GetWin(),
        # 	sizer=_bb_filter_freq_sizer,
        # 	value=self.bb_filter_freq,
        # 	callback=self.set_bb_filter_freq,
        # 	label="BB Freq",
        # 	converter=forms.int_converter(),
        # 	proportion=0,
        # )
        # self._bb_filter_freq_slider = forms.slider(
        # 	parent=self.GetWin(),
        # 	sizer=_bb_filter_freq_sizer,
        # 	value=self.bb_filter_freq,
        # 	callback=self.set_bb_filter_freq,
        # 	minimum=5e3,
        # 	maximum=30e3,
        # 	num_steps=250,
        # 	style=wx.SL_HORIZONTAL,
        # 	cast=int,
        # 	proportion=1,
        # )
        # self.Add(_bb_filter_freq_sizer)
        # _average_sizer = wx.BoxSizer(wx.VERTICAL)
        # self._average_text_box = forms.text_box(
        # 	parent=self.GetWin(),
        # 	sizer=_average_sizer,
        # 	value=self.average,
        # 	callback=self.set_average,
        # 	label="Average Length",
        # 	converter=forms.int_converter(),
        # 	proportion=0,
        # )
        # self._average_slider = forms.slider(
        # 	parent=self.GetWin(),
        # 	sizer=_average_sizer,
        # 	value=self.average,
        # 	callback=self.set_average,
        # 	minimum=0,
        # 	maximum=256,
        # 	num_steps=256,
        # 	style=wx.SL_HORIZONTAL,
        # 	cast=int,
        # 	proportion=1,
        # )
        # self.Add(_average_sizer)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_correlate_access_code_bb_0, 0))
        #self.connect((self.digital_correlate_access_code_bb_0, 0), (self.blocks_uchar_to_float_0_0, 0))
        #self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        #self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blks2_rational_resampler_xxx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        #self.connect((self.blocks_uchar_to_float_0_0, 0), (self.wxgui_scopesink2_1_0_0, 0))
        #self.connect((self.blocks_file_source_0_0, 0), (self.blocks_throttle_0, 0))
        #self.connect((self.blocks_file_source_0_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_complex_to_mag_0, 0))

        self.packetizer = Packetizer(82)
        self.connect((self.digital_correlate_access_code_bb_0, 0),
                     (self.packetizer, 0))
Ejemplo n.º 34
0
 def __make_dc_blocker(self):
     # We use the DC blocker even when we also have a band pass filter because it is (TODO verify) cheaper than a sharp filter.
     return grfilter.dc_blocker_ff(self.__demod_rate // _am_lower_cutoff_freq, False)
Ejemplo n.º 35
0
    def __init__(self):
        gr.top_block.__init__(self, "Audio Filter")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Audio Filter")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "Audio_Filter")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_qtgui_range_4 = variable_qtgui_range_4 = 3000
        self.variable_qtgui_range_3 = variable_qtgui_range_3 = 3000
        self.variable_qtgui_range_2 = variable_qtgui_range_2 = 1
        self.variable_qtgui_range_1 = variable_qtgui_range_1 = 2700
        self.variable_qtgui_range_0 = variable_qtgui_range_0 = 200
        self.step = step = 10
        self.samp_rate = samp_rate = 6000

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_range_4_range = Range(0, 3000, step, 3000, 200)
        self._variable_qtgui_range_4_win = RangeWidget(
            self._variable_qtgui_range_4_range,
            self.set_variable_qtgui_range_4, 'HIGH BLOCK', "counter_slider",
            float)
        self.top_layout.addWidget(self._variable_qtgui_range_4_win)
        self._variable_qtgui_range_3_range = Range(0, 3000, step, 3000, 200)
        self._variable_qtgui_range_3_win = RangeWidget(
            self._variable_qtgui_range_3_range,
            self.set_variable_qtgui_range_3, 'LOW BLOCK', "counter_slider",
            float)
        self.top_layout.addWidget(self._variable_qtgui_range_3_win)
        self._variable_qtgui_range_2_range = Range(0, 10, 0.1, 1, 200)
        self._variable_qtgui_range_2_win = RangeWidget(
            self._variable_qtgui_range_2_range,
            self.set_variable_qtgui_range_2, 'VOLUME', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_2_win)
        self._variable_qtgui_range_1_range = Range(0, 3000, step, 2700, 200)
        self._variable_qtgui_range_1_win = RangeWidget(
            self._variable_qtgui_range_1_range,
            self.set_variable_qtgui_range_1, 'Low  PASS', "counter_slider",
            float)
        self.top_layout.addWidget(self._variable_qtgui_range_1_win)
        self._variable_qtgui_range_0_range = Range(0, 3000, step, 200, 200)
        self._variable_qtgui_range_0_win = RangeWidget(
            self._variable_qtgui_range_0_range,
            self.set_variable_qtgui_range_0, 'High PASS', "counter_slider",
            float)
        self.top_layout.addWidget(self._variable_qtgui_range_0_win)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "Output",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not False)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Input',  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not False:
            self.qtgui_freq_sink_x_1.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_1.set_plot_pos_half(not False)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.band_reject_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_reject(1, samp_rate, variable_qtgui_range_3,
                               variable_qtgui_range_4, 10, firdes.WIN_HAMMING,
                               6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(variable_qtgui_range_2, samp_rate,
                             variable_qtgui_range_0, variable_qtgui_range_1,
                             10, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(samp_rate, '', True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.audio_source_0, 0), (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.band_reject_filter_0, 0))
        self.connect((self.band_reject_filter_0, 0), (self.audio_sink_0, 0))
        self.connect((self.band_reject_filter_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.band_pass_filter_0, 0))
Ejemplo n.º 36
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Dsbsc")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

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

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.wxgui_fftsink2_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
    def __init__(self,
                 antenna=satnogs.not_set_antenna,
                 bb_gain=satnogs.not_set_rx_bb_gain,
                 decoded_data_file_path='/tmp/.satnogs/data/data',
                 dev_args=satnogs.not_set_dev_args,
                 doppler_correction_per_sec=1000,
                 enable_iq_dump=0,
                 file_path='test.wav',
                 if_gain=satnogs.not_set_rx_if_gain,
                 iq_file_path='/tmp/iq.dat',
                 lo_offset=100e3,
                 ppm=0,
                 rf_gain=satnogs.not_set_rx_rf_gain,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 rx_sdr_device='usrpb200',
                 udp_IP='127.0.0.1',
                 udp_port=16887,
                 waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "FSK9600 AX.25 decoder with G3RUH support")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_rx = samp_rate_rx = satnogs.hw_rx_settings[
            rx_sdr_device]['samp_rate']
        self.deviation = deviation = 5000
        self.baud_rate = baud_rate = 9600
        self.xlate_filter_taps = xlate_filter_taps = firdes.low_pass(
            1, samp_rate_rx, 125000, 25000, firdes.WIN_HAMMING, 6.76)

        self.taps = taps = firdes.low_pass(12.0, samp_rate_rx, 100e3, 60000,
                                           firdes.WIN_HAMMING, 6.76)

        self.modulation_index = modulation_index = deviation / (baud_rate /
                                                                2.0)
        self.filter_rate = filter_rate = 250000
        self.audio_samp_rate = audio_samp_rate = 48000
        self.audio_gain = audio_gain = satnogs.fm_demod_settings[
            rx_sdr_device]['audio_gain']

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(
            udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_quad_demod_filter_ff_0 = satnogs.quad_demod_filter_ff(
            ((audio_samp_rate) / baud_rate) / (math.pi * modulation_index))
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(
            decoded_data_file_path, 0)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(
            rx_freq, samp_rate_rx)
        self.satnogs_ax25_decoder_bm_0 = satnogs.ax25_decoder_bm(
            'GND', 0, True, True, 1024)
        self.osmosdr_source_0 = osmosdr.source(
            args="numchan=" + str(1) + " " +
            satnogs.handle_rx_dev_args(rx_sdr_device, dev_args))
        self.osmosdr_source_0.set_sample_rate(samp_rate_rx)
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(
            satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(
            satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(
            satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(
            satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(samp_rate_rx, 0)

        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, audio_samp_rate, 7850, audio_samp_rate * 0.15,
                            firdes.WIN_HAMMING, 6.76))
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            int(samp_rate_rx / filter_rate), (xlate_filter_taps), lo_offset,
            samp_rate_rx)
        self.digital_costas_loop_cc_0 = digital.costas_loop_cc(
            2.0 * math.pi / 100.0, 2, False)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            48e3 / 9600, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blks2_rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=48000,
            decimation=int(samp_rate_rx / (int(samp_rate_rx / filter_rate))),
            taps=None,
            fractional_bw=None,
        )
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(
            ((audio_samp_rate) / baud_rate) / (math.pi * modulation_index))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_ax25_decoder_bm_0, 'pdu'),
                         (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.blks2_rational_resampler_xxx_1, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.satnogs_ax25_decoder_bm_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.satnogs_quad_demod_filter_ff_0, 0))
        self.connect((self.digital_costas_loop_cc_0, 0),
                     (self.blks2_rational_resampler_xxx_1, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.digital_costas_loop_cc_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.osmosdr_source_0, 0),
                     (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.satnogs_quad_demod_filter_ff_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
Ejemplo n.º 38
0
    def __init__(self):
        gr.top_block.__init__(self, "vor_record_sigmf")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("vor_record_sigmf")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "vor_playback_sigmf")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.throttle_rate = throttle_rate = 1
        self.samp_rate = samp_rate = 250e3
        self.fine = fine = 0
        self.decim = decim = 5
        self.audio_gain_30hz = audio_gain_30hz = 1
        self.alpha = alpha = .02

        ##################################################
        # Blocks
        ##################################################
        self._throttle_rate_tool_bar = Qt.QToolBar(self)
        self._throttle_rate_tool_bar.addWidget(
            Qt.QLabel("throttle_rate" + ": "))
        self._throttle_rate_line_edit = Qt.QLineEdit(str(self.throttle_rate))
        self._throttle_rate_tool_bar.addWidget(self._throttle_rate_line_edit)
        self._throttle_rate_line_edit.returnPressed.connect(
            lambda: self.set_throttle_rate(
                eng_notation.str_to_num(
                    str(self._throttle_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._throttle_rate_tool_bar, 0, 6, 1,
                                       2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._samp_rate_tool_bar = Qt.QToolBar(self)
        self._samp_rate_tool_bar.addWidget(Qt.QLabel("samp_rate" + ": "))
        self._samp_rate_line_edit = Qt.QLineEdit(str(self.samp_rate))
        self._samp_rate_tool_bar.addWidget(self._samp_rate_line_edit)
        self._samp_rate_line_edit.returnPressed.connect(
            lambda: self.set_samp_rate(
                eng_notation.str_to_num(
                    str(self._samp_rate_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._samp_rate_tool_bar, 0, 4, 1, 2)
        for r in range(0, 1):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._fine_tool_bar = Qt.QToolBar(self)
        self._fine_tool_bar.addWidget(Qt.QLabel('Fine [Hz]' + ": "))
        self._fine_line_edit = Qt.QLineEdit(str(self.fine))
        self._fine_tool_bar.addWidget(self._fine_line_edit)
        self._fine_line_edit.returnPressed.connect(lambda: self.set_fine(
            eng_notation.str_to_num(str(self._fine_line_edit.text().toAscii()))
        ))
        self.top_grid_layout.addWidget(self._fine_tool_bar, 1, 4, 1, 2)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.sigmf_source_0 = gr_sigmf.source(
            '/captures/20191216/VOR_2019-12-16T18:51:17Z.sigmf-data',
            "cf32" + ("_le" if sys.byteorder == "little" else "_be"), False)
        self.rational_resampler_xxx_2 = filter.rational_resampler_fff(
            interpolation=66,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=66,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0_0 = filter.rational_resampler_ccc(
            interpolation=24,
            decimation=25,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=decim,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.010)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        if not True:
            self.qtgui_waterfall_sink_x_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        colors = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)

        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4,
                                       0, 4, 4)
        for r in range(4, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate / decim / 25 * 24,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                    qtgui.TRIG_SLOPE_POS, 0, 0,
                                                    0, "")
        self.qtgui_time_sink_x_0_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0_0.enable_grid(True)
        self.qtgui_time_sink_x_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win, 6, 4,
                                       2, 4)
        for r in range(6, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            8192,  #size
            samp_rate / decim / 25 * 24,  #samp_rate
            "30 Hz Variable",  #name
            2  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.0010)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM,
                                                  qtgui.TRIG_SLOPE_POS, 0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(True)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        if not True:
            self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "blue"
        ]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 4, 4, 2,
                                       4)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            4096,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate / decim / 25 * 24,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        if not True:
            self.qtgui_freq_sink_x_1.disable_legend()

        if "float" == "float" or "float" == "msg_float":
            self.qtgui_freq_sink_x_1.set_plot_pos_half(not False)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_win, 0, 0, 4,
                                       4)
        for r in range(0, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.low_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(10, samp_rate / decim / 25 * 24, 1e3, 500,
                            firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.low_pass(1, 48e3, 1, 1, firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate * throttle_rate,
                                                 True)
        self.blocks_multiply_xx_3 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_integrate_xx_2 = blocks.integrate_ff(66, 1)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(66, 1)
        self.blocks_float_to_complex_2 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_0_0 = blocks.divide_ff(1)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_delay_1 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 0)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_arg_0 = blocks.complex_to_arg(1)
        self.band_pass_filter_0_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5,
                             firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.band_pass(1, samp_rate / decim / 25 * 24, 25, 35, 5,
                             firdes.WIN_HAMMING, 6.76))
        self._audio_gain_30hz_tool_bar = Qt.QToolBar(self)
        self._audio_gain_30hz_tool_bar.addWidget(Qt.QLabel('vol30' + ": "))
        self._audio_gain_30hz_line_edit = Qt.QLineEdit(
            str(self.audio_gain_30hz))
        self._audio_gain_30hz_tool_bar.addWidget(
            self._audio_gain_30hz_line_edit)
        self._audio_gain_30hz_line_edit.returnPressed.connect(
            lambda: self.set_audio_gain_30hz(
                eng_notation.str_to_num(
                    str(self._audio_gain_30hz_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._audio_gain_30hz_tool_bar, 1, 7, 1,
                                       1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(7, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.analog_sig_source_x_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 9960, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * fine, 1, 0)
        self.analog_pll_carriertracking_cc_0 = analog.pll_carriertracking_cc(
            math.pi / 200, math.pi / 10, -math.pi / 10)
        self.analog_fm_demod_cf_0 = analog.fm_demod_cf(
            channel_rate=samp_rate / decim / 25 * 24,
            audio_decim=1,
            deviation=1e3,
            audio_pass=100,
            audio_stop=200,
            gain=1.0,
            tau=75e-6,
        )
        self.analog_const_source_x_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
            channel_rate=48e3,
            audio_decim=1,
            audio_pass=12000,
            audio_stop=13000,
        )
        self.analog_agc2_xx_0 = analog.agc2_cc(1e-1, 1e-2, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(65536)
        self._alpha_tool_bar = Qt.QToolBar(self)
        self._alpha_tool_bar.addWidget(Qt.QLabel('alpha' + ": "))
        self._alpha_line_edit = Qt.QLineEdit(str(self.alpha))
        self._alpha_tool_bar.addWidget(self._alpha_line_edit)
        self._alpha_line_edit.returnPressed.connect(lambda: self.set_alpha(
            eng_notation.str_to_num(str(self._alpha_line_edit.text().toAscii())
                                    )))
        self.top_grid_layout.addWidget(self._alpha_tool_bar, 1, 6, 1, 1)
        for r in range(1, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 7):
            self.top_grid_layout.setColumnStretch(c, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc2_xx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.low_pass_filter_0_0, 0))
        self.connect((self.analog_am_demod_cf_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_fm_demod_cf_0, 0),
                     (self.band_pass_filter_0_0, 0))
        self.connect((self.analog_pll_carriertracking_cc_0, 0),
                     (self.rational_resampler_xxx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_1, 1))
        self.connect((self.band_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.band_pass_filter_0_0, 0),
                     (self.dc_blocker_xx_0_0, 0))
        self.connect((self.blocks_complex_to_arg_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_divide_xx_0_0, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_xx_3, 0))
        self.connect((self.blocks_delay_1, 0), (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.blocks_float_to_complex_2, 0))
        self.connect((self.blocks_divide_xx_0_0, 0),
                     (self.blocks_float_to_complex_2, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_float_to_complex_2, 0),
                     (self.blocks_complex_to_arg_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_integrate_xx_2, 0),
                     (self.rational_resampler_xxx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.analog_agc2_xx_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0),
                     (self.analog_fm_demod_cf_0, 0))
        self.connect((self.blocks_multiply_xx_2, 0),
                     (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_multiply_xx_3, 0),
                     (self.blocks_integrate_xx_2, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_delay_1, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.blocks_multiply_xx_3, 1))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.low_pass_filter_0, 0),
                     (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_pll_carriertracking_cc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.analog_am_demod_cf_0, 0))
        self.connect((self.rational_resampler_xxx_0_0_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_divide_xx_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_divide_xx_0_0, 0))
        self.connect((self.rational_resampler_xxx_2, 0),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.sigmf_source_0, 0), (self.blocks_throttle_0, 0))
Ejemplo n.º 39
0
    def __init__(self,
                 baudrate,
                 samp_rate,
                 iq,
                 deviation=None,
                 subaudio=False,
                 dc_block=True,
                 dump_path=None,
                 options=None):
        gr.hier_block2.__init__(
            self, 'fsk_demodulator',
            gr.io_signature(1, 1,
                            gr.sizeof_gr_complex if iq else gr.sizeof_float),
            gr.io_signature(1, 1, gr.sizeof_float))
        options_block.__init__(self, options)

        use_agc = self.options.use_agc or not iq
        if self.options.disable_dc_block:
            dc_block = False

        if dump_path is not None:
            dump_path = pathlib.Path(dump_path)

        if deviation is not None:
            _deviation = deviation
        else:
            _deviation = self.options.deviation

        # Prevent problems due to baudrate too high
        if baudrate >= samp_rate:
            print(
                f'Sample rate {samp_rate} sps insufficient for {baudrate} '
                'baud FSK demodulation. Demodulator will not work.',
                file=sys.stderr)
            baudrate = samp_rate / 2

        if iq:
            # Cut to Carson's bandwidth rule before quadrature demod.
            # Note that _deviation can be negative to encode that the
            # low tone corresponds to the symbol 1 and the high tone
            # corresponds to the symbol 0.
            carson_cutoff = abs(_deviation) + baudrate / 2
            self.demod = analog.quadrature_demod_cf(samp_rate /
                                                    (2 * pi * _deviation))
            if carson_cutoff >= samp_rate / 2:
                # Sample rate is already narrower than Carson's
                # bandwidth. Do not filter
                self.connect(self, self.demod)
            else:
                # Sample rate is wider than Carson's bandwidth.
                # Lowpass filter before demod.
                fir_taps = firdes.low_pass(1, samp_rate, carson_cutoff,
                                           0.1 * carson_cutoff)
                self.demod_filter = filter.fir_filter_ccf(1, fir_taps)
                self.connect(self, self.demod_filter, self.demod)
        else:
            self.demod = self

        sps = samp_rate / baudrate
        max_sps = 10
        if sps > max_sps:
            decimation = ceil(sps / max_sps)
        else:
            decimation = 1
        sps /= decimation

        if subaudio:
            # some not-so-bad filter parameters for subaudio processing
            subaudio_cutoff = 2.0 / 3.0 * baudrate
            subaudio_transition = subaudio_cutoff / 4.0
            subaudio_taps = firdes.low_pass(1, samp_rate, subaudio_cutoff,
                                            subaudio_transition)
            self.subaudio_lowpass = filter.fir_filter_fff(1, subaudio_taps)

        # square pulse filter
        sqfilter_len = int(samp_rate / baudrate)
        taps = np.ones(sqfilter_len) / sqfilter_len
        self.lowpass = filter.fir_filter_fff(decimation, taps)

        if dc_block:
            self.dcblock = filter.dc_blocker_ff(ceil(sps * 32), True)
        else:
            self.dcblock = self.lowpass  # to simplify connections below

        if use_agc:
            # This gives a time constant of 50 symbols
            agc_constant = 2e-2 / sps
            self.agc = rms_agc_f(agc_constant, 1)

        if dump_path is not None:
            self.waveform = blocks.file_sink(gr.sizeof_float,
                                             str(dump_path / 'waveform.f32'))

        # "Eempiric" formula for TED gain of Gardner detector
        # 1.47 symbol^{-1}
        ted_gain = 1.47
        damping = 1.0
        self.clock_recovery = digital.symbol_sync_ff(
            digital.TED_GARDNER, sps, self.options.clk_bw, damping, ted_gain,
            self.options.clk_limit * sps, 1,
            digital.constellation_bpsk().base(), digital.IR_PFB_NO_MF)

        if dump_path is not None:
            self.clock_recovery_out = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_out.f32'),
                False)
            self.clock_recovery_err = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_err.f32'),
                False)
            self.clock_recovery_T_inst = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_inst.f32'),
                False)
            self.clock_recovery_T_avg = blocks.file_sink(
                gr.sizeof_float, str(dump_path / 'clock_recovery_T_avg.f32'),
                False)
            self.connect(self.clock_recovery, self.clock_recovery_out)
            self.connect((self.clock_recovery, 1), self.clock_recovery_err)
            self.connect((self.clock_recovery, 2), self.clock_recovery_T_inst)
            self.connect((self.clock_recovery, 3), self.clock_recovery_T_avg)

        conns = [self.demod]
        if subaudio:
            conns.append(self.subaudio_lowpass)
        conns.append(self.lowpass)
        if dc_block:
            conns.append(self.dcblock)
        self.connect(*conns)
        if use_agc:
            self.connect(self.dcblock, self.agc, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.agc, self.waveform)
        else:
            self.connect(self.dcblock, self.clock_recovery)
            if dump_path is not None:
                self.connect(self.dcblock, self.waveform)
        self.connect(self.clock_recovery, self)
Ejemplo n.º 40
0
    def __init__(self):
        gr.top_block.__init__(self, "On Off Keying")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("On Off Keying")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "OnOffKeying")

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100
        self.carrier_freq = carrier_freq = 10000
        self.samp_delay = samp_delay = 0
        self.noise = noise = 0
        self.modulating_freq = modulating_freq = 100
        self.lf = lf = 100
        self.filter_taps = filter_taps = firdes.low_pass(
            1, samp_rate, carrier_freq, 25000, firdes.WIN_HAMMING, 6.76)
        self.bit_delay = bit_delay = 0
        self.Glow = Glow = 3

        ##################################################
        # Blocks
        ##################################################
        self._samp_delay_range = Range(0, 1000, 1, 0, 200)
        self._samp_delay_win = RangeWidget(self._samp_delay_range,
                                           self.set_samp_delay, 'samp_delay',
                                           "counter_slider", float)
        self.top_grid_layout.addWidget(self._samp_delay_win)
        self._noise_range = Range(0, 1, 1e-3, 0, 200)
        self._noise_win = RangeWidget(self._noise_range, self.set_noise,
                                      'noise in [mV]', "counter_slider", float)
        self.top_grid_layout.addWidget(self._noise_win)
        self._lf_range = Range(50, 200, 1, 100, 200)
        self._lf_win = RangeWidget(self._lf_range, self.set_lf,
                                   'Low-pass filter cut-off frequency',
                                   "counter_slider", float)
        self.top_grid_layout.addWidget(self._lf_win)
        self._carrier_freq_range = Range(10000, 100000, 1, 10000, 200)
        self._carrier_freq_win = RangeWidget(self._carrier_freq_range,
                                             self.set_carrier_freq,
                                             'carrier_freq', "counter_slider",
                                             float)
        self.top_grid_layout.addWidget(self._carrier_freq_win)
        self._Glow_range = Range(0.1, 100, 0.1, 3, 200)
        self._Glow_win = RangeWidget(self._Glow_range, self.set_Glow,
                                     'Low-pass filter gain', "counter_slider",
                                     float)
        self.top_grid_layout.addWidget(self._Glow_win)
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
            interpolation=1, decimation=10, taps=None, fractional_bw=None)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=10, decimation=1, taps=None, fractional_bw=None)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "",  #name
            3  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(True)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(3):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
            1024,  #size
            "",  #name
            1  #number of inputs
        )
        self.qtgui_const_sink_x_0.set_update_time(0.10)
        self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                   qtgui.TRIG_SLOPE_POS, 0.0,
                                                   0, "")
        self.qtgui_const_sink_x_0.enable_autoscale(True)
        self.qtgui_const_sink_x_0.enable_grid(False)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "red", "red", "red", "red", "red", "red", "red",
            "red"
        ]
        styles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        markers = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_const_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(
            self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win)
        self._modulating_freq_range = Range(10, 1000, 1, 100, 200)
        self._modulating_freq_win = RangeWidget(self._modulating_freq_range,
                                                self.set_modulating_freq,
                                                'modulating_freq',
                                                "counter_slider", float)
        self.top_grid_layout.addWidget(self._modulating_freq_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(Glow, samp_rate, lf, 1000, firdes.WIN_HAMMING,
                            6.76))
        self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(
            20,
            np.convolve(np.array(filter.firdes.gaussian(1, 20, 1.0, 4 * 20)),
                        np.array((1, ) * 20)))
        self.interp_fir_filter_xxx_0.declare_sample_delay(0)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            1, filter_taps, 0, samp_rate)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(
            20,
            np.convolve(np.array(filter.firdes.gaussian(1, 20, 1.0, 4 * 20)),
                        np.array((1, ) * 20)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            1, 0.25 * 0.175 * 0.175, 0.5, 0.175, 0.005)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf(
            [0, 1], 1)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(320, True)
        self.channels_channel_model_0 = channels.channel_model(
            noise_voltage=noise,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=[1.0 + 1.0j],
            noise_seed=0,
            block_tags=False)
        self.blocks_unpacked_to_packed_xx_0 = blocks.unpacked_to_packed_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
            1, gr.GR_MSB_FIRST)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(0.9)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_char * 1,
            '/mnt/c/Users/David Fernandez Pina/sdr/MyTest.txt', True, 0, 0)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char * 1,
                                                   '/dev/pts/0', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_delay_1 = blocks.delay(gr.sizeof_char * 1, 0)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, samp_delay)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self._bit_delay_range = Range(0, 8, 1, 0, 200)
        self._bit_delay_win = RangeWidget(self._bit_delay_range,
                                          self.set_bit_delay, 'bit_delay',
                                          "counter_slider", int)
        self.top_grid_layout.addWidget(self._bit_delay_win)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, carrier_freq, 1, 0, 0)
        self.analog_sig_source_x_0.set_block_alias("Carrier")

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.dc_blocker_xx_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 2))
        self.connect((self.blocks_delay_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_delay_1, 0),
                     (self.blocks_unpacked_to_packed_xx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.channels_channel_model_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.qtgui_const_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_unpacked_to_packed_xx_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.channels_channel_model_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.blocks_delay_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.interp_fir_filter_xxx_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.interp_fir_filter_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_time_sink_x_0, 1))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.fir_filter_xxx_0, 0))
Ejemplo n.º 41
0
    def __init__(self):
        gr.top_block.__init__(self, "Audio Filter")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Audio Filter")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "Audio_Filter")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.variable_qtgui_range_4 = variable_qtgui_range_4 = 3000
        self.variable_qtgui_range_3 = variable_qtgui_range_3 = 3000
        self.variable_qtgui_range_2 = variable_qtgui_range_2 = 1
        self.variable_qtgui_range_1 = variable_qtgui_range_1 = 2700
        self.variable_qtgui_range_0 = variable_qtgui_range_0 = 200
        self.step = step = 10
        self.samp_rate = samp_rate = 6000

        ##################################################
        # Blocks
        ##################################################
        self._variable_qtgui_range_4_range = Range(0, 3000, step, 3000, 200)
        self._variable_qtgui_range_4_win = RangeWidget(self._variable_qtgui_range_4_range, self.set_variable_qtgui_range_4, 'HIGH BLOCK', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_4_win)
        self._variable_qtgui_range_3_range = Range(0, 3000, step, 3000, 200)
        self._variable_qtgui_range_3_win = RangeWidget(self._variable_qtgui_range_3_range, self.set_variable_qtgui_range_3, 'LOW BLOCK', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_3_win)
        self._variable_qtgui_range_2_range = Range(0, 10, 0.1, 1, 200)
        self._variable_qtgui_range_2_win = RangeWidget(self._variable_qtgui_range_2_range, self.set_variable_qtgui_range_2, 'VOLUME', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_2_win)
        self._variable_qtgui_range_1_range = Range(0, 3000, step, 2700, 200)
        self._variable_qtgui_range_1_win = RangeWidget(self._variable_qtgui_range_1_range, self.set_variable_qtgui_range_1, 'Low  PASS', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_1_win)
        self._variable_qtgui_range_0_range = Range(0, 3000, step, 200, 200)
        self._variable_qtgui_range_0_win = RangeWidget(self._variable_qtgui_range_0_range, self.set_variable_qtgui_range_0, 'High PASS', "counter_slider", float)
        self.top_layout.addWidget(self._variable_qtgui_range_0_win)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	"Output", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)
        
        if not True:
          self.qtgui_waterfall_sink_x_0.disable_legend()
        
        if "float" == "float" or "float" == "msg_float":
          self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not False)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        colors = [0, 0, 0, 0, 0,
                  0, 0, 0, 0, 0]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alphas[i])
        
        self.qtgui_waterfall_sink_x_0.set_intensity_range(-140, 10)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #bw
        	'Input', #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1.enable_autoscale(False)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)
        
        if not False:
          self.qtgui_freq_sink_x_1.disable_legend()
        
        if "float" == "float" or "float" == "msg_float":
          self.qtgui_freq_sink_x_1.set_plot_pos_half(not False)
        
        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_freq_sink_x_1_win)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.band_reject_filter_0 = filter.fir_filter_fff(1, firdes.band_reject(
        	1, samp_rate, variable_qtgui_range_3, variable_qtgui_range_4, 10, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	variable_qtgui_range_2, samp_rate, variable_qtgui_range_0, variable_qtgui_range_1, 10, firdes.WIN_HAMMING, 6.76))
        self.audio_source_0 = audio.source(samp_rate, '', True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.audio_source_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.audio_source_0, 0), (self.qtgui_freq_sink_x_1, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.band_reject_filter_0, 0))    
        self.connect((self.band_reject_filter_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.band_reject_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.band_pass_filter_0, 0))    
    def __init__(self):
        gr.top_block.__init__(self, "Lab 2 Task 1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Lab 2 Task 1")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "lab2_task1_1")

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 960000

        ##################################################
        # Blocks
        ##################################################
        self.tab = Qt.QTabWidget()
        self.tab_widget_0 = Qt.QWidget()
        self.tab_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_0)
        self.tab_grid_layout_0 = Qt.QGridLayout()
        self.tab_layout_0.addLayout(self.tab_grid_layout_0)
        self.tab.addTab(self.tab_widget_0, 'Message')
        self.tab_widget_1 = Qt.QWidget()
        self.tab_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_1)
        self.tab_grid_layout_1 = Qt.QGridLayout()
        self.tab_layout_1.addLayout(self.tab_grid_layout_1)
        self.tab.addTab(self.tab_widget_1, 'Modulated')
        self.tab_widget_2 = Qt.QWidget()
        self.tab_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                          self.tab_widget_2)
        self.tab_grid_layout_2 = Qt.QGridLayout()
        self.tab_layout_2.addLayout(self.tab_grid_layout_2)
        self.tab.addTab(self.tab_widget_2, 'Demodulated')
        self.top_grid_layout.addWidget(self.tab)
        self.freq = Qt.QTabWidget()
        self.freq_widget_0 = Qt.QWidget()
        self.freq_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_0)
        self.freq_grid_layout_0 = Qt.QGridLayout()
        self.freq_layout_0.addLayout(self.freq_grid_layout_0)
        self.freq.addTab(self.freq_widget_0, 'Message')
        self.freq_widget_1 = Qt.QWidget()
        self.freq_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_1)
        self.freq_grid_layout_1 = Qt.QGridLayout()
        self.freq_layout_1.addLayout(self.freq_grid_layout_1)
        self.freq.addTab(self.freq_widget_1, 'Modulated')
        self.freq_widget_2 = Qt.QWidget()
        self.freq_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                           self.freq_widget_2)
        self.freq_grid_layout_2 = Qt.QGridLayout()
        self.freq_layout_2.addLayout(self.freq_grid_layout_2)
        self.freq.addTab(self.freq_widget_2, 'Demodulated')
        self.top_grid_layout.addWidget(self.freq)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            'Demodulated',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.10)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_1.enable_tags(False)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(True)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_axis_labels(True)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        self.qtgui_time_sink_x_1.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_1_win = sip.wrapinstance(
            self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.tab_layout_2.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            "Message",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0_0_0.enable_tags(True)
        self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      qtgui.TRIG_SLOPE_POS,
                                                      0.0, 0, 0, "")
        self.qtgui_time_sink_x_0_0_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0_0_0.enable_grid(False)
        self.qtgui_time_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0_0_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0_0_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0_0_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0_0_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_0.addWidget(self._qtgui_time_sink_x_0_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #samp_rate
            'Modulated',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        self.qtgui_time_sink_x_0.enable_stem_plot(False)

        labels = [
            'Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
            'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            'blue', 'red', 'green', 'black', 'cyan', 'magenta', 'yellow',
            'dark red', 'dark green', 'dark blue'
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
        styles = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tab_layout_1.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_2 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Demodulated',  #name
            1)
        self.qtgui_freq_sink_x_2.set_update_time(0.10)
        self.qtgui_freq_sink_x_2.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_2.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_2.enable_autoscale(True)
        self.qtgui_freq_sink_x_2.enable_grid(False)
        self.qtgui_freq_sink_x_2.set_fft_average(1.0)
        self.qtgui_freq_sink_x_2.enable_axis_labels(True)
        self.qtgui_freq_sink_x_2.enable_control_panel(False)

        self.qtgui_freq_sink_x_2.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_2.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_2.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_2_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_2.pyqwidget(), Qt.QWidget)
        self.freq_layout_2.addWidget(self._qtgui_freq_sink_x_2_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Message',  #name
            1)
        self.qtgui_freq_sink_x_1.set_update_time(0.10)
        self.qtgui_freq_sink_x_1.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_1.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_1.enable_autoscale(True)
        self.qtgui_freq_sink_x_1.enable_grid(False)
        self.qtgui_freq_sink_x_1.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1.enable_control_panel(False)

        self.qtgui_freq_sink_x_1.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_1.pyqwidget(), Qt.QWidget)
        self.freq_layout_0.addWidget(self._qtgui_freq_sink_x_1_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_KAISER,  #wintype
            0,  #fc
            samp_rate,  #bw
            'Modulated',  #name
            1)
        self.qtgui_freq_sink_x_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0,
                                                  "")
        self.qtgui_freq_sink_x_0.enable_autoscale(True)
        self.qtgui_freq_sink_x_0.enable_grid(False)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        self.qtgui_freq_sink_x_0.set_plot_pos_half(not True)

        labels = ['', '', '', '', '', '', '', '', '', '']
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "cyan", "magenta", "yellow",
            "dark red", "dark green", "dark blue"
        ]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]

        for i in range(1):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget)
        self.freq_layout_1.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(
            1,
            firdes.low_pass(2, samp_rate, 15000, 100, firdes.WIN_KAISER, 6.76))
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_throttle_0_0_0 = blocks.throttle(gr.sizeof_float * 1,
                                                     samp_rate, True)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.analog_sig_source_x_1 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 100000, 1, 0, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_COS_WAVE, 10000, 0.5, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_throttle_0_0_0, 0))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_1, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_throttle_0_0_0, 0),
                     (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.blocks_throttle_0_0_0, 0),
                     (self.qtgui_time_sink_x_0_0_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_freq_sink_x_2, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "THD Analyser")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("THD Analyser")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

        self.settings = Qt.QSettings("GNU Radio", "THD_analyser")
        self.restoreGeometry(
            self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.frequency = frequency = 1000
        self.cut_off = cut_off = frequency / 10
        self.transition_width = transition_width = cut_off / 10
        self.samp_rate = samp_rate = 44100

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

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

        self.qtgui_number_sink_0.enable_autoscale(False)
        self._qtgui_number_sink_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_number_sink_0_win)
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.low_pass(1, samp_rate,
                            frequency + cut_off - transition_width,
                            transition_width, firdes.WIN_BLACKMAN, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(
            1,
            firdes.high_pass(1, samp_rate,
                             frequency + cut_off + (transition_width * 1.1),
                             transition_width, firdes.WIN_BLACKMAN, 6.76))
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(32, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(32, True)
        self.blocks_rms_xx_0_0 = blocks.rms_ff(0.0001)
        self.blocks_rms_xx_0 = blocks.rms_ff(0.0001)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float * 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.audio_source_0 = audio.source(samp_rate, '', True)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)
        self.analog_sig_source_x_0 = analog.sig_source_f(
            samp_rate, analog.GR_SIN_WAVE, frequency, 0.5, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.audio_sink_0, 1))
        self.connect((self.audio_source_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.audio_source_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.audio_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_divide_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_number_sink_0, 0))
        self.connect((self.blocks_null_source_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_rms_xx_0, 0), (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_rms_xx_0_0, 0), (self.blocks_divide_xx_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.blocks_rms_xx_0_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.blocks_rms_xx_0, 0))
        self.connect((self.high_pass_filter_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.dc_blocker_xx_0_0, 0))
Ejemplo n.º 44
0
    def __init__(self,
                 antenna="",
                 bb_freq=0.0,
                 bw=0.0,
                 dc_removal="False",
                 decoded_data_file_path="/tmp/.satnogs/data/data",
                 dev_args="",
                 deviation=5e3,
                 doppler_correction_per_sec=20,
                 enable_iq_dump=0,
                 file_path="test.wav",
                 gain=0.0,
                 gain_mode="Overall",
                 iq_file_path="/tmp/iq.dat",
                 lo_offset=100e3,
                 max_modulation_freq=3e3,
                 other_settings="",
                 ppm=0,
                 rigctl_port=4532,
                 rx_freq=100e6,
                 samp_rate_rx=0.0,
                 soapy_rx_device="driver=invalid",
                 stream_args="",
                 tune_args="",
                 udp_IP="127.0.0.1",
                 udp_dump_dest='127.0.0.1',
                 udp_dump_port=7355,
                 udp_port=16887,
                 waterfall_file_path="/tmp/waterfall.dat"):
        gr.top_block.__init__(self, "satnogs_fm")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.bb_freq = bb_freq
        self.bw = bw
        self.dc_removal = dc_removal
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.deviation = deviation
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.gain = gain
        self.gain_mode = gain_mode
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.max_modulation_freq = max_modulation_freq
        self.other_settings = other_settings
        self.ppm = ppm
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.samp_rate_rx = samp_rate_rx
        self.soapy_rx_device = soapy_rx_device
        self.stream_args = stream_args
        self.tune_args = tune_args
        self.udp_IP = udp_IP
        self.udp_dump_dest = udp_dump_dest
        self.udp_dump_port = udp_dump_port
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.audio_samp_rate = audio_samp_rate = 48000
        self.decimation = decimation = max(
            4, satnogs.find_decimation(audio_samp_rate, 2, audio_samp_rate))

        ##################################################
        # Blocks
        ##################################################
        self.soapy_source_0_0 = None
        # Make sure that the gain mode is valid
        if (gain_mode not in ['Overall', 'Specific', 'Settings Field']):
            raise ValueError(
                "Wrong gain mode on channel 0. Allowed gain modes: "
                "['Overall', 'Specific', 'Settings Field']")

        dev = soapy_rx_device

        # Stream arguments for every activated stream
        tune_args = [tune_args]
        settings = [other_settings]

        # Setup the device arguments
        dev_args = dev_args

        self.soapy_source_0_0 = soapy.source(1, dev, dev_args, stream_args,
                                             tune_args, settings, samp_rate_rx,
                                             "fc32")

        self.soapy_source_0_0.set_dc_removal(
            0, bool(distutils.util.strtobool(dc_removal)))

        # Set up DC offset. If set to (0, 0) internally the source block
        # will handle the case if no DC offset correction is supported
        self.soapy_source_0_0.set_dc_offset(0, 0)

        # Setup IQ Balance. If set to (0, 0) internally the source block
        # will handle the case if no IQ balance correction is supported
        self.soapy_source_0_0.set_iq_balance(0, 0)

        self.soapy_source_0_0.set_agc(0, False)

        # generic frequency setting should be specified first
        self.soapy_source_0_0.set_frequency(0, rx_freq - lo_offset)

        self.soapy_source_0_0.set_frequency(0, "BB", bb_freq)

        # Setup Frequency correction. If set to 0 internally the source block
        # will handle the case if no frequency correction is supported
        self.soapy_source_0_0.set_frequency_correction(0, ppm)

        self.soapy_source_0_0.set_antenna(0, antenna)

        self.soapy_source_0_0.set_bandwidth(0, bw)

        if (gain_mode != 'Settings Field'):
            # pass is needed, in case the template does not evaluare anything
            pass
            self.soapy_source_0_0.set_gain(0, gain)
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(
            audio_samp_rate, rx_freq, 10, 1024, waterfall_file_path, 1)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source(
            "127.0.0.1", rigctl_port, False,
            int(1000.0 / doppler_correction_per_sec) + 1, 1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(
            file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False,
                                                 enable_iq_dump)
        self.satnogs_doppler_compensation_0 = satnogs.doppler_compensation(
            samp_rate_rx, rx_freq, lo_offset, audio_samp_rate, 1, 0)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            1,
            firdes.low_pass(1, audio_samp_rate,
                            deviation + max_modulation_freq, 1000,
                            firdes.WIN_HAMMING, 6.76))
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_udp_sink_0_0 = blocks.udp_sink(gr.sizeof_gr_complex * 1,
                                                   udp_dump_dest,
                                                   udp_dump_port + 1, 1472,
                                                   True)
        self.blocks_udp_sink_0 = blocks.udp_sink(gr.sizeof_short * 1,
                                                 udp_dump_dest, udp_dump_port,
                                                 1472, True)
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 16383.0)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(
            (2 * math.pi * deviation) / audio_samp_rate)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'),
                         (self.satnogs_doppler_compensation_0, 'doppler'))
        self.connect((self.analog_quadrature_demod_cf_0, 0),
                     (self.dc_blocker_xx_0_0, 0))
        self.connect((self.blocks_float_to_short_0, 0),
                     (self.blocks_udp_sink_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.blocks_float_to_short_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0),
                     (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.blocks_udp_sink_0_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.satnogs_iq_sink_0, 0))
        self.connect((self.satnogs_doppler_compensation_0, 0),
                     (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.soapy_source_0_0, 0),
                     (self.satnogs_doppler_compensation_0, 0))
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.audio_rate = audio_rate = int(48e3)
        self.rtl_rate = rtl_rate = int(240e3)
        self.out_intermediary_rate = out_intermediary_rate = audio_rate*4
        self.out_gain = out_gain = .25
        self.out_frequency_offset = out_frequency_offset = -50e3
        self.out_frequency = out_frequency = 145.521e6
        self.out_audio_inverted = out_audio_inverted = True
        self.in_frequency_offset = in_frequency_offset = 0
        self.in_frequency = in_frequency = 145.551e6
        self.in_final_gain = in_final_gain = 0.5
        self.in_decimation_factor = in_decimation_factor = 8
        self.in_audio_inverted = in_audio_inverted = True
        self.hackrf_rate = hackrf_rate = 2e6
        self.dstar_bandwidth = dstar_bandwidth = 6.5e3

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(rtl_rate)
        self.rtlsdr_source_0.set_center_freq(in_frequency+in_frequency_offset, 0)
        self.rtlsdr_source_0.set_freq_corr(69, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna("", 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)
          
        self.rational_resampler_xxx_3 = filter.rational_resampler_ccc(
                interpolation=int(hackrf_rate),
                decimation=out_intermediary_rate,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "" )
        self.osmosdr_sink_0.set_sample_rate(hackrf_rate)
        self.osmosdr_sink_0.set_center_freq(out_frequency-out_frequency_offset, 0)
        self.osmosdr_sink_0.set_freq_corr(4, 0)
        self.osmosdr_sink_0.set_gain(14, 0)
        self.osmosdr_sink_0.set_if_gain(0, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna("0", 0)
        self.osmosdr_sink_0.set_bandwidth(100e3, 0)
          
        self.low_pass_filter_1 = filter.fir_filter_ccf(5, firdes.low_pass(
        	1, rtl_rate, dstar_bandwidth*2, 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, audio_rate, dstar_bandwidth*2, 200, firdes.WIN_KAISER, 6.76))
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(1, (1, ), 0-out_frequency_offset, out_intermediary_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(128, True)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff(((-1 if out_audio_inverted else 1)*out_gain, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((0-in_final_gain if in_audio_inverted else in_final_gain, ))
        self.audio_source_0 = audio.source(audio_rate, "hw:10,1", True)
        self.audio_sink_1 = audio.sink(audio_rate, "plughw:11,0", True)
        self.analog_pwr_squelch_xx_1 = analog.pwr_squelch_cc(-30, 1, 1, False)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(-60, 1, 1, True)
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
        	audio_rate=int(audio_rate),
        	quad_rate=int(out_intermediary_rate),
        	tau=0,
        	max_dev=dstar_bandwidth,
        )
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=audio_rate,
        	quad_rate=audio_rate,
        	tau=0.000000000000000000001,
        	max_dev=dstar_bandwidth*2,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.analog_nbfm_tx_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0))    
        self.connect((self.analog_pwr_squelch_xx_0, 0), (self.blocks_multiply_const_vxx_2, 0))    
        self.connect((self.analog_pwr_squelch_xx_1, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self.audio_source_0, 0), (self.dc_blocker_xx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.audio_sink_1, 0))    
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.dc_blocker_xx_0, 0), (self.analog_pwr_squelch_xx_0, 0))    
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.rational_resampler_xxx_3, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.analog_nbfm_tx_0, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.analog_pwr_squelch_xx_1, 0))    
        self.connect((self.rational_resampler_xxx_3, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_1, 0))    
Ejemplo n.º 46
0
    def __init__(self, antenna=satnogs.not_set_antenna, baudrate=9600.0, bb_gain=satnogs.not_set_rx_bb_gain, decoded_data_file_path='/tmp/.satnogs/data/data', dev_args=satnogs.not_set_dev_args, doppler_correction_per_sec=1000, enable_iq_dump=0, file_path='test.wav', if_gain=satnogs.not_set_rx_if_gain, iq_file_path='/tmp/iq.dat', lo_offset=100e3, ppm=0, rf_gain=satnogs.not_set_rx_rf_gain, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', samp_rate_rx=satnogs.not_set_samp_rate_rx, udp_IP='127.0.0.1', udp_port=16887, waterfall_file_path='/tmp/waterfall.dat'):
        gr.top_block.__init__(self, "satnogs_reaktor_hello_world_fsk9600_decoder")

        ##################################################
        # Parameters
        ##################################################
        self.antenna = antenna
        self.baudrate = baudrate
        self.bb_gain = bb_gain
        self.decoded_data_file_path = decoded_data_file_path
        self.dev_args = dev_args
        self.doppler_correction_per_sec = doppler_correction_per_sec
        self.enable_iq_dump = enable_iq_dump
        self.file_path = file_path
        self.if_gain = if_gain
        self.iq_file_path = iq_file_path
        self.lo_offset = lo_offset
        self.ppm = ppm
        self.rf_gain = rf_gain
        self.rigctl_port = rigctl_port
        self.rx_freq = rx_freq
        self.rx_sdr_device = rx_sdr_device
        self.samp_rate_rx = samp_rate_rx
        self.udp_IP = udp_IP
        self.udp_port = udp_port
        self.waterfall_file_path = waterfall_file_path

        ##################################################
        # Variables
        ##################################################
        self.variable_whitening_0 = variable_whitening_0 = satnogs.whitening_make(0x21, 0x1FF, 8)
        self.audio_samp_rate = audio_samp_rate = 48000

        ##################################################
        # Blocks
        ##################################################
        self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1)
        self.satnogs_udp_msg_sink_0_0 = satnogs.udp_msg_sink(udp_IP, udp_port, 1500)
        self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500)
        self.satnogs_ogg_encoder_0 = satnogs.ogg_encoder(file_path, audio_samp_rate, 1.0)
        self.satnogs_iq_sink_0 = satnogs.iq_sink(16768, iq_file_path, False, enable_iq_dump)
        self.satnogs_frame_file_sink_0_1_0 = satnogs.frame_file_sink(decoded_data_file_path, 0)
        self.satnogs_frame_acquisition_0 = satnogs.frame_acquisition(1, [0xAA, 0xAA, 0xAA, 0xAA], 4, [0x35, 0x2E, 0x35, 0x2E], 3, 1, 256, 3, variable_whitening_0, 2048)
        self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.pfb_arb_resampler_xxx_0_0 = pfb.arb_resampler_ccf(
        	  (2.0*baudrate)/audio_samp_rate,
                  taps=None,
        	  flt_size=32)
        self.pfb_arb_resampler_xxx_0_0.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0 = pfb.arb_resampler_ccf(
        	  audio_samp_rate/satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx),
                  taps=None,
        	  flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.handle_rx_dev_args(rx_sdr_device, dev_args) )
        self.osmosdr_source_0.set_sample_rate(satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx))
        self.osmosdr_source_0.set_center_freq(rx_freq - lo_offset, 0)
        self.osmosdr_source_0.set_freq_corr(ppm, 0)
        self.osmosdr_source_0.set_dc_offset_mode(2, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(satnogs.handle_rx_rf_gain(rx_sdr_device, rf_gain), 0)
        self.osmosdr_source_0.set_if_gain(satnogs.handle_rx_if_gain(rx_sdr_device, if_gain), 0)
        self.osmosdr_source_0.set_bb_gain(satnogs.handle_rx_bb_gain(rx_sdr_device, bb_gain), 0)
        self.osmosdr_source_0.set_antenna(satnogs.handle_rx_antenna(rx_sdr_device, antenna), 0)
        self.osmosdr_source_0.set_bandwidth(satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx), 0)

        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2, 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.dc_blocker_xx_0_0 = filter.dc_blocker_ff(1024, True)
        self.dc_blocker_xx_0 = filter.dc_blocker_ff(1024, True)
        self.blocks_rotator_cc_0 = blocks.rotator_cc(-2.0 * math.pi * (lo_offset / satnogs.handle_samp_rate_rx(rx_sdr_device, samp_rate_rx)))
        self.analog_quadrature_demod_cf_0_0_0 = analog.quadrature_demod_cf(0.9)
        self.analog_quadrature_demod_cf_0_0 = analog.quadrature_demod_cf(1.2)



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.satnogs_frame_acquisition_0, 'out'), (self.satnogs_frame_file_sink_0_1_0, 'frame'))
        self.msg_connect((self.satnogs_frame_acquisition_0, 'out'), (self.satnogs_udp_msg_sink_0_0, 'in'))
        self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq'))
        self.connect((self.analog_quadrature_demod_cf_0_0, 0), (self.dc_blocker_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0_0_0, 0), (self.dc_blocker_xx_0_0, 0))
        self.connect((self.blocks_rotator_cc_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0))
        self.connect((self.dc_blocker_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.dc_blocker_xx_0_0, 0), (self.satnogs_ogg_encoder_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.satnogs_frame_acquisition_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.blocks_rotator_cc_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.analog_quadrature_demod_cf_0_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.pfb_arb_resampler_xxx_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.satnogs_iq_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0), (self.satnogs_waterfall_sink_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0), (self.analog_quadrature_demod_cf_0_0, 0))
        self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.pfb_arb_resampler_xxx_0, 0))
Ejemplo n.º 47
0
 def init(self, taps=16):
     self.gr_block = filter.dc_blocker_ff(16, long_form=False)