Wireless sensor network location simulation algorithm based on matlab particle swarm optimization

Posted by intercampus on Sat, 19 Feb 2022 09:28:33 +0100

1 Introduction

As one of the 21 most influential technologies in the 21st century and one of the top ten technologies that change the world, Wireless Sensor Networks (WSN) is widely used in industry, transportation, medical treatment, environmental protection, military management and so on. WSN is usually composed of a large number of wireless sensor nodes that can be randomly distributed to unattended areas for data collection, so it is difficult to obtain the specific location of nodes. At present, the mature GPS technology can accurately obtain the location information of each node, but due to the high cost of GPS positioning and harsh environmental conditions, GPS positioning can not be fully applied to WSN. Therefore, the use of location algorithm to estimate unknown nodes with a small number of anchor nodes with location information has become a hot spot in related research. At present, the localization algorithm is mainly realized through the following two steps: the first step is to measure the distance or angle relationship between the unknown node and the anchor node; The second step needs to use the measurement information of the previous step to calculate the location information of the unknown node. Typical distance measurement techniques include ranging using ^ RSSI ^ AOA ^ TOA ^ or TDOA ^ etc. RSSI (Received Signal Strength Indicator) algorithm calculates the distance between the unknown node and the anchor node by measuring the attenuation degree in the process of signal transmission. The principle of AOA (Angle Of Arrival) algorithm is to measure the actual distance through the angle at which the signal reaches the receiving end. TOA (time of arrival) algorithm and TDOA (Time Difference Of Arrival) algorithm calculate the actual distance between the unknown node and the anchor node by measuring the transmission time of the signal and the arrival time difference of the two signals respectively.

This paper proposes a node location algorithm for wireless sensor networks based on particle swarm annealing algorithm and RSSI Firstly, RSSI ranging technology is used to collect the communication information and distance estimation between nodes in the network, and the beacon nodes are selected; Secondly, by treating the location problem as an optimization problem, particle swarm annealing algorithm is used to optimize the location results of unknown nodes Simulation results show that the proposed location algorithm has high location accuracy

Part 2 code

%Location algorithm of Trilateration %dA,dB,dC From three beacon nodes to unknown nodes(Assumed coordinates[x,y]unknown)Simulated measurement distance function [P] = Triangle(S,dA,dB,dC)          %Unknown coordinate definition x,y Is a symbolic variable     syms x y;          %Distance equation,Take the beacon node as the center of the circle,The measured distance from the beacon node to the unknown node is three circles for the radius     f1 = (S(1,1)-x)^2+(S(1,2)-y)^2-dA^2;     f2 = (S(2,1)-x)^2+(S(2,2)-y)^2-dB^2;     f3 = (S(3,1)-x)^2+(S(3,2)-y)^2-dC^2;          %Any two equations are simultaneous,Find the intersection of any two circles     s1 = solve(f1,f2); %seek A,B Intersection of two circles     s2 = solve(f2,f3); %seek B,C Intersection of two circles     s3 = solve(f1,f3); %seek A,C Intersection of two circles          %Will result(Symbolic variable)Convert to double     x1 = double(s1.x);     y1 = double(s1.y);     x2 = double(s2.x);     y2 = double(s2.y);     x3 = double(s3.x);     y3 = double(s3.y);          %Select the three intersections on the inside     %Two circles intersect at two points,The point near the center of the third circle is the selected intersection Pab,Pbc,Pac     d1(1) = sqrt(((S(3,1)-x1(1))^2+(S(3,2)-y1(1))^2));     d1(2) = sqrt(((S(3,1)-x1(2))^2+(S(3,2)-y1(2))^2));     if d1(1) <= d1(2)         Pab(1) = x1(1);         Pab(2) = y1(1);     else         Pab(1) = x1(2);         Pab(2) = y1(2);     end     d2(1) = sqrt(((S(1,1)-x2(1))^2+(S(1,2)-y2(1))^2));     d2(2) = sqrt(((S(1,1)-x2(2))^2+(S(1,2)-y2(2))^2));     if d2(1) <= d2(2)         Pbc(1) = x2(1);         Pbc(2) = y2(1);     else         Pbc(1) = x2(2);         Pbc(2) = y2(2);     end     d3(1) = sqrt(((S(2,1)-x3(1))^2+(S(2,2)-y3(1))^2));     d3(2) = sqrt(((S(2,1)-x3(2))^2+(S(2,2)-y3(2))^2));     if d3(1) <= d3(2)         Pac(1) = x3(1);         Pac(2) = y3(1);     else         Pac(1) = x3(2);         Pac(2) = y3(2);     end          %Pab     %Pbc     %Pac          %Find three intersections inside three circles Pab,Pbc,Pac Centroid of,Unknown node P,Complete positioning     P(1) = (Pab(1)+Pbc(1)+Pac(1))/3;     P(2) = (Pab(2)+Pbc(2)+Pac(2))/3;

3 simulation results

4 references

[1] Fan Yuhong, Peng Hong, Zhu Chenliang, et al A location algorithm for wireless sensor networks based on genetic simulated annealing algorithm and RSSI [J] Journal of Xihua University: Natural Science Edition, 2010, 29 (6): 4

Blogger profile: good at matlab simulation in intelligent optimization algorithm, neural network prediction, signal processing, cellular automata, image processing, path planning, UAV and other fields. Relevant matlab code problems can be exchanged through private letters.

Some theories cite online literature. If there is infringement, contact the blogger and delete it.

Topics: MATLAB network Algorithm