目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
此代码用于MATLAB GUI,其中为WSN实现了AODV路由协议。源节点每次都会随着数据包的数量而变化。GUI的快照已附加。它是一个动态GUI。
AODV(Ad-hoc On demand Distance Vector)是一种用于自组织网络的无环路路由协议。它被设计为在移动节点的环境中自启动,能够承受各种网络行为,如节点移动性、链路故障和数据包丢失。在每个节点上,AODV都维护一个路由表。目的地的路由表条目包含三个基本字段:下一跳节点、序列号和跳数。所有目的地为目的地的数据包都被发送到下一跳节点。序列号作为时间戳的一种形式,是衡量路线新鲜度的指标。跃点计数表示到目标节点的当前距离。
📚2 运行结果


主函数部分代码:
clear all
close all
clc
%%
global hmain
hmain=figure(1);
%set the area edit box
uicontrol('style','text','Units','Normalize','Position',[0.82 0.900 0.150 0.05],'String','Enter The Area');
gui.edit=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.850 0.100 0.05],'BackgroundColor','white');
%set the node number edit box
uicontrol('style','text','Units','Normalize','Position',[0.82 0.780 0.150 0.07],'String','Enter The Nodes no');
gui.nodes=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.730 0.100 0.05],'BackgroundColor','white');
%set the node grid size edit box
uicontrol('style','text','Units','Normalize','Position',[0.82 0.660 0.150 0.07],'String','Enter The Grid Size');
gui.grid=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.610 0.100 0.05],'BackgroundColor','white');
% uicontrol('style','text','Units','Normalize','Position',[0.82 0.45 0.152 0.05],'String','Enter The Source');
% gui.src=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.40 0.100 0.05],'BackgroundColor','white');
uicontrol('style','text','Units','Normalize','Position',[0.82 0.55 0.152 0.05],'String','Base stations No.');
gui.dst=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.50 0.100 0.05],'BackgroundColor','white');
uicontrol('style','text','Units','Normalize','Position',[0.82 0.45 0.152 0.05],'String','No. of packets');
gui.pkt=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.40 0.100 0.05],'BackgroundColor','white');
uicontrol('style','text','Units','Normalize','Position',[0.80 0.32 0.200 0.08],'String','Enter The Transmission Range');
gui.range=uicontrol('style','edit','Units','Normalize','Position',[0.84 0.26 0.100 0.05],'BackgroundColor','white');
gui.button=uicontrol('style','pushbutton','Units','Normalize','Position',[0.84 0.21 0.100 0.05],'string','plot path'...
,'callback',@nwpath,'BackgroundColor','cyan');
% uicontrol('style','pushbutton','Units','Normalize','Position',[0.70 0.01 0.100 0.05],'string','Clear All'...
% ,'callback',@cla,'BackgroundColor','cyan');
set(axes,'position',[0.1,0.1,0.7,0.7])
%% available the variables balues for other functions usage
handles.gui=gui;
guidata(hmain,handles)
get(gui.edit,'value')
%%
🎉3 参考文献
[1]赵海军,陈华月,陈毅红.WSN中边界覆盖的最佳部署及其选择[J/OL].云南大学学报(自然科学版):1-9[2023-04-26].
部分理论引用网络文献,若有侵权联系博主删除。



















