コード例 #1
0
def rcos_bpsk_map(t, data, b_rate, **args):
    """
    Generates a baseband signal to modulate with BPSK and raised cosine pulses

    :param t: time axis
    :param data: binary sequence which is going to be mapped
    :param b_rate: bit rate of the transmitted bit-stream
    :param args: optional arguments, see the table.

    +----------+-------------+-----------+---------------------------------------------------+
    | Key word | Possible    | Default   | Description                                       |
    |          | values      |           |                                                   |
    +==========+=============+===========+===================================================+
    | tp       | positive    |           |  pulse width of a single symbol                   |
    |          | float       | 1/b_rate  |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+
    | td       | positive    |           |  delay of the signal with reference to the origin |
    |          | float       |   0       |  of the time axis                                 |
    +----------+-------------+-----------+---------------------------------------------------+
    | pw       | positive    | 1/b_rate  |  pulse width of the sinc - main lobe              |
    |          | float       |           |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+
    | alpha    | positive    |   0.8     |  roll-off factor                                  |
    |          | float       |           |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+

    :return: Baseband signal
    """
    if 'tp' in args:
        tp = args['tp']
    else:
        tp = 1 / b_rate  # pulse width of a single symbol

    if 'td' in args:
        td = args['td']
    else:
        td = 0  # signal starts at time td = 0s

    if 'pw' in args:
        pw = args['pw']
    else:
        pw = 1 / b_rate  # pulse width of the sinc - main lobe

    if 'alpha' in args:
        alpha = args['alpha']
    else:
        alpha = .8  # roll-off factor

    # Baseband signal generator
    i_bb = 2 * gen.rcos_tr(t, tp, td, data, pw, alpha) - 1
    q_bb = np.zeros(np.size(t))
    bb = i_bb + q_bb * 1j

    return (bb)
コード例 #2
0
f_sampl = 50e3 		# sampling frequency in kHz
T_int = 1.8 			# entire signal length in ms

##################### Simulation TAU = 1 ######################
t = np.arange(0,T_int,1/f_sampl)	# time axis
f = ut.freq_fr_time (t)				# frequency axis
tc = ut.corr_fr_time (t)			# correlation time axis
cd = np.array([1,1,1,0,1,1,1,1,0,1,0,0,1,0,1])	# code

tau = 1								# time acceleration factor
Tstr = 10e-3						# transmitted symbol interval
Ts = Tstr/tau						# Nyquist's symbol interval
td = 0.01							# initial delay of the sequence (time offset)

# Time Domain
a1 = gen.rcos_tr(t,Tstr,td + Tstr/2,cd,Ts,1.0)
a2 = gen.rcos_tr(t,Tstr,td + Tstr/2,cd,Ts,0.5)
a3 = gen.rcos_tr(t,Tstr,td + Tstr/2,cd,Ts,0.0)
c  = gen.rect_tr(t,Tstr,0,td,cd)


# Correlate processor
A1_c = signal.correlate(a1,a1,'full')
A2_c = signal.correlate(a2,a2,'full')
A3_c = signal.correlate(a3,a3,'full')
C1_c = signal.correlate( c,a1,'full')
C2_c = signal.correlate( c,a2,'full')
C3_c = signal.correlate( c,a3,'full')

CC_c = signal.correlate( c, c,'full')
コード例 #3
0
##################### Parameters ######################
f_sampl = 50e3  # sampling frequency in kHz
T_int = 0.5  # entire signal length in ms

##################### Simulation ######################
t = np.arange(0, T_int, 1 / f_sampl)  # time axis
f = ut.freq_fr_time(t)  # frequency axis
tc = ut.corr_fr_time(t)  # correlation time axis
cd = prn.gold_seq(3, 5, no_bits=500)  # code
Ts = 10e-3  # Nyquist's symbol interval
tau = 0.3  # time acceleration factor
Tstr = Ts * tau  # transmitted symbol interval
td = 0.05  # initial delay of the sequence (time offset)

# Time Domain
a1 = gen.rcos_tr(t, Tstr, td + Tstr / 2, cd, Ts, 1.0)
#c  = gen.rect_tr(t,Tstr,0,td,cd)

print("Length of the signal", np.size(a1))

print(60 * '-')
print('CUDA correlator')
print(60 * '-')
p = profiler.Profile(signatures=False)
p.enable()
cc = corcud.corr_td_single(a1, a1)
p.disable()
p.print_stats()
print(60 * '-')

print(60 * '-')
コード例 #4
0
def rcos_qpsk_map(t, data, s_rate, **args):
    """
    Generates a baseband signal to modulate with QPSK and raised cosine pulses

    :param t: time axis
    :param data: binary sequence which is going to be mapped
    :param s_rate: symbol rate of the transmitted baseband signal
    :param args: optional arguments, see the table.

    +----------+-------------+-----------+---------------------------------------------------+
    | Key word | Possible    | Default   | Description                                       |
    |          | values      |           |                                                   |
    +==========+=============+===========+===================================================+
    | tp       | positive    |           |  pulse width of a single symbol                   |
    |          | float       | 1/b_rate  |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+
    | td       | positive    |           |  delay of the signal with reference to the origin |
    |          | float       |   0       |  of the time axis                                 |
    +----------+-------------+-----------+---------------------------------------------------+
    | pw       | positive    | 1/b_rate  |  pulse width of the sinc - main lobe              |
    |          | float       |           |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+
    | alpha    | positive    |   0.8     |  roll-off factor                                  |
    |          | float       |           |                                                   |
    +----------+-------------+-----------+---------------------------------------------------+

    :return: Baseband signal
    """
    tup = 2  # number of bits in one tuple
    n_d = tup - (np.size(data) % tup)
    data = np.append(data,
                     np.zeros(n_d))  # appends zeros to get the proper shape
    data_2s = data.reshape(-1, tup)  # reshaping the data vector into matrix
    data_2s = data_2s > 0

    ## Baseband signal parameters
    if 'tp' in args:
        tp = args['tp']
    else:
        tp = 1 / s_rate  # pulse width of a single symbol

    if 'td' in args:
        td = args['td']
    else:
        td = 0  # signal starts at time td = 0s

    if 'pw' in args:
        pw = args['pw']
    else:
        pw = 1 / s_rate  # pulse width of the sinc - main lobe

    if 'alpha' in args:
        alpha = args['alpha']
    else:
        alpha = .8  # roll-off factor

    # Baseband signal generator
    i_bb = 2 * gen.rcos_tr(t, tp, td, data_2s[:, 0], pw, alpha) - 1
    q_bb = 2 * gen.rcos_tr(t, tp, td, data_2s[:, 1], pw, alpha) - 1
    bb = i_bb + q_bb * 1j

    return (bb)