Regional Link Routing Algorithm for Wireless Sensor Networks based on Improved Grey Wolf Optimization Algorithm

In order to improve the survival time, connectivity and the active number of nodes in the wireless sensor network, this paper proposes a regional chain wireless sensor network routing algorithm (RWA) based on improved grey Wolf optimization algorithm. The algorithm uses the method of dividing regions into chains, and in each region, chains are formed to select cluster heads before communication. The simulation results show that RWA has an improvement in avoiding too long chain, balancing energy consumption and prolonging the network life cycle.


Network model
Assume that a wireless sensor network consists of n randomly deployed sensor nodes, let Si denote the ith node, and the corresponding set of nodes is {S1, S2,... Sn}.The WSN has the following properties: ①all nodes have the same initial characteristics, are randomly distributed in the monitoring area and are stationary; ② nodes can communicate with each other or directly with the base station; ③the location of the base station is fixed, the energy is not limited and the energy can meet the energy needs of the monitoring area; ④ The node has limited energy and dies when it runs out of energy.

Energy model
This paper employs the classical energy consumption model for the improved algorithm and simulation.Specifically, Equation (1) E TX (k, d) denotes the energy consumed by a sensor node to transmit k bits of data to a neighboring node at a distance d.This equation is comprised of two components, namely, the transmitting circuit loss and the power amplification loss, as illustrated in FIG. 1. Equation ( 2) characterizes the energy loss incurred during the reception of k bits of data, while Equation (3) describes the energy consumption associated with the fusion of k bits of data.

Fitness function design
In the grey Wolf optimizer, in addition to the need to initialize the position of each grey Wolf individual, its fitness function needs to be explicit.The fitness function further determines which three wolves will be elected as wolves α, β and δ, and the positions of wolves α, β and δ play a crucial role in estimating the position of prey.In this paper, the improved grey Wolf algorithm is used for the selection of cluster heads, therefore, the fitness function is designed mainly according to the parameters of WSN nodes.The design of the fitness function mainly considers the following four factors: • Relative residual energy of nodes.In addition to the energy consumption of monitoring information, the energy of cluster head is also used to receive data from member nodes in the cluster and forward data to the base station.Therefore, cluster heads consume more energy compared to normal nodes.In cluster head selection, the node with a high ratio K of residual energy Er to initial energy Ei is selected as the cluster head, which can more effectively ensure the stable transmission of data, reduce the mortality rate of remaining nodes, and increase the network life cycle, which is denoted as: • The distance between nodes in the subregion.Node distances correspond to the distances between α, β and δ wolves, respectively, denoted as D; (5) Expectation of the distance between cluster heads in adjacent sub-regions.The expectation of distance cube between two cluster heads in two adjacent sub-regions is denoted as follows: ) In summary, the fitness function is designed as follows: Among them, a 1 , a 2 , a 3 , a 4 are the weight coefficients that balance the relative residual energy of nodes, the distance between nodes in sub-regions, the expected distance between cluster heads in adjacent sub-regions, and the average cluster head energy consumption of nodes.

Grey Wolf optimization algorithm based on dynamic weight
The initialization process of the algorithm made full use of the position of the Wolf pack.Considering that the nodes transmitted data along the link, the mutual distance between the nodes was converted into the corresponding weight as the initial weight factor to find the prey position The initial position Xp (0) of the prey is as follows.
In the formula: X α (0), X β (0) and X δ (0) are the initial positions of α, β and δ wolves; D α, β , D β, δ and D δ, α denote the distances between wolves α, β and δ, respectively.ω α , ω β , ω δ represent the initial weight of the distance between each gray Wolf relative to the prey in the initial state of the first child, respectively.In the subsequent iterations of the algorithm, the weight factors are dynamically adjusted and updated according to the following equation: In the formula: ω t+1 α , ω t+1 β , ω t+1 δ are the weights of the prey positions of α, β, δ wolves at t+1 iterations.F α , F β and F δ are the fitness values of wolves α, β and δ.After t+1 iterations, the position of the prey is updated to X p t+1 Whether the region is of the prescribed interval size is judged in the subregion process.If the length and width of the region were between the upper and lower thresholds, a new node was added to the region.If not, remove the node.Starting from the nodes close to the sink node, the division is successively outward until all area divisions tend to the average size FIG. 2. For the area at the edge of the network, the nodes are often sparse, and the network area can not meet the set threshold, as long as the node energy consumption is small.

