Example #1
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Blocks
        ##################################################
        self.blocks_uchar_to_float_1 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((8e-3, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((8e-3, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/home/yann/Documents/INSA/5SEC/Drone/Dongle/script_grc/capture.bin", True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, "/home/yann/Documents/INSA/5SEC/Drone/Dongle/script_grc/capture.c", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_char*1, 1)
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((-127, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-127, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_const_vxx_1, 0))    
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_uchar_to_float_0, 0))    
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_uchar_to_float_1, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_deinterleave_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_uchar_to_float_1, 0), (self.blocks_add_const_vxx_1, 0))    
Example #2
0
    def __init__(self, N=512 , NW=3 , K=5, weighting='adaptive', fftshift=False):
        gr.hier_block2.__init__(self, "mtm",
                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                gr.io_signature(1, 1, gr.sizeof_float*N))
        self.check_parameters(N, NW, K)

        self.s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, N)
        self.connect(self, self.s2v)

        dpss = specest_gendpss.gendpss(N=N, NW=NW, K=K)
        self.mtm = [eigenspectrum(dpss.dpssarray[i], fftshift) for i in xrange(K)]
        if weighting == 'adaptive':
            self.sum = specest_swig.adaptiveweighting_vff(N, dpss.lambdas)
            self.connect_mtm(K)
            self.connect(self.sum, self)
        elif weighting == 'unity':
            self.sum = blocks.add_ff(N)
            self.divide = blocks.multiply_const_vff([1./K]*N)
            self.connect_mtm(K)
            self.connect(self.sum, self.divide, self)
        elif weighting == 'eigenvalues':
            self.eigvalmulti = []
            self.lambdasum = 0
            for i in xrange(K):
                self.eigvalmulti.append(blocks.multiply_const_vff([dpss.lambdas[i]]*N))
                self.lambdasum += dpss.lambdas[i]
            self.divide = blocks.multiply_const_vff([1./self.lambdasum]*N)
            self.sum = blocks.add_ff(N)
            self.connect_mtm(K)
            self.connect(self.sum, self.divide, self)
        else:
            raise ValueError, 'weighting-type should be: adaptive, unity or eigenvalues'
Example #3
0
    def __init__(self, bits=16):
        gr.hier_block2.__init__(
            self, "Quantizer",
            gr.io_signature(1, 1, gr.sizeof_float*1),
            gr.io_signature(1, 1, gr.sizeof_float*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.bits = bits

        ##################################################
        # Blocks
        ##################################################
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((1.0/pow(2.0,bits-1.0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((pow(2,bits-1.0), ))
        self.blocks_float_to_short_0 = blocks.float_to_short(1, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self, 0))
        self.connect((self.blocks_short_to_float_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_float_to_short_0, 0), (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_short_0, 0))
        self.connect((self, 0), (self.blocks_multiply_const_vxx_0, 0))
Example #4
0
    def __init__(self, options):
        gr.hier_block2.__init__(self, "ReadByteFile",
                                gr.io_signature(0, 0, 0),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        ##################################################
        # Blocks
        ##################################################
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, options.source, False)
        self.blocks_deinterleave_0 = blocks.deinterleave(gr.sizeof_char*1)
        self.blocks_uchar_to_float_1 = blocks.uchar_to_float()
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((8e-3, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((8e-3, ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((-127, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-127, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, options.rate, True)

        self.connect((self.blocks_file_source_0, 0), (self.blocks_deinterleave_0, 0))
        self.connect((self.blocks_deinterleave_0, 0), (self.blocks_uchar_to_float_0, 0))
        self.connect((self.blocks_deinterleave_0, 1), (self.blocks_uchar_to_float_1, 0))
        self.connect((self.blocks_uchar_to_float_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_uchar_to_float_1, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self, 0))
Example #5
0
    def __init__(self, magnitude=0, phase=0):
        gr.hier_block2.__init__(
            self, "IQ Imbalance Generator",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.magnitude = magnitude
        self.phase = phase

        ##################################################
        # Blocks
        ##################################################
        self.mag = blocks.multiply_const_vff((math.pow(10,magnitude/20.0), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((math.sin(phase*math.pi/180.0), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex_0, 0), (self, 0))
        self.connect((self, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.mag, 0))
        self.connect((self.mag, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0))
Example #6
0
    def __init__(self, preamble_len, spread_factor, oversample_factor, pn_mask, pn_seed):
        gr.hier_block2.__init__(self,
                "pn_acquisition",
                gr.io_signature(1, 1, gr.sizeof_float),
                gr.io_signature(1, 1, gr.sizeof_float))

        self.preamble_len = preamble_len;

        # Blocks
        self.blocks_multiply_const_0 = blocks.multiply_const_vff((preamble_len, ))
        self.blocks_multiply_const_1 = blocks.multiply_const_vff((preamble_len, ))

        # Connections
        self.connect(self, self.blocks_multiply_const_0, self.blocks_multiply_const_1, self)
    def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0):
        gr.hier_block2.__init__(
            self, "Clock offset corrector",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )
        if version(gr.version()) >= version('3.7.9'):
            self.message_port_register_hier_in("ppm_in")
        else:
            self.message_port_register_hier_out("ppm_in")

        ##################################################
        # Parameters
        ##################################################
        self.fc = fc
        self.ppm = ppm
        self.samp_rate_in = samp_rate_in

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_out = samp_rate_out = samp_rate_in

        ##################################################
        # Blocks
        ##################################################
        self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(0,samp_rate_out)
        self.gsm_controlled_const_source_f_0 = grgsm.controlled_const_source_f(ppm)
        self.fractional_resampler_xx_0 = filter.fractional_resampler_cc(0, samp_rate_in/samp_rate_out)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((1.0e-6*samp_rate_in/samp_rate_out, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((fc/samp_rate_out*(2*math.pi)/1e6, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((samp_rate_in/samp_rate_out, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.fractional_resampler_xx_0, 0))
        self.connect((self.fractional_resampler_xx_0, 0), (self.gsm_controlled_rotator_cc_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.fractional_resampler_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.gsm_controlled_rotator_cc_0, 1))
        self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0))
        self.connect((self.gsm_controlled_const_source_f_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.gsm_controlled_const_source_f_0, 0), (self.blocks_multiply_const_vxx_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self, "ppm_in", self.gsm_controlled_const_source_f_0, "constant_msg")
Example #8
0
    def __init__(self):
        gr.hier_block2.__init__(
            self, "NBFM Chain",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_float*1),
        )

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=192000,
                decimation=2400000,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_1 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, 192000, 5e3, 5e3, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((5, ))
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
        	audio_rate=48000,
        	quad_rate=192000,
        	tau=75e-6,
        	max_dev=2.5e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_rx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self, 0))    
        self.connect((self.low_pass_filter_1, 0), (self.analog_nbfm_rx_0, 0))    
        self.connect((self, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_1, 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))
    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.transition = transition = 1000000
        self.samp_rate = samp_rate = 2000000
        self.quadrature = quadrature = 500000
        self.cutoff = cutoff = 100000
        self.audio_decimation = audio_decimation = 10

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + "" )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(107.8e6, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(20, 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_1 = filter.rational_resampler_fff(
                interpolation=2000,
                decimation=500,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, cutoff, transition, firdes.WIN_HAMMING, 6.76))
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=quadrature,
        	audio_decimation=audio_decimation,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rtlsdr_source_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_null_sink_0, 0))
    def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0):
        grgsm.hier_block.__init__(
            self, "Clock offset corrector",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )
        self.message_port_register_hier_in("ppm_in")
        
        ##################################################
        # Parameters
        ##################################################
        self.fc = fc
        self.ppm = ppm
        self.samp_rate_in = samp_rate_in

        ##################################################
        # Variables
        ##################################################
        self.samp_rate_out = samp_rate_out = samp_rate_in

        ##################################################
        # Blocks
        ##################################################
        self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(0,samp_rate_out)
        self.gsm_controlled_const_source_f_0 = grgsm.controlled_const_source_f(ppm)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((fc/samp_rate_out*(2*math.pi)/1e6, ))

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self, 'ppm_in'), (self.gsm_controlled_const_source_f_0, 'constant_msg'))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.gsm_controlled_rotator_cc_0, 1))    
        self.connect((self.gsm_controlled_const_source_f_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.gsm_controlled_rotator_cc_0, 0), (self, 0))    
        self.connect((self, 0), (self.gsm_controlled_rotator_cc_0, 0))    
Example #12
0
	def __init__(self, fft_size=2048, decim=100):
		gr.hier_block2.__init__(
			self, "RA:FFT",
			gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
			gr.io_signature(1, 1, gr.sizeof_float*fft_size),
		)

		##################################################
		# Parameters
		##################################################
		self.fft_size = fft_size
		self.decim = decim

		##################################################
		# Blocks
		##################################################
		self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(1.0/decim, fft_size)
		self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.blackmanharris(1024)), True, 1)
		self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
		self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(([1.0/fft_size]*fft_size))
		self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*fft_size, decim)
		self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(fft_size)

		##################################################
		# Connections
		##################################################
		self.connect((self.blocks_multiply_const_vxx_0, 0), (self.single_pole_iir_filter_xx_0, 0))
		self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0))
		self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_keep_one_in_n_0, 0))
		self.connect((self.fft_vxx_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
		self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
		self.connect((self, 0), (self.blocks_stream_to_vector_0, 0))
		self.connect((self.blocks_keep_one_in_n_0, 0), (self, 0))
Example #13
0
def topblock(self, carrier=32000, samp_rate = 80000, bw=1000, amp=1):
    gr.top_block.__init__(self, "Top Block")

    ##################################################
    # Variables
    ##################################################
    self.samp_rate = samp_rate 
    self.carrier = carrier 
    self.bw = bw

    self.source = blocks.vector_source_b((0,0), False, 1, [])

    self.sink = blocks.multiply_vcc(1)
    analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, carrier, amp, 0)
    blocks_complex_to_real_0 = blocks.complex_to_real(1)
    stereo = blocks.multiply_const_vff((-1, ))
    self.out = blocks.wavfile_sink("/tmp/outbits.wav", 2, samp_rate)

    ##################################################
    # Connections
    ##################################################
    self.connect((analog_sig_source_x_0, 0), (self.sink, 1))
    self.connect((self.sink, 0), (blocks_complex_to_real_0, 0))
    self.connect((blocks_complex_to_real_0, 0), (self.out, 0))
    self.connect((blocks_complex_to_real_0, 0), (stereo, 0))
    self.connect((stereo, 0), (self.out, 1))
Example #14
0
	def _update_filtered(self, translated):
		if translated is not None and self._taps is not None:
			filtered = TimeData(numpy.complex64(scipy.signal.lfilter(self._taps, 1, translated.samples)), translated.sampling_rate)
			filtered_abs = filtered.abs

			data_source = filtered_abs.samples
			numpy_source = NumpySource(data_source)
			peak_detector = blocks.peak_detector_fb(1.0, 0.3, 10, 0.001)
			sample_and_hold = blocks.sample_and_hold_ff()
			multiply_const = blocks.multiply_const_vff((0.5, ))
			subtract = blocks.sub_ff(1)
			numpy_sink = NumpySink(numpy.float32)
			top = gr.top_block()
			top.connect((numpy_source, 0), (peak_detector, 0))
			top.connect((numpy_source, 0), (sample_and_hold, 0))
			top.connect((numpy_source, 0), (subtract, 0))
			top.connect((peak_detector, 0), (sample_and_hold, 1))
			top.connect((sample_and_hold, 0), (multiply_const, 0))
			top.connect((multiply_const, 0), (subtract, 1))
			top.connect((subtract, 0), (numpy_sink, 0))
			top.run()
			filtered = TimeData(numpy_sink.data, translated.sampling_rate)

			self.filtered_view.data = filtered
			# abs_min = filtered.abs.min
			# abs_max = filtered.abs.max
			# abs_mid = (abs_min + abs_max) / 2.0

			# self.burst.filtered = filtered.abs - abs_mid
			self.burst.filtered = filtered
		else:
			self.filtered_view.data = None
			self.burst.filtered = None
Example #15
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Transmisor")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100
        self.fcmod = fcmod = 0
        self.fc = fc = 0

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_time_source("gpsdo", 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(fc, 0)
        self.uhd_usrp_sink_0.set_gain(0, 0)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
          constellation_points=4,
          mod_code="gray",
          differential=True,
          samples_per_symbol=2,
          excess_bw=0.35,
          verbose=False,
          log=False,
          )
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((127, ))
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_b(grc_blks2.packet_encoder(
        		samples_per_symbol=2,
        		bits_per_symbol=1,
        		access_code="",
        		pad_for_usrp=False,
        	),
        	payload_length=0,
        )
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fcmod, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blks2_packet_encoder_0, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.digital_psk_mod_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0))
Example #16
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Receptor")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 44100
        self.fcdemod = fcdemod = 0
        self.fc = fc = 0

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	device_addr="",
        	stream_args=uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_clock_source("gpsdo", 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(fc, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.digital_psk_demod_0 = digital.psk.psk_demod(
          constellation_points=4,
          differential=True,
          samples_per_symbol=2,
          excess_bw=0.35,
          phase_bw=6.28/100.0,
          timing_bw=6.28/100.0,
          mod_code="gray",
          verbose=False,
          log=False,
          )
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff((0.007874016, ))
        self.blocks_char_to_float_1 = blocks.char_to_float(1, 1)
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_b(grc_blks2.packet_decoder(
        		access_code="",
        		threshold=-1,
        		callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
        	),
        )
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, fcdemod, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.digital_psk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.digital_psk_demod_0, 0))
        self.connect((self.analog_sig_source_x_0_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.blocks_char_to_float_1, 0), (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0), (self.blocks_char_to_float_1, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0), (self.audio_sink_0, 0))
Example #17
0
    def __init__(self, mode,
            freq_absolute=100.0,
            freq_relative=None,
            freq_linked_to_device=False,
            audio_destination=None,
            device_name=None,
            audio_gain=-6,
            audio_pan=0,
            audio_channels=0,
            context=None):
        assert audio_channels == 1 or audio_channels == 2
        assert audio_destination is not None
        assert device_name is not None
        gr.hier_block2.__init__(
            self, type(self).__name__,
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_float * audio_channels))
        
        if lookup_mode(mode) is None:
            # TODO: communicate back to client if applicable
            log.msg('Unknown mode %r in Receiver(); using AM' % (mode,))
            mode = 'AM'
        
        # Provided by caller
        self.context = context
        self.__audio_channels = audio_channels

        # cached info from device
        self.__device_name = device_name
        
        # Simple state
        self.mode = mode
        self.audio_gain = audio_gain
        self.audio_pan = min(1, max(-1, audio_pan))
        self.__audio_destination = audio_destination
        
        # Receive frequency.
        self.__freq_linked_to_device = bool(freq_linked_to_device)
        if self.__freq_linked_to_device and freq_relative is not None:
            self.__freq_relative = float(freq_relative)
            self.__freq_absolute = self.__freq_relative + self.__get_device().get_freq()
        else:
            self.__freq_absolute = float(freq_absolute)
            self.__freq_relative = self.__freq_absolute - self.__get_device().get_freq()
        
        # Blocks
        self.__rotator = blocks.rotator_cc()
        self.__demodulator = self.__make_demodulator(mode, {})
        self.__update_demodulator_info()
        self.__audio_gain_block = blocks.multiply_const_vff([0.0] * audio_channels)
        self.probe_audio = analog.probe_avg_mag_sqrd_f(0, alpha=10.0 / 44100)  # TODO adapt to output audio rate
        
        # Other internals
        self.__last_output_type = None
        
        self.__update_rotator()  # initialize rotator, also in case of __demod_tunable
        self.__update_audio_gain()
        self.__do_connect(reason=u'initialization')
Example #18
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 50000000
        self.rows = rows = 30
        self.g2 = g2 = 7
        self.g1 = g1 = 5
        self.ebno = ebno = 0
        self.ds_size = ds_size = 30
        self.cols = cols = 60
        self.cc_len = cc_len = 900
        self.ConstK = ConstK = 3
        self.BT = BT = 0.3

        ##################################################
        # Blocks
        ##################################################
        self.viterbi_zeropad_bb_0_0 = viterbi.zeropad_bb(ds_size, 2)
        self.viterbi_zeropad_bb_0 = viterbi.zeropad_bb(cc_len-ConstK+1, ConstK-1)
        self.viterbi_vitsova_0 = viterbi.vitsova(ds_size, BT, False)
        self.viterbi_nrz_encoder_0 = viterbi.nrz_encoder(True, 1)
        self.viterbi_nrz_decode_fb_0 = viterbi.nrz_decode_fb(-1)
        self.viterbi_interleave_ff_0_0 = viterbi.interleave_ff(cols, rows)
        self.viterbi_interleave_ff_0 = viterbi.interleave_ff(rows, cols)
        self.viterbi_gmskmod_bc_0 = viterbi.gmskmod_bc(1, 3, BT)
        self.viterbi_gmskmf_cf_0 = viterbi.gmskmf_cf(BT, False)
        self.viterbi_dropfirstN_ff_0 = viterbi.dropfirstN_ff(3)
        self.viterbi_convenc_bf_0 = viterbi.convenc_bf(ConstK, g1, g2)
        self.viterbi_convdec_0 = viterbi.convdec(cc_len-ConstK+1, ConstK, g1, g2)
        self.viterbi_bercount_b_0 = viterbi.bercount_b("/home/jayram/Desktop/gnuradio/Project/BER/cc_k3.dat", True, ebno, 50000000)
        self.viterbi_awgn_cc_0 = viterbi.awgn_cc(sqrt(power(10, - (ebno-3)/10.0)), 47)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, ))
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2, cc_len*1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0), (self.viterbi_bercount_b_0, 0))
        self.connect((self.viterbi_convdec_0, 0), (self.viterbi_bercount_b_0, 1))
        self.connect((self.viterbi_zeropad_bb_0, 0), (self.viterbi_convenc_bf_0, 0))
        self.connect((self.viterbi_interleave_ff_0_0, 0), (self.viterbi_convdec_0, 0))
        self.connect((self.viterbi_convenc_bf_0, 0), (self.viterbi_interleave_ff_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.viterbi_zeropad_bb_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.viterbi_interleave_ff_0_0, 0))
        self.connect((self.viterbi_nrz_encoder_0, 0), (self.viterbi_gmskmod_bc_0, 0))
        self.connect((self.viterbi_zeropad_bb_0_0, 0), (self.viterbi_nrz_encoder_0, 0))
        self.connect((self.viterbi_interleave_ff_0, 0), (self.viterbi_nrz_decode_fb_0, 0))
        self.connect((self.viterbi_nrz_decode_fb_0, 0), (self.viterbi_zeropad_bb_0_0, 0))
        self.connect((self.viterbi_gmskmod_bc_0, 0), (self.viterbi_awgn_cc_0, 0))
        self.connect((self.viterbi_dropfirstN_ff_0, 0), (self.viterbi_vitsova_0, 0))
        self.connect((self.viterbi_gmskmf_cf_0, 0), (self.viterbi_dropfirstN_ff_0, 0))
        self.connect((self.viterbi_awgn_cc_0, 0), (self.viterbi_gmskmf_cf_0, 0))
        self.connect((self.viterbi_vitsova_0, 0), (self.blocks_multiply_const_vxx_0, 0))
Example #19
0
    def __init__(self, win, sat_name, mode_name):
        gr.hier_block2.__init__(self, "Channel "+str(sat_name)+" "+str(mode_name)+" SSB",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex),
                                gr.io_signature(1, 1, gr.sizeof_gr_complex))

        self.trans = trans = 500
        self.sample_rate = sample_rate = 2048000
        self.low_ssb = low_ssb = 200
        self.high_ssb = high_ssb = 2800
        self.decim = decim = 8
        self.agc_decay = agc_decay = 50e-6

        ##################################################
        # Blocks
        ##################################################
        self.fftsink_audio = fftsink2.fft_sink_f(
            win,
            baseband_freq=0,
            y_per_div=5,
            y_divs=10,
            ref_level=-20,
            ref_scale=2.0,
            sample_rate=32000,
            fft_size=1024,
            fft_rate=15,
            average=True,
            avg_alpha=None,
            title="FFT Plot (Audio - "+sat_name+" "+str(mode_name)+")",
            peak_hold=True,
            )

        self.multiply_const_64 = blocks.multiply_const_vff((0.1, ))
        self.complex_to_real = blocks.complex_to_real(1)

        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=32,
            decimation=64,
            taps=None,
            fractional_bw=None,
            )
        self.band_pass_filter = filter.fir_filter_ccc(4, filter.firdes.complex_band_pass(
            1, sample_rate/decim, low_ssb, high_ssb, trans, filter.firdes.WIN_HAMMING, 6.76))
        self.agc = analog.agc2_cc(0.1, agc_decay, 0.9, 1.0)
        
        ##################################################
        # Connections
        ##################################################
        #self.connect(self, (self.gr_throttle_0, 0))

        self.connect(self, (self.band_pass_filter, 0))
        self.connect((self.band_pass_filter, 0), (self.agc, 0))
        self.connect((self.agc, 0), (self.rational_resampler, 0))
        self.connect((self.rational_resampler, 0), (self.complex_to_real, 0))
        self.connect((self.complex_to_real, 0), (self.multiply_const_64, 0))
        self.connect((self.multiply_const_64, 0), (self.fftsink_audio, 0))
        self.connect((self.multiply_const_64, 0), self)
Example #20
0
    def __init__(self, fft_size=4096):
        gr.hier_block2.__init__(
            self, "Fast Autocor",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_float*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.fft_size = fft_size

        ##################################################
        # Blocks
        ##################################################
        self.fft_vxx_0_0 = fft.fft_vcc(fft_size, False, (window.hamming(fft_size)), False, 1)
        self.fft_vxx_0 = fft.fft_vcc(fft_size, True, (window.hamming(fft_size)), False, 1)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((1.0/fft_size, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2048.0/fft_size, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_squared_1 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_complex_to_mag_squared_1, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0), (self.fft_vxx_0_0, 0))
        self.connect((self.fft_vxx_0_0, 0), (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self, 0), (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self, 0))
        self.connect((self.blocks_complex_to_mag_squared_1, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_float_to_complex_0, 0))
Example #21
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        self.Freq = Freq = 1000

        ##################################################
        # Blocks
        ##################################################
        self._Freq_range = Range(0, 4000, 1, 1000, 200)
        self._Freq_win = RangeWidget(self._Freq_range, self.set_Freq, "frequency", "counter_slider", int)
        self.top_layout.addWidget(self._Freq_win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=48000,
                decimation=8*10**3,
                taps=None,
                fractional_bw=None,
        )
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, ))
        self.audio_sink_0 = audio.sink(48*10**3, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, Freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.rational_resampler_xxx_0, 0))    
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=4160,
                decimation=4800,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=9600,
                decimation=samp_rate,
                taps=None,
                fractional_bw=None,
        )
        self.blocks_wavfile_source_0 = blocks.wavfile_source(sys.argv[1], False)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((255, ))
        self.blocks_keep_one_in_n_1 = blocks.keep_one_in_n(gr.sizeof_float*1, 2)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, 2)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, sys.argv[1]+".gray", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate, 500, 4200, 2000, firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_wavfile_source_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_skiphead_0, 0))
        self.connect((self.blocks_skiphead_0, 0), (self.blocks_keep_one_in_n_1, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_keep_one_in_n_1, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0))
    def __init__(self, decay=0.001, samp_rate=48000, attack=0.1, Frequency=1200):
        gr.hier_block2.__init__(
            self, "Detectmarkspace",
            gr.io_signature(1, 1, gr.sizeof_float*1),
            gr.io_signaturev(2, 2, [gr.sizeof_float*1, gr.sizeof_float*1]),
        )

        ##################################################
        # Parameters
        ##################################################
        self.decay = decay
        self.samp_rate = samp_rate
        self.attack = attack
        self.Frequency = Frequency

        ##################################################
        # Variables
        ##################################################
        self.Baud = Baud = 1200

        ##################################################
        # Blocks
        ##################################################
        self.root_raised_cosine_filter_0 = filter.fir_filter_ccf(1, firdes.root_raised_cosine(
        	1, samp_rate, Baud, 0.35, samp_rate/Baud))
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        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_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.5, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -Frequency, 1, 0)
        self.analog_agc2_xx_0 = analog.agc2_ff(attack, decay, 1.0, 1.0)
        self.analog_agc2_xx_0.set_max_gain(1.0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.analog_agc2_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self, 1))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.analog_agc2_xx_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_sub_xx_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_multiply_xx_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_sub_xx_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.root_raised_cosine_filter_0, 0))    
        self.connect((self.blocks_null_source_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_sub_xx_0, 0), (self, 0))    
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_null_sink_0, 0))    
        self.connect((self.root_raised_cosine_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
Example #24
0
    def __init__(self, input_samp_rate, output_samp_rate):
        gr.hier_block2.__init__(
                self, "FM Block",
                gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
                gr.io_signature(1, 1, gr.sizeof_float*1),
        )

        # Parameters
        self.input_samp_rate = input_samp_rate
        self.output_samp_rate = output_samp_rate
        self.decimation = decimation = 4
        self.cutoff = cutoff = 100e3
        self.transition = transition = 10e3

        # Blocks
        self.rational_resampler_1 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=decimation,
                taps=None,
                fractional_bw=None,
        )

        self.low_pass_filter = filter.fir_filter_ccf(1, filter.firdes.low_pass(
        	1, int(input_samp_rate/decimation), cutoff, transition, filter.firdes.WIN_HAMMING, 6.76))

        self.fm_demodulator = analog.wfm_rcv(
                quad_rate=int(input_samp_rate/decimation),
                audio_decimation=1,
        )

        self.rational_resampler_2 = filter.rational_resampler_fff(
                interpolation=output_samp_rate,
                decimation=int(input_samp_rate/decimation),
                taps=None,
                fractional_bw=None,
        )

        self.multiply = blocks.multiply_const_vff((80,))

        # Connections
        self.connect(
                self,
                self.rational_resampler_1,
                self.low_pass_filter,
                self.fm_demodulator,
                self.rational_resampler_2,
                self.multiply,
                self
        )
Example #25
0
    def __init__(self, alpha=0):
        gr.hier_block2.__init__(
            self, "IQ Phase Balancer",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.alpha = alpha

        ##################################################
        # Blocks
        ##################################################
        self.filter_single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(alpha, 1)
        self.blocks_sub_xx_1 = blocks.sub_ff(1)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_xx_2 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_divide_xx_0 = blocks.divide_ff(1)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_divide_xx_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_multiply_xx_1, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.filter_single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_multiply_xx_2, 0), (self.blocks_sub_xx_1, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_sub_xx_0, 0))
        self.connect((self.blocks_sub_xx_1, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_divide_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_sub_xx_1, 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.filter_single_pole_iir_filter_xx_0, 0))
        self.connect((self, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self, 0))
        self.connect((self.filter_single_pole_iir_filter_xx_0, 0), (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_2, 1))
