Exemplo n.º 1
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 = 44100
        self.center1 = center1 = 0

        ##################################################
        # Blocks
        ##################################################
        self._center1_range = Range(-20000, 20000, 100, 0, 200)
        self._center1_win = RangeWidget(self._center1_range, self.set_center1, "center1", "counter_slider", float)
        self.top_layout.addWidget(self._center1_win)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcf(1, (1, ), center1, samp_rate)
        self.freq_xlating_fft_filter_ccc_0 = filter.freq_xlating_fft_filter_ccc(1, (1, ), center1, samp_rate)
        self.freq_xlating_fft_filter_ccc_0.set_nthreads(1)
        self.freq_xlating_fft_filter_ccc_0.declare_sample_delay(0)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_float_to_complex_0, 1))    
        self.connect((self.audio_source_0, 0), (self.blocks_float_to_complex_0, 0))    
        self.connect((self.audio_source_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.audio_sink_0, 1))    
        self.connect((self.blocks_float_to_complex_0, 0), (self.freq_xlating_fft_filter_ccc_0, 0))    
        self.connect((self.freq_xlating_fft_filter_ccc_0, 0), (self.blocks_complex_to_float_0_0, 0))    
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blocks_complex_to_float_0, 0))    
Exemplo n.º 2
0
    def __init__(self, k=4.0, tchannel=1, voltage=0):
        gr.hier_block2.__init__(
            self,
            "channel",
            gr.io_signature(1, 1, gr.sizeof_float * 1),
            gr.io_signature(1, 1, gr.sizeof_float * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.k = k
        self.tchannel = tchannel
        self.voltage = voltage

        ##################################################
        # Blocks
        ##################################################
        self.channels_fading_model_0_0 = channels.fading_model(
            8, 5 / 32000, False, 4.0, 0)
        self.channels_fading_model_0 = channels.fading_model(
            8, 5 / 32000, True, k, 0)
        self.blocks_float_to_complex_0_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.analog_noise_source_x_0 = analog.noise_source_f(
            analog.GR_GAUSSIAN, voltage, 0)
        self.Multiplexer_mux_0 = Multiplexer.mux(tchannel)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.Multiplexer_mux_0, 0), (self, 0))
        self.connect((self.analog_noise_source_x_0, 0),
                     (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.Multiplexer_mux_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.Multiplexer_mux_0, 2))
        self.connect((self.blocks_complex_to_float_0_0_0, 0),
                     (self.Multiplexer_mux_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.channels_fading_model_0_0, 0))
        self.connect((self.blocks_float_to_complex_0_0, 0),
                     (self.channels_fading_model_0, 0))
        self.connect((self.channels_fading_model_0, 0),
                     (self.blocks_complex_to_float_0_0_0, 0))
        self.connect((self.channels_fading_model_0_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self, 0), (self.blocks_add_xx_0, 1))
        self.connect((self, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self, 0), (self.blocks_float_to_complex_0_0, 0))
Exemplo n.º 3
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))
Exemplo n.º 4
0
		def __init__(self, window_size):
			gr.hier_block2.__init__(self, "FFT_IFFT", gr.io_signature(1,1,gr.sizeof_float), gr.io_signature(1,1,gr.sizeof_float))
			vector_to_stream = blocks.vector_to_stream(gr.sizeof_gr_complex, window_size)
			stream_to_vector = blocks.stream_to_vector(gr.sizeof_float, window_size)
			divide = blocks.divide_cc(1)
			complex_to_float = blocks.complex_to_float(1)
			fft_forward = fft.fft_vfc(window_size, True, (fft.window.blackmanharris(window_size)), 1)
			fft_backward = fft.fft_vcc(window_size, False, (fft.window.blackmanharris(window_size)), False, 1)
			constant = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0, window_size)

			#print("1. Connect self to stream_to_vector")
			self.connect((self, 0), (stream_to_vector, 0))
			#print("2. Connect stream_to_vector to fft_forward")
			self.connect((stream_to_vector, 0), (fft_forward, 0))
			#print("3. Connect fft_forward to fft_backward")
			self.connect((fft_forward, 0), (fft_backward, 0))
			#print("4. Connect fft_backward to vector_to_stream")
			self.connect((fft_backward, 0), (vector_to_stream, 0))
			#print("5. Connect vector_to_stream to port 0 of divide")
			self.connect((vector_to_stream, 0), (divide, 0))
			#print("6. Connect constant to port 1 of divide")
			self.connect(constant, (divide, 1))
			#print("7. Connect divide to complex_to_float")
			self.connect((divide, 0), (complex_to_float, 0))
			#print("8. Connect complex_to_float to self")
			self.connect((complex_to_float, 0), (self, 0))
Exemplo n.º 5
0
	def __init__(self, target_id, packet_size=8192, number_channel=1, channels = "1"):
		gr.hier_block2.__init__(self, "rtdex_sink",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0),)


		self._target_id = target_id
		self._packet_size = packet_size
		self._number_channel = number_channel
		self._channels = channels

		self.sink = nutaq.rtdex_sink(self._target_id,gr.sizeof_short,self._number_channel,3)
		self.sink.set_type(0)
		self.sink.set_packet_size(self._packet_size)
		self.sink.set_channels(self._channels)

		self.blocks_interleave_0 = blocks.interleave(gr.sizeof_short*1, 1)
		self.blocks_float_to_short_0_0_0 = blocks.float_to_short(1, 2**11-1)
		self.blocks_float_to_short_0_0 = blocks.float_to_short(1, 2**11-1)
		self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

		self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_short_0_0, 0))    
		self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_float_to_short_0_0_0, 0))    
		self.connect((self.blocks_float_to_short_0_0, 0), (self.blocks_interleave_0, 0))    
		self.connect((self.blocks_float_to_short_0_0_0, 0), (self.blocks_interleave_0, 1))    
		self.connect((self.blocks_interleave_0, 0), (self.sink, 0))       

		self.connect(self,self.blocks_complex_to_float_0)
Exemplo n.º 6
0
        def __init__(self, window_size):
            gr.hier_block2.__init__(self, "FFT_IFFT",
                                    gr.io_signature(1, 1, gr.sizeof_float),
                                    gr.io_signature(1, 1, gr.sizeof_float))
            vector_to_stream = blocks.vector_to_stream(gr.sizeof_gr_complex,
                                                       window_size)
            stream_to_vector = blocks.stream_to_vector(gr.sizeof_float,
                                                       window_size)
            divide = blocks.divide_cc(1)
            complex_to_float = blocks.complex_to_float(1)
            fft_forward = fft.fft_vfc(window_size, True,
                                      (fft.window.blackmanharris(window_size)),
                                      1)
            fft_backward = fft.fft_vcc(
                window_size, False, (fft.window.blackmanharris(window_size)),
                False, 1)
            constant = analog.sig_source_c(0, analog.GR_CONST_WAVE, 0, 0,
                                           window_size)

            #print("1. Connect self to stream_to_vector")
            self.connect((self, 0), (stream_to_vector, 0))
            #print("2. Connect stream_to_vector to fft_forward")
            self.connect((stream_to_vector, 0), (fft_forward, 0))
            #print("3. Connect fft_forward to fft_backward")
            self.connect((fft_forward, 0), (fft_backward, 0))
            #print("4. Connect fft_backward to vector_to_stream")
            self.connect((fft_backward, 0), (vector_to_stream, 0))
            #print("5. Connect vector_to_stream to port 0 of divide")
            self.connect((vector_to_stream, 0), (divide, 0))
            #print("6. Connect constant to port 1 of divide")
            self.connect(constant, (divide, 1))
            #print("7. Connect divide to complex_to_float")
            self.connect((divide, 0), (complex_to_float, 0))
            #print("8. Connect complex_to_float to self")
            self.connect((complex_to_float, 0), (self, 0))
Exemplo n.º 7
0
 def __init__(self,
         device_name,
         sample_rate,
         channel_mapping,
         audio_module):
     self.__device_name = device_name
     self.__sample_rate = sample_rate
     
     self.__signal_type = SignalType(
         # TODO: type should be able to be LSB
         kind='IQ' if len(channel_mapping) == 2 else 'USB',
         sample_rate=self.__sample_rate)
     
     gr.hier_block2.__init__(
         self, type(self).__name__,
         gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
         gr.io_signature(0, 0, 0),
     )
     
     sink = audio_module.sink(
         self.__sample_rate,
         device_name=self.__device_name,
         ok_to_block=True)
     
     # TODO: ignoring channel_mapping parameter, shouldn't be
     split = blocks.complex_to_float(1)
     self.connect(self, split, (sink, 0))
     self.connect((split, 1), (sink, 1))
Exemplo n.º 8
0
    def __init__(self, samp_rate, src_filename, dest_filename):
        gr.top_block.__init__(self, "SAME Encoder")

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

        ##################################################
        # Blocks
        ##################################################
        self.msg_source = blocks.file_source(1, src_filename)
        self.packed_to_unpacked = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
        self.repeat = blocks.repeat(4, 96)
        self.chunks_to_symbols = digital.chunks_to_symbols_bf(([-1, 1]), 1)
        self.freq_mod = analog.frequency_modulator_fc(3.14159265 / 96)
        # TODO: Make amplitude adjustable
        self.center_freq_src = analog.sig_source_c(50000, analog.GR_COS_WAVE, 1822.916666, 0.1, 0)
        self.freq_mult = blocks.multiply_vcc(1)
        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=samp_rate / 100, decimation=500, taps=None, fractional_bw=None
        )
        self.complex_to_float = blocks.complex_to_float()
        self.float_to_short = blocks.float_to_short(1, 32767)
        self.sink = blocks.file_sink(2, dest_filename)
        self.sink.set_unbuffered(True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.msg_source, 0), (self.packed_to_unpacked, 0), (self.chunks_to_symbols, 0))
        self.connect((self.chunks_to_symbols, 0), (self.repeat, 0), (self.freq_mod, 0), (self.freq_mult, 0))
        self.connect((self.center_freq_src, 0), (self.freq_mult, 1))
        self.connect((self.freq_mult, 0), (self.rational_resampler, 0), (self.complex_to_float, 0))
        self.connect((self.complex_to_float, 0), (self.float_to_short, 0), (self.sink, 0))
Exemplo n.º 9
0
    def __init__(self, alpha=0):
        gr.hier_block2.__init__(
            self, "Amplitude Balance",
            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.blocks_rms_xx0 = blocks.rms_ff(alpha)
        self.blocks_rms_xx = blocks.rms_ff(alpha)
        self.blocks_multiply_vxx1 = blocks.multiply_vff(1)
        self.blocks_float_to_complex = blocks.float_to_complex(1)
        self.blocks_divide_xx = blocks.divide_ff(1)
        self.blocks_complex_to_float = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_float_to_complex, 0), (self, 0))
        self.connect((self, 0), (self.blocks_complex_to_float, 0))
        self.connect((self.blocks_complex_to_float, 0), (self.blocks_rms_xx, 0))
        self.connect((self.blocks_complex_to_float, 1), (self.blocks_rms_xx0, 0))
        self.connect((self.blocks_rms_xx, 0), (self.blocks_divide_xx, 0))
        self.connect((self.blocks_rms_xx0, 0), (self.blocks_divide_xx, 1))
        self.connect((self.blocks_complex_to_float, 0), (self.blocks_float_to_complex, 0))
        self.connect((self.blocks_complex_to_float, 1), (self.blocks_multiply_vxx1, 1))
        self.connect((self.blocks_divide_xx, 0), (self.blocks_multiply_vxx1, 0))
        self.connect((self.blocks_multiply_vxx1, 0), (self.blocks_float_to_complex, 1))
Exemplo n.º 10
0
	def __init__(self,
			device_name,
			sample_rate,
			quadrature_as_stereo):
		self.__device_name = device_name
		self.__sample_rate = sample_rate
		self.__quadrature_as_stereo = quadrature_as_stereo
		
		self.__signal_type = SignalType(
			# TODO: type should be able to be LSB
			kind='IQ' if quadrature_as_stereo else 'USB',
			sample_rate=self.__sample_rate)
		
		gr.hier_block2.__init__(
			self, type(self).__name__,
			gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
			gr.io_signature(0, 0, 0),
		)
		
		sink = audio.sink(
			self.__sample_rate,
			device_name=self.__device_name,
			ok_to_block=True)
		
		split = blocks.complex_to_float(1)
		self.connect(self, split, (sink, 0))
		self.connect((split, 1), (sink, 1))
Exemplo n.º 11
0
    def __init__(self,
                 parent,
                 title='',
                 sample_rate=1,
                 size=default_scopesink_size,
                 frame_decim=default_frame_decim,
                 v_scale=default_v_scale,
                 t_scale=None,
                 num_inputs=1,
                 xy_mode=False,
                 **kwargs):

        gr.hier_block2.__init__(
            self, "scope_sink_c",
            gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
            gr.io_signature(0, 0, 0))

        msgq = gr.msg_queue(2)  # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
            c2f = blocks.complex_to_float()
            self.connect((self, i), c2f)
            self.connect((c2f, 0), (self.guts, 2 * i + 0))
            self.connect((c2f, 1), (self.guts, 2 * i + 1))

        self.win = scope_window(
            win_info(msgq, sample_rate, frame_decim, v_scale, t_scale,
                     self.guts, title), parent)
        self.win.info.xy = xy_mode