Network partitionong phase
After the entire network area is partitioned according to the threshold value, the chaining phase is entered.After the partition, the network starts to build the chain.Since the monitoring area has been partitioned, each node has two marks: the same area mark and the different area mark.Each sub-area is equivalent to a cluster and is linked separately.Taking the nodes in the same rectangular area as an example, when the chain is formed inside the sub-area, the same area mark is set, the nodes in each ring sub-area are numbered, and the fitness value of each node is calculated.The path of each node was traversed into a chain in turn to form a number of links, the length of each link was compared, and the shortest path was selected as the initial link.When linking between sub-regions, different region markers are set to form a cluster head chain between cluster heads in the direction of the base station.FIG. 3 shows the schematic diagram of node distribution and chain building.

Cluster head selection phase
For sub-regions containing less than 3 nodes within the same region, node chain and cluster head selection cannot be performed, and these nodes are treated as redundant for data transmission.On the other hand, sub-regions with more than three nodes execute the grey Wolf optimization algorithm.
Within the maximum number of iterations, a loop is executed to calculate the fitness value of each node, and the fitness values of nodes in each sub-region are sorted.The top three nodes are selected as α, β, and δ wolves.These nodes are then used to update the prey position, which is mapped to the cluster head node position to obtain the optimal solution, thus ending the cluster head selection process.
To account for the node residual energy and distance from the node to prey, the minimum fitness principle is applied to the mapping relationship between prey and cluster head.The fitness function is designed as follows: E MAX represents the maximum residual energy in the cluster, E MIN represents the minimum residual energy in the cluster, and E denotes the residual energy of each node.These values are used to represent the average cluster head energy consumption of points in the r round.
In a wireless sensor network with randomly distributed sensor nodes in the monitoring area, the positions of the nodes are discrete.After the prey position is updated using the improved Wolf position update formula in the Grey Wolf optimization algorithm based on the fitness function, the prey location may not necessarily correspond to the actual sensor node location in the monitoring area.
Therefore, it is necessary to convert the prey location to the sensor node location using the following formula: For each sub-region, a link is established and a cluster head is selected based on the aforementioned criteria.Data is then transmitted from the two end nodes of the link to the cluster head.
Once the cluster head receives data from all nodes in the cluster, it transmits the data to the cluster head of the next sub-region closer to the base station along the cluster head chain.This process continues until all the data is received by the base station.If a node within a sub-region becomes inactive, the link must be re-established before data transmission can resume.
To determine the cluster head using the improved grey Wolf optimization algorithm, the distance between each node in the cluster and the prey position X p is calculated using the formula, where X p represents the location of the prey, X n represents the location of the sensor node, N represents the number of sensor nodes, and d(X p ,X n ) is the distance between the location of the prey and the sensor node in the cluster.The node position with the latest distance is taken as the actual position of the prey, which is the cluster head.
In the subsequent process, each cluster does not update the cluster head after each round of transmission.Instead, the base station marks the ratio of the residual energy E r of the cluster head in each sub-region to the initial energy E i as the relative residual energy K of the node.This value is then compared with the set node energy threshold E thres to determine the update time of the cluster head.As the network energy consumption increases, the value of the cluster head node K gradually decreases.Therefore, the threshold value is variable and gradually decreases with the energy consumption of network nodes.The initial value of the threshold should be moderate.If the initial threshold is too large, the replacement of cluster head nodes will be more frequent, which will increase network overhead.

