Пример #1
0
 def setUp (self):
     self.tb = gr.top_block ()
     
     key = "subframe"
     msg_buf_name = "cfi"
     print "setup test"
     
     data = []
     for i in range(3):
         cfi = get_cfi_sequence(i+1)
         data.extend(nrz_encoding(cfi))
     
     reps = 5
     taglist = get_tag_list(3*reps, key, 10)
     
     data = [float(data[i]) for i in range(len(data))]
     ext_data = []
     for i in range(reps):
         ext_data.extend(data)
     data = ext_data
     
     self.src = blocks.vector_source_f(data, False, 32, taglist)
     self.cfi = lte.cfi_unpack_vf(key, msg_buf_name)
     self.dbg = blocks.message_debug()
     
     self.tb.connect(self.src, self.cfi)
     #self.tb.msg_connect(self.cfi, msg_buf_name, self.dbg, "print")
     print "setup finished"
Пример #2
0
    def __init__(self, N_rb_dl, key, out_key, msg_cell_id_name, msg_N_ant_name, msg_cfi_name):
        gr.hier_block2.__init__(self,
            "decode_pcfich_vcm",
            gr.io_signature(3, 3, gr.sizeof_gr_complex * 12 * N_rb_dl),  # Input signature
            gr.io_signature(0, 0, 0)) # Output signature
        
        # register message ports        
        self.message_port_register_hier_out(msg_cell_id_name)
        self.message_port_register_hier_out(msg_N_ant_name)
        self.message_port_register_hier_in(msg_cfi_name)
        # define some variables
        cvlen = 16
        N_ant = 2 # dummy resetable during runtime
        style = "tx_diversity" # PCFICH only uses this value (no spatial multiplexing etc.)
        
        # instatiate blocks with there parameters
        self.demux = lte.pcfich_demux_vcvc(N_rb_dl, key, out_key, msg_cell_id_name)
        self.predecoder = lte.pre_decoder_vcvc(N_ant, cvlen, style)
        self.demapper = lte.layer_demapper_vcvc(N_ant, cvlen, style)
        self.qpsk = lte.qpsk_soft_demod_vcvf(cvlen)
        self.descrambler = lte.pcfich_descrambler_vfvf(out_key, msg_cell_id_name)
        self.unpack = lte.cfi_unpack_vf(out_key, msg_cfi_name)

        # Connect defined blocks
        self.connect((self, 0), (self.demux, 0), (self.predecoder, 0))
        self.connect((self, 1), (self.demux, 1), (self.predecoder, 1))
        self.connect((self, 2), (self.demux, 2), (self.predecoder, 2))
        self.connect(self.predecoder, self.demapper, self.qpsk, self.descrambler, self.unpack)
        
        # Don't forget the message ports
        self.msg_connect(self, msg_N_ant_name, self.predecoder, msg_N_ant_name)
        self.msg_connect(self, msg_N_ant_name, self.demapper, msg_N_ant_name)
        self.msg_connect(self, msg_cell_id_name, self.demux, msg_cell_id_name)
        self.msg_connect(self, msg_cell_id_name, self.descrambler, msg_cell_id_name)
        self.msg_connect(self.unpack, msg_cfi_name, self, msg_cfi_name)
Пример #3
0
 def test_001_parts(self):
     print "test 001 PARTS!!!"
     # This test is for integration
     # all parts expect Demux are tested if they decode CFI correctly
     
     self.tb2 = gr.top_block ()
     
     cell_id = 124
     N_ant = 2
     style = "tx_diversity"
     cvlen = 16
     key = "subframe"
     msg_buf_name = "cfi"
     cfi = 1
     
     data = []
     exp_pc = []
     for ns in range(10):
         cfi_seq = get_cfi_sequence(cfi)
         scr = scramble_cfi_sequence(cfi_seq, cell_id, 2*ns)
         mod = qpsk_modulation(scr)
         lay = layer_mapping(mod, N_ant, style)
         prc = pre_coding(lay, N_ant, style)
         prc_prep = [prc[0][i]+prc[1][i] for i in range(len(prc[0]))]
         #print np.shape(prc)
         prep = prepare_for_demapper_block(lay, N_ant, style)
         exp_pc.extend(prep)
         data.extend(prc_prep)
           
     taglist = get_tag_list(len(data)/16, key, 10)
     self.src = blocks.vector_source_c(data, False, cvlen, taglist)
   
     h0 = [complex(1,0)]*len(data)
     h1 = [complex(1,0)]*len(data)
     self.src1 = blocks.vector_source_c(h0, False, cvlen)
     self.src2 = blocks.vector_source_c(h1, False, cvlen)
     self.predecoder = lte.pre_decoder_vcvc(N_ant, cvlen, style)
     self.snk = blocks.vector_sink_c(cvlen)
     self.demapper = lte.layer_demapper_vcvc(N_ant, cvlen, style)
     self.qpsk = lte.qpsk_soft_demod_vcvf(cvlen)
     self.descr = lte.pcfich_descrambler_vfvf(key, msg_buf_name)
     self.descr.set_cell_id(cell_id)
     self.cfi = lte.cfi_unpack_vf(key, msg_buf_name)
     
     self.tb2.connect(self.src, (self.predecoder, 0))
     self.tb2.connect(self.src1, (self.predecoder, 1))
     self.tb2.connect(self.src2, (self.predecoder, 2))
     self.tb2.connect(self.predecoder, self.demapper)
     self.tb2.connect(self.predecoder, self.snk)
     self.tb2.connect(self.demapper, self.qpsk, self.descr, self.cfi)
     
     self.tb2.run()
     print "test 001 PARTS FINISHED!!!\n"