欢迎来到本博客❤️❤️
博主优势:博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
本文目录如下:
目录
1 概述
2 运行结果
3 参考文献
4 Matlab代码实现
部署由电池电量和无线通信有限的节点组成的传感器网络,以从现场收集有用的信息。以节能的方式收集感测信息对于传感器网络的长期运行至关重要。在W. Heinzelman等人(Proc. Hawaii Conf. on System Sci., 2000)中,定义了数据收集问题,在一轮通信中,每个传感器节点都有一个数据包要发送到遥远的基站。如果每个节点将其感测数据直接传输到基站,那么它将迅速耗尽其功率。W. Heinzelman等人提出的LEACH协议是一种优雅的解决方案,其中形成集群以在传输到基站之前融合数据。通过随机分配选择传输到基站的集群头,与直接传输相比,LEACH 实现了 8 倍的改进,以节点死亡时间来衡量。在本文中,我们提出了PEGASIS(传感器信息系统中的节能收集),这是一种接近最优的基于链的协议,是对LICACH的改进。在PEGASIS中,每个节点仅与近邻通信,并轮流向基站发送信号,从而减少了每轮消耗的能量。仿真结果表明,当100%、300%、1%和20%的节点在不同的网络规模和拓扑下死亡时,PEGASIS的性能比利奇好约50%至100%。
能够进行大量计算和无线通信的廉价传感器正在变得可用[2],[4]。可以部署传感器节点网络以从现场收集有用的信息,例如,在恶劣的物理环境中[13]。这些传感器节点收集音频、地震和其他类型的数据,并协作以在网络中执行高级任务,传感器节点受到可用电池电量的严重限制,限制了网络的使用寿命和质量。由于无线通信消耗大量电池电量,传感器节点应花费尽可能少的能量来接收和传输数据[5],[10],[12]。通信协议必须最大化节点的生存期[9],通过使用节点之间的本地协作来减少带宽消耗,并容忍节点故障[14]。
部分代码:
SN(i).dts=0; % nodes distance from the sink
SN(i).role=0; % node acts as normal if the value is '0', if elected as a cluster head it gets the value '1' (initially all nodes are normal)
SN(i).pos=0;
SN(i).closest=0;
SN(i).prev=0;
SN(i).dis=0; % distance between two nodes headin towards to the cluster head from position 1
SN(i).dis2=0; % distance between two nodes headin towards to the cluster head from position 2
SN(i).order=0;
SN(i).sel=0; % states if the node has already operated for this round or not (if 0 then no, if 1 then yes)
SN(i).rop=0; % number of rounds node was operational
SN(i).tel=0; % states how many times the node was elected as a Cluster Head
order(i)=0;
hold on;
figure(1)
plot(x,y,xm,ym,SN(i).x,SN(i).y,'ob',sinkx,sinky,'*r');
title 'Wireless Sensor Network';
xlabel '(m)';
ylabel '(m)';
end
% Calculates Distance Between Each Node and the Sink (Base Station) %
for i=1:n
SN(i).dts=sqrt((sinkx-SN(i).x)^2 + (sinky-SN(i).y)^2);
SN(i).Esink=Eelec*k + Eamp*k*(SN(i).dts)^2;
T(i)=SN(i).dts;
end
A=sort(T,'descend'); % Creates array A containing the distance between each node and the sink,
% sorted in an asceding order
A_id(1:n)=0;
% Creates array A_id which is sorted in a way that it's elements are
% aligned with those of A. Contains the node ID
for i=1:n
for j=1:n
if A(i)==SN(j).dts
A_id(i)=SN(j).id;
end
end
SN(i).dts=0; % nodes distance from the sink
SN(i).role=0; % node acts as normal if the value is '0', if elected as a cluster head it gets the value '1' (initially all nodes are normal)
SN(i).pos=0;
SN(i).closest=0;
SN(i).prev=0;
SN(i).dis=0; % distance between two nodes headin towards to the cluster head from position 1
SN(i).dis2=0; % distance between two nodes headin towards to the cluster head from position 2
SN(i).order=0;
SN(i).sel=0; % states if the node has already operated for this round or not (if 0 then no, if 1 then yes)
SN(i).rop=0; % number of rounds node was operational
SN(i).tel=0; % states how many times the node was elected as a Cluster Head
order(i)=0;
hold on;
figure(1)
plot(x,y,xm,ym,SN(i).x,SN(i).y,'ob',sinkx,sinky,'*r');
title 'Wireless Sensor Network';
xlabel '(m)';
ylabel '(m)';
end
% Calculates Distance Between Each Node and the Sink (Base Station) %
for i=1:n
SN(i).dts=sqrt((sinkx-SN(i).x)^2 + (sinky-SN(i).y)^2);
SN(i).Esink=Eelec*k + Eamp*k*(SN(i).dts)^2;
T(i)=SN(i).dts;
end
A=sort(T,'descend'); % Creates array A containing the distance between each node and the sink,
% sorted in an asceding order
A_id(1:n)=0;
% Creates array A_id which is sorted in a way that it's elements are
% aligned with those of A. Contains the node ID
for i=1:n
for j=1:n
if A(i)==SN(j).dts
A_id(i)=SN(j).id;
end
end
文章中一些内容引自网络,会注明出处或引用为参考文献,难免有未尽之处,如有不妥,请随时联系删除。