コード例 #1
0
 def test_002_t(self):
     self.tb2 = gr.top_block()
     N_rb_dl = 50
     phich_dur = 0
     phich_res = 1.0
     N_ant = 2
     data = []
     test_len = 100
     my_res = []
     for i in range(test_len):
         mib = lte_test.pack_mib(N_rb_dl, phich_dur, phich_res, i)
         crc = lte_test.crc_checksum(mib, N_ant)
         conv = lte_test.convolutional_encoder_sorted(crc)
         convit = lte_test.convolutional_encoder(crc)
         my_res.extend(lte_test.nrz_encoding(convit) )
         rated = lte_test.rate_match(conv)
         nrz = lte_test.nrz_encoding(rated)
         data.extend(nrz)
     
     srcf = blocks.vector_source_f(data, False, 120)
     snkf = blocks.file_sink(gr.sizeof_float*120, "/home/johannes/tests/rated.dat")
     self.tb2.connect(srcf, snkf)
     
     src1 = blocks.vector_source_f(data, False, 120)
             
     vts0 = blocks.vector_to_stream(40*gr.sizeof_float, 3)
     sts0 = blocks.stream_to_streams(40*gr.sizeof_float, 3)        
     self.tb2.connect(src1, vts0, sts0)
     
     
     inter = blocks.interleave(gr.sizeof_float)
     for i in range(3):
         deint = lte.subblock_deinterleaver_vfvf(40, 1)
         vts1 = blocks.vector_to_stream(1*gr.sizeof_float, 40)
         self.tb2.connect( (sts0, i), deint, vts1, (inter, i))
     stv = blocks.stream_to_vector(1*gr.sizeof_float, 120)
     snk = blocks.vector_sink_f(120)        
     self.tb2.connect(inter, stv, snk)
     
     self.tb2.run()
     res = snk.data()
     print res[110:130]
     
     self.assertFloatTuplesAlmostEqual(tuple(my_res), res)
コード例 #2
0
    def test_002_t(self):
        self.tb2 = gr.top_block()
        N_rb_dl = 50
        phich_dur = 0
        phich_res = 1.0
        N_ant = 2
        data = []
        test_len = 100
        my_res = []
        for i in range(test_len):
            mib = lte_test.pack_mib(N_rb_dl, phich_dur, phich_res, i)
            crc = lte_test.crc_checksum(mib, N_ant)
            conv = lte_test.convolutional_encoder_sorted(crc)
            convit = lte_test.convolutional_encoder(crc)
            my_res.extend(lte_test.nrz_encoding(convit))
            rated = lte_test.rate_match(conv)
            nrz = lte_test.nrz_encoding(rated)
            data.extend(nrz)

        srcf = blocks.vector_source_f(data, False, 120)
        snkf = blocks.file_sink(gr.sizeof_float * 120,
                                "/home/johannes/tests/rated.dat")
        self.tb2.connect(srcf, snkf)

        src1 = blocks.vector_source_f(data, False, 120)

        vts0 = blocks.vector_to_stream(40 * gr.sizeof_float, 3)
        sts0 = blocks.stream_to_streams(40 * gr.sizeof_float, 3)
        self.tb2.connect(src1, vts0, sts0)

        inter = blocks.interleave(gr.sizeof_float)
        for i in range(3):
            deint = lte.subblock_deinterleaver_vfvf(40, 1)
            vts1 = blocks.vector_to_stream(1 * gr.sizeof_float, 40)
            self.tb2.connect((sts0, i), deint, vts1, (inter, i))
        stv = blocks.stream_to_vector(1 * gr.sizeof_float, 120)
        snk = blocks.vector_sink_f(120)
        self.tb2.connect(inter, stv, snk)

        self.tb2.run()
        res = snk.data()
        print res[110:130]

        self.assertFloatTuplesAlmostEqual(tuple(my_res), res)
コード例 #3
0
 def test_001_t (self):
     print "lte_rate_unmatch TEST"
     mib = lte_test.pack_mib(50,0,1.0, 511)
     mib_crc = lte_test.crc_checksum(mib, 2)
     c_enc_sorted = lte_test.convolutional_encoder_sorted(mib_crc)
     
     
     in_data = c_enc_sorted
     input_data = lte_test.rate_match(in_data)
     my_data = []
     for i in range(40):
         my_data.append(in_data[i+0])
         my_data.append(in_data[i+40])
         my_data.append(in_data[i+80])    
     in_data = my_data
     exp_res = tuple([float(in_data[i]) for i in range(len(in_data))])
     
     self.src.set_data(input_data)
     self.tb.run ()
     res=self.snk.data()
     
     self.assertEqual(res, exp_res)