Пример #1
0
    def __init__(self, fftl):
        """
        This hierarchical block has a complex input and complex output stream. The actual data remains unchanged.
        The N_id_2 or cell ID number is calculated.
        Based on the position of the PSS the frame structure is calculated on a half frame basis and tagged to the output stream together with N_id_2
        A tag with the slot number within a half frame is tagged at the beginning of every slot. (key = slot)
        A tag with the N_id_2 is tagged at the beginning of every half frame. (Corresponds to slot 0) (key = N_id_2)
        The input data must be tagged with information for symbols. (key = symbol)
        the tag propagation policy is set to TPP_DONT.
	    """
        gr.hier_block2.__init__(
            self,
            "hier_pss_sync_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        # This is a fixed value due to the fact that the PSS is always located at the 62 center carriers.
        N_rb_dl = 6

        self.tag = lte.pss_tagging_cc(fftl)

        self.sel = lte.pss_selector_cvc(fftl)
        self.fft = gr.fft_vcc(fftl, True, window.rectangular(fftl), False, 1)
        self.ext = lte.extract_occupied_tones_vcvc(N_rb_dl, fftl)
        self.calc = lte.pss_calc_vc(self.tag, self.sel, fftl)

        # Define blocks
        self.connect(self, self.tag, self)
        self.connect(self, self.sel, self.fft, self.ext, self.calc)
Пример #2
0
    def __init__(self, fftl):
        """
        This hierarchical block has a complex input and complex output stream. The actual data remains unchanged.
        The N_id_2 or cell ID number is calculated.
        Based on the position of the PSS the frame structure is calculated on a half frame basis and tagged to the output stream together with N_id_2
        A tag with the slot number within a half frame is tagged at the beginning of every slot. (key = slot)
        A tag with the N_id_2 is tagged at the beginning of every half frame. (Corresponds to slot 0) (key = N_id_2)
        The input data must be tagged with information for symbols. (key = symbol)
        the tag propagation policy is set to TPP_DONT.
	    """
        gr.hier_block2.__init__(self, "hier_pss_sync_cc",
				gr.io_signature(1,1, gr.sizeof_gr_complex),  # Input signature
				gr.io_signature(1,1, gr.sizeof_gr_complex)) # Output signature

        
        # This is a fixed value due to the fact that the PSS is always located at the 62 center carriers.
        N_rb_dl = 6;
        
        
        
        self.tag = lte.pss_tagging_cc(fftl)
        
        self.sel  = lte.pss_selector_cvc(fftl)
        self.fft  = gr.fft_vcc(fftl,True,window.rectangular(fftl),False,1)
        self.ext  = lte.extract_occupied_tones_vcvc(N_rb_dl,fftl)
        self.calc = lte.pss_calc_vc(self.tag,self.sel,fftl)
        
        # Define blocks
        self.connect(self, self.tag, self)
        self.connect(self, self.sel, self.fft, self.ext, self.calc)
Пример #3
0
    def __init__(self, samplerate, bits_per_sec, fftlen):
        gr.hier_block2.__init__(
            self,
            "gmsk_sync",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        #this is just the old square-and-fft method
        #ais.freqest is simply looking for peaks spaced bits-per-sec apart
        self.square = gr.multiply_cc(1)
        self.fftvect = gr.stream_to_vector(gr.sizeof_gr_complex, fftlen)
        self.fft = gr.fft_vcc(fftlen, True, window.rectangular(fftlen), True)
        self.freqest = ais.freqest(int(samplerate), int(bits_per_sec), fftlen)
        self.repeat = gr.repeat(gr.sizeof_float, fftlen)
        self.fm = gr.frequency_modulator_fc(-1.0 / (float(samplerate) /
                                                    (2 * pi)))
        self.mix = gr.multiply_cc(1)

        self.connect(self, (self.square, 0))
        self.connect(self, (self.square, 1))
        #this is the feedforward branch
        self.connect(self, (self.mix, 0))
        #this is the feedback branch
        self.connect(self.square, self.fftvect, self.fft, self.freqest,
                     self.repeat, self.fm, (self.mix, 1))
        #and this is the output
        self.connect(self.mix, self)
Пример #4
0
 def setUp (self):
     self.tb = gr.top_block ()
     
     #print os.getpid()
     #raw_input("Press the ANY key!")
     
     offset = 43223  #sample15 = 21839 #sample20 = 43223
     fftl = 512
     cell_id = 124
     N_rb_dl = 6
     
     
     mod=scipy.io.loadmat('/home/demel/exchange/matlab_test_first_freq.mat') 
     mat_u1=tuple(mod['test'].flatten())
     mat_d=range(len(mat_u1))
     for idx, val in enumerate(mat_u1):
         mat_d[idx]=val
     intu=tuple(mat_d[0:100000])
     
     
     self.src  = gr.vector_source_c(intu,False,1)
     self.tag  = lte_swig.tag_symbol_cc(offset,fftl)
     self.sel  = lte_swig.pss_selector_cvc(fftl)
     self.fft  = gr.fft_vcc(fftl,True,window.rectangular(fftl),False,1)
     self.ext  = lte_swig.extract_occupied_tones_vcvc(N_rb_dl,fftl)
     
     self.tagp = lte.pss_tagging_cc(fftl) # Dummy
     self.calc = lte.pss_calc_vc(self.tagp,self.sel,fftl)
     #self.snk = gr.vector_sink_c(fftl)
     
     self.tb.connect(self.src, self.tag, self.sel, self.fft, self.ext, self.calc)
Пример #5
0
    def setUp(self):
        self.tb = gr.top_block()

        #print os.getpid()
        #raw_input("Press the ANY key!")

        offset = 43223  #sample15 = 21839 #sample20 = 43223
        fftl = 512
        cell_id = 124
        N_rb_dl = 6

        mod = scipy.io.loadmat(
            '/home/demel/exchange/matlab_test_first_freq.mat')
        mat_u1 = tuple(mod['test'].flatten())
        mat_d = range(len(mat_u1))
        for idx, val in enumerate(mat_u1):
            mat_d[idx] = val
        intu = tuple(mat_d[0:100000])

        self.src = gr.vector_source_c(intu, False, 1)
        self.tag = lte_swig.tag_symbol_cc(offset, fftl)
        self.sel = lte_swig.pss_selector_cvc(fftl)
        self.fft = gr.fft_vcc(fftl, True, window.rectangular(fftl), False, 1)
        self.ext = lte_swig.extract_occupied_tones_vcvc(N_rb_dl, fftl)

        self.tagp = lte.pss_tagging_cc(fftl)  # Dummy
        self.calc = lte.pss_calc_vc(self.tagp, self.sel, fftl)
        #self.snk = gr.vector_sink_c(fftl)

        self.tb.connect(self.src, self.tag, self.sel, self.fft, self.ext,
                        self.calc)
Пример #6
0
    def __init__(self, fftl):
        """
        docstring
        """
        gr.hier_block2.__init__(
            self,
            "hier_sss_sync_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex),
        )  # Output signature

        self.message_port_register_hier_in("cell_id")
        # input goes into 2 blocks: selector and tagging
        # 2 parallel streams: main (all data) right into tagging, sss symbol -> fft -> extract -> calc sss
        # required blocks:
        # selector
        # fft
        # resize (extract)
        # calc sss
        # tagging

        # SSS selector block
        self.sel = lte_swig.sss_selector_cvc(fftl)

        # in this block N_rb_dl is fixed. SSS is always mapped to those carriers.
        N_rb_dl = 6

        # fft block and matching extract block
        # input : vector with size: gr_complex * fftl
        # output: vector with size: gr_complex * 12 * N_rb_dl
        self.fft = gr.fft_vcc(fftl, True, window.rectangular(fftl), False, 1)
        self.ext = lte_swig.extract_occupied_tones_vcvc(N_rb_dl, fftl)

        self.tag = lte_swig.sss_tagging_cc(fftl)
        # calc sink block, which sets some attributes of other blocks.
        # self.calc = lte_swig.sss_calc_vc(self.tag, daemon, fftl)
        self.calc = lte_swig.sss_calc_vc(self.tag, fftl)

        # Connect blocks
        self.connect(self, self.tag, self)
        self.connect(self, self.sel, self.fft, self.ext, self.calc)

        self.msg_connect(self.calc, "cell_id", self, "cell_id")
Пример #7
0
    def __init__(self, daemon, fftl):
        """
        docstring
        """
        gr.hier_block2.__init__(
            self,
            "hier_sss_sync_cc",
            gr.io_signature(1, 1, gr.sizeof_gr_complex),  # Input signature
            gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output signature

        # input goes into 2 blocks: selector and tagging
        # 2 parallel streams: main (all data) right into tagging, sss symbol -> fft -> extract -> calc sss
        # required blocks:
        # selector
        # fft
        # resize (extract)
        # calc sss
        # tagging

        # SSS selector block
        self.sel = lte_swig.sss_selector_cvc(fftl)

        # in this block N_rb_dl is fixed. SSS is always mapped to those carriers.
        N_rb_dl = 6

        # fft block and matching extract block
        # input : vector with size: gr_complex * fftl
        # output: vector with size: gr_complex * 12 * N_rb_dl
        self.fft = gr.fft_vcc(fftl, True, window.rectangular(fftl), False, 1)
        self.ext = lte_swig.extract_occupied_tones_vcvc(N_rb_dl, fftl)

        self.tag = lte_swig.sss_tagging_cc(fftl)
        # calc sink block, which sets some attributes of other blocks.
        self.calc = lte_swig.sss_calc_vci(self.tag, daemon, fftl)

        # Connect blocks
        self.connect(self, self.tag, self)
        self.connect(self, self.sel, self.fft, self.ext, self.calc)
Пример #8
0
    def __init__(self, samplerate, bits_per_sec, fftlen):
		gr.hier_block2.__init__(self, "gmsk_sync",
                                gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature

		#this is just the old square-and-fft method
		#ais.freqest is simply looking for peaks spaced bits-per-sec apart
		self.square = gr.multiply_cc(1)
		self.fftvect = gr.stream_to_vector(gr.sizeof_gr_complex, fftlen)
		self.fft = gr.fft_vcc(fftlen, True, window.rectangular(fftlen), True)
		self.freqest = ais.freqest(int(samplerate), int(bits_per_sec), fftlen)
		self.repeat = gr.repeat(gr.sizeof_float, fftlen)
		self.fm = gr.frequency_modulator_fc(-1.0/(float(samplerate)/(2*pi)))
		self.mix = gr.multiply_cc(1)

		self.connect(self, (self.square, 0))
		self.connect(self, (self.square, 1))
		#this is the feedforward branch
		self.connect(self, (self.mix, 0))
		#this is the feedback branch
		self.connect(self.square, self.fftvect, self.fft, self.freqest, self.repeat, self.fm, (self.mix, 1))
		#and this is the output
		self.connect(self.mix, self)
Пример #9
0
 def setUp (self):
     self.tb = gr.top_block ()
     
     #print os.getpid()
     #raw_input("Press the ANY key!")
     
     offset = 43223  #sample15 = 21839 #sample20 = 43223
     fftl = 512
     cell_id = 124
     N_rb_dl = 6
     
     intu = [1.0] * 100 * fftl        
     self.src  = gr.vector_source_c(intu,False,1)
     self.tag  = lte_swig.tag_symbol_cc(offset,fftl)
     self.sel  = lte_swig.pss_selector_cvc(fftl)
     self.fft  = gr.fft_vcc(fftl,True,window.rectangular(fftl),False,1)
     self.ext  = lte_swig.extract_occupied_tones_vcvc(N_rb_dl,fftl)
     
     self.tagp = lte.pss_tagging_cc(fftl) # Dummy
     self.calc = lte.pss_calc_vc(self.tagp,self.sel,fftl)
     #self.snk = gr.vector_sink_c(fftl)
     
     self.tb.connect(self.src, self.tag, self.sel, self.fft, self.ext, self.calc)
Пример #10
0
    def setUp(self):

        #print os.getpid()
        #raw_input("Press the ANY key to continue")
        setuptime = time.clock()

        self.tb = gr.top_block()

        print "\nqa_multi_block_test START"

        offset = 1133
        fftl = 512
        cell_id = 124
        N_rb_dl = 6
        I = 768
        D = 1000

        # This first part is for syncing!
        #self.src  = gr.vector_source_c(intu,False,1)

        infile1 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:48:19.dat'  # successful!
        infile2 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:48:07.dat'  # failed!
        infile3 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:46:30.dat'  # successful!
        infile4 = '/home/johannes/lte/data/Messung_LTE_2012-05-23_12:47:32.dat'  # successful!
        infile5 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:49:57.dat'  # successful!

        samps = (fftl * 7 * 2 * 10 + 10 * fftl) * 300 + offset
        input_file = infile3
        print input_file

        self.src = gr.file_source(gr.sizeof_gr_complex, input_file, False)
        self.resample = blks2.rational_resampler_ccc(I, D)

        self.head1 = gr.head(gr.sizeof_gr_complex, samps)
        #self.tag  = lte_swig.tag_symbol_cc(offset,fftl)
        self.sync = lte_swig.cp_time_freq_sync_cc(fftl)
        self.pss = lte.hier_pss_sync_cc(fftl)
        self.est = lte.hier_freq_estimate_cc(fftl)
        # This is the actual place to initialize self.sss
        # Nevertheless it it the last block to be initialized because it needs pointers to some others.
        # self.sss = lte.hier_sss_sync_cc(fftl)

        #This part does still process all data (more ore less)
        self.rcp = lte_swig.remove_cp_cvc(fftl)
        self.fft = gr.fft_vcc(fftl, True, window.rectangular(fftl), False, 1)
        self.ext = lte_swig.extract_occupied_tones_vcvc(N_rb_dl, fftl)

        self.eq = lte.linear_OFDM_estimator_hier_vcvc(N_rb_dl)  #cell_id,
        #self.eq.set_cell_id(cell_id)
        #self.sh1  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)
        #self.sh2  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)
        #self.sh3  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)

        # After the next block only the PBCH is processed!
        self.demux = lte_swig.pbch_demux_vcvc(N_rb_dl)  #cell_id,
        #self.demux.set_cell_id(cell_id)
        self.pd1 = lte_swig.pre_decoder_vcvc(1, 'tx_diversity')
        self.pd2 = lte_swig.pre_decoder_vcvc(2, 'tx_diversity')
        self.ldm1 = lte_swig.layer_demapper_vcvc(1, 'tx_diversity')
        self.ldm2 = lte_swig.layer_demapper_vcvc(2, 'tx_diversity')
        self.int = gr.interleave(240 * 8)
        self.dmd = lte_swig.qpsk_soft_demod_vcvf()
        self.ld = lte_swig.descrambling_vfvf()
        #self.ld.set_cell_id(cell_id)
        self.lru = lte_swig.rate_unmatch_vff()

        # After Viterbi decoding, only bits are processed!
        self.vit = lte.viterbi_vfvb()
        self.crc = lte_swig.crc_calculator_vbvb()
        self.mib = lte_swig.mib_unpack_vb()

        #############################################################
        # This last block is just a daemon to propagate the calculated cell id
        #############################################################

        self.daemon = lte.cell_id_daemon(self.eq.get_eq(), self.demux, self.ld)
        self.sss = lte.hier_sss_sync_cc(self.daemon, fftl)

        # declaration of additional sink blocks for tests
        #self.snk1 = gr.vector_sink_f(120)
        #self.snk2 = gr.vector_sink_b(40)

        # Connect all blocks together!
        self.tb.connect(self.src, self.resample, self.head1, self.sync,
                        self.pss, self.est, self.sss, self.rcp, self.fft,
                        self.ext, self.eq)  #

        self.tb.connect((self.eq, 0), (self.demux, 0))
        self.tb.connect((self.eq, 1), (self.demux, 1))
        self.tb.connect((self.eq, 2), (self.demux, 2))

        self.tb.connect((self.demux, 0), (self.pd1, 0))
        self.tb.connect((self.demux, 1), (self.pd1, 1))
        self.tb.connect((self.demux, 0), (self.pd2, 0))
        self.tb.connect((self.demux, 1), (self.pd2, 1))
        self.tb.connect((self.demux, 2), (self.pd2, 2))
        self.tb.connect(self.pd1, self.ldm1, (self.int, 0))
        self.tb.connect(self.pd2, self.ldm2, (self.int, 1))
        self.tb.connect(self.int, self.dmd, self.ld, self.lru, self.vit,
                        self.crc)
        self.tb.connect((self.crc, 0), (self.mib, 0))
        self.tb.connect((self.crc, 1), (self.mib, 1))

        # additional sink blocks for testing
        #self.tb.connect(self.lru,self.snk1)
        #self.tb.connect(self.vit,self.snk2)

        print "\n\nsetuptime = " + str(time.clock() - setuptime) + "\n\n"
Пример #11
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel

        parser = OptionParser(option_class=eng_option)
        parser.add_option(
            "-w",
            "--which",
            type="int",
            default=0,
            help="select which USRP (0, 1, ...) default is %default",
            metavar="NUM")
        parser.add_option(
            "-R",
            "--rx-subdev-spec",
            type="subdev",
            default=None,
            help=
            "select USRP Rx side A or B (default=first one with a daughterboard)"
        )
        parser.add_option("-A",
                          "--antenna",
                          default=None,
                          help="select Rx Antenna (only on RFX-series boards)")
        parser.add_option(
            "-d",
            "--decim",
            type="int",
            default=16,
            help="set fgpa decimation rate to DECIM [default=%default]")
        parser.add_option("-f",
                          "--freq",
                          type="eng_float",
                          default=None,
                          help="set frequency to FREQ",
                          metavar="FREQ")
        parser.add_option("-g",
                          "--gain",
                          type="eng_float",
                          default=None,
                          help="set gain in dB [default is midpoint]")
        parser.add_option("-8",
                          "--width-8",
                          action="store_true",
                          default=False,
                          help="Enable 8-bit samples across USB")
        parser.add_option("--no-hb",
                          action="store_true",
                          default=False,
                          help="don't use halfband filter in usrp")
        parser.add_option("-S",
                          "--oscilloscope",
                          action="store_true",
                          default=False,
                          help="Enable oscilloscope display")
        parser.add_option(
            "",
            "--avg-alpha",
            type="eng_float",
            default=1e-1,
            help="Set fftsink averaging factor, [default=%default]")
        parser.add_option("",
                          "--ref-scale",
                          type="eng_float",
                          default=13490.0,
                          help="Set dBFS=0dB input value, [default=%default]")
        parser.add_option("",
                          "--fft-size",
                          type="int",
                          default=512,
                          help="Set FFT frame size, [default=%default]")
        parser.add_option("-e",
                          "--order",
                          type="int",
                          default=4,
                          help="order of the AR filter for burg estimator")
        parser.add_option("",
                          "--shift-fft",
                          action="store_true",
                          default=True,
                          help="shift the DC carrier to the middle.")
        parser.add_option("-W",
                          "--waterfall",
                          action="store_true",
                          default=False,
                          help="Enable waterfall display")

        (options, args) = parser.parse_args()
        if len(args) != 0:
            parser.print_help()
            sys.exit(1)
        self.options = options
        self.show_debug_info = True

        # build the graph
        if options.no_hb or (options.decim < 8):
            #Min decimation of this firmware is 4.
            #contains 4 Rx paths without halfbands and 0 tx paths.
            self.fpga_filename = "std_4rx_0tx.rbf"
            self.u = usrp.source_c(which=options.which,
                                   decim_rate=options.decim,
                                   fpga_filename=self.fpga_filename)
        else:
            #Min decimation of standard firmware is 8.
            #standard fpga firmware "std_2rxhb_2tx.rbf"
            #contains 2 Rx paths with halfband filters and 2 tx paths (the default)
            self.u = usrp.source_c(which=options.which,
                                   decim_rate=options.decim)

        if options.rx_subdev_spec is None:
            options.rx_subdev_spec = pick_subdevice(self.u)
        self.u.set_mux(
            usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))

        if options.width_8:
            width = 8
            shift = 8
            format = self.u.make_format(width, shift)
            print "format =", hex(format)
            r = self.u.set_format(format)
            print "set_format =", r

        # determine the daughterboard subdevice we're using
        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)

        input_rate = self.u.adc_freq() / self.u.decim_rate()

        self.scope = fftsink2.fft_sink_c(panel,
                                         fft_size=options.fft_size,
                                         sample_rate=input_rate,
                                         ref_scale=options.ref_scale,
                                         ref_level=80,
                                         y_divs=20,
                                         avg_alpha=options.avg_alpha)

        toskip = 1

        self.head = gr.head(gr.sizeof_gr_complex,
                            (toskip + 1) * options.fft_size)
        self.skip = gr.skiphead(gr.sizeof_gr_complex,
                                toskip * options.fft_size)
        mywindow1 = window.hamming(options.fft_size)
        ma_len = 200
        overlap = 100
        self.welch = specest.welch(options.fft_size, overlap, ma_len, True,
                                   mywindow1)
        self.f2c = gr.float_to_complex(options.fft_size)
        mywindow2 = window.rectangular(options.fft_size)
        self.ifft = gr.fft_vcc(options.fft_size, False, mywindow2, True)
        self.v2s = gr.vector_to_stream(gr.sizeof_gr_complex, options.fft_size)
        self.connect(self.u, self.welch, self.f2c, self.ifft, self.v2s,
                     self.scope)

        self._build_gui(vbox)
        self._setup_events()

        # set initial values

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            g = self.subdev.gain_range()
            options.gain = float(g[0] + g[1]) / 2

        if options.freq is None:
            # if no freq was specified, use the mid-point
            r = self.subdev.freq_range()
            options.freq = float(r[0] + r[1]) / 2

        self.set_gain(options.gain)

        if options.antenna is not None:
            print "Selecting antenna %s" % (options.antenna, )
            self.subdev.select_rx_antenna(options.antenna)

        if self.show_debug_info:
            self.myform['decim'].set_value(self.u.decim_rate())
            self.myform['fs@usb'].set_value(self.u.adc_freq() /
                                            self.u.decim_rate())
            self.myform['dbname'].set_value(self.subdev.name())
            self.myform['baseband'].set_value(0)
            self.myform['ddc'].set_value(0)

        if not (self.set_freq(options.freq)):
            self._set_status_msg("Failed to set initial frequency")
Пример #12
0
	def __init__(self):
		gr.top_block.__init__(self, "LTE flowgraph")
		Qt.QWidget.__init__(self)
		self.setWindowTitle("LTE flowgraph")
		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.fftlen = fftlen = 512
		self.cpl0 = cpl0 = 160*fftlen/2048
		self.cpl = cpl = 144*fftlen/2048
		self.slotl = slotl = 7*fftlen+6*cpl+cpl0
		self.samp_rate = samp_rate = slotl/0.0005
		self.style = style = "tx_diversity"
		self.interp_val = interp_val = int(samp_rate/1e4)
		self.N_rb_dl = N_rb_dl = 6

		##################################################
		# Blocks
		##################################################
		self.eq = lte.linear_OFDM_equalizer_hier_vcvc(N_rb_dl)
		self.descr = lte.descrambling_vfvf()
		self.demux = lte.pbch_demux_vcvc(N_rb_dl)
		self.daemon = lte.cell_id_daemon(self.eq.eq, self.demux, self.descr)
		self.qtgui_sink_x_0 = qtgui.sink_c(
			1024, #fftsize
			firdes.WIN_BLACKMAN_hARRIS, #wintype
			0, #fc
			samp_rate, #bw
			"QT GUI Plot", #name
			True, #plotfreq
			True, #plotwaterfall
			True, #plottime
			True, #plotconst
		)
		self._qtgui_sink_x_0_win = sip.wrapinstance(self.qtgui_sink_x_0.pyqwidget(), Qt.QWidget)
		self.top_layout.addWidget(self._qtgui_sink_x_0_win)
		self.lte_viterbi_vfvb_0 = lte.viterbi_vfvb()
		self.lte_remove_cp_cvc_1 = lte.remove_cp_cvc(fftlen)
		self.lte_rate_unmatch_vff_0 = lte.rate_unmatch_vff()
		self.lte_qpsk_soft_demod_vcvf_0 = lte.qpsk_soft_demod_vcvf()
		self.lte_pss_sync_hier_cc_0 = lte.pss_sync_hier_cc(fftlen)
		self.lte_pre_decoder_vcvc_0_0 = lte.pre_decoder_vcvc(2, style)
		self.lte_pre_decoder_vcvc_0 = lte.pre_decoder_vcvc(1, style)
		self.lte_mib_unpack_vb_0 = lte.mib_unpack_vb()
		self.lte_layer_demapper_vcvc_0_0 = lte.layer_demapper_vcvc(2, style)
		self.lte_layer_demapper_vcvc_0 = lte.layer_demapper_vcvc(1, style)
		self.lte_hier_sss_sync_cc_0 = lte.hier_sss_sync_cc(self.daemon, fftlen)
		self.lte_hier_freq_estimate_cc_0 = lte.hier_freq_estimate_cc(fftlen)
		self.lte_extract_occupied_tones_vcvc_0 = lte.extract_occupied_tones_vcvc(N_rb_dl,fftlen)
		self.lte_crc_calculator_vbvb_0 = lte.crc_calculator_vbvb()
		self.lte_cp_time_freq_sync_cc_0 = lte.cp_time_freq_sync_cc(fftlen)
		self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, 240)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_interleave_0 = gr.interleave(gr.sizeof_gr_complex*240)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/demel/Dokumente/Messungen_31_10_2012/samples_12.5MSps_20dB.iq", False)
		self.fft_vxx_0 = fft.fft_vcc(fftlen, True, (window.rectangular(fftlen)), False, 1)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_ccc(
			interpolation=interp_val,
			decimation=1250,
			taps=None,
			fractional_bw=None,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.lte_hier_freq_estimate_cc_0, 0), (self.lte_hier_sss_sync_cc_0, 0))
		self.connect((self.lte_pss_sync_hier_cc_0, 0), (self.lte_hier_freq_estimate_cc_0, 0))
		self.connect((self.lte_cp_time_freq_sync_cc_0, 0), (self.lte_pss_sync_hier_cc_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.lte_cp_time_freq_sync_cc_0, 0))
		self.connect((self.lte_hier_sss_sync_cc_0, 0), (self.lte_remove_cp_cvc_1, 0))
		self.connect((self.fft_vxx_0, 0), (self.lte_extract_occupied_tones_vcvc_0, 0))
		self.connect((self.lte_remove_cp_cvc_1, 0), (self.fft_vxx_0, 0))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.eq, 0))
		self.connect((self.lte_pre_decoder_vcvc_0, 0), (self.lte_layer_demapper_vcvc_0, 0))
		self.connect((self.eq, 0), (self.demux, 0))
		self.connect((self.eq, 1), (self.demux, 1))
		self.connect((self.eq, 2), (self.demux, 2))
		self.connect((self.lte_pre_decoder_vcvc_0_0, 0), (self.lte_layer_demapper_vcvc_0_0, 0))
		self.connect((self.lte_layer_demapper_vcvc_0_0, 0), (self.gr_interleave_0, 1))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0_0, 1))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0, 1))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0, 0))
		self.connect((self.demux, 2), (self.lte_pre_decoder_vcvc_0_0, 2))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0_0, 0))
		self.connect((self.lte_qpsk_soft_demod_vcvf_0, 0), (self.descr, 0))
		self.connect((self.gr_interleave_0, 0), (self.lte_qpsk_soft_demod_vcvf_0, 0))
		self.connect((self.lte_layer_demapper_vcvc_0, 0), (self.gr_interleave_0, 0))
		self.connect((self.descr, 0), (self.lte_rate_unmatch_vff_0, 0))
		self.connect((self.lte_crc_calculator_vbvb_0, 1), (self.lte_mib_unpack_vb_0, 1))
		self.connect((self.lte_crc_calculator_vbvb_0, 0), (self.lte_mib_unpack_vb_0, 0))
		self.connect((self.lte_viterbi_vfvb_0, 0), (self.lte_crc_calculator_vbvb_0, 0))
		self.connect((self.lte_rate_unmatch_vff_0, 0), (self.lte_viterbi_vfvb_0, 0))
		self.connect((self.gr_interleave_0, 0), (self.gr_vector_to_stream_0, 0))
		self.connect((self.gr_vector_to_stream_0, 0), (self.qtgui_sink_x_0, 0))
