目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
空中无人机(UAV)长期以来一直被用作移动网络中的网络处理器,但它们现在被用作移动边缘计算(MEC)中的移动服务器。由于它们的灵活性、可移植性、强大的视线通信联系以及低成本、可改变的使用,它们在研究和商业应用中变得更加流行。广泛的民用服务现在可能因其基本特性而得到支持,包括运输和工业监测、农业以及森林火灾和无线服务。本项目研究了基于无人机的移动边缘计算网络,其中无人机(UAV)进行移动终端用户提供的计算。
要运行代码,请执行以下步骤:
对于单次运行,请使用main.m。
本代码是程序的主要入口,它自动绘制和保存图形。
用于批处理运行。使用main_loop.m。
本代码用于循环以获取批处理数据,其中可以将参数设置为一系列值,以检查它们对结果的影响。例如,K_list=[5],M_list=[0.01,0.02]
运行main_lop.m将自动输出记录结果的表格。
所有其他脚本和函数都在这两个脚本中调用。
📚2 运行结果
🎉3 参考文献
[1]邱铭. 基于微波供能的无人机移动边缘计算网络研究[D].广东工业大学,2020.DOI:10.27029/d.cnki.ggdgu.2020.001588.
👨💻4 Matlab代码
主函数部分代码:
%% parameters
global imgnum; %looping times
global N; % divide [0,1]*[0,1] map into N*N grid
global TARGET;
global UAV_info; % UAVs location matrix
global UAVnum;
global UAV_pos; % UAVi's initial position
global SumTarget;
global needReplan;
global enemysUK;
global enemysUK2plot;
global enemysK;
global enemysSize;
global traceRecord;
global G;
%% initialize target
imgnum=0;
TARGET = round([0.95 0.95]*N); %target position
%% initialize UAV
UAV_info = UAV_initialize;
UAVnum=size(UAV_info,1);
UAV_pos=[];
for i=1:UAVnum
UAV_pos(i,:)=UAV_info(i,1:2);
end
needReplan=ones(1,UAVnum); %UAVi need to replan when needReplan(i)=1
SumTarget=zeros(1,UAVnum); %when UAVi's SumTarget(i)=1, don't need further move
%% initialize enemys
enemysUK=enemyGuass; %Unknown obstacles(includs all UAVs) location matrix
enemysSize=size(enemysUK,1);
enemysUK2plot=enemys(); %used when drawing map
enemysK={}; % no enemy is detected initially
for i=1:UAVnum
enemysK{i}=[];
end
%% initialize trace record
traceRecord={}; % no record of trace initially
for i=1:UAVnum
traceRecord{i}=[];
end
%% initialize G Matrix
G={};
D=ones(N,N)*N^2; %initialize D with all elements are N^2 and target 0
D(TARGET(1),TARGET(2))=0;
for i=1:UAVnum
G{i}=[D];
end
%% parameters
global imgnum; %looping times
global N; % divide [0,1]*[0,1] map into N*N grid
global TARGET;
global UAV_info; % UAVs location matrix
global UAVnum;
global UAV_pos; % UAVi's initial position
global SumTarget;
global needReplan;
global enemysUK;
global enemysUK2plot;
global enemysK;
global enemysSize;
global traceRecord;
global G;
%% initialize target
imgnum=0;
TARGET = round([0.95 0.95]*N); %target position
%% initialize UAV
UAV_info = UAV_initialize;
UAVnum=size(UAV_info,1);
UAV_pos=[];
for i=1:UAVnum
UAV_pos(i,:)=UAV_info(i,1:2);
end
needReplan=ones(1,UAVnum); %UAVi need to replan when needReplan(i)=1
SumTarget=zeros(1,UAVnum); %when UAVi's SumTarget(i)=1, don't need further move
%% initialize enemys
enemysUK=enemyGuass; %Unknown obstacles(includs all UAVs) location matrix
enemysSize=size(enemysUK,1);
enemysUK2plot=enemys(); %used when drawing map
enemysK={}; % no enemy is detected initially
for i=1:UAVnum
enemysK{i}=[];
end
%% initialize trace record
traceRecord={}; % no record of trace initially
for i=1:UAVnum
traceRecord{i}=[];
end
%% initialize G Matrix
G={};
D=ones(N,N)*N^2; %initialize D with all elements are N^2 and target 0
D(TARGET(1),TARGET(2))=0;
for i=1:UAVnum
G{i}=[D];
end