目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
无线传感器网络是由一定数量的无线传感器节点组成的网络系统,各节点可采集环境数据并通过无线通信进行数据传输,目前已广泛应用于军事、智能交通、环境监控等多个领域。在传统的无线传感器网络应用中,由于节点体积一般较小,网络寿命会受到节点电池容量的制约。而且,无线传感器网络中节点数量庞大、分布范围极广,因此,为所有节点更换电池是一件难以实现且成本极高的事情。为解决上述问题,本文提出一种超低功耗可持续无线传感器网络,利用无线能量传输技术将采集环境中的电磁波能量转化为电能为节点供电,同时通过引入唤醒无线电技术和环境反向散射技术进一步降低无线传感器网络的功耗,从而延长网络的使用寿命。
本文为用于超低功耗无线传感器网络的 MATLAB 消息传递算法。该程序基于Dijkstra算法,计算发送的每条消息的变化权重函数。节点的权重函数将考虑与基站的距离,但也考虑每个节点的剩余能量,这在超低功耗环境中至关重要。
📚2 运行结果
主函数部分代码:
clear n = 25; %number of nodes area = 10; %area in m^2 covered per node r = 7; %range of a node roundmax = 1000; %number of rounds simulation will run for dimension = sqrt(area)*sqrt(n); BS = BaseStation(dimension/2, dimension/2); %base station postion at the centre %deploy network Network = CreateNodes(n, dimension); distances = CalculateDists (n, Network); dist2BS = calcBSDist(n,Network, BS); connections = CalculateConnections (n,r,dist2BS, distances); [s,t] = GraphPoints (n, connections); %energy after setup phase for i = 1:n c=0; for j = 1:n %send a wakeup packet to all nodes Network(i).energy = NewEnergy(Network(i), 0); %if a node is in range, respond if connections(i,j) == true Network(i).energy = NewEnergy(Network(i), 4); c=c+1; end end %send one packet to the BS, with 4bytes for every neighbouring node Network(i).energy = NewEnergy(Network(i), 4*c); end %draw graph weights = CalculateWeights(distances, Network, n, connections); G=DrawGraphWeight (s, t, weights); %assign parents and children to Nodes for i = 1:n P = shortestpath(G, i, n+1); if size(P,2)>2 Network(i).parent = P(2); Network(P(2)).child = horzcat(Network(P(2)).child, i); end end %find first gen nodes dC = 0; for i = 1:n if connections (i, n+1) == true dC=dC+1; end end directConnect = zeros(1,dC); j = 0; for i = 1:n if connections(i,n+1) == true j = j+1; directConnect(j) = i; end end %main loop for i = 1:roundmax for j = 1:n dependents = findDependents(Network(j),Network); for k = 1:size(Network(j).child,2) %send one packet per child %length of packet depends on that child's no.dependents %the instruction is only one byte long bytes = size(findDependents(Network(Network(j).child(k)),Network),2); Network(j).energy = NewEnergy(Network(j), bytes); end %finally, report data back to BS, 1 byte for data, 2 bytes each for %strength of links to children Network(j).energy = NewEnergy(Network(j), 1 + 2*size(Network(j).child,2)); %data out end weights = CalculateWeights(distances, Network, n, connections); G=DrawGraphWeight (s, t, weights); %clear children for z = 1:n Network(z).child=[]; end %assign parents and children for q = 1:n %shortestpath in MATLAB is the built-in function for Dijkstra %shortest paths are found based on changing weight function P = shortestpath(G, q, n+1); if size(P,2)>2 Network(q).parent = P(2); Network(P(2)).child = horzcat(Network(P(2)).child, q); end end end
🎉3 参考文献
[1]陈俊聪. 超低功耗可持续无线传感器网络的研究与实现[D].华南理工大学,2019.
部分理论引用网络文献,若有侵权联系博主删除。