Пример #13
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        self.frame = frame
        self.panel = panel
        
        parser = OptionParser(option_class=eng_option)
        parser.add_option("-w", "--which", type="int", default=0,
                          help="select which USRP (0, 1, ...) default is %default",
			  metavar="NUM")
        parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
                          help="select USRP Rx side A or B (default=first one with a daughterboard)")
        parser.add_option("-A", "--antenna", default=None,
                          help="select Rx Antenna (only on RFX-series boards)")
        parser.add_option("-d", "--decim", type="int", default=16,
                          help="set fgpa decimation rate to DECIM [default=%default]")
        parser.add_option("-f", "--freq", type="eng_float", default=None,
                          help="set frequency to FREQ", metavar="FREQ")
        parser.add_option("-g", "--gain", type="eng_float", default=None,
                          help="set gain in dB [default is midpoint]")
        parser.add_option("-8", "--width-8", action="store_true", default=False,
                          help="Enable 8-bit samples across USB")
        parser.add_option( "--no-hb", action="store_true", default=False,
                          help="don't use halfband filter in usrp")
        parser.add_option("-S", "--oscilloscope", action="store_true", default=False,
                          help="Enable oscilloscope display")
	parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1,
			  help="Set fftsink averaging factor, [default=%default]")
	parser.add_option("", "--ref-scale", type="eng_float", default=13490.0,
			  help="Set dBFS=0dB input value, [default=%default]")
        parser.add_option("", "--fft-size", type="int", default=512,
                          help="Set FFT frame size, [default=%default]");
	parser.add_option("-e", "--order", type="int", default=4,
                	  help="order of the AR filter for burg estimator")
	parser.add_option("", "--shift-fft", action="store_true", default=True,
                	  help="shift the DC carrier to the middle.")
        parser.add_option("-W", "--waterfall", action="store_true", default=False,
                          help="Enable waterfall display")

        (options, args) = parser.parse_args()
        if len(args) != 0:
            parser.print_help()
            sys.exit(1)
	self.options = options
        self.show_debug_info = True
        
        # build the graph
        if options.no_hb or (options.decim<8):
          #Min decimation of this firmware is 4. 
          #contains 4 Rx paths without halfbands and 0 tx paths.
          self.fpga_filename="std_4rx_0tx.rbf"
          self.u = usrp.source_c(which=options.which, decim_rate=options.decim, fpga_filename=self.fpga_filename)
        else:
          #Min decimation of standard firmware is 8. 
          #standard fpga firmware "std_2rxhb_2tx.rbf" 
          #contains 2 Rx paths with halfband filters and 2 tx paths (the default)
          self.u = usrp.source_c(which=options.which, decim_rate=options.decim)

        if options.rx_subdev_spec is None:
            options.rx_subdev_spec = pick_subdevice(self.u)
        self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))

        if options.width_8:
            width = 8
            shift = 8
            format = self.u.make_format(width, shift)
            print "format =", hex(format)
            r = self.u.set_format(format)
            print "set_format =", r
            
        # determine the daughterboard subdevice we're using
        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)

        input_rate = self.u.adc_freq() / self.u.decim_rate()

        self.scope = fftsink2.fft_sink_c (panel, fft_size=options.fft_size, sample_rate=input_rate, 
					      ref_scale=options.ref_scale, ref_level=80, y_divs = 20,
					      avg_alpha=options.avg_alpha)


	toskip = 1

	self.head = gr.head(gr.sizeof_gr_complex, (toskip+1)*options.fft_size)
	self.skip = gr.skiphead(gr.sizeof_gr_complex, toskip*options.fft_size)
	mywindow1 = window.hamming(options.fft_size)
	ma_len = 200
	overlap = 100
	self.welch = specest.welch (options.fft_size, overlap, ma_len, True, mywindow1)
	self.f2c = gr.float_to_complex(options.fft_size)
	mywindow2 = window.rectangular(options.fft_size)
	self.ifft = gr.fft_vcc(options.fft_size, False, mywindow2, True)
	self.v2s = gr.vector_to_stream(gr.sizeof_gr_complex, options.fft_size)
        self.connect(self.u, self.welch, self.f2c, self.ifft, self.v2s, self.scope)

        self._build_gui(vbox)
	self._setup_events()
	
        # set initial values

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            g = self.subdev.gain_range()
            options.gain = float(g[0]+g[1])/2

        if options.freq is None:
            # if no freq was specified, use the mid-point
            r = self.subdev.freq_range()
            options.freq = float(r[0]+r[1])/2

        self.set_gain(options.gain)

	if options.antenna is not None:
            print "Selecting antenna %s" % (options.antenna,)
            self.subdev.select_rx_antenna(options.antenna)

        if self.show_debug_info:
            self.myform['decim'].set_value(self.u.decim_rate())
            self.myform['fs@usb'].set_value(self.u.adc_freq() / self.u.decim_rate())
            self.myform['dbname'].set_value(self.subdev.name())
            self.myform['baseband'].set_value(0)
            self.myform['ddc'].set_value(0)

        if not(self.set_freq(options.freq)):
            self._set_status_msg("Failed to set initial frequency")
