<< NARVAL_M_XYExtraction NARVAL NARVAL_P_IPknowledge >>

NARVAL >> NARVAL > NARVAL_M_XYExtractionB

NARVAL_M_XYExtractionB

Extract the coordinates of network nodes from a graphic window when n moving nodes are defined after nf fixed nodes (VANET).

Calling Sequence

[nx,ny] = NARVAL_M_XYExtractionB(f,n,nf)

Parameters

f :

graphic window ID.

n :

quantity of moving nodes

nf :

quantity of fixed nodes.

nx :

nodes x-coordinates

ny :

nodes y-coordinates

Description

NARVAL_M_XYExtractionB extracts the coordinates of network nodes (nx,ny) from the graphic window defined by its handle f when n moving nodes are defined after nf fixed nodes. It is used for the VANET scenario when roads are defined before nodes.

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;
P1x=[100 900 900 100];
P1y=[100 100 900 900];
P2x=[130 870 870 130];
P2y=[130 130 870 870];
P3x=[160 160 840 840];
P3y=[160 840 840 160];
P4x=[190 190 810 810];
P4y=[190 810 810 190];
n1=15;
n2=15;
n3=15;
n4=15;
N=[n1 n2 n3 n4];
//n=50;//quantity of moving nodes
n=n1+n2+n3+n4;
nf=4;
i1=int(4*rand(1,n1))+1;
i2=int(4*rand(1,n2))+1;
i3=int(4*rand(1,n3))+1;
i4=int(4*rand(1,n4))+1;
indc=[i1 i2 i3 i4];
nodex=[145 145 855 855 P1x(i1) P2x(i2) P3x(i3) P4x(i4) ];
nodey=[145 855 855 145 P1y(i1) P2y(i2) P3y(i3) P4y(i4) ];

Dind=[NARVAL_M_NextDestination(i1) NARVAL_M_NextDestination(i2) NARVAL_M_NextDestination(i3) NARVAL_M_NextDestination(i4)];
destx=[P1x(NARVAL_M_NextDestination(i1)) P2x(NARVAL_M_NextDestination(i2)) P3x(NARVAL_M_NextDestination(i3)) P4x(NARVAL_M_NextDestination(i4))];
desty=[P1y(NARVAL_M_NextDestination(i1)) P2y(NARVAL_M_NextDestination(i2)) P3y(NARVAL_M_NextDestination(i3)) P4y(NARVAL_M_NextDestination(i4))];

xfpolys([[P1x P1x(1)]+[-15 15 15 -15 -15]]',[[P1y P1y(1)]+[-15 -15 15 15 -15]]',31);//12
f.children.children(1).children.thickness=1;
xfpolys([[P1x P1x(1)]+[15 -15 -15 15 15]]',[[P1y P1y(1)]+[15 15 -15 -15 15]]',31);//12
f.children.children(1).children.thickness=1;

xfpolys([[P2x P2x(1)]+[15 -15 -15 15 15]]',[[P2y P2y(1)]+[15 15 -15 -15 15]]',30);//16
f.children.children(1).children.thickness=1;

xfpolys([[P3x P3x(1)]+[15 15 -15 -15 15]]',[[P3y P3y(1)]+[15 -15 -15 15 15]]',30);//16
f.children.children(1).children.thickness=1;
xfpolys([[P4x P4x(1)]+[15 15 -15 -15 15]]',[[P4y P4y(1)]+[15 -15 -15 15 15]]',8);//8
f.children.children(1).children.thickness=1;

show_pixmap();

initdestx=destx;
initdesty=desty;

//simulation scenario
[ndep,nfin]=NARVAL_M_Random_i_j_nf(n,nf);//connection extremal nodes
vm=10;
r=10;
rf=15;//display radius of fixed nodes
rs=15;//display radius of the moving nodes belonging to the connection under studies
v=vm*rand(1,n);//velocity
d=sqrt((nodex(1:n)-destx).^2+(nodey(1:n)-desty).^2);//initialization of the distance vector
//display the initial state
NARVAL_M_Graph2Plot(nodex(nf+1:$),nodey(nf+1:$),r,1,w);//fixed nodes in black (1)red (5)
NARVAL_M_Graph2Plot(nodex(1:nf),nodey(1:nf),rf,5,w);//fixed nodes in green (3)
show_pixmap();//display
f=gcf();//get the figure properties
i=ndep-nf;//emission node in purple (6)
f.children.children(2).children(n-i+1).data(3:4)=[rs rs];//node i
f.children.children(2).children(n-i+1).foreground=3;//node i 
f.children.children(2).children(n-i+1).background=3;//node i

show_pixmap();//display
t=0;
Tnodes=zeros(1,n);//initialization of breaking time parameters
he=[];//link head vector
ta=[];//link tail vector 
col=[3 5 2 6];
cb=1;
f.pixmap='off';
[nodx,nody]=NARVAL_M_XYExtractionB(f,n,nf);//Application of NARVAL_M_XYExtractionB
nodx
nody

Authors

Foued Melakessou

Contact

Dr. Foued Melakessou

Research Associate

Interdisciplinary Centre for Security, Reliability and Trust

Room F106

University of Luxembourg

6, rue Coudenhove Kalergi

L-1359 Luxembourg-Kirchberg

E-mail: foued.melakessou@uni.lu

Tel: (+352) 46 66 44 5346

Home Page


<< NARVAL_M_XYExtraction NARVAL NARVAL_P_IPknowledge >>