✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab完整代码及仿真定制内容点击👇
🔥 内容介绍
在这篇论文中,我们提出了一种改进的能源高效PEGASIS协议(IEEPB)中的汇聚移动性,以提高无线传感器网络(WSN)的网络寿命。多头链,多链概念和汇聚移动性在增强无线传感器网络的网络寿命方面起到了重要作用。因此,我们推荐使用移动汇聚改进的能源高效PEGASIS路由协议(MIEEPB);这是一个具有汇聚移动性的多链模型,旨在实现无线传感器的高效能源利用。由于移动汇聚的运动由汽油或电流驱动,有必要将这种移动限制在边界内,并且移动汇聚的轨迹应该是固定的。在我们的技术中,移动汇聚沿着其轨迹移动,并在逗留位置停留一段时间,以确保完整的数据收集。我们为移动汇聚的轨迹开发了一个算法。最终,我们进行了广泛的实验,以评估所提方法的性能。






📣 部分代码
S3(i).xd=rand*50;S3(i).yd=50+rand*50;% plot(S3(i).xd,S3(i).yd,'m*')hold onS3(i).E=Eo;S3(i).Q=0;endif(i>50 && i<76)S3(i).xd=50+rand*50;S3(i).yd=50+rand*50;% plot(S3(i).xd,S3(i).yd,'r.')hold onS3(i).E=Eo;S3(i).Q=0;endif(i>75)S3(i).xd=50+rand*50;S3(i).yd=rand*50;hold on% plot(S3(i).xd,S3(i).yd,'b+')S3(i).E=Eo;S3(i).Q=0;end%%%%%%%endflag_first_dead1=0;flag_first_dead2=0;flag_first_dead3=0;flag_first_dead4=0;flag_all_dead1=0;flag_all_dead2=0;flag_all_dead3=0;flag_all_dead4=0;dead1=0;dead2=0;dead3=0;dead4=0;first_dead1=0;first_dead2=0;first_dead3=0;first_dead4=0;all_dead1=0;allive1=25;allive2=25;allive3=25;allive4=25;% % % counter for bit transmitted to Bases Stationpackets_TO_BS1=0;temp_L_node1=0;temp_L_node2=0;temp_L_node3=0;temp_L_node4=0;% figure(1);x=0;ym=50;% % this variable controle the speed of sink%%%%%%%%%%%%%%%%%%%%%for i=1:node_numberS3(i).parent=0;S3(i).children=zeros(1,100);endRENERGY1=zeros(1,rmax+1);for r3=0:rmax %r3for i=1:node_numberS3(i).parent=0;S3(i).children=zeros(1,100);endfor i=1:node_numberRENERGY1(r3+1) =RENERGY1(r3+1)+S3(i).E;endA1=zeros(25,25);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B1=zeros(50,50);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%C1=zeros(75,75);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%D1=zeros(100,100);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%dead1=0;dead2=0;dead3=0;dead4=0;for i=1:1:25%flags for the calculation of first ,teenth, half and all nodes ..if (S3(i).E<=0)dead1=dead1+1;if (dead1==1)if(flag_first_dead1==0)first_dead1=r3+1;flag_first_dead1=1;endendif(dead1==25)if(flag_all_dead1==0)all_dead1=r3+1;flag_all_dead1=1;endendendendfor i=26:1:50%flags for the calculation of first ,teenth, half and all nodes ..if (S3(i).E<=0)dead2=dead2+1;if (dead2==1)if(flag_first_dead2==0)first_dead2=r3+1;flag_first_dead2=1;endendif(dead2==25)if(flag_all_dead2==0)all_dead2=r3+1;flag_all_dead2=1;endendendendfor i=51:1:75%flags for the calculation of first ,teenth, half and all nodes ..if (S3(i).E<=0)dead3=dead3+1;if (dead3==1)if(flag_first_dead3==0)first_dead3=r3+1;flag_first_dead3=1;endendif(dead3==25)if(flag_all_dead3==0)all_dead3=r3+1;flag_all_dead3=1;endendendendfor i=76:1:100%flags for the calculation of first ,teenth, half and all nodes ..if (S3(i).E<=0)dead4=dead4+1;if (dead4==1)if(flag_first_dead4==0)first_dead4=r3+1;flag_first_dead4=1;endendif(dead4==25)if(flag_all_dead4==0)all_dead4=r3+1;flag_all_dead4=1;endendendendSTATISTICS3(r3+1).ALLIVE1=allive1-dead1;STATISTICS3(r3+1).Et1=0;%total energy of nodes in a roundSTATISTICS3(r3+1).ALLIVE2=allive2-dead2;STATISTICS3(r3+1).Et2=0;%total energy of nodes in a roundSTATISTICS3(r3+1).ALLIVE3=allive3-dead3;STATISTICS3(r3+1).Et3=0;%total energy of nodes in a roundSTATISTICS3(r3+1).ALLIVE4=allive4-dead4;STATISTICS3(r3+1).Et4=0;%total energy of nodes in a roundSTATISTICS3(r3+1).DEAD5=dead1+dead2+dead3+dead4;STATISTICS3(r3+1).ALLIVE5=(STATISTICS3(r3+1).ALLIVE1+STATISTICS3(r3+1).ALLIVE2+STATISTICS3(r3+1).ALLIVE3+STATISTICS3(r3+1).ALLIVE4);for i=1:1:25if (S3(i).E>0)STATISTICS3(r3+1).Et1=STATISTICS3(r3+1).Et1 + S3(i).E;endendif (STATISTICS3(r3+1).ALLIVE1>0)STATISTICS3(r3+1).Eavg1=STATISTICS3(r3+1).Et1/(25*Eo);elseSTATISTICS3(r3+1).Eavg1=0;endfor i=26:1:50if (S3(i).E>0)STATISTICS3(r3+1).Et2=STATISTICS3(r3+1).Et2 + S3(i).E;endendif (STATISTICS3(r3+1).ALLIVE2>0)STATISTICS3(r3+1).Eavg2=STATISTICS3(r3+1).Et2/(25*Eo);elseSTATISTICS3(r3+1).Eavg2=0;endfor i=51:1:75if (S3(i).E>0)STATISTICS3(r3+1).Et3=STATISTICS3(r3+1).Et3 + S3(i).E;endendif (STATISTICS3(r3+1).ALLIVE3>0)STATISTICS3(r3+1).Eavg3=STATISTICS3(r3+1).Et3/(25*Eo);elseSTATISTICS3(r3+1).Eavg3=0;endfor i=76:1:100if (S3(i).E>0)STATISTICS3(r3+1).Et4=STATISTICS3(r3+1).Et4 + S3(i).E;endendif (STATISTICS3(r3+1).ALLIVE4>0)STATISTICS3(r3+1).Eavg4=STATISTICS3(r3+1).Et4/(25*Eo);elseSTATISTICS3(r3+1).Eavg4=0;endSTATISTICS3(r3+1).Eavg5=(STATISTICS3(r3+1).Eavg1+STATISTICS3(r3+1).Eavg2+STATISTICS3(r3+1).Eavg3+STATISTICS3(r3+1).Eavg4)/4;A=zeros(1,STATISTICS3(r3+1).ALLIVE1);for i=1:1:25if S3(i).E>0A(1)=i;break;endendfor i=2:STATISTICS3(r3+1).ALLIVE1for j=(A(i-1)+1):25,if S3(j).E>0A(i)=j;break;endendendB=zeros(1,STATISTICS3(r3+1).ALLIVE2);for i=26:1:50if S3(i).E>0B(1)=i;break;endendfor i=2:(STATISTICS3(r3+1).ALLIVE2)for j=(B(i-1)+1):50,if S3(j).E>0B(i)=j;break;endendendC=zeros(1,STATISTICS3(r3+1).ALLIVE3);for i=51:1:75if S3(i).E>0C(1)=i;break;endend
⛳️ 运行结果




🔗 参考文献
Mohsin Raza, N. Javaid, A. Javaid, Z. A. Khan, "Maximizing the Lifetime of Multi-Chain PEGASIS Using Sink Mobility," published in World Applied Sciences Journal, 21 (9): 1283-1289, 2013 (ISI-Indexed)
本文提出一种改进的能源高效PEGASIS协议,通过引入移动汇聚机制,优化无线传感器网络的生命周期。研究了多链模型和移动限制策略,设计了移动汇聚轨迹算法,并通过实验验证了新方法的有效性。
182

被折叠的 条评论
为什么被折叠?