Пример #14
0
	def __init__(self):
		gr.top_block.__init__(self, "LTE flowgraph")

		##################################################
		# Variables
		##################################################
		self.fftlen = fftlen = 2048
		self.cpl0 = cpl0 = 160*fftlen/2048
		self.cpl = cpl = 144*fftlen/2048
		self.slotl = slotl = 7*fftlen+6*cpl+cpl0
		self.samp_rate = samp_rate = slotl/0.0005
		self.style = style = "tx_diversity"
		self.interp_val = interp_val = int(samp_rate/1e4)
		self.N_rb_dl = N_rb_dl = 6

		##################################################
		# Blocks
		##################################################
		self.lte_viterbi_vfvb_0 = lte.viterbi_vfvb()
		self.lte_remove_cp_cvc_1 = lte.remove_cp_cvc(fftlen)
		self.lte_rate_unmatch_vff_0 = lte.rate_unmatch_vff()
		self.lte_qpsk_soft_demod_vcvf_0 = lte.qpsk_soft_demod_vcvf()
		self.lte_pre_decoder_vcvc_0_0 = lte.pre_decoder_vcvc(2, style)
		self.lte_pre_decoder_vcvc_0 = lte.pre_decoder_vcvc(1, style)
		self.lte_mib_unpack_vb_0 = lte.mib_unpack_vb()
		self.lte_layer_demapper_vcvc_0_0 = lte.layer_demapper_vcvc(2, style)
		self.lte_layer_demapper_vcvc_0 = lte.layer_demapper_vcvc(1, style)
		self.lte_hier_sss_sync_cc_1 = lte.hier_sss_sync_cc(fftlen)
		self.lte_hier_pss_sync_cc_0 = lte.hier_pss_sync_cc(fftlen)
		self.lte_hier_freq_estimate_cc_0 = lte.hier_freq_estimate_cc(fftlen)
		self.lte_extract_occupied_tones_vcvc_0 = lte.extract_occupied_tones_vcvc(N_rb_dl,fftlen)
		self.lte_crc_calculator_vbvb_0 = lte.crc_calculator_vbvb()
		self.lte_cp_time_freq_sync_cc_0 = lte.cp_time_freq_sync_cc(fftlen)
		self.lte_channel_estimator_0 = lte.channel_estimator(N_rb_dl)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate/4)
		self.gr_interleave_0 = gr.interleave(gr.sizeof_gr_complex*240)
		self.gr_file_source_0_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/demel/gr-lte/data/Messung_Resampled_3072MSps.dat", False)
		self.fft_vxx_0 = fft.fft_vcc(fftlen, True, (window.rectangular(fftlen)), False, 1)
		self.descr = lte.descrambling_vfvf()
		self.demux = lte.pbch_demux_vcvc(N_rb_dl)

		##################################################
		# Connections
		##################################################
		self.connect((self.lte_cp_time_freq_sync_cc_0, 0), (self.lte_hier_pss_sync_cc_0, 0))
		self.connect((self.lte_hier_pss_sync_cc_0, 0), (self.lte_hier_freq_estimate_cc_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.lte_cp_time_freq_sync_cc_0, 0))
		self.connect((self.gr_file_source_0_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.fft_vxx_0, 0), (self.lte_extract_occupied_tones_vcvc_0, 0))
		self.connect((self.lte_remove_cp_cvc_1, 0), (self.fft_vxx_0, 0))
		self.connect((self.descr, 0), (self.lte_rate_unmatch_vff_0, 0))
		self.connect((self.lte_qpsk_soft_demod_vcvf_0, 0), (self.descr, 0))
		self.connect((self.demux, 2), (self.lte_pre_decoder_vcvc_0_0, 2))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0_0, 1))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0_0, 0))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0, 1))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0, 0))
		self.connect((self.lte_channel_estimator_0, 2), (self.demux, 2))
		self.connect((self.lte_channel_estimator_0, 1), (self.demux, 1))
		self.connect((self.lte_channel_estimator_0, 0), (self.demux, 0))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.lte_channel_estimator_0, 0))
		self.connect((self.lte_rate_unmatch_vff_0, 0), (self.lte_viterbi_vfvb_0, 0))
		self.connect((self.lte_viterbi_vfvb_0, 0), (self.lte_crc_calculator_vbvb_0, 0))
		self.connect((self.lte_crc_calculator_vbvb_0, 0), (self.lte_mib_unpack_vb_0, 0))
		self.connect((self.lte_crc_calculator_vbvb_0, 1), (self.lte_mib_unpack_vb_0, 1))
		self.connect((self.lte_layer_demapper_vcvc_0, 0), (self.gr_interleave_0, 0))
		self.connect((self.gr_interleave_0, 0), (self.lte_qpsk_soft_demod_vcvf_0, 0))
		self.connect((self.lte_layer_demapper_vcvc_0_0, 0), (self.gr_interleave_0, 1))
		self.connect((self.lte_pre_decoder_vcvc_0_0, 0), (self.lte_layer_demapper_vcvc_0_0, 0))
		self.connect((self.lte_pre_decoder_vcvc_0, 0), (self.lte_layer_demapper_vcvc_0, 0))
		self.connect((self.lte_hier_freq_estimate_cc_0, 0), (self.lte_hier_sss_sync_cc_1, 0))
		self.connect((self.lte_hier_sss_sync_cc_1, 0), (self.lte_remove_cp_cvc_1, 0))

		##################################################
		# Asynch Message Connections
		##################################################
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.demux, "cell_id")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.descr, "cell_id")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_channel_estimator_0, "cell_id")
Пример #15
0
	def __init__(self):
		gr.top_block.__init__(self, "LTE flowgraph")
		Qt.QWidget.__init__(self)
		self.setWindowTitle("LTE flowgraph")
		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.fft_len = fft_len = 2048
		self.cpl0 = cpl0 = 160*fft_len/2048
		self.cpl = cpl = 144*fft_len/2048
		self.cell_id = cell_id = 364
		self.N_rb_dl = N_rb_dl = 50
		self.slotl = slotl = 7*fft_len+6*cpl+cpl0
		self.frame_pilots_1 = frame_pilots_1 = lte.frame_pilot_value_and_position(N_rb_dl, cell_id, 1, 1)
		self.frame_pilots_0 = frame_pilots_0 = lte.frame_pilot_value_and_position(N_rb_dl, cell_id, 1, 0)
		self.tag_key = tag_key = "symbol"
		self.samp_rate = samp_rate = int(slotl/0.0005)
		self.pilot_symbols = pilot_symbols = frame_pilots_0[1]
		self.pilot_carriers_p1 = pilot_carriers_p1 = frame_pilots_1[0]
		self.pilot_carriers_p0 = pilot_carriers_p0 = frame_pilots_0[0]

		##################################################
		# Blocks
		##################################################
		self.lte_source_c_0 = lte_source_c(
			samp_rate=samp_rate,
		)
		self.lte_remove_cp_cvc_0 = lte.remove_cp_cvc(fft_len, tag_key)
		self.lte_pbch_demux_vcvc_1 = lte.pbch_demux_vcvc(N_rb_dl)
		self.lte_mib_unpack_vb_0 = lte.mib_unpack_vb()
		self.lte_hier_sss_sync_cc_1 = lte.hier_sss_sync_cc(fft_len)
		self.lte_hier_pss_sync_cc_0 = lte.hier_pss_sync_cc(fft_len)
		self.lte_hier_freq_estimate_cc_0 = lte.hier_freq_estimate_cc(fft_len)
		self.lte_extract_occupied_tones_vcvc_0 = lte.extract_occupied_tones_vcvc(N_rb_dl,fft_len)
		self.lte_estimator_parameterizer_msg_0_0 = lte.estimator_parameterizer_msg("cell_id", "pilots", N_rb_dl, 1)
		self.lte_estimator_parameterizer_msg_0 = lte.estimator_parameterizer_msg("cell_id", "pilots", N_rb_dl, 0)
		self.lte_decode_pcfich_vcm_0 = lte.decode_pcfich_vcm(N_rb_dl, tag_key, "subframe", "cell_id", "N_ant", "CFI")
		self.lte_decode_pbch_vcvf_0 = lte.decode_pbch_vcvf()
		self.lte_decode_bch_hier_0 = lte_decode_bch_hier()
		self.lte_cp_time_freq_sync_cc_0 = lte.cp_time_freq_sync_cc(fft_len)
		self.lte_channel_estimator_ant_1 = lte.channel_estimator_vcvc(12*N_rb_dl, tag_key, "pilots", pilot_carriers_p1, pilot_symbols)
		self.lte_channel_estimator_ant_0 = lte.channel_estimator_vcvc(12*N_rb_dl, tag_key, "pilots", pilot_carriers_p0, pilot_symbols)
		self.fft_vxx_0 = fft.fft_vcc(fft_len, True, (window.rectangular(fft_len)), False, 1)

		##################################################
		# Connections
		##################################################
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.lte_pbch_demux_vcvc_1, 0))
		self.connect((self.fft_vxx_0, 0), (self.lte_extract_occupied_tones_vcvc_0, 0))
		self.connect((self.lte_hier_freq_estimate_cc_0, 0), (self.lte_hier_sss_sync_cc_1, 0))
		self.connect((self.lte_pbch_demux_vcvc_1, 1), (self.lte_decode_pbch_vcvf_0, 1))
		self.connect((self.lte_pbch_demux_vcvc_1, 2), (self.lte_decode_pbch_vcvf_0, 2))
		self.connect((self.lte_remove_cp_cvc_0, 0), (self.fft_vxx_0, 0))
		self.connect((self.lte_hier_sss_sync_cc_1, 0), (self.lte_remove_cp_cvc_0, 0))
		self.connect((self.lte_hier_pss_sync_cc_0, 0), (self.lte_hier_freq_estimate_cc_0, 0))
		self.connect((self.lte_cp_time_freq_sync_cc_0, 0), (self.lte_hier_pss_sync_cc_0, 0))
		self.connect((self.lte_pbch_demux_vcvc_1, 0), (self.lte_decode_pbch_vcvf_0, 0))
		self.connect((self.lte_source_c_0, 0), (self.lte_cp_time_freq_sync_cc_0, 0))
		self.connect((self.lte_decode_pbch_vcvf_0, 0), (self.lte_decode_bch_hier_0, 0))
		self.connect((self.lte_decode_bch_hier_0, 0), (self.lte_mib_unpack_vb_0, 0))
		self.connect((self.lte_decode_bch_hier_0, 1), (self.lte_mib_unpack_vb_0, 1))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.lte_channel_estimator_ant_0, 0))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.lte_channel_estimator_ant_1, 0))
		self.connect((self.lte_channel_estimator_ant_0, 0), (self.lte_pbch_demux_vcvc_1, 1))
		self.connect((self.lte_channel_estimator_ant_1, 0), (self.lte_pbch_demux_vcvc_1, 2))
		self.connect((self.lte_channel_estimator_ant_0, 0), (self.lte_decode_pcfich_vcm_0, 1))
		self.connect((self.lte_channel_estimator_ant_1, 0), (self.lte_decode_pcfich_vcm_0, 2))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.lte_decode_pcfich_vcm_0, 0))

		##################################################
		# Asynch Message Connections
		##################################################
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_pbch_demux_vcvc_1, "cell_id")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_decode_pbch_vcvf_0, "cell_id")
		self.msg_connect(self.lte_estimator_parameterizer_msg_0, "pilots", self.lte_channel_estimator_ant_0, "pilots")
		self.msg_connect(self.lte_estimator_parameterizer_msg_0_0, "pilots", self.lte_channel_estimator_ant_1, "pilots")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_estimator_parameterizer_msg_0, "cell_id")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_estimator_parameterizer_msg_0_0, "cell_id")
		self.msg_connect(self.lte_hier_sss_sync_cc_1, "cell_id", self.lte_decode_pcfich_vcm_0, "cell_id")
		self.msg_connect(self.lte_mib_unpack_vb_0, "N_ant", self.lte_decode_pcfich_vcm_0, "N_ant")
