📄 generate_bulk_par.m
字号:
case{'los'}
sigma_sf_ave = 4 ; % in dB
warning('no SCM LOS standard deviation of shadowing is defined for urban macro - urban micro LOS standard deviation of shadowing is used')
end
else
switch lower(scmpar.ScmOptions)
case {'none','polarized','urban_canyon'}
sigma_sf_ave = 10 ; % in dB
case{'los'}
sigma_sf_ave = 4 ; % in dB
end
end
epsilon_ds = 0.18 ;
% generate alphas, betas and gammas for all links
abc = C*randn(3,NumLinks);
% inter-site correlation terms for all different MSs
gamma= bsq*randn(1,NumOfMs); % bsq*ksi_3 for all different MSs
gammas=gamma(MsNumber); gammas=gammas(:).'; % so that works also when NumOfMs==1
abc(3,:)=abc(3,:) + gammas; % add inter-site correlation term
sigma_ds = 10.^(epsilon_ds*abc(1,:).' + mu_ds);
sigma_as = 10.^(epsilon_as*abc(2,:).' + mu_as);
sigma_sf = 10.^(0.1*sigma_sf_ave*abc(3,:).');
% output
sigmas=[sigma_ds sigma_as sigma_sf];
case {'urban_micro'}
% shadow fading
if ~strcmpi(scmpar.AlternativePathloss,'yes')
switch lower(scmpar.ScmOptions)
case {'none','polarized','urban_canyon'}
sigma_sf_ave = 10 ; % in dB
case{'los'}
sigma_sf_ave = 4 ; % in dB
end
else
switch lower(scmpar.ScmOptions)
case {'none','polarized','urban_canyon'}
sigma_sf_ave = 10 ; % in dB
case{'los'}
sigma_sf_ave = 4 ; % in dB
end
end
% inter-site correlation terms for all different MSs
gamma_intersite= bsq*randn(1,NumOfMs); % bsq*ksi_3 for all different MSs
gamma_intersites=gamma_intersite(MsNumber); gamma_intersites=gamma_intersites(:).';
gamma= C(3,:)*randn(3,NumLinks)+ gamma_intersites; % add inter-site correlation term
sigma_sf = 10.^(0.1*sigma_sf_ave*gamma);
% output
sigmas=[sigma_sf];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A function that maps inputs from (-inf,inf) to (-180,180)
function y=prin_value(x)
y=mod(x,360);
y=y-360*floor(y/180);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A function to generate bulk parameters for suburban and urban macro cells
% See [1, Sec.5.3.1].
function bulk_parameters=macro(scmpar,linkpar,antpar)
% extract the number of users from the first field of linkpar struct
MsBsDistance =linkpar.MsBsDistance;
NumLinks = length(linkpar.MsBsDistance);
% extract certain parameters from the input structs
Scenario = scmpar.Scenario;
ScmOptions = scmpar.ScmOptions;
N = scmpar.NumPaths;
M = scmpar.NumSubPathsPerPath;
DelaySamplingInterval = scmpar.DelaySamplingInterval;
FixedPdpUsed = scmpar.FixedPdpUsed;
IntraClusterDsUsed = scmpar.IntraClusterDsUsed;
% check that M=20
if (M ~= 20)
M=20;
warning('MATLAB:NumSubPathsChanged','NumSubPathsPerPath is not 20! Using NumSubPathsPerPath=20 instead.')
end
% make sure that user-specific parameters are row vectors
ThetaBs = linkpar.ThetaBs(:).';
ThetaMs = linkpar.ThetaMs(:).';
% general environment parameters for suburban macro [1, Table 5.1]
switch lower(Scenario)
case {'suburban_macro'}
r_as = 1.2;
r_ds = 1.4;
sigma_rnd = 3; % per-path shadowing std in dB, needed in step 5
case {'urban_macro'}
r_as = 1.3;
r_ds = 1.7;
sigma_rnd = 3; % per-path shadowing std in dB, needed in step 5
end
% if bandwidth extension is used
if strcmpi(IntraClusterDsUsed,'yes')
% the values below are from Table 2 of [2]
NumSubPathsPerMidpath=[10,6,4];
MidPathOrder= [1,2,3,4,5,6,7,8,19,20,9,10,11,12,17,18,13,14,15,16];
MidPathDelays=[0 7.0e-009 2.65e-008]; % relative to path/cluster delay
MidPathPowers=[10/20 6/20 4/20];
end
% step 3: determine DS, AS and SF for all users
% This step takes into account channel scenario automatically
% Note: path loss is computed in step 13
sigmas = step3(scmpar,linkpar); % a (NumLinks x 3) matrix
sigma_ds = sigmas(:,1);
sigma_as = sigmas(:,2);
sigma_sf = sigmas(:,3);
% step 4: generate delays in a (NumLinks x N) matrix
% The unit of taus is seconds
if strcmpi(FixedPdpUsed,'no')
sigma_ds = repmat(sigma_ds,1,N); % delay spreads for all users
taus = sort(-r_ds*sigma_ds.*log(rand(NumLinks,N)),2);
taus_sorted = taus - repmat(taus(:,1),1,N ); % normalize min. delay to zero
if strcmpi(IntraClusterDsUsed,'yes') % add the fixed midpath delays
taus_sorted_all=repmat(taus_sorted,[1 1 length(MidPathDelays)]);
taus_sorted_all=permute(taus_sorted_all,[1 3 2]);
taus_sorted_all=reshape(taus_sorted_all,NumLinks,length(MidPathDelays)*N);
taus_sorted_all=taus_sorted_all+repmat(MidPathDelays,NumLinks,N);
end
else % use fixed delays from a table [2]
sigma_ds = repmat(sigma_ds,1,N); % delay spreads for all users
switch lower(Scenario)
case {'suburban_macro'}
if strcmpi(IntraClusterDsUsed,'yes')
taus_sorted_all=[0 7.0000e-009 2.6500e-008 6.2600e-008 6.9600e-008 8.9100e-008 1.4080e-007 1.4780e-007 1.6730e-007 4.0150e-007 ...
4.0850e-007 4.2800e-007 1.3820e-006 1.3890e-006 1.4085e-006 2.8280e-006 2.8350e-006 2.8545e-006];
taus_sorted=[0 6.26e-008 1.4080e-007 4.015e-007 1.3820e-006 2.8280e-006];
taus_sorted_all=repmat(taus_sorted_all,NumLinks,1);
taus_sorted=repmat(taus_sorted,NumLinks,1);
else % give only path/cluster delays
taus_sorted=[0 6.26e-008 1.4080e-007 4.015e-007 1.3820e-006 2.8280e-006];
taus_sorted=repmat(taus_sorted,NumLinks,1);
end
case {'urban_macro'}
if strcmpi(IntraClusterDsUsed,'yes')
taus_sorted_all=[0 7.0000e-009 2.6500e-008 2.5270e-007 2.5970e-007 2.7920e-007 3.6000e-007 3.6700e-007 3.8650e-007 1.0387e-006...
1.0457e-006 1.0652e-006 2.7300e-006 2.7370e-006 2.7565e-006 4.5977e-006 4.6047e-006 4.6242e-006];
taus_sorted=[0 2.527e-007 3.600e-007 1.0387e-006 2.7300e-006 4.5977e-006];
taus_sorted_all=repmat(taus_sorted_all,NumLinks,1);
taus_sorted=repmat(taus_sorted,NumLinks,1);
else % give only path/cluster delays
taus_sorted=[0 2.527e-007 3.600e-007 1.0387e-006 2.7300e-006 4.5977e-006];
taus_sorted=repmat(taus_sorted,NumLinks,1);
end
end
end
% Rounding to delay grid
if strcmpi(IntraClusterDsUsed,'no')
if (DelaySamplingInterval>0)
taus_rounded=DelaySamplingInterval*floor( taus_sorted/DelaySamplingInterval + 0.5);
else
taus_rounded=taus_sorted;
end
else
if (DelaySamplingInterval>0)
taus_rounded=DelaySamplingInterval*floor( taus_sorted_all/DelaySamplingInterval + 0.5);
else
taus_rounded=taus_sorted_all;
end
end
% end of step 4
% step 5: determine random average powers in a (NumLinks x N) matrix
if strcmpi(FixedPdpUsed,'no')
ksi = randn(NumLinks,N)*sigma_rnd; % per-path shadowing
Pprime = exp((1-r_ds)/r_ds*taus_sorted./sigma_ds ).*10.^(-ksi/10);
P = Pprime./repmat(sum(Pprime,2),1,N); % power normalization
%Psub = repmat(P,[1 1 M])/M; % a (NumLinks x N x M) array
if strcmpi(IntraClusterDsUsed,'yes') % add the fixed midpath delays
Pall=repmat(P,[1 1 length(MidPathPowers)]);
Pall=permute(Pall,[1 3 2]);
Pall=reshape(Pall,NumLinks,length(MidPathPowers)*N);
Pall=Pall.*repmat(MidPathPowers,NumLinks,N);
end
else % use fixed powers [2]
switch lower(Scenario)
case {'suburban_macro'}
if strcmpi(IntraClusterDsUsed,'yes')
Pall=[5.0110e-001 3.0066e-001 2.0044e-001 1.1980e-001 7.1883e-002 4.7922e-002 2.7109e-001 1.6266e-001 1.0844e-001 4.5564e-002 ...
2.7338e-002 1.8225e-002 1.1288e-002 6.7725e-003 4.5150e-003 3.0267e-003 1.8160e-003 1.2107e-003];
% normalization of path and midpath powers
Pall=Pall/sum(Pall);
Pall=repmat(Pall,NumLinks,1); % replicate to all links
% path/cluster powers (needed for AoAs etc.)
Pprime=[1.0022e+000 2.3961e-001 5.4219e-001 9.1127e-002 2.2575e-002 6.0533e-003];
P=Pprime/sum(Pprime); % normalization of path powers
P=repmat(P,NumLinks,1); % replicate to all links
else % give only path/cluster powers
Pprime=[1.0022e+000 2.3961e-001 5.4219e-001 9.1127e-002 2.2575e-002 6.0533e-003];
P=Pprime/sum(Pprime); % normalization of path powers
P=repmat(P,NumLinks,1); % replicate to all links
end
case {'urban_macro'}
if strcmpi(IntraClusterDsUsed,'yes')
Pall=[5.0119e-001 3.0061e-001 2.0045e-001 3.3741e-001 2.0238e-001 1.3495e-001 3.0058e-001 1.8029e-001 1.2022e-001 1.5172e-001 ...
9.1000e-002 6.0679e-002 6.2350e-002 3.7397e-002 2.4937e-002 2.8176e-002 1.6899e-002 1.1269e-002];
% normalization of path and midpath powers
Pall=Pall/sum(Pall);
Pall=repmat(Pall,NumLinks,1); % replicate to all links
% path/cluster powers (needed for AoAs etc.)
Pprime=[1.0022e+000 6.7474e-001 6.0108e-001 3.0340e-001 1.2468e-001 5.6344e-002];
P=Pprime/sum(Pprime); % normalization of path powers
P=repmat(P,NumLinks,1); % replicate to all links
else % give only path/cluster powers
Pprime=[1.0022e+000 6.7474e-001 6.0108e-001 3.0340e-001 1.2468e-001 5.6344e-002];
P=Pprime/sum(Pprime); % normalization of path powers
P=repmat(P,NumLinks,1); % replicate to all links
end
end
end
% step 6: determine AoDs
if strcmpi(scmpar.FixedAnglesUsed,'no')
sigma_aod = r_as*sigma_as; % AoD angle spreads for all users
deltas = abs(randn(NumLinks,N).*repmat(sigma_aod,1,N));
deltas_sorted = sort(deltas,2);
delta_aod = sign(rand(NumLinks,N)-0.5).*deltas_sorted; % a (NumLinks x N) matrix of path AoDs
delta_aod = reshape(delta_aod.',NumLinks*N,1);
delta_aod = repmat(delta_aod,1,M).'; % a (M x (NumLinks*N)) matrix
% step 7: associate the path delays with AoDs (a dummy step)
% step 8: determine the powers, phases and offset AoDs at the BS
% The phases are computed in step 13
aod_2deg = [0.0894 0.2826 0.4984 0.7431 1.0257 1.3594 1.7688 2.2961 3.0389 4.3101]; % [1, Table 5.2]
delta_nm_aod = [aod_2deg; -aod_2deg];
delta_nm_aod = delta_nm_aod(:); % this (M x 1) vector is the same for all users and paths
delta_nm_aod = repmat(delta_nm_aod,1,N*NumLinks); % a (M x (NumLinks*N)) matrix
% step 9: determine the AoAs
% If urban_canyon option is selected steps 9a-9d replace step 9
if (strcmpi(ScmOptions,'urban_canyon')==1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -