コード例 #1
0
    def test_add_vcc_five(self):
	src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
	src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
	src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
	expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j)
	op = gr.add_vcc(5)
	self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
コード例 #2
0
    def test_add_vcc_one(self):
	src1_data = (1.0+2.0j,)
	src2_data = (3.0+4.0j,)
	src3_data = (5.0+6.0j,)
	expected_result = (9.0+12j,)
	op = gr.add_vcc(1)
	self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
コード例 #3
0
   def __init__(self, dBm, pfa, pfd, nTrials):
      gr.top_block.__init__(self)

      # Constants
      samp_rate = 2.4e6
      fft_size = 4096
      samples_per_band = 16
      tcme = 1.9528
      output_pfa = True
      debug_stats = False
      histogram = False
      primary_user_location = 0
      useless_bw = 200000.0
      src_data = [0+0j]*fft_size*nTrials
      voltage = self.powerToAmplitude(dBm);

		# Blocks
      src = gr.vector_source_c(src_data)
      noise = gr.noise_source_c(gr.GR_GAUSSIAN, voltage, 42)
      add = gr.add_vcc()
      s2v = gr.stream_to_vector(gr.sizeof_gr_complex, fft_size)
      fftb = fft.fft_vcc(fft_size, True, (window.blackmanharris(1024)), False, 1)
      ss = howto.spectrum_sensing_cf(samp_rate,fft_size,samples_per_band,pfd,pfa,tcme,output_pfa,debug_stats,primary_user_location,useless_bw,histogram)
      self.sink = gr.vector_sink_f()

		# Connections
      self.connect(src, add, s2v, fftb, ss, self.sink)
      self.connect(noise, (add, 1))
コード例 #4
0
 def test_add_vcc_one(self):
     src1_data = (1.0 + 2.0j, )
     src2_data = (3.0 + 4.0j, )
     src3_data = (5.0 + 6.0j, )
     expected_result = (9.0 + 12j, )
     op = gr.add_vcc(1)
     self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
コード例 #5
0
ファイル: awgn_gen.py プロジェクト: no-net/gr-winelo
    def __init__(self, noise_ampl=0):
        """
            Parameters:

                noise_ampl: float
        """
        gr.hier_block2.__init__(
            self, "Additive White Gaussian Noise Generator",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
        )

        ##################################################
        # Parameters
        ##################################################
        self.noise_ampl = noise_ampl

        ##################################################
        # Blocks
        ##################################################
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN,
                                                     noise_ampl, 42)
        self.gr_add_xx_0 = gr.add_vcc(1)

        ##################################################
        # Connections
        ##################################################
        self.connect((self, 0), (self.gr_add_xx_0, 0))
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self, 0))
コード例 #6
0
 def test_add_vcc_five(self):
     src1_data = (1.0 + 2.0j, 3.0 + 4.0j, 5.0 + 6.0j, 7.0 + 8.0j,
                  9.0 + 10.0j)
     src2_data = (11.0 + 12.0j, 13.0 + 14.0j, 15.0 + 16.0j, 17.0 + 18.0j,
                  19.0 + 20.0j)
     src3_data = (21.0 + 22.0j, 23.0 + 24.0j, 25.0 + 26.0j, 27.0 + 28.0j,
                  29.0 + 30.0j)
     expected_result = (33.0 + 36.0j, 39.0 + 42.0j, 45.0 + 48.0j,
                        51.0 + 54.0j, 57.0 + 60.0j)
     op = gr.add_vcc(5)
     self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
コード例 #7
0
    def __init__(self, seed,fD,chan_pwrs,path_delays,flag_indep=False,flag_norm=True,flag_fadeEnable=False):
        gr.hier_block2.__init__(self,
            "multipath_rayleigh_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex*1)) # Output signature

        ##################################################
        # Parameters
        ##################################################
        self.fD = fD #Doppler Bandwidth = fd*(1.0/chan_rate)
        self.chan_pwrs = chan_pwrs
        self.path_delays_samples = path_delays
        self.chan_seed = seed
        self.mode = flag_fadeEnable #Enables fading for underlaying single path fading block

        # Checks that there is the same number of delays as there are powers.
        if len(self.chan_pwrs) != len(self.path_delays_us):
            raise ValueError, "The vector length of chan_pwrs does not match the vector length of path_delays."
            # Could this be improved?
            sys.exit(1)

        self.c2f_blks = []      # for list of gr.complex_to_float().
        self.delay_blks = []    # for list of gr.filter_delay_fc ().
        self.chan_blks = []     # for list of tait.flat_rayleigh_channel_cc().

        # Normalizes the channel powers if required
        if flag_norm is True:
            self.chan_pwrs = 1.0*np.array(chan_pwrs)/np.sqrt((chan_pwrs ** 2).sum(-1))

        # Populate the lists above with the correct number of blocks.
        for i in range (len(self.path_delays_samples)):
            print "create delay block %d" %(i)
            
            # Delay block is required.
            self.delay_blks.append(gr.delay(gr.sizeof_gr_complex*1, int(self.path_delays_samples[i])))
                
            self.chan_blks.append(rccBlocks.rayleighChan_cc(chan_seed + i, self.fD, self.chan_pwrs[i], flag_indep,self.mode))

        self.sum = gr.add_vcc(1)  

        # Create multiple instances of the "src -> delay -> channel" connection.
        for i in range (len(self.chan_blks)):
            print i
            self.connect( (self,0), (self.chan_blks[i],0) )
            self.connect( (self.chan_blks[i],0), (self.delay_blks[i],0) )
            self.connect( (self.delay_blks[i],0), (self.sum, i) )
        #self.connect( (self,0), (self.chan_blks[0],0) )
        #self.connect( (self.chan_blks[0],0), (self.delay_blks[0],0) )
        #self.connect( (self.delay_blks[0],0), (self, 0) )  
        self.connect((self.sum, 0), (self,0) )         
コード例 #8
0
ファイル: top_block.py プロジェクト: Exadios/PWR
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Top Block")
		_icon_path = "/home/pfb/.local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

		##################################################
		# Blocks
		##################################################
		self.M_Sequence = gr.vector_source_f((-1,  -1,   1,   1,  -1,   1,   1,   1,   1,  -1,   1,   1,   1,  -1,   1,  -1,  -1,  -1,  -1,  -1, -1,  -1,   1,  -1,   1,  -1,   1,   1,  -1,  -1,  -1,   1,   1,  -1,  -1,   1,   1,   1,  -1,  -1,  -1,  -1,  -1,  -1,   1,   1,   1,   1,   1,  -1,   1,  -1,  -1,   1,  -1,   1,  -1,   1,  -1,  -1,  1,  -1,  -1,  -1,  -1,  -1,   1,  -1,  -1,  -1,  -1,   1,   1,   1,  -1,   1,   1,   1,   1,   1,  1,  -1,   1,   1,  -1,  -1,  -1,  -1,   1,   1,  -1,  -1,  -1,   1,  -1,  -1,   1,   1,  -1,  -1,  -1,  -1,  -1,   1,   1,  -1,   1,  -1,  -1,  -1,   1,  -1,   1,  -1,  -1,   1,   1,  -1,   1,  -1,  1,  -1,  -1,  -1,  -1,   1,  -1,   1,   1,   1,  -1,  -1,   1,   1,   1,   1,  -1,   1,  -1,   1,  1,   1,   1,   1,  -1,  -1,  -1,   1,   1,   1,  -1,  -1,   1,  -1,   1,  -1,  -1,  -1,   1,   1,  1,   1,  -1,  -1,  -1,  -1,   1,  -1,  -1,   1,  -1,  -1,   1,  -1,   1,   1,   1,   1,  -1,  -1,  1,  -1,  -1,  -1,   1,  -1,  -1,  -1,   1,   1,  -1,   1,   1,  -1,   1,   1,   1,  -1,  -1,  -1,  1,  -1,   1,   1,  -1,  -1,   1,   1,  -1,  -1,   1,  -1,   1,   1,  -1,   1,   1,  -1,  -1,   1,  -1,  -1,   1,   1,   1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,   1,   1,  -1,   1,   1,  -1,   1,  -1,   1,   1,  -1,   1,  -1,  -1,   1,   1,   1,   1,   1,   1,   1,   1), True, 1)
		self.M_Sequence_Baseband_Modulator = blks2.dbpsk_mod(
			samples_per_symbol=2,
			excess_bw=0.35,
			gray_code=False,
			verbose=False,
			log=False,
		)
		self.blks2_dxpsk_mod_0 = blks2.dbpsk_mod(
			samples_per_symbol=2,
			excess_bw=0.35,
			gray_code=True,
			verbose=False,
			log=False,
		)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.gr_delay_0 = gr.delay(gr.sizeof_char*1, 16)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1, "../M_Sequence_Baseband.cmplx")
		self.gr_float_to_char_0 = gr.float_to_char()
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((0, ))
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.gr_delay_0, 0), (self.blks2_dxpsk_mod_0, 0))
		self.connect((self.blks2_dxpsk_mod_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.M_Sequence_Baseband_Modulator, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.M_Sequence, 0), (self.gr_float_to_char_0, 0))
		self.connect((self.gr_float_to_char_0, 0), (self.M_Sequence_Baseband_Modulator, 0))
		self.connect((self.gr_float_to_char_0, 0), (self.gr_delay_0, 0))
コード例 #9
0
 def __init__(self, EbN0):
     gr.top_block.__init__(self)
     self.const = digital.qpsk_constellation()
     # Source is N_BITS bits, non-repeated
     data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol()))
     src   = gr.vector_source_b(data, False)
     mod   = gr.chunks_to_symbols_bc((self.const.points()), 1)
     add   = gr.add_vcc()
     noise = gr.noise_source_c(gr.GR_GAUSSIAN,
                               self.EbN0_to_noise_voltage(EbN0),
                               RAND_SEED)
     demod = digital.constellation_decoder_cb(self.const.base())
     ber   = BitErrors(self.const.bits_per_symbol())
     self.sink  = gr.vector_sink_f()
     self.connect(src, mod, add, demod, ber, self.sink)
     self.connect(noise, (add, 1))
     self.connect(src, (ber, 1))
コード例 #10
0
 def __init__(self, EbN0):
     gr.top_block.__init__(self)
     self.const = digital.qpsk_constellation()
     # Source is N_BITS bits, non-repeated
     data = map(
         int,
         numpy.random.randint(0, self.const.arity(),
                              N_BITS / self.const.bits_per_symbol()))
     src = gr.vector_source_b(data, False)
     mod = gr.chunks_to_symbols_bc((self.const.points()), 1)
     add = gr.add_vcc()
     noise = gr.noise_source_c(gr.GR_GAUSSIAN,
                               self.EbN0_to_noise_voltage(EbN0), RAND_SEED)
     demod = digital.constellation_decoder_cb(self.const.base())
     ber = BitErrors(self.const.bits_per_symbol())
     self.sink = gr.vector_sink_f()
     self.connect(src, mod, add, demod, ber, self.sink)
     self.connect(noise, (add, 1))
     self.connect(src, (ber, 1))
コード例 #11
0
  def __init__( self, snr_db, sigpow = 1.0, vlen = 1 ):
    gr.hier_block2.__init__( self,
          "awgn_channel",
          gr.io_signature( 1, 1, gr.sizeof_gr_complex * vlen ),
          gr.io_signature( 1, 1, gr.sizeof_gr_complex * vlen ) )

    snr = 10.0**(snr_db/10.0)
    noise_pow = float(sigpow) / snr

    noise_src = ofdm.complex_white_noise( 0.0, sqrt( noise_pow ) )
    if vlen > 1:
      channel = gr.add_vcc( vlen )
    else:
      channel = gr.add_cc()

    self.connect( self, channel, self )

    if vlen > 1:
      self.connect( noise_src, gr.stream_to_vector( gr.sizeof_gr_complex, vlen),
                    ( channel, 1) )
    else:
      self.connect( noise_src, ( channel, 1 ) )