Exemplo n.º 12
0
 def __init__(self,
         device_name,
         sample_rate,
         quadrature_as_stereo):
     self.__device_name = device_name
     self.__sample_rate = sample_rate
     self.__quadrature_as_stereo = quadrature_as_stereo
     
     self.__signal_type = SignalType(
         # TODO: type should be able to be LSB
         kind='IQ' if quadrature_as_stereo else 'USB',
         sample_rate=self.__sample_rate)
     
     gr.hier_block2.__init__(
         self, type(self).__name__,
         gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
         gr.io_signature(0, 0, 0),
     )
     
     sink = audio.sink(
         self.__sample_rate,
         device_name=self.__device_name,
         ok_to_block=True)
     
     split = blocks.complex_to_float(1)
     self.connect(self, split, (sink, 0))
     self.connect((split, 1), (sink, 1))
Exemplo n.º 13
0
    def __init__(self):
        gr.top_block.__init__(self, "Dttsprx")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000000

        ##################################################
        # Blocks
        ##################################################
        self.low_pass_filter_0 = filter.fir_filter_ccf(int(samp_rate/48000), firdes.low_pass(
        	1, samp_rate, 48000, 1000, firdes.WIN_HAMMING, 6.76))
        self.blocks_interleaved_char_to_complex_0 = blocks.interleaved_char_to_complex(False)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, "/tmp/iqdata", False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_sink_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_file_source_0, 0), (self.blocks_interleaved_char_to_complex_0, 0))    
        self.connect((self.blocks_interleaved_char_to_complex_0, 0), (self.low_pass_filter_0, 0))    
        self.connect((self.low_pass_filter_0, 0), (self.blocks_complex_to_float_0, 0))    
Exemplo n.º 14
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", type=QtCore.QByteArray))

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 1000000

        ##################################################
        # Blocks
        ##################################################
        self.simplefe_sink_f_0 = simplefe.sink_f(samp_rate, 0)
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="none",
            differential=False,
            samples_per_symbol=10,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((0.6, ))
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_random_source_x_0 = blocks.vector_source_b(
            map(int, numpy.random.randint(0, 256, 1000)), True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_random_source_x_0, 0),
                     (self.digital_psk_mod_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.simplefe_sink_f_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_complex_to_float_0, 0))
Exemplo n.º 15
0
def oqpsktx(self,
            carrier=10000,
            samp_rate=80000,
            bw=4000,
            amp=1,
            code=codes.mycode,
            **kwargs):
    code_table, code_len = codes.codes2table(code), len(code)
    chunk_len = int(log(code_len, 2))

    topblock(self, carrier, samp_rate, bw, amp)

    ##################################################
    # Blocks
    ##################################################
    self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(
        chunk_len, gr.GR_LSB_FIRST)
    self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
        (code_table), code_len)

    self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex * 1, 4)
    self.blocks_vector_source_x_0 = blocks.vector_source_c(
        [0, sin(pi / 4), 1, sin(3 * pi / 4)], True, 1, [])

    self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
    self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
    self.blocks_delay_0 = blocks.delay(gr.sizeof_float * 1, 2)

    self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
    self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
        interpolation=int(samp_rate / bw),
        decimation=1,
        taps=None,
        fractional_bw=None,
    )

    ##################################################
    # Connections
    ##################################################
    self.connect((self.source, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
    self.connect((self.blocks_packed_to_unpacked_xx_0, 0),
                 (self.digital_chunks_to_symbols_xx_0, 0))
    self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                 (self.blocks_repeat_0, 0))

    self.connect((self.blocks_vector_source_x_0, 0),
                 (self.blocks_multiply_xx_0, 0))
    self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1))

    self.connect((self.blocks_multiply_xx_0, 0),
                 (self.blocks_complex_to_float_0, 0))
    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_delay_0, 0))
    self.connect((self.blocks_delay_0, 0), (self.blocks_float_to_complex_0, 1))

    self.connect((self.blocks_float_to_complex_0, 0),
                 (self.rational_resampler_xxx_0, 0))
    self.connect((self.rational_resampler_xxx_0, 0), (self.sink, 0))
Exemplo n.º 16
0
    def __init__(self):
        gr.top_block.__init__(self, "Tx Wav")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Tx Wav")
        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", "tx_wav")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3
        self.freq = freq = samp_rate/4
        self.amp = amp = 3

        ##################################################
        # Blocks
        ##################################################
        self._freq_range = Range(1e2, samp_rate/2, 1, samp_rate/4, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq", "counter_slider", float)
        self.top_layout.addWidget(self._freq_win)
        self._amp_range = Range(-40, 20, 1, 3, 200)
        self._amp_win = RangeWidget(self._amp_range, self.set_amp, "amp", "counter_slider", float)
        self.top_layout.addWidget(self._amp_win)
        self.fft_filter_xxx_0 = filter.fft_filter_ccc(1, (firdes.complex_band_pass(pow(10.0,amp/10.0),samp_rate,-3000,-300,100,firdes.WIN_BLACKMAN)), 1)
        self.fft_filter_xxx_0.declare_sample_delay(0)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vcc((0, ))
        self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq, 0.1, 0)
        self.analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, pow(10.0,amp/10.0), 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_noise_source_x_0, 0), (self.fft_filter_xxx_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_multiply_xx_0, 0))    
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 1))    
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))    
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))    
        self.connect((self.fft_filter_xxx_0, 0), (self.blocks_add_const_vxx_0, 0))    
Exemplo n.º 17
0
    def __init__(self):
        gr.top_block.__init__(self, "Hd Tx Rtl File")

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
                interpolation=2,
                decimation=1,
                taps=None,
                fractional_bw=None)
        self.nrsc5_sis_encoder_0 = nrsc5.sis_encoder('ABCD')
        self.nrsc5_psd_encoder_0 = nrsc5.psd_encoder(0, 'Title', 'Artist')
        self.nrsc5_l2_encoder_0 = nrsc5.l2_encoder(1, 0, 146176)
        self.nrsc5_l1_fm_encoder_mp1_0 = nrsc5.l1_fm_encoder(1)
        self.nrsc5_hdc_encoder_0 = nrsc5.hdc_encoder(2, 64000)
        self.fft_vxx_0 = fft.fft_vcc(2048, False, window.rectangular(2048), True, 1)
        self.blocks_wavfile_source_0 = blocks.wavfile_source('sample.wav', True)
        self.blocks_vector_to_stream_0 = blocks.vector_to_stream(gr.sizeof_gr_complex*1, 2048)
        self.blocks_vector_source_x_0 = blocks.vector_source_c([math.sin(math.pi / 2 * i / 112) for i in range(112)] + [1] * (2048-112) + [math.cos(math.pi / 2 * i / 112) for i in range(112)], True, 1, [])
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*2048, 2)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_cc(0.5)
        self.blocks_keep_m_in_n_0 = blocks.keep_m_in_n(gr.sizeof_gr_complex, 2160, 4096, 0)
        self.blocks_interleave_0 = blocks.interleave(gr.sizeof_float*1, 1)
        self.blocks_float_to_uchar_0 = blocks.float_to_uchar()
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_char*1, 'hd-generated.raw', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_conjugate_cc_0 = blocks.conjugate_cc()
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_const_vxx_0_0 = blocks.add_const_ff(127.5)



        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_add_const_vxx_0_0, 0), (self.blocks_float_to_uchar_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_interleave_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_interleave_0, 1))
        self.connect((self.blocks_conjugate_cc_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.blocks_float_to_uchar_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.blocks_interleave_0, 0), (self.blocks_add_const_vxx_0_0, 0))
        self.connect((self.blocks_keep_m_in_n_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_conjugate_cc_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_vector_to_stream_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_vector_to_stream_0, 0), (self.blocks_keep_m_in_n_0, 0))
        self.connect((self.blocks_wavfile_source_0, 1), (self.nrsc5_hdc_encoder_0, 1))
        self.connect((self.blocks_wavfile_source_0, 0), (self.nrsc5_hdc_encoder_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.nrsc5_hdc_encoder_0, 0), (self.nrsc5_l2_encoder_0, 0))
        self.connect((self.nrsc5_l1_fm_encoder_mp1_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.nrsc5_l2_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 0))
        self.connect((self.nrsc5_psd_encoder_0, 0), (self.nrsc5_l2_encoder_0, 1))
        self.connect((self.nrsc5_sis_encoder_0, 0), (self.nrsc5_l1_fm_encoder_mp1_0, 1))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_multiply_const_vxx_0, 0))
Exemplo n.º 18
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.samp_rate = samp_rate = 32000

        ##################################################
        # 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(100e6, 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.blocks_wavfile_sink_0 = blocks.wavfile_sink('', 2, samp_rate, 8)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_wavfile_sink_0, 1))
        self.connect((self.rtlsdr_source_0, 0),
                     (self.blocks_complex_to_float_0, 0))
Exemplo n.º 19
0
 def test_complex_to_float_1(self):
     src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
     expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
Exemplo n.º 20
0
 def test_complex_to_float_1(self):
     src_data = (1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j)
     expected_data = (1.0, 3.0, 5.0, 7.0, 9.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst = blocks.vector_sink_f()
     self.tb.connect(src, op, dst)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data, dst.data())
    def __init__(self):
        gr.top_block.__init__(self, "SSB Transmitter V1 - F1ATB - MAY 2020")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2400000
        self.LSB_USB = LSB_USB = 1
        self.GainRF_TX = GainRF_TX = 100
        self.GainIF_TX = GainIF_TX = 300
        self.GainBB_TX = GainBB_TX = 40
        self.Fr_TX = Fr_TX = 145100000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_xxx_1 = filter.rational_resampler_ccc(
            interpolation=240, decimation=1, taps=None, fractional_bw=None)
        self.hilbert_fc_0 = filter.hilbert_fc(64, firdes.WIN_HAMMING, 6.76)
        self.hilbert_fc_0.set_min_output_buffer(10)
        self.hilbert_fc_0.set_max_output_buffer(10)
        self.blocks_udp_source_0 = blocks.udp_source(gr.sizeof_short * 1,
                                                     '127.0.0.1', 9005, 512,
                                                     True)
        self.blocks_udp_source_0.set_max_output_buffer(2048)
        self.blocks_short_to_float_0 = blocks.short_to_float(1, 32767)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_gr_complex * 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(LSB_USB)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.band_pass_filter_0 = filter.fir_filter_ccc(
            1,
            firdes.complex_band_pass(1, samp_rate / 240,
                                     -1300 + LSB_USB * 1500,
                                     1300 + LSB_USB * 1500, 200,
                                     firdes.WIN_HAMMING, 6.76))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.band_pass_filter_0, 0),
                     (self.rational_resampler_xxx_1, 0))
        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_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, 1))
        self.connect((self.blocks_short_to_float_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.blocks_udp_source_0, 0),
                     (self.blocks_short_to_float_0, 0))
        self.connect((self.hilbert_fc_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0),
                     (self.blocks_null_sink_0, 0))
    def __init__(self):
        gr.hier_block2.__init__(
            self, "IEEE802.15.4 OQPSK PHY",
            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("txin")
        self.message_port_register_hier_out("rxout")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 4000000

        ##################################################
        # Blocks
        ##################################################
        self.single_pole_iir_filter_xx_0 = filter.single_pole_iir_filter_ff(0.00016, 1)
        self.ieee802_15_4_packet_sink_0 = ieee802_15_4.packet_sink(10)
        self.ieee802_15_4_access_code_prefixer_0 = ieee802_15_4.access_code_prefixer()
        self.foo_burst_tagger_0 = foo.burst_tagger(pmt.intern("pdu_length"), 128)
        self.digital_clock_recovery_mm_xx_0 = digital.clock_recovery_mm_ff(2, 0.000225, 0.5, 0.03, 0.0002)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(([(1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (1-1j), (-1+1j), (1+1j), (-1-1j), (-1-1j), (1+1j), (-1+1j), (-1+1j), (-1-1j), (1-1j), (-1-1j), (1-1j), (1+1j), (1-1j), (1+1j), (-1+1j), (1+1j), (-1-1j), (1-1j), (-1+1j), (-1+1j), (1-1j), (-1-1j), (-1-1j), (-1+1j), (1+1j), (-1+1j), (1+1j), (1-1j), (1+1j), (1-1j), (-1-1j)]), 16)
        self.blocks_vector_source_x_0 = blocks.vector_source_c([0, sin(pi/4), 1, sin(3*pi/4)], True, 1, [])
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, 4)
        self.blocks_pdu_to_tagged_stream_0_0_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, 'pdu_length')
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(4, gr.GR_LSB_FIRST)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 2)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.analog_quadrature_demod_cf_0 = analog.quadrature_demod_cf(1)

        ##################################################
        # Connections
        ##################################################
        self.msg_connect((self.ieee802_15_4_access_code_prefixer_0, 'out'), (self.blocks_pdu_to_tagged_stream_0_0_0, 'pdus'))
        self.msg_connect((self.ieee802_15_4_packet_sink_0, 'out'), (self, 'rxout'))
        self.msg_connect((self, 'txin'), (self.ieee802_15_4_access_code_prefixer_0, 'in'))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.analog_quadrature_demod_cf_0, 0), (self.single_pole_iir_filter_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_delay_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0), (self.foo_burst_tagger_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0_0_0, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_sub_xx_0, 0), (self.digital_clock_recovery_mm_xx_0, 0))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.digital_clock_recovery_mm_xx_0, 0), (self.ieee802_15_4_packet_sink_0, 0))
        self.connect((self.foo_burst_tagger_0, 0), (self, 0))
        self.connect((self, 0), (self.analog_quadrature_demod_cf_0, 0))
        self.connect((self.single_pole_iir_filter_xx_0, 0), (self.blocks_sub_xx_0, 1))