Пример #16
0
    def setUp (self):
    
        #print os.getpid()
        #raw_input("Press the ANY key to continue")
        setuptime = time.clock()
    
        self.tb = gr.top_block ()
        
        print "\nqa_multi_block_test START"
 

        offset =  1133
        fftl = 512
        cell_id = 124
        N_rb_dl = 6
        I = 768
        D = 1000

        # This first part is for syncing!
        #self.src  = gr.vector_source_c(intu,False,1)
        
        infile1 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:48:19.dat' # successful!
        infile2 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:48:07.dat' # failed!
        infile3 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:46:30.dat' # successful!
        infile4 = '/home/johannes/lte/data/Messung_LTE_2012-05-23_12:47:32.dat' # successful!
        infile5 = '/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:49:57.dat' # successful!
        
        samps = (fftl*7*2*10+10*fftl)*300 +offset
        input_file = infile3
        print input_file
        
        self.src = gr.file_source(gr.sizeof_gr_complex,input_file, False)
        self.resample = blks2.rational_resampler_ccc(I, D)
        
        self.head1 = gr.head(gr.sizeof_gr_complex, samps)
        #self.tag  = lte_swig.tag_symbol_cc(offset,fftl)
        self.sync = lte_swig.cp_time_freq_sync_cc(fftl)
        self.pss = lte.hier_pss_sync_cc(fftl)
        self.est = lte.hier_freq_estimate_cc(fftl)
        # This is the actual place to initialize self.sss
        # Nevertheless it it the last block to be initialized because it needs pointers to some others.
        # self.sss = lte.hier_sss_sync_cc(fftl)
        
        #This part does still process all data (more ore less)
        self.rcp  = lte_swig.remove_cp_cvc(fftl)        
        self.fft  = gr.fft_vcc(fftl,True,window.rectangular(fftl),False,1)
        self.ext  = lte_swig.extract_occupied_tones_vcvc(N_rb_dl,fftl)
        
        self.eq   = lte.linear_OFDM_estimator_hier_vcvc(N_rb_dl)#cell_id,
        #self.eq.set_cell_id(cell_id)
        #self.sh1  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)
        #self.sh2  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)
        #self.sh3  = gr.skiphead(gr.sizeof_gr_complex*12*N_rb_dl,7)
        
        # After the next block only the PBCH is processed!
        self.demux= lte_swig.pbch_demux_vcvc(N_rb_dl)#cell_id,
        #self.demux.set_cell_id(cell_id)
        self.pd1  = lte_swig.pre_decoder_vcvc(1,'tx_diversity')
        self.pd2  = lte_swig.pre_decoder_vcvc(2,'tx_diversity')
        self.ldm1 = lte_swig.layer_demapper_vcvc(1,'tx_diversity')
        self.ldm2 = lte_swig.layer_demapper_vcvc(2,'tx_diversity')
        self.int  = gr.interleave(240*8)
        self.dmd  = lte_swig.qpsk_soft_demod_vcvf()
       	self.ld   = lte_swig.descrambling_vfvf()
       	#self.ld.set_cell_id(cell_id)
        self.lru  = lte_swig.rate_unmatch_vff()
        

        # After Viterbi decoding, only bits are processed!
        self.vit  = lte.viterbi_vfvb()
        self.crc  = lte_swig.crc_calculator_vbvb()
        self.mib  = lte_swig.mib_unpack_vb()
        
        #############################################################
        # This last block is just a daemon to propagate the calculated cell id
        #############################################################
        
        self.daemon = lte.cell_id_daemon(self.eq.get_eq(),self.demux, self.ld)
        self.sss = lte.hier_sss_sync_cc(self.daemon, fftl)
        
        # declaration of additional sink blocks for tests
        #self.snk1 = gr.vector_sink_f(120)
        #self.snk2 = gr.vector_sink_b(40)
        
        
        # Connect all blocks together!
        self.tb.connect(self.src,self.resample,self.head1,self.sync,self.pss,self.est,self.sss,self.rcp,self.fft,self.ext,self.eq)#
        
        self.tb.connect( (self.eq,0), (self.demux,0) )
        self.tb.connect( (self.eq,1), (self.demux,1) )
        self.tb.connect( (self.eq,2), (self.demux,2) )
        
        self.tb.connect( (self.demux,0) ,(self.pd1,0) )
        self.tb.connect( (self.demux,1) ,(self.pd1,1) )
        self.tb.connect( (self.demux,0) ,(self.pd2,0) )
        self.tb.connect( (self.demux,1) ,(self.pd2,1) )
        self.tb.connect( (self.demux,2) ,(self.pd2,2) )
        self.tb.connect(self.pd1,self.ldm1,(self.int,0) )
        self.tb.connect(self.pd2,self.ldm2,(self.int,1) )
        self.tb.connect(self.int,self.dmd,self.ld,self.lru,self.vit,self.crc)
        self.tb.connect( (self.crc,0),(self.mib,0) )
        self.tb.connect( (self.crc,1),(self.mib,1) )
        
        # additional sink blocks for testing
        #self.tb.connect(self.lru,self.snk1)
        #self.tb.connect(self.vit,self.snk2)
        
        print "\n\nsetuptime = " + str(time.clock() - setuptime) + "\n\n"
