Exemple #1
0
Input: ([carrierIQ0,carrierIQ1,...,], [NCO0,NCO1,...,], sample rate)
Output: (duc IQ out, sample rate)
Note: NCO unit is Hz
'''


def duc(bbIQ_list, NCO_list, fs):
    dataout = np.zeros([len(bbIQ_list[0])], dtype=complex)
    #    idx = 0
    for idx in range(len(bbIQ_list)):
        #        frq_shift = np.zeros([len(bbIQ)],dtype=complex)
        frq_shift = np.exp(1j * 2 * cmath.pi * (NCO_list[idx] / fs) *
                           np.arange(len(bbIQ_list[idx])))
        #        for k in range(0,len(bbIQ)):
        #            frq_shift[k] = cmath.exp(1j*2*cmath.pi*(NCO_list[idx]/fs)*k)
        dataout = dataout + bbIQ_list[idx] * frq_shift
#        idx = idx + 1
    return dataout, fs


#%%

if __name__ == '__main__':
    bbIQ, sr = bb.baseband_Gen("64QAM", 20, 1)
    bbIQf = fb.channelfir(bbIQ)
    bbIQ2x, sr = fb.upsampling_2x(bbIQf, sr)
    bbIQ4x, sr = fb.upsampling_2x(bbIQ2x, sr)

    bbduc, sr = duc([bbIQ4x, bbIQ4x, bbIQ4x], [-20000000, 0, 20000000], sr)

    bb.PSD_Disp(bbduc, sr)
Exemple #2
0
import baseband as bb
import filterbranch as fb
import numpy as np
import matplotlib.pyplot as plt


def papr_Calc(datain):
    power = datain.real**2 + datain.imag**2
    ##papr = 10 * math.log((np.max(power) / np.mean(power)),10)
    power = np.sort(power)
    papr = 10 * math.log(
        (power[int(len(power) * 0.9999)] / np.mean(power)), 10)  ##0.00001 PAPR
    return papr


bbIQ0, sr0 = bb.baseband_Gen("64QAM", 20, 1)
bbIQ1, sr1 = bb.baseband_Gen("64QAM", 20, 1)

bbIQ_20M_0, sr0 = fb.firbranch_DL(bbIQ0, sr0)
bbIQ_20M_1, sr1 = fb.firbranch_DL(bbIQ1, sr1)

bbIQ_2x20M_20, sr3 = duc.duc([bbIQ_20M_0, bbIQ_20M_1], [-20000000, 20000000],
                             sr0)

plt.figure(0)
bb.PSD_Disp(bbIQ_2x20M_20, sr3)

papr_40 = papr_Calc(bbIQ_2x20M_20)
papr_20_0 = papr_Calc(bbIQ_20M_0)
papr_20_1 = papr_Calc(bbIQ_20M_1)
Exemple #3
0
    data_interp = np.zeros([len(datain) * 2], dtype=complex)
    data_interp[0::2] = datain
    dataout = signal.convolve(hbcoef, data_interp)
    dataout = dataout[len(hbcoef) - 1:]
    return dataout, sr * 2


#%%
'''
Downlink filter branch
Input: data IQ
Output: 122.88Msps data IQ    
'''


def firbranch_DL(datain, sr):
    bbIQ = channelfir(datain)
    while int(122880000 / sr) != 1:
        bbIQ, sr = upsampling_2x(bbIQ, sr)
    return bbIQ, int(sr)


#%%
if __name__ == '__main__':
    (bbIQ, sr) = baseband.baseband_Gen("16QAM", 10, 1)
    #    bbIQf = channelfir(bbIQ)
    #    bbIQ2x,sr = upsampling_2x(bbIQf,sr)
    #    bbIQ122,sr = upsampling_2x(bbIQ2x,sr)
    bbIQ122, sr = firbranch_DL(bbIQ, sr)
    baseband.PSD_Disp(bbIQ122, sr)