Example #26
0
 def __rebuild_demodulator_nodirty(self, mode=None):
     if self.__demodulator is None:
         defaults = {}
     else:
         defaults = self.__demodulator.state_to_json()
     if mode is None:
         mode = self.mode
     self.__demodulator = self.__make_demodulator(mode, defaults)
     self.__update_demodulator_info()
     self.__update_rotator()
     self.mode = mode
     self.state_changed('demodulator')
     
     # Replace blocks downstream of the demodulator so as to flush samples that are potentially at a different sample rate and would therefore be audibly wrong. Caller will handle reconnection.
     self.__audio_gain_block = blocks.multiply_const_vff([0.0] * self.__audio_channels)
     self.__update_audio_gain()
Example #27
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Ntsc Hackrf")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samples_per_line = samples_per_line = 772
        self.samp_rate = samp_rate = samples_per_line * 60 * .999 * 525 / 2
        self.rf_gain = rf_gain = 14
        self.if_gain = if_gain = 40
        self.digital_gain = digital_gain = 0.9
        self.center_freq = center_freq = 186000000+1250000

        ##################################################
        # Blocks
        ##################################################
        self.zero = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.osmosdr_sink_0 = osmosdr.sink( args="numchan=" + str(1) + " " + "hackrf=0" )
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna("", 0)
        self.osmosdr_sink_0.set_bandwidth(0, 0)
          
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((digital_gain, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float*1, "/home/ubuntu/WAHD-TV/ve3irr-testing.dat", True)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.band_pass_filter_0 = filter.fir_filter_ccc(1, firdes.complex_band_pass(
        	1, samp_rate, -2475000 + 1725000, 2475000 + 1725000, 500000, firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, 4500000, 0.1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_add_xx_0, 1))    
        self.connect((self.blocks_add_xx_0, 0), (self.osmosdr_sink_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.zero, 0), (self.blocks_float_to_complex_0, 1))    
Example #28
0
	def __init__(self, fft_len, sens_per_sec, sample_rate, channel_space = 1,
	 search_bw = 1, thr_leveler = 10, tune_freq = 0, alpha_avg = 1, test_duration = 1,
	  period = 3600, trunc_band = 1, verbose = False, peak_alpha = 0, subject_channels = []):
		gr.hier_block2.__init__(self,
			"flank detector",
			gr.io_signature(1, 1, gr.sizeof_gr_complex),
			gr.io_signature(0,0,0))
		self.fft_len = fft_len #lenght of the fft for spectral analysis
		self.sens_per_sec = sens_per_sec #number of measurements per second (decimates)
		self.sample_rate = sample_rate 
		self.channel_space = channel_space #channel space for analysis
		self.search_bw = search_bw #search bandwidth within each channel
		self.thr_leveler = thr_leveler #leveler factor for noise floor / threshold comparison
		self.tune_freq = tune_freq #center frequency
		self.threshold = 0 #actual value of the threshold
		self.alpha_avg = alpha_avg #averaging factor for noise level between consecutive measurements
		self.peak_alpha = peak_alpha  #averaging factor for peak level between consecutive measurements
		self.subject_channels = subject_channels #channels whose flancks will be analysed
		

		self.msgq0 = gr.msg_queue(2)

		#######BLOCKS#####
		self.s2p = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fft_len)
		self.one_in_n = blocks.keep_one_in_n(gr.sizeof_gr_complex * self.fft_len,
		 max(1, int(self.sample_rate/self.fft_len/self.sens_per_sec)))

		mywindow = window.blackmanharris(self.fft_len)
		self.fft = fft.fft_vcc(self.fft_len, True, (), True)

		self.c2mag2 = blocks.complex_to_mag_squared(self.fft_len)
		self.multiply = blocks.multiply_const_vff(np.array([1.0/float(self.fft_len**2)]*fft_len))

		self.sink0 = blocks.message_sink(gr.sizeof_float * self.fft_len, self.msgq0, True)
		#####CONNECTIONS####
		self.connect(self, self.s2p, self.one_in_n, self.fft, self.c2mag2, self.multiply, self.sink0)

		#start periodic logging
		self._logger = logger(period, test_duration)
		#self._logger = None

		#Watchers
		#statistics and power
		self._watcher0 = _queue0_watcher(self.msgq0, sens_per_sec, self.tune_freq, self.channel_space,
		 self.search_bw, self.fft_len, self.sample_rate, self.thr_leveler, self.alpha_avg, test_duration,
		  trunc_band, verbose, peak_alpha, subject_channels, self._logger)
Example #29
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="BER Test")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_numbersink2_0 = numbersink2.number_sink_f(
        	self.GetWin(),
        	unit="%",
        	minval=-100,
        	maxval=100,
        	factor=1.0,
        	decimal_places=10,
        	ref_level=0,
        	sample_rate=samp_rate,
        	number_rate=15,
        	average=False,
        	avg_alpha=None,
        	label="BER",
        	peak_hold=False,
        	show_gauge=True,
        )
        self.Add(self.wxgui_numbersink2_0.win)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_not_xx_0 = blocks.not_bb()
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.bitErrorRate_0 = bitErrorRate()
        self.analog_random_source_x_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 2, 16)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.wxgui_numbersink2_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.bitErrorRate_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.bitErrorRate_0, 0))
        self.connect((self.analog_random_source_x_0, 0), (self.blocks_not_xx_0, 0))
        self.connect((self.blocks_not_xx_0, 0), (self.bitErrorRate_0, 1))
    def __init__(self,f_in,f_out):
        gr.top_block.__init__(self)
        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.file_out = file_out = f_out
        self.file_in = file_in = f_in

        ##################################################
        # Blocks
        ##################################################
        self.sat_observer_noaa_analog_decoder_f_0 = sat_observer.noaa_analog_decoder_f(file_out, "ac", 15)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=441,
                decimation=192,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=1,
                decimation=2,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, (40, ), 10.966e3, samp_rate)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(file_in, False)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((6.5, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate,
        	audio_decimation=5,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0_0, 0), (self.sat_observer_noaa_analog_decoder_f_0, 0))
        self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
Example #31
0
File: cp03a.py Project: mr0w1/cp
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="CP v0.3a")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.freq = freq = 92.9e6
        self.samp_rate = samp_rate = 2.4e6
        self.ch3_volume = ch3_volume = 1
        self.ch3_squelch = ch3_squelch = -30
        self.ch3_mute = ch3_mute = 1
        self.ch3_modulation = ch3_modulation = 0
        self.ch3_invert = ch3_invert = 1
        self.ch3_freq = ch3_freq = freq
        self.ch2_volume = ch2_volume = 1
        self.ch2_squelch = ch2_squelch = -30
        self.ch2_mute = ch2_mute = 1
        self.ch2_modulation = ch2_modulation = 0
        self.ch2_invert = ch2_invert = 1
        self.ch2_freq = ch2_freq = freq
        self.ch1_volume = ch1_volume = 1
        self.ch1_squelch = ch1_squelch = -30
        self.ch1_mute = ch1_mute = 1
        self.ch1_modulation = ch1_modulation = 0
        self.ch1_invert = ch1_invert = 1
        self.ch1_freq = ch1_freq = freq

        ##################################################
        # Blocks
        ##################################################
        self.tab = self.tab = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.tab.AddPage(grc_wxgui.Panel(self.tab), "Ch 1")
        self.tab.AddPage(grc_wxgui.Panel(self.tab), "Ch 2")
        self.tab.AddPage(grc_wxgui.Panel(self.tab), "Ch 3")
        self.GridAdd(self.tab, 5, 0, 1, 7)
        self._freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.freq,
            callback=self.set_freq,
            label="Radio Center Freq",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._freq_text_box, 21, 0, 1, 10)
        _ch3_volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch3_volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch3_volume_sizer,
            value=self.ch3_volume,
            callback=self.set_ch3_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch3_volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch3_volume_sizer,
            value=self.ch3_volume,
            callback=self.set_ch3_volume,
            minimum=0,
            maximum=10,
            num_steps=20,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch3_volume_sizer, 4, 2, 1, 1)
        _ch3_squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch3_squelch_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch3_squelch_sizer,
            value=self.ch3_squelch,
            callback=self.set_ch3_squelch,
            label="Squelch",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch3_squelch_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch3_squelch_sizer,
            value=self.ch3_squelch,
            callback=self.set_ch3_squelch,
            minimum=-70,
            maximum=0,
            num_steps=14,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch3_squelch_sizer, 4, 3, 1, 1)
        self._ch3_mute_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch3_mute,
            callback=self.set_ch3_mute,
            label="Mute",
            true=0,
            false=1,
        )
        self.GridAdd(self._ch3_mute_check_box, 4, 5, 1, 1)
        self._ch3_modulation_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.ch3_modulation,
            callback=self.set_ch3_modulation,
            label="Modulation",
            choices=[0, 1, 2],
            labels=["DMR", "NBFM", "WBFM"],
        )
        self.GridAdd(self._ch3_modulation_chooser, 4, 1, 1, 1)
        self._ch3_invert_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch3_invert,
            callback=self.set_ch3_invert,
            label="Invert",
            true=-1,
            false=1,
        )
        self.GridAdd(self._ch3_invert_check_box, 4, 4, 1, 1)
        self._ch3_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.ch3_freq,
            callback=self.set_ch3_freq,
            label="Ch3 Freq",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._ch3_freq_text_box, 4, 0, 1, 1)
        _ch2_volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch2_volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch2_volume_sizer,
            value=self.ch2_volume,
            callback=self.set_ch2_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch2_volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch2_volume_sizer,
            value=self.ch2_volume,
            callback=self.set_ch2_volume,
            minimum=0,
            maximum=10,
            num_steps=20,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch2_volume_sizer, 2, 2, 1, 1)
        _ch2_squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch2_squelch_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch2_squelch_sizer,
            value=self.ch2_squelch,
            callback=self.set_ch2_squelch,
            label="Squelch",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch2_squelch_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch2_squelch_sizer,
            value=self.ch2_squelch,
            callback=self.set_ch2_squelch,
            minimum=-70,
            maximum=0,
            num_steps=14,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch2_squelch_sizer, 2, 3, 1, 1)
        self._ch2_mute_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch2_mute,
            callback=self.set_ch2_mute,
            label="Mute",
            true=0,
            false=1,
        )
        self.GridAdd(self._ch2_mute_check_box, 2, 5, 1, 1)
        self._ch2_modulation_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.ch2_modulation,
            callback=self.set_ch2_modulation,
            label="Modulation",
            choices=[0, 1, 2],
            labels=["DMR", "NBFM", "WBFM"],
        )
        self.GridAdd(self._ch2_modulation_chooser, 2, 1, 1, 1)
        self._ch2_invert_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch2_invert,
            callback=self.set_ch2_invert,
            label="Invert",
            true=-1,
            false=1,
        )
        self.GridAdd(self._ch2_invert_check_box, 2, 4, 1, 1)
        self._ch2_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.ch2_freq,
            callback=self.set_ch2_freq,
            label="Ch2 Freq",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._ch2_freq_text_box, 2, 0, 1, 1)
        _ch1_volume_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch1_volume_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch1_volume_sizer,
            value=self.ch1_volume,
            callback=self.set_ch1_volume,
            label="Volume",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch1_volume_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch1_volume_sizer,
            value=self.ch1_volume,
            callback=self.set_ch1_volume,
            minimum=0,
            maximum=10,
            num_steps=40,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch1_volume_sizer, 0, 2, 1, 1)
        _ch1_squelch_sizer = wx.BoxSizer(wx.VERTICAL)
        self._ch1_squelch_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_ch1_squelch_sizer,
            value=self.ch1_squelch,
            callback=self.set_ch1_squelch,
            label="Squelch",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._ch1_squelch_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_ch1_squelch_sizer,
            value=self.ch1_squelch,
            callback=self.set_ch1_squelch,
            minimum=-70,
            maximum=0,
            num_steps=14,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_ch1_squelch_sizer, 0, 3, 1, 1)
        self._ch1_mute_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch1_mute,
            callback=self.set_ch1_mute,
            label="Mute",
            true=0,
            false=1,
        )
        self.GridAdd(self._ch1_mute_check_box, 0, 5, 1, 1)
        self._ch1_modulation_chooser = forms.drop_down(
            parent=self.GetWin(),
            value=self.ch1_modulation,
            callback=self.set_ch1_modulation,
            label="Modulation",
            choices=[0, 1, 2],
            labels=["DMR", "NBFM", "WBFM"],
        )
        self.GridAdd(self._ch1_modulation_chooser, 0, 1, 1, 1)
        self._ch1_invert_check_box = forms.check_box(
            parent=self.GetWin(),
            value=self.ch1_invert,
            callback=self.set_ch1_invert,
            label="Invert",
            true=-1,
            false=1,
        )
        self.GridAdd(self._ch1_invert_check_box, 0, 4, 1, 1)
        self._ch1_freq_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.ch1_freq,
            callback=self.set_ch1_freq,
            label="Ch1 Freq",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._ch1_freq_text_box, 0, 0, 1, 1)
        self.wxgui_waterfallsink2_1 = waterfallsink2.waterfall_sink_c(
            self.GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="Waterfall Plot",
        )
        self.GridAdd(self.wxgui_waterfallsink2_1.win, 6, 0, 15, 10)
        self.wxgui_fftsink2_0_0_0 = fftsink2.fft_sink_c(
            self.tab.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=512,
            fft_rate=15,
            average=True,
            avg_alpha=0.1333,
            title="Channel 3",
            peak_hold=False,
        )
        self.tab.GetPage(2).GridAdd(self.wxgui_fftsink2_0_0_0.win, 0, 0, 12, 7)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.tab.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=512,
            fft_rate=15,
            average=True,
            avg_alpha=0.1333,
            title="Channel 2",
            peak_hold=False,
        )
        self.tab.GetPage(1).GridAdd(self.wxgui_fftsink2_0_0.win, 0, 0, 12, 7)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.tab.GetPage(0).GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=512,
            fft_rate=15,
            average=True,
            avg_alpha=0.1333,
            title="Channel 1",
            peak_hold=False,
        )
        self.tab.GetPage(0).GridAdd(self.wxgui_fftsink2_0.win, 0, 0, 12, 7)
        self.wbfm_chain_0_0_0 = wbfm_chain()
        self.wbfm_chain_0_0 = wbfm_chain()
        self.wbfm_chain_0 = wbfm_chain()
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "")
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(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.nbfm_chain_1_0 = nbfm_chain()
        self.nbfm_chain_1 = nbfm_chain()
        self.nbfm_chain_0 = nbfm_chain()
        self.freq_xlating_fft_filter_ccc_0_0_0 = filter.freq_xlating_fft_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 200000, 10000)), ch3_freq - freq,
            samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0_0 = filter.freq_xlating_fft_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 200000, 10000)), ch2_freq - freq,
            samp_rate)
        self.freq_xlating_fft_filter_ccc_0_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0_0.declare_sample_delay(0)
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(
            1, (firdes.low_pass(1, samp_rate, 200000, 10000)), ch1_freq - freq,
            samp_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        self.dsd_chain_1_0 = dsd_chain()
        self.dsd_chain_1 = dsd_chain()
        self.dsd_chain_0 = dsd_chain()
        self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vff(
            (ch3_invert * ch3_mute, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff(
            (ch2_invert * ch2_mute, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(
            (ch1_invert * ch1_mute, ))
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff(
            (ch3_volume, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (ch2_volume, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (ch1_volume, ))
        self.blks2_selector_0_1_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=1,
            num_outputs=3,
            input_index=0,
            output_index=ch3_modulation,
        )
        self.blks2_selector_0_1 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=1,
            num_outputs=3,
            input_index=0,
            output_index=ch2_modulation,
        )
        self.blks2_selector_0_0_0_0 = grc_blks2.selector(
            item_size=gr.sizeof_float * 1,
            num_inputs=3,
            num_outputs=1,
            input_index=ch3_modulation,
            output_index=0,
        )
        self.blks2_selector_0_0_0 = grc_blks2.selector(
            item_size=gr.sizeof_float * 1,
            num_inputs=3,
            num_outputs=1,
            input_index=ch2_modulation,
            output_index=0,
        )
        self.blks2_selector_0_0 = grc_blks2.selector(
            item_size=gr.sizeof_float * 1,
            num_inputs=3,
            num_outputs=1,
            input_index=ch1_modulation,
            output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=1,
            num_outputs=3,
            input_index=0,
            output_index=ch1_modulation,
        )
        self.audio_sink_0_0_0 = audio.sink(48000, "", True)
        self.audio_sink_0_0 = audio.sink(48000, "", True)
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_pwr_squelch_xx_0_0_0_0 = analog.pwr_squelch_cc(
            ch3_squelch, 1e-4, 0, True)
        self.analog_pwr_squelch_xx_0_0_0 = analog.pwr_squelch_cc(
            ch2_squelch, 1e-4, 0, True)
        self.analog_pwr_squelch_xx_0_0 = analog.pwr_squelch_cc(
            ch1_squelch, 1e-4, 0, True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_pwr_squelch_xx_0_0, 0),
                     (self.blks2_selector_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0_0_0, 0),
                     (self.blks2_selector_0_1, 0))
        self.connect((self.analog_pwr_squelch_xx_0_0_0_0, 0),
                     (self.blks2_selector_0_1_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.dsd_chain_0, 0))
        self.connect((self.blks2_selector_0, 1), (self.nbfm_chain_0, 0))
        self.connect((self.blks2_selector_0, 2), (self.wbfm_chain_0, 0))
        self.connect((self.blks2_selector_0_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blks2_selector_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blks2_selector_0_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blks2_selector_0_1, 0), (self.dsd_chain_1, 0))
        self.connect((self.blks2_selector_0_1, 1), (self.nbfm_chain_1, 0))
        self.connect((self.blks2_selector_0_1, 2), (self.wbfm_chain_0_0, 0))
        self.connect((self.blks2_selector_0_1_0, 0), (self.dsd_chain_1_0, 0))
        self.connect((self.blks2_selector_0_1_0, 1), (self.nbfm_chain_1_0, 0))
        self.connect((self.blks2_selector_0_1_0, 2),
                     (self.wbfm_chain_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.blocks_multiply_const_vxx_2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.audio_sink_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2_0, 0),
                     (self.audio_sink_0_0_0, 0))
        self.connect((self.dsd_chain_0, 0), (self.blks2_selector_0_0, 0))
        self.connect((self.dsd_chain_1, 0), (self.blks2_selector_0_0_0, 0))
        self.connect((self.dsd_chain_1_0, 0), (self.blks2_selector_0_0_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0),
                     (self.analog_pwr_squelch_xx_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0),
                     (self.analog_pwr_squelch_xx_0_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0),
                     (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_0, 0),
                     (self.analog_pwr_squelch_xx_0_0_0_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0_0_0, 0),
                     (self.wxgui_fftsink2_0_0_0, 0))
        self.connect((self.nbfm_chain_0, 0), (self.blks2_selector_0_0, 1))
        self.connect((self.nbfm_chain_1, 0), (self.blks2_selector_0_0_0, 1))
        self.connect((self.nbfm_chain_1_0, 0),
                     (self.blks2_selector_0_0_0_0, 1))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.freq_xlating_fft_filter_ccc_0_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.wxgui_waterfallsink2_1, 0))
        self.connect((self.wbfm_chain_0, 0), (self.blks2_selector_0_0, 2))
        self.connect((self.wbfm_chain_0_0, 0), (self.blks2_selector_0_0_0, 2))
        self.connect((self.wbfm_chain_0_0_0, 0),
                     (self.blks2_selector_0_0_0_0, 2))
Example #32
0
    def __init__(self):
        gr.top_block.__init__(self, "Pal Transmit")

        ##################################################
        # Variables
        ##################################################
        self.samp_visual = samp_visual = 702
        self.samp_rate = samp_rate = samp_visual / (52e-6)
        self.samp_line = samp_line = int((64e-6) * samp_rate)
        self.sub_freq = sub_freq = 4433618.75
        self.samp_visual_delay = samp_visual_delay = int(2.5 / 64 * samp_line)
        self.samp_h_sync = samp_h_sync = int(4.7 / 64 * samp_line)
        self.samp_burst_delay = samp_burst_delay = int(0.9 / 64 * samp_line)
        self.samp_burst = samp_burst = int(2.25 / 64 * samp_line)
        self.rf_gain = rf_gain = 14
        self.lines_visual = lines_visual = 576
        self.lines_half_frame = lines_half_frame = 305
        self.level_blank = level_blank = 0.285
        self.level_black = level_black = 0.339
        self.if_gain = if_gain = 48

        ##################################################
        # Blocks
        ##################################################
        self.stdin = blocks.file_source(gr.sizeof_char * 1, '/dev/stdin',
                                        False)
        self.stdin.set_begin_tag(pmt.PMT_NIL)
        self.short_sync_pulse_0_3_0_1 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0_0_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.short_sync_pulse_0_3_0 = short_sync_pulse(
            samp_half_line=samp_line / 2, )
        self.osmosdr_sink_0_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                             'hackrf=0')
        self.osmosdr_sink_0_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0_0.set_center_freq(55e6, 0)
        self.osmosdr_sink_0_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0_0.set_gain(rf_gain, 0)
        self.osmosdr_sink_0_0.set_if_gain(if_gain, 0)
        self.osmosdr_sink_0_0.set_bb_gain(24, 0)
        self.osmosdr_sink_0_0.set_antenna('', 0)
        self.osmosdr_sink_0_0.set_bandwidth(0, 0)

        self.long_sync_pulse_0_0 = long_sync_pulse(samp_line=samp_line / 2, )
        self.long_sync_pulse_0 = long_sync_pulse(samp_line=samp_line / 2, )
        self.blocks_vector_to_stream_2_1_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_vector_to_stream_2_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_vector_to_stream_2_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_2 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1_1 = blocks.vector_to_stream(
            gr.sizeof_float * samp_visual, 3 * lines_visual)
        self.blocks_vector_to_stream_1_0_1 = blocks.vector_to_stream(
            gr.sizeof_float * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1_0 = blocks.vector_to_stream(
            gr.sizeof_float * 1, lines_half_frame * samp_visual)
        self.blocks_vector_to_stream_1 = blocks.vector_to_stream(
            gr.sizeof_float * samp_visual, 3 * lines_visual)
        self.blocks_vector_to_stream_0_1 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_line)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_uchar_to_float_0 = blocks.uchar_to_float()
        self.blocks_sub_xx_0 = blocks.sub_cc(1)
        self.blocks_stream_to_vector_1_0_0_1_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, samp_visual)
        self.blocks_stream_to_vector_1_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * samp_visual, lines_half_frame)
        self.blocks_stream_to_vector_1_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * samp_visual, lines_half_frame)
        self.blocks_stream_to_vector_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, 3 * samp_visual * lines_visual)
        self.blocks_stream_to_vector_0_1_1_2_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_2 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_1 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_1 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_burst)
        self.blocks_stream_to_vector_0_1_0_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_1_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_visual)
        self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, samp_line / 2)
        self.blocks_stream_to_streams_2 = blocks.stream_to_streams(
            gr.sizeof_gr_complex * samp_visual, 2)
        self.blocks_stream_to_streams_1 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual * lines_visual * 3, 2)
        self.blocks_stream_to_streams_0_0_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual, 2)
        self.blocks_stream_to_streams_0_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * samp_visual, 2)
        self.blocks_stream_to_streams_0_0 = blocks.stream_to_streams(
            gr.sizeof_float * lines_half_frame * samp_visual, 3)
        self.blocks_stream_to_streams_0 = blocks.stream_to_streams(
            gr.sizeof_float * lines_half_frame * samp_visual, 3)
        self.blocks_stream_mux_4 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_burst, (8, 305, 7, 305))
        self.blocks_stream_mux_3_0 = blocks.stream_mux(
            gr.sizeof_float * 702, (9, lines_visual / 2, 8))
        self.blocks_stream_mux_3 = blocks.stream_mux(gr.sizeof_float * 702,
                                                     (8, lines_visual / 2, 9))
        self.blocks_stream_mux_2_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync + samp_burst_delay, samp_burst, samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_2_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync, samp_burst_delay + samp_burst + samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_2 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1,
            (samp_h_sync, samp_burst_delay + samp_burst + samp_visual_delay,
             samp_visual, samp_line -
             (samp_h_sync + samp_burst_delay + samp_burst + samp_visual_delay +
              samp_visual)))
        self.blocks_stream_mux_1_1_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_visual, (8, 305, 7, 305))
        self.blocks_stream_mux_1_0_0_0_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_burst, (1, 1))
        self.blocks_stream_mux_1 = blocks.stream_mux(
            gr.sizeof_gr_complex * samp_line / 2,
            (6, 5, 5, 2 * 305, 5, 5, 4, 2 * 305))
        self.blocks_stream_mux_0 = blocks.stream_mux(
            gr.sizeof_gr_complex * 1, (samp_visual, samp_visual))
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float *
                                                     samp_visual)
        self.blocks_null_sink_1 = blocks.null_sink(gr.sizeof_float *
                                                   samp_visual)
        self.blocks_multiply_xx_2 = blocks.multiply_vcc(samp_burst)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (0.00390625 / 2, ))
        self.blocks_float_to_complex_1_0 = blocks.float_to_complex(
            lines_half_frame * samp_visual)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(
            lines_half_frame * samp_visual)
        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_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vcc((level_black, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((level_black, ))
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 4433618.75, 0.68, 0)
        self.analog_const_source_x_3_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)
        self.analog_const_source_x_3_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)
        self.analog_const_source_x_3_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_3 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_2 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_0_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1_0 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_1 = analog.sig_source_f(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_3_0_1 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, level_blank)
        self.analog_const_source_x_0_0_3 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_2_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, (-1 + 1j) / sqrt(2))
        self.analog_const_source_x_0_0_1_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, (-1 - 1j) / sqrt(2))
        self.analog_const_source_x_0_0_0_0_0_1_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_1_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_1 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0_0_0_0_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 0)
        self.analog_const_source_x_0 = analog.sig_source_c(
            0, analog.GR_CONST_WAVE, 0, 0, 1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0),
                     (self.blocks_sub_xx_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1, 0),
                     (self.blocks_stream_mux_2_1, 0))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1_0, 0),
                     (self.blocks_stream_mux_2_1, 4))
        self.connect((self.analog_const_source_x_0_0_0_0_0_1_0_0, 0),
                     (self.blocks_stream_mux_2_1, 2))
        self.connect((self.analog_const_source_x_0_0_1_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_2_0, 0))
        self.connect((self.analog_const_source_x_0_0_2_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_2, 0))
        self.connect((self.analog_const_source_x_0_0_3, 0),
                     (self.blocks_stream_mux_2, 0))
        self.connect((self.analog_const_source_x_0_0_3_0, 0),
                     (self.blocks_stream_mux_2, 1))
        self.connect((self.analog_const_source_x_0_0_3_0_0, 0),
                     (self.blocks_stream_mux_2, 3))
        self.connect((self.analog_const_source_x_0_0_3_0_0_0, 0),
                     (self.blocks_stream_mux_2_0, 3))
        self.connect((self.analog_const_source_x_0_0_3_0_1, 0),
                     (self.blocks_stream_mux_2_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1_0, 0),
                     (self.blocks_float_to_complex_0_0, 1))
        self.connect((self.analog_const_source_x_0_0_3_1_1, 0),
                     (self.blocks_stream_to_vector_1_0_0_1, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_0, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_0_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_0_0, 0))
        self.connect((self.analog_const_source_x_0_0_3_1_1_1, 0),
                     (self.blocks_stream_to_vector_1_0_0_1_1, 0))
        self.connect((self.analog_const_source_x_0_0_3_2, 0),
                     (self.blocks_stream_mux_2_0, 0))
        self.connect((self.analog_const_source_x_3, 0),
                     (self.blocks_stream_to_vector_0_1_1, 0))
        self.connect((self.analog_const_source_x_3_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_0, 0))
        self.connect((self.analog_const_source_x_3_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_1, 0))
        self.connect((self.analog_const_source_x_3_0_0_0, 0),
                     (self.blocks_stream_to_vector_0_1_1_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_add_const_vxx_0, 0),
                     (self.blocks_stream_mux_2, 2))
        self.connect((self.blocks_add_const_vxx_0_0, 0),
                     (self.blocks_stream_mux_2_0, 2))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_stream_to_vector_0_0_0, 0))
        self.connect((self.blocks_conjugate_cc_0, 0),
                     (self.blocks_stream_mux_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_float_to_complex_1, 0),
                     (self.blocks_vector_to_stream_2, 0))
        self.connect((self.blocks_float_to_complex_1_0, 0),
                     (self.blocks_vector_to_stream_2_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_stream_to_vector_1_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_xx_2, 0),
                     (self.blocks_vector_to_stream_0_1, 0))
        self.connect((self.blocks_stream_mux_0, 0),
                     (self.blocks_stream_mux_2_1, 3))
        self.connect((self.blocks_stream_mux_1, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_stream_mux_1_0_0_0_1, 0),
                     (self.blocks_multiply_xx_2, 0))
        self.connect((self.blocks_stream_mux_1_1_0, 0),
                     (self.blocks_stream_to_streams_2, 0))
        self.connect((self.blocks_stream_mux_2, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.blocks_stream_mux_2_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.blocks_stream_mux_2_1, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_stream_mux_3, 0),
                     (self.blocks_stream_to_vector_1_0_0_0, 0))
        self.connect((self.blocks_stream_mux_3_0, 0),
                     (self.blocks_stream_to_vector_1_0_0_0_0, 0))
        self.connect((self.blocks_stream_mux_4, 0),
                     (self.blocks_multiply_xx_2, 1))
        self.connect((self.blocks_stream_to_streams_0, 1),
                     (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_stream_to_streams_0, 2),
                     (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_stream_to_streams_0, 0),
                     (self.blocks_vector_to_stream_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0, 1),
                     (self.blocks_float_to_complex_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0, 2),
                     (self.blocks_float_to_complex_1_0, 1))
        self.connect((self.blocks_stream_to_streams_0_0, 0),
                     (self.blocks_vector_to_stream_1_0_1, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0, 1),
                     (self.blocks_null_sink_1, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0, 0),
                     (self.blocks_stream_mux_3, 1))
        self.connect((self.blocks_stream_to_streams_0_0_0_0, 0),
                     (self.blocks_null_sink_1_0, 0))
        self.connect((self.blocks_stream_to_streams_0_0_0_0, 1),
                     (self.blocks_stream_mux_3_0, 1))
        self.connect((self.blocks_stream_to_streams_1, 0),
                     (self.blocks_vector_to_stream_1, 0))
        self.connect((self.blocks_stream_to_streams_1, 1),
                     (self.blocks_vector_to_stream_1_1, 0))
        self.connect((self.blocks_stream_to_streams_2, 1),
                     (self.blocks_vector_to_stream_2_1, 0))
        self.connect((self.blocks_stream_to_streams_2, 0),
                     (self.blocks_vector_to_stream_2_1_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_stream_mux_1, 3))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.blocks_stream_mux_1, 7))
        self.connect((self.blocks_stream_to_vector_0_0_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 3))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 1))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 0))
        self.connect((self.blocks_stream_to_vector_0_1_0_0_0_0_0, 0),
                     (self.blocks_stream_mux_1_1_0, 2))
        self.connect((self.blocks_stream_to_vector_0_1_1, 0),
                     (self.blocks_stream_mux_4, 0))
        self.connect((self.blocks_stream_to_vector_0_1_1_0, 0),
                     (self.blocks_stream_mux_4, 2))
        self.connect((self.blocks_stream_to_vector_0_1_1_0_0, 0),
                     (self.blocks_stream_mux_4, 3))
        self.connect((self.blocks_stream_to_vector_0_1_1_1, 0),
                     (self.blocks_stream_mux_4, 1))
        self.connect((self.blocks_stream_to_vector_0_1_1_2, 0),
                     (self.blocks_stream_mux_1_0_0_0_1, 0))
        self.connect((self.blocks_stream_to_vector_0_1_1_2_0, 0),
                     (self.blocks_stream_mux_1_0_0_0_1, 1))
        self.connect((self.blocks_stream_to_vector_1_0_0, 0),
                     (self.blocks_stream_to_streams_1, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_0, 0),
                     (self.blocks_stream_to_streams_0, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_0_0, 0),
                     (self.blocks_stream_to_streams_0_0, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_1, 0),
                     (self.blocks_stream_mux_3, 0))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_0, 0),
                     (self.blocks_stream_mux_3, 2))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_0_0, 0),
                     (self.blocks_stream_mux_3_0, 2))
        self.connect((self.blocks_stream_to_vector_1_0_0_1_1, 0),
                     (self.blocks_stream_mux_3_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_uchar_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.osmosdr_sink_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0_1, 0),
                     (self.blocks_stream_mux_2_1, 1))
        self.connect((self.blocks_vector_to_stream_1, 0),
                     (self.blocks_stream_to_streams_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_vector_to_stream_1_0_1, 0),
                     (self.blocks_float_to_complex_0_0, 0))
        self.connect((self.blocks_vector_to_stream_1_1, 0),
                     (self.blocks_stream_to_streams_0_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2, 0),
                     (self.blocks_stream_to_vector_0_1_0_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2_0, 0),
                     (self.blocks_stream_to_vector_0_1_0_0, 0))
        self.connect((self.blocks_vector_to_stream_2_1, 0),
                     (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_vector_to_stream_2_1_0, 0),
                     (self.blocks_stream_mux_0, 0))
        self.connect((self.long_sync_pulse_0, 0),
                     (self.blocks_stream_mux_1, 1))
        self.connect((self.long_sync_pulse_0_0, 0),
                     (self.blocks_stream_mux_1, 5))
        self.connect((self.short_sync_pulse_0_3_0, 0),
                     (self.blocks_stream_mux_1, 0))
        self.connect((self.short_sync_pulse_0_3_0_0, 0),
                     (self.blocks_stream_mux_1, 2))
        self.connect((self.short_sync_pulse_0_3_0_0_0, 0),
                     (self.blocks_stream_mux_1, 6))
        self.connect((self.short_sync_pulse_0_3_0_1, 0),
                     (self.blocks_stream_mux_1, 4))
        self.connect((self.stdin, 0), (self.blocks_uchar_to_float_0, 0))
