目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
无线传感器网络是通过大量分布的传感器节点作为终端来协同感知和自主地监测外部世界,以多跳、自组织或协作的方式进行通信和信息传输,具备自主决策和自控能力,并智能地完成目标任务。这些传感器节点具有体积微小、能耗较低等特点,并且计算和通信能力具有局限性。由于无线传感器网络具备实用性高、设置灵活,网络规模具备可扩展性,接入方式可变性等特征,近十多年来,无线传感器网络已经受到学术界和工业界密切的关注,并已广泛应用于智慧城市、国防军事、智能交通、工农业生产、智慧医疗、环境灾害预警等众多领域。作为一种新的计算模式,无线传感器网络已经发展成为涉及多种技术的交叉学科,成为构造智能物联系统和普适计算的关键技术,在物联网时代具有决定性作用。传感器网络通常是大规模部署在环境比较恶劣、高危、偏僻的无人区域。在海洋、浅海和湖泊等水下部署的无线传感器网络,明显具有传感器节点的位置或感知方向易发生摆动或漂移、监测信号衰减较快、噪声干扰大、节点能量损耗快、部署成本高等特性。因此,在水下复杂、多变的应用环境下,构建无线传感器网络节点部署优化策略将对提升传感器节点的监测能力和无线传感器网络的综合性能至关重要,也是无线传感器网络相关研究的基础性和关键性问题。本文针对二维有向无线传感器网络、水下三维异构无线传感器网络节点部署优化以及水下三维传感器网络异构节点部署优化问题,深入系统研究了不同目标应用所处场景下网络部署面临的环境特点和具体应用需求特征,探索具有针对性的、高效的无线传感器网络节点部署和优化方案,以有效分散节点功耗,提升感知质量,延长网络生命周期。本文主要研究内容与成果包括以下方面:1.二维有向无线传感器网络节点部署优化策略。针对在二维环境下的有向无线传感器网络监测任务中,以随机部署方式撒播在指定监测区域内部的有向感知节点通常会出现分布不均匀等问题,分析有向传感器节点、概率感知模型特征以及多个传感器节点对监测目标点的协同感知模型的特点,提出了极坐标下的感知优化策略,指导二维平面有向传感器节点的方向调整和感知优化,从而提升网络节点感知能力。
📚2 运行结果
主函数部分代码:
clear;
clc;
close all;
filename = "amal.gif";
%axis tight manual;
%ITERATIONS = 1200;
objective_history = [];
%fitness_history = [];
min_lifetime = -1;
min_index_lifetime = -1;
final_energy = 15;
prev_mean = -inf;
prompt = {'Number of Sensor Nodes', 'Number of Heterogenous Nodes', 'Initial energy of each sensor Node', 'Initial energy of each heterogenous Node', 'Size of Terrain(x)', 'X coordinate of Sink', 'Y coordinate of Sink', 'Total Population size:','Maximum Iterations:', 'Random Number generator Seed:', '0 for fixed deployment, 1 for random'};
title = 'Multihop Transmission Genetic Algorithm';
dims = [1 70];
definput = {'30', '6', '0.5', '1.5', '100', '50', '50', '1000', '50', '1', '1'};
answer = inputdlg(prompt,title,dims,definput);
NODES = str2double(answer{1});
HET_NODES = str2double(answer{2});
SENSOR_ENERGY = str2double(answer{3});
HETER_ENERGY = str2double(answer{4});
TERRAIN_SIZE = str2double(answer{5});
SinkX = str2double(answer{6});
SinkY = str2double(answer{7});
POPULATION_SIZE = str2double(answer{8});
ITERATIONS = str2double(answer{9});
RNG_SEED = str2double(answer{10});
DEP_TYPE = str2double(answer{11});
tic
relay_energy = SENSOR_ENERGY + HETER_ENERGY;
min_positions = zeros(1, HET_NODES);
% generate terrain and initialize sensor nodes
if DEP_TYPE == 1
[x, y, en] = sensor_nodes(NODES, TERRAIN_SIZE, SENSOR_ENERGY);
else
[x, y, en] = fixed_deployment(SENSOR_ENERGY);
NODES = 40;
TERRAIN_SIZE = 100;
end
nn_mv_tic = tic;
[nn, nn_dist] = calculate_nearest_neighbour(x, y, SinkX, SinkY);
mv = calculate_multiplier(size(x, 2), nn);
fprintf('Time Taken to calculate nn&mv : %.2f seconds. \n',toc(nn_mv_tic));
initial_energy = en;
[lifetime1, en2] = multihop_transmission(x, y, en, SinkX, SinkY, nn_dist, mv);
initial_lifetime = lifetime1;
total_energy_hist = -1 * ones(1, ITERATIONS);
lifetime_hist = -1 * ones(1, ITERATIONS);
rng(RNG_SEED);
p = [x(:) y(:)];
% initial population
% heter_nodes_index = randi([1, size(x, 2)], POPULATION_SIZE, HET_NODES);
for i = 1 : POPULATION_SIZE
heter_nodes_index(i, :) = randperm(size(x, 2), HET_NODES);
end
int_hni = heter_nodes_index;
%for i = 1:HET_NODES
% hetero_nodes_position(i, 1) = x(heter_nodes_index(i));
% hetero_nodes_position(i, 2) = y(heter_nodes_index(i));
% en(heter_nodes_index(i)) = en(heter_nodes_index(i)) + HETER_ENERGY;
%end
%plot_nodes(x, y, SinkX, SinkY, hetero_nodes_position);
f = figure('Position', [750, 50, 600, 400]);
saturation_count = 0;
for z = 1 : ITERATIONS
lifetimes = -1 * ones(1, POPULATION_SIZE);
fitness = -1 * ones(1, POPULATION_SIZE);
objective = -1 * ones(1, POPULATION_SIZE);
for i = 1 : POPULATION_SIZE
energy = initial_energy;
for j = 1 : HET_NODES
energy(heter_nodes_index(i, j)) = energy(heter_nodes_index(i, j)) + HETER_ENERGY;
end
[lifetime2, en3] = multihop_transmission(x, y, energy, SinkX, SinkY, nn_dist, mv);
lifetimes(i) = lifetime2;
objective(i) = lifetime2;
fitness(i) = 1 / (1 + objective(i));
end
%lifetime_hist(z) = min(lifetimes);
[lifetime_hist(z), min_index] = max(lifetimes(~ismember(lifetimes, 0)));
if lifetime_hist(z) > min_lifetime
min_lifetime = lifetime_hist(z);
all_min_indices = find(lifetimes == max(lifetimes));
random_index = randi([1, size(all_min_indices, 2)]);
min_index_lifetime = all_min_indices(random_index);
min_positions = heter_nodes_index(min_index_lifetime, :);
for i = 1:HET_NODES
hetero_nodes_position(i, 1) = x(min_positions(i));
hetero_nodes_position(i, 2) = y(min_positions(i));
end
end
🎉3 参考文献
[1]王若霖. 基于群智能算法的异构WSN节点部署优化研究[D].哈尔滨工程大学,2020.