コード例 #12
0
    def __init__(self):
        gr.top_block.__init__(self, "Simple QAM Simulation")
        Qt.QWidget.__init__(self)
        self.setWindowTitle("Simple QAM Simulation")
        self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
        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)

        ##################################################
        # Variables
        ##################################################
        self.constellation_cardinality = constellation_cardinality = 16
        self.const_object = const_object = constellations()['qam'](
            constellation_cardinality)
        self.snr_db = snr_db = 20
        self.constellation = constellation = const_object.points()
        self.sps = sps = 8
        self.samp_rate = samp_rate = 250000
        self.noise_amp = noise_amp = sqrt((10**(-snr_db / 10.)) / 2.)
        self.constellation_power = constellation_power = sqrt(
            sum([abs(i)**2
                 for i in constellation]) / constellation_cardinality)

        ##################################################
        # Blocks
        ##################################################
        self.tabid_0 = Qt.QTabWidget()
        self.tabid_0_widget_0 = Qt.QWidget()
        self.tabid_0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_0_widget_0)
        self.tabid_0_grid_layout_0 = Qt.QGridLayout()
        self.tabid_0_layout_0.addLayout(self.tabid_0_grid_layout_0)
        self.tabid_0.addTab(self.tabid_0_widget_0, "TX")
        self.tabid_0_widget_1 = Qt.QWidget()
        self.tabid_0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_0_widget_1)
        self.tabid_0_grid_layout_1 = Qt.QGridLayout()
        self.tabid_0_layout_1.addLayout(self.tabid_0_grid_layout_1)
        self.tabid_0.addTab(self.tabid_0_widget_1, "CHANNEL")
        self.tabid_0_widget_2 = Qt.QWidget()
        self.tabid_0_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_0_widget_2)
        self.tabid_0_grid_layout_2 = Qt.QGridLayout()
        self.tabid_0_layout_2.addLayout(self.tabid_0_grid_layout_2)
        self.tabid_0.addTab(self.tabid_0_widget_2, "RX")
        self.top_grid_layout.addWidget(self.tabid_0, 30, 0, 10, 100)
        self.tabid_2 = Qt.QTabWidget()
        self.tabid_2_widget_0 = Qt.QWidget()
        self.tabid_2_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_2_widget_0)
        self.tabid_2_grid_layout_0 = Qt.QGridLayout()
        self.tabid_2_layout_0.addLayout(self.tabid_2_grid_layout_0)
        self.tabid_2.addTab(self.tabid_2_widget_0, "symbol-based")
        self.tabid_2_widget_1 = Qt.QWidget()
        self.tabid_2_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_2_widget_1)
        self.tabid_2_grid_layout_1 = Qt.QGridLayout()
        self.tabid_2_layout_1.addLayout(self.tabid_2_grid_layout_1)
        self.tabid_2.addTab(self.tabid_2_widget_1, "bit-based")
        self.tabid_2_widget_2 = Qt.QWidget()
        self.tabid_2_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_2_widget_2)
        self.tabid_2_grid_layout_2 = Qt.QGridLayout()
        self.tabid_2_layout_2.addLayout(self.tabid_2_grid_layout_2)
        self.tabid_2.addTab(self.tabid_2_widget_2, "BER")
        self.tabid_0_layout_2.addWidget(self.tabid_2)
        self.tabid_1 = Qt.QTabWidget()
        self.tabid_1_widget_0 = Qt.QWidget()
        self.tabid_1_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_1_widget_0)
        self.tabid_1_grid_layout_0 = Qt.QGridLayout()
        self.tabid_1_layout_0.addLayout(self.tabid_1_grid_layout_0)
        self.tabid_1.addTab(self.tabid_1_widget_0, "bit-based")
        self.tabid_1_widget_1 = Qt.QWidget()
        self.tabid_1_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_1_widget_1)
        self.tabid_1_grid_layout_1 = Qt.QGridLayout()
        self.tabid_1_layout_1.addLayout(self.tabid_1_grid_layout_1)
        self.tabid_1.addTab(self.tabid_1_widget_1, "scrambled")
        self.tabid_1_widget_2 = Qt.QWidget()
        self.tabid_1_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom,
                                              self.tabid_1_widget_2)
        self.tabid_1_grid_layout_2 = Qt.QGridLayout()
        self.tabid_1_layout_2.addLayout(self.tabid_1_grid_layout_2)
        self.tabid_1.addTab(self.tabid_1_widget_2, "symbol-based")
        self.tabid_0_grid_layout_0.addWidget(self.tabid_1, 0, 0, 10, 10)
        self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
            1024,  #size
            samp_rate,  #bw
            "QT GUI Plot",  #name
            1  #number of inputs
        )
        self._qtgui_time_sink_x_0_win = sip.wrapinstance(
            self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
        self.tabid_2_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
        self.qtgui_sink_x_0_1_0_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            False,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self._qtgui_sink_x_0_1_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_0_0.pyqwidget(), Qt.QWidget)
        self.tabid_1_layout_0.addWidget(self._qtgui_sink_x_0_1_0_0_win)
        self.qtgui_sink_x_0_1_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self._qtgui_sink_x_0_1_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1_0.pyqwidget(), Qt.QWidget)
        self.tabid_1_layout_1.addWidget(self._qtgui_sink_x_0_1_0_win)
        self.qtgui_sink_x_0_1 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            False,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self._qtgui_sink_x_0_1_win = sip.wrapinstance(
            self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)
        self.tabid_1_layout_2.addWidget(self._qtgui_sink_x_0_1_win)
        self.qtgui_sink_x_0_0_0_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self._qtgui_sink_x_0_0_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
        self.tabid_2_layout_0.addWidget(self._qtgui_sink_x_0_0_0_0_win)
        self.qtgui_sink_x_0_0_0 = qtgui.sink_f(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            False,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            True,  #plotconst
        )
        self._qtgui_sink_x_0_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
        self.tabid_2_layout_1.addWidget(self._qtgui_sink_x_0_0_0_win)
        self.qtgui_sink_x_0_0 = qtgui.sink_c(
            1024,  #fftsize
            firdes.WIN_BLACKMAN_hARRIS,  #wintype
            0,  #fc
            samp_rate,  #bw
            "QT GUI Plot",  #name
            True,  #plotfreq
            False,  #plotwaterfall
            True,  #plottime
            False,  #plotconst
        )
        self._qtgui_sink_x_0_0_win = sip.wrapinstance(
            self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget)
        self.tabid_0_layout_1.addWidget(self._qtgui_sink_x_0_0_win)
        self.gr_vector_source_x_0_0 = gr.vector_source_b(([1, 0]), True, 1)
        self.gr_vector_source_x_0 = gr.vector_source_b(([1, 0]), True, 1)
        self.gr_unpack_k_bits_bb_0 = gr.unpack_k_bits_bb(
            int(log2(constellation_cardinality)))
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_pack_k_bits_bb_0 = gr.pack_k_bits_bb(
            int(log2(constellation_cardinality)))
        self.gr_null_sink_0 = gr.null_sink(gr.sizeof_char * 1)
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise_amp,
                                                     0)
        self.gr_nlog10_ff_0 = gr.nlog10_ff(1, 1, 0)
        self.gr_multiply_const_vxx_0_0 = gr.multiply_const_vcc(
            (1. / constellation_power, ))
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc(
            (constellation_power, ))
        self.gr_file_sink_0_1_0 = gr.file_sink(gr.sizeof_gr_complex * 1,
                                               "rx_sym.32fc")
        self.gr_file_sink_0_1_0.set_unbuffered(False)
        self.gr_file_sink_0_1 = gr.file_sink(gr.sizeof_gr_complex * 1,
                                             "tx_sym.32fc")
        self.gr_file_sink_0_1.set_unbuffered(False)
        self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char * 1, "rx.8b")
        self.gr_file_sink_0_0.set_unbuffered(False)
        self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char * 1, "tx.8b")
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_descrambler_bb_0 = gr.descrambler_bb(0xe4001, 0x7ffff, 19)
        self.gr_char_to_float_1_0 = gr.char_to_float(1, 1)
        self.gr_char_to_float_1 = gr.char_to_float(1, 1)
        self.gr_char_to_float_0 = gr.char_to_float(1, 1)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.digital_scrambler_bb_0 = digital.scrambler_bb(
            0xe4001, 0x7fffF, 19)
        self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb(
            const_object.base(), 6.28 / 100, -0.25, +0.25)
        self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc(
            (constellation), 1)
        self.blks2_error_rate_0 = grc_blks2.error_rate(
            type='BER',
            win_size=samp_rate,
            bits_per_symbol=1,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_vector_source_x_0, 0),
                     (self.digital_scrambler_bb_0, 0))
        self.connect((self.digital_scrambler_bb_0, 0),
                     (self.gr_pack_k_bits_bb_0, 0))
        self.connect((self.gr_pack_k_bits_bb_0, 0),
                     (self.digital_chunks_to_symbols_xx_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.gr_file_sink_0_0, 0))
        self.connect((self.digital_constellation_receiver_cb_0, 0),
                     (self.gr_unpack_k_bits_bb_0, 0))
        self.connect((self.gr_unpack_k_bits_bb_0, 0),
                     (self.gr_descrambler_bb_0, 0))
        self.connect((self.gr_descrambler_bb_0, 0), (self.gr_null_sink_0, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.digital_constellation_receiver_cb_0, 0))
        self.connect((self.gr_descrambler_bb_0, 0),
                     (self.gr_char_to_float_0, 0))
        self.connect((self.gr_char_to_float_0, 0),
                     (self.qtgui_sink_x_0_0_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.digital_chunks_to_symbols_xx_0, 0),
                     (self.gr_multiply_const_vxx_0_0, 0))
        self.connect((self.gr_multiply_const_vxx_0_0, 0),
                     (self.gr_file_sink_0_1, 0))
        self.connect((self.gr_multiply_const_vxx_0_0, 0),
                     (self.qtgui_sink_x_0_1, 0))
        self.connect((self.gr_char_to_float_1, 0),
                     (self.qtgui_sink_x_0_1_0, 0))
        self.connect((self.gr_pack_k_bits_bb_0, 0),
                     (self.gr_char_to_float_1, 0))
        self.connect((self.gr_pack_k_bits_bb_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_char_to_float_1_0, 0),
                     (self.qtgui_sink_x_0_1_0_0, 0))
        self.connect((self.gr_vector_source_x_0, 0),
                     (self.gr_char_to_float_1_0, 0))
        self.connect((self.gr_multiply_const_vxx_0_0, 0),
                     (self.gr_add_xx_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.qtgui_sink_x_0_0, 0))
        self.connect((self.gr_throttle_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_0_1_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.qtgui_sink_x_0_0_0_0, 0))
        self.connect((self.gr_nlog10_ff_0, 0), (self.qtgui_time_sink_x_0, 0))
        self.connect((self.blks2_error_rate_0, 0), (self.gr_nlog10_ff_0, 0))
        self.connect((self.gr_vector_source_x_0_0, 0),
                     (self.blks2_error_rate_0, 0))
        self.connect((self.gr_descrambler_bb_0, 0),
                     (self.blks2_error_rate_0, 1))
コード例 #13
0
ファイル: gmsk_sim.py プロジェクト: travisfcollins/Thesis
	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="DVB Simulator (GMSK)")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.signal = signal = 1
		self.samp_rate = samp_rate = 32000
		self.noise = noise = 10

		##################################################
		# Blocks
		##################################################
		_signal_sizer = wx.BoxSizer(wx.VERTICAL)
		self._signal_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_signal_sizer,
			value=self.signal,
			callback=self.set_signal,
			label="Signal",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._signal_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_signal_sizer,
			value=self.signal,
			callback=self.set_signal,
			minimum=0,
			maximum=1000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_signal_sizer)
		_noise_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			label="Noise",
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_sizer,
			value=self.noise,
			callback=self.set_noise,
			minimum=0,
			maximum=1000,
			num_steps=1000,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_sizer)
		self.gr_wavfile_source_0 = gr.wavfile_source("/home/traviscollins/GNURADIO/tfc_models/test.wav", False)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_float*1, samp_rate)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise, 42)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((signal, ))
		self.gr_file_sink_1_0 = gr.file_sink(gr.sizeof_float*1, "/home/traviscollins/GNURADIO/tfc_models/output_txt.wav")
		self.gr_file_sink_1_0.set_unbuffered(False)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=20,
			frequency_offset=0.0,
			epsilon=1.0,
			taps=(1.0 + 1.0j, ),
			noise_seed=42,
		)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.digital_gmsk_mod_0 = digital.gmsk_mod(
			samples_per_symbol=2,
			bt=0.35,
			verbose=False,
			log=False,
		)
		self.digital_gmsk_demod_0 = digital.gmsk_demod(
			samples_per_symbol=2,
			gain_mu=0.175,
			mu=0.5,
			omega_relative_limit=0.005,
			freq_error=0.0,
			verbose=False,
			log=False,
		)
		self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(grc_blks2.packet_encoder(
				samples_per_symbol=2,
				bits_per_symbol=1,
				access_code="",
				pad_for_usrp=True,
			),
			payload_length=0,
		)
		self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(grc_blks2.packet_decoder(
				access_code="",
				threshold=-1,
				callback=lambda ok, payload: self.blks2_packet_decoder_0.recv_pkt(ok, payload),
			),
		)
		self.audio_sink_0 = audio.sink(samp_rate, "", True)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.gr_add_xx_0, 0), (self.digital_gmsk_demod_0, 0))
		self.connect((self.blks2_packet_encoder_0, 0), (self.digital_gmsk_mod_0, 0))
		self.connect((self.digital_gmsk_mod_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.blks2_packet_encoder_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_1_0, 0))
		self.connect((self.digital_gmsk_demod_0, 0), (self.blks2_packet_decoder_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_wavfile_source_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.blks2_packet_decoder_0, 0), (self.audio_sink_0, 0))
