def test_003_data_gen(self):
        N_rb_dl = self.N_rb_dl
        subcarriers = self.subcarriers
        N_ofdm_symbols = self.N_ofdm_symbols
        tag_key = self.tag_key
        msg_buf_name = self.msg_buf_name
        cell_id = 124
        Ncp = 1
        N_ant = 2
        style= "tx_diversity"
        sfn = 0
        srcid = "source"

        nf = 4
        data = []
        for sfn in range(nf):
            mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, sfn)
            bch = lte_test.encode_bch(mib, N_ant)
            pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)
            frame = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
            for p in range(len(frame)):
                frame[p] = lte_test.map_pbch_to_frame_layer(frame[p], pbch[p], cell_id, sfn, p)

            stream = frame[0].flatten().tolist()
            stream = np.add(stream, frame[1].flatten().tolist() )
            data.extend(stream)
        print len(data)

        tags = lte_test.get_tag_list(140 * nf, 140, self.tag_key, srcid)

        tb2 = gr.top_block ()
        src = blocks.vector_source_c(data, False, subcarriers)
        dbg = blocks.file_sink(gr.sizeof_gr_complex * 12*N_rb_dl, "/home/johannes/tests/est_frame_data.dat")
        tb2.connect(src, dbg)
        tb2.run()
Exemplo n.º 2
0
    def test_003_data_gen(self):
        N_rb_dl = self.N_rb_dl
        subcarriers = self.subcarriers
        N_ofdm_symbols = self.N_ofdm_symbols
        tag_key = self.tag_key
        msg_buf_name = self.msg_buf_name
        cell_id = 124
        Ncp = 1
        N_ant = 2
        style = "tx_diversity"
        sfn = 0
        srcid = "source"

        nf = 4
        data = []
        for sfn in range(nf):
            mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, sfn)
            bch = lte_test.encode_bch(mib, N_ant)
            pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)
            frame = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
            for p in range(len(frame)):
                frame[p] = lte_test.map_pbch_to_frame_layer(
                    frame[p], pbch[p], cell_id, sfn, p)

            stream = frame[0].flatten().tolist()
            stream = np.add(stream, frame[1].flatten().tolist())
            data.extend(stream)
        print len(data)

        tags = lte_test.get_tag_list(140 * nf, 140, self.tag_key, srcid)

        tb2 = gr.top_block()
        src = blocks.vector_source_c(data, False, subcarriers)
        tb2.run()
Exemplo n.º 3
0
    def test_001_t(self):
        cell_id = 124
        N_ant = 2
        style = "tx_diversity"
        N_rb_dl = self.N_rb_dl
        sim_frames = 4
        self.demux.set_cell_id(cell_id)
        sfn = 512
        mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, sfn)
        bch = lte_test.encode_bch(mib, N_ant)
        pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)

        stream = []
        #for i in range(sim_frames):
        #    frame = lte_test.generate_frame(pbch, N_rb_dl, cell_id, i+20, N_ant)
        #    stream.extend(frame[0].flatten())
        #
        #print len(stream)
        for i in range(sim_frames):
            frame = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
            for p in range(len(frame)):
                frame[p] = lte_test.map_pbch_to_frame_layer(
                    frame[p], pbch[p], cell_id, sfn + i, p)
            stream.extend(frame[0].flatten().tolist())

        key = self.key
        srcid = "source"
        tags = lte_test.get_tag_list(140 * sim_frames, 140, key, srcid)

        self.src1.set_data(stream, tuple(tags))
        self.dbg = blocks.file_sink(gr.sizeof_gr_complex * 12 * N_rb_dl,
                                    "/home/johannes/tests/pbch_frame.dat")
        self.tb.connect(self.src1, self.dbg)
        # set up fg
        self.tb.run()
        # check data
        res1 = self.snk1.data()
        #res2 = self.snk2.data()
        #res3 = self.snk3.data()

        print len(res1)
        compare = res1[0:len(pbch[0])]

        #'''
        #partl = 10
        #for i in range(len(res1)/partl):
        #    partres = compare[partl*i:partl*(i+1)]
        #    partcom = pbch[0][partl*i:partl*(i+1)]
        #    try:
        #        self.assertComplexTuplesAlmostEqual(partcom,partres)
        #        print str(i*partl) + "\tsuccess"
        #    except:
        #        #print "\n\n\n\n\n\n"
        #        print str(i*partl) + "\t" + str(partres)
        #'''

        self.assertComplexTuplesAlmostEqual(compare,
                                            tuple(pbch[0][0:len(compare)]))
