[ENM-LAP model] Matlab simulation of mobile ad hoc network topology evolution based on ENM-LAP model

1. Software version

MATLAB2013b

2. Theoretical knowledge of this algorithm

Mobile ad hoc networks not only have the characteristics of limited terminal energy, wireless channel conditions are affected by link distance, etc., but also have the law of preference for node location selection. In this section, a network topology evolution model based on node location preference is established and analyzed using complex network theory. The generation process of the network topology structure is as follows:

1) Growth: In the initial state of the network, there are a small number of nodes in the network. Let the number of nodes at this time be , this node is connected to the surrounding nodes according to the distance between each other and its own coverage. Here, it is assumed that each node is connected to all its neighbors. There are two purposes for this. The first is to reduce the complexity of the initial network and make the connection rules of the initial nodes simpler. The second is to try to avoid the existence of isolated nodes. , so that the network is in the state of a connected graph.

After the network is initialized, a new node is added to the network at each time step. The addition of a new node is based on the node's preference for the location, that is, the node will choose a corresponding location within a certain range to appear in the network according to certain network characteristics. Commonly defined network characteristics are node degree, node betweenness, node energy or other physical properties. In this paper, the node degree is considered as the basis for nodes to join the network. Equation (1) gives the probability expression that a new node follows when joining the network:

 In the formula, it represents the probability that the new node appears in a certain local area. In this paper, the local area is called "selection area", and its radius is called node selection radius L. k represents the degree of the nodes in the network, and represents the sum of the degrees of all nodes in the selected area. It can be seen from the expression that the position of the newly added node is determined by the sum of the degrees of the nodes in the selected area, which represents the activity degree of the nodes in the area. It is more and more closely connected, which has strong practical significance in the mobile self-organizing network with social attributes.

 2) Preferential connection: When a new node enters the network, the node will select m nodes within its coverage area to connect. Assume that the newly added node j has a probability of connecting to a node i that already exists in the network, and this probability is constrained by the node degree, the distance between two nodes, and the remaining energy E of node i.

 

Here, that is, the greater the residual energy of the node, the closer the distance between the two nodes, and the greater the probability that the new node is connected to it. It is noted here that in order to improve the channel quality, the new node should be connected to its closer nodes as much as possible. is an adjustable parameter that can adjust the relationship between energy and distance.

 In the evolution process, it is assumed that any two nodes in the network can communicate directly or indirectly, that is to say, the network is connected when the construction is completed, and there are no isolated nodes. This assumption is reasonable. For example, if a mobile self-organizing network is deployed in the square, any person in the network will be in contact with at least one person. If he does not contact anyone, then he does not belong to this network. . In addition, it is assumed that the network scale is large enough, and the connection edge of the node joining the network is small, and there can be more than one node in the coverage area of ​​the node.

3. Core code

clc;
clear;
close all;
warning off;





m0    = 9;
m     = 8;
N     = 500;
SCALE = 500;%
%通信半径
Radius= 90;%

alpha = 0.5;
Ec    = 1/400;
E0    = 1;



%%
%局域网偏好的网络拓扑
L  = 70;
X  = rand(1,m0)*SCALE;  
Y  = rand(1,m0)*SCALE; 
fed= [];
for i = 1:m0
    for j = 1:m0
        dist(i,j)=sqrt((X(i)-X(j))^2+(Y(i)-Y(j))^2);
    end
end

indx = 0;
NN   = 0;  
while NN < N  
      
      indx = indx + 1;rng(indx);
      %计算度
      if indx == 1
         X2 = X; 
         Y2 = Y;   
      end
      
      
      degree1 = [];
      for i = 1:length(X2)
          xx= 0;
          for j = 1:length(Y2)
              dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
              if dist <= Radius & dist > 0
                 xx= xx + 1; 
              end
          end
          degree1(i) = xx;
      end    
        
      degree2 = [];
      di      = [];
      for i = 1:length(X2)
          xx= 0;
          for j = 1:length(Y2)
              dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
              if dist <= Radius & dist > 0 & dist<= L
                 xx= xx + 1; 
              end
              di(i,j) = dist;
          end
          degree2(i) = xx;
      end    
      
      %计算节点剩余能源
      if indx == 1
         E(1:m0) = E0 - Ec;
         tmps    = E;
      else
         E       = tmps - Ec;
         E       = [E,E0 - Ec];
         tmps    = E;
      end
      
      for i = 1:length(X2)
          d      = di(i,:);
          fed(i) = real(E(i)^alpha*(1-d(i)/sum(d))^(1-alpha));
      end
      for i = 1:length(X2)
          Para2(i) = fed(i)*degree1(i)/(sum(fed.*degree1));%公式3.3连接8个概率
      end
      %选择概率最大的m个进行连接
      [Vp,Ip] = sort(Para2);
      Mindx   = Ip(end-m+1:end);
      
      %新节点加入网络时遵循的概率表达式
      Parea = (degree2)/sum(degree1);
      [V,I] = max(Parea);
      indx2  = find(Parea>=0.5*V);
      %Nr    = randperm(length(indx2));
      Nr    = floor(length(indx2)*rand)+1;
      if rand > max([0.5,sum(Parea(1:m))])%加入网络时遵循的概率表达式
         if rand < m*Vp(end)
            Xnew = X2(indx2(Nr))+L*cos(2*pi*rand);
            Ynew = Y2(indx2(Nr))+L*sin(2*pi*rand);
         else
            Xnew  = rand(1,1)*SCALE; 
            Ynew  = rand(1,1)*SCALE;
         end
      else
         Xnew  = rand(1,1)*SCALE;  
         Ynew  = rand(1,1)*SCALE;  
      end
      
      X2    = [X2,Xnew];
      Y2    = [Y2,Ynew];
      NN    = length(X2);