Example #33
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1e6
        self.transition = transition = samp_rate / 8
        self.tap2 = tap2 = 1
        self.tap1 = tap1 = 1
        self.tap0 = tap0 = 1
        self.cutoff = cutoff = samp_rate / 8

        ##################################################
        # Blocks
        ##################################################
        _tap2_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tap2_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tap2_sizer,
            value=self.tap2,
            callback=self.set_tap2,
            label='tap2',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._tap2_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tap2_sizer,
            value=self.tap2,
            callback=self.set_tap2,
            minimum=-1,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_tap2_sizer)
        _tap1_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tap1_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tap1_sizer,
            value=self.tap1,
            callback=self.set_tap1,
            label='tap1',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._tap1_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tap1_sizer,
            value=self.tap1,
            callback=self.set_tap1,
            minimum=-1,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_tap1_sizer)
        _tap0_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tap0_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tap0_sizer,
            value=self.tap0,
            callback=self.set_tap0,
            label='tap0',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._tap0_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tap0_sizer,
            value=self.tap0,
            callback=self.set_tap0,
            minimum=-1,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_tap0_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Scope Plot',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title='FFT Plot',
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        _transition_sizer = wx.BoxSizer(wx.VERTICAL)
        self._transition_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_transition_sizer,
            value=self.transition,
            callback=self.set_transition,
            label='transition',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._transition_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_transition_sizer,
            value=self.transition,
            callback=self.set_transition,
            minimum=samp_rate / 1000,
            maximum=samp_rate / 2,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_transition_sizer)
        self.fir_filter_xxx_0 = filter.fir_filter_fff(1, ((tap0, tap1, tap2)))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        _cutoff_sizer = wx.BoxSizer(wx.VERTICAL)
        self._cutoff_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_cutoff_sizer,
            value=self.cutoff,
            callback=self.set_cutoff,
            label='cutoff',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._cutoff_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_cutoff_sizer,
            value=self.cutoff,
            callback=self.set_cutoff,
            minimum=samp_rate / 1000,
            maximum=samp_rate / 2,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_cutoff_sizer)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float * 1,
                                                 samp_rate, True)
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff(
            (tap2, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff(
            (tap1, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((tap0, ))
        self.blocks_delay_0_0 = blocks.delay(gr.sizeof_float * 1, 2)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_noise_source_x_0 = analog.noise_source_f(
            analog.GR_GAUSSIAN, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.wxgui_scopesink2_0, 1))
        self.connect((self.blocks_delay_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_delay_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_delay_0_0, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.fir_filter_xxx_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0))
Example #34
0
    def __init__(self, sample_rate=48000, wavfile=""):
        gr.top_block.__init__(self, "Equisat Fm Demod")

        ##################################################
        # Parameters
        ##################################################
        self.sample_rate = sample_rate
        self.wavfile = wavfile

        ##################################################
        # Variables
        ##################################################
        self.symbol_depth = symbol_depth = 40
        self.decimation = decimation = 2

        self.variable_rrc_filter_taps_0 = variable_rrc_filter_taps_0 = firdes.root_raised_cosine(
            1.0, sample_rate / decimation, 4800, 0.2,
            symbol_depth * (sample_rate / decimation / 4800))

        self.gain_mu = gain_mu = 0.050

        ##################################################
        # Blocks
        ##################################################
        self.message_store_block_raw = blocks.message_debug()
        self.message_store_block_corrected = blocks.message_debug()
        self.fir_filter_xxx_0 = filter.fir_filter_fff(
            decimation, (variable_rrc_filter_taps_0))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.equisat_decoder_equisat_fec_decoder_0 = equisat_decoder.equisat_fec_decoder(
        )
        self.equisat_decoder_equisat_4fsk_preamble_detect_0 = equisat_decoder.equisat_4fsk_preamble_detect(
            255, 0.33, 40)
        self.equisat_decoder_equisat_4fsk_block_decode_0 = equisat_decoder.equisat_4fsk_block_decode(
            255, False)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            (sample_rate / decimation) / 4800.0, 0.25 * gain_mu * gain_mu, 0.5,
            gain_mu, 0.005)
        self.blocks_wavfile_source_0 = blocks.wavfile_source(wavfile, False)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((10, ))
        self.blocks_message_debug_0 = blocks.message_debug()

        ##################################################
        # Connections
        ##################################################
        self.msg_connect(
            (self.equisat_decoder_equisat_4fsk_block_decode_0, 'out'),
            (self.equisat_decoder_equisat_fec_decoder_0, 'in'))
        self.msg_connect(
            (self.equisat_decoder_equisat_4fsk_block_decode_0, 'out'),
            (self.message_store_block_raw, 'store'))
        self.msg_connect(
            (self.equisat_decoder_equisat_4fsk_preamble_detect_0, 'out'),
            (self.equisat_decoder_equisat_4fsk_block_decode_0, 'in'))
        self.msg_connect((self.equisat_decoder_equisat_fec_decoder_0, 'out'),
                         (self.message_store_block_corrected, 'store'))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.equisat_decoder_equisat_4fsk_preamble_detect_0, 0))
        self.connect((self.fir_filter_xxx_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
Example #35
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self._variable_config_LowCO_config = ConfigParser.ConfigParser()
        self._variable_config_LowCO_config.read("/home/maayan4/ParkingRC/Parking_RC_config.ini")
        try: variable_config_LowCO = self._variable_config_LowCO_config.getfloat("BPF", "Low_CO")
        except: variable_config_LowCO = 150e3
        self.variable_config_LowCO = variable_config_LowCO
        self._variable_config_HighCO_config = ConfigParser.ConfigParser()
        self._variable_config_HighCO_config.read("/home/maayan4/ParkingRC/Parking_RC_config.ini")
        try: variable_config_HighCO = self._variable_config_HighCO_config.getfloat("BPF", "High_CO")
        except: variable_config_HighCO = 300e3
        self.variable_config_HighCO = variable_config_HighCO
        self.samp_rate = samp_rate = 2000000
        self.omega = omega = 250
        self.gain_coeff = gain_coeff = 1
        self.fft_size_slider = fft_size_slider = 1024
        self.fft_size1 = fft_size1 = 1024
        self.decimation_coeff = decimation_coeff = 4
        self.center_freq = center_freq = 433.5E6
        self.Low_CO = Low_CO = variable_config_LowCO
        self.High_CO = High_CO = variable_config_HighCO

        ##################################################
        # Blocks
        ##################################################
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "RF")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "filtered")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "BB")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Auto Corr")
        self.Add(self.nb)
        _omega_sizer = wx.BoxSizer(wx.VERTICAL)
        self._omega_text_box = forms.text_box(
        	parent=self.nb.GetPage(2).GetWin(),
        	sizer=_omega_sizer,
        	value=self.omega,
        	callback=self.set_omega,
        	label="omega",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._omega_slider = forms.slider(
        	parent=self.nb.GetPage(2).GetWin(),
        	sizer=_omega_sizer,
        	value=self.omega,
        	callback=self.set_omega,
        	minimum=0,
        	maximum=1000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.nb.GetPage(2).Add(_omega_sizer)
        _center_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._center_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_center_freq_sizer,
        	value=self.center_freq,
        	callback=self.set_center_freq,
        	label="Center frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._center_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_center_freq_sizer,
        	value=self.center_freq,
        	callback=self.set_center_freq,
        	minimum=433E6,
        	maximum=435E6,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_center_freq_sizer)
        _Low_CO_sizer = wx.BoxSizer(wx.VERTICAL)
        self._Low_CO_text_box = forms.text_box(
        	parent=self.nb.GetPage(1).GetWin(),
        	sizer=_Low_CO_sizer,
        	value=self.Low_CO,
        	callback=self.set_Low_CO,
        	label="Low_CO",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._Low_CO_slider = forms.slider(
        	parent=self.nb.GetPage(1).GetWin(),
        	sizer=_Low_CO_sizer,
        	value=self.Low_CO,
        	callback=self.set_Low_CO,
        	minimum=0,
        	maximum=500e3,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.nb.GetPage(1).Add(_Low_CO_sizer)
        _High_CO_sizer = wx.BoxSizer(wx.VERTICAL)
        self._High_CO_text_box = forms.text_box(
        	parent=self.nb.GetPage(1).GetWin(),
        	sizer=_High_CO_sizer,
        	value=self.High_CO,
        	callback=self.set_High_CO,
        	label="High_CO",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._High_CO_slider = forms.slider(
        	parent=self.nb.GetPage(1).GetWin(),
        	sizer=_High_CO_sizer,
        	value=self.High_CO,
        	callback=self.set_High_CO,
        	minimum=150e3,
        	maximum=500e3,
        	num_steps=200,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.nb.GetPage(1).Add(_High_CO_sizer)
        self.wxgui_scopesink2_0_0_0_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	title="BB",
        	sample_rate=samp_rate*gain_coeff/decimation_coeff,
        	v_scale=0,
        	v_offset=0,
        	t_scale=1,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_0_0.win, 0, 1, 1, 1)
        self.wxgui_scopesink2_0_0_0 = scopesink2.scope_sink_f(
        	self.nb.GetPage(2).GetWin(),
        	title="After MM",
        	sample_rate=samp_rate/decimation_coeff,
        	v_scale=0,
        	v_offset=0,
        	t_scale=1,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(2).GridAdd(self.wxgui_scopesink2_0_0_0.win, 0, 0, 1, 1)
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=center_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="RF",
        	peak_hold=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(1).GetWin(),
        	baseband_freq=center_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate*gain_coeff/decimation_coeff,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Filtered",
        	peak_hold=False,
        )
        self.nb.GetPage(1).Add(self.wxgui_fftsink2_0.win)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate*gain_coeff/decimation_coeff, 5000, 3500, firdes.WIN_HAMMING, 6.76))
        _fft_size_slider_sizer = wx.BoxSizer(wx.VERTICAL)
        self._fft_size_slider_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_fft_size_slider_sizer,
        	value=self.fft_size_slider,
        	callback=self.set_fft_size_slider,
        	label="fft_size_1",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._fft_size_slider_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_fft_size_slider_sizer,
        	value=self.fft_size_slider,
        	callback=self.set_fft_size_slider,
        	minimum=24,
        	maximum=1024,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_fft_size_slider_sizer)
        self.digital_correlate_access_code_bb_0 = digital.correlate_access_code_bb("11111", 0)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(omega*(1+0.0), 0.25*0.175*0.175, 0.5, 0.175, 0.005)
        self.digital_binary_slicer_fb_1 = digital.binary_slicer_fb()
        self.blocks_wavfile_sink_0_0 = blocks.wavfile_sink("/home/maayan4/ParkingRC/baseband_mm.wav", 1, samp_rate/8, 8)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink("/home/maayan4/ParkingRC/baseband.wav", 1, samp_rate*gain_coeff/decimation_coeff, 8)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/maayan4/ParkingRC/ParkingRC-f4.335000e+08-s2.000000e+06-t20160513215032.cfile", False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, "/home/maayan4/ParkingRC/parkRC_bytes", False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_vff((-0.3, ))
        self.band_pass_filter_0 = filter.fir_filter_ccc(decimation_coeff, firdes.complex_band_pass(
        	gain_coeff, samp_rate, Low_CO, High_CO, High_CO-Low_CO, firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0, 0))    
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.blocks_multiply_const_vxx_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_add_const_vxx_0_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0))    
        self.connect((self.digital_binary_slicer_fb_1, 0), (self.digital_correlate_access_code_bb_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.blocks_wavfile_sink_0_0, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_1, 0))    
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.wxgui_scopesink2_0_0_0, 0))    
        self.connect((self.digital_correlate_access_code_bb_0, 0), (self.blocks_file_sink_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_wavfile_sink_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.wxgui_scopesink2_0_0_0_0, 0))    