Exemplo n.º 4
0
    def test_001_t (self):
        cell_id = 124
        N_ant = 2
        style= "tx_diversity"
        N_rb_dl = self.N_rb_dl
        sim_frames = 4
        self.demux.set_cell_id(cell_id)
        sfn = 512
        mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, sfn)
        bch = lte_test.encode_bch(mib, N_ant)
        pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)

        stream = []
        #for i in range(sim_frames):
        #    frame = lte_test.generate_frame(pbch, N_rb_dl, cell_id, i+20, N_ant)
        #    stream.extend(frame[0].flatten())
        #
        #print len(stream)
        for i in range(sim_frames):
            frame = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
            for p in range(len(frame)):
                frame[p] = lte_test.map_pbch_to_frame_layer(frame[p], pbch[p], cell_id, sfn+i, p)
            stream.extend(frame[0].flatten().tolist() )

        key = self.key
        srcid = "source"
        tags = lte_test.get_tag_list(140 * sim_frames, 140, key, srcid)

        self.src1.set_data(stream, tuple(tags))
        self.dbg = blocks.file_sink(gr.sizeof_gr_complex * 12*N_rb_dl, "/home/johannes/tests/pbch_frame.dat")
        self.tb.connect(self.src1, self.dbg)
        # set up fg
        self.tb.run ()
        # check data
        res1 = self.snk1.data()
        #res2 = self.snk2.data()
        #res3 = self.snk3.data()

        print len(res1)
        compare = res1[0:len(pbch[0])]

        #'''
        #partl = 10
        #for i in range(len(res1)/partl):
        #    partres = compare[partl*i:partl*(i+1)]
        #    partcom = pbch[0][partl*i:partl*(i+1)]
        #    try:
        #        self.assertComplexTuplesAlmostEqual(partcom,partres)
        #        print str(i*partl) + "\tsuccess"
        #    except:
        #        #print "\n\n\n\n\n\n"
        #        print str(i*partl) + "\t" + str(partres)
        #'''

        self.assertComplexTuplesAlmostEqual(compare, tuple(pbch[0][0:len(compare)]))
    def get_data_stream(self, N_ant, cell_id, style, N_rb_dl, sfn, subcarriers):
        #mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, 511)
        #bch = lte_test.encode_bch(mib, N_ant)
        #pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)

        framep = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
        streamp = framep[0].flatten().tolist()
        streamp = np.add(streamp, framep[1].flatten().tolist() )
        symbolp = streamp[0:subcarriers*5]
        streamp = np.append(streamp, symbolp)

        #frame = lte_test.generate_frame(pbch, N_rb_dl, cell_id, sfn, N_ant)
        #stream = frame[0].flatten()
        #stream = stream + frame[1].flatten()
        #symbol = stream[0:subcarriers*5]
        #stream = np.append(stream, symbol)

        return streamp
Exemplo n.º 6
0
    def get_data_stream(self, N_ant, cell_id, style, N_rb_dl, sfn,
                        subcarriers):
        #mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, 511)
        #bch = lte_test.encode_bch(mib, N_ant)
        #pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)

        framep = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
        streamp = framep[0].flatten().tolist()
        streamp = np.add(streamp, framep[1].flatten().tolist())
        symbolp = streamp[0:subcarriers * 5]
        streamp = np.append(streamp, symbolp)

        #frame = lte_test.generate_frame(pbch, N_rb_dl, cell_id, sfn, N_ant)
        #stream = frame[0].flatten()
        #stream = stream + frame[1].flatten()
        #symbol = stream[0:subcarriers*5]
        #stream = np.append(stream, symbol)

        return streamp
Exemplo n.º 7
0
    def test_001_t (self):
        cell_id = 124
        N_ant = 2
        style= "tx_diversity"
        N_rb_dl = self.N_rb_dl
        sim_frames = 4
        self.demux.set_cell_id(cell_id)
        sfn = 512
        mib = lte_test.pack_mib(N_rb_dl, 0, 1.0, sfn)
        bch = lte_test.encode_bch(mib, N_ant)
        pbch = lte_test.encode_pbch(bch, cell_id, N_ant, style)

        stream = []
        #for i in range(sim_frames):
        #    frame = lte_test.generate_frame(pbch, N_rb_dl, cell_id, i+20, N_ant)
        #    stream.extend(frame[0].flatten())
        #
        #print len(stream)
        for i in range(sim_frames):
            frame = lte_test.generate_phy_frame(cell_id, N_rb_dl, N_ant)
            for p in range(len(frame)):
                frame[p] = lte_test.map_pbch_to_frame_layer(frame[p], pbch[p], cell_id, sfn+i, p)
            stream.extend(frame[0].flatten().tolist() )

        key = self.key
        srcid = "source"
        tags = lte_test.get_tag_list(140 * sim_frames, 140, key, srcid)

        self.src1.set_data(stream, tuple(tags))
        # set up fg
        self.tb.run ()
        # check data
        res1 = self.snk1.data()

        print len(res1)
        compare = res1[0:len(pbch[0])]

        self.assertComplexTuplesAlmostEqual(compare, tuple(pbch[0][0:len(compare)]))