Skip to content

Commit

Permalink
change parameters by nishita
Browse files Browse the repository at this point in the history
  • Loading branch information
Hritwik authored and Hritwik committed Feb 5, 2021
1 parent cd7aae5 commit 4fd8d67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/LEACH.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

%% Create sensor nodes, Set Parameters and Create Energy Model
%%%%%%%%%%%%%%%%%%%%%%%%% Initial Parameters %%%%%%%%%%%%%%%%%%%%%%%
n=100; %Number of Nodes in the field
n=200; %Number of Nodes in the field
[Area,Model]=setParameters(n); %Set Parameters Sensors and Network

%%%%%%%%%%%%%%%%%%%%%%%%% configuration Sensors %%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -129,10 +129,10 @@
if (Sensors(i).type=='N' && Sensors(i).dis2ch<Sensors(i).dis2sink && ...
Sensors(i).E>0)

XL=[Sensors(i).xd ,Sensors(Sensors(i).MCH).xd];
YL=[Sensors(i).yd ,Sensors(Sensors(i).MCH).yd];
% XL=[Sensors(i).xd ,Sensors(Sensors(i).MCH).xd];
% YL=[Sensors(i).yd ,Sensors(Sensors(i).MCH).yd];
hold on
line(XL,YL)
% line(XL,YL)

end

Expand Down
14 changes: 10 additions & 4 deletions src/ploter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@
if (Sensors(i).E>0)

if(Sensors(i).type=='N' )
plot(Sensors(i).xd,Sensors(i).yd,'o');
% plot(Sensors(i).xd,Sensors(i).yd,'o');
plot(Sensors(i).xd,Sensors(i).yd,'ko', 'MarkerSize', 5, 'MarkerFaceColor', 'k');
else %Sensors.type=='C'
plot(Sensors(i).xd,Sensors(i).yd,'kx','MarkerSize',10);
% plot(Sensors(i).xd,Sensors(i).yd,'kx','MarkerSize',10);
plot(Sensors(i).xd,Sensors(i).yd,'ko', 'MarkerSize', 5, 'MarkerFaceColor', 'r');
end

else
deadNum=deadNum+1;
plot(Sensors(i).xd,Sensors(i).yd,'red .');
% plot(Sensors(i).xd,Sensors(i).yd,'red .');
plot(Sensors(i).xd,Sensors(i).yd,'ko', 'MarkerSize',5, 'MarkerFaceColor', 'w');
end

hold on;

end
plot(Sensors(n+1).xd,Sensors(n+1).yd,'g*','MarkerSize',15);
% plot(Sensors(n+1).xd,Sensors(n+1).yd,'g*','MarkerSize',15);

plot(Sensors(n+1).xd,Sensors(n+1).yd,'bo', 'MarkerSize', 8, 'MarkerFaceColor', 'b');
text(Sensors(n+1).xd+1,Sensors(n+1).yd-1,'Sink');
axis square

end
8 changes: 4 additions & 4 deletions src/setParameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
% 0918 546 2272
%%%%%%%%%%%%%%%%%%%%%%%%% Set Inital PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%
%Field Dimensions - x and y maximum (in meters)
Area.x=n;
Area.y=n;
Area.x=1000;
Area.y=1000;

%Sink Motion pattern
Sinkx=0.5*Area.x;
Expand All @@ -23,7 +23,7 @@
ERX=50*0.000000001;

%Transmit Amplifier types
Efs=10*0.000000000001;
Efs=10e-12;
Emp=0.0013*0.000000000001;

%Data Aggregation Energy
Expand All @@ -34,7 +34,7 @@

%%%%%%%%%%%%%%%%%%%%%%%%% Run Time Parameters %%%%%%%%%%%%%%%%%%%%%%%%%
%maximum number of rounds
rmax=5000;
rmax=200;

%Data packet size
DpacketLen=4000;
Expand Down

1 comment on commit 4fd8d67

@HritwikSinghal
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes By Nishita:
- n to 200
- area to 1000x1000
- rmax to 200
- Efs to 10e-12
- hide lines connecting nodes to CH (in LEACH.m)
- change graph to: normal nodes are black and dead nodes are empty

Please sign in to comment.