Exemplo n.º 23
0
    def __init__(self, txstr="Hello World", carrier=10000, samp_rate = 80000, bw=4000, amp=1):
        gr.top_block.__init__(self, "Top Block")

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

        ##################################################
        # Blocks
        ##################################################
        self.source = blocks.vector_source_b(tuple(bytearray(txstr)), False, 1, [])

        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=int(samp_rate/bw),
                decimation=1,
                taps=None,
                fractional_bw=None,
        )
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc((CODE_TABLE), CODE_LEN)
        self.blocks_vector_source_x_0 = blocks.vector_source_c([0, sin(pi/4), 1, sin(3*pi/4)], True, 1, [])
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, 4)
        self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(CHUNK_LEN, gr.GR_LSB_FIRST)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 2)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_sink_0 = audio.sink(samp_rate, "")
        #XXX Hack: 0.07 should actually be parameter amp, but RPI crashes
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, carrier, 0.07, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.source, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
        self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_repeat_0, 0))

        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1))

        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))
        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_delay_0, 0))
        self.connect((self.blocks_delay_0, 0), (self.blocks_float_to_complex_0, 1))

        self.connect((self.blocks_float_to_complex_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0_0, 1))

        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.audio_sink_0, 0))
Exemplo n.º 24
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        fft_size = 256

        # build our flow graph
        input_rate = 2048.0e3

        #Generate some noise
        noise = analog.noise_source_c(analog.GR_UNIFORM, 1.0 / 10)

        # Generate a complex sinusoid
        #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
        src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 57.50e3,
                                   1)

        # We add these throttle blocks so that this demo doesn't
        # suck down all the CPU available.  Normally you wouldn't use these.
        thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)

        sink1 = fft_sink_c(panel,
                           title="Complex Data",
                           fft_size=fft_size,
                           sample_rate=input_rate,
                           baseband_freq=100e3,
                           ref_level=0,
                           y_per_div=20,
                           y_divs=10)
        vbox.Add(sink1.win, 1, wx.EXPAND)

        combine1 = blocks.add_cc()
        self.connect(src1, (combine1, 0))
        self.connect(noise, (combine1, 1))
        self.connect(combine1, thr1, sink1)

        #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
        src2 = analog.sig_source_f(input_rate, analog.GR_CONST_WAVE, 57.50e3,
                                   1)
        thr2 = blocks.throttle(gr.sizeof_float, input_rate)
        sink2 = fft_sink_f(panel,
                           title="Real Data",
                           fft_size=fft_size * 2,
                           sample_rate=input_rate,
                           baseband_freq=100e3,
                           ref_level=0,
                           y_per_div=20,
                           y_divs=10)
        vbox.Add(sink2.win, 1, wx.EXPAND)

        combine2 = blocks.add_ff()
        c2f2 = blocks.complex_to_float()

        self.connect(src2, (combine2, 0))
        self.connect(noise, c2f2, (combine2, 1))
        self.connect(combine2, thr2, sink2)
Exemplo n.º 25
0
    def __init__(self,
                 samp_rate=44100,
                 carrier_freq=3000,
                 samples_per_symbol=None):
        gr.top_block.__init__(self, 'mod_top_block')
        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate
        self.carrier_freq = carrier_freq
        if samples_per_symbol is None:
            #this will result in a bandwidth that touches 200 Hz on the lower side
            #this way we don't make aliases and don't use frequiencies under 200 Hz,
            #because transmission characteristics can be bad with cheap speakers.
            self.samples_per_symbol = 1 + samp_rate // (carrier_freq - 200)
        else:
            self.samples_per_symbol = samples_per_symbol

        ##################################################
        # Blocks
        ##################################################
        #TODO work out the bandwidth used, we might be getting aliases now.
        self.digital_psk_mod_0 = digital.psk.psk_mod(
            constellation_points=2,
            mod_code="gray",
            differential=True,
            samples_per_symbol=self.samples_per_symbol,
            excess_bw=0.35,
            verbose=False,
            log=False,
        )

        self.packet_source = packet_source()
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, carrier_freq, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_complex_to_float_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_multiply_xx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.packet_source, 0), (self.digital_psk_mod_0, 0))
        self.connect((self.digital_psk_mod_0, 0),
                     (self.blocks_multiply_xx_0, 1))
Exemplo n.º 26
0
    def __init__(self):
        gr.top_block.__init__(self, "Tx1")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Tx1")
        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", "tx1")
        self.restoreGeometry(self.settings.value("geometry").toByteArray())

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 48e3
        self.freq = freq = samp_rate / 4
        self.amp = amp = -10

        ##################################################
        # Blocks
        ##################################################
        self._freq_range = Range(1e2, samp_rate / 2, 1, samp_rate / 4, 200)
        self._freq_win = RangeWidget(self._freq_range, self.set_freq, "freq",
                                     "counter_slider", float)
        self.top_layout.addWidget(self._freq_win)
        self._amp_range = Range(-40, 0, 1, -10, 200)
        self._amp_win = RangeWidget(self._amp_range, self.set_amp, "amp",
                                    "counter_slider", float)
        self.top_layout.addWidget(self._amp_win)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_sink_0 = audio.sink(int(samp_rate), '', True)
        self.analog_sig_source_x_0 = analog.sig_source_c(
            samp_rate, analog.GR_COS_WAVE, freq, pow(10.0, amp / 10.0), 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.audio_sink_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.audio_sink_0, 0))
Exemplo n.º 27
0
    def __init__(self):
        gr.top_block.__init__(self, "SAME Decoder test")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 8000

        ##################################################
        # Blocks
        ##################################################
        self.rational_resampler_44k = filter.rational_resampler_fff(
                interpolation=80,
                decimation=441,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=100,
                decimation=96,
                taps=None,
                fractional_bw=None,
        )
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_fcc(1, (firdes.low_pass(1, samp_rate, 600, 100)), 1822.916667, samp_rate)
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
        	samples_per_symbol=16,
        	gain_mu=0.175,
        	mu=0.5,
        	omega_relative_limit=0.1,
        	freq_error=0.0,
        	verbose=True,
        	log=False,
        )
        #self.src = audio.source(samp_rate, "plughw:CARD=PCH,DEV=2", True)
        self.blocks_wavfile_source_0 = blocks.wavfile_source("eas-test-11-7-2013.wav", False)
        self.blocks_bitstream_sink = blocks.file_sink(1, "bitstream.bin")
        self.xlat_sink = blocks.wavfile_sink("xlat.wav", 1, 8333)
        self.xlat_complex_to_float = blocks.complex_to_float()
        self.analog_pwr_squelch_xx_0 = analog.pwr_squelch_ff(-50, 0.0001, 0)
        self.msg_queue = gr.msg_queue(10)
        self.same_dec_0 = same.same_dec(self.msg_queue)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.xlat_complex_to_float, 0), (self.xlat_sink, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.same_dec_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0), (self.blocks_bitstream_sink, 0))
        #self.connect((self.src, 0), (self.rational_resampler_44k, 0))
        #self.connect((self.rational_resampler_44k, 0), (self.analog_pwr_squelch_xx_0, 0))
        self.connect((self.blocks_wavfile_source_0, 0), (self.analog_pwr_squelch_xx_0,0))
        self.connect((self.analog_pwr_squelch_xx_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))

        self._watcher = _queue_watcher_thread(self.msg_queue)
Exemplo n.º 28
0
 def source(self, sampling_rate, device_name, ok_to_block=True):
     if device_name not in self.__names:
         # unfortunately RuntimeError is the error gnuradio raises
         raise RuntimeError('_AudioModuleStub has no audio device {!r}'.format(device_name))
     noutputs = self.__names[device_name]
     # An arbitrary block that has the same output signature as the intended audio source. The tests we are doing do not ever run the flow graph, so the blocks do not need to have their inputs satisfied. We cannot use a custom hier block because hier blocks do not support variable numbers of outputs.
     if noutputs == 1:
         return blocks.vector_source_f([1])
     elif noutputs == 2:
         return blocks.complex_to_float()
     else:
         raise NotImplementedError('noutputs={!r}'.format(noutputs))
Exemplo n.º 29
0
 def source(self, sampling_rate, device_name, ok_to_block=True):
     if device_name not in self.__names:
         # unfortunately RuntimeError is the error gnuradio raises
         raise RuntimeError('_AudioModuleStub has no audio device {!r}'.format(device_name))
     noutputs = self.__names[device_name]
     # An arbitrary block that has the same output signature as the intended audio source. The tests we are doing do not ever run the flow graph, so the blocks do not need to have their inputs satisfied. We cannot use a custom hier block because hier blocks do not support variable numbers of outputs.
     if noutputs == 1:
         return blocks.vector_source_f([1])
     elif noutputs == 2:
         return blocks.complex_to_float()
     else:
         raise NotImplementedError('noutputs={!r}'.format(noutputs))
Exemplo n.º 30
0
    def __init__(self, payload_len=96, sync_seq=[complex(1,0),complex(-1,0)], threshold=.8):
        gr.hier_block2.__init__(self,
            "generic_rx_path",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
            gr.io_signaturev(3, 3, [gr.sizeof_gr_complex*1, gr.sizeof_gr_complex*1, gr.sizeof_float*1]),
            )

        ##################################################
        # Parameters
        ##################################################
        self.threshold = threshold
        self.sync_seq = sync_seq
        self.sync_header_len = len(sync_seq)
        self.items_per_header_symbol = 1
        self.payload_len = payload_len

        ##################################################
        # Variables
        ##################################################
        self.tag_len_name = tag_len_name = "packet_len"

        ##################################################
        # Blocks
        ##################################################
        self.frame_sync_0 = dctk.frame_sync (self.sync_seq, self.threshold)
        self.digital_header_payload_demux_0 = digital.header_payload_demux(self.sync_header_len, self.items_per_header_symbol, 0, tag_len_name, "", False, gr.sizeof_gr_complex)
        self.dctk_header_tag_generator_0 = dctk.header_tag_generator(self.sync_header_len, payload_len, tag_len_name)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, self.sync_header_len)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.blocks_delay_0, 0))
        self.connect((self, 0), (self.frame_sync_0, 0)) 
               
        self.connect((self.blocks_delay_0, 0), (self.digital_header_payload_demux_0, 0))
        self.connect((self.frame_sync_0, 1), (self.digital_header_payload_demux_0, 1))
        
        self.connect((self.digital_header_payload_demux_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_float_to_char_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.dctk_header_tag_generator_0, 0))
        
        self.connect((self.frame_sync_0, 0), (self, 2))
        self.connect((self.digital_header_payload_demux_0, 1), (self, 1))
        self.connect((self.digital_header_payload_demux_0, 0), (self, 0))
        
        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.dctk_header_tag_generator_0, "header_data", self.digital_header_payload_demux_0, "header_data")
Exemplo n.º 31
0
    def __init__(self, sr, bw):
        gr.top_block.__init__(self, "Top Block")
        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = sr
        self.freq = freq = 2400e6
        self.bandwidth = bandwidth = bw

        ##################################################
        # Blocks
        ##################################################
        self.osmosdr_sink_0 = osmosdr.sink(args="numchan=" + str(1) + " " +
                                           "bladerf=32a")
        self.osmosdr_sink_0.set_sample_rate(samp_rate)
        self.osmosdr_sink_0.set_center_freq(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(0, 0)
        self.osmosdr_sink_0.set_bb_gain(0, 0)
        self.osmosdr_sink_0.set_antenna('TX', 0)
        self.osmosdr_sink_0.set_bandwidth(bandwidth, 0)

        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_file_source_0_0 = blocks.file_source(
            gr.sizeof_float * 1, '/dev/shm/QPulse.dat', True)
        self.blocks_file_source_0 = blocks.file_source(gr.sizeof_float * 1,
                                                       '/dev/shm/IPulse.dat',
                                                       True)
        self.blocks_file_sink_0_0_0_0_0_0 = blocks.file_sink(
            gr.sizeof_float * 1, '/dev/shm/ruidoR.dat', False)
        self.blocks_file_sink_0_0_0_0_0_0.set_unbuffered(True)
        self.blocks_file_sink_0_0_0_0_0 = blocks.file_sink(
            gr.sizeof_float * 1, '/dev/shm/ruidoI.dat', False)
        self.blocks_file_sink_0_0_0_0_0.set_unbuffered(True)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_file_sink_0_0_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_file_sink_0_0_0_0_0_0, 0))
        self.connect((self.blocks_file_source_0, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_file_source_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.osmosdr_sink_0, 0))
