RENEWLab  1.1.0
RENEW project
getRxVec.m File Reference

Functions

 fadec (i)=0
 
num clusters if length (angcTx)
 
end if length (angspdRx)
 
end if length (angspdTx)
 
end if length (dlycns)
 
end if length (dlyspdns)
 
end if length (powcdB)
 
np, 1 zeros ()
 
 urx (:, i)
 
 utx (:, i)
 
nsub for fading if fadec (ic) nsubi
 
 angpTx (I)
 
 dlypns (I)
 
 powp (I)
 
end Compute the spatial signatures urx and utx urx (:, ip)
 
 utx (:, ip)
 
 zeros ((idlyMax-idly), 1)]
 
x delayed vector per idly y (:, irx)
 
node_ue1 sdr_txgainctrl ()
 
gain control end node_bs sdrsync (1)
 
synchronize delays only for BS node_ue1 sdrsync (0)
 
end node_ue1 sdrrxsetup ()
 
node_bs set_config (chained_mode, 1)
 
configure the if n_ue node_ue2 set_config (chained_mode, 0)
 
end node_bs sdr_txbeacon (N_ZPAD_PRE)
 
Burn beacon to the BS(1) RAM node_ue1.sdrtx(tx_data(Burn data to the UE RAM if n_ue node_ue2 sdrtx (tx_data(:, 2))
 
end node_bs sdr_activate_rx ()
 
activate reading stream node_ue1 sdr_setcorr () % activate correlator if n_ue >1 node_ue2.sdr_setcorr() end %node_bs.sdrtrigger(trig)
 
read data node_bs sdr_close ()
 
end fprintf ('Length of the received vector from HW:\tUE:%d\n', data0_len)
 
 fprintf ("No valid channel type was given!")
 

Variables

function y
 
 nvar = tx_var / 10^(0.1*snr)
 
noise variance per data sample H_ul = ones(size(tx_data.'))
 
noise vector W_ul
 
elseif chan_type
 
 hvar = 1
 
if n_ue
 
output vector y0 = H_ul.*tx_data.'
 
number of subpaths per cluster fmaxHz = 0
 
max Doppler spread in Hz NOT USED ! freqErrHz = 0
 
constant frequency error in Hz dlyns =0
 
constant delay in ns angMotion =0
 
angle of motion KEEP at Cluster parameters represented as a vector with one component per cluster angcRx = [0 90]'*pi/180
 
RX center angle in radians angspdRx = 10*pi/180
 
RX angular spread in radians angcTx = 0
 
TX center angle in radians angspdTx = 0
 
TX angular spread in radians dlycns = [0 100]'
 
excess delay of first path in cluster nsec dlyspdns = 30
 
delay spread within cluster in nsec powcdB = [-3 -3]'
 
gain power in dB the power on each cluster fadec = [1 1]'
 
number of TX antennas nantRx = n_bs
 
number of RX antennas dsepTx = 0.5
 
TX antenna separation dsepRx = 0.5
 
RX antenna separation nov = 16
 
oversampling ratio tx_var = mean(abs(tx_data).^2 ) * (64/48)
 
noise variance per data sample Carrier and sample rate fsampMHz = 5
 
sample frequency in MHz x = tx_data
 
Convert scalar parameters to vectors nc = length(angcRx)
 
end Compute total number of paths ncfade = sum(fadec)
 
num fading clusters np = nsub*ncfade + nc-ncfade
 
AoA in radians angpTx = zeros(np,1)
 
AoD in radians dlypns = zeros(np,1)
 
delay in us of each path powp = zeros(np,1)
 
power of each path in linear scale ip = 0
 
Spatial signature of each path urx = double.empty()
 
else nsubi = 1
 
end I = (ip+1:ip+nsubi)'
 
 omgiTx = 2*pi*dsepTx*cos(angpTx)
 
end Generate complex gains and Doppler shifts gain = sqrt(powp).*exp(2*pi*1i*rand(np,1))
 
complex gain of each path fdHz = fmaxHz*cos(angpRx-angMotion) + freqErrHz
 
Doppler shift in Hz
 
sample period in ms nt = size(x,1)
 
number of input samples ntx = nt*nov
 
num input time samples after upconverting Compute size of y based on maximum path delay ts1 = tsms/nov
 
sample period of upcoverted signal in ms idlyMax = max( round((dlypns+dlyns)*1e-6/ts1))
 
idlyMax expressed in units of ts1 nty = ntx + idlyMax
 
Upsample x1 = resample(x,nov,1)
 
 t = (0:nty-1)'*ts1*1e-3
 
must be in sec since dfHz is in sec ! y = zeros(nty,nantRx)
 
Filter the signal by summing each path Sum shifted and scaled versions of x1 to create the output y for irx
 
delay of path ip xs = [zeros(idly,1)
 
Add noise ny = size(y0,1)
 
 w = sqrt(nvar/2)*(randn(ny,nantRx) + 1i*randn(ny,nantRx))
 
 n_samp = bs_param.n_samp
 
 node_bs = iris_py(bs_param)
 
initialize BS node_ue1 = iris_py(ue_param(1))
 
initialize UE if n_ue node_ue2 = iris_py(ue_param(2))
 
end trig = 1
 
 chained_mode = 0
 
configure the BS
 
set trigger to start the frame Iris Rx Only UL data
 
set trigger to start the frame Iris Rx Only UL data0_len = node_bs.sdrrx(n_samp)
 

Function Documentation

◆ angpTx()

angpTx ( I  )

◆ dlypns()

dlypns ( I  )

◆ fadec() [1/2]

fadec ( i  )
pure virtual

◆ fadec() [2/2]

nsub for fading if fadec ( ic  )

◆ fprintf() [1/2]

fprintf ( "No valid channel type was given!"  )

◆ fprintf() [2/2]

end fprintf ( 'Length of the received vector from HW:\tUE:%d\n'  ,
data0_len   
)

◆ length() [1/6]

num clusters if length ( angcTx  )

◆ length() [2/6]

end if length ( angspdRx  )

◆ length() [3/6]

end if length ( angspdTx  )

◆ length() [4/6]

end if length ( dlycns  )

◆ length() [5/6]

end if length ( dlyspdns  )

◆ length() [6/6]

end if length ( powcdB  )

◆ powp()

powp ( I  )

◆ sdr_activate_rx()

end node_bs sdr_activate_rx ( )

◆ sdr_close()

read data node_bs sdr_close ( )

◆ sdr_setcorr()

activate reading stream node_ue1 sdr_setcorr ( )

◆ sdr_txbeacon()

end node_bs sdr_txbeacon ( N_ZPAD_PRE  )

◆ sdr_txgainctrl()

if n_ue node_ue2 sdr_txgainctrl ( )

◆ sdrrxsetup()

end node_ue1 sdrrxsetup ( )

◆ sdrsync() [1/2]

if n_ue node_ue2 sdrsync ( )

◆ sdrsync() [2/2]

gain control end node_bs sdrsync ( )

◆ sdrtx()

Burn beacon to the BS (1) RAM node_ue1.sdrtx(tx_data( Burn data to the UE RAM if n_ue node_ue2 sdrtx ( tx_data(:, 2)  )

◆ set_config() [1/2]

configure the if n_ue node_ue2 set_config ( chained_mode  ,
 
)

◆ set_config() [2/2]

node_bs set_config ( chained_mode  ,
 
)

◆ urx() [1/2]

urx ( ,
i   
)

◆ urx() [2/2]

end Compute the spatial signatures urx and utx urx ( ,
ip   
)

◆ utx() [1/2]

utx ( ,
i   
)

◆ utx() [2/2]

utx ( ,
ip   
)

◆ y()

x delayed vector per idly y ( ,
irx   
)

◆ zeros() [1/2]

zeros ( (idlyMax-idly)  ,
 
)

◆ zeros() [2/2]

np,1 zeros ( )
virtual

Variable Documentation

◆ ! freqErrHz

max Doppler spread in Hz NOT USED ! freqErrHz = 0

◆ ! y

must be in sec since dfHz is in sec ! y = zeros(nty,nantRx)

◆ angcRx

angle of motion KEEP at Cluster parameters represented as a vector with one component per cluster angcRx = [0 90]'*pi/180

◆ angcTx

RX angular spread in radians angcTx = 0

◆ angMotion

constant delay in ns angMotion =0

◆ angpTx

AoA in radians angpTx = zeros(np,1)

◆ angspdRx

RX center angle in radians angspdRx = 10*pi/180

◆ angspdTx

TX center angle in radians angspdTx = 0

◆ BS

configure the BS

◆ chained_mode

chained_mode = 0

◆ chan_type

elseif chan_type
Initial value:
== "rayleigh"
% Rayleigh fading (slower than iid!)
tx_var = mean(mean(abs(tx_data).^2 )) * (64/48)

◆ data

set trigger to start the frame Iris Rx Only UL data

◆ data0_len

set trigger to start the frame Iris Rx Only UL data0_len = node_bs.sdrrx(n_samp)

◆ dlycns

TX angular spread in radians dlycns = [0 100]'

◆ dlyns

constant frequency error in Hz dlyns =0

◆ dlypns

AoD in radians dlypns = zeros(np,1)

◆ dlyspdns

excess delay of first path in cluster nsec dlyspdns = 30

◆ dsepRx

TX antenna separation dsepRx = 0.5

◆ dsepTx

number of RX antennas dsepTx = 0.5

◆ fadec

gain power in dB the power on each cluster fadec = [1 1]'

◆ fdHz

complex gain of each path fdHz = fmaxHz*cos(angpRx-angMotion) + freqErrHz

◆ fmaxHz

number of subpaths per cluster fmaxHz = 0

◆ fsampMHz

noise variance per data sample Carrier and sample rate fsampMHz = 5

◆ gain

end Generate complex gains and Doppler shifts gain = sqrt(powp).*exp(2*pi*1i*rand(np,1))

◆ H_ul

else H_ul = ones(size(tx_data.'))

◆ hvar

hvar = 1

◆ Hz

Doppler shift in Hz
Initial value:
= fmaxHz*cos(angp)
% Get dimensions
tsms = 1e-3/fsampMHz

◆ I

end I = (ip+1:ip+nsubi)'

◆ idlyMax

sample period of upcoverted signal in ms idlyMax = max( round((dlypns+dlyns)*1e-6/ts1))

◆ ip

for ip = 0

◆ irx

Filter the signal by summing each path Sum shifted and scaled versions of x1 to create the output y for irx
Initial value:
=1:size(urx,1)
for ip=1:np
idly = round((dlypns(ip) + dlyns)...
*1e-6/ts1)

◆ n_samp

n_samp = bs_param.n_samp

◆ n_ue

if n_ue
Initial value:
== 1
H_ul = sqrt(hvar/2).*randn(n_bs, length(tx_data)) + 1i*randn(n_bs, length(tx_data))

◆ nantRx

number of TX antennas nantRx = n_bs

◆ nc

Convert scalar parameters to vectors nc = length(angcRx)

◆ ncfade

end Compute total number of paths ncfade = sum(fadec)

◆ node_bs

node_bs = iris_py(bs_param)

◆ node_ue1

initialize BS node_ue1 = iris_py(ue_param(1))

◆ node_ue2

initialize UE if n_ue node_ue2 = iris_py(ue_param(2))

◆ nov

RX antenna separation nov = 16

◆ np

num fading clusters np = nsub*ncfade + nc-ncfade

◆ nsubi

else nsubi = 1

◆ nt

sample period in ms nt = size(x,1)

◆ ntx

number of input samples ntx = nt*nov

◆ nty

idlyMax expressed in units of ts1 nty = ntx + idlyMax

◆ nvar

nvar = tx_var / 10^(0.1*snr)

◆ ny

Add noise ny = size(y0,1)

◆ omgiTx

omgiTx = 2*pi*dsepTx*cos(angpTx)

◆ powcdB

delay spread within cluster in nsec powcdB = [-3 -3]'

◆ powp

delay in us of each path powp = zeros(np,1)

◆ t

t = (0:nty-1)'*ts1*1e-3

◆ trig

end trig = 1

◆ ts1

num input time samples after upconverting Compute size of y based on maximum path delay ts1 = tsms/nov

◆ tx_var

oversampling ratio tx_var = mean(abs(tx_data).^2 ) * (64/48)

◆ urx

Spatial signature of each path urx = double.empty()

◆ w

w = sqrt(nvar/2)*(randn(ny,nantRx) + 1i*randn(ny,nantRx))

◆ W_ul

noise variance per data sample noise vector W_ul
Initial value:
= sqrt(nvar/2).* (randn(n_bs, length(tx_data)) + ...
1i*randn(n_bs, length(tx_data)) )

◆ x

sample frequency in MHz x = tx_data

◆ x1

x1 = resample(x,nov,1)

◆ xs

delay of path ip xs = [zeros(idly,1)

◆ y

else y
Initial value:
= getRxVec(tx_data, n_bs, n_ue, chan_type, snr, bs_param, ue_param, past_data_fname)
%%% Returns Rx vector passed through the channel type given in the input
%%% list.
if chan_type == "awgn"
% AWGN
tx_var = mean(mean(abs(tx_data).^2 )) * (64/48)

◆ y0

end end y0 = H_ul.*tx_data.'
iris_py.type
type
Definition: iris_py.py:333
np
num fading clusters np
Definition: getRxVec.m:112
length
num clusters if length(angcTx)
tx_var
oversampling ratio tx_var
Definition: getRxVec.m:80
ip
power of each path in linear scale ip
Definition: getRxVec.m:120
channel
Equalize with *known * channel
Definition: berr_perfect.m:49
fmaxHz
number of subpaths per cluster fmaxHz
Definition: getRxVec.m:57
ts1
num input time samples after upconverting Compute size of y based on maximum path delay ts1
Definition: getRxVec.m:167
nvar
nvar
Definition: getRxVec.m:11
tx_data
tx_data
Definition: berr_perfect.m:5
snr
number of bits snr
Definition: mod_demod.m:16
i
for i
Definition: rl_ofdm_calib.m:121
n_ue
if n_ue
Definition: getRxVec.m:29
dlyns
constant frequency error in Hz dlyns
Definition: getRxVec.m:59
urx
Spatial signature of each path urx
Definition: getRxVec.m:122
dlypns
AoD in radians dlypns
Definition: getRxVec.m:118
hvar
hvar
Definition: getRxVec.m:28
fsampMHz
noise variance per data sample Carrier and sample rate fsampMHz
Definition: getRxVec.m:84
vector
Maybe you need to transpose bits_matrix before reshaping it to a vector
Definition: syms2bits.m:62
chan_type
if chan_type
Definition: getRxVec.m:8
H_ul
noise variance per data sample H_ul
Definition: getRxVec.m:13