Example #36
0
    def __init__(self):
        gr.top_block.__init__(self, "NOAA Demo based on PFB Channelizer Demo")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("NOAA Demo based on PFB Channelizer Demo")
        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", "noaa_demo")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.noaa_num_chans = noaa_num_chans = 7
        self.noaa_chan_width = noaa_chan_width = int(25e3)
        self.noaa_band_start = noaa_band_start = 162.4e6
        self.oversampled_width = oversampled_width = noaa_chan_width * (
            noaa_num_chans + 1)
        self.noaa_fm_dev = noaa_fm_dev = int(5e3)
        self.noaa_band_center = noaa_band_center = noaa_band_start + (
            noaa_num_chans / 2 * noaa_chan_width)
        self.hardware_rate = hardware_rate = int(16e6)
        self.tuner_freq = tuner_freq = 162.3e6
        self.target_freq = target_freq = noaa_band_center
        self.ppm = ppm = 0
        self.pfb_taps = pfb_taps = firdes.low_pass(2.0, oversampled_width,
                                                   noaa_fm_dev * 2, 1000,
                                                   firdes.WIN_HAMMING, 6.76)
        self.lpf_taps = lpf_taps = firdes.low_pass(1.0, hardware_rate,
                                                   oversampled_width / 2,
                                                   noaa_chan_width,
                                                   firdes.WIN_HAMMING, 6.76)
        self.channel_map = channel_map = range(0, noaa_num_chans)
        self.volume = volume = 0.15
        self.tuner_offset = tuner_offset = target_freq - tuner_freq
        self.ppm_corr = ppm_corr = tuner_freq * (ppm / 1e6)
        self.pfb_sizeof_taps = pfb_sizeof_taps = len(pfb_taps)
        self.noaa_band_width = noaa_band_width = noaa_chan_width * noaa_num_chans
        self.noaa_band_end = noaa_band_end = noaa_band_start + (
            noaa_num_chans * noaa_chan_width)
        self.lpf_sizeof_taps = lpf_sizeof_taps = len(lpf_taps)
        self.fftwidth = fftwidth = 512
        self.fft_interval = fft_interval = 1.0 / 20
        self.decimation = decimation = hardware_rate / oversampled_width
        self.channelizer_map = channelizer_map = 5, 6, 7, 0, 1, 2, 3
        self.channel_names = channel_names = map(
            lambda x: "%.3fMHz" % (162.4 + (x * 0.025)), channel_map)
        self.chan_num = chan_num = channel_map[6]

        ##################################################
        # Blocks
        ##################################################
        self._volume_range = Range(0, 1, 0.05, 0.15, 50)
        self._volume_win = RangeWidget(self._volume_range, self.set_volume,
                                       "volume", "slider", float)
        self.top_grid_layout.addWidget(self._volume_win, 0, 1, 1, 1)
        self._chan_num_options = channel_map
        self._chan_num_labels = channel_names
        self._chan_num_tool_bar = Qt.QToolBar(self)
        self._chan_num_tool_bar.addWidget(Qt.QLabel("Channel" + ": "))
        self._chan_num_combo_box = Qt.QComboBox()
        self._chan_num_tool_bar.addWidget(self._chan_num_combo_box)
        for label in self._chan_num_labels:
            self._chan_num_combo_box.addItem(label)
        self._chan_num_callback = lambda i: Qt.QMetaObject.invokeMethod(
            self._chan_num_combo_box, "setCurrentIndex",
            Qt.Q_ARG("int", self._chan_num_options.index(i)))
        self._chan_num_callback(self.chan_num)
        self._chan_num_combo_box.currentIndexChanged.connect(
            lambda i: self.set_chan_num(self._chan_num_options[i]))
        self.top_grid_layout.addWidget(self._chan_num_tool_bar, 0, 0, 1, 1)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              "hackrf")
        self.rtlsdr_source_0.set_sample_rate(hardware_rate)
        self.rtlsdr_source_0.set_center_freq(tuner_freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(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_0 = filter.rational_resampler_fff(
            interpolation=24,
            decimation=25,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0_0_0 = qtgui.waterfall_sink_c(
            fftwidth,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            target_freq,  #fc
            oversampled_width,  #bw
            "Band Monitor",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0_0_0.set_update_time(fft_interval)
        self.qtgui_waterfall_sink_x_0_0_0.enable_grid(True)

        if not True:
            self.qtgui_waterfall_sink_x_0_0_0.disable_legend()

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

        labels = ["", "", "", "", "", "", "", "", "", ""]
        colors = [5, 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_0_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0_0_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0_0_0.set_intensity_range(-80, -35)

        self._qtgui_waterfall_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_0_win,
                                       1, 0, 1, 2)
        self.qtgui_waterfall_sink_x_0_0 = qtgui.waterfall_sink_c(
            fftwidth,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            noaa_chan_width,  #bw
            "Channel Monitor",  #name
            1  #number of inputs
        )
        self.qtgui_waterfall_sink_x_0_0.set_update_time(fft_interval)
        self.qtgui_waterfall_sink_x_0_0.enable_grid(True)

        if not True:
            self.qtgui_waterfall_sink_x_0_0.disable_legend()

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

        labels = ["", "", "", "", "", "", "", "", "", ""]
        colors = [5, 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_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_waterfall_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_waterfall_sink_x_0_0.set_color_map(i, colors[i])
            self.qtgui_waterfall_sink_x_0_0.set_line_alpha(i, alphas[i])

        self.qtgui_waterfall_sink_x_0_0.set_intensity_range(-67, -37)

        self._qtgui_waterfall_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_waterfall_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_0_win, 1,
                                       2, 1, 2)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            fftwidth,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            noaa_chan_width,  #bw
            "Channelizer Output",  #name
            noaa_num_chans  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(fft_interval)
        self.qtgui_freq_sink_x_0.set_y_axis(-80, 0)
        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(True)
        self.qtgui_freq_sink_x_0.set_fft_average(0.1)
        self.qtgui_freq_sink_x_0.enable_control_panel(False)

        if not True:
            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 = [
            channel_names[0], channel_names[1], channel_names[2],
            channel_names[3], channel_names[4], channel_names[5],
            channel_names[6], "channel_names[7]", "", ""
        ]
        widths = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
        colors = [
            "blue", "red", "green", "black", "dark red", "dark green",
            "dark blue", "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(noaa_num_chans):
            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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 0, 1,
                                       4)
        self._ppm_range = Range(-20, 20, 0.5, 0, 50)
        self._ppm_win = RangeWidget(self._ppm_range, self.set_ppm, "ppm",
                                    "slider", float)
        self.top_grid_layout.addWidget(self._ppm_win, 0, 2, 1, 1)
        self.pfb_channelizer_ccf_0 = pfb.channelizer_ccf(
            noaa_num_chans + 1, (pfb_taps), 1, 1)
        self.pfb_channelizer_ccf_0.set_channel_map((channelizer_map))
        self.pfb_channelizer_ccf_0.declare_sample_delay(0)

        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(
            int(decimation), (lpf_taps), tuner_offset + ppm_corr,
            hardware_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        self.blocks_multiply_const_vxx_0_7 = blocks.multiply_const_vcc((50, ))
        self.blocks_multiply_const_vxx_0_6_0 = blocks.multiply_const_vff(
            (volume, ))
        self.blocks_multiply_const_vxx_0_6 = blocks.multiply_const_vcc((10, ))
        self.blocks_multiply_const_vxx_0_5_0 = blocks.multiply_const_vcc(
            (1 if chan_num is 7 else 0, ))
        self.blocks_multiply_const_vxx_0_5 = blocks.multiply_const_vcc(
            (1 if chan_num is 6 else 0, ))
        self.blocks_multiply_const_vxx_0_4 = blocks.multiply_const_vcc(
            (1 if chan_num is 5 else 0, ))
        self.blocks_multiply_const_vxx_0_3 = blocks.multiply_const_vcc(
            (1 if chan_num is 4 else 0, ))
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc(
            (1 if chan_num is 3 else 0, ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vcc(
            (1 if chan_num is 2 else 0, ))
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vcc(
            (1 if chan_num is 1 else 0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (1 if chan_num is 0 else 0, ))
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.audio_sink_0 = audio.sink(24000, "", True)
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
            audio_rate=noaa_chan_width,
            quad_rate=noaa_chan_width,
            tau=75e-6,
            max_dev=noaa_fm_dev,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_nbfm_rx_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_6, 0))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.qtgui_waterfall_sink_x_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_add_xx_0, 2))
        self.connect((self.blocks_multiply_const_vxx_0_2, 0),
                     (self.blocks_add_xx_0, 3))
        self.connect((self.blocks_multiply_const_vxx_0_3, 0),
                     (self.blocks_add_xx_0, 4))
        self.connect((self.blocks_multiply_const_vxx_0_4, 0),
                     (self.blocks_add_xx_0, 5))
        self.connect((self.blocks_multiply_const_vxx_0_5, 0),
                     (self.blocks_add_xx_0, 6))
        self.connect((self.blocks_multiply_const_vxx_0_5_0, 0),
                     (self.blocks_add_xx_0, 7))
        self.connect((self.blocks_multiply_const_vxx_0_6, 0),
                     (self.analog_nbfm_rx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_6_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_7, 0),
                     (self.freq_xlating_fft_filter_ccc_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0),
                     (self.pfb_channelizer_ccf_0, 0))
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0),
                     (self.qtgui_waterfall_sink_x_0_0_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 1),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 2),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.pfb_channelizer_ccf_0, 3),
                     (self.blocks_multiply_const_vxx_0_2, 0))
        self.connect((self.pfb_channelizer_ccf_0, 4),
                     (self.blocks_multiply_const_vxx_0_3, 0))
        self.connect((self.pfb_channelizer_ccf_0, 5),
                     (self.blocks_multiply_const_vxx_0_4, 0))
        self.connect((self.pfb_channelizer_ccf_0, 6),
                     (self.blocks_multiply_const_vxx_0_5, 0))
        self.connect((self.pfb_channelizer_ccf_0, 7),
                     (self.blocks_multiply_const_vxx_0_5_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.pfb_channelizer_ccf_0, 1),
                     (self.qtgui_freq_sink_x_0, 1))
        self.connect((self.pfb_channelizer_ccf_0, 2),
                     (self.qtgui_freq_sink_x_0, 2))
        self.connect((self.pfb_channelizer_ccf_0, 3),
                     (self.qtgui_freq_sink_x_0, 3))
        self.connect((self.pfb_channelizer_ccf_0, 4),
                     (self.qtgui_freq_sink_x_0, 4))
        self.connect((self.pfb_channelizer_ccf_0, 5),
                     (self.qtgui_freq_sink_x_0, 5))
        self.connect((self.pfb_channelizer_ccf_0, 6),
                     (self.qtgui_freq_sink_x_0, 6))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0_6_0, 0))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.blocks_multiply_const_vxx_0_7, 0))
Example #37
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        ##################################################
        # Variables
        ##################################################
        self.occupied_carriers = occupied_carriers = (
            range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) +
            range(8, 21) + range(22, 27), )
        self.length_tag_key = length_tag_key = "packet_len"
        self.sync_word2 = sync_word2 = [
            0, 0, 0, 0, 0, 0, -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, 0, 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, 0, 0, 0, 0, 0
        ]
        self.sync_word1 = sync_word1 = [
            0., 0., 0., 0., 0., 0., 0., 1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., -1.41421356, 0., -1.41421356, 0.,
            1.41421356, 0., -1.41421356, 0., 1.41421356, 0., -1.41421356, 0.,
            -1.41421356, 0., -1.41421356, 0., -1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            -1.41421356, 0., 1.41421356, 0., 1.41421356, 0., 1.41421356, 0.,
            0., 0., 0., 0., 0.
        ]
        self.samp_rate = samp_rate = 100000
        self.rolloff = rolloff = 0
        self.pilot_symbols = pilot_symbols = ((
            1,
            1,
            1,
            -1,
        ), )
        self.pilot_carriers = pilot_carriers = ((
            -21,
            -7,
            7,
            21,
        ), )
        self.payload_mod = payload_mod = digital.constellation_qpsk()
        self.packet_len = packet_len = 478
        self.mysamp_rate = mysamp_rate = 50000000
        self.min_singnal_var0 = min_singnal_var0 = 0
        self.header_mod = header_mod = digital.constellation_bpsk()
        self.hdr_format = hdr_format = digital.header_format_ofdm(
            occupied_carriers,
            1,
            length_tag_key,
        )
        self.gain = gain = 0
        self.fft_len = fft_len = 64
        self.N_fft = N_fft = 1024

        ##################################################
        # Blocks
        ##################################################
        self.min_signal0 = blocks.probe_signal_f()

        def _min_singnal_var0_probe():
            while True:
                val = self.min_signal0.level()
                try:
                    self.set_min_singnal_var0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (10))

        _min_singnal_var0_thread = threading.Thread(
            target=_min_singnal_var0_probe)
        _min_singnal_var0_thread.daemon = True
        _min_singnal_var0_thread.start()

        self._gain_range = Range(0, 74, 1, 0, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'gain',
                                     "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("serial=31DDABF", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(10e6)
        self.uhd_usrp_source_0.set_center_freq(2.402e9, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.uhd_usrp_source_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_source_0.set_auto_dc_offset(True, 0)
        self.uhd_usrp_source_0.set_auto_iq_balance(True, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(('serial= 31DDAA6', "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(3000000)
        self.uhd_usrp_sink_0.set_center_freq(1E9, 0)
        self.uhd_usrp_sink_0.set_gain(50, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_c(
            1024,  #size
            samp_rate,  #samp_rate
            'Scope Plot',  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_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 = ['Scope Plot', '', '', '', '', '', '', '', '', '']
        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:
                if (i % 2 == 0):
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Re{{Data {0}}}".format(i / 2))
                else:
                    self.qtgui_time_sink_x_0.set_line_label(
                        i, "Im{{Data {0}}}".format(i / 2))
            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_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            'FFT Plot',  #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(-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)

        if not True:
            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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.fft_vxx_1 = fft.fft_vcc(N_fft, True,
                                     (window.blackmanharris(N_fft)), False, 1)
        self.fft_vxx_0 = fft.fft_vcc(fft_len, False, (()), True, 1)
        self.digital_protocol_formatter_bb_0 = digital.protocol_formatter_bb(
            hdr_format, length_tag_key)
        self.digital_ofdm_cyclic_prefixer_0 = digital.ofdm_cyclic_prefixer(
            fft_len, fft_len + fft_len / 4, rolloff, length_tag_key)
        self.digital_ofdm_carrier_allocator_cvc_0 = digital.ofdm_carrier_allocator_cvc(
            fft_len, occupied_carriers, pilot_carriers, pilot_symbols,
            (sync_word1, sync_word2), length_tag_key)
        self.digital_crc32_bb_0 = digital.crc32_bb(False, length_tag_key, True)
        self.digital_chunks_to_symbols_xx_0_0 = digital.chunks_to_symbols_bc(
            (payload_mod.points()), 1)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (header_mod.points()), 1)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_float * 1, N_fft)
        self.blocks_tagged_stream_mux_0 = blocks.tagged_stream_mux(
            gr.sizeof_gr_complex * 1, length_tag_key, 0)
        self.blocks_tag_gate_0 = blocks.tag_gate(gr.sizeof_gr_complex * 1,
                                                 False)
        self.blocks_tag_gate_0.set_single_key("")
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, N_fft)
        self.blocks_stream_to_tagged_stream_0 = blocks.stream_to_tagged_stream(
            gr.sizeof_char, 1, packet_len, length_tag_key)
        self.blocks_repack_bits_bb_0_0 = blocks.repack_bits_bb(
            8, 1, length_tag_key, False, gr.GR_LSB_FIRST)
        self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(
            8, payload_mod.bits_per_symbol(), length_tag_key, False,
            gr.GR_LSB_FIRST)
        self.blocks_nlog10_ff_0_0 = blocks.nlog10_ff(10, 1, 0)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1,
                                                   -1 * min_singnal_var0)
        self.blocks_multiply_const_vxx_0_2 = blocks.multiply_const_vcc(
            (0.05, ))
        self.blocks_multiply_const_vxx_0_1 = blocks.multiply_const_vff(
            (N_fft / 50e6, ))
        self.blocks_multiply_const_vxx_0_0_0 = blocks.multiply_const_vff(
            (N_fft / 50e6, ))
        self.blocks_min_xx_0 = blocks.min_ff(N_fft, 1)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(
            N_fft)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_min_xx_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_float_to_uchar_0, 0),
                     (self.blocks_stream_to_tagged_stream_0, 0))
        self.connect((self.blocks_min_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0_0, 0),
                     (self.blocks_nlog10_ff_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_1, 0),
                     (self.blocks_nlog10_ff_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_2, 0),
                     (self.blocks_tag_gate_0, 0))
        self.connect((self.blocks_nlog10_ff_0, 0),
                     (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_nlog10_ff_0_0, 0), (self.min_signal0, 0))
        self.connect((self.blocks_repack_bits_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0_0, 0))
        self.connect((self.blocks_repack_bits_bb_0_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_stream_to_tagged_stream_0, 0),
                     (self.digital_crc32_bb_0, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.blocks_tag_gate_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_tag_gate_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_tag_gate_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_tagged_stream_mux_0, 0),
                     (self.digital_ofdm_carrier_allocator_cvc_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_multiply_const_vxx_0_1, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.blocks_tagged_stream_mux_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0_0, 0),
                     (self.blocks_tagged_stream_mux_0, 1))
        self.connect((self.digital_crc32_bb_0, 0),
                     (self.blocks_repack_bits_bb_0, 0))
        self.connect((self.digital_crc32_bb_0, 0),
                     (self.digital_protocol_formatter_bb_0, 0))
        self.connect((self.digital_ofdm_carrier_allocator_cvc_0, 0),
                     (self.fft_vxx_0, 0))
        self.connect((self.digital_ofdm_cyclic_prefixer_0, 0),
                     (self.blocks_multiply_const_vxx_0_2, 0))
        self.connect((self.digital_protocol_formatter_bb_0, 0),
                     (self.blocks_repack_bits_bb_0_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.digital_ofdm_cyclic_prefixer_0, 0))
        self.connect((self.fft_vxx_1, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_stream_to_vector_0, 0))
Example #38
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        ##################################################
        # Variables
        ##################################################
        self.blf = blf = 40e3
        self.adc_rate = adc_rate = 100e6 / 50
        self.tx_gain = tx_gain = 0
        self.samp_rate = samp_rate = 32000
        self.rx_gain = rx_gain = 20
        self.num_taps = num_taps = [1] * int(adc_rate / blf * 0.5)
        self.freq = freq = 910e6
        self.decim = decim = 5
        self.dac_rate = dac_rate = 1e6
        self.ampl = ampl = 0.5

        ##################################################
        # Blocks
        ##################################################
        self.rfid_tag_decoder_0 = rfid.tag_decoder(int(adc_rate / decim))
        self.rfid_reader_0 = rfid.reader(int(adc_rate / decim), int(dac_rate))
        self.rfid_gate_0 = rfid.gate(int(adc_rate / decim))
        self.fir_filter_xxx_0 = filter.fir_filter_ccc(decim, (num_taps))
        self.fir_filter_xxx_0.declare_sample_delay(0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((ampl, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/andreas/Engineering/PartIIB/Project/repos/Hertz/gr-rfid/misc/data/file_source_test',
            False)
        self.blocks_file_sink_1 = blocks.file_sink(
            gr.sizeof_gr_complex * 1,
            '/home/andreas/Engineering/PartIIB/Project/repos/Hertz/gr-rfid/misc/data/file_sink',
            False)
        self.blocks_file_sink_1.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(
            gr.sizeof_gr_complex * 1,
            '/home/andreas/Engineering/PartIIB/Project/repos/Hertz/gr-rfid/misc/data/file_sink',
            False)
        self.blocks_file_sink_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_file_source_0, 0),
                     (self.fir_filter_xxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.fir_filter_xxx_0, 0), (self.rfid_gate_0, 0))
        self.connect((self.rfid_gate_0, 0), (self.rfid_tag_decoder_0, 0))
        self.connect((self.rfid_reader_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rfid_tag_decoder_0, 1),
                     (self.blocks_file_sink_1, 0))
        self.connect((self.rfid_tag_decoder_0, 0), (self.rfid_reader_0, 0))
Example #39
0
    def __init__(self):
        gr.top_block.__init__(self, "Am Tx")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Am Tx")
        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", "AM_TX")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.u = u = 1
        self.samp_rate = samp_rate = 200000
        self.gain = gain = 50
        self.fm = fm = 4000
        self.fc = fc = 32000
        self.A = A = 1

        ##################################################
        # Blocks
        ##################################################
        self._u_range = Range(0, 2, 200, 1, 200)
        self._u_win = RangeWidget(self._u_range, self.set_u, "Modulation Index", "counter_slider", float)
        self.top_layout.addWidget(self._u_win)
        self._gain_range = Range(0, 100, 1, 50, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, "gain", "counter_slider", float)
        self.top_layout.addWidget(self._gain_win)
        self._fm_range = Range(0, 10000, 1, 4000, 200)
        self._fm_win = RangeWidget(self._fm_range, self.set_fm, "Modulation/Message Signal Frequency", "counter_slider", float)
        self.top_layout.addWidget(self._fm_win)
        self._fc_range = Range(16000, samp_rate/2, 100, 32000, 200)
        self._fc_win = RangeWidget(self._fc_range, self.set_fc, "fc", "counter_slider", float)
        self.top_layout.addWidget(self._fc_win)
        self._A_range = Range(0, 1, 0.1, 1, 200)
        self._A_win = RangeWidget(self._A_range, self.set_A, "Amplitude", "counter_slider", float)
        self.top_layout.addWidget(self._A_win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("addr=192.168.10.2", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(1280e6, 0)
        self.uhd_usrp_sink_0.set_gain(gain, 0)
        self.uhd_usrp_sink_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_sink_0.set_bandwidth(200e6, 0)
        self.qtgui_time_sink_x_2 = qtgui.time_sink_c(
        	1024, #size
        	samp_rate, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_2.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_2.enable_tags(-1, True)
        self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_2.enable_autoscale(True)
        self.qtgui_time_sink_x_2.enable_grid(False)
        self.qtgui_time_sink_x_2.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_2.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(2*1):
            if len(labels[i]) == 0:
                if(i % 2 == 0):
                    self.qtgui_time_sink_x_2.set_line_label(i, "Re{{Data {0}}}".format(i/2))
                else:
                    self.qtgui_time_sink_x_2.set_line_label(i, "Im{{Data {0}}}".format(i/2))
            else:
                self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_2_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"A+u*m(t)", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(0.30)
        self.qtgui_time_sink_x_1.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_1.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_1.enable_tags(-1, True)
        self.qtgui_time_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_1.enable_autoscale(True)
        self.qtgui_time_sink_x_1.enable_grid(False)
        self.qtgui_time_sink_x_1.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_1.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        markers = [-1, -1, -1, -1, -1,
                   -1, -1, -1, -1, -1]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        
        for i in xrange(1):
            if len(labels[i]) == 0:
                self.qtgui_time_sink_x_1.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_1.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_1.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_1.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_1.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_1.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_1.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_1_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate, #samp_rate
        	"Message Signal", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.30)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(True)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate, #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_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_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 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_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.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	6e3, #bw
        	"Frequency Response of Recovered Message", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.30)
        self.qtgui_freq_sink_x_0.set_y_axis(-140, 10)
        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_control_panel(False)
        
        if not True:
          self.qtgui_freq_sink_x_0.disable_legend()
        
        if "float" == "float" or "float" == "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.top_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((u, ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((A, ))
        self.analog_sig_source_x_1 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, fc, 0.7, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, fm, 0.7, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.qtgui_freq_sink_x_0, 0))    
        self.connect((self.analog_sig_source_x_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.analog_sig_source_x_1, 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.blocks_add_const_vxx_0, 0), (self.qtgui_time_sink_x_1, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.qtgui_time_sink_x_2, 0))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.uhd_usrp_sink_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.qtgui_freq_sink_x_1, 0))    