コード例 #14
0
ファイル: sss_corr2_gui.py プロジェクト: a4a881d4/gr-lte-1
	def __init__(self, freq_corr=0, N_id_1=134, avg_frames=1, N_id_2=0, decim=16):
		grc_wxgui.top_block_gui.__init__(self, title="Sss Corr2 Gui")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.freq_corr = freq_corr
		self.N_id_1 = N_id_1
		self.avg_frames = avg_frames
		self.N_id_2 = N_id_2
		self.decim = decim

		##################################################
		# Variables
		##################################################
		self.vec_half_frame = vec_half_frame = 30720*5/decim
		self.samp_rate = samp_rate = 30720e3/decim
		self.rot = rot = 0
		self.noise_level = noise_level = 0
		self.fft_size = fft_size = 2048/decim

		##################################################
		# Blocks
		##################################################
		_rot_sizer = wx.BoxSizer(wx.VERTICAL)
		self._rot_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_rot_sizer,
			value=self.rot,
			callback=self.set_rot,
			label='rot',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._rot_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_rot_sizer,
			value=self.rot,
			callback=self.set_rot,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_rot_sizer)
		_noise_level_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_level_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_level_sizer,
			value=self.noise_level,
			callback=self.set_noise_level,
			label='noise_level',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_level_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_level_sizer,
			value=self.noise_level,
			callback=self.set_noise_level,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_level_sizer)
		self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
			self.GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.Add(self.wxgui_scopesink2_0.win)
		self.gr_vector_to_stream_1 = gr.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
		self.gr_vector_to_stream_0_2 = gr.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
		self.gr_vector_to_stream_0_1 = gr.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
		self.gr_vector_to_stream_0_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
		self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_float*1, fft_size)
		self.gr_vector_source_x_0_0_0 = gr.vector_source_c((gen_pss_fd(N_id_2, fft_size, False).get_data()), True, fft_size)
		self.gr_vector_source_x_0_0 = gr.vector_source_c((gen_pss_fd(N_id_2, fft_size, False).get_data()), True, fft_size)
		self.gr_vector_source_x_0 = gr.vector_source_c((gen_sss_fd( N_id_1, N_id_2, fft_size).get_sss(True)), True, fft_size)
		self.gr_stream_to_vector_0_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
		self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
		self.gr_repeat_0 = gr.repeat(gr.sizeof_float*1, fft_size)
		self.gr_null_sink_0_0 = gr.null_sink(gr.sizeof_gr_complex*1)
		self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*1)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level, 0)
		self.gr_multiply_xx_1 = gr.multiply_vcc(1)
		self.gr_multiply_xx_0 = gr.multiply_vcc(fft_size)
		self.gr_multiply_const_vxx_1 = gr.multiply_const_vcc((1/1500., ))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((exp(rot*2*numpy.pi*1j), ))
		self.gr_interleave_0 = gr.interleave(gr.sizeof_gr_complex*fft_size)
		self.gr_integrate_xx_0 = gr.integrate_ff(fft_size)
		self.gr_float_to_complex_0_0 = gr.float_to_complex(1)
		self.gr_float_to_complex_0 = gr.float_to_complex(1)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/user/git/gr-lte/gr-lte/test/foo_pss0_sss_in.cfile", True)
		self.gr_fft_vxx_1 = gr.fft_vcc(fft_size, False, (window.blackmanharris(1024)), True, 1)
		self.gr_fft_vxx_0 = gr.fft_vcc(fft_size, True, (window.blackmanharris(1024)), True, 1)
		self.gr_divide_xx_0_1 = gr.divide_cc(1)
		self.gr_divide_xx_0_0 = gr.divide_ff(1)
		self.gr_divide_xx_0 = gr.divide_cc(1)
		self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_gr_complex*fft_size)
		self.gr_conjugate_cc_1 = gr.conjugate_cc()
		self.gr_conjugate_cc_0 = gr.conjugate_cc()
		self.gr_complex_to_mag_squared_0_0 = gr.complex_to_mag_squared(1)
		self.gr_complex_to_mag_squared_0 = gr.complex_to_mag_squared(fft_size)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.gr_add_const_vxx_0 = gr.add_const_vff((1, ))
		self.const_source_x_0_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 0)
		self.const_source_x_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 0)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.gr_stream_to_vector_0, 0))
		self.connect((self.gr_conjugate_cc_0, 0), (self.gr_stream_to_vector_0_0, 0))
		self.connect((self.gr_stream_to_vector_0_0, 0), (self.gr_multiply_xx_0, 1))
		self.connect((self.gr_deinterleave_0, 0), (self.gr_multiply_xx_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.gr_complex_to_mag_squared_0, 0))
		self.connect((self.gr_complex_to_mag_squared_0, 0), (self.gr_vector_to_stream_0, 0))
		self.connect((self.gr_vector_to_stream_0, 0), (self.gr_integrate_xx_0, 0))
		self.connect((self.gr_integrate_xx_0, 0), (self.gr_repeat_0, 0))
		self.connect((self.gr_multiply_xx_0, 0), (self.gr_vector_to_stream_0_0, 0))
		self.connect((self.gr_vector_to_stream_0_1, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_divide_xx_0, 0), (self.gr_multiply_xx_1, 0))
		self.connect((self.gr_float_to_complex_0, 0), (self.gr_divide_xx_0, 1))
		self.connect((self.gr_conjugate_cc_1, 0), (self.gr_divide_xx_0, 0))
		self.connect((self.gr_deinterleave_0, 1), (self.gr_vector_to_stream_0_1, 0))
		self.connect((self.gr_repeat_0, 0), (self.gr_float_to_complex_0, 0))
		self.connect((self.const_source_x_0, 0), (self.gr_float_to_complex_0, 1))
		self.connect((self.gr_vector_to_stream_0_0, 0), (self.gr_conjugate_cc_1, 0))
		self.connect((self.gr_vector_to_stream_0_0, 0), (self.gr_complex_to_mag_squared_0_0, 0))
		self.connect((self.gr_complex_to_mag_squared_0_0, 0), (self.gr_divide_xx_0_0, 0))
		self.connect((self.gr_repeat_0, 0), (self.gr_divide_xx_0_0, 1))
		self.connect((self.gr_divide_xx_0_0, 0), (self.gr_add_const_vxx_0, 0))
		self.connect((self.gr_add_const_vxx_0, 0), (self.gr_float_to_complex_0_0, 0))
		self.connect((self.const_source_x_0_0, 0), (self.gr_float_to_complex_0_0, 1))
		self.connect((self.gr_float_to_complex_0_0, 0), (self.gr_divide_xx_0_1, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_divide_xx_0_1, 0))
		self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
		self.connect((self.gr_fft_vxx_0, 0), (self.gr_deinterleave_0, 0))
		self.connect((self.gr_vector_to_stream_0_2, 0), (self.gr_conjugate_cc_0, 0))
		self.connect((self.gr_divide_xx_0_1, 0), (self.gr_null_sink_0, 0))
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_interleave_0, 1))
		self.connect((self.gr_interleave_0, 0), (self.gr_fft_vxx_1, 0))
		self.connect((self.gr_fft_vxx_1, 0), (self.gr_vector_to_stream_1, 0))
		self.connect((self.gr_vector_source_x_0_0, 0), (self.gr_interleave_0, 0))
		self.connect((self.gr_vector_source_x_0_0_0, 0), (self.gr_vector_to_stream_0_2, 0))
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.gr_vector_to_stream_1, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_vector_to_stream_0_1, 0), (self.gr_multiply_const_vxx_1, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.gr_null_sink_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_1, 0), (self.wxgui_scopesink2_0, 1))
		self.connect((self.gr_divide_xx_0_1, 0), (self.wxgui_scopesink2_0, 0))
コード例 #15
0
ファイル: benchmark_tx.py プロジェクト: jeztek/spectrum
    def __init__(self, options):
        gr.top_block.__init__(self)
        use_sink = None
        if(options.tx_freq is not None):
            self.sink = uhd_transmitter(options.args,
                                        options.bandwidth,
                                        options.tx_freq, options.tx_gain,
                                        options.spec, options.antenna,
                                        options.verbose)
            use_sink = self.sink
        elif(options.to_file is not None):
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
            self.throttle = gr.throttle(gr.sizeof_gr_complex*1, options.file_samp_rate)
            self.connect(self.throttle, self.sink)
            use_sink = self.throttle
        else:
            self.sink = gr.null_sink(gr.sizeof_gr_complex)

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath = [ ]
        self.txpath.append(transmit_path(options))
        self.txpath.append(transmit_path(options))

        samp_rate = 0
        if(options.tx_freq is not None):
            samp_rate = self.sink.get_sample_rate()
        else:
            samp_rate = options.file_samp_rate

        print "SAMP RATE " + str(samp_rate)    

        volume = options.split_amplitude
        band_transition = options.band_trans_width
        low_transition = options.low_trans_width
        guard_width = options.guard_width

        self.low_pass_filter_qv0 = gr.interp_fir_filter_ccf(2, firdes.low_pass(
            1, samp_rate, samp_rate/4-guard_width/2, low_transition, firdes.WIN_HAMMING, 6.76))
        self.freq_translate_qv0 = filter.freq_xlating_fir_filter_ccc(1, (options.num_taps, ), samp_rate/4, samp_rate)
        self.band_pass_filter_qv0 = gr.fir_filter_ccc(1, firdes.complex_band_pass(
            1, samp_rate, -samp_rate/2+guard_width, 0-guard_width, band_transition, firdes.WIN_HAMMING, 6.76))

        self.low_pass_filter_qv1 = gr.interp_fir_filter_ccf(2, firdes.low_pass(
            1, samp_rate, samp_rate/4-guard_width/2, low_transition, firdes.WIN_HAMMING, 6.76))
        self.freq_translate_qv1 = filter.freq_xlating_fir_filter_ccc(1, (options.num_taps, ), -samp_rate/4, samp_rate)
        self.band_pass_filter_qv1 = gr.fir_filter_ccc(1, firdes.complex_band_pass(
            1, samp_rate, 0+guard_width, samp_rate/2-guard_width, band_transition, firdes.WIN_HAMMING, 6.76))

        self.combiner = gr.add_vcc(1)
        self.volume_multiply = blocks.multiply_const_vcc((volume, ))

        self.connect((self.txpath[0], 0), (self.low_pass_filter_qv0, 0))
        self.connect((self.txpath[1], 0), (self.low_pass_filter_qv1, 0))

        self.connect((self.low_pass_filter_qv0, 0), (self.freq_translate_qv0, 0))
        self.connect((self.freq_translate_qv0, 0), (self.band_pass_filter_qv0, 0))

        self.connect((self.low_pass_filter_qv1, 0), (self.freq_translate_qv1, 0))
        self.connect((self.freq_translate_qv1, 0), (self.band_pass_filter_qv1, 0))

        self.connect((self.band_pass_filter_qv0, 0), (self.combiner, 0))
        self.connect((self.band_pass_filter_qv1, 0), (self.combiner, 1))

        self.connect((self.combiner, 0), (self.volume_multiply, 0))

        self.connect(self.volume_multiply, use_sink)
コード例 #16
0
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.random_source_x_0 = gr.vector_source_b(
            map(int, numpy.random.randint(0, 2, 1000)), True)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, 512)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_sub_xx_0 = gr.sub_cc(512)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, 512)
        self.gr_file_source_1 = gr.file_source(
            gr.sizeof_gr_complex * 512,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt",
            True)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_float * 1,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt",
            True)
        self.gr_file_sink_0 = gr.file_sink(
            gr.sizeof_float * 1,
            "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt"
        )
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)),
                                     True, 1)
        self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)),
                                     True, 1)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(options=grc_blks2.options(
                modulation="bpsk",
                fft_length=512,
                occupied_tones=200,
                cp_length=128,
                pad_for_usrp=True,
                log=None,
                verbose=None,
            ), ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    snr=10,
                    log=None,
                    verbose=None,
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.
                recv_pkt(ok, payload),
            ), )
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(samples_per_symbol=2,
                                                     excess_bw=0.35,
                                                     gray_coded=True,
                                                     verbose=False,
                                                     log=False)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.random_source_x_0, 0),
                     (self.digital_dxpsk_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0))
        self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.digital_ofdm_demod_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_0, 0))
