目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
无线传感器网络(WSN)由数十个、数百个甚至数千个自主传感器组成。这些传感器以无线方式嵌入环境中,彼此相距一定距离进行通信,其任务是发现和聚集环境信息,并将其传输到监测中心。传感器节点的连续移动及其有限的电池功率会导致这些类型网络的路由问题。因此,在无线传感器网络中提供可靠和安全的协议似乎至关重要。本文的主要重点是利用人工智能技术,如聚类和粒子群优化(PSO)算法,在无线传感器网络中找到安全高效的路由模型。
📚2 运行结果
主函数部分代码:
function Init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%%%%%% %Field Dimensions - x and y maximum (in meters) run=1; iteration=1; PopNum=30; VelocityLimit=3.83; xRank=13.33; RepLimit = 100; % repository limitation number . we can not exceed this number of record in repository ObjNum=2; R = 6; C1 = [1.3 1.5 1.8 1.9 2]; % C1 nd C2 range Weight = [0.6 0.7 0.8 0.9 1]; % W range %Energy Model (all values in Joules) %Initial Energy Eo=8; NodeNum=400; PlotSizeX=100; PlotSizeY=100; X=PlotSizeX*rand(1,NodeNum); Y=PlotSizeY*rand(1,NodeNum); E=Eo*ones(1,NodeNum); %Initil Energy sender.x=0; sender.y=0; %x and y Coordinates of the Sink sink.x=PlotSizeX/2; sink.y=PlotSizeY/2; % % %Number of Nodes in the field % % n=300; % % %Optimal Election Probability of a node % % %to become cluster head % % p=0.2; %Eelec=Etx=Erx ETX=50*0.000000001; ERX=50*0.000000001; %Transmit Amplifier types Efs=10*0.000000000001; Emp=0.0013*0.000000000001; %Data Aggregation Energy EDA=5*0.000000001; %maximum number of rounds rmax=5; %%%%%%%%%%%%%%%%%%%%%%%%% END OF PARAMETERS %%%%%%%%%%%%%%%%%%%%%%%% %Computation of do do=sqrt(Efs/Emp); MutualDominance=1; MobilityRate=2;%movement rate of sink Step=150; %step of modeling BsTrackX=[sink.x]; BsTrackY=[sink.y]; % save the track of x and y coordinate of sink energy_values=[]; fitness=[]; clusters=[]; index_energy=1; index_fitness=1; cluster_index=1; for w=1:Step TrackSize=size(BsTrackX); [sink.x sink.y]=NodeMovement(BsTrackX(TrackSize(2)),BsTrackY(TrackSize(2)),PlotSizeX,PlotSizeY,MobilityRate); BsTrackX=[BsTrackX sink.x]; BsTrackY=[BsTrackY sink.y]; SenderNum=ceil(rand()*7); for jj=1:SenderNum I=ceil(NodeNum*rand()); while (E(I)<=0) I=ceil(NodeNum*rand()); end sender.x=X(I); sender.y=Y(I); for ii=1:run [OutputParticleAC OutputParticleVal OutputFitness OutputRepSize Energy]=PSO(iteration,X,Y,E,sink,sender,xRank,RepLimit,PopNum,C1(3),Weight(4),ETX,EDA,Emp,NodeNum,PlotSizeX,ObjNum,do,VelocityLimit,R,Efs,MutualDominance,I,MobilityRate); end end E=Energy; energy_values(index_energy,1:NodeNum)=E; fitness(index_fitness,1)=OutputFitness(1,1); clusters(cluster_index,1)=-OutputFitness(1,2); cluster_index=cluster_index+1; index_fitness=index_fitness+1; index_energy=index_energy+1; disp(['end of step ',num2str(w),' ']); end
🎉3 参考文献
[1]蒋溢. 无线传感器网络路由安全关键技术研究[D].电子科技大学,2015.
部分理论引用网络文献,若有侵权联系博主删除。