Example #40
0
    def __init__(self):
        gr.top_block.__init__(self, "Aprs Rx Test")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Aprs Rx Test")
        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", "aprs_rx_test")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3
        self.sps = sps = int(samp_rate / 1200)
        self.gain_mu = gain_mu = 0.175

        ##################################################
        # Blocks
        ##################################################
        self.show_text_0 = display.show_text()
        self._show_text_0_win = sip.wrapinstance(self.show_text_0.pyqwidget(),
                                                 Qt.QWidget)
        self.top_grid_layout.addWidget(self._show_text_0_win, 2, 0, 1, 2)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            2048,  #size
            1024,  #samp_rate
            "",  #name
            1  #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                  qtgui.TRIG_SLOPE_POS, 0.0, 0,
                                                  0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(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)

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

        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.fsk_demod_0 = fsk_demod(
            baud=1200,
            fsk_hi_tone=2200,
            fsk_lo_tone=1200,
            in_sps=sps,
            out_sps=2,
        )
        self.fft_filter_xxx_0 = filter.fft_filter_fff(1, (firdes.band_pass(
            1, samp_rate, 1000, 2400, 300, firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.epy_block_0 = epy_block_0.blk()
        self.digital_hdlc_deframer_bp_0_0 = digital.hdlc_deframer_bp(32, 500)
        self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(2)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            2 * (1 + 0.0), 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_wavfile_source_0 = blocks.wavfile_source(
            '/home/handiko/aprs_test.wav', True)
        self.blocks_pdu_to_tagged_stream_1 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, 'packet_len')
        self.blocks_not_xx_0 = blocks.not_bb()
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.1, ))
        self.blocks_and_const_xx_0 = blocks.and_const_bb(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_f(
            analog.GR_UNIFORM, 0.1, 0, 8192)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.digital_hdlc_deframer_bp_0_0, 'out'),
                         (self.epy_block_0, 'hdlc in'))
        self.msg_connect((self.epy_block_0, 'ax25 out'),
                         (self.blocks_pdu_to_tagged_stream_1, 'pdus'))
        self.connect((self.analog_fastnoise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fft_filter_xxx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.fsk_demod_0, 0))
        self.connect((self.blocks_and_const_xx_0, 0),
                     (self.digital_hdlc_deframer_bp_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_not_xx_0, 0),
                     (self.blocks_and_const_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_1, 0),
                     (self.show_text_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_diff_decoder_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_diff_decoder_bb_0, 0),
                     (self.blocks_not_xx_0, 0))
        self.connect((self.fft_filter_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.fsk_demod_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
Example #41
0
    def __init__(self):
        gr.top_block.__init__(self, "Receptor APT NOAA")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Receptor APT NOAA")
        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", "AptRxData")
        self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))


        ##################################################
        # Variables
        ##################################################
        self.prefix = prefix = "/home/gonzalo/workspace/github/sdr-apt/wav/"
        self.samp_rate = samp_rate = 960000
        self.recfile3 = recfile3 = prefix +"am_demod/"+ datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + "_20800.wav"
        self.recfile2 = recfile2 = prefix +"am_demod/"+ datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".wav"
        self.recfile = recfile = prefix +"fm_demod/"+ datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".wav"
        self.delay = delay = 0
        self.af_gain = af_gain = 1.5

        ##################################################
        # 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, 'Senal en recepcion')
        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, 'Demodulacion FM')
        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, 'Detector de envolvente')
        self.top_grid_layout.addWidget(self.tab)
        self._delay_range = Range(0, 5, 1, 0, 200)
        self._delay_win = RangeWidget(self._delay_range, self.set_delay, 'Delay', "counter_slider", float)
        self.tab_grid_layout_2.addWidget(self._delay_win)
        self._af_gain_range = Range(0, 3, .1, 1.5, 100)
        self._af_gain_win = RangeWidget(self._af_gain_range, self.set_af_gain, 'Volumen audio', "dial", float)
        self.top_grid_layout.addWidget(self._af_gain_win, 2, 4, 1, 1)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 5):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=20800,
                decimation=48000,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	96000, #bw
        	"", #name
                1 #number of inputs
        )
        self.qtgui_waterfall_sink_x_0.set_update_time(0.10)
        self.qtgui_waterfall_sink_x_0.enable_grid(False)
        self.qtgui_waterfall_sink_x_0.enable_axis_labels(True)

        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.tab_grid_layout_0.addWidget(self._qtgui_waterfall_sink_x_0_win)
        self.qtgui_time_sink_x_2 = qtgui.time_sink_c(
        	1024, #size
        	96000, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_2.set_update_time(0.10)
        self.qtgui_time_sink_x_2.set_y_axis(-1, 1)

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

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

        if not True:
          self.qtgui_time_sink_x_2.disable_legend()

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

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

        self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win)
        self.qtgui_time_sink_x_1 = qtgui.time_sink_f(
        	2080, #size
        	2080*2, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_1.set_update_time(.5)
        self.qtgui_time_sink_x_1.set_y_axis(0, 0.4)

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

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

        if not True:
          self.qtgui_time_sink_x_1.disable_legend()

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

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

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

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

        self.qtgui_time_sink_x_0_0.enable_tags(-1, False)
        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(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(2):
            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_2.addWidget(self._qtgui_time_sink_x_0_0_win)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	1024, #size
        	20800, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

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

        if not True:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [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.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_1.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_freq_sink_x_1 = qtgui.freq_sink_f(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	20800, #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 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_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.tab_grid_layout_1.addWidget(self._qtgui_freq_sink_x_1_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	2048, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	96000, #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(-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(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 True:
          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)
        self.low_pass_filter_0 = filter.fir_filter_fff(1, firdes.low_pass(
        	10, 20800, 1300, 200, firdes.WIN_HAMMING, 6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(5, firdes.WIN_HAMMING, 6.76)
        self.blocks_wavfile_sink_1_0 = blocks.wavfile_sink(recfile3, 1, 20800, 8)
        self.blocks_wavfile_sink_1 = blocks.wavfile_sink(recfile2, 1, 2080*2, 8)
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(recfile, 1, 20800, 16)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, 96000,True)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((.5, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((af_gain, ))
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(5, 1/5., 4000, 1)
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(gr.sizeof_float*1, 5)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/gonzalo/workspace/sdr apt capturas/captura3/2019.01.05.16.36.27.dat', False)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, delay)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=96000,
        	audio_decimation=2,
        )



        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_keep_one_in_n_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_wavfile_sink_1_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.blocks_wavfile_sink_1, 0))
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.qtgui_time_sink_x_1, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_delay_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.analog_wfm_rcv_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_2, 0))
        self.connect((self.blocks_throttle_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_mag_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_wavfile_sink_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_freq_sink_x_1, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.qtgui_time_sink_x_0_0, 1))
Example #42
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Wbfm Transceiver")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.tx_gain = tx_gain = 0
        self.samp_rate = samp_rate = 1000000
        self.rx_gain = rx_gain = 0
        self.nbfm_max_dev = nbfm_max_dev = 75000
        self.center_freq = center_freq = 1000000
        self.audio_rate = audio_rate = 44100
        self.audio_interp = audio_interp = 1

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_f(
            self.GetWin(),
            title='Osciloscope',
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=True,
            xy_mode=False,
            num_inputs=2,
            trig_mode=wxgui.TRIG_MODE_STRIPCHART,
            y_axis_label='Amplitude',
        )
        self.Add(self.wxgui_scopesink2_0_0.win)
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(('addr=192.168.10.3', "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_source_0.set_gain(rx_gain, 0)
        self.uhd_usrp_source_0.set_antenna('RX2', 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(('addr=192.168.10.2', "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(center_freq, 0)
        self.uhd_usrp_sink_0.set_gain(tx_gain, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=int(samp_rate),
            decimation=int(audio_interp * audio_rate),
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=int(audio_rate * audio_interp),
            decimation=int(samp_rate),
            taps=None,
            fractional_bw=None,
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.200, ))
        self.audio_sink_0 = audio.sink(int(audio_rate), '', False)
        self.analog_wfm_tx_0 = analog.wfm_tx(
            audio_rate=int(audio_rate),
            quad_rate=int(audio_rate * audio_interp),
            tau=75e-6,
            max_dev=75e3,
            fh=-1.0,
        )
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=audio_interp * audio_rate,
            audio_decimation=audio_interp,
        )
        self.analog_sig_source_x_0 = analog.sig_source_f(
            audio_rate, analog.GR_COS_WAVE, 440, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0), (self.audio_sink_0, 0))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.wxgui_scopesink2_0_0, 1))
        self.connect((self.analog_wfm_tx_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_wfm_tx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_scopesink2_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.rational_resampler_xxx_0, 0))
Example #43
0
    def __init__(self):
        gr.top_block.__init__(self, "Lang Rx")

        ##################################################
        # Variables
        ##################################################
        self.SQL = SQL = 50
        self.RxOffset = RxOffset = 0
        self.Mute = Mute = False
        self.Mode = Mode = 3
        self.Filt_Low = Filt_Low = 300
        self.Filt_High = Filt_High = 3000
        self.FFTEn = FFTEn = 0
        self.AFGain = AFGain = 20

        ##################################################
        # Blocks
        ##################################################
        self.pluto_source_0 = iio.pluto_source('ip:pluto.local', 1000000000,
                                               528000, 2000000, 0x800, True,
                                               True, True, "slow_attack", 64.0,
                                               '', True)
        self.logpwrfft_x_0 = logpwrfft.logpwrfft_c(
            sample_rate=48000,
            fft_size=512,
            ref_scale=2,
            frame_rate=15,
            avg_alpha=0.9,
            average=True,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(
            11, (firdes.low_pass(1, 529200, 23000, 2000)), RxOffset, 528000)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float * 512)
        self.blocks_multiply_const_vxx_2_1 = blocks.multiply_const_vff(
            (Mode == 5, ))
        self.blocks_multiply_const_vxx_2_0 = blocks.multiply_const_vff(
            (Mode == 4, ))
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff(
            (Mode < 4, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(
            ((AFGain / 100.0) * (not Mute), ))
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float * 512,
                                                   '/tmp/langstonefft', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.blocks_add_xx_1_0 = blocks.add_vff(1)
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_float * 512,
            num_inputs=1,
            num_outputs=2,
            input_index=0,
            output_index=FFTEn,
        )
        self.band_pass_filter_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, 48000, Filt_Low, Filt_High, 100,
                                     firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "hw:CARD=Device,DEV=0", False)
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_cc(
            SQL - 100, 0.001, 0, False)
        self.analog_nbfm_rx_0 = analog.nbfm_rx(
            audio_rate=48000,
            quad_rate=48000,
            tau=75e-6,
            max_dev=5e3,
        )
        self.analog_agc3_xx_0 = analog.agc3_cc(1e-2, 5e-7, 0.1, 1.0, 1)
        self.analog_agc3_xx_0.set_max_gain(1000)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc3_xx_0, 0),
                     (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.analog_nbfm_rx_0, 0),
                     (self.blocks_multiply_const_vxx_2_0, 0))
        self.connect((self.analog_pwr_squelch_xx_0, 0),
                     (self.analog_nbfm_rx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_complex_to_mag_0, 0))
        self.connect((self.band_pass_filter_0, 0),
                     (self.blocks_complex_to_real_0, 0))
        self.connect((self.blks2_selector_0, 1), (self.blocks_file_sink_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_add_xx_1, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_add_xx_1_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_mag_0, 0),
                     (self.blocks_multiply_const_vxx_2_1, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0),
                     (self.blocks_add_xx_1, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.analog_agc3_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0),
                     (self.blocks_add_xx_1_0, 0))
        self.connect((self.blocks_multiply_const_vxx_2_0, 0),
                     (self.blocks_add_xx_1, 1))
        self.connect((self.blocks_multiply_const_vxx_2_1, 0),
                     (self.blocks_add_xx_1_0, 1))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.band_pass_filter_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.logpwrfft_x_0, 0))
        self.connect((self.logpwrfft_x_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.pluto_source_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
Example #44
0
    def __init__(self, magnitude=0, phase=0, mode=0):
        '''
        This block implements the single branch IQ imbalance
        transmitter and receiver models.

        Developed from source (2014):
        "In-Phase and Quadrature Imbalance:
          Modeling, Estimation, and Compensation"

        TX Impairment:

                                  {R}--|Multiply: 10**(mag/20)|--+--|Multiply: cos(pi*degree/180)|--X1
        Input ---|Complex2Float|---|                             +--|Multiply: sin(pi*degree/180)|--X2
                                  {I}--|  Adder  |
                                   X2--|   (+)   |--X3

                          X1--{R}--| Float 2 |--- Output
                          X3--{I}--| Complex |

        RX Impairment:

                                  {R}--|Multiply: cos(pi*degree/180)|-------|       |
        Input ---|Complex2Float|---|                                        | Adder |--X1
                                  {I}--+--|Multiply: sin(pi*degree/180)|----|  (+)  |
                                       |
                                       +--X2

                        X1--|Multply: 10**(mag/20)|--{R}--| Float 2 |--- Output
                        X2---------------------------{I}--| Complex |

        (ASCII ART monospace viewing)
        '''
        gr.hier_block2.__init__(
            self,
            "IQ Imbalance Generator",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.magnitude = magnitude
        self.phase = phase
        self.mode = mode

        ##################################################
        # Blocks
        ##################################################
        # Same blocks for Transmitter and Receiver
        self.mag = blocks.multiply_const_vff((math.pow(10,
                                                       magnitude / 20.0), ))
        self.sin_phase = blocks.multiply_const_vff(
            (math.sin(phase * math.pi / 180.0), ))
        self.cos_phase = blocks.multiply_const_vff(
            (math.cos(phase * math.pi / 180.0), ))
        self.f2c = blocks.float_to_complex(1)
        self.c2f = blocks.complex_to_float(1)
        self.adder = blocks.add_vff(1)

        ##################################################
        # Connections
        ##################################################
        if (self.mode):
            # Receiver Mode
            self.connect((self, 0), (self.c2f, 0))
            self.connect((self.c2f, 0), (self.cos_phase, 0))
            self.connect((self.cos_phase, 0), (self.adder, 0))
            self.connect((self.c2f, 1), (self.sin_phase, 0))
            self.connect((self.sin_phase, 0), (self.adder, 1))
            self.connect((self.adder, 0), (self.mag, 0))
            self.connect((self.mag, 0), (self.f2c, 0))
            self.connect((self.c2f, 1), (self.f2c, 1))
            self.connect((self.f2c, 0), (self, 0))
        else:
            # Transmitter Mode
            self.connect((self, 0), (self.c2f, 0))
            self.connect((self.c2f, 0), (self.mag, 0))
            self.connect((self.mag, 0), (self.cos_phase, 0))
            self.connect((self.cos_phase, 0), (self.f2c, 0))
            self.connect((self.mag, 0), (self.sin_phase, 0))
            self.connect((self.sin_phase, 0), (self.adder, 0))
            self.connect((self.c2f, 1), (self.adder, 1))
            self.connect((self.adder, 0), (self.f2c, 1))
            self.connect((self.f2c, 0), (self, 0))
Example #45
0
    def __init__(self, MTU=1500):
        gr.top_block.__init__(self, "Telemetry Rx Final 1095B")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Telemetry Rx Final 1095B")
        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_1095B")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

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

        ##################################################
        # Variables
        ##################################################
        self.symb_rate = symb_rate = 52083
        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.source_option = source_option = True
        self.loopbw_range = 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 = 2000000
        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._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, 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._loopbw_range_range = Range(0.001, 2, 0.001, 0.4, 10000)
        self._loopbw_range_win = RangeWidget(self._loopbw_range_range,
                                             self.set_loopbw_range,
                                             "loopbw_range", "dial", float)
        self.tab_grid_layout_1.addWidget(self._loopbw_range_win, 0, 0, 1, 2)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 2):
            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, 2, 1, 2)
        for r in range(0, 1):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(2, 4):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self.satellites_decode_rs_general_0 = satellites.decode_rs_general(
            285, 0, 1, 32, False)
        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(
            1095 + 10,  #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 = qtgui.time_sink_f(
            1115 + 10,  #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(
            1279 * 2 * 8 + 5000,  #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_zafar_telemetry_deinterleave_0 = iustsat.zafar_telemetry_deinterleave(
            "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', 1279 * 2 * 8)
        self.iustsat_synch_detect_tag_1 = iustsat.synch_detect_tag(
            60, 'pkt_len', 1279 * 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_pdu_debug_0_0 = iustsat.pdu_debug('auth_tag')
        self.iustsat_pack_rsblock_0 = iustsat.pack_rsblock("pkt_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, loopbw_range, 0.5, 100, 2, 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 = 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 = 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, 1, 4000, 1)
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_gr_complex * 1,
            '/home/iust/Documents/zafar_prj/REC5_1095B.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((4, ))
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.analog_pll_freqdet_cf_0 = analog.pll_freqdet_cf(
            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_debug_0_0, 'pdu_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_pack_rsblock_0, 'out'),
                         (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.iustsat_pack_rsblock_0, 'out'),
                         (self.iustsat_rs_to_decrypt_0_0, 'in'))
        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_deinterleave_0, 'out'),
                         (self.satellites_decode_rs_general_0, 'in'))
        self.msg_connect((self.iustsat_zafar_telemetry_derand_0, 'out'),
                         (self.iustsat_zafar_telemetry_deinterleave_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.iustsat_pack_rsblock_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_moving_average_xx_0, 0),
                     (self.qtgui_time_sink_x_0, 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, 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.dc_blocker_xx_0, 0),
                     (self.blocks_moving_average_xx_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))
    def __init__(self, samp_rate=80e6):
        gr.top_block.__init__(
            self, "INMARSAT BGAN Service, C-Band Return, Transponder 2")
        Qt.QWidget.__init__(self)
        self.setWindowTitle(
            "INMARSAT BGAN Service, C-Band Return, Transponder 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", "inmarsat_cband_playback_3")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Parameters
        ##################################################
        self.samp_rate = samp_rate

        ##################################################
        # Variables
        ##################################################
        self.xpndr_offset = xpndr_offset = [-23e6, -7.5e6, 8e6, 23e6]
        self.xpndr_id = xpndr_id = 1
        self.rf_freq = rf_freq = 3627.5e6
        self.offset = offset = 0
        self.rf_center = rf_center = (rf_freq + xpndr_offset[xpndr_id] +
                                      offset)
        self.hs_lo = hs_lo = 5150e6
        self.xpndr_lbl = xpndr_lbl = "{:s}, Center [MHz]: {:4.3f}, BW [MHz]: 1.0".format(
            str(xpndr_id + 1), rf_center / 1e6)
        self.if_freq = if_freq = hs_lo - rf_freq
        self.xpndr_lbll = xpndr_lbll = xpndr_lbl
        self.xpndr_4_offset = xpndr_4_offset = xpndr_offset[3]
        self.xpndr_3_offset = xpndr_3_offset = xpndr_offset[2]
        self.xpndr_2_offset = xpndr_2_offset = xpndr_offset[1]
        self.xpndr_1_offset = xpndr_1_offset = xpndr_offset[0]
        self.rf_freq_lbl = rf_freq_lbl = rf_freq
        self.resamp_rate = resamp_rate = 0.175
        self.if_freq_lbl = if_freq_lbl = if_freq
        self.fg_title = fg_title = "INMARSAT BGAN Service, C-Band Return, Transponder {:s}".format(
            str(xpndr_id + 1))

        ##################################################
        # 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, 'Transponder 1')
        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, 'Transponder 2')
        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, 'Transponder 3')
        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, 'Transponder 4')
        self.top_grid_layout.addWidget(self.tab, 2, 0, 4, 2)
        for r in range(2, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._offset_tool_bar = Qt.QToolBar(self)
        self._offset_tool_bar.addWidget(Qt.QLabel("offset" + ": "))
        self._offset_line_edit = Qt.QLineEdit(str(self.offset))
        self._offset_tool_bar.addWidget(self._offset_line_edit)
        self._offset_line_edit.returnPressed.connect(lambda: self.set_offset(
            eng_notation.str_to_num(
                str(self._offset_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._offset_tool_bar, 8, 2, 1, 2)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._xpndr_lbll_tool_bar = Qt.QToolBar(self)

        if None:
            self._xpndr_lbll_formatter = None
        else:
            self._xpndr_lbll_formatter = lambda x: str(x)

        self._xpndr_lbll_tool_bar.addWidget(Qt.QLabel('Transponder' + ": "))
        self._xpndr_lbll_label = Qt.QLabel(
            str(self._xpndr_lbll_formatter(self.xpndr_lbll)))
        self._xpndr_lbll_tool_bar.addWidget(self._xpndr_lbll_label)
        self.top_grid_layout.addWidget(self._xpndr_lbll_tool_bar, 9, 2, 1, 2)
        for r in range(9, 10):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._rf_freq_lbl_tool_bar = Qt.QToolBar(self)

        if None:
            self._rf_freq_lbl_formatter = None
        else:
            self._rf_freq_lbl_formatter = lambda x: eng_notation.num_to_str(x)

        self._rf_freq_lbl_tool_bar.addWidget(Qt.QLabel('RF' + ": "))
        self._rf_freq_lbl_label = Qt.QLabel(
            str(self._rf_freq_lbl_formatter(self.rf_freq_lbl)))
        self._rf_freq_lbl_tool_bar.addWidget(self._rf_freq_lbl_label)
        self.top_grid_layout.addWidget(self._rf_freq_lbl_tool_bar, 8, 0, 1, 1)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 1):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate * resamp_rate * 0.071428571,  #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(False)

        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(-100, -20)

        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, 3,
                                       2, 3, 2)
        for r in range(3, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            rf_freq + xpndr_offset[xpndr_id] + offset,  #fc
            samp_rate * resamp_rate * 0.071428571,  #bw
            "",  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.0010)
        self.qtgui_freq_sink_x_0.set_y_axis(-100, -20)
        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(True)
        self.qtgui_freq_sink_x_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0.enable_axis_labels(False)
        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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 2, 2, 1,
                                       2)
        for r in range(2, 3):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.pfb_arb_resampler_xxx_0_1 = pfb.arb_resampler_ccf(resamp_rate,
                                                               taps=None,
                                                               flt_size=32)
        self.pfb_arb_resampler_xxx_0_1.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0_0_0_0 = pfb.arb_resampler_ccf(0.071428571,
                                                                   taps=None,
                                                                   flt_size=32)
        self.pfb_arb_resampler_xxx_0_0_0_0.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0_0_0 = pfb.arb_resampler_ccf(resamp_rate,
                                                                 taps=None,
                                                                 flt_size=32)
        self.pfb_arb_resampler_xxx_0_0_0.declare_sample_delay(0)

        self.pfb_arb_resampler_xxx_0_0 = pfb.arb_resampler_ccf(resamp_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(resamp_rate,
                                                             taps=None,
                                                             flt_size=32)
        self.pfb_arb_resampler_xxx_0.declare_sample_delay(0)

        self._if_freq_lbl_tool_bar = Qt.QToolBar(self)

        if None:
            self._if_freq_lbl_formatter = None
        else:
            self._if_freq_lbl_formatter = lambda x: eng_notation.num_to_str(x)

        self._if_freq_lbl_tool_bar.addWidget(Qt.QLabel('IF' + ": "))
        self._if_freq_lbl_label = Qt.QLabel(
            str(self._if_freq_lbl_formatter(self.if_freq_lbl)))
        self._if_freq_lbl_tool_bar.addWidget(self._if_freq_lbl_label)
        self.top_grid_layout.addWidget(self._if_freq_lbl_tool_bar, 8, 1, 1, 1)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(1, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0_2 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0_2.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0_2.set_frequency_range(rf_freq, samp_rate)
        self._fosphor_qt_sink_c_0_2_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0_2.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._fosphor_qt_sink_c_0_2_win, 0, 0,
                                       2, 4)
        for r in range(0, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0_1 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0_1.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0_1.set_frequency_range(
            rf_freq + xpndr_3_offset, samp_rate * resamp_rate)
        self._fosphor_qt_sink_c_0_1_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0_1.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_2.addWidget(self._fosphor_qt_sink_c_0_1_win, 0, 0,
                                         4, 4)
        for r in range(0, 4):
            self.tab_grid_layout_2.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_2.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0_0_0 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0_0_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0_0_0.set_frequency_range(
            rf_freq + xpndr_4_offset, samp_rate * resamp_rate)
        self._fosphor_qt_sink_c_0_0_0_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_3.addWidget(self._fosphor_qt_sink_c_0_0_0_win, 0,
                                         0, 4, 4)
        for r in range(0, 4):
            self.tab_grid_layout_3.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_3.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0_0 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0_0.set_frequency_range(
            rf_freq + xpndr_2_offset, samp_rate * resamp_rate)
        self._fosphor_qt_sink_c_0_0_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_1.addWidget(self._fosphor_qt_sink_c_0_0_win, 0, 0,
                                         4, 4)
        for r in range(0, 4):
            self.tab_grid_layout_1.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_1.setColumnStretch(c, 1)
        self.fosphor_qt_sink_c_0 = fosphor.qt_sink_c()
        self.fosphor_qt_sink_c_0.set_fft_window(window.WIN_BLACKMAN_hARRIS)
        self.fosphor_qt_sink_c_0.set_frequency_range(rf_freq + xpndr_1_offset,
                                                     samp_rate * resamp_rate)
        self._fosphor_qt_sink_c_0_win = sip.wrapinstance(
            self.fosphor_qt_sink_c_0.pyqwidget(), Qt.QWidget)
        self.tab_grid_layout_0.addWidget(self._fosphor_qt_sink_c_0_win, 0, 0,
                                         4, 4)
        for r in range(0, 4):
            self.tab_grid_layout_0.setRowStretch(r, 1)
        for c in range(0, 4):
            self.tab_grid_layout_0.setColumnStretch(c, 1)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex * 1,
                                                 samp_rate, True)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, ))
        self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex(
            False, False)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_1 = blocks.file_source(
            gr.sizeof_short * 1,
            '/data1/captures/inmarsat_c/4F3_F5BE35_20180903_043333.872099_UTC_80M.short',
            True)
        self.blocks_file_source_1.set_begin_tag(pmt.PMT_NIL)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_sig_source_x_0_1 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * xpndr_3_offset, 1, 0)
        self.analog_sig_source_x_0_0_1 = analog.sig_source_c(
            samp_rate * resamp_rate, analog.GR_COS_WAVE, -1 * (offset), 1, 0)
        self.analog_sig_source_x_0_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * xpndr_4_offset, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * xpndr_2_offset, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, -1 * xpndr_1_offset, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0),
                     (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 1))
        self.connect((self.analog_sig_source_x_0_0_1, 0),
                     (self.blocks_multiply_xx_0_0_1, 1))
        self.connect((self.analog_sig_source_x_0_1, 0),
                     (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_file_source_1, 0),
                     (self.blocks_interleaved_short_to_complex_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.fosphor_qt_sink_c_0_2, 0))
        self.connect((self.blocks_interleaved_short_to_complex_0, 0),
                     (self.blocks_throttle_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.pfb_arb_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0),
                     (self.pfb_arb_resampler_xxx_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_0, 0),
                     (self.pfb_arb_resampler_xxx_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_0_1, 0),
                     (self.pfb_arb_resampler_xxx_0_0_0_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0),
                     (self.pfb_arb_resampler_xxx_0_1, 0))
        self.connect((self.blocks_throttle_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0, 0),
                     (self.fosphor_qt_sink_c_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.blocks_multiply_xx_0_0_1, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0, 0),
                     (self.fosphor_qt_sink_c_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0_0, 0),
                     (self.fosphor_qt_sink_c_0_0_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0_0_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_0_0_0, 0),
                     (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.pfb_arb_resampler_xxx_0_1, 0),
                     (self.fosphor_qt_sink_c_0_1, 0))
