Ejemplo n.º 1
0
def main():
    cell_id = 124
    N_ant = 1
    style = "tx_diversity"
    N_rb_dl = 50
    sfn = 0
    Ncp = 1
    N_g = 1
    cfi = 2

    trollframe = lte_phy.generate_phy_frame(cell_id, N_rb_dl, N_ant)
    for ant in [1, 2, 4]:
        frame = lte_phy.generate_phy_frame(cell_id, N_rb_dl, ant)
        print np.shape(frame)

    mib = pack_mib(50, 0, 1.0, 511)
    bch = encode_bch(mib, N_ant)
    pbch = encode_pbch(bch, cell_id, N_ant, style)
    if N_ant == 1:
        pbch = [pbch]
    pn_seq = pn_generator(220, cell_id)
    rs_seq = rs_generator(3, 4, cell_id, Ncp)
    pcfich = encode_pcfich(2, cell_id, 4, N_ant)
    N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
    my_pdcchs = get_all_pdcchs(N_CCE)
    ns = 0
Ejemplo n.º 2
0
def generate_subframe(pdcch_data, hi, N_rb_dl, cell_id, N_ant, N_g, n_sub,
                      cfi):
    cfi_syms = cfi
    if N_rb_dl < 10:
        cfi_syms = cfi_syms + 1
    ns = n_sub * 2
    n_carriers = 12 * N_rb_dl
    subframe = np.zeros((N_ant, 14, n_carriers), dtype=np.complex)
    pcfich = encode_pcfich(cfi, cell_id, ns, N_ant)
    style = "tx_diversity"
    cp_len = "normal"
    phich = encode_phich(hi, N_rb_dl, N_g, cp_len, ns, cell_id, N_ant, style)
    pdcch = encode_pdcch(pdcch_data, N_rb_dl, N_ant, style, cfi, N_g, ns,
                         cell_id)
    if N_ant == 1:
        pdcch = [pdcch]
    for p in range(N_ant):
        subframe[p][0] = map_pcfich_to_symbol(subframe[p][0], pcfich[p],
                                              N_rb_dl, cell_id, p)
        subframe[p][0] = map_phich_to_symbol(subframe[p][0], phich[p], N_rb_dl,
                                             cell_id, N_g)
        subframe[p][0:cfi_syms] = map_pdcch_to_symbols(subframe[p][0:cfi_syms],
                                                       pdcch[p], N_rb_dl,
                                                       cell_id, N_g, cfi)
    return subframe
Ejemplo n.º 3
0
def main():
    cell_id = 124
    N_ant = 1
    style = "tx_diversity"
    N_rb_dl = 50
    sfn = 0
    Ncp = 1
    N_g = 1
    cfi = 2

    trollframe = lte_phy.generate_phy_frame(cell_id, N_rb_dl, N_ant)
    for ant in [1, 2, 4]:
        frame = lte_phy.generate_phy_frame(cell_id, N_rb_dl, ant)
        print np.shape(frame)

    mib = pack_mib(50, 0, 1.0, 511)
    bch = encode_bch(mib, N_ant)
    pbch = encode_pbch(bch, cell_id, N_ant, style)
    if N_ant == 1:
        pbch = [pbch]
    pn_seq = pn_generator(220, cell_id)
    rs_seq = rs_generator(3, 4, cell_id, Ncp)
    pcfich = encode_pcfich(2, cell_id, 4, N_ant)
    N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
    my_pdcchs = get_all_pdcchs(N_CCE)
    ns = 0
Ejemplo n.º 4
0
def generate_frame(pbch, N_rb_dl, cell_id, sfn, N_ant):
    n_carriers = 12 * N_rb_dl
    frame = np.zeros((N_ant, 140, n_carriers), dtype=np.complex)
    Ncp = 1
    pcfich = encode_pcfich(2, cell_id, 0, N_ant)
    for p in range(N_ant):
        frame[p] = map_pbch_to_frame(frame[p], pbch, cell_id, sfn, p)
        frame[p] = frame_map_rs_symbols(frame[p], N_rb_dl, cell_id, Ncp, p)
        frame[p] = map_pcfich_to_frame(frame[p], pcfich[p], N_rb_dl, cell_id, p)
    return frame
Ejemplo n.º 5
0
def generate_subframe(pdcch_data, hi, N_rb_dl, cell_id, N_ant, N_g, n_sub, cfi):
    cfi_syms = cfi
    if N_rb_dl < 10:
        cfi_syms = cfi_syms + 1
    ns = n_sub * 2
    n_carriers = 12 * N_rb_dl
    subframe = np.zeros((N_ant, 14, n_carriers), dtype=np.complex)
    pcfich = encode_pcfich(cfi, cell_id, ns, N_ant)
    style = "tx_diversity"
    cp_len = "normal"
    phich = encode_phich(hi, N_rb_dl, N_g, cp_len, ns, cell_id, N_ant, style)
    pdcch = encode_pdcch(pdcch_data, N_rb_dl, N_ant, style, cfi, N_g, ns, cell_id)
    if N_ant == 1:
        pdcch = [pdcch]
    for p in range(N_ant):
        subframe[p][0] = map_pcfich_to_symbol(subframe[p][0], pcfich[p], N_rb_dl, cell_id, p)
        subframe[p][0] = map_phich_to_symbol(subframe[p][0], phich[p], N_rb_dl, cell_id, N_g)
        subframe[p][0:cfi_syms] = map_pdcch_to_symbols(subframe[p][0:cfi_syms], pdcch[p], N_rb_dl, cell_id, N_g, cfi)
    return subframe