Data transfer phase
To begin with, a link is established for each sub-region based on the aforementioned criteria, and a cluster head is selected.Data is then transmitted from the two end nodes of the link to the cluster head.Once the cluster head receives data from all nodes in the cluster, it transmits the data to the cluster head of the next sub-region closer to the base station along the cluster head chain.This process continues until all the data is received by the base station.If a node within a sub-region becomes inactive, the link must be re-established before data transmission can resume.

Simulation parameter selection
The test area set in this paper is 200m×200m, and 200 nodes are deployed in the area.The coordinate of the base station is set at the origin point (0,0) in the figure, and the comparison simulation experiment has 2000 rounds in total.Considering the correlation of data, chain length, overall network delay and energy consumption, the whole network area is divided into six rectangular areas.The upper threshold of the length and width of the rectangle area are 200m,40m, and the lower threshold is 75m, 10m.In order to verify the performance of the improved algorithm, MATLAB is used to conduct simulation experiments.The simulation parameters of the algorithm are shown in Table Ⅰ

Performance evaluation index
Figure 4 shows the curves of each round of viable nodes of each algorithm within the effective working time of the network.Figure 4 shows the comparison of the number of nodes still surviving in the network after each working cycle of each algorithm.According to the curve in Figure 4, TTEMR algorithm has its first failure node in 287 rounds, and PEGASIS algorithm has its first failure node in 492 rounds.The first failure node of RWA algorithm did not appear until 970 rounds, while the number of failure nodes of other two algorithms both exceeded 50% of the total number.After 1300 rounds, the failure nodes of each algorithm are more than 80%. Figure 5 shows the total network residual energy of each algorithm for each round in the network working process, and shows the comparison of energy consumption speed between RWA algorithm and other three algorithms.As can be seen from Figure 6, PEGASIS algorithm has the fastest energy consumption, while RWA algorithm has a slower energy consumption rate than the other two algorithms, and the energy consumption is more average.In addition, in the same work, RWA algorithm has a higher number of nodes remaining alive than other algorithms, which can effectively lengthen the working time of the network.
Figure 6 illustrates a comparison of the total energy consumption of the entire network among the RWA algorithm proposed in this paper, as well as PEGASIS and TTEMR algorithms.The X-axis represents the number of rounds, while the Y-axis depicts the total energy consumption of the whole network.The results depicted in Figure 6 demonstrate that the RWA algorithm consumes the least amount of energy, followed by PEGASIS and then TTEMR.This is because the RWA algorithm uses a first subdivision and then intra-region chain formation method, which avoids the issues of excessively long chains and potential cross-chaining that can occur with chain formation algorithms.Additionally, the algorithm improves the energy consumption of cluster head selection by utilizing an improved Grey Wolf optimization algorithm to select the optimal cluster head and address the issue of uneven convergence of the algorithm.

Conclusions
Based on PEGASIS protocol, this paper proposes a regional chain routing protocol (RWA) for wireless sensor network based on improved grey Wolf optimization algorithm.Based on PEGASIS, this paper proposed a method of regional chaining, and used the improved grey Wolf optimization algorithm for cluster head election, which could effectively avoid the problems of too long chaining, high energy consumption and low transmission efficiency caused by cross links.

Figure 1 .
Figure 1.Energy consumption model for wireless transmission

Figure 3 .
Figure 3.The nodes in the region form a chain graph

Figure 4 .Figure 6 .
Figure 4. Network life cycle comparison Figure 5.Comparison of network residual energy

region link routing algorithm based on improved grey Wolf optimization
Firstly, the sensor nodes are randomly deployed in the WSN area.After deployment, the neighbor nodes divided the whole network area according to the distance from the sink node.Suppose the whole wireless sensor network is divided into k regions, and suppose there are N nodes in the network.According to the model in FIG.1, the total energy consumption of K clusters in the energy consumption of K clusters in the network is as follows: