无线传感器网络flooding路由协议的MATLAB仿真(2).docx
《无线传感器网络flooding路由协议的MATLAB仿真(2).docx》由会员分享,可在线阅读,更多相关《无线传感器网络flooding路由协议的MATLAB仿真(2).docx(5页珍藏版)》请在第一文库网上搜索。
1、functionparam=params;param(1).defau1t=0.5;param(1).name=P;functiontopo1ogy,mote_IDs=topo1ogy(varargin);Nx=10;Ny=I;%numberofpointsonthegridix=1;t=;distx=1;disty=5;X=1:distx:(Nx-1)*distx+1;Y=I:disty:(Ny-1)*disty+1;fori=Xforj=Yt=t;i,j;endendtopo1ogy=t;mote_IDs=1:Nx*Ny;functionx=animationpersistentanim_
2、dataifisempty(anim_data)sma11=5;medium=20;1arge=50;%Event_nameAnimatedCo1or/on/off/togg1eSizeanim_def=.Init-App1ication,1,000,sma11,.Packet-Sent2,100,sma11,.PackeCReceived,3,100,sma11,.Co11ided_Packet_Received,4,100,sma11,.C1oCkJriCKO,000,sma11,.Channe1Request,O,000,sma11),.Channe1IdIe_Check,1,100,s
3、ma11),.,Packet-Receive_Start,O,010,sma11,.Packet_Receive_EndO,000,sma11,.Packet_Transmit_Start1,100,medium,.Packet_Transmit_End1,010,sma11;fori=1:1ength(anim_def)=WORD完整版.可编辑-专业资料分享=a=anim-defi;ifi=1anim-data=struct(event,a1,animated,a2,co1or,a3,size,a4);e1seanim-data(i)=struct(event,a1,animated1,a2
4、,co1or,a3,size,a4);endendendx=anim_data;functionapp1ication(S)S;persistentapp_dataS;g1oba1IDtS;t,event,ID,data=get_event(S);S;topo1ogy,moteJDs=prow1er(GetTopo1ogyInfo,);S;ix=find(mote_IDs=ID);S;if-strcmp(event,Init-App1ication,)S;trymemory=app_dataix;catchmemory=;end,S;endS;SENDER-ID=sim-params(,get
5、-app,Start-Mote,);ifisempty(SENDERJD),SENDERJD=1;endswitcheventcase,Init-App1ication,Signa1strength=1;memory=struct(,send,1,signa1_strength,signa1_strength);ifID=SENDERJD%thisnodestartsf1oodSecciock(IOOO)endPrintMessageCi)casePacket-Sent,memory.send=0;PrintMessageCs)casePacket-Received%data.data%mes
6、sage%data.signa1_strength%receivedsigna1strengthifmemory.sendp=sim-params(,get-app,P);ifisempty(p);p=.3;end%p=0.3;%pisforcedto0.3/Commentthis1ineifyouwanttouseitforoptimization=WORD完整版.可编辑-专业资料分享=ifrandpSend_Packet(radiostream(data.data,memory.signa1-strength);endmemory.send=0;PrintMessage(r,)endcas
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 无线 传感器 网络 flooding 路由 协议 MATLAB 仿真