主页 > 人工智能  > 

基于LEACH和HEED的WSN路由协议研究与改进(Matlab代码实现)

基于LEACH和HEED的WSN路由协议研究与改进(Matlab代码实现)

 👨‍🎓个人主页:研学社的博客 

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🌈3 Matlab代码实现

🎉4 参考文献


💥1 概述

无线传感器网络(Wireless Sensor Networks,WSN)作为一种新兴的信息获取技术,被誉为21世纪将影响世界的十大技术之首,以其广泛的应用,受到人们的重视。无线传感器网络通过撒播具有无线通信能力的传感器节点在监测区域,来感知、收集、处理监测区域的物理信息,并把信息反馈给控制台。由于低功耗、低成本、分布式和自组织的特点,无线传感器网络被广泛的应用于在军事、航空、防爆、救灾、环境、医疗、保健、家居、工业、商业等领域。在无线传感器网络的应用中,成千上万的传感器节点被散布在人迹罕至的监测区域,传感器节点通常是通过电池来进行供电的,传感器节点部署完成后很难进行电池的更换,一旦节点能量耗尽,将会失去作用,过多的节点失效会导致网络瘫痪,因此节点能量显得弥足珍贵。所以,研究高效、节能,能延长网络生命周期的网络协议非常重要。

📚2 运行结果

 

 

部分代码:

% Clean memory and command window clear,clc,close all

%% Parameters N = 100;             % Number of nodes W = 200;             % length of the network L = 200;             % width of the network Ei = 2;              % Initial energy of each node (joules) CHpl = 3000;         % Packet size for cluster head per round (bits)

p = 5/100;           % desired percentage of cluster heads R = 50;              % Range for cluster pMin = 10^-4;        % Lowest possible CH_prop

num_rounds = 2000;   % Max Number of simulated rounds NonCHpl = 200;       % Packet size for normal node per round (bits) Tsetup = 4;          % average Time in seconds taken in setup phase Tss = 10;            % average Time in seconds taken in steady state phase Etrans = 1.0000e-05; % Energy for transmitting one bit  Erec = 1.0000e-05;   % Energy for receiving one bit  Eagg = 1.0000e-07;   % Data aggregation energy Efs = 0.3400e-9;     % Energy of free space model amplifier % Position of sink SX = W/2; SY = L/2;

%% First Leach algorithm %%%%%%%%%%%%%%%%%%%%%%%%%%

% 1st row: states of being a CH, 1:never been CH, 0:has been CH  % 2nd: x-position, 3rd: y-position net = [ones(1,N);rand([1,N])*W;rand([1,N])*L];

% Preallocation for energy calculations E = Ei*ones(1,N);          % Energy left in each node EH = zeros(1,num_rounds);  % Preallocation for dead nodes calculations Ecrit = 0;                 % Critical energy left in node to call it alive Ncrit = fix((95/100)*N);   % Critical number for dead nodes to stop simulation Dead = false(1,N);         % Status of all nodes 0:Alive 1:Dead DeadH = zeros(1,num_rounds); % Preallocation for Bits sent calculations BitsH = zeros(1,num_rounds); figure('Position',[34 30 792 613]);

% Simulating for each round for r=1:num_rounds % iterating on each round          %%%% Choosing Clusters heads %%%%     [net(1,:),CH] = Leach_algo(net(1,:),Dead,p,r);     tmp = find(CH);     for i=1:N         if isempty(net(2,CH))                      else             [~,aa]=min(sqrt((net(2,CH) - net(2,i)).^2 + (net(3,CH) - net(3,i)).^2));             net(1,i) = tmp(aa);         end     end

 

🌈3 Matlab代码实现

🎉4 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]杨梦宁,杨丹,黄超.无线传感器网络中改进的HEED分簇算法[J].重庆大学学报,2012,35(08):101-106.

标签:

基于LEACH和HEED的WSN路由协议研究与改进(Matlab代码实现)由讯客互联人工智能栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“基于LEACH和HEED的WSN路由协议研究与改进(Matlab代码实现)