Example #47
0
    def __init__(self,
                 callsign='',
                 invert=1,
                 ip='::',
                 latitude=0,
                 longitude=0,
                 port=7355,
                 recstart=''):
        gr.top_block.__init__(self, "TW-1C decoder")

        ##################################################
        # Parameters
        ##################################################
        self.callsign = callsign
        self.invert = invert
        self.ip = ip
        self.latitude = latitude
        self.longitude = longitude
        self.port = port
        self.recstart = recstart

        ##################################################
        # Variables
        ##################################################
        self.threshold = threshold = 6
        self.gain_mu = gain_mu = 0.175 * 3
        self.access_code = access_code = "10010011000010110101000111011110"

        ##################################################
        # Blocks
        ##################################################
        self.sync_to_pdu_packed_0 = sync_to_pdu_packed(
            packlen=256,
            sync=access_code,
            threshold=threshold,
        )
        self.sids_submit_0 = sids.submit(
            'http://tlm.pe0sat.nl/tlmdb/frame_db.php', 40926, callsign,
            longitude, latitude, recstart)
        self.sids_print_timestamp_0 = sids.print_timestamp('%Y-%m-%d %H:%M:%S')
        self.low_pass_filter_0 = filter.fir_filter_fff(
            1, firdes.low_pass(1, 48000, 2400, 2000, firdes.WIN_HAMMING, 6.76))
        self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0x00, 16)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(
            10, 0.25 * gain_mu * gain_mu, 0.5, gain_mu, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1, ip,
                                                     port, 1472, False)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767.0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff(
            (invert * 10, ))
        self.blocks_message_debug_0 = blocks.message_debug()
        self.ax100_gomx3_rs_decode_0 = ax100.gomx3_rs_decode(False)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ax100_gomx3_rs_decode_0, 'out'),
                         (self.sids_print_timestamp_0, 'in'))
        self.msg_connect((self.ax100_gomx3_rs_decode_0, 'out'),
                         (self.sids_submit_0, 'in'))
        self.msg_connect((self.sids_print_timestamp_0, 'out'),
                         (self.blocks_message_debug_0, 'print_pdu'))
        self.msg_connect((self.sync_to_pdu_packed_0, 'out'),
                         (self.ax100_gomx3_rs_decode_0, 'in'))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.digital_descrambler_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_descrambler_bb_0, 0),
                     (self.sync_to_pdu_packed_0, 0))
        self.connect((self.low_pass_filter_0, 0),
                     (self.digital_clock_recovery_mm_xx_0, 0))
Example #48
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Fm Radio Hackrf")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 5e6
        self.channel_width = channel_width = 200e3
        self.channel_freq = channel_freq = 100e6
        self.center_freq = center_freq = 107.3e6
        self.audio_gain = audio_gain = 1

        ##################################################
        # Blocks
        ##################################################
        _center_freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._center_freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_center_freq_sizer,
        	value=self.center_freq,
        	callback=self.set_center_freq,
        	label='center_freq',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._center_freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_center_freq_sizer,
        	value=self.center_freq,
        	callback=self.set_center_freq,
        	minimum=88e6,
        	maximum=108e6,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_center_freq_sizer)
        _audio_gain_sizer = wx.BoxSizer(wx.VERTICAL)
        self._audio_gain_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	label='audio_gain',
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._audio_gain_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_audio_gain_sizer,
        	value=self.audio_gain,
        	callback=self.set_audio_gain,
        	minimum=0,
        	maximum=10,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_audio_gain_sizer)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=center_freq,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        	win=window.hamming,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=12,
                decimation=5,
                taps=None,
                fractional_bw=None,
        )
        self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + 'hackrf=0' )
        self.osmosdr_source_0.set_sample_rate(samp_rate)
        self.osmosdr_source_0.set_center_freq(center_freq, 0)
        self.osmosdr_source_0.set_freq_corr(0, 0)
        self.osmosdr_source_0.set_dc_offset_mode(0, 0)
        self.osmosdr_source_0.set_iq_balance_mode(0, 0)
        self.osmosdr_source_0.set_gain_mode(False, 0)
        self.osmosdr_source_0.set_gain(10, 0)
        self.osmosdr_source_0.set_if_gain(20, 0)
        self.osmosdr_source_0.set_bb_gain(20, 0)
        self.osmosdr_source_0.set_antenna('', 0)
        self.osmosdr_source_0.set_bandwidth(0, 0)

        self.low_pass_filter_0 = filter.fir_filter_ccf(int(samp_rate/channel_width), firdes.low_pass(
        	1, samp_rate, 75e3, 25e3, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((audio_gain, ))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=480e3,
        	audio_decimation=10,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_rcv_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_wfm_rcv_0, 0))
Example #49
0
    def __init__(self,
                 lo_offset_freq=1e6,
                 threshold_dB=-70,
                 RF=2.49e9,
                 DC_filter_num_elements=4,
                 speed_samp_rate=1,
                 samp_rate=1e6,
                 highpass_cutoff_freq=0,
                 lowpass_cutoff_freq=1700,
                 fft_len=pow(2, 20),
                 samp_rate_sink=8000,
                 angle=0,
                 tx_amp=1,
                 rx_gain=30.5):
        grc_wxgui.top_block_gui.__init__(self, title="CW Radar Single Target")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.lo_offset_freq = lo_offset_freq
        self.threshold_dB = threshold_dB
        self.RF = RF
        self.DC_filter_num_elements = DC_filter_num_elements
        self.speed_samp_rate = speed_samp_rate
        self.samp_rate = samp_rate
        self.highpass_cutoff_freq = highpass_cutoff_freq
        self.lowpass_cutoff_freq = lowpass_cutoff_freq
        self.fft_len = fft_len
        self.samp_rate_sink = samp_rate_sink
        self.angle = angle
        self.tx_amp = tx_amp
        self.rx_gain = rx_gain

        ##################################################
        # Variables
        ##################################################
        self.target_speed = target_speed = 0
        self.target_direction = target_direction = 0
        self.tx_amp_tuner = tx_amp_tuner = tx_amp
        self.threshold_dB_tuner = threshold_dB_tuner = threshold_dB
        self.speed_textbox = speed_textbox = target_speed
        self.rx_gain_tuner = rx_gain_tuner = rx_gain
        self.lowpass_cutoff_freq_tuner = lowpass_cutoff_freq_tuner = lowpass_cutoff_freq
        self.highpass_cutoff_freq_tuner = highpass_cutoff_freq_tuner = highpass_cutoff_freq
        self.direction_textbox = direction_textbox = target_direction
        self.angle_tuner = angle_tuner = angle
        self.RF_tuner = RF_tuner = RF

        ##################################################
        # Blocks
        ##################################################
        _tx_amp_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tx_amp_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_tx_amp_tuner_sizer,
            value=self.tx_amp_tuner,
            callback=self.set_tx_amp_tuner,
            label="TX Signal Amp",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._tx_amp_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_tx_amp_tuner_sizer,
            value=self.tx_amp_tuner,
            callback=self.set_tx_amp_tuner,
            minimum=0,
            maximum=1,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_tx_amp_tuner_sizer, 0, 17, 1, 26)
        _threshold_dB_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_dB_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_threshold_dB_tuner_sizer,
            value=self.threshold_dB_tuner,
            callback=self.set_threshold_dB_tuner,
            label="Detected Target Threshold (dB)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._threshold_dB_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_threshold_dB_tuner_sizer,
            value=self.threshold_dB_tuner,
            callback=self.set_threshold_dB_tuner,
            minimum=-90,
            maximum=-30,
            num_steps=60,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_threshold_dB_tuner_sizer, 2, 0, 1, 17)
        self.speed_probe = blocks.probe_signal_f()
        _rx_gain_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rx_gain_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rx_gain_tuner_sizer,
            value=self.rx_gain_tuner,
            callback=self.set_rx_gain_tuner,
            label="USRP RX Gain (dB)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rx_gain_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rx_gain_tuner_sizer,
            value=self.rx_gain_tuner,
            callback=self.set_rx_gain_tuner,
            minimum=0,
            maximum=30.5 + 62,
            num_steps=185,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_rx_gain_tuner_sizer, 0, 0, 1, 17)
        self.notebook = self.notebook = wx.Notebook(self.GetWin(),
                                                    style=wx.NB_TOP)
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "FFT CW Doppler Radar Receiver")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "Frequency/Time CW Doppler Radar Receiver")
        self.notebook.AddPage(grc_wxgui.Panel(self.notebook),
                              "FFT CW Doppler Radar Receiver Full Spectrum")
        self.GridAdd(self.notebook, 5, 0, 13, 75)
        _lowpass_cutoff_freq_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._lowpass_cutoff_freq_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_lowpass_cutoff_freq_tuner_sizer,
            value=self.lowpass_cutoff_freq_tuner,
            callback=self.set_lowpass_cutoff_freq_tuner,
            label="Lowpass Cutoff Frequency (Hz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._lowpass_cutoff_freq_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_lowpass_cutoff_freq_tuner_sizer,
            value=self.lowpass_cutoff_freq_tuner,
            callback=self.set_lowpass_cutoff_freq_tuner,
            minimum=0,
            maximum=3000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_lowpass_cutoff_freq_tuner_sizer, 1, 43, 1, 32)
        _highpass_cutoff_freq_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._highpass_cutoff_freq_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_highpass_cutoff_freq_tuner_sizer,
            value=self.highpass_cutoff_freq_tuner,
            callback=self.set_highpass_cutoff_freq_tuner,
            label="High-Pass Cutoff Frequency (Hz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._highpass_cutoff_freq_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_highpass_cutoff_freq_tuner_sizer,
            value=self.highpass_cutoff_freq_tuner,
            callback=self.set_highpass_cutoff_freq_tuner,
            minimum=0,
            maximum=1600,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_highpass_cutoff_freq_tuner_sizer, 0, 43, 1, 32)
        self.direction_probe = blocks.probe_signal_i()
        _angle_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._angle_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_angle_tuner_sizer,
            value=self.angle_tuner,
            callback=self.set_angle_tuner,
            label="Angle of Approach of the Target (Deg)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._angle_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_angle_tuner_sizer,
            value=self.angle_tuner,
            callback=self.set_angle_tuner,
            minimum=0,
            maximum=89,
            num_steps=890,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_angle_tuner_sizer, 1, 17, 1, 26)
        _RF_tuner_sizer = wx.BoxSizer(wx.VERTICAL)
        self._RF_tuner_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_RF_tuner_sizer,
            value=self.RF_tuner,
            callback=self.set_RF_tuner,
            label="Radar Frequency (Hz)",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._RF_tuner_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_RF_tuner_sizer,
            value=self.RF_tuner,
            callback=self.set_RF_tuner,
            minimum=2.4e9,
            maximum=2.5e9,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.GridAdd(_RF_tuner_sizer, 1, 0, 1, 17)
        self.wxgui_waterfallsink = waterfallsink2.waterfall_sink_c(
            self.notebook.GetPage(1).GetWin(),
            baseband_freq=0,
            dynamic_range=100,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate_sink,
            fft_size=1024,
            fft_rate=100,
            average=False,
            avg_alpha=None,
            title="Time/Frequency CW Doppler Radar",
            win=window.blackmanharris,
        )
        self.notebook.GetPage(1).Add(self.wxgui_waterfallsink.win)
        self.wxgui_fftsink2_full_spectrum = 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,
            fft_size=4096,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT CW Doppler Radar Receiver Full Spectrum",
            peak_hold=False,
            win=window.blackmanharris,
        )
        self.notebook.GetPage(2).Add(self.wxgui_fftsink2_full_spectrum.win)
        self.wxgui_fftsink = 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_sink,
            fft_size=1024,
            fft_rate=100,
            average=False,
            avg_alpha=None,
            title="FFT CW Doppler Radar Receiver ",
            peak_hold=False,
            win=window.blackmanharris,
        )
        self.notebook.GetPage(0).Add(self.wxgui_fftsink.win)
        self.usrp_transmitter = uhd.usrp_sink(
            ",".join(('addr=192.168.10.2', "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.usrp_transmitter.set_clock_source("internal", 0)
        self.usrp_transmitter.set_samp_rate(samp_rate)
        self.usrp_transmitter.set_center_freq(RF_tuner, 0)
        self.usrp_transmitter.set_gain(0, 0)
        self.usrp_transmitter.set_antenna('TX/RX', 0)
        self.usrp_receiver = uhd.usrp_source(
            ",".join(('addr=192.168.10.3', "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.usrp_receiver.set_clock_source("mimo", 0)
        self.usrp_receiver.set_time_source("mimo", 0)
        self.usrp_receiver.set_samp_rate(samp_rate)
        self.usrp_receiver.set_center_freq(
            uhd.tune_request(RF_tuner, lo_offset_freq), 0)
        self.usrp_receiver.set_gain(rx_gain_tuner, 0)
        self.usrp_receiver.set_antenna("J1", 0)
        self.usrp_receiver.set_bandwidth(15e6, 0)

        def _target_speed_probe():
            while True:
                val = self.speed_probe.level()
                try:
                    self.set_target_speed(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (2))

        _target_speed_thread = threading.Thread(target=_target_speed_probe)
        _target_speed_thread.daemon = True
        _target_speed_thread.start()

        def _target_direction_probe():
            while True:
                val = self.direction_probe.level()
                try:
                    ##############################################
                    if val == 1:  #if the value is 1 the target is approaching.
                        val = "Approaching"
                    elif val == 2:  #if the value is 2 the target is receding.
                        val = "Receding"
                    elif val == 0:  #if the value is 0 there is no target in sight.
                        val = "No Target Detected"
                    self.set_target_direction(val)
                    ###############################################
                except AttributeError:
                    pass
                time.sleep(1.0 / (2))

        _target_direction_thread = threading.Thread(
            target=_target_direction_probe)
        _target_direction_thread.daemon = True
        _target_direction_thread.start()
        self._speed_textbox_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.speed_textbox,
            callback=self.set_speed_textbox,
            label="Target Speed (Kph)",
            converter=forms.float_converter(),
        )
        self.GridAdd(self._speed_textbox_text_box, 3, 0, 1, 17)
        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=1,
            decimation=int(samp_rate / samp_rate_sink),
            taps=None,
            fractional_bw=None,
        )
        self.fft_vxx_0 = fft.fft_vcc(fft_len, True,
                                     (window.blackmanharris(fft_len)), True, 1)
        self._direction_textbox_text_box = forms.text_box(
            parent=self.GetWin(),
            value=self.direction_textbox,
            callback=self.set_direction_textbox,
            label="Target Direction",
            converter=forms.str_converter(),
        )
        self.GridAdd(self._direction_textbox_text_box, 4, 0, 1, 17)
        self.cwradar_vector_flip_ff = cwradar.vector_flip_ff(fft_len / 2)
        self.cwradar_doppler_velocity_single_target_ff_0 = cwradar.doppler_velocity_single_target_ff(
            fft_len / 2, samp_rate, RF_tuner, threshold_dB_tuner, angle_tuner,
            lowpass_cutoff_freq_tuner, highpass_cutoff_freq_tuner)
        self.complex_to_mag = blocks.complex_to_mag(fft_len)
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_float * 1, fft_len)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_float * 1, fft_len)
        self.blocks_stream_to_vector_1_0 = blocks.stream_to_vector(
            gr.sizeof_float * 1, fft_len / 2)
        self.blocks_stream_to_vector_1 = blocks.stream_to_vector(
            gr.sizeof_float * 1, fft_len / 2)
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_keep_m_in_n_0_0 = blocks.keep_m_in_n(
            gr.sizeof_float, fft_len / 2, fft_len, fft_len / 2)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_float,
                                                       fft_len / 2, fft_len, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, 0, tx_amp_tuner, 0)
        self.DC_filter_0 = blocks.multiply_const_vff(
            ([0] * DC_filter_num_elements + [1] *
             ((fft_len / 2) - DC_filter_num_elements)))
        self.DC_filter = blocks.multiply_const_vff(
            ([0] * DC_filter_num_elements + [1] *
             ((fft_len / 2) - DC_filter_num_elements)))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.blocks_keep_m_in_n_0_0, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0),
                     (self.blocks_stream_to_vector_1, 0))
        self.connect((self.blocks_keep_m_in_n_0_0, 0),
                     (self.blocks_stream_to_vector_1_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.blocks_stream_to_vector_1_0, 0),
                     (self.DC_filter_0, 0))
        self.connect((self.blocks_stream_to_vector_1, 0),
                     (self.cwradar_vector_flip_ff, 0))
        self.connect((self.cwradar_vector_flip_ff, 0), (self.DC_filter, 0))
        self.connect((self.rational_resampler, 0),
                     (self.wxgui_waterfallsink, 0))
        self.connect((self.rational_resampler, 0), (self.wxgui_fftsink, 0))
        self.connect((self.fft_vxx_0, 0), (self.complex_to_mag, 0))
        self.connect((self.blocks_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.complex_to_mag, 0),
                     (self.blocks_vector_to_stream_0, 0))
        self.connect((self.complex_to_mag, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.DC_filter_0, 0),
                     (self.cwradar_doppler_velocity_single_target_ff_0, 1))
        self.connect((self.DC_filter, 0),
                     (self.cwradar_doppler_velocity_single_target_ff_0, 0))
        self.connect((self.cwradar_doppler_velocity_single_target_ff_0, 0),
                     (self.speed_probe, 0))
        self.connect((self.cwradar_doppler_velocity_single_target_ff_0, 1),
                     (self.direction_probe, 0))
        self.connect((self.usrp_receiver, 0),
                     (self.wxgui_fftsink2_full_spectrum, 0))
        self.connect((self.usrp_receiver, 0), (self.rational_resampler, 0))
        self.connect((self.usrp_receiver, 0),
                     (self.blocks_stream_to_vector_0, 0))
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.usrp_transmitter, 0))
Example #50
0
    def __init__(self):
        gr.top_block.__init__(self, "AM_receive")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("AM_receive")
        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", "am_receive")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.volume = volume = 300e-3
        self.samp_rate = samp_rate = 1e6
        self.decim = decim = 8

        ##################################################
        # Blocks
        ##################################################
        self._volume_range = Range(0, 1, 50e-3, 300e-3, 200)
        self._volume_win = RangeWidget(self._volume_range, self.set_volume, "volume", "counter_slider", float)
        self.top_layout.addWidget(self._volume_win)
        self.zeromq_sub_source_0 = zeromq.sub_source(gr.sizeof_float, 1, "tcp://127.0.0.1:50001", 100, False, -1)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	256, #size
        	int(samp_rate/decim), #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)
        
        self.qtgui_time_sink_x_0.set_y_label("Amplitude", "")
        
        self.qtgui_time_sink_x_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_control_panel(False)
        
        if not True:
          self.qtgui_time_sink_x_0.disable_legend()
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        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.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
            self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
            self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
            self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
            self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
            self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf(decim, (firdes.low_pass(1,samp_rate, (samp_rate/(2*decim)), 2000)), 48e3, samp_rate)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((volume, ))
        self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1)
        self.band_pass_filter_0 = filter.fir_filter_fff(1, firdes.band_pass(
        	1, samp_rate/decim, 500, 6000, 400, firdes.WIN_HAMMING, 6.76))
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_agc_xx_0 = analog.agc_cc(625e-6, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_agc_xx_0, 0), (self.blocks_complex_to_mag_0, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.band_pass_filter_0, 0), (self.blocks_multiply_const_vxx_0, 0))    
        self.connect((self.blocks_complex_to_mag_0, 0), (self.band_pass_filter_0, 0))    
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.analog_agc_xx_0, 0))    
        self.connect((self.zeromq_sub_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
Example #51
0
    def __init__(self, lpf_cutoff=24e3, lpf_trans=1e3):
        gr.top_block.__init__(self, "Burst Detect Es")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Burst Detect Es")
        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", "burst_detect_es")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())


        ##################################################
        # Parameters
        ##################################################
        self.lpf_cutoff = lpf_cutoff
        self.lpf_trans = lpf_trans

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 250000
        self.interp = interp = 24
        self.decim = decim = int(samp_rate/2000)
        self.baud = baud = 9600
        self.samps_per_symb = samps_per_symb = int((samp_rate/decim*interp)/baud)
        self.offset = offset = 0
        self.max_symbols = max_symbols = samps_per_symb*300*8 *2
        self.max_min_freq = max_min_freq = 100
        self.loop_bw = loop_bw = 900
        self.fsk_dev = fsk_dev = 10000
        self.avg_len = avg_len = 100.0

        ##################################################
        # Blocks
        ##################################################
        self._offset_tool_bar = Qt.QToolBar(self)
        self._offset_tool_bar.addWidget(Qt.QLabel("offset"+": "))
        self._offset_line_edit = Qt.QLineEdit(str(self.offset))
        self._offset_tool_bar.addWidget(self._offset_line_edit)
        self._offset_line_edit.returnPressed.connect(
        	lambda: self.set_offset(eng_notation.str_to_num(str(self._offset_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._offset_tool_bar, 4, 6, 1, 2)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(6, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._loop_bw_range = Range(1, 1000, 1, 900, 200)
        self._loop_bw_win = RangeWidget(self._loop_bw_range, self.set_loop_bw, "loop_bw", "counter_slider", float)
        self.top_grid_layout.addWidget(self._loop_bw_win, 6, 2, 1, 2)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self._avg_len_tool_bar = Qt.QToolBar(self)
        self._avg_len_tool_bar.addWidget(Qt.QLabel("avg_len"+": "))
        self._avg_len_line_edit = Qt.QLineEdit(str(self.avg_len))
        self._avg_len_tool_bar.addWidget(self._avg_len_line_edit)
        self._avg_len_line_edit.returnPressed.connect(
        	lambda: self.set_avg_len(eng_notation.str_to_num(str(self._avg_len_line_edit.text().toAscii()))))
        self.top_grid_layout.addWidget(self._avg_len_tool_bar, 4, 4, 1, 2)
        for r in range(4, 5):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 6):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.vcc_qt_hex_text_0 = vcc.qt_hex_text()
        self._vcc_qt_hex_text_0_win = self.vcc_qt_hex_text_0;
        self.top_grid_layout.addWidget(self._vcc_qt_hex_text_0_win, 8, 4, 1, 4)
        for r in range(8, 9):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)

        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=interp,
                decimation=decim,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	2048, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate / decim*interp, #bw
        	"RX Spectrum", #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, 0, 4, 2, 4)
        for r in range(0, 2):
            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_0 = qtgui.time_sink_f(
        	50000, #size
        	samp_rate, #samp_rate
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0_0.set_y_axis(-1, 1)

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

        self.qtgui_time_sink_x_0_0.enable_tags(-1, True)
        self.qtgui_time_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0.0, 0, "burst")
        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)
        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(2):
            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, 2, 0, 2, 4)
        for r in range(2, 4):
            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 = qtgui.time_sink_f(
        	1024, #size
        	samp_rate*interp/decim, #samp_rate
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.10)
        self.qtgui_time_sink_x_0.set_y_axis(-1, 1)

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

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

        if not True:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['', '', '', '', '',
                  '', '', '', '', '']
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "blue"]
        styles = [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.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, 7, 2, 1, 2)
        for r in range(7, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_number_sink_0 = qtgui.number_sink(
            gr.sizeof_float,
            0,
            qtgui.NUM_GRAPH_NONE,
            1
        )
        self.qtgui_number_sink_0.set_update_time(0.0010)
        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, -20000)
            self.qtgui_number_sink_0.set_max(i, 20000)
            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, 7, 0, 1, 2)
        for r in range(7, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_1_0 = qtgui.freq_sink_c(
        	2048, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate / decim*interp, #bw
        	"RX Spectrum", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_1_0.set_update_time(0.010)
        self.qtgui_freq_sink_x_1_0.set_y_axis(-150, 0)
        self.qtgui_freq_sink_x_1_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_1_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_1_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_1_0.enable_grid(True)
        self.qtgui_freq_sink_x_1_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_1_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_1_0.enable_control_panel(False)

        if not False:
          self.qtgui_freq_sink_x_1_0.disable_legend()

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

        labels = ['pre-d', 'agc_filt', '', '', '',
                  '', '', '', '', '']
        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(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_1_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_1_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_1_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_1_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_1_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_1_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_1_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_1_0_win, 0, 0, 2, 4)
        for r in range(0, 2):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	0, #fc
        	samp_rate*interp/decim, #bw
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.0010)
        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(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 True:
          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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win, 5, 4, 2, 4)
        for r in range(5, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_1 = qtgui.const_sink_c(
        	256, #size
        	"", #name
        	1 #number of inputs
        )
        self.qtgui_const_sink_x_1.set_update_time(0.0010)
        self.qtgui_const_sink_x_1.set_y_axis(-2, 2)
        self.qtgui_const_sink_x_1.set_x_axis(-2, 2)
        self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
        self.qtgui_const_sink_x_1.enable_autoscale(False)
        self.qtgui_const_sink_x_1.enable_grid(False)
        self.qtgui_const_sink_x_1.enable_axis_labels(True)

        if not True:
          self.qtgui_const_sink_x_1.disable_legend()

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

        self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_1_win, 4, 2, 2, 2)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(2, 4):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
        	1024, #size
        	"", #name
        	0 #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(True)
        self.qtgui_const_sink_x_0.enable_axis_labels(True)

        if not True:
          self.qtgui_const_sink_x_0.disable_legend()

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

        self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win, 4, 0, 2, 2)
        for r in range(4, 6):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.pyqt_meta_text_output_0 = pyqt.meta_text_output()
        self._pyqt_meta_text_output_0_win = self.pyqt_meta_text_output_0;
        self.top_grid_layout.addWidget(self._pyqt_meta_text_output_0_win, 7, 4, 1, 4)
        for r in range(7, 8):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)

        self.pyqt_ctime_plot_0 = pyqt.ctime_plot('')
        self._pyqt_ctime_plot_0_win = self.pyqt_ctime_plot_0;
        self.top_grid_layout.addWidget(self._pyqt_ctime_plot_0_win, 2, 4, 2, 4)
        for r in range(2, 4):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(4, 8):
            self.top_grid_layout.setColumnStretch(c, 1)

        self._max_min_freq_range = Range(1, 1000, 1, 100, 200)
        self._max_min_freq_win = RangeWidget(self._max_min_freq_range, self.set_max_min_freq, "max_min_freq", "counter_slider", float)
        self.top_grid_layout.addWidget(self._max_min_freq_win, 6, 0, 1, 2)
        for r in range(6, 7):
            self.top_grid_layout.setRowStretch(r, 1)
        for c in range(0, 2):
            self.top_grid_layout.setColumnStretch(c, 1)
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate / decim *interp, lpf_cutoff, lpf_trans, firdes.WIN_HAMMING, 6.76))
        self.kiss_pdu_to_kiss_0 = kiss.pdu_to_kiss()
        self.kiss_nrzi_decode_0 = kiss.nrzi_decode()
        self.kiss_hdlc_deframer_0 = kiss.hdlc_deframer(check_fcs=True, max_length=300)
        self.es_trigger_edge_f_0 = es.trigger_edge_f(-2,baud*samps_per_symb / 4,int(avg_len*2),gr.sizeof_gr_complex,300)
        self.es_sink_0 = es.sink(1*[gr.sizeof_gr_complex],8,64,0,2,0)
        self.es_handler_pdu_0 = es.es_make_handler_pdu(es.es_handler_print.TYPE_C32)
        self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(samps_per_symb, 0.5, 256, math.pi/loop_bw)
        self.digital_descrambler_bb_0 = digital.descrambler_bb(0x21, 0, 16)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(samps_per_symb*(1+0.0), 0.25*0.175*0.175, 0.25, 0.175, 0.005)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.burst_length_detect_0 = burst.length_detect()
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate*8,True)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_skiphead_1 = blocks.skiphead(gr.sizeof_gr_complex*1, 200)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float*1, 1)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.complex_t, 'es::event_length')
        (self.blocks_pdu_to_tagged_stream_0).set_min_output_buffer(48000)
        self.blocks_pdu_remove_0 = blocks.pdu_remove(pmt.intern("es::event_buffer"))
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff((-1*samp_rate*interp/decim/(2*math.pi), ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-1, ))
        self.blocks_moving_average_xx_0_0 = blocks.moving_average_ff(1, 1, 4000, 1)
        self.blocks_moving_average_xx_0 = blocks.moving_average_ff(int(avg_len), 1/avg_len, 4000, 1)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 1024*8, max_symbols*2, 0)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/zleffke/captures/lithium_20180327/downlink_data_1.fc32', True)
        self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((3, ))
        self.blocks_abs_xx_0 = blocks.abs_ff(1)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -1*offset, 1, 0)
        self.analog_quadrature_demod_cf_1_0 = analog.quadrature_demod_cf((samp_rate/decim*interp)/(2*math.pi*fsk_dev/8.0))
        self.analog_quadrature_demod_cf_1 = analog.quadrature_demod_cf((samp_rate/decim*interp)/(2*math.pi*fsk_dev/8.0))
        self.analog_agc2_xx_0 = analog.agc2_cc(10, 1e-1, 65536, 1)
        self.analog_agc2_xx_0.set_max_gain(65536)



        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_pdu_remove_0, 'pdus'), (self.burst_length_detect_0, 'cpdus'))
        self.msg_connect((self.burst_length_detect_0, 'cpdus'), (self.blocks_pdu_to_tagged_stream_0, 'pdus'))
        self.msg_connect((self.burst_length_detect_0, 'cpdus'), (self.pyqt_ctime_plot_0, 'cpdus'))
        self.msg_connect((self.burst_length_detect_0, 'cpdus'), (self.pyqt_meta_text_output_0, 'pdus'))
        self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.blocks_pdu_remove_0, 'pdus'))
        self.msg_connect((self.es_handler_pdu_0, 'pdus_out'), (self.qtgui_const_sink_x_0, 'in'))
        self.msg_connect((self.es_trigger_edge_f_0, 'edge_event'), (self.es_handler_pdu_0, 'handle_event'))
        self.msg_connect((self.es_trigger_edge_f_0, 'which_stream'), (self.es_sink_0, 'schedule_event'))
        self.msg_connect((self.kiss_hdlc_deframer_0, 'out'), (self.kiss_pdu_to_kiss_0, 'in'))
        self.msg_connect((self.kiss_pdu_to_kiss_0, 'out'), (self.vcc_qt_hex_text_0, 'pdus'))
        self.connect((self.analog_agc2_xx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.analog_quadrature_demod_cf_1, 0), (self.blocks_skiphead_0, 0))
        self.connect((self.analog_quadrature_demod_cf_1, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_1_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_abs_xx_0, 0), (self.blocks_moving_average_xx_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.es_trigger_edge_f_0, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.qtgui_time_sink_x_0_0, 1))
        self.connect((self.blocks_complex_to_real_0, 0), (self.qtgui_time_sink_x_0_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0), (self.digital_fll_band_edge_cc_0, 0))
        self.connect((self.blocks_moving_average_xx_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_moving_average_xx_0_0, 0), (self.qtgui_number_sink_0, 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, 0), (self.blocks_moving_average_xx_0_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_skiphead_1, 0))
        self.connect((self.blocks_skiphead_0, 0), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_skiphead_1, 0), (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_abs_xx_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0), (self.digital_descrambler_bb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.digital_descrambler_bb_0, 0), (self.kiss_nrzi_decode_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0), (self.analog_quadrature_demod_cf_1_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 1), (self.blocks_multiply_const_vxx_1_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 2), (self.blocks_null_sink_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_const_sink_x_1, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.es_trigger_edge_f_0, 0), (self.es_sink_0, 0))
        self.connect((self.kiss_nrzi_decode_0, 0), (self.kiss_hdlc_deframer_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_quadrature_demod_cf_1, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.es_trigger_edge_f_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_1_0, 1))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.analog_agc2_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.qtgui_freq_sink_x_1_0, 0))
Example #52
0
    def __init__(self):
        gr.top_block.__init__(self, "Dronedb Down")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Dronedb Down")
        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", "DroneDB_DOWN")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.head = head = int(2e6)
        self.cent_freq = cent_freq = 2.462e9
        self.band = band = 2e6

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(2),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(cent_freq, 0)
        self.uhd_usrp_source_0.set_gain(0, 0)
        self.uhd_usrp_source_0.set_antenna("TX/RX", 0)
        self.uhd_usrp_source_0.set_center_freq(cent_freq, 1)
        self.uhd_usrp_source_0.set_gain(0, 1)
        self.uhd_usrp_source_0.set_antenna("RX2", 1)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=8,
            taps=None,
            fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=1,
            decimation=8,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_number_sink_0_0_1_0 = qtgui.number_sink(
            gr.sizeof_char, 0, qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0_0_1_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0_1_0.set_title("rightGFSK")

        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_0_1_0.set_min(i, -1)
            self.qtgui_number_sink_0_0_1_0.set_max(i, 1)
            self.qtgui_number_sink_0_0_1_0.set_color(i, colors[i][0],
                                                     colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0_1_0.set_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0_1_0.set_label(i, labels[i])
            self.qtgui_number_sink_0_0_1_0.set_unit(i, units[i])
            self.qtgui_number_sink_0_0_1_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0_1_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_1_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0_0_1_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_0_1_0_win)
        self.qtgui_number_sink_0_0_1 = qtgui.number_sink(
            gr.sizeof_char, 0, qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0_0_1.set_update_time(0.10)
        self.qtgui_number_sink_0_0_1.set_title("leftGFSK")

        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_0_1.set_min(i, -1)
            self.qtgui_number_sink_0_0_1.set_max(i, 1)
            self.qtgui_number_sink_0_0_1.set_color(i, colors[i][0],
                                                   colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0_1.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0_1.set_label(i, labels[i])
            self.qtgui_number_sink_0_0_1.set_unit(i, units[i])
            self.qtgui_number_sink_0_0_1.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0_1.enable_autoscale(False)
        self._qtgui_number_sink_0_0_1_win = sip.wrapinstance(
            self.qtgui_number_sink_0_0_1.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_0_1_win)
        self.qtgui_number_sink_0_0_0 = qtgui.number_sink(
            gr.sizeof_float, 0, qtgui.NUM_GRAPH_HORIZ, 1)
        self.qtgui_number_sink_0_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0_0.set_title("rightFRMS")

        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_0_0.set_min(i, -1)
            self.qtgui_number_sink_0_0_0.set_max(i, 1)
            self.qtgui_number_sink_0_0_0.set_color(i, colors[i][0],
                                                   colors[i][1])
            if len(labels[i]) == 0:
                self.qtgui_number_sink_0_0_0.set_label(i, "Data {0}".format(i))
            else:
                self.qtgui_number_sink_0_0_0.set_label(i, labels[i])
            self.qtgui_number_sink_0_0_0.set_unit(i, units[i])
            self.qtgui_number_sink_0_0_0.set_factor(i, factor[i])

        self.qtgui_number_sink_0_0_0.enable_autoscale(False)
        self._qtgui_number_sink_0_0_0_win = sip.wrapinstance(
            self.qtgui_number_sink_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_number_sink_0_0_0_win)
        self.qtgui_number_sink_0_0 = qtgui.number_sink(gr.sizeof_float, 0,
                                                       qtgui.NUM_GRAPH_HORIZ,
                                                       1)
        self.qtgui_number_sink_0_0.set_update_time(0.10)
        self.qtgui_number_sink_0_0.set_title("leftFRMS")

        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_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.top_layout.addWidget(self._qtgui_number_sink_0_0_win)
        self.fft_vxx_0_0 = fft.fft_vcc(1024, True,
                                       (window.blackmanharris(1024)), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(1024, True, (window.blackmanharris(1024)),
                                     True, 1)
        self.digital_gfsk_demod_0_0 = digital.gfsk_demod(
            samples_per_symbol=2,
            sensitivity=1.0,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.digital_gfsk_demod_0 = digital.gfsk_demod(
            samples_per_symbol=2,
            sensitivity=1.0,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blocks_vector_to_stream_0_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_stream_to_vector_0_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_stream_to_vector_0_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, 1024)
        self.blocks_skiphead_0_1_0 = blocks.skiphead(gr.sizeof_char * 1,
                                                     head / 2)
        self.blocks_skiphead_0_1 = blocks.skiphead(gr.sizeof_char * 1,
                                                   head / 2)
        self.blocks_skiphead_0_0 = blocks.skiphead(gr.sizeof_float * 1, head)
        self.blocks_skiphead_0 = blocks.skiphead(gr.sizeof_float * 1, head)
        self.blocks_rms_xx_0_0 = blocks.rms_cf(0.0001)
        self.blocks_rms_xx_0 = blocks.rms_cf(0.0001)
        self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((100, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100, ))
        self.blocks_file_sink_0_0_1_0 = blocks.file_sink(
            gr.sizeof_char * 1,
            "/home/summit/DroneIndicator/rightGFSK_DOWN.dat", True)
        self.blocks_file_sink_0_0_1_0.set_unbuffered(False)
        self.blocks_file_sink_0_0_1 = blocks.file_sink(
            gr.sizeof_char * 1,
            "/home/summit/DroneIndicator/leftGFSK_DOWN.dat", True)
        self.blocks_file_sink_0_0_1.set_unbuffered(False)
        self.blocks_file_sink_0_0_0 = blocks.file_sink(
            gr.sizeof_float * 1,
            "/home/summit/DroneIndicator/rightFRMS_DOWN.dat", True)
        self.blocks_file_sink_0_0_0.set_unbuffered(False)
        self.blocks_file_sink_0_0 = blocks.file_sink(
            gr.sizeof_float * 1,
            "/home/summit/DroneIndicator/leftFRMS_DOWN.dat", True)
        self.blocks_file_sink_0_0.set_unbuffered(False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_skiphead_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0_0, 0),
                     (self.blocks_skiphead_0_0, 0))
        self.connect((self.blocks_rms_xx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_rms_xx_0_0, 0),
                     (self.blocks_multiply_const_vxx_0_0, 0))
        self.connect((self.blocks_skiphead_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_skiphead_0_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_skiphead_0_1, 0),
                     (self.blocks_file_sink_0_0_1, 0))
        self.connect((self.blocks_skiphead_0_1, 0),
                     (self.qtgui_number_sink_0_0_1, 0))
        self.connect((self.blocks_skiphead_0_1_0, 0),
                     (self.blocks_file_sink_0_0_1_0, 0))
        self.connect((self.blocks_skiphead_0_1_0, 0),
                     (self.qtgui_number_sink_0_0_1_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0, 0),
                     (self.fft_vxx_0, 0))
        self.connect((self.blocks_stream_to_vector_0_0_0, 0),
                     (self.fft_vxx_0_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0),
                     (self.blocks_rms_xx_0, 0))
        self.connect((self.blocks_vector_to_stream_0_0, 0),
                     (self.blocks_rms_xx_0_0, 0))
        self.connect((self.digital_gfsk_demod_0, 0),
                     (self.blocks_skiphead_0_1, 0))
        self.connect((self.digital_gfsk_demod_0_0, 0),
                     (self.blocks_skiphead_0_1_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.fft_vxx_0_0, 0),
                     (self.blocks_vector_to_stream_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_file_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.qtgui_number_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.blocks_file_sink_0_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.qtgui_number_sink_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_stream_to_vector_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 1),
                     (self.blocks_stream_to_vector_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.digital_gfsk_demod_0, 0))
        self.connect((self.uhd_usrp_source_0, 1),
                     (self.digital_gfsk_demod_0_0, 0))
    def __init__(self):
        gr.top_block.__init__(
            self, "TJ Groundstation No Gui with Control and IQ streaming")

        ##################################################
        # Variables
        ##################################################
        self.interp = interp = 4
        self.audio_rate = audio_rate = 48000
        self.tx_gain = tx_gain = 10
        self.rx_downsamp_bw = rx_downsamp_bw = 10000
        self.rf_tx_rate = rf_tx_rate = audio_rate * interp
        self.rf_rx_rate = rf_rx_rate = 192000
        self.preamble_len = preamble_len = 300
        self.groundstation_zmq_port_4 = groundstation_zmq_port_4 = "5504"
        self.groundstation_zmq_port_3 = groundstation_zmq_port_3 = "5503"
        self.groundstation_zmq_port_2 = groundstation_zmq_port_2 = "5502"
        self.groundstation_zmq_port_1 = groundstation_zmq_port_1 = "5501"
        self.groundstation_port_2 = groundstation_port_2 = "5557"
        self.groundstation_port_1 = groundstation_port_1 = "5555"
        self.groundstation_ip_addr = groundstation_ip_addr = "192.168.1.10"
        self.groundstation_controller_ip = groundstation_controller_ip = "192.268.1.3"
        self.gain = gain = 40
        self.freq = freq = 144.39e6
        self.baud_rate = baud_rate = 1200
        self.audio_line_driver = audio_line_driver = .8
        self.Decay = Decay = 0.8
        self.Attack = Attack = 0.8

        ##################################################
        # Blocks
        ##################################################
        self.zeromq_push_sink_0_0_0_0 = zeromq.push_sink(
            gr.sizeof_float, 1,
            "tcp://" + groundstation_ip_addr + ":" + groundstation_zmq_port_4,
            100, False, -1)
        self.zeromq_push_sink_0_0_0 = zeromq.push_sink(
            gr.sizeof_float, 1,
            "tcp://" + groundstation_ip_addr + ":" + groundstation_zmq_port_3,
            100, False, -1)
        self.zeromq_push_sink_0_0 = zeromq.push_sink(
            gr.sizeof_gr_complex, 1,
            "tcp://" + groundstation_ip_addr + ":" + groundstation_zmq_port_2,
            100, False, -1)
        self.zeromq_push_sink_0 = zeromq.push_sink(
            gr.sizeof_gr_complex, 1,
            "tcp://" + groundstation_ip_addr + ":" + groundstation_zmq_port_1,
            100, False, -1)
        self.uhd_usrp_source_0_1 = uhd.usrp_source(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0_1.set_samp_rate(rf_rx_rate)
        self.uhd_usrp_source_0_1.set_center_freq(freq, 0)
        self.uhd_usrp_source_0_1.set_gain(gain, 0)
        self.uhd_usrp_source_0_1.set_antenna('RX2', 0)
        self.uhd_usrp_source_0_1.set_bandwidth(rf_rx_rate, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            ",".join(("", "")),
            uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(rf_tx_rate)
        self.uhd_usrp_sink_0.set_center_freq(freq, 0)
        self.uhd_usrp_sink_0.set_gain(tx_gain, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.uhd_usrp_sink_0.set_bandwidth(rf_tx_rate, 0)
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
            interpolation=4,
            decimation=1,
            taps=None,
            fractional_bw=None,
        )
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(
            4,
            firdes.low_pass(1, rf_rx_rate, rx_downsamp_bw / 2, 1000,
                            firdes.WIN_HAMMING, 6.76))
        self.detectMarkSpace_1_0_0 = detectMarkSpace(
            Frequency=2200,
            attack=Attack,
            decay=Decay,
            samp_rate=audio_rate,
        )
        self.detectMarkSpace_0_0_0 = detectMarkSpace(
            Frequency=1200,
            attack=Attack,
            decay=Decay,
            samp_rate=audio_rate,
        )
        self.bruninga_str_to_aprs_0 = bruninga.str_to_aprs(
            'KN4DTQ', 'KN4DTQ', [])
        self.bruninga_ax25_fsk_mod_0 = bruninga.ax25_fsk_mod(
            audio_rate, preamble_len, 5, 2200, 1200, baud_rate)
        self.blocks_udp_sink_0_0 = blocks.udp_sink(
            gr.sizeof_char * 1, groundstation_controller_ip,
            int(groundstation_port_2), 1472, True)
        self.blocks_sub_xx_0_0_0_0 = blocks.sub_ff(1)
        self.blocks_socket_pdu_0_0 = blocks.socket_pdu("UDP_SERVER",
                                                       groundstation_ip_addr,
                                                       groundstation_port_1,
                                                       10000, False)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.8, ))
        self.analog_nbfm_tx_0 = analog.nbfm_tx(
            audio_rate=audio_rate,
            quad_rate=audio_rate,
            tau=75e-6,
            max_dev=5e3,
            fh=-1.0,
        )
        self.analog_nbfm_rx_0_0 = analog.nbfm_rx(
            audio_rate=audio_rate,
            quad_rate=audio_rate,
            tau=75e-6,
            max_dev=5e3,
        )
        self.afsk_ax25decode_1_0 = afsk.ax25decode(audio_rate, 1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.blocks_socket_pdu_0_0, 'pdus'),
                         (self.bruninga_str_to_aprs_0, 'in'))
        self.msg_connect((self.bruninga_str_to_aprs_0, 'out'),
                         (self.bruninga_ax25_fsk_mod_0, 'in'))
        self.connect((self.afsk_ax25decode_1_0, 0),
                     (self.blocks_udp_sink_0_0, 0))
        self.connect((self.analog_nbfm_rx_0_0, 0),
                     (self.detectMarkSpace_0_0_0, 0))
        self.connect((self.analog_nbfm_rx_0_0, 0),
                     (self.detectMarkSpace_1_0_0, 0))
        self.connect((self.analog_nbfm_rx_0_0, 0),
                     (self.zeromq_push_sink_0_0_0_0, 0))
        self.connect((self.analog_nbfm_tx_0, 0),
                     (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.analog_nbfm_tx_0, 0), (self.zeromq_push_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.analog_nbfm_tx_0, 0))
        self.connect((self.blocks_sub_xx_0_0_0_0, 0),
                     (self.afsk_ax25decode_1_0, 0))
        self.connect((self.bruninga_ax25_fsk_mod_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.bruninga_ax25_fsk_mod_0, 0),
                     (self.zeromq_push_sink_0_0_0, 0))
        self.connect((self.detectMarkSpace_0_0_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 0))
        self.connect((self.detectMarkSpace_1_0_0, 0),
                     (self.blocks_sub_xx_0_0_0_0, 1))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.analog_nbfm_rx_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0),
                     (self.zeromq_push_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0),
                     (self.uhd_usrp_sink_0, 0))
        self.connect((self.uhd_usrp_source_0_1, 0),
                     (self.low_pass_filter_0_0, 0))
Example #54
0
    def __init__(self):
        gr.top_block.__init__(self, "FM Receiver")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("FM Receiver")
        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", "fm_receiver")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.lo_freq = lo_freq = 0
        self.center_freq = center_freq = 100600000
        self.station_freq = station_freq = center_freq - lo_freq
        self.samp_rate = samp_rate = 2048000
        self.resamp_factor = resamp_factor = 4
        self.if1 = if1 = 1
        self.gain = gain = 0.1
        self.bb = bb = 0

        ##################################################
        # Blocks
        ##################################################
        self._lo_freq_range = Range(-1000000, 1000000, 100000, 0, 200)
        self._lo_freq_win = RangeWidget(self._lo_freq_range, self.set_lo_freq,
                                        'Frequency shift', "counter_slider",
                                        float)
        self.top_grid_layout.addWidget(self._lo_freq_win)
        self._if1_range = Range(0, 40, 1, 1, 200)
        self._if1_win = RangeWidget(self._if1_range, self.set_if1, 'if',
                                    "counter_slider", float)
        self.top_grid_layout.addWidget(self._if1_win)
        self._gain_range = Range(0, 1, 0.1, 0.1, 200)
        self._gain_win = RangeWidget(self._gain_range, self.set_gain, 'Gain',
                                     "counter_slider", float)
        self.top_grid_layout.addWidget(self._gain_win)
        self._bb_range = Range(0, 40, 1, 0, 200)
        self._bb_win = RangeWidget(self._bb_range, self.set_bb, 'bb',
                                   "counter_slider", float)
        self.top_grid_layout.addWidget(self._bb_win)
        self._station_freq_tool_bar = Qt.QToolBar(self)

        if None:
            self._station_freq_formatter = None
        else:
            self._station_freq_formatter = lambda x: str(x)

        self._station_freq_tool_bar.addWidget(
            Qt.QLabel('Station frequency' + ": "))
        self._station_freq_label = Qt.QLabel(
            str(self._station_freq_formatter(self.station_freq)))
        self._station_freq_tool_bar.addWidget(self._station_freq_label)
        self.top_grid_layout.addWidget(self._station_freq_tool_bar)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " +
                                              '')
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(center_freq, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(27.2, 0)
        self.rtlsdr_source_0.set_if_gain(if1, 0)
        self.rtlsdr_source_0.set_bb_gain(bb, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
            interpolation=48,
            decimation=50,
            taps=None,
            fractional_bw=None,
        )
        self.qtgui_freq_sink_x_0_0_0 = qtgui.freq_sink_c(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            center_freq - lo_freq,  #fc
            samp_rate,  #bw
            'Signal spectrum',  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0_0_0.set_update_time(0.05)
        self.qtgui_freq_sink_x_0_0_0.set_y_axis(-80, 0)
        self.qtgui_freq_sink_x_0_0_0.set_y_label('Relative Gain', 'dB')
        self.qtgui_freq_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE,
                                                      0.0, 0, "")
        self.qtgui_freq_sink_x_0_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0_0.enable_grid(True)
        self.qtgui_freq_sink_x_0_0_0.set_fft_average(1.0)
        self.qtgui_freq_sink_x_0_0_0.enable_axis_labels(True)
        self.qtgui_freq_sink_x_0_0_0.enable_control_panel(True)

        if not True:
            self.qtgui_freq_sink_x_0_0_0.disable_legend()

        if "complex" == "float" or "complex" == "msg_float":
            self.qtgui_freq_sink_x_0_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_0.set_line_label(
                    i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0_0.set_line_alpha(i, alphas[i])

        self._qtgui_freq_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_freq_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_0_win)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_f(
            1024,  #size
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            center_freq - lo_freq,  #fc
            samp_rate / resamp_factor,  #bw
            'Station spectrum',  #name
            1  #number of inputs
        )
        self.qtgui_freq_sink_x_0.set_update_time(0.05)
        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(False)
        self.qtgui_freq_sink_x_0.enable_grid(True)
        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 True:
            self.qtgui_freq_sink_x_0.disable_legend()

        if "float" == "float" or "float" == "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.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win)
        self.low_pass_filter_0 = filter.fir_filter_ccf(
            resamp_factor,
            firdes.low_pass(1, samp_rate, 100000, 5000, firdes.WIN_HAMMING,
                            6.76))
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((gain, ))
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
            quad_rate=samp_rate / resamp_factor,
            audio_decimation=10,
        )
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, lo_freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0),
                     (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.audio_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0),
                     (self.qtgui_freq_sink_x_0_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
    def __init__(self, args):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48000
        self.seed = seed = args.seed
        self.m_rate = m_rate = args.m_rate
        self.if_rate = if_rate = samp_rate*40
        self.gauss = gauss = args.gauss
        self.fc = fc = args.fc
        self.dpp = dpp = args.dop
        self.sinu = sinu = args.sinu
        
        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_0_1 = filter.rational_resampler_fff(
                interpolation=3,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_fff(
                interpolation=40,
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_1_0 = filter.fir_filter_fff(40, firdes.low_pass(
        	1, if_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_1 = filter.fir_filter_fff(40, firdes.low_pass(
        	1, if_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.interp_fir_filter_fff(1, firdes.low_pass(
        	1, samp_rate, 7500, 100, firdes.WIN_HAMMING, 6.76))
        self.hilbert_fc_0 = filter.hilbert_fc(301, firdes.WIN_HAMMING, 6.76)
        self.high_pass_filter_0_1 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_0_0_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_0_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
        self.high_pass_filter_0 = filter.fir_filter_fff(1, firdes.high_pass(
        	1, samp_rate, 50, 10, firdes.WIN_HAMMING, 6.76))
        self.channels_fading_model_0 = channels.fading_model(sinu, dpp/if_rate, True, 2, 256 )
        self.blocks_wavfile_source_0 = blocks.wavfile_source(file1, False)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1_0 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((0, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((m_rate, ))
        self.blocks_file_sink_0_5 = blocks.file_sink(gr.sizeof_float*1, file2, False)
        self.blocks_file_sink_0_5.set_unbuffered(False)
        self.blocks_file_sink_0_4 = blocks.file_sink(gr.sizeof_float*1, file3, False)
        self.blocks_file_sink_0_4.set_unbuffered(False)
        self.blocks_file_sink_0_3 = blocks.file_sink(gr.sizeof_float*1, file4, False)
        self.blocks_file_sink_0_3.set_unbuffered(False)
        self.blocks_file_sink_0_2 = blocks.file_sink(gr.sizeof_float*1, file5, False)
        self.blocks_file_sink_0_2.set_unbuffered(False)
        self.blocks_file_sink_0_1 = blocks.file_sink(gr.sizeof_float*1, file6, False)
        self.blocks_file_sink_0_1.set_unbuffered(False)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float*1, file7, False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, file8, False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_add_xx_0_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0_0 = blocks.add_vcc(1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((1, ))
        self.band_pass_filter_0_1 = filter.fir_filter_ccf(1, firdes.band_pass(
        	4, if_rate, fc-7.5e3, fc+7.5e3, 100, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0_0_0 = filter.fir_filter_ccf(1, firdes.band_pass(
        	4, if_rate, fc-7.5e3, fc+7.5e3, 100, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0_0 = filter.fir_filter_ccf(1, firdes.band_pass(
        	4, if_rate, fc-7.5e3, fc+7.5e3, 100, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.band_pass(
        	4, if_rate, fc-7.5e3, fc+7.5e3, 100, firdes.WIN_HAMMING, 6.76))
        self.band_pass_filter_0 = filter.fir_filter_ccf(1, firdes.band_pass(
        	4, if_rate, fc-7.5e3, fc+7.5e3, 100, firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0_0 = analog.sig_source_f(if_rate, analog.GR_COS_WAVE, fc, 1, 0)
        self.analog_fastnoise_source_x_0 = analog.fastnoise_source_c(analog.GR_GAUSSIAN, gauss, seed, 8192)
        self.analog_am_demod_cf_0_1 = analog.am_demod_cf(
        	channel_rate=fc,
        	audio_decim=40,
        	audio_pass=7500,
        	audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0_0_0 = analog.am_demod_cf(
        	channel_rate=fc,
        	audio_decim=40,
        	audio_pass=7500,
        	audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0_0 = analog.am_demod_cf(
        	channel_rate=fc,
        	audio_decim=40,
        	audio_pass=7500,
        	audio_stop=10e3,
        )
        self.analog_am_demod_cf_0_0 = analog.am_demod_cf(
        	channel_rate=fc,
        	audio_decim=40,
        	audio_pass=7500,
        	audio_stop=10e3,
        )
        self.analog_am_demod_cf_0 = analog.am_demod_cf(
        	channel_rate=fc,
        	audio_decim=40,
        	audio_pass=7500,
        	audio_stop=10e3,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_am_demod_cf_0, 0), (self.high_pass_filter_0, 0))
        self.connect((self.analog_am_demod_cf_0_0, 0), (self.high_pass_filter_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_0_0, 0), (self.high_pass_filter_0_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_0_0_0, 0), (self.high_pass_filter_0_0_0_0, 0))
        self.connect((self.analog_am_demod_cf_0_1, 0), (self.high_pass_filter_0_1, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0_0, 1))
        self.connect((self.analog_fastnoise_source_x_0, 0), (self.blocks_add_xx_0_0_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1_0, 1))
        self.connect((self.band_pass_filter_0, 0), (self.analog_am_demod_cf_0, 0))
        self.connect((self.band_pass_filter_0, 0), (self.blocks_complex_to_real_0_0, 0))
        self.connect((self.band_pass_filter_0_0, 0), (self.analog_am_demod_cf_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.analog_am_demod_cf_0_0_0, 0))
        self.connect((self.band_pass_filter_0_0_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.band_pass_filter_0_0_0_0, 0), (self.analog_am_demod_cf_0_0_0_0, 0))
        self.connect((self.band_pass_filter_0_1, 0), (self.analog_am_demod_cf_0_1, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.band_pass_filter_0, 0))
        self.connect((self.blocks_add_xx_0_0, 0), (self.band_pass_filter_0_1, 0))
        self.connect((self.blocks_add_xx_0_0_0, 0), (self.band_pass_filter_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_real_0_0, 0), (self.blocks_multiply_xx_1_0, 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_add_xx_0_0_0, 1))
        self.connect((self.blocks_multiply_xx_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.low_pass_filter_1, 0))
        self.connect((self.blocks_multiply_xx_1_0, 0), (self.low_pass_filter_1_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.rational_resampler_xxx_0_1, 0))
        self.connect((self.channels_fading_model_0, 0), (self.band_pass_filter_0_0_0, 0))
        self.connect((self.channels_fading_model_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.channels_fading_model_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.high_pass_filter_0, 0), (self.blocks_file_sink_0_5, 0))
        self.connect((self.high_pass_filter_0_0, 0), (self.blocks_file_sink_0_3, 0))
        self.connect((self.high_pass_filter_0_0_0, 0), (self.blocks_file_sink_0_2, 0))
        self.connect((self.high_pass_filter_0_0_0_0, 0), (self.blocks_file_sink_0_1, 0))
        self.connect((self.high_pass_filter_0_1, 0), (self.blocks_file_sink_0_4, 0))
        self.connect((self.hilbert_fc_0, 0), (self.band_pass_filter_0_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_add_xx_0_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.channels_fading_model_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.low_pass_filter_1, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.low_pass_filter_1_0, 0), (self.blocks_file_sink_0_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.rational_resampler_xxx_0_1, 0), (self.low_pass_filter_0, 0))
    def __init__(self):
        #init the top block and GUI.
        gr.top_block.__init__(self, "Nist-v2")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Nist-v2")
        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", "nist")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################

        #FFT Len, Calibration factor, Windowing function compensation.
        self.fft_len = fft_len = my_consts.fft_size()
        self.cal_dB = cal_dB = my_consts.cal_dB()
        self.window_compenstation = window_compenstation = 2.0

        #Target freq / sampling rate
        self.target_freq = target_freq = my_consts.center_freq()
        self.samp_rate = samp_rate = my_consts.samp_rate()

        #PSD adjustment factor (calculated using above variables)
        self.psd_normalization = psd_normalization = (
            [(window_compenstation / fft_len)**2] * my_consts.agg_out()
        )  #(2.0/FFT_SIZE) ^2 (applied after fft -> mag^2 to save processing power)

        #calibration (applies the calibration factor and undo the power increase due to the amplifier gain).
        self.cal = cal = 10**((cal_dB - my_consts.usrp_gain()) / 20)
        if (my_consts.source_type() == "OSMOCOM"):
            self.cal = cal = 10**(
                (cal_dB - my_consts.osmosdr_RF_gain() -
                 my_consts.osmosdr_IF_gain() - my_consts.osmosdr_BB_gain()) /
                20)
        self.new_bin_size = new_bin_size = my_consts.agg_out()

        #for usrp
        self.usrp_lo_offset = usrp_lo_offset = my_consts.usrp_lo_offset()
        self.usrp_gain = usrp_gain = my_consts.usrp_gain()

        #for osmosdr
        self.osmosdr_RF_gain = osmosdr_RF_gain = my_consts.osmosdr_RF_gain()
        self.osmosdr_IF_gain = osmosdr_IF_gain = my_consts.osmosdr_IF_gain()
        self.osmosdr_BB_gain = osmosdr_BB_gain = my_consts.osmosdr_BB_gain()

        ##################################################
        # Blocks
        ##################################################

        #------------------------------signal source------------------------------
        #dummy signal mode
        if my_consts.source_type() == "CONST":
            self.uhd_usrp_source_0 = analog.sig_source_c(
                0, analog.GR_CONST_WAVE, 0, 0, 1)

        #usrp mode
        elif my_consts.source_type() == "USRP":
            self.uhd_usrp_source_0 = uhd.usrp_source(
                ",".join(("", "")),
                uhd.stream_args(
                    cpu_format="fc32",
                    channels=range(1),
                ),
            )
            self.uhd_usrp_source_0.set_samp_rate(samp_rate)
            self.uhd_usrp_source_0.set_center_freq(
                uhd.tune_request(target_freq, usrp_lo_offset), 0)
            self.uhd_usrp_source_0.set_gain(usrp_gain, 0)
            self.uhd_usrp_source_0.set_antenna(my_consts.antenna_port(), 0)

        #osmosdr mode
        elif my_consts.source_type() == "OSMOCOM":
            self.uhd_usrp_source_0 = osmosdr.source(args="numchan=" + str(1) +
                                                    " " + '')
            self.uhd_usrp_source_0.set_sample_rate(samp_rate)
            self.uhd_usrp_source_0.set_center_freq(target_freq, 0)
            self.uhd_usrp_source_0.set_freq_corr(0, 0)
            self.uhd_usrp_source_0.set_dc_offset_mode(0, 0)
            self.uhd_usrp_source_0.set_iq_balance_mode(0, 0)
            self.uhd_usrp_source_0.set_gain_mode(False, 0)
            self.uhd_usrp_source_0.set_gain(osmosdr_RF_gain, 0)
            self.uhd_usrp_source_0.set_if_gain(osmosdr_IF_gain, 0)
            self.uhd_usrp_source_0.set_bb_gain(osmosdr_BB_gain, 0)
            self.uhd_usrp_source_0.set_antenna(my_consts.antenna_port(), 0)
            self.uhd_usrp_source_0.set_bandwidth(samp_rate, 0)
        #------------------------------signal source end--------------------------

        #junks (removed QT gui)
        self.qtgui_vector_sink_f_0 = qtgui.vector_sink_f(
            new_bin_size,
            0,
            1.0,
            "x-Axis",
            "y-Axis",
            "",
            1  # Number of inputs
        )
        #self.qtgui_vector_sink_f_0.set_update_time(0.10)
        #self.qtgui_vector_sink_f_0.set_y_axis(-140, 10)
        #self.qtgui_vector_sink_f_0.enable_autoscale(False)
        #self.qtgui_vector_sink_f_0.enable_grid(False)
        #self.qtgui_vector_sink_f_0.set_x_axis_units("")
        #self.qtgui_vector_sink_f_0.set_y_axis_units("")
        #self.qtgui_vector_sink_f_0.set_ref_level(0)

        #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_vector_sink_f_0.set_line_label(i, "Data {0}".format(i))
        #	else:
        #		self.qtgui_vector_sink_f_0.set_line_label(i, labels[i])
        #	self.qtgui_vector_sink_f_0.set_line_width(i, widths[i])
        #	self.qtgui_vector_sink_f_0.set_line_color(i, colors[i])
        #	self.qtgui_vector_sink_f_0.set_line_alpha(i, alphas[i])

        #self._qtgui_vector_sink_f_0_win = sip.wrapinstance(self.qtgui_vector_sink_f_0.pyqwidget(), Qt.QWidget)
        #self.top_layout.addWidget(self._qtgui_vector_sink_f_0_win)

        #PSD Normalizer / FFT / log10 / data -> Mag^2 blocks
        self.mul_const = blocks.multiply_const_vff((psd_normalization))
        self.fft_vxx_0 = fft.fft_vcc(fft_len, True, (window.hann(fft_len)),
                                     True, my_consts.fft_threads())
        self.blocks_stream_to_vector_0 = blocks.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_len)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, new_bin_size, 0)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(
            fft_len)

        #if calibration needed: create cal block
        if abs(cal) > 0.1:
            self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
                (cal, ))

        #my blocks (process/aggregrate FFT data / dump data to files)
        self.fftprocess = fftprocess()
        self.dumptofile = dumptofile()

        #debug blocks (performance eval, etc)
        if my_consts.debug_mode():
            self.blocks_probe_rate_0 = blocks.probe_rate(
                gr.sizeof_float * self.fft_len, 1000.0, 0.15)
            self.blocks_message_debug_0 = blocks.message_debug()

        #throws out n-1 snapshots and use only 1 for calculation
        self.blocks_keep_one_in_n_0 = blocks.keep_one_in_n(
            gr.sizeof_gr_complex * fft_len, my_consts.keep_1_fft_blk_per_n())

        ##################################################
        # Connections
        ##################################################
        if abs(cal) > 0.1:  #if calibration needed:
            # usrp -> calibration
            self.connect((self.uhd_usrp_source_0, 0),
                         (self.blocks_multiply_const_vxx_0, 0))

            #calibration -> vector
            self.connect((self.blocks_multiply_const_vxx_0, 0),
                         (self.blocks_stream_to_vector_0, 0))

        else:  #if calibration not needed:
            # usrp -> vector
            self.connect((self.uhd_usrp_source_0, 0),
                         (self.blocks_stream_to_vector_0, 0))

        #Throw out n-1 snapshots and keep 1
        self.connect((self.blocks_stream_to_vector_0, 0),
                     (self.blocks_keep_one_in_n_0, 0))

        #fft -> mag^2
        self.connect((self.blocks_keep_one_in_n_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.fft_vxx_0, 0),
                     (self.blocks_complex_to_mag_squared_0, 0))

        #re-bin fft, max-hold.
        self.connect((self.blocks_complex_to_mag_squared_0, 0),
                     (self.fftprocess, 0))

        #normalize by multiplying ((window compensation)/N)^2
        self.connect((self.fftprocess, 0), (self.mul_const, 0))

        #to log
        self.connect((self.mul_const, 0), (self.blocks_nlog10_ff_0, 0))

        #display (temporary)
        #self.connect((self.blocks_nlog10_ff_0, 0), (self.qtgui_vector_sink_f_0, 0))

        #data -> file
        self.connect((self.blocks_nlog10_ff_0, 0), (self.dumptofile, 0))

        #debug blocks

        #performance eval
        if my_consts.debug_mode():
            self.connect((self.blocks_complex_to_mag_squared_0, 0),
                         (self.blocks_probe_rate_0, 0))
            self.msg_connect((self.blocks_probe_rate_0, 'rate'),
                             (self.blocks_message_debug_0, 'print'))
Example #57
0
    def __init__(self):
        gr.top_block.__init__(self, "Top Block")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Top Block")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(
                self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 640000
        self.center_freq = center_freq = 915e6

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

        self.qtgui_sink_x_0.enable_rf_freq(True)

        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                           'hackrf=0')
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(center_freq, 0)
        self.osmosdr_sink_0.set_freq_corr(0, 0)
        self.osmosdr_sink_0.set_gain(10, 0)
        self.osmosdr_sink_0.set_if_gain(20, 0)
        self.osmosdr_sink_0.set_bb_gain(20, 0)
        self.osmosdr_sink_0.set_antenna('', 0)
        self.osmosdr_sink_0.set_bandwidth(1e3, 0)

        self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff(
            (0.00003, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((32768, ))
        self.blocks_file_source_0 = blocks.file_source(
            gr.sizeof_short * 1,
            '/Users/asdf/programming/radio-stuff/stream_32k.fifo', True)
        self.analog_wfm_tx_0 = analog.wfm_tx(
            audio_rate=32000,
            quad_rate=640000,
            tau=75e-6,
            max_dev=75e3,
            fh=-1.0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_wfm_tx_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.osmosdr_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.qtgui_sink_x_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0),
                     (self.analog_wfm_tx_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_1, 0))
Example #58
0
    def __init__(self,
                 bfo=1500,
                 callsign='',
                 ip='::',
                 latitude=0,
                 longitude=0,
                 port=7355,
                 recstart=''):
        gr.top_block.__init__(self, "AO-73 decoder")

        ##################################################
        # Parameters
        ##################################################
        self.bfo = bfo
        self.callsign = callsign
        self.ip = ip
        self.latitude = latitude
        self.longitude = longitude
        self.port = port
        self.recstart = recstart

        ##################################################
        # Variables
        ##################################################
        self.sps = sps = 8
        self.nfilts = nfilts = 16
        self.alpha = alpha = 0.35

        self.variable_constellation_0_0 = variable_constellation_0_0 = digital.constellation_calcdist(
            ([-1, 1]), ([0, 1]), 2, 1).base()

        self.samp_rate = samp_rate = 48000
        self.rrc_taps = rrc_taps = firdes.root_raised_cosine(
            nfilts, nfilts, 1.0 / float(sps), alpha, 11 * sps * nfilts)

        ##################################################
        # Blocks
        ##################################################
        self.sids_submit_0 = sids.submit(
            'http://tlm.pe0sat.nl/tlmdb/frame_db.php', 39444, callsign,
            longitude, latitude, recstart)
        self.sids_print_timestamp_0 = sids.print_timestamp('%Y-%m-%d %H:%M:%S')
        self.funcube_telemetry_parser_0 = ao40.funcube_telemetry_parser()
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf(
            5, (firdes.low_pass(1, samp_rate, 1300, 500)), bfo, samp_rate)
        self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(
            sps, 0.1, (rrc_taps), nfilts, nfilts / 2, 0.05, 1)
        self.digital_fll_band_edge_cc_0 = digital.fll_band_edge_cc(
            sps, 0.350, 100, 0.01)
        self.digital_binary_slicer_fb_0 = digital.binary_slicer_fb()
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1, ip,
                                                     port, 1472, False)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((-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.ao40_fec_decoder_0 = ao40_fec_decoder()
        self.analog_feedforward_agc_cc_0 = analog.feedforward_agc_cc(1024, 2)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ao40_fec_decoder_0, 'out'),
                         (self.sids_print_timestamp_0, 'in'))
        self.msg_connect((self.ao40_fec_decoder_0, 'out'),
                         (self.sids_submit_0, 'in'))
        self.msg_connect((self.sids_print_timestamp_0, 'out'),
                         (self.funcube_telemetry_parser_0, 'in'))
        self.connect((self.analog_feedforward_agc_cc_0, 0),
                     (self.digital_fll_band_edge_cc_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0),
                     (self.blocks_multiply_const_vxx_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_real_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.digital_binary_slicer_fb_0, 0))
        self.connect((self.blocks_short_to_float_0, 0),
                     (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.digital_binary_slicer_fb_0, 0),
                     (self.ao40_fec_decoder_0, 0))
        self.connect((self.digital_fll_band_edge_cc_0, 0),
                     (self.digital_pfb_clock_sync_xxx_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.blocks_delay_0, 0))
        self.connect((self.digital_pfb_clock_sync_xxx_0, 0),
                     (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0),
                     (self.analog_feedforward_agc_cc_0, 0))
Example #59
0
    def __init__(self):
        gr.top_block.__init__(self, "Uhd Adsb 3")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Uhd Adsb 3")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6
        self.rx_gain = rx_gain = 40
        self.low = low = .3
        self.high = high = .31
        self.freq = freq = 1090e6
        self.bb_gain = bb_gain = 100e3

        ##################################################
        # 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._low_tool_bar = Qt.QToolBar(self)
        self._low_tool_bar.addWidget(Qt.QLabel("low"+": "))
        self._low_line_edit = Qt.QLineEdit(str(self.low))
        self._low_tool_bar.addWidget(self._low_line_edit)
        self._low_line_edit.returnPressed.connect(
        	lambda: self.set_low(eng_notation.str_to_num(str(self._low_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._low_tool_bar)
        self._high_tool_bar = Qt.QToolBar(self)
        self._high_tool_bar.addWidget(Qt.QLabel("high"+": "))
        self._high_line_edit = Qt.QLineEdit(str(self.high))
        self._high_tool_bar.addWidget(self._high_line_edit)
        self._high_line_edit.returnPressed.connect(
        	lambda: self.set_high(eng_notation.str_to_num(str(self._high_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._high_tool_bar)
        self._rx_gain_tool_bar = Qt.QToolBar(self)
        self._rx_gain_tool_bar.addWidget(Qt.QLabel("rx_gain"+": "))
        self._rx_gain_line_edit = Qt.QLineEdit(str(self.rx_gain))
        self._rx_gain_tool_bar.addWidget(self._rx_gain_line_edit)
        self._rx_gain_line_edit.returnPressed.connect(
        	lambda: self.set_rx_gain(eng_notation.str_to_num(str(self._rx_gain_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._rx_gain_tool_bar)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
        	512, #size
        	samp_rate, #samp_rate
        	"", #name
        	2 #number of inputs
        )
        self.qtgui_time_sink_x_0.set_update_time(0.010)
        self.qtgui_time_sink_x_0.set_y_axis(0, 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, .2, .00005, 0, "")
        self.qtgui_time_sink_x_0.enable_autoscale(False)
        self.qtgui_time_sink_x_0.enable_grid(False)
        self.qtgui_time_sink_x_0.enable_axis_labels(True)
        self.qtgui_time_sink_x_0.enable_control_panel(False)

        if not True:
          self.qtgui_time_sink_x_0.disable_legend()

        labels = ['pre', 'post', '', '', '',
                  '', '', '', '', '']
        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_layout.addWidget(self._qtgui_time_sink_x_0_win)
        self.digital_correlate_access_code_tag_bb_0 = digital.correlate_access_code_tag_bb('1010000101000000', 3, 'adsb_preamble')
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(low, high, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((100e3, ))
        self.blocks_message_source_0 = blocks.message_source(gr.sizeof_char*1, blocks_message_source_0_msgq_in)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/leffke/sandbox/adsb/adsb_20161212_2M_2.32fc', True)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, '/dev/stdout', True)
        self.blocks_file_sink_0.set_unbuffered(True)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self._bb_gain_tool_bar = Qt.QToolBar(self)
        self._bb_gain_tool_bar.addWidget(Qt.QLabel("bb_gain"+": "))
        self._bb_gain_line_edit = Qt.QLineEdit(str(self.bb_gain))
        self._bb_gain_tool_bar.addWidget(self._bb_gain_line_edit)
        self._bb_gain_line_edit.returnPressed.connect(
        	lambda: self.set_bb_gain(eng_notation.str_to_num(str(self._bb_gain_line_edit.text().toAscii()))))
        self.top_layout.addWidget(self._bb_gain_tool_bar)
        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.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_float_to_uchar_0, 0), (self.digital_correlate_access_code_tag_bb_0, 0))
        self.connect((self.blocks_message_source_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_time_sink_x_0, 1))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.digital_correlate_access_code_tag_bb_0, 0), (self.adsb_framer_0, 0))
Example #60
0
    def __init__(self):
        gr.top_block.__init__(self, "Reversing Radio Signals")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Reversing Radio Signals")
        qtgui.util.check_set_qss()
        try:
            self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        except:
            pass
        self.top_scroll_layout = Qt.QVBoxLayout()
        self.setLayout(self.top_scroll_layout)
        self.top_scroll = Qt.QScrollArea()
        self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
        self.top_scroll_layout.addWidget(self.top_scroll)
        self.top_scroll.setWidgetResizable(True)
        self.top_widget = Qt.QWidget()
        self.top_scroll.setWidget(self.top_widget)
        self.top_layout = Qt.QVBoxLayout(self.top_widget)
        self.top_grid_layout = Qt.QGridLayout()
        self.top_layout.addLayout(self.top_grid_layout)

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

        if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
            self.restoreGeometry(self.settings.value("geometry").toByteArray())
        else:
            self.restoreGeometry(self.settings.value("geometry", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2e6

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(433e6, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(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.qtgui_sink_x_0 = qtgui.sink_f(
        	1024, #fftsize
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	4339e5, #fc
        	samp_rate, #bw
        	"", #name
        	True, #plotfreq
        	True, #plotwaterfall
        	True, #plottime
        	True, #plotconst
        )
        self.qtgui_sink_x_0.set_update_time(1.0/10)
        self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_layout.addWidget(self._qtgui_sink_x_0_win)

        self.qtgui_sink_x_0.enable_rf_freq(False)



        self.blocks_threshold_ff_0 = blocks.threshold_ff(0.1, 0.2, 0)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((5, ))
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, '/home/iot/receive_signal_433', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.qtgui_sink_x_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_complex_to_mag_squared_0, 0))