异构网络垂直切换算法lte/wimax
1.問題描述:
?
2.部分程序:
?
clc
clear all;
%初始化一些參數(shù)
avethroughput=0;s=0;g=0;
picothroughput=0;
averagepicoput2=0;
averagemacroput2=0;
macrothroughput=0;
totalthroughput=0;
macroput2=0;
picoput2=0;
sectorc2=0;
for time=1:1
? ? picounity=0;
j=1;N=30;k=1;l=1;f=0;M=120;
%生成網(wǎng)絡(luò)拓?fù)浣Y(jié)構(gòu)
%先確定macrocell的拓?fù)浣Y(jié)構(gòu),先從確定站間距開始
%因?yàn)槭?9個(gè)小區(qū),所有生成19個(gè)基站,每兩個(gè)間距之間均為500m
macroposx=[0 ?250*sqrt(3) ?0 ?-250*sqrt(3) -250*sqrt(3) 0 ?250*sqrt(3) 500*sqrt(3) ?500*sqrt(3) 250*sqrt(3) ...
? ? ? ? ? ? ? 0 -250*sqrt(3) -500*sqrt(3) -500*sqrt(3) -500*sqrt(3) -250*sqrt(3) 0 250*sqrt(3) 500*sqrt(3)];%下標(biāo)從1開始到19的每個(gè)宏基站的橫坐標(biāo)
macroposy=[0 -250 -500 -250 250 500 250 0 -500 -750 -1000 -750 -500 0 500 750 1000 750 500];%下標(biāo)從1開始到19的每個(gè)宏基站的縱坐標(biāo)
%生成picocell的位置,每個(gè)macrocell的位置周圍都有N個(gè)picocell,隨機(jī)分布,布置思路是根據(jù)在屬于范圍內(nèi)的點(diǎn)即可
picox=zeros(19,N);picoy=zeros(19,N);
II=zeros(1,19);
for i=1:19?
? ? j=1;
? ? while j<=N ? ??
? ? ? ? picox(i,j)=(1000/sqrt(3)*rand()-500/sqrt(3))+macroposx(i);%隨機(jī)生成橫坐標(biāo)
? ? ? ? picoy(i,j)=(500*rand()-250)+macroposy(i);%隨機(jī)生成縱坐標(biāo)
? ? ? ? distance=sqrt((picox(i,j)-macroposx(i))^2+(picoy(i,j)-macroposy(i))^2);%算pico距離macro的距離
? ? ? ? h=1;judge=0;
? ? ? ? picodis=50;
? ? ? ? while h<=i
? ? ? ? ? ? l=1;
? ? ? ? ? ?while l<j
? ? ? ? ? ? ? ? ?picodis=sqrt((picox(i,j)-picox(h,l))^2+(picoy(i,j)-picoy(h,l))^2);%遍歷已經(jīng)生成的pico,確認(rèn)pico之間的距離
? ? ? ? ? ? ? ? ?if picodis<40%如果有距離小于40的,則不滿足條件,跳出循環(huán),重新生成pico ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? judge=1;
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ?end;
? ? ? ? ? ? ? ? ?l=l+1;
? ? ? ? ? ?end;
? ? ? ? ? ?%h=h+1;
? ? ? ? ? ?if judge==1
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? ? ?h=h+1;
? ? ? ? end;
? ? ? ? if abs(picox(i,j)-macroposx(i)) + abs(picoy(i,j)-macroposy(i))/sqrt(3)<= 500/sqrt(3)&&distance>75&&picodis>40 %只有滿足三個(gè)條件的,才能算是生成正常。1是在正六邊形內(nèi),二是和宏基站的距離大于75,三是pico之間的距離大于40
? ? ? ? ? ?% picox(i,j)=picox(i,j)+macroposx(i);%若可以的話,疊加上宏基站的位置,生成每個(gè)位置的pico,生成結(jié)束
? ? ? ? ? ? %picoy(i,j)=picoy(i,j)+macroposy(i);
? ? ? ? ? ? j = j+1;
? ? ? ? end
? ? end?
? ? II(i)=i;
end
%生成用戶的位置,每個(gè)macrocell的位置周圍都有30個(gè)用戶。所有采用的生成思路和驗(yàn)證思路和pico一模一樣的,不再贅述
userx=zeros(19,M);usery=zeros(19,M);
for i=1:19
? ? k=1;
? ? while k<=M
? ? ? ? userx(i,k)=(1000/sqrt(3)*rand()-500/sqrt(3))+macroposx(i);
? ? ? ? usery(i,k)=(500*rand()-250)+macroposy(i);
? ? ? ? distance=sqrt((userx(i,k)-macroposx(i))^2+(usery(i,k)-macroposy(i))^2);
? ? ? ? h=1;judge=0;
? ? ? ? picoUEdis=50;
? ? ? ? while h<=19
? ? ? ? ? ? l=1;
? ? ? ? ? ?while l<=N
? ? ? ? ? ? ? ?picoUEdis=sqrt((userx(i,k)-picox(h,l))^2+(usery(i,k)-picoy(h,l))^2);
? ? ? ? ? ? ? ?if picoUEdis<10
? ? ? ? ? ? ? ? ? ?judge=1;
? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ?end;
? ? ? ? ? ? ? ?l=l+1;
? ? ? ? ? ?end;
? ? ? ? ? ?if judge==1
? ? ? ? ? ? ? ?break;
? ? ? ? ? ?end
? ? ? ? ? ?h=h+1;
? ? ? ? end
? ? ? ? if abs(userx(i,k)-macroposx(i)) + abs(usery(i,k)-macroposy(i))/sqrt(3)<= 500/sqrt(3)&&distance>25&&picoUEdis>10
? ? ? ? ? %userx(i,k)=userx(i,k)+macroposx(i);
? ? ? ? ? %usery(i,k)=usery(i,k)+macroposy(i);
? ? ? ? ? k = k+1;
? ? ? ? end
? ? ?end
end ??
bandwidth=10^7;
%CF=2*10^9;
%macropower=10^4.6/1000;
%picopower=1;
%噪聲的單位是DB,怎么搞
%noise=9;
%formulas for path loss from macro to UE and pico to UE
%pico to UE, result is db
%L=140.7+36.7*log10(D);
%macro to UE, result is db
%PL=128.1+37.6*log10(d);
%antenna configuration of pico at any direction
%picoantgain=10^0.5;
%antenna configuration of macro at any direction
%macroantgain=-min(12*(theta/65),20);
%calculate the fast fading parameter for macro and pico
macrofading=raylrnd(1,[19 19*M]);
picofading=raylrnd(1,[19*N 19*M]);
%求出SINR的公式,初始化SINR為一個(gè)1*570的矩陣,每一個(gè)用戶有著唯一的SINR
SINR=zeros(19, M);
power=zeros(19,M);
powermw=zeros(19,M);
%theta=zeros(19,30);
%嘗試去求一個(gè)UE所接收功率的大小
%對于macro的UE來說
?userxx=zeros(19,M);
?useryy=zeros(19,M);
?picoxx=zeros(19,N);
?picoyy=zeros(19,N);
?recordi=zeros(1,600);
?recordk=zeros(1,600);
?recordj=zeros(1,600);
for i=1:19
? ? for k=1:M
? ? userxx(i,k)=userx(i,k)-macroposx(i);
? ? useryy(i,k)=usery(i,k)-macroposy(i); ? ?
? ? d=sqrt(userxx(i,k)^2+useryy(i,k)^2)/1000;
? ? %theta=ATAND(useryy(i,k)/userxx(i,k));
? ? %分不同的情況去討論天線的增益,然后再根據(jù)路損公式和天線增益算出macro能給一個(gè)UE的power
? ? if userxx(i,k)>0
? ? ? ? theta=atand(useryy(i,k)/userxx(i,k));
? ? ? ? if theta>0
? ? ? ? ? ? A=-min(12*(abs(theta-60)/65)^2,20);
? ? ? ? else?
? ? ? ? ? ? A=-min(12*(abs(theta+60)/65)^2,20);
? ? ? ? end
? ? else
? ? ? ? theta=atand(useryy(i,k)/userxx(i,k));
? ? ? ? theta2=theta+180;
? ? ? ? if abs(theta) <60
? ? ? ? ? ? A=-min(12*(abs(theta)/65)^2,20);
? ? ? ? elseif theta>60
? ? ? ? ? ? A=-min(12*(abs(theta-60)/65)^2,20);
? ? ? ? else
? ? ? ? ? ? A=-min(12*(abs(theta+60)/65)^2,20);
? ? ? ? end
? ? end
? ? ddd=46+14-(128.1+37.6*log10(d))+A;
? ? power(i,k)=10^(ddd/10)*macrofading(i,i*k);
? ? %遍歷一遍pico,算出pico能給UE的功率,誰給UE的功率大,UE就連接著誰
? ? j=1;
? ??
? ? while j<=N
? ? ? ? picoxx(i,j)=picox(i,j)-macroposx(i);
? ? ? ? picoyy(i,j)=picoy(i,j)-macroposy(i);
? ? ? ? D=sqrt((userxx(i,k)-picoxx(i,j))^2+(useryy(i,k)-picoyy(i,j))^2)/1000;
? ? ? ? p=30+5-(140.7+36.7*log10(D));
? ? ? ? if 10^(p/10)*picofading(i*j,i*k)>power(i,k);
? ? ? ? ? ? power(i,k)=10^(p/10)*picofading(i*j,i*k);
? ? ? ? ? ? sss=p;
? ? ? ? ? ? s=i;
? ? ? ? ? ? g=j;
? ? ? ? ? ? %f=f+1;
? ? ? ? end ? ? ??
? ? ? ? j=j+1;
? ? end
? ??
? ??
? ? %算出到底有幾次UE不是連接著macro的
? ? if power(i,k)~=10^(ddd/10)*macrofading(i,i*k)
? ? ? ??
? ? ? ? f=f+1;
? ? ? ? recordi(f)=i;
? ? ? ? recordk(f)=k;
? ? ? ? recordj(f)=g;
? ? end
? ? powermw(i,k)=power(i,k);
? ? end
?end
%既然現(xiàn)在已經(jīng)計(jì)算出了接收功率,那么現(xiàn)在只要計(jì)算出干擾即可
%首先計(jì)算出macrocell對其的干擾
Imw=zeros(19,M);
Im=zeros(19,M,19);
Ip=zeros(19,M,19,N);
userxxx=zeros(19,M,19);
for i=1:19
? ? for k=1:M
? ? ? ? for m=1:19
? ? ? ? ? ? d2=sqrt((userx(i,k)-macroposx(m))^2+(usery(i,k)-macroposy(m))^2)/1000;
? ? ? ? ? ? %theta2=atand((usery(i,k)-macroposy(m))/(userx(i,k)-macroposx(m)));
? ? ? ? ? ? userxxx(i,k,m)=userx(i,k)-macroposx(m);
? ? ? ? ? ? %先算出macro對UE的干擾,也是分情況討論天線的增益
? ? ? ? ? ? if userxxx(i,k,m)>0
? ? ? ? ? ? ? ?theta2=atand((usery(i,k)-macroposy(m))/(userx(i,k)-macroposx(m)));
? ? ? ? ? ? ? ?A2=-min(12*(abs(theta2-60)/65)^2,20);
? ? ? ? ? ? ? ?A3=-min(12*(abs(theta2+60)/65)^2,20);
? ? ? ? ? ? ? ?A4=-min(12*(abs(theta2-180)/65)^2,20);
? ? ? ? ? ? else
? ? ? ? ? ? ? ? theta2=atand((usery(i,k)-macroposy(m))/(userx(i,k)-macroposx(m)));
? ? ? ? ? ? ? ? theta3=theta+180;
? ? ? ? ? ? ? ? A2=-min(12*(abs(theta2+60)/65)^2,20);
? ? ? ? ? ? ? ? A3=-min(12*(abs(theta2-60)/65)^2,20);
? ? ? ? ? ? ? ? A4=-min(12*(abs(theta2)/65)^2,20);
? ? ? ? ? ? end
? ? ? ? ? ? %A2=-min(12*abs(theta2/65),20)-min(12*abs(theta2+120/65),20)-min(12*abs(theta2-120/65),20);
? ? ? ? ? ? macrointerfe1=46+14-(128.1+37.6*log10(d2))+A2;
? ? ? ? ? ? macrointerfe2=46+14-(128.1+37.6*log10(d2))+A3;
? ? ? ? ? ? macrointerfe3=46+14-(128.1+37.6*log10(d2))+A4;%每一個(gè)macro的干擾
? ? ? ? ? ? Im(i,k,m)=(10^(macrointerfe1/10)+10^(macrointerfe2/10)+10^(macrointerfe3/10))*macrofading(m,i*k);%在加的時(shí)候,要進(jìn)行實(shí)數(shù)化
? ? ? ? ? ? Imw(i,k)=Imw(i,k)+Im(i,k,m);
? ? ? ? end
? ? end
end
for i=1:19
? ? for k=1:M
? ? ? ? for m=1:19
? ? ? ? ? ? for n=1:N
? ? ? ? ? ? ? ? d3=sqrt((userx(i,k)-picox(m,n))^2+(usery(i,k)-picoy(m,n))^2)/1000;
? ? ? ? ? ? ? ? picointerfe=30+5-(140.7+36.7*log10(d3));
? ? ? ? ? ? ? ? Ip(i,k,m,n)=10^(picointerfe/10)*picofading(m*n,i*k);
? ? ? ? ? ? ? ? Imw(i,k)=Imw(i,k)+Ip(i,k,m,n);
? ? ? ? ? ? end
? ? ? ? end
? ? ? ? %I(i,k)=I(i,k)-powermw(i,k);
? ? end
end
I=zeros(19,M);
for i=1:19
? ? for k=1:M
? ? ? ? I(i,k)=Imw(i,k)-powermw(i,k);
? ? ? ??
? ? end
end
%所以現(xiàn)在已經(jīng)算出來了對于任意一個(gè)UE(i,k)來說它的power(i,k)和它的干擾I(i,k),直接求出性噪比即可。
SINRCDF=zeros(19,M);
%CDF=zeros(1,19*30);
for i=1:19
? ? for k=1:M
? ? ? ? SINR(i,k)=powermw(i,k)/I(i,k);
? ? ? ? SINRCDF(i,k)=10*log10(SINR(i,k));
? ? ? ? %SINRCDF(i*k)=SINR(i,k);
? ? end
end
CDF=SINRCDF(:);
%reshape(SINRCDF,i*k,1);
.....................................................
?
3.仿真結(jié)論:
D110
總結(jié)
以上是生活随笔為你收集整理的异构网络垂直切换算法lte/wimax的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 异构网络垂直切换算法LTE/WIMAX切
- 下一篇: FSEDFE