Exemplo n.º 32
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Aareff LBC Player")
        _icon_path = "C:\Program Files\GNURadio-3.7\share\icons\hicolor\scalable/apps\gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title='Aareff Oscilliscope',
            sample_rate=samp_rate,
            v_scale=0.2,
            v_offset=0,
            t_scale=5e-3,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=wxgui.TRIG_MODE_AUTO,
            y_axis_label='Counts',
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.blocks_ffmpeg_source_0 = FfmpegHeirBlock(
            '-re -i http://media-sov.musicradio.com/LBCUK? -f wav udp://127.0.0.1:1234'
        )
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (0.000025, ))
        self.blocks_interleaved_short_to_complex_0 = blocks.interleaved_short_to_complex(
            False, False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_sink_0 = audio.sink(samp_rate, '', True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_ffmpeg_source_0, 0),
                     (self.blocks_interleaved_short_to_complex_0, 0))
        self.connect((self.blocks_interleaved_short_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.wxgui_scopesink2_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.audio_sink_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.audio_sink_0, 0))
Exemplo n.º 33
0
    def __init__(self, dtype="discrete", limit=10000, randomize=False):
        if dtype == "discrete":
            gr.hier_block2.__init__(self, "source_alphabet",
                                    gr.io_signature(0, 0, 0),
                                    gr.io_signature(1, 1, gr.sizeof_char))

            self.src = blocks.file_source(
                gr.sizeof_char, "source_material/gutenberg_shakespeare.txt")
            self.convert = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
            # self.convert = blocks.packed_to_unpacked_bb(8, gr.GR_LSB_FIRST);
            self.limit = blocks.head(gr.sizeof_char, limit)
            self.connect(self.src, self.convert)
            last = self.convert

            # whiten our sequence with a random block scrambler (optionally)
            if randomize:
                rand_len = 256
                rand_bits = np.random.randint(2, size=rand_len)
                self.rand_src = blocks.vector_source_b(rand_bits, True)
                self.xor = blocks.xor_bb()
                self.connect(self.rand_src, (self.xor, 1))
                self.connect(last, self.xor)
                last = self.xor
        elif dtype == "continuous":  # continuous
            gr.hier_block2.__init__(self, "source_alphabet",
                                    gr.io_signature(0, 0, 0),
                                    gr.io_signature(1, 1, gr.sizeof_float))

            self.src = blocks.wavfile_source(
                "source_material/serial-s01-e01.mp3", True)
            self.float_short = blocks.float_to_short(1, 1)
            self.convert2 = blocks.interleaved_short_to_complex()
            self.convert3 = blocks.multiply_const_cc(1.0 / 65535)
            self.convert = blocks.complex_to_float()
            self.limit = blocks.head(gr.sizeof_float, limit)
            self.connect(self.src, self.convert2, self.convert3, self.convert)
            last = self.convert
        else:  # noise
            gr.hier_block2.__init__(
                self, "source_alphabet", gr.io_signature(0, 0, 0),
                gr.io_signature(1, 1, gr.sizeof_gr_complex))

            self.src = analog.fastnoise_source_c(analog.GR_GAUSSIAN, 1e-4, 0,
                                                 8192)
            self.limit = blocks.head(gr.sizeof_gr_complex, limit)
            last = self.src

        # connect head or not, and connect to output
        if limit is None:
            self.connect(last, self)
        else:
            self.connect(last, self.limit, self)
Exemplo n.º 34
0
    def __init__(self,
                 dtype="discrete",
                 limit=10000,
                 randomize=False,
                 repeat=False):
        if (dtype == "discrete"):
            gr.hier_block2.__init__(self, "source_alphabet",
                                    gr.io_signature(0, 0, 0),
                                    gr.io_signature(1, 1, gr.sizeof_char))

            self.src = blocks.file_source(
                gr.sizeof_char,
                "source_material/gutenberg_shakespeare.txt",
                repeat=repeat)
            self.convert = blocks.packed_to_unpacked_bb(1, gr.GR_LSB_FIRST)
            #self.convert = blocks.packed_to_unpacked_bb(8, gr.GR_LSB_FIRST);
            if limit is not None:
                self.limit = blocks.head(gr.sizeof_char, limit)
            self.connect(self.src, self.convert)
            last = self.convert

            # whiten our sequence with a random block scrambler (optionally)
            if (randomize):
                rand_len = 256
                rand_bits = np.random.randint(2, size=rand_len)
                self.randsrc = blocks.vector_source_b(rand_bits, True)
                self.xor = blocks.xor_bb()
                self.connect(self.randsrc, (self.xor, 1))
                self.connect(last, self.xor)
                last = self.xor

        else:  # "type_continuous"
            gr.hier_block2.__init__(self, "source_alphabet",
                                    gr.io_signature(0, 0, 0),
                                    gr.io_signature(1, 1, gr.sizeof_float))

            self.src = mediatools.audiosource_s(
                ["source_material/serial-s01-e01.mp3"])
            self.convert2 = blocks.interleaved_short_to_complex()
            self.convert3 = blocks.multiply_const_cc(1.0 / 65535)
            self.convert = blocks.complex_to_float()
            if limit is not None:
                self.limit = blocks.head(gr.sizeof_float, limit)
            self.connect(self.src, self.convert2, self.convert3, self.convert)
            last = self.convert

        # connect head or not, and connect to output
        if (limit is None):
            self.connect(last, self)
        else:
            self.connect(last, self.limit, self)
Exemplo n.º 35
0
    def __init__(self):
        gr.top_block.__init__(self, "Motorola CQUAM v1.4")

        ##################################################
        # Blocks
        ##################################################
        self.low_pass_filter_0 = filter.interp_fir_filter_ccf(
            1, firdes.low_pass(1, 44100, 11e3, 1e3, firdes.WIN_BLACKMAN, 6.76))
        self.blocks_wavfile_sink_0 = blocks.wavfile_sink(
            '/mnt/mediay/SEND/output_4.wav', 2, 44100, 16)
        self.blocks_sub_xx_0 = blocks.sub_ff(1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((0.3, ))
        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_3 = blocks.add_vff(1)
        self.blocks_add_xx_1 = blocks.add_vff(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self.audio_source_0 = audio.source(44100, 'tx_source', True)
        self.analog_sig_source_x_2_0_0 = analog.sig_source_f(
            44100, analog.GR_SIN_WAVE, 25, 0.08, 0)
        self.analog_sig_source_x_2_0 = analog.sig_source_f(
            44100, analog.GR_COS_WAVE, 0, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_2_0, 0),
                     (self.blocks_add_xx_0, 1))
        self.connect((self.analog_sig_source_x_2_0_0, 0),
                     (self.blocks_add_xx_3, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_add_xx_1, 0))
        self.connect((self.audio_source_0, 1), (self.blocks_add_xx_1, 1))
        self.connect((self.audio_source_0, 0), (self.blocks_sub_xx_0, 0))
        self.connect((self.audio_source_0, 1), (self.blocks_sub_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_add_xx_1, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_add_xx_3, 0),
                     (self.blocks_float_to_complex_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.blocks_wavfile_sink_0, 1))
        self.connect((self.blocks_complex_to_float_0, 0),
                     (self.blocks_wavfile_sink_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.low_pass_filter_0, 0))
        self.connect((self.blocks_sub_xx_0, 0), (self.blocks_add_xx_3, 1))
        self.connect((self.low_pass_filter_0, 0),
                     (self.blocks_complex_to_float_0, 0))
Exemplo n.º 36
0
 def test_complex_to_float_2(self):
     src_data = (1+2j, 3+4j, 5+6j, 7+8j, 9+10j)
     expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst1 = blocks.vector_sink_f()
     dst2 = blocks.vector_sink_f()
     self.tb.connect(src, op)
     self.tb.connect((op, 0), dst1)
     self.tb.connect((op, 1), dst2)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data1, dst1.data())
     self.assertFloatTuplesAlmostEqual(expected_data2, dst2.data())
Exemplo n.º 37
0
 def test_complex_to_float_2(self):
     src_data = (1 + 2j, 3 + 4j, 5 + 6j, 7 + 8j, 9 + 10j)
     expected_data1 = (1.0, 3.0, 5.0, 7.0, 9.0)
     expected_data2 = (2.0, 4.0, 6.0, 8.0, 10.0)
     src = blocks.vector_source_c(src_data)
     op = blocks.complex_to_float()
     dst1 = blocks.vector_sink_f()
     dst2 = blocks.vector_sink_f()
     self.tb.connect(src, op)
     self.tb.connect((op, 0), dst1)
     self.tb.connect((op, 1), dst2)
     self.tb.run()
     self.assertFloatTuplesAlmostEqual(expected_data1, dst1.data())
     self.assertFloatTuplesAlmostEqual(expected_data2, dst2.data())
Exemplo n.º 38
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))
Exemplo n.º 39
0
    def __init__(self):
        gr.top_block.__init__(self)

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

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

        # self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus("",1)
        # self.fcdproplus_fcdproplus_0.set_lna(1)
        # self.fcdproplus_fcdproplus_0.set_mixer_gain(1)
        # self.fcdproplus_fcdproplus_0.set_if_gain(20)
        # self.fcdproplus_fcdproplus_0.set_freq_corr(0)
        # self.fcdproplus_fcdproplus_0.set_freq(70050000)
        self.fcdproplus_fcdproplus_0 = fcdproplus.fcdproplus("",1)
        self.fcdproplus_fcdproplus_0.set_lna(0)
        self.fcdproplus_fcdproplus_0.set_mixer_gain(0)
        self.fcdproplus_fcdproplus_0.set_if_gain(30) # new board, cal 17/12/17
        #self.fcdproplus_fcdproplus_0.set_if_gain(38) # new board, cal 17/12/17
        #self.fcdproplus_fcdproplus_0.set_if_gain(47) # new board
#        self.fcdproplus_fcdproplus_0.set_if_gain(38) # old board
        self.fcdproplus_fcdproplus_0.set_freq_corr(0)
        #delta=180
        delta=255
        self.fcdproplus_fcdproplus_0.set_freq(21406000+delta)
#        self.fcdproplus_fcdproplus_0.set_freq(21400000)
#        self.fcdproplus_fcdproplus_0.set_freq(29210000)
          

        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.audio_sink_0 = audio.sink(samp_rate, "skype", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 1))
        self.connect((self.fcdproplus_fcdproplus_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_complex_to_float_0, 0))
Exemplo n.º 40
0
    def __init__(self, mode='IQ', **kwargs):
        audio_rate = 96000
        SimpleAudioDemodulator.__init__(self,
                                        mode=mode,
                                        stereo=True,
                                        audio_rate=audio_rate,
                                        demod_rate=audio_rate,
                                        band_filter=audio_rate * 0.5,
                                        band_filter_transition=audio_rate *
                                        0.2,
                                        **kwargs)

        self.split_block = blocks.complex_to_float(1)

        self.connect(self, self.band_filter_block, self.rf_squelch_block, self)
        self.connect(self.band_filter_block, self.rf_probe_block)
Exemplo n.º 41
0
    def __init__(self, k=4.0, tchannel=1, voltage=0):
        gr.hier_block2.__init__(
            self,
            "Channels",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )

        ##################################################
        # Parameters
        ##################################################
        self.k = k
        self.tchannel = tchannel
        self.voltage = voltage

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

        ##################################################
        # Blocks
        ##################################################
        self.channel_0_0 = Transmission_Channels.channel(
            k=k,
            tchannel=tchannel,
            voltage=voltage,
        )
        self.channel_0 = Transmission_Channels.channel(
            k=k,
            tchannel=tchannel,
            voltage=voltage,
        )
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_complex_to_float_0, 0), (self.channel_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1),
                     (self.channel_0_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self, 0))
        self.connect((self.channel_0, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.channel_0_0, 0),
                     (self.blocks_float_to_complex_0, 1))
        self.connect((self, 0), (self.blocks_complex_to_float_0, 0))
