I have used the following code to create a wsn virtual structure with 4*4 grid-cells and have deployed 100 nodes in it. Each cell is headed by a cluster-head which is in center of the cell i.e their are a total of 16 cluster-heads.Now the whole wsn a

2 views (last 30 days)
I have used the following code to create a wsn virtual structure with 4*4 grid-cells and have deployed 100 nodes in it. Each cell is headed by a cluster-head which is in center of the cell i.e their are a total of 16 cluster-heads.Now the whole wsn area is also headed by a single "Area-header" which is in the center of the whole wsn area. Now,how will the cluster-heads collect the information from the nodes of their respective cells? Please help.
% WSN Grid structure with 4*4 cells made
NrGrid = 4;
x = linspace(0, 100, NrGrid+1);
[X,Y] = meshgrid(x);
figure(1)
plot(X,Y,'k')
hold on
plot(Y,X,'k')
hold off
set(gca, 'Box','off', 'XTick',[], 'YTick',[])
axis square
% grid formation ends
% Nodes deployment started
NrGrid = 4;
coords = rand(100,2) * NrGrid + 1;
scatter(coords(:,1),coords(:,2));
set(gca, 'XTick', 1:NrGrid+1, 'YTick', 1:NrGrid+1)
grid on
% Nodes deployment ends
%All good upto here
%cluster head selection on basis of most near to the center
[XC, YC] = ndgrid(1/2:NrGrid+1/2, 1/2:NrGrid+1/2);
center_idx = zeros(NrGrid, NrGrid);
k=16;
for K = 1 : numel(XC)
xc = XC(K);
yc = YC(K);
dists = sqrt((coords(:,1)-xc).^2 + (coords(:,2)-yc).^2);
[mindist, minidx] = min(dists);
center_idx(k) = minidx;
end
%cluster head selection ends
energy(1:100) = sqrt(7) /2E7; % Energy given to all the nodes around 0.5 joules

Answers (1)

Walter Roberson
Walter Roberson on 15 Jun 2015
How the cluster-heads will collect information from the nodes of their cells is a matter for you to research. The code you use to create the cluster-heads does so based upon our knowledge of where the nodes are, but in a real WSN the nodes do not know where the other ones are until they have communicated to exchange position information. WSN are not, in practice, pre-programmed with information about exactly where all the other nodes are. You should be simulating having the WSN nodes send out signals and listening for the signals from other nodes to try to figure out where the other nodes are. For example the nodes could be attempting to do triangulation.
The difficulty of figuring out where everything is is going to depend upon the sensors available to the WSN nodes. Do the WSN nodes have GPS? If they do, then is there also a GPS ground station transmitting that can be used to achieve better accuracy than the approximately 3.5 metres possible with pure satellite GPS ?

Categories

Find more on WSNs in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!