コード例 #17
0
ファイル: sss_corr2_gui.py プロジェクト: gmg2719/gr-lte-1
    def __init__(self,
                 freq_corr=0,
                 N_id_1=134,
                 avg_frames=1,
                 N_id_2=0,
                 decim=16):
        grc_wxgui.top_block_gui.__init__(self, title="Sss Corr2 Gui")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.freq_corr = freq_corr
        self.N_id_1 = N_id_1
        self.avg_frames = avg_frames
        self.N_id_2 = N_id_2
        self.decim = decim

        ##################################################
        # Variables
        ##################################################
        self.vec_half_frame = vec_half_frame = 30720 * 5 / decim
        self.samp_rate = samp_rate = 30720e3 / decim
        self.rot = rot = 0
        self.noise_level = noise_level = 0
        self.fft_size = fft_size = 2048 / decim

        ##################################################
        # Blocks
        ##################################################
        _rot_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rot_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            label='rot',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rot_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rot_sizer)
        _noise_level_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_level_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            label='noise_level',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_level_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            minimum=0,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_level_sizer)
        self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
            self.GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.Add(self.wxgui_scopesink2_0.win)
        self.gr_vector_to_stream_1 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_vector_to_stream_0_2 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_vector_to_stream_0_1 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_vector_to_stream_0_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(
            gr.sizeof_float * 1, fft_size)
        self.gr_vector_source_x_0_0_0 = gr.vector_source_c(
            (gen_pss_fd(N_id_2, fft_size, False).get_data()), True, fft_size)
        self.gr_vector_source_x_0_0 = gr.vector_source_c(
            (gen_pss_fd(N_id_2, fft_size, False).get_data()), True, fft_size)
        self.gr_vector_source_x_0 = gr.vector_source_c(
            (gen_sss_fd(N_id_1, N_id_2, fft_size).get_sss(True)), True,
            fft_size)
        self.gr_stream_to_vector_0_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_repeat_0 = gr.repeat(gr.sizeof_float * 1, fft_size)
        self.gr_null_sink_0_0 = gr.null_sink(gr.sizeof_gr_complex * 1)
        self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex * 1)
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN,
                                                     noise_level, 0)
        self.gr_multiply_xx_1 = gr.multiply_vcc(1)
        self.gr_multiply_xx_0 = gr.multiply_vcc(fft_size)
        self.gr_multiply_const_vxx_1 = gr.multiply_const_vcc((1 / 1500., ))
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc(
            (exp(rot * 2 * numpy.pi * 1j), ))
        self.gr_interleave_0 = gr.interleave(gr.sizeof_gr_complex * fft_size)
        self.gr_integrate_xx_0 = gr.integrate_ff(fft_size)
        self.gr_float_to_complex_0_0 = gr.float_to_complex(1)
        self.gr_float_to_complex_0 = gr.float_to_complex(1)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/user/git/gr-lte/gr-lte/test/foo_pss0_sss_in.cfile", True)
        self.gr_fft_vxx_1 = gr.fft_vcc(fft_size, False,
                                       (window.blackmanharris(1024)), True, 1)
        self.gr_fft_vxx_0 = gr.fft_vcc(fft_size, True,
                                       (window.blackmanharris(1024)), True, 1)
        self.gr_divide_xx_0_1 = gr.divide_cc(1)
        self.gr_divide_xx_0_0 = gr.divide_ff(1)
        self.gr_divide_xx_0 = gr.divide_cc(1)
        self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_gr_complex *
                                                 fft_size)
        self.gr_conjugate_cc_1 = gr.conjugate_cc()
        self.gr_conjugate_cc_0 = gr.conjugate_cc()
        self.gr_complex_to_mag_squared_0_0 = gr.complex_to_mag_squared(1)
        self.gr_complex_to_mag_squared_0 = gr.complex_to_mag_squared(fft_size)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.gr_add_const_vxx_0 = gr.add_const_vff((1, ))
        self.const_source_x_0_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 0)
        self.const_source_x_0 = gr.sig_source_f(0, gr.GR_CONST_WAVE, 0, 0, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0),
                     (self.gr_stream_to_vector_0, 0))
        self.connect((self.gr_conjugate_cc_0, 0),
                     (self.gr_stream_to_vector_0_0, 0))
        self.connect((self.gr_stream_to_vector_0_0, 0),
                     (self.gr_multiply_xx_0, 1))
        self.connect((self.gr_deinterleave_0, 0), (self.gr_multiply_xx_0, 0))
        self.connect((self.gr_multiply_xx_0, 0),
                     (self.gr_complex_to_mag_squared_0, 0))
        self.connect((self.gr_complex_to_mag_squared_0, 0),
                     (self.gr_vector_to_stream_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.gr_integrate_xx_0, 0))
        self.connect((self.gr_integrate_xx_0, 0), (self.gr_repeat_0, 0))
        self.connect((self.gr_multiply_xx_0, 0),
                     (self.gr_vector_to_stream_0_0, 0))
        self.connect((self.gr_vector_to_stream_0_1, 0),
                     (self.gr_multiply_xx_1, 1))
        self.connect((self.gr_divide_xx_0, 0), (self.gr_multiply_xx_1, 0))
        self.connect((self.gr_float_to_complex_0, 0), (self.gr_divide_xx_0, 1))
        self.connect((self.gr_conjugate_cc_1, 0), (self.gr_divide_xx_0, 0))
        self.connect((self.gr_deinterleave_0, 1),
                     (self.gr_vector_to_stream_0_1, 0))
        self.connect((self.gr_repeat_0, 0), (self.gr_float_to_complex_0, 0))
        self.connect((self.const_source_x_0, 0),
                     (self.gr_float_to_complex_0, 1))
        self.connect((self.gr_vector_to_stream_0_0, 0),
                     (self.gr_conjugate_cc_1, 0))
        self.connect((self.gr_vector_to_stream_0_0, 0),
                     (self.gr_complex_to_mag_squared_0_0, 0))
        self.connect((self.gr_complex_to_mag_squared_0_0, 0),
                     (self.gr_divide_xx_0_0, 0))
        self.connect((self.gr_repeat_0, 0), (self.gr_divide_xx_0_0, 1))
        self.connect((self.gr_divide_xx_0_0, 0), (self.gr_add_const_vxx_0, 0))
        self.connect((self.gr_add_const_vxx_0, 0),
                     (self.gr_float_to_complex_0_0, 0))
        self.connect((self.const_source_x_0_0, 0),
                     (self.gr_float_to_complex_0_0, 1))
        self.connect((self.gr_float_to_complex_0_0, 0),
                     (self.gr_divide_xx_0_1, 1))
        self.connect((self.gr_multiply_xx_1, 0), (self.gr_divide_xx_0_1, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
        self.connect((self.gr_fft_vxx_0, 0), (self.gr_deinterleave_0, 0))
        self.connect((self.gr_vector_to_stream_0_2, 0),
                     (self.gr_conjugate_cc_0, 0))
        self.connect((self.gr_divide_xx_0_1, 0), (self.gr_null_sink_0, 0))
        self.connect((self.gr_vector_source_x_0, 0), (self.gr_interleave_0, 1))
        self.connect((self.gr_interleave_0, 0), (self.gr_fft_vxx_1, 0))
        self.connect((self.gr_fft_vxx_1, 0), (self.gr_vector_to_stream_1, 0))
        self.connect((self.gr_vector_source_x_0_0, 0),
                     (self.gr_interleave_0, 0))
        self.connect((self.gr_vector_source_x_0_0_0, 0),
                     (self.gr_vector_to_stream_0_2, 0))
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_vector_to_stream_1, 0), (self.gr_add_xx_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_vector_to_stream_0_1, 0),
                     (self.gr_multiply_const_vxx_1, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.gr_null_sink_0_0, 0))
        self.connect((self.gr_multiply_const_vxx_1, 0),
                     (self.wxgui_scopesink2_0, 1))
        self.connect((self.gr_divide_xx_0_1, 0), (self.wxgui_scopesink2_0, 0))
コード例 #18
0
ファイル: soundgen.py プロジェクト: cdstelly/scripts
        def __init__(self):
                grc_wxgui.top_block_gui.__init__(self, title="Top Block")
                _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
                self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
 
                ##################################################
                # Variables
                ##################################################
                self.samp_rate = samp_rate = 192000
                self.Noise = Noise = 0.01
                self.Loudness = Loudness = 0.7
                self.Frequency = Frequency = 5000
 
                ##################################################
                # Blocks
                ##################################################
                _Noise_sizer = wx.BoxSizer(wx.VERTICAL)
                self._Noise_text_box = forms.text_box(
                        parent=self.GetWin(),
                        sizer=_Noise_sizer,
                        value=self.Noise,
                        callback=self.set_Noise,
                        label="Noise",
                        converter=forms.float_converter(),
                        proportion=0,
                )
                self._Noise_slider = forms.slider(
                        parent=self.GetWin(),
                        sizer=_Noise_sizer,
                        value=self.Noise,
                        callback=self.set_Noise,
                        minimum=0.0,
                        maximum=1,
                        num_steps=1000,
                        style=wx.SL_HORIZONTAL,
                        cast=float,
                        proportion=1,
                )
                self.Add(_Noise_sizer)
                _Loudness_sizer = wx.BoxSizer(wx.VERTICAL)
                self._Loudness_text_box = forms.text_box(
                        parent=self.GetWin(),
                        sizer=_Loudness_sizer,
                        value=self.Loudness,
                        callback=self.set_Loudness,
                        label="Loudness",
                        converter=forms.float_converter(),
                        proportion=0,
                )
                self._Loudness_slider = forms.slider(
                        parent=self.GetWin(),
                        sizer=_Loudness_sizer,
                        value=self.Loudness,
                        callback=self.set_Loudness,
                        minimum=0.0,
                        maximum=1.0,
                        num_steps=1000,
                        style=wx.SL_HORIZONTAL,
                        cast=float,
                        proportion=1,
                )
                self.Add(_Loudness_sizer)
                _Frequency_sizer = wx.BoxSizer(wx.VERTICAL)
                self._Frequency_text_box = forms.text_box(
                        parent=self.GetWin(),
                        sizer=_Frequency_sizer,
                        value=self.Frequency,
                        callback=self.set_Frequency,
                        label="Frequency",
                        converter=forms.int_converter(),
                        proportion=0,
                )
                self._Frequency_slider = forms.slider(
                        parent=self.GetWin(),
                        sizer=_Frequency_sizer,
                        value=self.Frequency,
                        callback=self.set_Frequency,
                        minimum=10,
                        maximum=20000,
                        num_steps=1000,
                        style=wx.SL_HORIZONTAL,
                        cast=int,
                        proportion=1,
                )
                self.Add(_Frequency_sizer)
                self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c(
                        self.GetWin(),
                        baseband_freq=0,
                        dynamic_range=100,
                        ref_level=0,
                        ref_scale=4.0,
                        sample_rate=samp_rate,
                        fft_size=2048,
                        fft_rate=15,
                        average=False,
                        avg_alpha=0.1,
                        title="Waterfall Plot",
                        size=(900,200),
                )
                self.Add(self.wxgui_waterfallsink2_0.win)
                def wxgui_waterfallsink2_0_callback(x, y):
                        self.set_Frequency(x)
 
                self.wxgui_waterfallsink2_0.set_callback(wxgui_waterfallsink2_0_callback)
                self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
                        self.GetWin(),
                        baseband_freq=0,
                        y_per_div=10,
                        y_divs=10,
                        ref_level=0,
                        ref_scale=4.0,
                        sample_rate=samp_rate,
                        fft_size=2048,
                        fft_rate=15,
                        average=True,
                        avg_alpha=0.1,
                        title="FFT Plot",
                        peak_hold=True,
                )
                self.Add(self.wxgui_fftsink2_0.win)
                self.gr_sig_source_x_2 = gr.sig_source_c(samp_rate, gr.GR_SIN_WAVE, Frequency, Loudness, 0)
                self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, Noise, 0)
                self.gr_complex_to_real_0 = gr.complex_to_real(1)
                self.gr_add_xx_1 = gr.add_vcc(1)
                self.audio_sink_0 = audio.sink(samp_rate, "", True)
 
                ##################################################
                # Connections
                ##################################################
                self.connect((self.gr_complex_to_real_0, 0), (self.audio_sink_0, 0))
                self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_1, 0))
                self.connect((self.gr_sig_source_x_2, 0), (self.gr_add_xx_1, 1))
                self.connect((self.gr_add_xx_1, 0), (self.gr_complex_to_real_0, 0))
                self.connect((self.gr_add_xx_1, 0), (self.wxgui_waterfallsink2_0, 0))
                self.connect((self.gr_add_xx_1, 0), (self.wxgui_fftsink2_0, 0))
コード例 #19
0
ファイル: test_cpm.py プロジェクト: GREO/gnuradio-git
def run_test(seed,blocksize):
        tb = gr.top_block()

	##################################################
	# Variables
	##################################################
	M = 2
	K = 1
	P = 2
	h = (1.0*K)/P
	L = 3
	Q = 4
        frac = 0.99
        f = trellis.fsm(P,M,L)

        # CPFSK signals
        #p = numpy.ones(Q)/(2.0)
        #q = numpy.cumsum(p)/(1.0*Q)

        # GMSK signals
        BT=0.3;
        tt=numpy.arange(0,L*Q)/(1.0*Q)-L/2.0;
        #print tt
        p=(0.5*scipy.stats.erfc(2*math.pi*BT*(tt-0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0))-0.5*scipy.stats.erfc(2*math.pi*BT*(tt+0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0)))/2.0;
        p=p/sum(p)*Q/2.0;
        #print p
        q=numpy.cumsum(p)/Q;
        q=q/q[-1]/2.0;
        #print q

        (f0T,SS,S,F,Sf,Ff,N) = fsm_utils.make_cpm_signals(K,P,M,L,q,frac)
        #print N
        #print Ff
        Ffa = numpy.insert(Ff,Q,numpy.zeros(N),axis=0)
        #print Ffa
        MF = numpy.fliplr(numpy.transpose(Ffa))
        #print MF
        E = numpy.sum(numpy.abs(Sf)**2,axis=0)
        Es = numpy.sum(E)/f.O()
        #print Es

        constellation = numpy.reshape(numpy.transpose(Sf),N*f.O())
        #print Ff
        #print Sf
        #print constellation
        #print numpy.max(numpy.abs(SS - numpy.dot(Ff , Sf)))

	EsN0_db = 10.0
        N0 =  Es * 10.0**(-(1.0*EsN0_db)/10.0)
        #N0 = 0.0
        #print N0
        head = 4
        tail = 4
        numpy.random.seed(seed*666)
        data = numpy.random.randint(0, M, head+blocksize+tail+1)
        #data = numpy.zeros(blocksize+1+head+tail,'int')
        for i in range(head):
            data[i]=0
        for i in range(tail+1):
            data[-i]=0
      


	##################################################
	# Blocks
	##################################################
	random_source_x_0 = gr.vector_source_b(data, False)
	gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1)
	gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p)
	gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q))

	gr_add_vxx_0 = gr.add_vcc(1)
	gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed))

	gr_multiply_vxx_0 = gr.multiply_vcc(1)
	gr_sig_source_x_0 = gr.sig_source_c(Q, gr.GR_COS_WAVE, -f0T, 1, 0)
        # only works for N=2, do it manually for N>2...
	gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate())
	gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate())
	gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex*1, N)
	gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, N*(1+0))
	viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, N, constellation, trellis.TRELLIS_EUCLIDEAN)

        gr_vector_sink_x_0 = gr.vector_sink_b()

	##################################################
	# Connections
	##################################################
	tb.connect((random_source_x_0, 0), (gr_chunks_to_symbols_xx_0, 0))
	tb.connect((gr_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0))
	tb.connect((gr_interp_fir_filter_xxx_0, 0), (gr_frequency_modulator_fc_0, 0))
	tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0))
	tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1))
	tb.connect((gr_add_vxx_0, 0), (gr_multiply_vxx_0, 0))
	tb.connect((gr_sig_source_x_0, 0), (gr_multiply_vxx_0, 1))
	tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0, 0))
	tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0_0, 0))
	tb.connect((gr_fir_filter_xxx_0_0, 0), (gr_streams_to_stream_0, 0))
	tb.connect((gr_fir_filter_xxx_0_0_0, 0), (gr_streams_to_stream_0, 1))
	tb.connect((gr_streams_to_stream_0, 0), (gr_skiphead_0, 0))
	tb.connect((gr_skiphead_0, 0), (viterbi, 0))
	tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0))
        

        tb.run()
        dataest = gr_vector_sink_x_0.data()
        #print data
        #print numpy.array(dataest)
        perr = 0
        err = 0
        for i in range(blocksize):
          if data[head+i] != dataest[head+i]:
            #print i
            err += 1
        if err != 0 :
          perr = 1
        return (err,perr)
