Example #1
0
    def test_001_t (self):
        print "Viterbi decoder test"
        test_range = 1030
        
        data = []
        my_input = []
        for sfn in range(test_range):
            mib = lte_test.pack_mib(50,0,1.0, sfn%1024 )
            mib_crc = lte_test.crc_checksum(mib, 2)
            my_input.extend(mib_crc)
            c_encoded = lte_test.convolutional_encoder(mib_crc)
            nrz_encoded = lte_test.nrz_encoding(c_encoded)
            data.extend(nrz_encoded)

        self.src.set_data(data)
        self.tb.run ()
        
        count = 0
        res = self.snk.data()
        for i in range(test_range):
            try:
                self.assertEqual(tuple(my_input[i*40:(i+1)*40]), res[i*40:(i+1)*40])
#                print "SUCCESS " + str(i)
                count = count+1
            except:
                pass
#                print "FAILED  " + str(i)
     
        rate = float(count)/float(test_range)  
        print (rate)
        if not rate == 1.0:
            self.assertEqual( [1] , [0] ) #throws always n error
        print "Viterbi decoder test END"
Example #2
0
    def test_001_t (self):
        print "Viterbi decoder test"
        test_range = 1030
        
        data = []
        my_input = []
        for sfn in range(test_range):
            mib = lte_test.pack_mib(50,0,1.0, sfn%1024 )
            mib_crc = lte_test.crc_checksum(mib, 2)
            my_input.extend(mib_crc)
            c_encoded = lte_test.convolutional_encoder(mib_crc)
            nrz_encoded = lte_test.nrz_encoding(c_encoded)
            data.extend(nrz_encoded)

        self.src.set_data(data)
        self.tb.run ()
        
        count = 0
        res = self.snk.data()
        for i in range(test_range):
            try:
                self.assertEqual(tuple(my_input[i*40:(i+1)*40]), res[i*40:(i+1)*40])
                print "SUCCESS " + str(i)
                count = count+1
            except:
                print "FAILED  " + str(i)
     
        print (float(count)/float(test_range))        
        print "Viterbi decoder test END"
Example #3
0
    def setUp (self):
        self.tb = gr.top_block ()
        
        mib = lte_test.pack_mib(50,0,1.0, 511)
        mib_crc = lte_test.crc_checksum(mib, 2)
        c_encoded = lte_test.convolutional_encoder(mib_crc)
        data = lte_test.nrz_encoding(c_encoded)

        self.src = blocks.vector_source_f(data,False, 120)
        self.vit = bch_viterbi_vfvb()
        self.snk = blocks.vector_sink_b(40)
        
        # connecting blocks
        self.tb.connect(self.src,self.vit, self.snk)
Example #4
0
    def setUp (self):
        self.tb = gr.top_block ()
        
        mib = lte_test.pack_mib(50,0,1.0, 511)
        mib_crc = lte_test.crc_checksum(mib, 2)
        c_encoded = lte_test.convolutional_encoder(mib_crc)
        data = lte_test.nrz_encoding(c_encoded)

        self.src = gr.vector_source_f(data,False, 120)
        self.vit = lte.viterbi_vfvb()
        self.snk = gr.vector_sink_b(40)
        
        # connecting blocks
        self.tb.connect(self.src,self.vit, self.snk)
Example #5
0
    def setUp (self):
        self.tb = gr.top_block ()
        
        mib = lte_test.pack_mib(50,0,1.0, 511)
        mib_crc = lte_test.crc_checksum(mib, 2)
        c_encoded = lte_test.convolutional_encoder(mib_crc)
        data = lte_test.nrz_encoding(c_encoded)

        self.src = blocks.vector_source_f(data,False, 120)
        self.vit = bch_viterbi_vfvb()
        self.snk = blocks.vector_sink_b(40)
        
        self.dbgs = blocks.file_sink(120 * gr.sizeof_float, "/home/johannes/tests/viterbi.dat")
        self.tb.connect(self.src, self.dbgs)
        
        # connecting blocks
        self.tb.connect(self.src,self.vit, self.snk)
 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)
Example #7
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)