Exemplo n.º 42
0
    def __init__( self, if_rate, af_rate ):
        gr.hier_block2.__init__(self, "ssb_demod",
                                gr.io_signature(1,1,gr.sizeof_gr_complex),
                                gr.io_signature(1,1,gr.sizeof_float))

        self.if_rate  = int(if_rate)
        self.af_rate  = int(af_rate)
        self.if_decim = int(if_rate / af_rate)
        self.sideband = 1

        self.xlate_taps = ([complex(v) for v in file('ssb_taps').readlines()])

        self.audio_taps = filter.firdes.low_pass(
            1.0,
            self.af_rate,
            3e3,
            600,
            filter.firdes.WIN_HAMMING )

        self.xlate = filter.freq_xlating_fir_filter_ccc(
            self.if_decim,
            self.xlate_taps,
            0,
            self.if_rate )

        self.split = blocks.complex_to_float()

        self.lpf = filter.fir_filter_fff(
            1, self.audio_taps )

        self.sum   = blocks.add_ff( )
        self.am_sel = blocks.multiply_const_ff( 0 )
        self.sb_sel = blocks.multiply_const_ff( 1 )
        self.mixer  = blocks.add_ff()
        self.am_det = blocks.complex_to_mag()

        self.connect(self,             self.xlate)
        self.connect(self.xlate,       self.split)
        self.connect((self.split, 0), (self.sum, 0))
        self.connect((self.split, 1), (self.sum, 1))
        self.connect(self.sum,         self.sb_sel)
        self.connect(self.xlate,       self.am_det)
        self.connect(self.sb_sel,     (self.mixer, 0))
        self.connect(self.am_det,      self.am_sel)
        self.connect(self.am_sel,     (self.mixer, 1))
        self.connect(self.mixer,       self.lpf)
        self.connect(self.lpf,         self)
Exemplo n.º 43
0
def graph ():
    print os.getpid()
    sampling_freq = 19200000

    tb = gr.top_block ()

    src0 = blocks.file_source(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")

    duc_coeffs = filter.firdes.low_pass( 1, 19.2e6, 9e6, 1e6, filter.firdes.WIN_HAMMING )
    duc = filter.freq_xlating_fir_filter_ccf( 1 duc_coeffs, 5.75e6, 19.2e6 )

    c2f = blocks.complex_to_float()
    file = blocks.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2")

    tb.connect( src0, duc, c2f, file )

    tb.run()
Exemplo n.º 44
0
 def handle_WBFM(self):
     self.statusLabel.setText("Status: Generating WBFM Data")
     SNRval = self.SNRSlider.value()
     if (SNRval % 2 != 0):
         SNRval = (SNRval + 1) % 20
     src, mod, chan = gen_wbfm(SNRval)
     #rand_bits = np.random.randint(2, size=256)
     #randsrc = blocks.vector_source_b(rand_bits, True)
     sigsrc = analog.sig_source_c(200e3, analog.GR_COS_WAVE, 200e3, 1, 0)
     self.lock()
     print "Locked"
     self.disconnect(self.qtgui_freq_sink_x_0)
     convert = blocks.complex_to_float()
     self.connect((sigsrc, 0), (convert, 0), (mod, 0), (chan, 0),
                  (self.qtgui_freq_sink_x_0, 0))
     self.unlock()
     print "Unlocked"
Exemplo n.º 45
0
def graph ():
    print os.getpid()
    sampling_freq = 19200000

    tb = gr.top_block ()

    src0 = blocks.file_source(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")

    duc_coeffs = filter.firdes.low_pass( 1, 19.2e6, 9e6, 1e6, filter.firdes.WIN_HAMMING )
    duc = filter.freq_xlating_fir_filter_ccf( 1, duc_coeffs, 5.75e6, 19.2e6 )

    c2f = blocks.complex_to_float()
    file = blocks.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2")

    tb.connect( src0, duc, c2f, file )

    tb.run()
Exemplo n.º 46
0
    def __init__(self, mode='IQ', **kwargs):
        audio_rate = 96000  # TODO parameter / justify this
        SimpleAudioDemodulator.__init__(self,
                                        mode=mode,
                                        stereo=True,
                                        audio_rate=audio_rate,
                                        demod_rate=audio_rate,
                                        band_filter=audio_rate * 0.5,
                                        band_filter_transition=audio_rate *
                                        0.2,
                                        **kwargs)

        self.split_block = blocks.complex_to_float(1)

        self.connect(self, self.band_filter_block, self.rf_squelch_block,
                     self.split_block)
        self.connect(self.band_filter_block, self.rf_probe_block)
        self.connect_audio_output((self.split_block, 0), (self.split_block, 1))
Exemplo n.º 47
0
    def __init__(self, mode="IQ", **kwargs):
        audio_rate = 96000  # TODO parameter / justify this
        SimpleAudioDemodulator.__init__(
            self,
            mode=mode,
            stereo=True,
            audio_rate=audio_rate,
            demod_rate=audio_rate,
            band_filter=audio_rate * 0.5,
            band_filter_transition=audio_rate * 0.2,
            **kwargs
        )

        self.split_block = blocks.complex_to_float(1)

        self.connect(self, self.band_filter_block, self.rf_squelch_block, self.split_block)
        self.connect(self.band_filter_block, self.rf_probe_block)
        self.connect_audio_output((self.split_block, 0), (self.split_block, 1))
Exemplo n.º 48
0
def oqpsktx(self, carrier=10000, samp_rate = 80000, bw=4000, amp=1, code=codes.mycode, **kwargs):
    code_table, code_len = codes.codes2table(code), len(code)
    chunk_len = int(log(code_len,2))

    topblock(self, carrier, samp_rate, bw, amp)

    ##################################################
    # Blocks
    ##################################################
    self.blocks_packed_to_unpacked_xx_0 = blocks.packed_to_unpacked_bb(chunk_len, gr.GR_LSB_FIRST)
    self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc((code_table), code_len)

    self.blocks_repeat_0 = blocks.repeat(gr.sizeof_gr_complex*1, 4)
    self.blocks_vector_source_x_0 = blocks.vector_source_c([0, sin(pi/4), 1, sin(3*pi/4)], True, 1, [])

    self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
    self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
    self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 2)

    self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
    self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
            interpolation=int(samp_rate/bw),
            decimation=1,
            taps=None,
            fractional_bw=None,
    )

    ##################################################
    # Connections
    ##################################################
    self.connect((self.source, 0), (self.blocks_packed_to_unpacked_xx_0, 0))
    self.connect((self.blocks_packed_to_unpacked_xx_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
    self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.blocks_repeat_0, 0))

    self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
    self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_xx_0, 1))

    self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))
    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_delay_0, 0))
    self.connect((self.blocks_delay_0, 0), (self.blocks_float_to_complex_0, 1))

    self.connect((self.blocks_float_to_complex_0, 0), (self.rational_resampler_xxx_0, 0))
    self.connect((self.rational_resampler_xxx_0, 0), (self.sink, 0))
Exemplo n.º 49
0
    def __init__(self, samp_rate, src_filename, dest_filename):
        gr.top_block.__init__(self, "SAME Encoder")

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

        ##################################################
        # Blocks
        ##################################################
        self.msg_source = blocks.file_source(1, src_filename)
        self.packed_to_unpacked = blocks.packed_to_unpacked_bb(
            1, gr.GR_LSB_FIRST)
        self.repeat = blocks.repeat(4, 96)
        self.chunks_to_symbols = digital.chunks_to_symbols_bf(([-1, 1]), 1)
        self.freq_mod = analog.frequency_modulator_fc(3.14159265 / 96)
        # TODO: Make amplitude adjustable
        self.center_freq_src = analog.sig_source_c(50000, analog.GR_COS_WAVE,
                                                   1822.916666, 0.1, 0)
        self.freq_mult = blocks.multiply_vcc(1)
        self.rational_resampler = filter.rational_resampler_ccc(
            interpolation=samp_rate / 100,
            decimation=500,
            taps=None,
            fractional_bw=None,
        )
        self.complex_to_float = blocks.complex_to_float()
        self.float_to_short = blocks.float_to_short(1, 32767)
        self.sink = blocks.file_sink(2, dest_filename)
        self.sink.set_unbuffered(True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.msg_source, 0), (self.packed_to_unpacked, 0),
                     (self.chunks_to_symbols, 0))
        self.connect((self.chunks_to_symbols, 0), (self.repeat, 0),
                     (self.freq_mod, 0), (self.freq_mult, 0))
        self.connect((self.center_freq_src, 0), (self.freq_mult, 1))
        self.connect((self.freq_mult, 0), (self.rational_resampler, 0),
                     (self.complex_to_float, 0))
        self.connect((self.complex_to_float, 0), (self.float_to_short, 0),
                     (self.sink, 0))
Exemplo n.º 50
0
	def __init__(self, mode='IQ', audio_rate=0, **kwargs):
		assert audio_rate > 0
		SimpleAudioDemodulator.__init__(self,
			mode=mode,
			audio_rate=audio_rate,
			demod_rate=audio_rate,
			band_filter=audio_rate * 0.5,
			band_filter_transition=audio_rate * 0.2,
			**kwargs)
		
		self.split_block = blocks.complex_to_float(1)
		
		self.connect(
			self,
			self.band_filter_block,
			self.rf_squelch_block,
			self.split_block)
		self.connect(self.band_filter_block, self.rf_probe_block)
		self.connect_audio_output((self.split_block, 0), (self.split_block, 1))
Exemplo n.º 51
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        fft_size = 256

        # build our flow graph
        input_rate = 2048.0e3

        #Generate some noise
        noise = analog.noise_source_c(analog.GR_UNIFORM, 1.0/10)

        # Generate a complex sinusoid
        #src1 = analog.sig_source_c(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
        src1 = analog.sig_source_c(input_rate, analog.GR_CONST_WAVE, 57.50e3, 1)

        # We add these throttle blocks so that this demo doesn't
        # suck down all the CPU available.  Normally you wouldn't use these.
        thr1 = blocks.throttle(gr.sizeof_gr_complex, input_rate)

        sink1 = fft_sink_c(panel, title="Complex Data", fft_size=fft_size,
			   sample_rate=input_rate, baseband_freq=100e3,
			   ref_level=0, y_per_div=20, y_divs=10)
        vbox.Add(sink1.win, 1, wx.EXPAND)

        combine1 = blocks.add_cc()
        self.connect(src1, (combine1,0))
        self.connect(noise,(combine1,1))
        self.connect(combine1,thr1, sink1)

        #src2 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 2e3, 1)
        src2 = analog.sig_source_f (input_rate, analog.GR_CONST_WAVE, 57.50e3, 1)
        thr2 = blocks.throttle(gr.sizeof_float, input_rate)
        sink2 = fft_sink_f(panel, title="Real Data", fft_size=fft_size*2,
			   sample_rate=input_rate, baseband_freq=100e3,
			   ref_level=0, y_per_div=20, y_divs=10)
        vbox.Add(sink2.win, 1, wx.EXPAND)

        combine2 = blocks.add_ff()
        c2f2 = blocks.complex_to_float()

        self.connect(src2, (combine2,0))
        self.connect(noise,c2f2,(combine2,1))
        self.connect(combine2, thr2,sink2)
Exemplo n.º 52
0
    def __init__(self, parent, title='', sample_rate=1,
                 size=default_scopesink_size, frame_decim=default_frame_decim,
                 v_scale=default_v_scale, t_scale=None, num_inputs=1, xy_mode=False, **kwargs):

        gr.hier_block2.__init__(self, "scope_sink_c",
                                gr.io_signature(num_inputs, num_inputs, gr.sizeof_gr_complex),
                                gr.io_signature(0,0,0))

        msgq = gr.msg_queue(2)         # message queue that holds at most 2 messages
        self.guts = wxgui.oscope_sink_f(sample_rate, msgq)
        for i in range(num_inputs):
	        c2f = blocks.complex_to_float()
	        self.connect((self, i), c2f)
	        self.connect((c2f, 0),(self.guts, 2*i+0))
	        self.connect((c2f, 1),(self.guts, 2*i+1))

        self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
                                         v_scale, t_scale, self.guts, title), parent)
        self.win.info.xy = xy_mode
Exemplo n.º 53
0
 def __init__(self, mode='IQ', **kwargs):
     audio_rate = 96000
     SimpleAudioDemodulator.__init__(self,
         mode=mode,
         stereo=True,
         audio_rate=audio_rate,
         demod_rate=audio_rate,
         band_filter=audio_rate * 0.5,
         band_filter_transition=audio_rate * 0.2,
         **kwargs)
     
     self.split_block = blocks.complex_to_float(1)
     
     self.connect(
         self,
         self.band_filter_block,
         self.rf_squelch_block,
         self)
     self.connect(self.band_filter_block, self.rf_probe_block)
Exemplo n.º 54
0
def complex_to_float(N):
    op = blocks.complex_to_float()
    tb = helper(N, op, gr.sizeof_gr_complex, gr.sizeof_float, 1, 2)
    return tb