コード例 #20
0
ファイル: simple_qam.py プロジェクト: Nishtha13/telclass
	def __init__(self):
		gr.top_block.__init__(self, "Simple QAM Simulation")
		Qt.QWidget.__init__(self)
		self.setWindowTitle("Simple QAM Simulation")
		self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
		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)


		##################################################
		# Variables
		##################################################
		self.constellation_cardinality = constellation_cardinality = 16
		self.const_object = const_object = constellations()['qam'](constellation_cardinality)
		self.snr_db = snr_db = 20
		self.constellation = constellation = const_object.points()
		self.sps = sps = 8
		self.samp_rate = samp_rate = 250000
		self.noise_amp = noise_amp = sqrt(  (10**(-snr_db/10.))  /2. )
		self.constellation_power = constellation_power = sqrt(sum([abs(i)**2 for i in constellation])/constellation_cardinality)

		##################################################
		# Blocks
		##################################################
		self.tabid_0 = Qt.QTabWidget()
		self.tabid_0_widget_0 = Qt.QWidget()
		self.tabid_0_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_0_widget_0)
		self.tabid_0_grid_layout_0 = Qt.QGridLayout()
		self.tabid_0_layout_0.addLayout(self.tabid_0_grid_layout_0)
		self.tabid_0.addTab(self.tabid_0_widget_0, "TX")
		self.tabid_0_widget_1 = Qt.QWidget()
		self.tabid_0_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_0_widget_1)
		self.tabid_0_grid_layout_1 = Qt.QGridLayout()
		self.tabid_0_layout_1.addLayout(self.tabid_0_grid_layout_1)
		self.tabid_0.addTab(self.tabid_0_widget_1, "CHANNEL")
		self.tabid_0_widget_2 = Qt.QWidget()
		self.tabid_0_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_0_widget_2)
		self.tabid_0_grid_layout_2 = Qt.QGridLayout()
		self.tabid_0_layout_2.addLayout(self.tabid_0_grid_layout_2)
		self.tabid_0.addTab(self.tabid_0_widget_2, "RX")
		self.top_grid_layout.addWidget(self.tabid_0, 30,0,10,100)
		self.tabid_2 = Qt.QTabWidget()
		self.tabid_2_widget_0 = Qt.QWidget()
		self.tabid_2_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_2_widget_0)
		self.tabid_2_grid_layout_0 = Qt.QGridLayout()
		self.tabid_2_layout_0.addLayout(self.tabid_2_grid_layout_0)
		self.tabid_2.addTab(self.tabid_2_widget_0, "symbol-based")
		self.tabid_2_widget_1 = Qt.QWidget()
		self.tabid_2_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_2_widget_1)
		self.tabid_2_grid_layout_1 = Qt.QGridLayout()
		self.tabid_2_layout_1.addLayout(self.tabid_2_grid_layout_1)
		self.tabid_2.addTab(self.tabid_2_widget_1, "bit-based")
		self.tabid_2_widget_2 = Qt.QWidget()
		self.tabid_2_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_2_widget_2)
		self.tabid_2_grid_layout_2 = Qt.QGridLayout()
		self.tabid_2_layout_2.addLayout(self.tabid_2_grid_layout_2)
		self.tabid_2.addTab(self.tabid_2_widget_2, "BER")
		self.tabid_0_layout_2.addWidget(self.tabid_2)
		self.tabid_1 = Qt.QTabWidget()
		self.tabid_1_widget_0 = Qt.QWidget()
		self.tabid_1_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_1_widget_0)
		self.tabid_1_grid_layout_0 = Qt.QGridLayout()
		self.tabid_1_layout_0.addLayout(self.tabid_1_grid_layout_0)
		self.tabid_1.addTab(self.tabid_1_widget_0, "bit-based")
		self.tabid_1_widget_1 = Qt.QWidget()
		self.tabid_1_layout_1 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_1_widget_1)
		self.tabid_1_grid_layout_1 = Qt.QGridLayout()
		self.tabid_1_layout_1.addLayout(self.tabid_1_grid_layout_1)
		self.tabid_1.addTab(self.tabid_1_widget_1, "scrambled")
		self.tabid_1_widget_2 = Qt.QWidget()
		self.tabid_1_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.tabid_1_widget_2)
		self.tabid_1_grid_layout_2 = Qt.QGridLayout()
		self.tabid_1_layout_2.addLayout(self.tabid_1_grid_layout_2)
		self.tabid_1.addTab(self.tabid_1_widget_2, "symbol-based")
		self.tabid_0_grid_layout_0.addWidget(self.tabid_1, 0,0,10,10)
		self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
			1024, #size
			samp_rate, #bw
			"QT GUI Plot", #name
			1 #number of inputs
		)
		self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
		self.tabid_2_layout_2.addWidget(self._qtgui_time_sink_x_0_win)
		self.qtgui_sink_x_0_1_0_0 = qtgui.sink_f(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			False, #plotfreq
			False, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_1_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_1_0_0.pyqwidget(), Qt.QWidget)
		self.tabid_1_layout_0.addWidget(self._qtgui_sink_x_0_1_0_0_win)
		self.qtgui_sink_x_0_1_0 = qtgui.sink_f(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			True, #plotfreq
			False, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_1_0_win = sip.wrapinstance(self.qtgui_sink_x_0_1_0.pyqwidget(), Qt.QWidget)
		self.tabid_1_layout_1.addWidget(self._qtgui_sink_x_0_1_0_win)
		self.qtgui_sink_x_0_1 = qtgui.sink_c(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			False, #plotfreq
			False, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_1_win = sip.wrapinstance(self.qtgui_sink_x_0_1.pyqwidget(), Qt.QWidget)
		self.tabid_1_layout_2.addWidget(self._qtgui_sink_x_0_1_win)
		self.qtgui_sink_x_0_0_0_0 = qtgui.sink_c(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			True, #plotfreq
			False, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_0_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0_0_0.pyqwidget(), Qt.QWidget)
		self.tabid_2_layout_0.addWidget(self._qtgui_sink_x_0_0_0_0_win)
		self.qtgui_sink_x_0_0_0 = qtgui.sink_f(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			False, #plotfreq
			False, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
		self.tabid_2_layout_1.addWidget(self._qtgui_sink_x_0_0_0_win)
		self.qtgui_sink_x_0_0 = qtgui.sink_c(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			True, #plotfreq
			False, #plotwaterfall
			True, #plottime
			False, #plotconst
		)
		self._qtgui_sink_x_0_0_win = sip.wrapinstance(self.qtgui_sink_x_0_0.pyqwidget(), Qt.QWidget)
		self.tabid_0_layout_1.addWidget(self._qtgui_sink_x_0_0_win)
		self.gr_vector_source_x_0_0 = gr.vector_source_b(([1,0]), True, 1)
		self.gr_vector_source_x_0 = gr.vector_source_b(([1,0]), True, 1)
		self.gr_unpack_k_bits_bb_0 = gr.unpack_k_bits_bb(int(log2(constellation_cardinality)))
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_pack_k_bits_bb_0 = gr.pack_k_bits_bb(int(log2(constellation_cardinality)))
		self.gr_null_sink_0 = gr.null_sink(gr.sizeof_char*1)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise_amp, 0)
		self.gr_nlog10_ff_0 = gr.nlog10_ff(1, 1, 0)
		self.gr_multiply_const_vxx_0_0 = gr.multiply_const_vcc((1./constellation_power, ))
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((constellation_power, ))
		self.gr_file_sink_0_1_0 = gr.file_sink(gr.sizeof_gr_complex*1, "rx_sym.32fc")
		self.gr_file_sink_0_1_0.set_unbuffered(False)
		self.gr_file_sink_0_1 = gr.file_sink(gr.sizeof_gr_complex*1, "tx_sym.32fc")
		self.gr_file_sink_0_1.set_unbuffered(False)
		self.gr_file_sink_0_0 = gr.file_sink(gr.sizeof_char*1, "rx.8b")
		self.gr_file_sink_0_0.set_unbuffered(False)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_char*1, "tx.8b")
		self.gr_file_sink_0.set_unbuffered(False)
		self.gr_descrambler_bb_0 = gr.descrambler_bb(0xe4001, 0x7ffff, 19)
		self.gr_char_to_float_1_0 = gr.char_to_float(1, 1)
		self.gr_char_to_float_1 = gr.char_to_float(1, 1)
		self.gr_char_to_float_0 = gr.char_to_float(1, 1)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.digital_scrambler_bb_0 = digital.scrambler_bb(0xe4001, 0x7fffF, 19)
		self.digital_constellation_receiver_cb_0 = digital.constellation_receiver_cb(const_object.base(), 6.28/100, -0.25, +0.25)
		self.digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bc((constellation), 1)
		self.blks2_error_rate_0 = grc_blks2.error_rate(
			type='BER',
			win_size=samp_rate,
			bits_per_symbol=1,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_vector_source_x_0, 0), (self.digital_scrambler_bb_0, 0))
		self.connect((self.digital_scrambler_bb_0, 0), (self.gr_pack_k_bits_bb_0, 0))
		self.connect((self.gr_pack_k_bits_bb_0, 0), (self.digital_chunks_to_symbols_xx_0, 0))
		self.connect((self.digital_constellation_receiver_cb_0, 0), (self.gr_file_sink_0_0, 0))
		self.connect((self.digital_constellation_receiver_cb_0, 0), (self.gr_unpack_k_bits_bb_0, 0))
		self.connect((self.gr_unpack_k_bits_bb_0, 0), (self.gr_descrambler_bb_0, 0))
		self.connect((self.gr_descrambler_bb_0, 0), (self.gr_null_sink_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.digital_constellation_receiver_cb_0, 0))
		self.connect((self.gr_descrambler_bb_0, 0), (self.gr_char_to_float_0, 0))
		self.connect((self.gr_char_to_float_0, 0), (self.qtgui_sink_x_0_0_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.digital_chunks_to_symbols_xx_0, 0), (self.gr_multiply_const_vxx_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_0_0, 0), (self.gr_file_sink_0_1, 0))
		self.connect((self.gr_multiply_const_vxx_0_0, 0), (self.qtgui_sink_x_0_1, 0))
		self.connect((self.gr_char_to_float_1, 0), (self.qtgui_sink_x_0_1_0, 0))
		self.connect((self.gr_pack_k_bits_bb_0, 0), (self.gr_char_to_float_1, 0))
		self.connect((self.gr_pack_k_bits_bb_0, 0), (self.gr_file_sink_0, 0))
		self.connect((self.gr_char_to_float_1_0, 0), (self.qtgui_sink_x_0_1_0_0, 0))
		self.connect((self.gr_vector_source_x_0, 0), (self.gr_char_to_float_1_0, 0))
		self.connect((self.gr_multiply_const_vxx_0_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.qtgui_sink_x_0_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_0_1_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.qtgui_sink_x_0_0_0_0, 0))
		self.connect((self.gr_nlog10_ff_0, 0), (self.qtgui_time_sink_x_0, 0))
		self.connect((self.blks2_error_rate_0, 0), (self.gr_nlog10_ff_0, 0))
		self.connect((self.gr_vector_source_x_0_0, 0), (self.blks2_error_rate_0, 0))
		self.connect((self.gr_descrambler_bb_0, 0), (self.blks2_error_rate_0, 1))