end

figure;
 
[D1,I1]=sort(degree1,'descend');
P1=(Parea);
loglog(degree1(1:5:end),1e-6./Parea(1:5:end),'rx','linewidth',2);

%%
%局域网偏好的网络拓扑
Ec = 1/4000;
X  = rand(1,m0)*SCALE;  
Y  = rand(1,m0)*SCALE; 
fed= [];
for i = 1:m0
    for j = 1:m0
        dist(i,j)=sqrt((X(i)-X(j))^2+(Y(i)-Y(j))^2);
    end
end

indx = 0;
NN   = 0;  
while NN < N  
      indx = indx + 1;rng(indx);
      %计算度
      if indx == 1
         X2 = X; 
         Y2 = Y;   
      end
      
      
      degree1 = [];
      for i = 1:length(X2)
          xx= 0;
          for j = 1:length(Y2)
              dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
              if dist <= Radius & dist > 0
                 xx= xx + 1; 
              end
          end
          degree1(i) = xx;
      end    
        
      degree2 = [];
      di      = [];
      for i = 1:length(X2)
          xx= 0;
          for j = 1:length(Y2)
              dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
              if dist <= Radius & dist > 0 & dist<= L
                 xx= xx + 1; 
              end
              di(i,j) = dist;
          end
          degree2(i) = xx;
      end    
      
      %计算节点剩余能源
      if indx == 1
         E(1:m0) = E0 - Ec;
         tmps    = E;
      else
         E       = tmps - Ec;
         E       = [E,E0 - Ec];
         tmps    = E;
      end
      
      for i = 1:length(X2)
          d      = di(i,:);
          fed(i) = real(E(i)^alpha*(1-d(i)/sum(d))^(1-alpha));
      end
      for i = 1:length(X2)
          Para2(i) = fed(i)*degree1(i)/(sum(fed.*degree1));%公式3.3连接8个概率
      end
      %选择概率最大的m个进行连接
      [Vp,Ip] = sort(Para2);
      Mindx   = Ip(end-m+1:end);
      
      %新节点加入网络时遵循的概率表达式
      Parea = (degree2)/sum(degree1);
      [V,I] = max(Parea);
      indx2 = find(Parea>=0.5*V);
      %Nr    = randperm(length(indx2));
      Nr    = floor(length(indx2)*rand)+1;
      if rand > max([0.5,sum(Parea(1:m))])%加入网络时遵循的概率表达式
         if rand < m*Vp(end)
            Xnew = X2(indx2(Nr))+L*cos(2*pi*rand);
            Ynew = Y2(indx2(Nr))+L*sin(2*pi*rand);
         else
            Xnew  = rand(1,1)*SCALE; 
            Ynew  = rand(1,1)*SCALE;
         end
      else
         Xnew  = rand(1,1)*SCALE;  
         Ynew  = rand(1,1)*SCALE;  
      end
      
      X2    = [X2,Xnew];
      Y2    = [Y2,Ynew];
      NN    = length(X2);
end

hold on
[D1,I1]=sort(degree1,'descend');
P1=(Parea);
loglog(degree1(1:5:end),1e-6./Parea(1:5:end),'b+','linewidth',2);
grid on
xlabel('节点度k');
ylabel('节点度分布p(k)');
legend('Ec=1/400','Ec=1/4000');


 4. Operation steps and simulation conclusion

1. Network topology with different radius lengths

2. In different selection area radii, the node degree distribution of the network

 Since in the mobile ad hoc network, each node has a certain coverage limit, the distribution of nodes in the network tends to be scattered with the increase of L, so the proportion of nodes with a larger degree is smaller than when L Low.

3. Node degree distribution at different node coverage (R=50, R=75)

The proportion of nodes with higher degrees is increased compared to R=90

4. Node energy consumption is different

4.2 ENM-LAP model and simulation analysis of average shortest path length

1. Different selection radius (the larger the L is to completely cover the entire regional network, which is equivalent to the BA network, the larger the path l is)

 2. Different coverage R (the larger the R is to completely cover the entire regional network, which is equivalent to the BA network, and the larger the path l is)

 3. Different energies

 1. Different deletion probabilities

2. Different selection radius (the larger the L is to completely cover the entire regional network, which is equivalent to the BA network, the larger the path l is)

5. References


A12-42

Guess you like

Origin blog.csdn.net/ccsss22/article/details/124437794