资源简介
leach基本代码,适用使用matlab仿真。
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LEACH Protocol %
% Part of Thesis: %
% Energy-Efficient Protocols In Wireless Sensor Networks %
% %
% (c) Alexandros Nikolaos Zattas %
% University of Peloponnese %
% Department of Informatics and Telecommunications %
% For any related questions or additional information %
% send an e-mail to: %
% alexzattas@gmail.com %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
clear;
clc;
%%%%%%%%%%%%%%%%%%%% Network Establishment Parameters %%%%%%%%%%%%%%%%%%%%
%%% Area of Operation %%%
% Field Dimensions in meters %
xm=100;
ym=100;
x=0; % added for better display results of the plot
y=0; % added for better display results of the plot
% Number of Nodes in the field %
n=100;
% Number of Dead Nodes in the beggining %
dead_nodes=0;
% Coordinates of the Sink (location is predetermined in this simulation) %
sinkx=50;
sinky=200;
%%% Energy Values %%%
% Initial Energy of a Node (in Joules) %
Eo=2; % units in Joules
% Energy required to run circuity (both for transmitter and receiver) %
Eelec=50*10^(-9); % units in Joules/bit
ETx=50*10^(-9); % units in Joules/bit
ERx=50*10^(-9); % units in Joules/bit
% Transmit Amplifier Types %
Eamp=100*10^(-12); % units in Joules/bit/m^2 (amount of energy spent by the amplifier to transmit the bits)
% Data Aggregation Energy %
EDA=5*10^(-9); % units in Joules/bit
% Size of data package %
k=4000; % units in bits
% Suggested percentage of cluster head %
p=0.05; % a 5 percent of the total amount of nodes used in the network is proposed to give good results
% Number of Clusters %
No=p*n;
% Round of Operation %
rnd=0;
% Current Number of operating Nodes %
operating_nodes=n;
transmissions=0;
temp_val=0;
flag1stdead=0;
%%%%%%%%%%%%%%%%%%%%%%%%%%% End of Parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Creation of the Wireless Sensor Network %%%
% Plotting the WSN %
for i=1:n
SN(i).id=i; % sensor‘s ID number
SN(i).x=rand(11)*xm; % X-axis coordinates of sensor node
SN(i).y=rand(11)*ym; % Y-axis coordinates of sensor node
SN(i).E=Eo; % nodes energy levels (initially set to be equal to “Eo“
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).cluster=0; % the cluster which a node belongs to
SN(i).cond=1; % States the current condition of the node. when the node is operational its value is =1 and when dead =0
SN(i).rop=0; % number of rounds node was operational
SN(i).rleft
相关资源
- matlab实现PM调制.doc
- 基于mppt算法的光伏并网逆变器
- Feedback Control of Dynamic Systems 7th Editio
- matlab当中单层的BP神经网络不使用工具
- 模糊蕴含关系的运算方法-最小运算(
- 叶片轮廓提取代码
- matlab实现人脸检测并提取摄像头检测
- MATLAB的eemd程序
- 人工势场法matlab源码
- matlab古典密码与破译
- Matlab基本遗传算法+详细注释
- Matlab免疫优化算法解题+详细注释
- 优化算法——粒子群算法(PSO)原理
- MATLAB 课程设计
- matlab复杂网络 gn算法
- 实用MATLABfft程序
- matlab实现的meanshift视频目标跟踪程序
- 一维热传导问题求解函数matlab
- 用MATLAB实现路径规划
- MatlabR2019A.7z
- RBF神经网络matlab程序例程
- 图像量化程序,包括图像和matlab程序
- 计算机图形学基本图形生成算法 MAT
- TSP问题的禁忌搜索解法MATLAB程序
- matlab图像处理自适应中值滤波
- 森林火灾视频识别提取
- 车牌识别MATLAB算法
- 两电平SVPWM的MATLAB实现
- 基于EKF二阶RC模型电池Soc预测仿真
- hausdorff_distance
评论
共有 条评论