コード例 #21
0
ファイル: sss_corr5_gui.py プロジェクト: a4a881d4/gr-lte-1
	def __init__(self, freq_corr=0, avg_frames=1, decim=16, N_id_2=0, N_id_1=134):
		grc_wxgui.top_block_gui.__init__(self, title="Sss Corr5 Gui")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Parameters
		##################################################
		self.freq_corr = freq_corr
		self.avg_frames = avg_frames
		self.decim = decim
		self.N_id_2 = N_id_2
		self.N_id_1 = N_id_1

		##################################################
		# Variables
		##################################################
		self.vec_half_frame = vec_half_frame = 30720*5/decim
		self.symbol_start = symbol_start = 144/decim
		self.slot_0_10 = slot_0_10 = 1
		self.samp_rate = samp_rate = 30720e3/decim
		self.rot = rot = 0
		self.noise_level = noise_level = 0
		self.fft_size = fft_size = 2048/decim
		self.N_re = N_re = 62

		##################################################
		# Blocks
		##################################################
		_rot_sizer = wx.BoxSizer(wx.VERTICAL)
		self._rot_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_rot_sizer,
			value=self.rot,
			callback=self.set_rot,
			label='rot',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._rot_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_rot_sizer,
			value=self.rot,
			callback=self.set_rot,
			minimum=0,
			maximum=1,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_rot_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), "SSS ML")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS equ")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS in")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "PSS equ")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "PSS ch est")
		self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "foo")
		self.Add(self.notebook_0)
		_noise_level_sizer = wx.BoxSizer(wx.VERTICAL)
		self._noise_level_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_noise_level_sizer,
			value=self.noise_level,
			callback=self.set_noise_level,
			label='noise_level',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._noise_level_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_noise_level_sizer,
			value=self.noise_level,
			callback=self.set_noise_level,
			minimum=0,
			maximum=10,
			num_steps=100,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_noise_level_sizer)
		self.wxgui_scopesink2_0_1_0_1 = scopesink2.scope_sink_c(
			self.notebook_0.GetPage(3).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=2,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0_1_0_1.win)
		self.wxgui_scopesink2_0_1_0_0 = scopesink2.scope_sink_c(
			self.notebook_0.GetPage(2).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=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.notebook_0.GetPage(2).Add(self.wxgui_scopesink2_0_1_0_0.win)
		self.wxgui_scopesink2_0_1_0 = scopesink2.scope_sink_c(
			self.notebook_0.GetPage(1).GetWin(),
			title="Scope Plot",
			sample_rate=samp_rate,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0_1_0.win)
		self.wxgui_scopesink2_0_1 = scopesink2.scope_sink_f(
			self.notebook_0.GetPage(0).GetWin(),
			title="Scope Plot",
			sample_rate=100/avg_frames,
			v_scale=0,
			v_offset=0,
			t_scale=0,
			ac_couple=False,
			xy_mode=False,
			num_inputs=1,
			trig_mode=gr.gr_TRIG_MODE_AUTO,
			y_axis_label="Counts",
		)
		self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_0_1.win)
		_symbol_start_sizer = wx.BoxSizer(wx.VERTICAL)
		self._symbol_start_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_symbol_start_sizer,
			value=self.symbol_start,
			callback=self.set_symbol_start,
			label='symbol_start',
			converter=forms.int_converter(),
			proportion=0,
		)
		self._symbol_start_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_symbol_start_sizer,
			value=self.symbol_start,
			callback=self.set_symbol_start,
			minimum=0,
			maximum=144/decim,
			num_steps=144/decim,
			style=wx.SL_HORIZONTAL,
			cast=int,
			proportion=1,
		)
		self.Add(_symbol_start_sizer)
		self.sss_ml_fd_0 = sss_ml_fd(
			decim=decim,
			avg_frames=avg_frames,
			N_id_1=N_id_1,
			N_id_2=N_id_2,
			slot_0_10=slot_0_10,
		)
		self.pss_chan_est2_0 = pss_chan_est2(
			N_id_2=N_id_2,
		)
		self.gr_vector_to_stream_0_0_1_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, N_re)
		self.gr_vector_to_stream_0_0_1 = gr.vector_to_stream(gr.sizeof_gr_complex*1, N_re)
		self.gr_vector_to_stream_0_0_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, N_re)
		self.gr_vector_to_stream_0_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, N_re)
		self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, fft_size)
		self.gr_vector_source_x_0_0_0 = gr.vector_source_c((gen_pss_fd(N_id_2, N_re, False).get_data()), True, N_re)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_stream_to_vector_0_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, N_re)
		self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, fft_size)
		self.gr_stream_mux_0 = gr.stream_mux(gr.sizeof_gr_complex*1, (N_re/2, N_re/2))
		self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*1)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise_level, 0)
		self.gr_multiply_xx_1_0 = gr.multiply_vcc(N_re)
		self.gr_multiply_xx_1 = gr.multiply_vcc(N_re)
		self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((0.005*exp(rot*2*numpy.pi*1j), ))
		self.gr_keep_m_in_n_0_0 = gr.keep_m_in_n(gr.sizeof_gr_complex, N_re/2, fft_size, (fft_size-N_re)/2-1)
		self.gr_keep_m_in_n_0 = gr.keep_m_in_n(gr.sizeof_gr_complex, N_re/2, fft_size, (fft_size)/2)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/user/git/gr-lte/gr-lte/test/octave/foo_sss_td_in.cfile", True)
		self.gr_fft_vxx_0 = gr.fft_vcc(fft_size, True, (window.blackmanharris(1024)), True, 1)
		self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_gr_complex*N_re)
		self.gr_channel_model_0 = gr.channel_model(
			noise_voltage=0.005*noise_level,
			frequency_offset=0.0,
			epsilon=1,
			taps=(0.005*exp(rot*2*numpy.pi*1j), ),
			noise_seed=0,
		)
		self.gr_add_xx_0 = gr.add_vcc(1)
		self.blks2_selector_0_0 = grc_blks2.selector(
			item_size=gr.sizeof_gr_complex*1,
			num_inputs=2,
			num_outputs=1,
			input_index=0,
			output_index=0,
		)
		self.blks2_selector_0 = grc_blks2.selector(
			item_size=gr.sizeof_gr_complex*1,
			num_inputs=3,
			num_outputs=2,
			input_index=0,
			output_index=0,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.gr_add_xx_0, 0), (self.gr_multiply_const_vxx_0, 0))
		self.connect((self.blks2_selector_0, 0), (self.gr_channel_model_0, 0))
		self.connect((self.blks2_selector_0, 1), (self.gr_add_xx_0, 0))
		self.connect((self.gr_channel_model_0, 0), (self.blks2_selector_0_0, 0))
		self.connect((self.gr_multiply_const_vxx_0, 0), (self.blks2_selector_0_0, 1))
		self.connect((self.gr_file_source_0, 0), (self.blks2_selector_0, 0))
		self.connect((self.blks2_selector_0_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.gr_deinterleave_0, 0), (self.gr_vector_to_stream_0_0_0, 0))
		self.connect((self.gr_vector_to_stream_0_0_0, 0), (self.wxgui_scopesink2_0_1_0_0, 0))
		self.connect((self.gr_vector_to_stream_0_0, 0), (self.wxgui_scopesink2_0_1_0, 0))
		self.connect((self.gr_fft_vxx_0, 0), (self.gr_vector_to_stream_0, 0))
		self.connect((self.gr_vector_to_stream_0, 0), (self.gr_keep_m_in_n_0, 0))
		self.connect((self.gr_stream_to_vector_0_0, 0), (self.gr_deinterleave_0, 0))
		self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
		self.connect((self.gr_vector_to_stream_0_0_1, 0), (self.wxgui_scopesink2_0_1_0_1, 0))
		self.connect((self.gr_vector_to_stream_0_0_1_0, 0), (self.wxgui_scopesink2_0_1_0_1, 1))
		self.connect((self.gr_vector_source_x_0_0_0, 0), (self.gr_vector_to_stream_0_0_1_0, 0))
		self.connect((self.pss_chan_est2_0, 0), (self.gr_multiply_xx_1, 1))
		self.connect((self.gr_multiply_xx_1, 0), (self.sss_ml_fd_0, 0))
		self.connect((self.gr_multiply_xx_1, 0), (self.gr_vector_to_stream_0_0, 0))
		self.connect((self.pss_chan_est2_0, 0), (self.gr_multiply_xx_1_0, 0))
		self.connect((self.gr_deinterleave_0, 1), (self.gr_multiply_xx_1_0, 1))
		self.connect((self.gr_multiply_xx_1_0, 0), (self.gr_vector_to_stream_0_0_1, 0))
		self.connect((self.gr_deinterleave_0, 1), (self.pss_chan_est2_0, 0))
		self.connect((self.gr_vector_to_stream_0, 0), (self.gr_keep_m_in_n_0_0, 0))
		self.connect((self.gr_keep_m_in_n_0_0, 0), (self.gr_stream_mux_0, 0))
		self.connect((self.gr_keep_m_in_n_0, 0), (self.gr_stream_mux_0, 1))
		self.connect((self.gr_stream_mux_0, 0), (self.gr_stream_to_vector_0_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
		self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 1))
		self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 2))
		self.connect((self.sss_ml_fd_0, 0), (self.wxgui_scopesink2_0_1, 0))
		self.connect((self.gr_deinterleave_0, 0), (self.gr_multiply_xx_1, 0))
コード例 #22
0
ファイル: sss_corr5_gui.py プロジェクト: gmg2719/gr-lte-1
    def __init__(self,
                 freq_corr=0,
                 avg_frames=1,
                 decim=16,
                 N_id_2=0,
                 N_id_1=134):
        grc_wxgui.top_block_gui.__init__(self, title="Sss Corr5 Gui")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Parameters
        ##################################################
        self.freq_corr = freq_corr
        self.avg_frames = avg_frames
        self.decim = decim
        self.N_id_2 = N_id_2
        self.N_id_1 = N_id_1

        ##################################################
        # Variables
        ##################################################
        self.vec_half_frame = vec_half_frame = 30720 * 5 / decim
        self.symbol_start = symbol_start = 144 / decim
        self.slot_0_10 = slot_0_10 = 1
        self.samp_rate = samp_rate = 30720e3 / decim
        self.rot = rot = 0
        self.noise_level = noise_level = 0
        self.fft_size = fft_size = 2048 / decim
        self.N_re = N_re = 62

        ##################################################
        # Blocks
        ##################################################
        _rot_sizer = wx.BoxSizer(wx.VERTICAL)
        self._rot_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            label='rot',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._rot_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_rot_sizer,
            value=self.rot,
            callback=self.set_rot,
            minimum=0,
            maximum=1,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_rot_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), "SSS ML")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS equ")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "SSS in")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "PSS equ")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "PSS ch est")
        self.notebook_0.AddPage(grc_wxgui.Panel(self.notebook_0), "foo")
        self.Add(self.notebook_0)
        _noise_level_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_level_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            label='noise_level',
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_level_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_level_sizer,
            value=self.noise_level,
            callback=self.set_noise_level,
            minimum=0,
            maximum=10,
            num_steps=100,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_level_sizer)
        self.wxgui_scopesink2_0_1_0_1 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(3).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=2,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(3).Add(self.wxgui_scopesink2_0_1_0_1.win)
        self.wxgui_scopesink2_0_1_0_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(2).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=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(2).Add(self.wxgui_scopesink2_0_1_0_0.win)
        self.wxgui_scopesink2_0_1_0 = scopesink2.scope_sink_c(
            self.notebook_0.GetPage(1).GetWin(),
            title="Scope Plot",
            sample_rate=samp_rate,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(1).Add(self.wxgui_scopesink2_0_1_0.win)
        self.wxgui_scopesink2_0_1 = scopesink2.scope_sink_f(
            self.notebook_0.GetPage(0).GetWin(),
            title="Scope Plot",
            sample_rate=100 / avg_frames,
            v_scale=0,
            v_offset=0,
            t_scale=0,
            ac_couple=False,
            xy_mode=False,
            num_inputs=1,
            trig_mode=gr.gr_TRIG_MODE_AUTO,
            y_axis_label="Counts",
        )
        self.notebook_0.GetPage(0).Add(self.wxgui_scopesink2_0_1.win)
        _symbol_start_sizer = wx.BoxSizer(wx.VERTICAL)
        self._symbol_start_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_symbol_start_sizer,
            value=self.symbol_start,
            callback=self.set_symbol_start,
            label='symbol_start',
            converter=forms.int_converter(),
            proportion=0,
        )
        self._symbol_start_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_symbol_start_sizer,
            value=self.symbol_start,
            callback=self.set_symbol_start,
            minimum=0,
            maximum=144 / decim,
            num_steps=144 / decim,
            style=wx.SL_HORIZONTAL,
            cast=int,
            proportion=1,
        )
        self.Add(_symbol_start_sizer)
        self.sss_ml_fd_0 = sss_ml_fd(
            decim=decim,
            avg_frames=avg_frames,
            N_id_1=N_id_1,
            N_id_2=N_id_2,
            slot_0_10=slot_0_10,
        )
        self.pss_chan_est2_0 = pss_chan_est2(N_id_2=N_id_2, )
        self.gr_vector_to_stream_0_0_1_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_1 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_vector_source_x_0_0_0 = gr.vector_source_c(
            (gen_pss_fd(N_id_2, N_re, False).get_data()), True, N_re)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_stream_to_vector_0_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, N_re)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(
            gr.sizeof_gr_complex * 1, fft_size)
        self.gr_stream_mux_0 = gr.stream_mux(gr.sizeof_gr_complex * 1,
                                             (N_re / 2, N_re / 2))
        self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex * 1)
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN,
                                                     noise_level, 0)
        self.gr_multiply_xx_1_0 = gr.multiply_vcc(N_re)
        self.gr_multiply_xx_1 = gr.multiply_vcc(N_re)
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc(
            (0.005 * exp(rot * 2 * numpy.pi * 1j), ))
        self.gr_keep_m_in_n_0_0 = gr.keep_m_in_n(gr.sizeof_gr_complex,
                                                 N_re / 2, fft_size,
                                                 (fft_size - N_re) / 2 - 1)
        self.gr_keep_m_in_n_0 = gr.keep_m_in_n(gr.sizeof_gr_complex, N_re / 2,
                                               fft_size, (fft_size) / 2)
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_gr_complex * 1,
            "/home/user/git/gr-lte/gr-lte/test/octave/foo_sss_td_in.cfile",
            True)
        self.gr_fft_vxx_0 = gr.fft_vcc(fft_size, True,
                                       (window.blackmanharris(1024)), True, 1)
        self.gr_deinterleave_0 = gr.deinterleave(gr.sizeof_gr_complex * N_re)
        self.gr_channel_model_0 = gr.channel_model(
            noise_voltage=0.005 * noise_level,
            frequency_offset=0.0,
            epsilon=1,
            taps=(0.005 * exp(rot * 2 * numpy.pi * 1j), ),
            noise_seed=0,
        )
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.blks2_selector_0_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=2,
            num_outputs=1,
            input_index=0,
            output_index=0,
        )
        self.blks2_selector_0 = grc_blks2.selector(
            item_size=gr.sizeof_gr_complex * 1,
            num_inputs=3,
            num_outputs=2,
            input_index=0,
            output_index=0,
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.blks2_selector_0, 0), (self.gr_channel_model_0, 0))
        self.connect((self.blks2_selector_0, 1), (self.gr_add_xx_0, 0))
        self.connect((self.gr_channel_model_0, 0),
                     (self.blks2_selector_0_0, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.blks2_selector_0_0, 1))
        self.connect((self.gr_file_source_0, 0), (self.blks2_selector_0, 0))
        self.connect((self.blks2_selector_0_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_deinterleave_0, 0),
                     (self.gr_vector_to_stream_0_0_0, 0))
        self.connect((self.gr_vector_to_stream_0_0_0, 0),
                     (self.wxgui_scopesink2_0_1_0_0, 0))
        self.connect((self.gr_vector_to_stream_0_0, 0),
                     (self.wxgui_scopesink2_0_1_0, 0))
        self.connect((self.gr_fft_vxx_0, 0), (self.gr_vector_to_stream_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.gr_keep_m_in_n_0, 0))
        self.connect((self.gr_stream_to_vector_0_0, 0),
                     (self.gr_deinterleave_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.gr_fft_vxx_0, 0))
        self.connect((self.gr_vector_to_stream_0_0_1, 0),
                     (self.wxgui_scopesink2_0_1_0_1, 0))
        self.connect((self.gr_vector_to_stream_0_0_1_0, 0),
                     (self.wxgui_scopesink2_0_1_0_1, 1))
        self.connect((self.gr_vector_source_x_0_0_0, 0),
                     (self.gr_vector_to_stream_0_0_1_0, 0))
        self.connect((self.pss_chan_est2_0, 0), (self.gr_multiply_xx_1, 1))
        self.connect((self.gr_multiply_xx_1, 0), (self.sss_ml_fd_0, 0))
        self.connect((self.gr_multiply_xx_1, 0),
                     (self.gr_vector_to_stream_0_0, 0))
        self.connect((self.pss_chan_est2_0, 0), (self.gr_multiply_xx_1_0, 0))
        self.connect((self.gr_deinterleave_0, 1), (self.gr_multiply_xx_1_0, 1))
        self.connect((self.gr_multiply_xx_1_0, 0),
                     (self.gr_vector_to_stream_0_0_1, 0))
        self.connect((self.gr_deinterleave_0, 1), (self.pss_chan_est2_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0),
                     (self.gr_keep_m_in_n_0_0, 0))
        self.connect((self.gr_keep_m_in_n_0_0, 0), (self.gr_stream_mux_0, 0))
        self.connect((self.gr_keep_m_in_n_0, 0), (self.gr_stream_mux_0, 1))
        self.connect((self.gr_stream_mux_0, 0),
                     (self.gr_stream_to_vector_0_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 1))
        self.connect((self.gr_null_source_0, 0), (self.blks2_selector_0, 2))
        self.connect((self.sss_ml_fd_0, 0), (self.wxgui_scopesink2_0_1, 0))
        self.connect((self.gr_deinterleave_0, 0), (self.gr_multiply_xx_1, 0))