Exemplo n.º 55
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

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

        ##################################################
        # Blocks
        ##################################################
        self.n = self.n = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.n.AddPage(grc_wxgui.Panel(self.n), "FFT")
        self.n.AddPage(grc_wxgui.Panel(self.n), "Time")
        self.Add(self.n)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
        	self.n.GetPage(1).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.n.GetPage(1).Add(self.wxgui_scopesink2_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_f(
        	self.n.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,
        )
        self.n.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.hilbert_fc_0 = filter.hilbert_fc(10000, firdes.WIN_HAMMING, 6.76)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
        self.blocks_multiply_xx_1 = blocks.multiply_vff(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_2 = blocks.add_vff(1)
        self.analog_sig_source_x_0_2 = analog.sig_source_f(samp_rate, analog.GR_SIN_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_f(samp_rate, analog.GR_COS_WAVE, 10000, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_f(samp_rate, analog.GR_TRI_WAVE, 500, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.hilbert_fc_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.analog_sig_source_x_0_2, 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_1, 0), (self.blocks_add_xx_2, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_add_xx_2, 1))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.blocks_add_xx_2, 0), (self.wxgui_scopesink2_0, 0))
Exemplo n.º 56
0
    def __init__(self, rxPort=52002, txPort=52001):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Parameters
        ##################################################
        self.rxPort = rxPort
        self.txPort = txPort

        ##################################################
        # Variables
        ##################################################
        self.localOscillator = localOscillator = 14070000
        self.threshold = threshold = -200
        self.samp_rate = samp_rate = 48000
        self.rxPhase = rxPhase = .84
        self.rxMagnitude = rxMagnitude = 0.854
        self.freqFine = freqFine = 0
        self.freq = freq = localOscillator
        self.bandwidth = bandwidth = 50

        ##################################################
        # Blocks
        ##################################################
        _threshold_sizer = wx.BoxSizer(wx.VERTICAL)
        self._threshold_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	label="threshold",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._threshold_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_threshold_sizer,
        	value=self.threshold,
        	callback=self.set_threshold,
        	minimum=-500,
        	maximum=500,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_threshold_sizer)
        self.notebook_0 = self.notebook_0 = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "tuning")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "scope")
        self.Add(self.notebook_0)
        _freqFine_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freqFine_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freqFine_sizer,
        	value=self.freqFine,
        	callback=self.set_freqFine,
        	label="Tuning",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freqFine_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freqFine_sizer,
        	value=self.freqFine,
        	callback=self.set_freqFine,
        	minimum=-500,
        	maximum=500,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freqFine_sizer)
        _freq_sizer = wx.BoxSizer(wx.VERTICAL)
        self._freq_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	label="Frequency",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._freq_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_freq_sizer,
        	value=self.freq,
        	callback=self.set_freq,
        	minimum=localOscillator-samp_rate,
        	maximum=localOscillator+samp_rate,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_freq_sizer)
        _bandwidth_sizer = wx.BoxSizer(wx.VERTICAL)
        self._bandwidth_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_bandwidth_sizer,
        	value=self.bandwidth,
        	callback=self.set_bandwidth,
        	label="Signal Bandwidth",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._bandwidth_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_bandwidth_sizer,
        	value=self.bandwidth,
        	callback=self.set_bandwidth,
        	minimum=30,
        	maximum=5000,
        	num_steps=1000,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_bandwidth_sizer)
        self.wxgui_waterfallsink2_0_0_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(1).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=125*8,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_waterfallsink2_0_0_0.win)
        self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=0,
        	dynamic_range=100,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=125*8,
        	fft_size=512,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title="Waterfall Plot",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_waterfallsink2_0_0.win)
        self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
        	self.notebook_0.GetPage(0).GetWin(),
        	baseband_freq=localOscillator,
        	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.notebook_0.GetPage(0).Add(self.wxgui_waterfallsink2_0.win)
        self.low_pass_filter_0_1 = filter.fir_filter_ccf(samp_rate/125/8, firdes.low_pass(
        	1, samp_rate, 500, 500, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0_0 = filter.interp_fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate, 30, 30, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(samp_rate/125/8, firdes.low_pass(
        	1, samp_rate, bandwidth, bandwidth, firdes.WIN_HAMMING, 6.76))
        self.digital_mpsk_receiver_cc_0 = digital.mpsk_receiver_cc(2, 0, cmath.pi/100.0, -0.5, 0.5, 0.25, 0.01, 125*8/31.25, 0.001, 0.001)
        self.blocks_transcendental_1 = blocks.transcendental("sin", "float")
        self.blocks_transcendental_0 = blocks.transcendental("cos", "float")
        self.blocks_throttle_0_1 = blocks.throttle(gr.sizeof_float*1, samp_rate)
        self.blocks_throttle_0_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate)
        self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*1, 31.25)
        self.blocks_threshold_ff_0 = blocks.threshold_ff(1e-12, 1e-12, 0)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, int(samp_rate/31.25))
        self.blocks_null_source_1 = blocks.null_source(gr.sizeof_float*1)
        self.blocks_null_source_0_0 = blocks.null_source(gr.sizeof_float*1)
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_float*1)
        self.blocks_multiply_xx_0_2 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vff((rxMagnitude, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((2, ))
        self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1)
        self.blocks_float_to_complex_1_0 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0_1 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
        self.blocks_float_to_char_0 = blocks.float_to_char(1, 1)
        self.blocks_delay_0 = blocks.delay(gr.sizeof_gr_complex*1, 1)
        self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_xx_0 = blocks.add_vcc(1)
        self.blocks_add_const_vxx_0 = blocks.add_const_vff((-1, ))
        self.blks2_tcp_source_0 = grc_blks2.tcp_source(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=txPort,
        	server=False,
        )
        self.blks2_tcp_sink_0 = grc_blks2.tcp_sink(
        	itemsize=gr.sizeof_char*1,
        	addr="127.0.0.1",
        	port=rxPort,
        	server=False,
        )
        self.audio_source_0 = audio.source(samp_rate, "", True)
        self.audio_sink_0 = audio.sink(samp_rate, "", True)
        self.analog_simple_squelch_cc_0 = analog.simple_squelch_cc(threshold, 1)
        self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, -freqFine, 1, 0)
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq+freqFine-localOscillator, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_SIN_WAVE, -(freq-localOscillator), 1, 0)
        self.analog_const_source_x_0 = analog.sig_source_f(0, analog.GR_CONST_WAVE, 0, 0, rxPhase*3.14159/180.0)
        self.analog_agc_xx_0 = analog.agc_cc(1e-4, 1.0, 1.0)
        self.analog_agc_xx_0.set_max_gain(65536)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blks2_tcp_source_0, 0), (self.blocks_throttle_0, 0))
        self.connect((self.blocks_throttle_0, 0), (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_char_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_const_vxx_0, 0))
        self.connect((self.blocks_float_to_complex_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.blocks_throttle_0_1, 0), (self.blocks_float_to_complex_0, 0))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_xx_0_0, 0))
        self.connect((self.blocks_float_to_complex_0_1, 0), (self.blocks_multiply_xx_0_1, 1))
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_transcendental_1, 0))
        self.connect((self.analog_const_source_x_0, 0), (self.blocks_transcendental_0, 0))
        self.connect((self.blocks_transcendental_0, 0), (self.blocks_float_to_complex_0_1, 0))
        self.connect((self.blocks_transcendental_1, 0), (self.blocks_float_to_complex_0_1, 1))
        self.connect((self.blocks_null_source_0, 0), (self.blocks_float_to_complex_1, 0))
        self.connect((self.audio_source_0, 0), (self.blocks_multiply_const_vxx_2, 0))
        self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_float_to_complex_1, 0), (self.blocks_multiply_xx_0_1, 0))
        self.connect((self.blocks_null_source_0_0, 0), (self.blocks_float_to_complex_1_0, 1))
        self.connect((self.audio_source_0, 1), (self.blocks_float_to_complex_1_0, 0))
        self.connect((self.blocks_float_to_complex_1_0, 0), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_multiply_xx_0_1, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_add_xx_0, 0), (self.blocks_throttle_0_0, 0))
        self.connect((self.blocks_null_source_1, 0), (self.blocks_float_to_complex_0, 1))
        self.connect((self.blocks_throttle_0_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_float_to_char_0, 0), (self.blks2_tcp_sink_0, 0))
        self.connect((self.blocks_complex_to_real_0, 0), (self.blocks_threshold_ff_0, 0))
        self.connect((self.blocks_threshold_ff_0, 0), (self.blocks_float_to_char_0, 0))
        self.connect((self.analog_simple_squelch_cc_0, 0), (self.blocks_complex_to_real_0, 0))
        self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.analog_simple_squelch_cc_0, 0))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.blocks_multiply_conjugate_cc_0, 1))
        self.connect((self.digital_mpsk_receiver_cc_0, 0), (self.blocks_delay_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_delay_0, 0), (self.blocks_multiply_conjugate_cc_0, 0))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_throttle_0_1, 0))
        self.connect((self.blocks_add_const_vxx_0, 0), (self.blocks_repeat_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_multiply_xx_0_2, 0))
        self.connect((self.analog_sig_source_x_1, 0), (self.blocks_multiply_xx_0_2, 1))
        self.connect((self.blocks_multiply_xx_0_2, 0), (self.low_pass_filter_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.low_pass_filter_0_1, 0))
        self.connect((self.low_pass_filter_0_1, 0), (self.wxgui_waterfallsink2_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_agc_xx_0, 0))
        self.connect((self.analog_agc_xx_0, 0), (self.digital_mpsk_receiver_cc_0, 0))
        self.connect((self.analog_agc_xx_0, 0), (self.wxgui_waterfallsink2_0_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.audio_sink_0, 1))
        self.connect((self.blocks_complex_to_float_0, 1), (self.audio_sink_0, 0))
        self.connect((self.blocks_throttle_0_0, 0), (self.wxgui_waterfallsink2_0, 0))