Ejemplo n.º 6
0
def main():
    cell_id = 124
    N_ant = 1
    style= "tx_diversity"
    N_rb_dl = 50
    sfn = 0
    Ncp = 1
    N_g = 1
    cfi = 2

    trollframe = lte_phy.generate_phy_frame(cell_id, N_rb_dl, N_ant)

    mib = pack_mib(50,0,1.0, 511)
    bch = encode_bch(mib, N_ant)
    pbch = encode_pbch(bch, cell_id, N_ant, style)
    if N_ant == 1:
        pbch = [pbch]
    pn_seq = pn_generator(220, cell_id)
    rs_seq = rs_generator(3, 4, cell_id, Ncp)
    pcfich = encode_pcfich(2, cell_id, 4, N_ant)
    N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
    my_pdcchs = get_all_pdcchs(N_CCE)
    ns = 0
    pdcch = encode_pdcch(my_pdcchs, N_rb_dl, N_ant, style, cfi, N_g, ns, cell_id)
    if N_ant == 1:
        pdcch = [pdcch]
    org_frame = generate_frame(pbch, N_rb_dl, cell_id, sfn, N_ant)    
    
    cfi_reg = calculate_pcfich_reg_pos(N_rb_dl, cell_id)
    free_reg = get_free_reg_pos(N_rb_dl, cell_id)
    n_phich_groups = get_n_phich_groups(N_g, N_rb_dl)    
    phich_pos = get_phich_pos(N_rb_dl, cell_id, N_g)
      
    
    
    symbol = [0] * 12 * N_rb_dl
    phich = ["PHICH"] * 12 * n_phich_groups
    pcfi = ["CFI"] * 16
    symbol = map_pcfich_to_symbol(symbol, pcfi, N_rb_dl, cell_id, 0)
    symbol = map_phich_to_symbol(symbol, phich, N_rb_dl, cell_id, N_g)
    print "\n\noccupied"
    occ = get_occupied_regs(N_rb_dl, cell_id, N_g)
    pdcch_pos = get_pdcch_reg_pos(N_rb_dl, cell_id, N_g, cfi)
    symbols = org_frame[0][0:cfi]
    print np.shape(symbols)
    print np.shape(pdcch)
    map_pdcch_to_symbols(symbols, pdcch[0], N_rb_dl, cell_id, N_g, cfi)
    print "pdcch done"
    
#    for i in range(len(symbol)):
#        print "{0}\t{1}".format(i, symbol[i])
    
#    n_sub = 0
#    ns = 2* n_sub
#    print np.shape(org_frame)
#    stream = generate_stream_frame(org_frame, N_ant)
#    print np.shape(stream)
    
    
    frame = []
    for i in range(N_ant):
        frame.append([])
    for n_sub in range(10):
        N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
        pdcchs = get_all_pdcchs(N_CCE)
        n_groups = get_n_phich_groups(N_g, N_rb_dl)
        hi = []
        for i in range(8*n_groups):
            hi.append(i%2)
        subframe = generate_subframe(pdcchs, hi, N_rb_dl, cell_id, N_ant, N_g, n_sub, cfi)
        for ant in range(N_ant):
            frame[ant].extend(subframe[ant])
    for p in range(N_ant):
        frame[p] = map_pbch_to_frame_layer(frame[p], pbch[p], cell_id, sfn, p)
        frame[p] = frame_map_rs_symbols(frame[p], N_rb_dl, cell_id, Ncp, p)
    print np.shape(frame)
    print np.shape(org_frame)
#    for i in range(len(frame[0][0])):
#        print "{0}\t{1}\t{2}".format(i, frame[0][0][i], org_frame[0][0][i])
    N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
    for i in range(len(N_rb_dl_lut)):
        N_rb_dl = N_rb_dl_lut[i]
        N_CCE = get_n_cce_available(N_ant, N_rb_dl, cfi, N_g)
        pos = get_pdcch_reg_pos(N_rb_dl, cell_id, N_g, cfi)
        print "{0}\t{1}\t{2}".format(N_CCE, N_CCE*9, np.shape(pos))


    print "this is the END"
Ejemplo n.º 7
0
        k = int((k_mean + (N_sc_rb / 2) * math.floor(n * N_rb_dl / 2)) % (N_rb_dl * N_sc_rb))
        for i in range(6):
            if i % 3 != cell_id_mod3:
                pcfich_pos.append(k + i)
    return pcfich_pos


if __name__ == "__main__":
    cell_id = 124
    N_ant = 2
    style = "tx_diversity"
    N_rb_dl = 6
    sfn = 0
    Ncp = 1

    mib = pack_mib(50, 0, 1.0, 511)
    bch = encode_bch(mib, N_ant)
    pbch = encode_pbch(bch, cell_id, N_ant, style)

    pn_seq = pn_generator(220, cell_id)
    rs_seq = rs_generator(3, 4, cell_id, Ncp)

    frame = generate_frame(pbch, N_rb_dl, cell_id, sfn, N_ant)

    pcfich = encode_pcfich(2, cell_id, 4, N_ant)

    print calculate_pcfich_pos(N_rb_dl, cell_id)

    stream = generate_stream_frame(frame, 2)
    print np.shape(stream)