コード例 #23
0
ファイル: gmsk_sim.py プロジェクト: sean-xia/Thesis
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="DVB Simulator (GMSK)")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

        ##################################################
        # Variables
        ##################################################
        self.signal = signal = 1
        self.samp_rate = samp_rate = 32000
        self.noise = noise = 10

        ##################################################
        # Blocks
        ##################################################
        _signal_sizer = wx.BoxSizer(wx.VERTICAL)
        self._signal_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            label="Signal",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._signal_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_signal_sizer,
            value=self.signal,
            callback=self.set_signal,
            minimum=0,
            maximum=1000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_signal_sizer)
        _noise_sizer = wx.BoxSizer(wx.VERTICAL)
        self._noise_text_box = forms.text_box(
            parent=self.GetWin(),
            sizer=_noise_sizer,
            value=self.noise,
            callback=self.set_noise,
            label="Noise",
            converter=forms.float_converter(),
            proportion=0,
        )
        self._noise_slider = forms.slider(
            parent=self.GetWin(),
            sizer=_noise_sizer,
            value=self.noise,
            callback=self.set_noise,
            minimum=0,
            maximum=1000,
            num_steps=1000,
            style=wx.SL_HORIZONTAL,
            cast=float,
            proportion=1,
        )
        self.Add(_noise_sizer)
        self.gr_wavfile_source_0 = gr.wavfile_source(
            "/home/traviscollins/GNURADIO/tfc_models/test.wav", False)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_float * 1, samp_rate)
        self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, noise, 42)
        self.gr_multiply_const_vxx_0 = gr.multiply_const_vcc((signal, ))
        self.gr_file_sink_1_0 = gr.file_sink(
            gr.sizeof_float * 1,
            "/home/traviscollins/GNURADIO/tfc_models/output_txt.wav")
        self.gr_file_sink_1_0.set_unbuffered(False)
        self.gr_channel_model_0 = gr.channel_model(
            noise_voltage=20,
            frequency_offset=0.0,
            epsilon=1.0,
            taps=(1.0 + 1.0j, ),
            noise_seed=42,
        )
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.digital_gmsk_mod_0 = digital.gmsk_mod(
            samples_per_symbol=2,
            bt=0.35,
            verbose=False,
            log=False,
        )
        self.digital_gmsk_demod_0 = digital.gmsk_demod(
            samples_per_symbol=2,
            gain_mu=0.175,
            mu=0.5,
            omega_relative_limit=0.005,
            freq_error=0.0,
            verbose=False,
            log=False,
        )
        self.blks2_packet_encoder_0 = grc_blks2.packet_mod_f(
            grc_blks2.packet_encoder(
                samples_per_symbol=2,
                bits_per_symbol=1,
                access_code="",
                pad_for_usrp=True,
            ),
            payload_length=0,
        )
        self.blks2_packet_decoder_0 = grc_blks2.packet_demod_f(
            grc_blks2.packet_decoder(
                access_code="",
                threshold=-1,
                callback=lambda ok, payload: self.blks2_packet_decoder_0.
                recv_pkt(ok, payload),
            ), )
        self.audio_sink_0 = audio.sink(samp_rate, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.digital_gmsk_demod_0, 0))
        self.connect((self.blks2_packet_encoder_0, 0),
                     (self.digital_gmsk_mod_0, 0))
        self.connect((self.digital_gmsk_mod_0, 0),
                     (self.gr_multiply_const_vxx_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.blks2_packet_encoder_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_file_sink_1_0, 0))
        self.connect((self.digital_gmsk_demod_0, 0),
                     (self.blks2_packet_decoder_0, 0))
        self.connect((self.gr_multiply_const_vxx_0, 0),
                     (self.gr_channel_model_0, 0))
        self.connect((self.gr_channel_model_0, 0), (self.gr_add_xx_0, 0))
        self.connect((self.gr_wavfile_source_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.blks2_packet_decoder_0, 0), (self.audio_sink_0, 0))
コード例 #24
0
ファイル: test_cpm.py プロジェクト: zimmerle/gnuradio
def run_test(seed, blocksize):
    tb = gr.top_block()

    ##################################################
    # Variables
    ##################################################
    M = 2
    K = 1
    P = 2
    h = (1.0 * K) / P
    L = 3
    Q = 4
    frac = 0.99
    f = trellis.fsm(P, M, L)

    # CPFSK signals
    #p = numpy.ones(Q)/(2.0)
    #q = numpy.cumsum(p)/(1.0*Q)

    # GMSK signals
    BT = 0.3
    tt = numpy.arange(0, L * Q) / (1.0 * Q) - L / 2.0
    #print tt
    p = (0.5 * scipy.stats.erfc(2 * math.pi * BT * (tt - 0.5) / math.sqrt(
        math.log(2.0)) / math.sqrt(2.0)) - 0.5 * scipy.stats.erfc(
            2 * math.pi * BT *
            (tt + 0.5) / math.sqrt(math.log(2.0)) / math.sqrt(2.0))) / 2.0
    p = p / sum(p) * Q / 2.0
    #print p
    q = numpy.cumsum(p) / Q
    q = q / q[-1] / 2.0
    #print q

    (f0T, SS, S, F, Sf, Ff,
     N) = fsm_utils.make_cpm_signals(K, P, M, L, q, frac)
    #print N
    #print Ff
    Ffa = numpy.insert(Ff, Q, numpy.zeros(N), axis=0)
    #print Ffa
    MF = numpy.fliplr(numpy.transpose(Ffa))
    #print MF
    E = numpy.sum(numpy.abs(Sf)**2, axis=0)
    Es = numpy.sum(E) / f.O()
    #print Es

    constellation = numpy.reshape(numpy.transpose(Sf), N * f.O())
    #print Ff
    #print Sf
    #print constellation
    #print numpy.max(numpy.abs(SS - numpy.dot(Ff , Sf)))

    EsN0_db = 10.0
    N0 = Es * 10.0**(-(1.0 * EsN0_db) / 10.0)
    #N0 = 0.0
    #print N0
    head = 4
    tail = 4
    numpy.random.seed(seed * 666)
    data = numpy.random.randint(0, M, head + blocksize + tail + 1)
    #data = numpy.zeros(blocksize+1+head+tail,'int')
    for i in range(head):
        data[i] = 0
    for i in range(tail + 1):
        data[-i] = 0

##################################################
# Blocks
##################################################
    random_source_x_0 = gr.vector_source_b(data.tolist(), False)
    gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1)
    gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p)
    gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2 * math.pi * h *
                                                            (1.0 / Q))

    gr_add_vxx_0 = gr.add_vcc(1)
    gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, (N0 / 2.0)**0.5,
                                            -long(seed))

    gr_multiply_vxx_0 = gr.multiply_vcc(1)
    gr_sig_source_x_0 = gr.sig_source_c(Q, gr.GR_COS_WAVE, -f0T, 1, 0)
    # only works for N=2, do it manually for N>2...
    gr_fir_filter_xxx_0_0 = gr.fir_filter_ccc(Q, MF[0].conjugate())
    gr_fir_filter_xxx_0_0_0 = gr.fir_filter_ccc(Q, MF[1].conjugate())
    gr_streams_to_stream_0 = gr.streams_to_stream(gr.sizeof_gr_complex * 1,
                                                  int(N))
    gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex * 1, int(N * (1 + 0)))
    viterbi = trellis.viterbi_combined_cb(f, head + blocksize + tail, 0, -1,
                                          int(N), constellation,
                                          digital.TRELLIS_EUCLIDEAN)

    gr_vector_sink_x_0 = gr.vector_sink_b()

    ##################################################
    # Connections
    ##################################################
    tb.connect((random_source_x_0, 0), (gr_chunks_to_symbols_xx_0, 0))
    tb.connect((gr_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0))
    tb.connect((gr_interp_fir_filter_xxx_0, 0),
               (gr_frequency_modulator_fc_0, 0))
    tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0))
    tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1))
    tb.connect((gr_add_vxx_0, 0), (gr_multiply_vxx_0, 0))
    tb.connect((gr_sig_source_x_0, 0), (gr_multiply_vxx_0, 1))
    tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0, 0))
    tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0_0, 0))
    tb.connect((gr_fir_filter_xxx_0_0, 0), (gr_streams_to_stream_0, 0))
    tb.connect((gr_fir_filter_xxx_0_0_0, 0), (gr_streams_to_stream_0, 1))
    tb.connect((gr_streams_to_stream_0, 0), (gr_skiphead_0, 0))
    tb.connect((gr_skiphead_0, 0), (viterbi, 0))
    tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0))

    tb.run()
    dataest = gr_vector_sink_x_0.data()
    #print data
    #print numpy.array(dataest)
    perr = 0
    err = 0
    for i in range(blocksize):
        if data[head + i] != dataest[head + i]:
            #print i
            err += 1
    if err != 0:
        perr = 1
    return (err, perr)
コード例 #25
0
    def __init__(
        self,
        vehicle_speed,
        carrier_freq,
        chan_rate,
        chan_seed,
        chan_pwrs,
        path_delays,
        flag_indep=False,
        flag_norm=True,
    ):
        gr.hier_block2.__init__(
            self,
            "multipath_rayleigh_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex * 1),
        )  # Output signature

        # Define blocks and connect them

        ##################################################
        # Parameters
        ##################################################
        self.vehicle_speed = vehicle_speed
        self.chan_rate = chan_rate
        self.carrier_freq = carrier_freq
        self.chan_pwrs = chan_pwrs
        self.path_delays_us = path_delays
        self.chan_seed = chan_seed
        self.mode = 1  # Enables fading for underlaying single path fading block

        # Checks that there is the same number of delays as there are powers.
        if len(self.chan_pwrs) != len(self.path_delays_us):
            raise ValueError, "The vector length of chan_pwrs does not match the vector length of path_delays."
            # Could this be improved?
            sys.exit(1)
            ##################################################
            # Constants
            ##################################################
            # Speed of light in km/h
        speed_of_light = 3e8 * 3.6

        ##################################################
        # Variables
        ##################################################
        # vehicle_speed (km/h), carrier_freq (Hz) and speed_of_light (km/h)
        # units: (km/h * Hz) / (km/h) = Hz.
        fd = (vehicle_speed * carrier_freq) / speed_of_light
        # channel rate in samples/micro-seconds
        chan_rate_us = chan_rate * 1e-6
        # stores the path delays translated from micro-seconds to
        # equivalent delays in samples (based on the channel rate)
        self.path_delays_samples = path_delays_samples = np.round(np.array(self.path_delays_us) * chan_rate_us)
        self.fD = fD = (((1.0 * vehicle_speed / 3.6) * carrier_freq) / 3e8) * (1.0 / chan_rate)
        print "self.fD =", self.fD

        # 'T' is the inverse channel rate.
        self.fdT = fd * (1.0 / chan_rate)
        # Testing only
        print "self.fdT = ", self.fdT

        # Warn the user of the limited channel delay resolution
        if chan_rate_us < 1:
            print "Warning: at a channel rate of ", chan_rate, " samples/s the delay resolution is ", 1.0 / chan_rate, "seconds"

        self.c2f_blks = []  # for list of gr.complex_to_float().
        self.delay_blks = []  # for list of gr.filter_delay_fc ().
        self.chan_blks = []  # for list of tait.flat_rayleigh_channel_cc().

        # For testing only
        print "path delays in samples ", self.path_delays_samples

        # Normalizes the channel powers if required
        if flag_norm is True:
            self.chan_pwrs = 1.0 * np.array(chan_pwrs) / np.sqrt((chan_pwrs ** 2).sum(-1))

            # Populate the lists above with the correct number of blocks.
        for i in range(len(self.path_delays_samples)):
            print "create delay block %d" % (i)

            # Delay block is required.
            self.delay_blks.append(gr.delay(gr.sizeof_gr_complex * 1, int(self.path_delays_samples[i])))

            self.chan_blks.append(
                rccBlocks.channelModel_cc(chan_seed + i, self.fdT, self.chan_pwrs[i], flag_indep, self.mode)
            )

        self.sum = gr.add_vcc(1)

        # Create multiple instances of the "src -> delay -> channel" connection.
        for i in range(len(self.chan_blks)):
            print i
            self.connect((self, 0), (self.chan_blks[i], 0))
            self.connect((self.chan_blks[i], 0), (self.delay_blks[i], 0))
            self.connect((self.delay_blks[i], 0), (self.sum, i))
            # self.connect( (self,0), (self.chan_blks[0],0) )
            # self.connect( (self.chan_blks[0],0), (self.delay_blks[0],0) )
            # self.connect( (self.delay_blks[0],0), (self, 0) )
        self.connect((self.sum, 0), (self, 0))