Exemplo n.º 57
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.offset_tune_freq = offset_tune_freq = -10E3
        self.band_freq = band_freq = 7.055E6
        self.usrp_clk_rate = usrp_clk_rate = 200E6
        self.usrp_ask_freq = usrp_ask_freq = band_freq+offset_tune_freq
        self.usrp_DDC_freq = usrp_DDC_freq = np.round(usrp_ask_freq/usrp_clk_rate* 2**32)/2**32 * usrp_clk_rate
        self.fine_tuner_freq = fine_tuner_freq = 0
        self.coarse_tuner_freq = coarse_tuner_freq = 0
        self.samp_rate = samp_rate = 250000
        self.lo_freq = lo_freq = usrp_DDC_freq + coarse_tuner_freq + fine_tuner_freq - offset_tune_freq
        self.record_check_box = record_check_box = False
        self.file_name_string = file_name_string = str(int(time.mktime(time.gmtime())))+"UTC_"+'{:.6f}'.format(lo_freq)+"Hz"+"_"+str(int(samp_rate/100))+"sps"+".raw"
        self.variable_function_probe_0 = variable_function_probe_0 = 0
        self.file_name = file_name = file_name_string if record_check_box==True else "/dev/null"
        self.volume = volume = 5.0
        self.rx_power_label = rx_power_label = '{:.1f}'.format(variable_function_probe_0)
        self.lo_freq_label = lo_freq_label = '{:.6f}'.format(lo_freq)
        self.gain_offset_dB = gain_offset_dB = 18.86
        self.filter_taps = filter_taps = firdes.low_pass(1.0,2.5,0.1,0.02,firdes.WIN_HAMMING)
        self.filename_label = filename_label = file_name
        self.cw_filter_bw = cw_filter_bw = 1000
        self.RX_power_offset_dB = RX_power_offset_dB = -35.2

        ##################################################
        # Blocks
        ##################################################
        self._volume_layout = Qt.QVBoxLayout()
        self._volume_knob = Qwt.QwtKnob()
        self._volume_knob.setRange(0, 10.0, 1.0)
        self._volume_knob.setValue(self.volume)
        self._volume_knob.valueChanged.connect(self.set_volume)
        self._volume_layout.addWidget(self._volume_knob)
        self._volume_label = Qt.QLabel("Volume")
        self._volume_label.setAlignment(Qt.Qt.AlignTop | Qt.Qt.AlignHCenter)
        self._volume_layout.addWidget(self._volume_label)
        self.top_grid_layout.addLayout(self._volume_layout, 5,6,1,1)
        self._cw_filter_bw_options = (100, 500, 1000, )
        self._cw_filter_bw_labels = ("100 Hz", "500 Hz", "1 kHz", )
        self._cw_filter_bw_tool_bar = Qt.QToolBar(self)
        self._cw_filter_bw_tool_bar.addWidget(Qt.QLabel("CW Filter BW"+": "))
        self._cw_filter_bw_combo_box = Qt.QComboBox()
        self._cw_filter_bw_tool_bar.addWidget(self._cw_filter_bw_combo_box)
        for label in self._cw_filter_bw_labels: self._cw_filter_bw_combo_box.addItem(label)
        self._cw_filter_bw_callback = lambda i: Qt.QMetaObject.invokeMethod(self._cw_filter_bw_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._cw_filter_bw_options.index(i)))
        self._cw_filter_bw_callback(self.cw_filter_bw)
        self._cw_filter_bw_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_cw_filter_bw(self._cw_filter_bw_options[i]))
        self.top_grid_layout.addWidget(self._cw_filter_bw_tool_bar, 5,5,1,1)
        self.blocks_probe_signal_x_0 = blocks.probe_signal_f()
        def _variable_function_probe_0_probe():
            while True:
                val = self.blocks_probe_signal_x_0.level()
                try:
                    self.set_variable_function_probe_0(val)
                except AttributeError:
                    pass
                time.sleep(1.0 / (5))
        _variable_function_probe_0_thread = threading.Thread(target=_variable_function_probe_0_probe)
        _variable_function_probe_0_thread.daemon = True
        _variable_function_probe_0_thread.start()
        self.uhd_usrp_source_0 = uhd.usrp_source(
        	",".join(("", "addr=192.168.40.2")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        )
        self.uhd_usrp_source_0.set_subdev_spec("B:A", 0)
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(usrp_ask_freq, 0)
        self.uhd_usrp_source_0.set_gain(6, 0)
        self._rx_power_label_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._rx_power_label_formatter = None
        else:
          self._rx_power_label_formatter = lambda x: x
        
        self._rx_power_label_tool_bar.addWidget(Qt.QLabel("RX Power (dBm)"+": "))
        self._rx_power_label_label = Qt.QLabel(str(self._rx_power_label_formatter(self.rx_power_label)))
        self._rx_power_label_tool_bar.addWidget(self._rx_power_label_label)
        self.top_grid_layout.addWidget(self._rx_power_label_tool_bar, 4,7,1,1)
          
        _record_check_box_check_box = Qt.QCheckBox("Record")
        self._record_check_box_choices = {True: True, False: False}
        self._record_check_box_choices_inv = dict((v,k) for k,v in self._record_check_box_choices.iteritems())
        self._record_check_box_callback = lambda i: Qt.QMetaObject.invokeMethod(_record_check_box_check_box, "setChecked", Qt.Q_ARG("bool", self._record_check_box_choices_inv[i]))
        self._record_check_box_callback(self.record_check_box)
        _record_check_box_check_box.stateChanged.connect(lambda i: self.set_record_check_box(self._record_check_box_choices[bool(i)]))
        self.top_grid_layout.addWidget(_record_check_box_check_box, 6,5,1,1)
        self.rational_resampler_xxx_0 = filter.rational_resampler_fff(
                interpolation=48000,
                decimation=2500,
                taps=None,
                fractional_bw=None,
        )
        self.qtgui_waterfall_sink_x_0 = qtgui.waterfall_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	usrp_DDC_freq, #fc
        	samp_rate, #bw
        	"Band Waterfall", #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)
        
        if complex == type(float()):
          self.qtgui_waterfall_sink_x_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.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, -70)
        
        self._qtgui_waterfall_sink_x_0_win = sip.wrapinstance(self.qtgui_waterfall_sink_x_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_waterfall_sink_x_0_win, 4,0,3,5)
        self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c(
        	1024, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	lo_freq, #fc
        	samp_rate/100, #bw
        	str(samp_rate/100) + " Hz Channel Spectrum", #name
        	2 #number of inputs
        )
        self.qtgui_freq_sink_x_0_0.set_update_time(0.10)
        self.qtgui_freq_sink_x_0_0.set_y_axis(-120, -70)
        self.qtgui_freq_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "")
        self.qtgui_freq_sink_x_0_0.enable_autoscale(False)
        self.qtgui_freq_sink_x_0_0.enable_grid(True)
        self.qtgui_freq_sink_x_0_0.set_fft_average(1.0)
        
        if complex == type(float()):
          self.qtgui_freq_sink_x_0_0.set_plot_pos_half(not True)
        
        labels = ["", "", "", "", "",
                  "", "", "", "", ""]
        widths = [1, 1, 1, 1, 1,
                  1, 1, 1, 1, 1]
        colors = ["blue", "red", "green", "black", "cyan",
                  "magenta", "yellow", "dark red", "dark green", "dark blue"]
        alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
                  1.0, 1.0, 1.0, 1.0, 1.0]
        for i in xrange(2):
            if len(labels[i]) == 0:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
            else:
                self.qtgui_freq_sink_x_0_0.set_line_label(i, labels[i])
            self.qtgui_freq_sink_x_0_0.set_line_width(i, widths[i])
            self.qtgui_freq_sink_x_0_0.set_line_color(i, colors[i])
            self.qtgui_freq_sink_x_0_0.set_line_alpha(i, alphas[i])
        
        self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_0_win, 0,5,3,5)
        self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c(
        	4096, #size
        	firdes.WIN_BLACKMAN_hARRIS, #wintype
        	usrp_DDC_freq, #fc
        	samp_rate, #bw
        	"Band Spectrum", #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(-110, -60)
        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.2)
        
        if complex == type(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, 0,0,3,5)
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/100, 0.9*cw_filter_bw, 0.1*cw_filter_bw, firdes.WIN_BLACKMAN, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	10**(gain_offset_dB/20), samp_rate, 100E3, 20E3, firdes.WIN_HAMMING, 6.76))
        self._lo_freq_label_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._lo_freq_label_formatter = None
        else:
          self._lo_freq_label_formatter = lambda x: x
        
        self._lo_freq_label_tool_bar.addWidget(Qt.QLabel("LO Freq (Hz)"+": "))
        self._lo_freq_label_label = Qt.QLabel(str(self._lo_freq_label_formatter(self.lo_freq_label)))
        self._lo_freq_label_tool_bar.addWidget(self._lo_freq_label_label)
        self.top_grid_layout.addWidget(self._lo_freq_label_tool_bar, 4,6,1,1)
          
        self.hilbert_fc_0_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.hilbert_fc_0 = filter.hilbert_fc(65, firdes.WIN_HAMMING, 6.76)
        self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(10, (filter_taps), lo_freq - usrp_DDC_freq, samp_rate)
        self.fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(10, (filter_taps))
        self.fir_filter_xxx_0_0_0.declare_sample_delay(0)
        self._fine_tuner_freq_layout = Qt.QVBoxLayout()
        self._fine_tuner_freq_tool_bar = Qt.QToolBar(self)
        self._fine_tuner_freq_layout.addWidget(self._fine_tuner_freq_tool_bar)
        self._fine_tuner_freq_tool_bar.addWidget(Qt.QLabel("Fine Tuner (Hz)"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._fine_tuner_freq_counter = qwt_counter_pyslot()
        self._fine_tuner_freq_counter.setRange(-500, 500, 1)
        self._fine_tuner_freq_counter.setNumButtons(2)
        self._fine_tuner_freq_counter.setValue(self.fine_tuner_freq)
        self._fine_tuner_freq_tool_bar.addWidget(self._fine_tuner_freq_counter)
        self._fine_tuner_freq_counter.valueChanged.connect(self.set_fine_tuner_freq)
        self._fine_tuner_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._fine_tuner_freq_slider.setRange(-500, 500, 1)
        self._fine_tuner_freq_slider.setValue(self.fine_tuner_freq)
        self._fine_tuner_freq_slider.setMinimumWidth(200)
        self._fine_tuner_freq_slider.valueChanged.connect(self.set_fine_tuner_freq)
        self._fine_tuner_freq_layout.addWidget(self._fine_tuner_freq_slider)
        self.top_grid_layout.addLayout(self._fine_tuner_freq_layout, 3,5,1,5)
        self._filename_label_tool_bar = Qt.QToolBar(self)
        
        if None:
          self._filename_label_formatter = None
        else:
          self._filename_label_formatter = lambda x: x
        
        self._filename_label_tool_bar.addWidget(Qt.QLabel("File Name"+": "))
        self._filename_label_label = Qt.QLabel(str(self._filename_label_formatter(self.filename_label)))
        self._filename_label_tool_bar.addWidget(self._filename_label_label)
        self.top_grid_layout.addWidget(self._filename_label_tool_bar, 6,6,1,3)
          
        self._coarse_tuner_freq_layout = Qt.QVBoxLayout()
        self._coarse_tuner_freq_tool_bar = Qt.QToolBar(self)
        self._coarse_tuner_freq_layout.addWidget(self._coarse_tuner_freq_tool_bar)
        self._coarse_tuner_freq_tool_bar.addWidget(Qt.QLabel("Coarse Tuner (Hz)"+": "))
        class qwt_counter_pyslot(Qwt.QwtCounter):
            def __init__(self, parent=None):
                Qwt.QwtCounter.__init__(self, parent)
            @pyqtSlot('double')
            def setValue(self, value):
                super(Qwt.QwtCounter, self).setValue(value)
        self._coarse_tuner_freq_counter = qwt_counter_pyslot()
        self._coarse_tuner_freq_counter.setRange(-samp_rate/2, samp_rate/2, 100)
        self._coarse_tuner_freq_counter.setNumButtons(2)
        self._coarse_tuner_freq_counter.setValue(self.coarse_tuner_freq)
        self._coarse_tuner_freq_tool_bar.addWidget(self._coarse_tuner_freq_counter)
        self._coarse_tuner_freq_counter.valueChanged.connect(self.set_coarse_tuner_freq)
        self._coarse_tuner_freq_slider = Qwt.QwtSlider(None, Qt.Qt.Horizontal, Qwt.QwtSlider.BottomScale, Qwt.QwtSlider.BgSlot)
        self._coarse_tuner_freq_slider.setRange(-samp_rate/2, samp_rate/2, 100)
        self._coarse_tuner_freq_slider.setValue(self.coarse_tuner_freq)
        self._coarse_tuner_freq_slider.setMinimumWidth(50)
        self._coarse_tuner_freq_slider.valueChanged.connect(self.set_coarse_tuner_freq)
        self._coarse_tuner_freq_layout.addWidget(self._coarse_tuner_freq_slider)
        self.top_grid_layout.addLayout(self._coarse_tuner_freq_layout, 3,0,1,5)
        self.blocks_null_sink_1_0_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_null_sink_1_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_nlog10_ff_0 = blocks.nlog10_ff(10, 1, RX_power_offset_dB)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_integrate_xx_0 = blocks.integrate_ff(500)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, file_name, False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.blocks_complex_to_mag_squared_0 = blocks.complex_to_mag_squared(1)
        self.blocks_complex_to_float_1_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0_0 = blocks.complex_to_float(1)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_add_xx_0 = blocks.add_vff(1)
        self._band_freq_options = [1.84E6, 3.598E6, 7.055E6, 2.5E6, 5.0E6, 10.0E6]
        self._band_freq_labels = ["160m", "80m", "40m", "2.5 MHz", "5 MHz", "10 MHz"]
        self._band_freq_tool_bar = Qt.QToolBar(self)
        self._band_freq_tool_bar.addWidget(Qt.QLabel("Band"+": "))
        self._band_freq_combo_box = Qt.QComboBox()
        self._band_freq_tool_bar.addWidget(self._band_freq_combo_box)
        for label in self._band_freq_labels: self._band_freq_combo_box.addItem(label)
        self._band_freq_callback = lambda i: Qt.QMetaObject.invokeMethod(self._band_freq_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._band_freq_options.index(i)))
        self._band_freq_callback(self.band_freq)
        self._band_freq_combo_box.currentIndexChanged.connect(
        	lambda i: self.set_band_freq(self._band_freq_options[i]))
        self.top_grid_layout.addWidget(self._band_freq_tool_bar, 4,5,1,1)
        self.audio_sink_0 = audio.sink(48000, "", True)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate/100, analog.GR_COS_WAVE, 600, 1, 0)
        self.analog_agc3_xx_0 = analog.agc3_cc(1e-1, 1e-4, volume/100, 1, 1)
        self.analog_agc3_xx_0.set_max_gain(2**16)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.fir_filter_xxx_0_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.fir_filter_xxx_0_0_0, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_freq_sink_x_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
        self.connect((self.fir_filter_xxx_0_0_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.low_pass_filter_0_0, 0), (self.blocks_complex_to_mag_squared_0, 0))
        self.connect((self.blocks_complex_to_mag_squared_0, 0), (self.blocks_integrate_xx_0, 0))
        self.connect((self.blocks_integrate_xx_0, 0), (self.blocks_nlog10_ff_0, 0))
        self.connect((self.blocks_nlog10_ff_0, 0), (self.blocks_probe_signal_x_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.qtgui_waterfall_sink_x_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.analog_agc3_xx_0, 0))
        self.connect((self.analog_agc3_xx_0, 0), (self.blocks_complex_to_float_1_0, 0))
        self.connect((self.fir_filter_xxx_0_0_0, 0), (self.qtgui_freq_sink_x_0_0, 0))
        self.connect((self.blocks_add_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_add_xx_0, 1))
        self.connect((self.blocks_complex_to_float_0_0, 1), (self.blocks_add_xx_0, 0))
        self.connect((self.blocks_complex_to_float_0_0, 0), (self.blocks_null_sink_1_0_0, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_null_sink_1_0, 0))
        self.connect((self.blocks_complex_to_float_1_0, 1), (self.hilbert_fc_0, 0))
        self.connect((self.hilbert_fc_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.blocks_complex_to_float_1_0, 0), (self.hilbert_fc_0_0, 0))
        self.connect((self.hilbert_fc_0_0, 0), (self.blocks_complex_to_float_0_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.qtgui_freq_sink_x_0_0, 1))
