目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
无线传感器网络(Wireless Sensor Networks, WSN)是一种新型的融合传感器、计算机、通信等多学科的信息获取和处理技术的网络,其在工业和军事领域具有广泛的应用前景。目前对于WSN的研究主要局限于同构WSN领域,与同构WSN不同,异构传感器网络中的传感器节点拥有不同的资源配置,如计算能力、通信能力、存储能力、电源能量等,更能满足实际应用场景对WSN的需求,因此设计合理的基于异构传感器网络的路由协议成为异构传感器网络领域的主要研究问题之一。
📚2 运行结果
主函数部分代码:
clc; clear all; close all; % Simulation Parameters %Field dimensions in meters xm = 200; ym = 200; %initial x and y coordinates of the Sink sink.x = 0; sink.y = ym*0.5; %Number of Nodes in the field n = 600; %Optimal Election Probability of a node %to become cluster head p_opt = 0.1; L = 4000; % packet length %Energy Model Eo = 0.5; %Initial Energy E_elec=50*0.000000001; % energy consumed by radio electronics in transmit/receive mode(J/bit) E_fs=10*0.000000000001; %energy consumed by the power amplifier on the free space model(J/bit/m2) E_mp=0.0013*0.000000000001; %energy consumed by the power amplifier on the multi path model(J/bit/m4) E_DA=5*0.000000001; % energy consumed for data aggregation(J/bit/signal) INFINITY = 999999999999999; %maximum number of rounds rmax=15000; %threshold distance do= 70; m = 0.75; a = 2; m0 = 0.525; b = 2.5; m1 = 0.225; u = 3; c=0.02; z=0.71; T_absolute= z*Eo; cr=5; % compression ratio S = struct; S.xd = zeros(n,1); S.yd = zeros(n,1); S.E = zeros(n,1); S.type = zeros(n,1); S.G = zeros(n,1); S.CH = zeros(n,1); S.D = zeros(n,1); S.T = zeros(n,1); S.min_dis_cluster= zeros(n,1); S.dis_to_cluster= zeros(n,1); C = struct; C.id= zeros(25,1); C.xd= zeros(25,1); C.yd= zeros(25,1); C.E= zeros(25,1); C.member= zeros(25,1); R = struct; R.id= zeros(100,1); R.xd= zeros(100,1); R.yd= zeros(100,1); p = zeros(n,1); E = zeros(n,1); DEAD = zeros(rmax,1); RES = zeros(rmax,1); % Creation of four-level heterogeneous network % Normal Nodes for i=1:1:240 S(i).xd = xm*rand(1,1); S(i).yd = ym*rand(1,1); S(i).E = Eo; S(i).type = 'N'; S(i).G = 1; S(i).CH = 0; S(i).D = 0; S(i).R = 0; S(i).min_dis_cluster=0; S(i).dis_to_cluster=0; figure(3); plot(S(i).xd,S(i).yd,'o', 'MarkerSize', 3, 'MarkerFaceColor', 'g'); hold on; end
🎉3 参考文献
[1]王若霖. 基于群智能算法的异构WSN节点部署优化研究[D].哈尔滨工程大学,2020.
部分理论引用网络文献,若有侵权联系博主删除。