基于粒子群优化算法的最佳方式设置无线传感器节点的位置,以减轻由于任何能量耗尽节点而产生的覆盖空洞(Matlab代码实现)
创始人
2024-02-07 03:55:17
0

 👨‍🎓个人主页:研学社的博客 

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

本文为了以最佳方式设置无线传感器节点的位置,以减轻由于任何能量耗尽节点而产生的覆盖空洞。粒子群优化(PSO)用于此目的。目标是具有可用节点的最大覆盖区域。此优化中不使用任何约束。

📚2 运行结果

 

 

 

部分代码:

close all
clear
clc
addpath(genpath(cd))
warning('off')
%%
N=10;                       % number of nodes
area=[10,10];              % nodes deployment area in meter
Trange=2;                   % transmission range of sensor node in meter
nodes.pos=area(1).*rand(N,2);% nodes geographical locations
lambda=0.125;                % signal wavelength in meter
nodes.major = Trange;        % major axis for ellpitical range in meter
nodes.minor = lambda*Trange;  % minro axis for ellipitical range in meter
% redundantNo=9;               % number of healing nodes   
redundantNo=round(10*N/100);
%% plot the nodes deployment
cnt=1;
for ii=1:N      
    for jj=1:N
        if ii~=jj
            nodes.distance(ii,jj)=pdist([nodes.pos(ii,:);nodes.pos(jj,:)]);
            if nodes.distance(ii,jj)                 nodes.inrange(ii,jj)=1;
            else
                nodes.inrange(ii,jj)=0;
            end
        end
    end
end

figure
F5=plot(nodes.pos(:,1),nodes.pos(:,2),'.','color','r');
hold on
for ii=1:N                   % plot the circular transmission range
    [nodes.circle.x(ii,:),nodes.circle.y(ii,:)]=circle(nodes.pos(ii,1),nodes.pos(ii,2),Trange);
    F6=fill(nodes.circle.x(ii,:),nodes.circle.y(ii,:),[0.25,0.25,0.25]);
    alpha 0.3
    hold on
end
axis on
xlabel('x(m)')
ylabel('y(m)')
title('Initial Placement of Nodes with circular transmission range')
%% plot delauny triangle
TRI = delaunay(nodes.pos(:,1),nodes.pos(:,2));
figure(2)
F5 = plot(nodes.pos(:,1),nodes.pos(:,2),'.','color','r');
hold on
for ii=1:N                   % plot the circular transmission range
    [nodes.circle.x(ii,:),nodes.circle.y(ii,:)]=circle(nodes.pos(ii,1),nodes.pos(ii,2),Trange);
    F6=fill(nodes.circle.x(ii,:),nodes.circle.y(ii,:),[0.25,0.25,0.25]);
    alpha 0.3
    hold on
end
axis on
xlabel('x(m)')
ylabel('y(m)')
title('Coverage hole in initila position of Nodes')
hold on
triplot(TRI,nodes.pos(:,1),nodes.pos(:,2))
%% Hole detection
[holeDetected.circle,Circmcenter.circle,circumradius.circle]=holeDetection(TRI,nodes,F5,F6,Trange,area,2,1);
display(['--> No of detected Holes for Circular = ',num2str(numel(find(holeDetected.circle)))])
%% PSO optimize position of rest wsn nodes to cover the hole
nvars = 2*(N);
fun=@(x)objf(x,Trange,area);
lb=zeros(nvars,1);
ub=area(1).*ones(nvars,1);
options = optimoptions(@particleswarm,'Display','iter','MaxIterations',100,'PlotFcn','pswplotbestf');
[x,fval] = particleswarm(fun,nvars,lb,ub,options);
finalPos = reshape(x,[numel(x)/2,2]);
% plot the final tuned Node' pos
figure
plot(finalPos(:,1),finalPos(:,2),'o','color','r');
hold on
for ii=1:N                 % plot the circular transmission range
    [finalcircle.x(ii,:),finalcircle.y(ii,:)]=circle(finalPos(ii,1),finalPos(ii,2),Trange);
    fill(finalcircle.x(ii,:),finalcircle.y(ii,:),[0.25,0.25,0.25]);
    alpha 0.3
    hold on
end
axis on
xlabel('x(m)')
ylabel('y(m)')
title('Optimized location of Nodes with circular transmission range')

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

Abhishek Gupta (2022). WSN-Nodes-Location-Optimiation .

🌈4 Matlab代码实现

相关内容

热门资讯

喜欢穿一身黑的男生性格(喜欢穿... 今天百科达人给各位分享喜欢穿一身黑的男生性格的知识,其中也会对喜欢穿一身黑衣服的男人人好相处吗进行解...
发春是什么意思(思春和发春是什... 本篇文章极速百科给大家谈谈发春是什么意思,以及思春和发春是什么意思对应的知识点,希望对各位有所帮助,...
网络用语zl是什么意思(zl是... 今天给各位分享网络用语zl是什么意思的知识,其中也会对zl是啥意思是什么网络用语进行解释,如果能碰巧...
为什么酷狗音乐自己唱的歌不能下... 本篇文章极速百科小编给大家谈谈为什么酷狗音乐自己唱的歌不能下载到本地?,以及为什么酷狗下载的歌曲不是...
华为下载未安装的文件去哪找(华... 今天百科达人给各位分享华为下载未安装的文件去哪找的知识,其中也会对华为下载未安装的文件去哪找到进行解...
家里可以做假山养金鱼吗(假山能... 今天百科达人给各位分享家里可以做假山养金鱼吗的知识,其中也会对假山能放鱼缸里吗进行解释,如果能碰巧解...
四分五裂是什么生肖什么动物(四... 本篇文章极速百科小编给大家谈谈四分五裂是什么生肖什么动物,以及四分五裂打一生肖是什么对应的知识点,希...
怎么往应用助手里添加应用(应用... 今天百科达人给各位分享怎么往应用助手里添加应用的知识,其中也会对应用助手怎么添加微信进行解释,如果能...
客厅放八骏马摆件可以吗(家里摆... 今天给各位分享客厅放八骏马摆件可以吗的知识,其中也会对家里摆八骏马摆件好吗进行解释,如果能碰巧解决你...
美团联名卡审核成功待激活(美团... 今天百科达人给各位分享美团联名卡审核成功待激活的知识,其中也会对美团联名卡审核未通过进行解释,如果能...