<< NL_M_Locality NL_M: Mobility NL_M_NodeBS >>

NARVAL >> NL_M: Mobility > NL_M_LocalityHT

NL_M_LocalityHT

Assign links between nodes within a topology in respect with the Locality approach.

Calling Sequence

[T,H] = NL_M_LocalityHT(X,Y,R)

Arguments

X :

X-coordinates vector.

Y :

Y-coordinates vector.

R :

Locality radius.

T :

Links tail vector.

H :

Links head vector.

Description

NL_M_LocalityHT assigns the links between the nodes of a topology defined by their coordinates stored in X and Y in respect with the Locality approach based on the locality radius R. The probability to create a link between two nodes depends on their distance and the Locality radius R. If is inferior to R, a link is created.

2 nodes are connected together if they are separated by the distance .

Examples

w=1;//window index
scf(w);//creation of a graphic window
clf(w);
f=gcf();
f.figure_name='MANET' ;
//f.pixmap='on'; //set the pixmap mode
//creation of the network boundaries
plot2d(0,0,-1,"011"," ",style=5,rect=[0,0,1000,1000]);
xgrid;
//simulation scenario
r=10;//display radius of moving nodes
rf=15;//display radius of fixed nodes
rs=20;//display radius of the moving nodes belonging to the connection under studies
n=50;//quantity of moving nodes
nf=5;//quantity of fixed nodes
[ndep,nfin]=NL_F_RandIntNiNjNf(n,nf);//connection extremal nodes
L=1000;//network square area side
ts=20;//maximum time break
vm=20;//maximum speed
v=vm*rand(1,n);//velocity
Tlim=1000;//simulation duration
nodex=L*rand(1,n+nf);//current x-coordinate of all nodes
nodey=L*rand(1,n+nf);//current y-coordinate of all nodes
destx=L*rand(1,n+nf);//destination x-coordinate of all nodes(not used for fixed nodes)
desty=L*rand(1,n+nf);//destination y-coordinate of all nodes(not used for fixed nodes)
d=sqrt((nodex-destx).^2+(nodey-desty).^2);//initialization of the distance vector
//display the initial state
NL_M_GraphAnimation(nodex(nf+1:$),nodey(nf+1:$),r,5,w);//fixed nodes in red (5)
NL_M_GraphAnimation(nodex(1:nf),nodey(1:nf),rf,2,w);//fixed nodes in blue (3)
//show_pixmap();//display
f=gcf();//get the figure properties
i=ndep-nf;//emission node in purple (6)
f.children.children($-1).children(n-i+1).data(3:4)=[rs rs];//node i
f.children.children($-1).children(n-i+1).foreground=6;//node i 
f.children.children($-1).children(n-i+1).background=6;//node i
//show_pixmap();//display
//f.pixmap='off';
[nodx,nody]=NL_F_XYExtraction(f,n,nf);//extraction of nodes coordinates 
Tnodes=zeros(1,n);//initialization of breaking time parameters
Tmax=100;//maximal waiting time
dmax=180;//Locality radius for the links attribution
[ta,he]=NL_M_LocalityHT(nodx,nody,dmax)//application of NARVAL_M_Locality

Report an issue
<< NL_M_Locality NL_M: Mobility NL_M_NodeBS >>