Пример #17
0
	def __init__(self):
		gr.top_block.__init__(self, "LTE flowgraph")

		##################################################
		# Variables
		##################################################
		self.fftlen = fftlen = 2048
		self.cpl0 = cpl0 = 160*fftlen/2048
		self.cpl = cpl = 144*fftlen/2048
		self.slotl = slotl = 7*fftlen+6*cpl+cpl0
		self.samp_rate = samp_rate = slotl/0.0005
		self.style = style = "tx_diversity"
		self.interp_val = interp_val = int(samp_rate/1e4)
		self.N_rb_dl = N_rb_dl = 6

		##################################################
		# Blocks
		##################################################
		self.eq = lte.linear_OFDM_estimator_hier_vcvc(N_rb_dl)
		self.descr = lte.descrambling_vfvf()
		self.demux = lte.pbch_demux_vcvc(N_rb_dl)
		self.daemon = lte.cell_id_daemon(self.eq.eq, self.demux, self.descr)
		self.lte_viterbi_vfvb_0 = lte.viterbi_vfvb()
		self.lte_remove_cp_cvc_1 = lte.remove_cp_cvc(fftlen)
		self.lte_rate_unmatch_vff_0 = lte.rate_unmatch_vff()
		self.lte_qpsk_soft_demod_vcvf_0 = lte.qpsk_soft_demod_vcvf()
		self.lte_pre_decoder_vcvc_0_0 = lte.pre_decoder_vcvc(2, style)
		self.lte_pre_decoder_vcvc_0 = lte.pre_decoder_vcvc(1, style)
		self.lte_mib_unpack_vb_0 = lte.mib_unpack_vb()
		self.lte_layer_demapper_vcvc_0_0 = lte.layer_demapper_vcvc(2, style)
		self.lte_layer_demapper_vcvc_0 = lte.layer_demapper_vcvc(1, style)
		self.lte_hier_sss_sync_cc_0 = lte.hier_sss_sync_cc(self.daemon, fftlen)
		self.lte_hier_pss_sync_cc_0 = lte.hier_pss_sync_cc(fftlen)
		self.lte_hier_freq_estimate_cc_0 = lte.hier_freq_estimate_cc(fftlen)
		self.lte_extract_occupied_tones_vcvc_0 = lte.extract_occupied_tones_vcvc(N_rb_dl,fftlen)
		self.lte_crc_calculator_vbvb_0 = lte.crc_calculator_vbvb()
		self.lte_cp_time_freq_sync_cc_0 = lte.cp_time_freq_sync_cc(fftlen)
		self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, samp_rate)
		self.gr_interleave_0 = gr.interleave(gr.sizeof_gr_complex*240)
		self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, "/home/demel/Dokumente/Messungen/Messung_LTE_2012-05-23_12:47:32.dat", False)
		self.fft_vxx_0 = fft.fft_vcc(fftlen, True, (window.rectangular(fftlen)), False, 1)
		self.blks2_rational_resampler_xxx_0 = blks2.rational_resampler_ccc(
			interpolation=interp_val,
			decimation=1000,
			taps=None,
			fractional_bw=None,
		)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_file_source_0, 0), (self.blks2_rational_resampler_xxx_0, 0))
		self.connect((self.blks2_rational_resampler_xxx_0, 0), (self.gr_throttle_0, 0))
		self.connect((self.lte_hier_freq_estimate_cc_0, 0), (self.lte_hier_sss_sync_cc_0, 0))
		self.connect((self.gr_throttle_0, 0), (self.lte_cp_time_freq_sync_cc_0, 0))
		self.connect((self.lte_hier_sss_sync_cc_0, 0), (self.lte_remove_cp_cvc_1, 0))
		self.connect((self.fft_vxx_0, 0), (self.lte_extract_occupied_tones_vcvc_0, 0))
		self.connect((self.lte_remove_cp_cvc_1, 0), (self.fft_vxx_0, 0))
		self.connect((self.lte_pre_decoder_vcvc_0, 0), (self.lte_layer_demapper_vcvc_0, 0))
		self.connect((self.lte_pre_decoder_vcvc_0_0, 0), (self.lte_layer_demapper_vcvc_0_0, 0))
		self.connect((self.lte_layer_demapper_vcvc_0_0, 0), (self.gr_interleave_0, 1))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0_0, 1))
		self.connect((self.demux, 1), (self.lte_pre_decoder_vcvc_0, 1))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0, 0))
		self.connect((self.demux, 2), (self.lte_pre_decoder_vcvc_0_0, 2))
		self.connect((self.demux, 0), (self.lte_pre_decoder_vcvc_0_0, 0))
		self.connect((self.lte_qpsk_soft_demod_vcvf_0, 0), (self.descr, 0))
		self.connect((self.gr_interleave_0, 0), (self.lte_qpsk_soft_demod_vcvf_0, 0))
		self.connect((self.lte_layer_demapper_vcvc_0, 0), (self.gr_interleave_0, 0))
		self.connect((self.descr, 0), (self.lte_rate_unmatch_vff_0, 0))
		self.connect((self.lte_crc_calculator_vbvb_0, 1), (self.lte_mib_unpack_vb_0, 1))
		self.connect((self.lte_crc_calculator_vbvb_0, 0), (self.lte_mib_unpack_vb_0, 0))
		self.connect((self.lte_viterbi_vfvb_0, 0), (self.lte_crc_calculator_vbvb_0, 0))
		self.connect((self.lte_rate_unmatch_vff_0, 0), (self.lte_viterbi_vfvb_0, 0))
		self.connect((self.lte_cp_time_freq_sync_cc_0, 0), (self.lte_hier_pss_sync_cc_0, 0))
		self.connect((self.lte_hier_pss_sync_cc_0, 0), (self.lte_hier_freq_estimate_cc_0, 0))
		self.connect((self.lte_extract_occupied_tones_vcvc_0, 0), (self.eq, 0))
		self.connect((self.eq, 0), (self.demux, 0))
		self.connect((self.eq, 1), (self.demux, 1))
		self.connect((self.eq, 2), (self.demux, 2))