clear;
%close all;
clc;
%这是图14 CASE 1 ASE的程序
% %%%%%%%%%% 程序说明 %%%%%%%%%%%%%
% 这是邓娜论文Case 1 的系统仿真程序。
% 这个程序呢,是具有相关性的双层异构蜂窝网络下行仿真,主要考察中断概率。
% 基站分为MBS和PBS,在以MBS为圆心,D为半径的圆内没有PBS的分布,以此表示相关性。
% 用户分为MU和PU,在以MBS为圆心,D为半径的圆内为MU,其余的为PU。
% %%%%%%%%%% 待改进处 %%%%%%%%%%%%%
% 1.要不要像于新磊的PPP_Lattic_V3一样,考虑ROI。
% 2.MU和PU用户的区分方法,会较为明显地影响到中断概率的最大最小值,所以如果PU用户选取位于PBS的voronoi区域内的话,会怎么样影响结果?
% %%%%%%%%%% 疑问 %%%%%%%%%%%%%%
% 原论文中用户密度和PBS密度相等,当我增大用户密度时发现PU的中断概率增大,减小用户密度时PU的中断概率减小,但在lambda_u大于4.0*10^(-4)时,PU用户的中断概率还是始终大于MU用户。
% 这与我推测的不一样。因为如果用户密度大一些的话,PU用户距离它的服务PBS的平均距离就会减小,距离其它干扰PBS的距离会增大,所以接收信号增大,干扰减小,SINR增大,中断率就会下降。
% 但实际上并非如此。所以为什么?
% %%%%%%%%%% 参数设置问题 %%%%%%%%%%
% 当area为1500*1500时,大概需要5~8分钟的计算。此时MBS大概只有40个左右,再考虑到Nb的影响,一个MU受到的干扰基站数不到2个。如果增大area运行时间会急剧增加。
% 需要调和结果准确性与运行时间之间的关系。
%%%%%%%%%%% 拓展 %%%%%%%%%%%
% 1.用户除了中断概率之外的其他参数,比如分集增益等(好像只出现在多点协作时?)
% 2.基站之间的协作CoMP
% 3.两层基站之间没有相关性的仿真
%%%%%%%%%% 对了 %%%%%%%%%%
% picture.m用来绘图的。和这个程序是配套的。
%%
%泊松分布密度
lambda_m=1.6*10^(-5);
lambda_p=1.1*10^(-3); %lambda_p=8.0*10^(-4);
%lambda_u=16.0*10^(-4);%lambda_u=8.0*10^(-4);
lambda_uu=(0.25:2.5/13:2.5).*10^(-3);
%基站发射功率
um=1;
up=0.05;
rm=40;%macro基站服务距离
rp=10;%pico基站服务距离
alpha=4;%衰减指数
Nb=30;%频道数目,一个基站在一个频道上只能服务一个用户
%D=3*rm*(up/um)^(1/alpha);%macro基站服务半径内没有Pico基站
D=55;
sigma2=10^(-11);%噪声功率
W0=10*10^(6);%系统带宽
area=[1500 1500];%撒点区域
ROI=[5000 5000];%研究区域=region of interest
cycle_num=5;%大循环次数
sub_cycle_num=20;%子循环次数(fading循环)
T_dB=-5:1:20;%SINR门限dB
T=5;%5dB
ASE_mu=zeros(1,length(lambda_uu));
ASE_pu=zeros(1,length(lambda_uu));
for uu=1:1:length(lambda_uu)
lambda_u=lambda_uu(uu);
Ps_sta_mu=zeros(cycle_num,1); %行表示每一次撒点对应的不同门限下的中断概率
Ps_sta_pu=zeros(cycle_num,1);
for cycle=1:1:cycle_num
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% macro基站撒点 %%%%%%%%%%%%%%%%%%%%%%%%%%
num_mbs=poissrnd(lambda_m*area(1)*area(2));
xy_mbs=rand(num_mbs,2)-0.5;
xy_mbs(:,1)=xy_mbs(:,1)*area(1);
xy_mbs(:,2)=xy_mbs(:,2)*area(2);
xy_mbs=xy_mbs(:,1)+xy_mbs(:,2)*1i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pico基站撒点 %%%%%%%%%%%%%%%%%%%%%%%%%%%
num_pbs0=poissrnd(lambda_p*area(1)*area(2)); %pbs0为所有pbs
xy_pbs0=rand(num_pbs0,2)-0.5;
xy_pbs0(:,1)=xy_pbs0(:,1)*area(1);
xy_pbs0(:,2)=xy_pbs0(:,2)*area(2);
xy_pbs0=xy_pbs0(:,1)+xy_pbs0(:,2)*1i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 挖去D内的pico基站 %%%%%%%%%%%%%%%%%%%%%%
%dist_pbs_to_all_pbs=zeros(num_pbs0,num_mbs);%所有pbs到mbs的距离矩阵
remain_pbs=ones(1,num_pbs0);%判断是否保留pbs的向量,1为保留,0为去除
for i=1:1:num_pbs0
j=1;
while j<=num_mbs
dist=abs(xy_pbs0(i)-xy_mbs(j));%计算两点之间的距离
if dist<=D
remain_pbs(i)=0;%如果pbs处在某个mbs的D范围内,就要剔除
break;%跳出while循环,考察下一个pbs
end
j=j+1;
end
end
xy_pbs1=xy_pbs0(find(remain_pbs==1));%剔除mbs范围内的pbs之后剩下的pbs
num_pbs1=length(xy_pbs1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%用户撒点%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ue_flag=0; %判断是否需要重新用户撒点的标志
while ue_flag==0
ue_flag=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 一次用户撒点 %%%%%%%%%%%%%%%%%%%%%%%%
num_ue=poissrnd(lambda_u*area(1)*area(2));
xy_ue=rand(num_ue,2)-0.5;
xy_ue(:,1)=xy_ue(:,1)*area(1);
xy_ue(:,2)=xy_ue(:,2)*area(2);
xy_ue=xy_ue(:,1)+xy_ue(:,2)*1i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 区分MU和PU用户 %%%%%%%%%%%%%%%%%%%%%%%%%
xy_mu=[];
xy_pu=[];
for i=1:1:num_ue
j=1;
while j<=num_mbs
dist=abs(xy_ue(i)-xy_mbs(j));
if dist<=D %%认为小于等与D的由mbs服务。大于D的由pbs服务 (用户距离mbs38.5265时,收到来自mbs和边缘pbs的信号相等)
break;
end
j=j+1;
end
if j<=num_mbs
xy_mu=[xy_mu;xy_ue(i)];
else
xy_pu=[xy_pu;xy_ue(i)]; %因为对于PU来说,最后会加一再跳出while循环,所以就变成了num_mbs+1
end
end
num_mu=length(xy_mu);
num_pu=length(xy_pu);
%%%%%%%%%%%%%%%%%%%%保证每个基站都有相应的服务用户%%%%%%%%%%%%%%%%%%
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MU %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%% 1.mbs服务状况结构体,表征每个mbs的所有可能服务用户%%%
mbs_service=struct('num_service_mu',repmat({0},1,num_mbs),'list_service_mu',[]);
for i=1:1:num_mu
[~,ind]=min(abs(xy_mu(i)-xy_mbs)); %距离该用户最近的mbs
mbs_service(ind).num_service_mu=mbs_service(ind).num_service_mu+1;
mbs_service(ind).list_service_mu=[mbs_service(ind).list_service_mu i];
end
%%%%%%%%%% 2.保证每个mbs都至少有一个服务用户%%%%%%%%%%%%%%%%%%%
for i=1:1:num_mbs
if mbs_service(i).num_service_mu==0
ue_flag=0; %如果存在mbs没有服务用户,则要求重新进行用户撒点
break;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% 1.pbs服务状况结构体,表征每个pbs所有可能的服务用户%%%%
pbs_service1=struct('num_service_pu1',repmat({0},1,num_pbs1),'list_service_pu1',[]);
for i=1:1:num_pu
[~,ind]=min(abs(xy_pu(i)-xy_pbs1)); %ind表示距离该PU用户最近的pbs
pbs_service1(ind).num_service_pu1=pbs_service1(ind).num_service_pu1+1;
pbs_service1(ind).list_service_pu1=[pbs_service1(ind).list_service_pu1 i];
end
%%%%% 2.保证每个pbs都有服务用户,没有服务用户的pbs剔除 %%%%%
%num_min_p=min(num_pbs1,num_pu);
valid_pbs=[];
for i=1:1:num_pbs1
if pbs_service1(i).num_service_pu1~=0
valid_pbs=[valid_pbs i];
end
end
%pbs_service=pbs_service1(valid_pbs); %所有有效pbs服务结构体
xy_pbs=xy_pbs1(valid_pbs); %剔除所有无服务的pbs之后剩下的pbs
num_pbs=length(xy_pbs);
%pbs_service2=pbs_service1(valid_pbs);
%%%% 3.重新计算剔除之后的所有有效pbs %%%%%
pbs_service=struct('num_service_pu',repmat({0},1,num_pbs),'list_service_pu',[]);
for i=1:1:num_pu
[~,ind]=min(abs(xy_pu(i)-xy_pbs)); %ind表示距离该PU用户最近的pbs
pbs_service(ind).num_service_pu=pbs_service(ind).num_service_pu+1;
pbs_service(ind).list_service_pu=[pbs_service(ind).list_service_pu i];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
评论3