Exemplo n.º 58
0
    def __init__(self, sym_rate=256, samp_per_sym=256, nominal_uplink_freq=2041.95e6*0 + 2041.9479e6 + 1e6*0, lo_off=5e6 * 0, tx_gain=15*0 + 13.5*0, backoff=0.150*0 + (0.6+0.1)*0 + 1e-3, record_path='/media/balint/PATRIOT/ICE/TX/'):
        grc_wxgui.top_block_gui.__init__(self, title="Uplink")

        ##################################################
        # Parameters
        ##################################################
        self.sym_rate = sym_rate
        self.samp_per_sym = samp_per_sym
        self.nominal_uplink_freq = nominal_uplink_freq
        self.lo_off = lo_off
        self.tx_gain = tx_gain
        self.backoff = backoff
        self.record_path = record_path

        ##################################################
        # Variables
        ##################################################
        self.time_format = time_format = "%Y-%d-%m_%H-%M-%S"
        self.time_now = time_now = time.strftime(time_format)
        self.samp_rate = samp_rate = 250000
        self.pre_resamp_rate = pre_resamp_rate = sym_rate * samp_per_sym
        self.f1 = f1 = 9000.0
        self.f0 = f0 = 7500.0
        self.resamp_rate = resamp_rate = float(samp_rate)/float(pre_resamp_rate)
        self.pm = pm = 1.2*0 + 1.0
        self.nominal_uplink_freq_chooser = nominal_uplink_freq_chooser = nominal_uplink_freq
        self.manual_doppler = manual_doppler = 0
        self.file_name = file_name = time_now + ".mcfile"
        self.doppler = doppler = 0
        self.deviation = deviation = (f1 - f0) / 2.0
        self.tx_gain_user = tx_gain_user = tx_gain
        self.subcarrier_freq = subcarrier_freq = f0 + deviation
        self.source = source = 'external'
        self.pm_txt = pm_txt = pm
        self.nominal_uplink_freq_user = nominal_uplink_freq_user = nominal_uplink_freq_chooser
        self.lo_off_user = lo_off_user = lo_off
        self.length_mul = length_mul = float(samp_per_sym) * resamp_rate
        self.invert = invert = 1
        self.final_record_path = final_record_path = os.path.join(record_path, file_name)
        self.final_doppler = final_doppler = doppler + manual_doppler
        self.backoff_user = backoff_user = backoff

        ##################################################
        # Blocks
        ##################################################
        _tx_gain_user_sizer = wx.BoxSizer(wx.VERTICAL)
        self._tx_gain_user_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_tx_gain_user_sizer,
        	value=self.tx_gain_user,
        	callback=self.set_tx_gain_user,
        	label="TX Gain",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._tx_gain_user_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_tx_gain_user_sizer,
        	value=self.tx_gain_user,
        	callback=self.set_tx_gain_user,
        	minimum=0,
        	maximum=32,
        	num_steps=32,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_tx_gain_user_sizer)
        self._nominal_uplink_freq_user_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.nominal_uplink_freq_user,
        	callback=self.set_nominal_uplink_freq_user,
        	label="Nominal Uplink Freq",
        	converter=forms.float_converter(),
        )
        self.Add(self._nominal_uplink_freq_user_text_box)
        self.nb = self.nb = wx.Notebook(self.GetWin(), style=wx.NB_TOP)
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Output FFT")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Input FFT")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Input Phase/Mag")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "Mod Clk/Data")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "PM Output Scope")
        self.nb.AddPage(grc_wxgui.Panel(self.nb), "PM Input")
        self.Add(self.nb)
        self._lo_off_user_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.lo_off_user,
        	callback=self.set_lo_off_user,
        	label="LO Offset",
        	converter=forms.float_converter(),
        )
        self.Add(self._lo_off_user_text_box)
        self._final_doppler_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.final_doppler,
        	callback=self.set_final_doppler,
        	label="Final Doppler",
        	converter=forms.float_converter(),
        )
        self.Add(self._final_doppler_static_text)
        self._doppler_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.doppler,
        	callback=self.set_doppler,
        	label="Doppler Shift",
        	converter=forms.float_converter(),
        )
        self.Add(self._doppler_text_box)
        _backoff_user_sizer = wx.BoxSizer(wx.VERTICAL)
        self._backoff_user_text_box = forms.text_box(
        	parent=self.GetWin(),
        	sizer=_backoff_user_sizer,
        	value=self.backoff_user,
        	callback=self.set_backoff_user,
        	label="Backoff",
        	converter=forms.float_converter(),
        	proportion=0,
        )
        self._backoff_user_slider = forms.slider(
        	parent=self.GetWin(),
        	sizer=_backoff_user_sizer,
        	value=self.backoff_user,
        	callback=self.set_backoff_user,
        	minimum=0,
        	maximum=1,
        	num_steps=100,
        	style=wx.SL_HORIZONTAL,
        	cast=float,
        	proportion=1,
        )
        self.Add(_backoff_user_sizer)
        self.xmlrpc_server_0 = SimpleXMLRPCServer.SimpleXMLRPCServer(("", 52003), allow_none=True)
        self.xmlrpc_server_0.register_instance(self)
        threading.Thread(target=self.xmlrpc_server_0.serve_forever).start()
        self.wxgui_scopesink2_2 = scopesink2.scope_sink_f(
        	self.nb.GetPage(5).GetWin(),
        	title="Scope Plot",
        	sample_rate=pre_resamp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(5).Add(self.wxgui_scopesink2_2.win)
        self.wxgui_scopesink2_1 = scopesink2.scope_sink_c(
        	self.nb.GetPage(4).GetWin(),
        	title="Scope Plot",
        	sample_rate=samp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(4).Add(self.wxgui_scopesink2_1.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.nb.GetPage(0).GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=256,
        	fft_rate=10,
        	average=False,
        	avg_alpha=None,
        	title="FFT Plot",
        	peak_hold=False,	fft_in=False,
        	always_run=False,
        	fft_out=False,
        )
        self.nb.GetPage(0).Add(self.wxgui_fftsink2_0.win)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
        	",".join(("serial=F4A7C3", "")),
        	uhd.stream_args(
        		cpu_format="fc32",
        		channels=range(1),
        	),
        	"",
        	True,
        )
        self.uhd_usrp_sink_0.set_clock_source(source, 0)
        self.uhd_usrp_sink_0.set_time_source(source, 0)
        self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_0.set_center_freq(uhd.tune_request(nominal_uplink_freq_user,lo_off_user), 0)
        self.uhd_usrp_sink_0.set_gain(tx_gain*0 + tx_gain_user, 0)
        self.uhd_usrp_sink_0.set_antenna('TX/RX', 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=int(samp_rate),
                decimation=int(pre_resamp_rate),
                taps=None,
                fractional_bw=None,
        )
        self._pm_txt_static_text = forms.static_text(
        	parent=self.GetWin(),
        	value=self.pm_txt,
        	callback=self.set_pm_txt,
        	label="Phase Moduation Index",
        	converter=forms.float_converter(),
        )
        self.Add(self._pm_txt_static_text)
        self._nominal_uplink_freq_chooser_chooser = forms.drop_down(
        	parent=self.GetWin(),
        	value=self.nominal_uplink_freq_chooser,
        	callback=self.set_nominal_uplink_freq_chooser,
        	label="Nomial Uplink Frequency",
        	choices=[2041.9479e6, 2090.66e6],
        	labels=['B: 2041.9479', 'A: 2090.66'],
        )
        self.Add(self._nominal_uplink_freq_chooser_chooser)
        self._manual_doppler_text_box = forms.text_box(
        	parent=self.GetWin(),
        	value=self.manual_doppler,
        	callback=self.set_manual_doppler,
        	label="Manual Doppler",
        	converter=forms.float_converter(),
        )
        self.Add(self._manual_doppler_text_box)
        self.mac_burst_tagger_0 = mac.burst_tagger('packet_len', length_mul, 256, 32*0 + 256, True, False)
        self.clock_and_data = scopesink2.scope_sink_c(
        	self.nb.GetPage(3).GetWin(),
        	title="Scope Plot",
        	sample_rate=pre_resamp_rate,
        	v_scale=0,
        	v_offset=0,
        	t_scale=0,
        	ac_couple=False,
        	xy_mode=False,
        	num_inputs=1,
        	trig_mode=wxgui.TRIG_MODE_AUTO,
        	y_axis_label="Counts",
        )
        self.nb.GetPage(3).Add(self.clock_and_data.win)
        self.carrier = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, doppler*0 + final_doppler, 0*backoff + backoff_user, 0)
        self.blocks_vector_source_x_0 = blocks.vector_source_f(tuple([1] * (samp_per_sym/4) +  [0] * (samp_per_sym/4) +  [0] * (samp_per_sym/4) +  [1] * (samp_per_sym/4)), True, 1, [])
        self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", "52002", 10000, False)
        self.blocks_repeat_0 = blocks.repeat(gr.sizeof_float*1, samp_per_sym)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len", 1)
        self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_float*1)
        self.blocks_multiply_xx_1 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_const_vxx_1_0 = blocks.multiply_const_vff((2.0/3, ))
        self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vff((2, ))
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((invert, ))
        self.blocks_message_strobe_0_0 = blocks.message_strobe(pmt.cons(pmt.to_pmt({'ignore': True}), pmt.init_u8vector(1, 1*[0])), 0)
        self.blocks_float_to_complex_2 = blocks.float_to_complex(1)
        self.blocks_float_to_complex_1 = blocks.float_to_complex(1)
        self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_gr_complex*1, final_record_path, samp_rate, 1, blocks.GR_FILE_FLOAT, True, 1000000, "", True)
        self.blocks_file_meta_sink_0.set_unbuffered(False)
        self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
        self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
        self.blocks_add_const_vxx_1_0 = blocks.add_const_vff((1.0/3, ))
        self.blocks_add_const_vxx_1 = blocks.add_const_vff((-1, ))
        self.binary_to_pdu0 = isee3.binary_to_pdu()
        self.analog_sig_source_x_0 = analog.sig_source_c(pre_resamp_rate, analog.GR_COS_WAVE, subcarrier_freq, 1/1.333, 0)
        self.analog_phase_modulator_fc_1 = analog.phase_modulator_fc(pm / (2.0*0 + 1))
        self.analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(float(deviation) / float(pre_resamp_rate) * math.pi*2.0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_char_to_float_0, 0))
        self.connect((self.blocks_char_to_float_0, 0), (self.blocks_multiply_const_vxx_1, 0))
        self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_add_const_vxx_1, 0))
        self.connect((self.blocks_add_const_vxx_1, 0), (self.blocks_repeat_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_complex_to_float_0, 0))
        self.connect((self.analog_frequency_modulator_fc_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_1_0, 0), (self.blocks_add_const_vxx_1_0, 0))
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_multiply_const_vxx_1_0, 0))
        self.connect((self.blocks_add_const_vxx_1_0, 0), (self.blocks_float_to_complex_2, 0))
        self.connect((self.blocks_float_to_complex_1, 0), (self.clock_and_data, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.carrier, 0), (self.blocks_multiply_xx_1, 1))
        self.connect((self.blocks_add_const_vxx_1_0, 0), (self.blocks_float_to_complex_1, 1))
        self.connect((self.blocks_repeat_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.analog_frequency_modulator_fc_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.analog_phase_modulator_fc_1, 0))
        self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_null_sink_0, 0))
        self.connect((self.blocks_complex_to_float_0, 0), (self.wxgui_scopesink2_2, 0))
        self.connect((self.blocks_add_const_vxx_1_0, 0), (self.blocks_float_to_complex_2, 1))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_float_to_complex_1, 0))
        self.connect((self.blocks_float_to_complex_2, 0), (self.blocks_multiply_xx_0, 2))
        self.connect((self.mac_burst_tagger_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.mac_burst_tagger_0, 0))
        self.connect((self.blocks_multiply_xx_1, 0), (self.wxgui_scopesink2_1, 0))
        self.connect((self.analog_phase_modulator_fc_1, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_multiply_xx_1, 0))
        self.connect((self.mac_burst_tagger_0, 0), (self.blocks_file_meta_sink_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.binary_to_pdu0, "pdu_out", self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.msg_connect(self.blocks_socket_pdu_0, "pdus", self.binary_to_pdu0, "binary_in")
        self.msg_connect(self.blocks_message_strobe_0_0, "strobe", self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.msg_connect(self.uhd_usrp_sink_0, "ctl", self.blocks_message_strobe_0_0, "trigger")