コード例 #26
0
	def __init__(self,vehicle_speed,carrier_freq,chan_rate,chan_seed,chan_pwrs,path_delays,flag_indep=False,flag_norm=True):
		gr.hier_block2.__init__(self,
		    "multipath_rayleigh_cc",
		    gr.io_signature(1, 1, gr.sizeof_gr_complex*1),  # Input signature
		    gr.io_signature(1, 1, gr.sizeof_gr_complex*1)) # Output signature

		    # Define blocks and connect them
            
		##################################################
		# Parameters
		##################################################
		self.vehicle_speed = vehicle_speed
		self.chan_rate = chan_rate
		self.carrier_freq = carrier_freq
		self.chan_pwrs = chan_pwrs
		self.path_delays_us = path_delays
		self.chan_seed = chan_seed
		self.mode = 1 #Enables fading for underlaying single path fading block
           
		# Checks that there is the same number of delays as there are powers.
		if len(self.chan_pwrs) != len(self.path_delays_us):
			raise ValueError, "The vector length of chan_pwrs does not match the vector length of path_delays."
			# Could this be improved?
			sys.exit(1)
		##################################################
		# Constants
		##################################################
		# Speed of light in km/h
		speed_of_light = 3e8 * 3.6
		
		##################################################
		# Variables
		##################################################
		# vehicle_speed (km/h), carrier_freq (Hz) and speed_of_light (km/h)
		# units: (km/h * Hz) / (km/h) = Hz. 
		fd = (vehicle_speed * carrier_freq) / speed_of_light
		# channel rate in samples/micro-seconds
		chan_rate_us = chan_rate * 1e-6
		# stores the path delays translated from micro-seconds to 
		# equivalent delays in samples (based on the channel rate)
		self.path_delays_samples = path_delays_samples = np.round(np.array(self.path_delays_us)*chan_rate_us)
		self.fD = fD = (((1.0*vehicle_speed/3.6)*carrier_freq)/3e8)*(1.0/chan_rate)
		print 'self.fD =', self.fD
		
		
		
		# 'T' is the inverse channel rate.
		self.fdT = fd * (1.0 / chan_rate)
		# Testing only
		print "self.fdT = ", self.fdT
		
		# Warn the user of the limited channel delay resolution
		if chan_rate_us < 1:
			print "Warning: at a channel rate of ", chan_rate, \
			" samples/s the delay resolution is ", 1.0/chan_rate, "seconds"
		
		self.c2f_blks = [] 		# for list of gr.complex_to_float().
		self.delay_blks = [] 	# for list of gr.filter_delay_fc ().
		self.chan_blks = [] 	# for list of tait.flat_rayleigh_channel_cc().
		
					
			
		# For testing only	
		print "path delays in samples ", self.path_delays_samples
		
		# Normalizes the channel powers if required
		if flag_norm is True:
			self.chan_pwrs = 1.0*np.array(chan_pwrs)/np.sqrt((chan_pwrs ** 2).sum(-1))
			
				
		# Populate the lists above with the correct number of blocks.
		for i in range (len(self.path_delays_samples)):
			print "create delay block %d" %(i)
			
			# Delay block is required.
			self.delay_blks.append(gr.delay(gr.sizeof_gr_complex*1, int(self.path_delays_samples[i])))
				
			self.chan_blks.append(rccBlocks.channelModel_cc(chan_seed + i, self.fdT, self.chan_pwrs[i], flag_indep,self.mode))
		
		
		self.sum = gr.add_vcc(1)  
		
		# Create multiple instances of the "src -> delay -> channel" connection.
		for i in range (len(self.chan_blks)):
			print i
			self.connect( (self,0), (self.chan_blks[i],0) )
			self.connect( (self.chan_blks[i],0), (self.delay_blks[i],0) )
			self.connect( (self.delay_blks[i],0), (self.sum, i) )
		#self.connect( (self,0), (self.chan_blks[0],0) )
		#self.connect( (self.chan_blks[0],0), (self.delay_blks[0],0) )
		#self.connect( (self.delay_blks[0],0), (self, 0) )	
		self.connect((self.sum, 0), (self,0) )         
コード例 #27
0
ファイル: benchmark_tx.py プロジェクト: jeztek/spectrum
    def __init__(self, modulator, options):
        gr.top_block.__init__(self)

        self.txpath = []
        use_sink = None
        if options.tx_freq is not None:
            # Work-around to get the modulation's bits_per_symbol
            args = modulator.extract_kwargs_from_options(options)
            symbol_rate = options.bitrate / modulator(**args).bits_per_symbol()

            self.sink = uhd_transmitter(
                options.args,
                symbol_rate,
                options.samples_per_symbol,
                options.tx_freq,
                options.tx_gain,
                options.spec,
                options.antenna,
                options.verbose,
            )
            sample_rate = self.sink.get_sample_rate()
            options.samples_per_symbol = self.sink._sps
            use_sink = self.sink
        elif options.to_file is not None:
            sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file)))
            self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
            self.throttle = gr.throttle(gr.sizeof_gr_complex * 1, options.file_samp_rate)
            self.connect(self.throttle, self.sink)
            use_sink = self.throttle
        else:
            sys.stderr.write("No sink defined, dumping samples to null sink.\n\n")
            self.sink = gr.null_sink(gr.sizeof_gr_complex)

        # do this after for any adjustments to the options that may
        # occur in the sinks (specifically the UHD sink)
        self.txpath.append(transmit_path(modulator, options))
        self.txpath.append(transmit_path(modulator, options))

        samp_rate = 0
        if options.tx_freq is not None:
            samp_rate = self.sink.get_sample_rate()
        else:
            samp_rate = options.file_samp_rate

        volume = options.split_amplitude
        band_transition = options.band_trans_width
        low_transition = options.low_trans_width
        guard_width = options.guard_width

        self.low_pass_filter_qv0 = gr.interp_fir_filter_ccf(
            2, firdes.low_pass(1, samp_rate, samp_rate / 4 - guard_width / 2, low_transition, firdes.WIN_HAMMING, 6.76)
        )
        self.freq_translate_qv0 = filter.freq_xlating_fir_filter_ccc(1, (options.num_taps,), samp_rate / 4, samp_rate)
        self.band_pass_filter_qv0 = gr.fir_filter_ccc(
            1,
            firdes.complex_band_pass(
                1, samp_rate, -samp_rate / 2 + guard_width, 0 - guard_width, band_transition, firdes.WIN_HAMMING, 6.76
            ),
        )

        self.low_pass_filter_qv1 = gr.interp_fir_filter_ccf(
            2, firdes.low_pass(1, samp_rate, samp_rate / 4 - guard_width / 2, low_transition, firdes.WIN_HAMMING, 6.76)
        )
        self.freq_translate_qv1 = filter.freq_xlating_fir_filter_ccc(1, (options.num_taps,), -samp_rate / 4, samp_rate)
        self.band_pass_filter_qv1 = gr.fir_filter_ccc(
            1,
            firdes.complex_band_pass(
                1, samp_rate, 0 + guard_width, samp_rate / 2 - guard_width, band_transition, firdes.WIN_HAMMING, 6.76
            ),
        )

        self.combiner = gr.add_vcc(1)
        self.volume_multiply = blocks.multiply_const_vcc((volume,))

        self.connect((self.txpath[0], 0), (self.low_pass_filter_qv0, 0))
        self.connect((self.txpath[1], 0), (self.low_pass_filter_qv1, 0))

        self.connect((self.low_pass_filter_qv0, 0), (self.freq_translate_qv0, 0))
        self.connect((self.freq_translate_qv0, 0), (self.band_pass_filter_qv0, 0))

        self.connect((self.low_pass_filter_qv1, 0), (self.freq_translate_qv1, 0))
        self.connect((self.freq_translate_qv1, 0), (self.band_pass_filter_qv1, 0))

        self.connect((self.band_pass_filter_qv0, 0), (self.combiner, 0))
        self.connect((self.band_pass_filter_qv1, 0), (self.combiner, 1))

        self.connect((self.combiner, 0), (self.volume_multiply, 0))

        self.connect(self.volume_multiply, use_sink)
コード例 #28
0
ファイル: top_block.py プロジェクト: travisfcollins/BLISS
    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
        self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

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

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0_0.win)
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
            self.GetWin(),
            baseband_freq=0,
            y_per_div=10,
            y_divs=10,
            ref_level=0,
            ref_scale=2.0,
            sample_rate=samp_rate,
            fft_size=1024,
            fft_rate=15,
            average=False,
            avg_alpha=None,
            title="FFT Plot",
            peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.random_source_x_0 = gr.vector_source_b(map(int, numpy.random.randint(0, 2, 1000)), True)
        self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex * 1, 512)
        self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex * 1, samp_rate)
        self.gr_sub_xx_0 = gr.sub_cc(512)
        self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex * 1, 512)
        self.gr_file_source_1 = gr.file_source(
            gr.sizeof_gr_complex * 512, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/hilbert.txt", True
        )
        self.gr_file_source_0 = gr.file_source(
            gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/INPUT.txt", True
        )
        self.gr_file_sink_0 = gr.file_sink(
            gr.sizeof_float * 1, "/home/traviscollins/git/BLISS/Matlab/Spectral_Subtraction/OUTPUT.txt"
        )
        self.gr_file_sink_0.set_unbuffered(False)
        self.gr_add_xx_0 = gr.add_vcc(1)
        self.fft_vxx_1 = fft.fft_vcc(512, False, (window.blackmanharris(1024)), True, 1)
        self.fft_vxx_0 = fft.fft_vcc(512, True, (window.blackmanharris(1024)), True, 1)
        self.digital_ofdm_mod_0 = grc_blks2.packet_mod_f(
            digital.ofdm_mod(
                options=grc_blks2.options(
                    modulation="bpsk",
                    fft_length=512,
                    occupied_tones=200,
                    cp_length=128,
                    pad_for_usrp=True,
                    log=None,
                    verbose=None,
                )
            ),
            payload_length=0,
        )
        self.digital_ofdm_demod_0 = grc_blks2.packet_demod_f(
            digital.ofdm_demod(
                options=grc_blks2.options(
                    modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, snr=10, log=None, verbose=None
                ),
                callback=lambda ok, payload: self.digital_ofdm_demod_0.recv_pkt(ok, payload),
            )
        )
        self.digital_dxpsk_mod_0 = digital.dbpsk_mod(
            samples_per_symbol=2, excess_bw=0.35, gray_coded=True, verbose=False, log=False
        )

        ##################################################
        # Connections
        ##################################################
        self.connect((self.gr_file_source_0, 0), (self.digital_ofdm_mod_0, 0))
        self.connect((self.digital_ofdm_demod_0, 0), (self.gr_file_sink_0, 0))
        self.connect((self.gr_stream_to_vector_0, 0), (self.fft_vxx_0, 0))
        self.connect((self.random_source_x_0, 0), (self.digital_dxpsk_mod_0, 0))
        self.connect((self.digital_ofdm_mod_0, 0), (self.gr_add_xx_0, 0))
        self.connect((self.digital_dxpsk_mod_0, 0), (self.gr_add_xx_0, 1))
        self.connect((self.gr_add_xx_0, 0), (self.gr_throttle_0, 0))
        self.connect((self.gr_throttle_0, 0), (self.gr_stream_to_vector_0, 0))
        self.connect((self.fft_vxx_0, 0), (self.gr_sub_xx_0, 0))
        self.connect((self.gr_file_source_1, 0), (self.gr_sub_xx_0, 1))
        self.connect((self.gr_vector_to_stream_0, 0), (self.digital_ofdm_demod_0, 0))
        self.connect((self.gr_vector_to_stream_0, 0), (self.wxgui_fftsink2_0, 0))
        self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0_0, 0))
        self.connect((self.gr_sub_xx_0, 0), (self.fft_vxx_1, 0))
        self.connect((self.fft_vxx_1, 0), (self.gr_vector_to_stream_0, 0))