A WSN Clustering Multi-Hop Routing Protocol Using Cellular Virtual Grid in IoT Environment

By dividing the grid and clustering multi-hop algorithm, the lifetime of WSN can be prolonged eﬀectively, and the reliability of the system can be improved. In order to prolong network lifetime and balance network energy consumption, a WSN clustering multihop routing protocol for electric vehicles using cellular virtual grid is proposed. The routing mechanism divides cells into regular hexagons. In the cluster head selection stage, the node angle ratio, distance ratio, and throughput optimization threshold function are introduced to select cluster heads independently. In data transmission, single hop in cluster and mixed hop between clusters are used to optimize the path and reduce energy consumption when transmitting data among cluster head nodes. In the routing protocol, the path cost from the intermediate node to the target node is calculated according to the distance and residual energy. The simulation results show that the protocol has obvious advantages in reducing network energy consumption compared with several traditional algorithms when the running time reaches 1200s and the network coverage is high.


Introduction
e Internet of ings (IoT) is a system used to describe the connection between the Internet and the physical world. Nowadays, it has gone far beyond the limitation of only focusing on radio frequency identification (RFID) connection when it was first proposed. It has developed into an important direction including devices, systems, and services, involving in many protocols, fields, and applications. From this, new concepts have emerged, such as big data and cloud computing. e development of networking has been in full swing. However, the limitations of the IoT itself have always been the focus of discussion among scholars. One problem that cannot be ignored is that the limitations of the IoT are still an important bottleneck in the development of the IoT, especially for sensor networks. Wireless Sensor Networks (WSNs) are widely used in marine environmental monitoring, mine monitoring, and medical monitoring. In the wireless sensor network, the nodes are powered by the battery, so the service life of the whole network is limited [1,2]. In the key technologies of WSNs, routing technology plays an important role. In this technology, the energy of nodes is mostly lost in the data transmission process, and the energy consumption of nodes is not uniform. erefore, reducing and balancing network energy consumption are a top priority in the routing design. e geographic locationbased clustering routing algorithm has strong scalability and efficient data fusion compared to other planar routing algorithms, which can reduce communication energy consumption [3,4]. e cellular virtual partitioning scheme has a great advantage in the network coverage compared with the virtual cells of other polygons, which is beneficial to the node to adjust the signal transmission power [5].
In the development of electric vehicle industry, the construction and operation of charging and switching service network play an important role. Monitoring battery status is one of the key factors to ensure the quality of charging and switching service. Traditional battery management system (BMS) can monitor the working status of single battery pack, predict the remaining power and mileage, and protect the power battery, ensure the safe operation of power battery, and maximize the storage capacity and cycle life of battery. However, as a dynamic transfer asset, when the battery pack is stored in the charging and switching power station, its flow state and working state always need to be monitored. e global state of the battery pack that the monitoring and management system in the charging and switching power station needs to master is the data support of the intelligent charging and switching business. e BMS network function of single battery pack is weak, so it is difficult to collect the status monitoring information of battery pack into the station monitoring management system in the storage and distribution links. e above problems can be solved by introducing IoT technology into battery management in rechargeable power stations. Literature [6] proposes that IoT sensing devices should be deployed in EV. A small IoT device is composed of user fee card with RFID chip, GPS locator, and sensors. e wireless sensor network is composed of sensor devices in the vehicle area IoT and sensing devices in charging and switching power stations through RFID technology. Literature [7] proposes a multi-hop clustering routing algorithm based on region partitioning, which divides the monitoring area into equal-spacing circles and then equal-angle quadratic partitioning areas. In view of the problem that the batteries to be replaced are stored on the battery rack in the power exchange service and cannot be used for information transmission through the vehicle area IoT, the intelligent battery rack equipped with sensing devices is proposed in literature [8], which intelligently perceives the battery status and communicates with the operation support system and the gateway of the station area IoT. However, this kind of application limits the spatial range of data transmission and increases the data transmission interface between battery pack and battery rack, which also increases the investment and operation difficulty of rechargeable power station.
In order to solve the above problems, this paper proposes a hybrid multi-hop clustering routing algorithm based on cellular virtual grid from the actual demand of intelligent charging and switching service for battery management.
at is to say, the monitoring target area is divided into several regular hexagonal virtual cells. e nodes in these regions form clusters by themselves, and the residual energy of cluster head and the angle ratio and distance ratio of cluster head position to the center of mass of the cell network are considered comprehensively in cluster head election, so as to balance the energy consumption of cluster head nodes and restrain the generation of outliers. e application of smart battery pack can make the status of battery pack be perceived and monitored in the whole charging and replacement process, thus improving the efficiency of charging and replacement business management, shortening the cycle of battery pack, and reducing the difficulty of battery management and maintenance. In the second chapter, WSN routing protocol and system model of smart battery pack are proposed. In the third chapter, cluster head election algorithm and data transmission module based on cellular virtual grid are introduced in detail. In the fourth chapter, experiments are designed to verify the proposed routing protocol.

WSN Routing Protocol for Smart
Batteries. WSN routing protocol is responsible for forming a data transmission network for each independent node. Due to the applicationrelated and resource-constrained characteristics of WSN routing protocol, it is necessary to evolve the existing routing protocol according to the scenario of charging and switching service and the function of smart battery pack, so as to design a WSN routing protocol suitable for smart battery pack application.
rough the analysis of the implementation method of panoramic data acquisition for batteries, it can be found that WSN networking mode is mainly used in the storage link of batteries and the charging mode of subcompartments, and then the characteristics of WSN node distribution based on smart batteries are obtained.
(1) WSN is a high density network, and smart battery pack node mobility is not strong. It is a relatively static network (2) WSN is deployed in a two-dimensional plane with fewer obstacles (3) e smart battery pack has the same node structure and the same maximum transmission distance (4) e sink node is deployed in a fixed location, and the sink node is unique, located at the edge of the working area, without energy constraints, and has relatively strong computing and storage capabilities (5) In the worst case, smart battery pack nodes are powered by small capacity standby batteries with limited energy (6) e physical location of smart battery pack nodes can be estimated in advance Based on the above characteristics, the network model studied in this paper assumes that n smart battery packs are evenly distributed in the area of smart charging and switching power stations. e general WSN model is based on many randomly distributed nodes in a wide area. It is data-centric and concerned with local measurement results, rather than the specific node from which the measurement results are transmitted. In the battery management system, each battery has its own ID and even has a relatively fixed physical location.
e sink node cares about the data transmitted by the specific smart battery node, which requires that the smart battery node can be identified in a way in advance.
Based on the above network model, a new routing protocol is proposed in this paper. When the network is initialized, each smart battery group node forms a cluster according to its location information, and the sink node obtains all the clusters in the network. Data transmission is initiated by the sink node and forms a real-time route between the dynamically selected cluster heads from the sink node to the target cluster. Local data is obtained by the cluster head of the target cluster, such as the state data of a battery in the cluster at that time, and transmitted to the sink node. Nodes are redundant in most WSNs; i.e., there are multiple paths between different nodes [9,10]. e proposed virtual grid is based on the above analysis; that is, if the storage area coverage can be divided into several virtual grids to ensure that any node in the grid can communicate with any node in the adjacent grid, then, in the same grid, as long as the wireless transceiver of one node is in working state, even if other nodes are closed or closed, in the idle state, the connectivity of the network can still be guaranteed.
According to the network model, if the link is bidirectional, that is, if a node can get data from a neighbor node N i , its data transmission range can also reach N i , assuming that the transmission distance of all nodes is the same as R. In this case, the following virtual grids are defined: adjacent virtual grids A and B, all nodes in grid A can communicate with all nodes in grid B, and vice versa, and all nodes in the same grid can act as equivalent routing nodes. Assuming that the edge length of each virtual grid is r, according to the above definition, that is, the upper limit of the distance between two nodes in the adjacent grid should be R, then there is (1) Each node in the virtual grid forms a cluster in the network. Each cluster has a unique cluster number. After setting the size of the virtual grid, each smart battery node can calculate its cluster number according to its physical location. Based on virtual grid, a WSN clustering multi-hop routing protocol for electric vehicles using cellular virtual grid is proposed.

System
Model. Based on the basic principle of genetic algorithm, the traditional GAF routing algorithm divides the monitoring area into several squares. According to the analysis, the structure only has common edges with four virtual cells, and in the regular hexagonal virtual grid, each cell is adjacent to six nearby cells. According to the analysis of relevant data, compared with the square virtual cells, the hexagonal virtual grid also has advantages in the coverage area of single hop and the total number of nodes in the cell. e partitioned area will produce a G-ID (Grid-ID), and the node will use its own location coordinates to get its own G-ID. e hexagon mesh communication model in WSNs is shown in Figure 1. Let the edge of each hexagon be R. It is assumed that the nodes in the monitoring area have the following properties: (1) Once the ordinary nodes and the link nodes are fixed, they have a unique N-ID (node-ID) and are randomly arranged in the monitoring area. (2) For all ordinary nodes, the energy is limited and the same while the energy of sink node and base station is not limited. (3) All nodes can store data and have the same computing and forwarding functions, and all nodes can participate in cluster head competition with the same status. Fourthly, the nodes in the region can know their own location and calculate the distance between them by localization algorithm. e nodes in the area can collect data periodically and ensure that the data is successfully sent to the base station.
It is easy to judge the cell of node in plane area by geometric constraint calculation. For example, determine whether a node (x i , y i ) is in the regular hexagon. Firstly, the regular hexagon is divided into three sections. In the regular hexagonal mesh area, the coordinates of six vertices are set as (a, b), (c, d), (d, e), (c, f), (a, f), (g, e), respectively. Because the region division is a normal graph, the coordinates of the above vertices can be easily obtained. At the same time, it is easy to get that the coordinate position of common nodes is (x i , y i ) from the node location algorithm, so the G-ID of judging nodes becomes the size of comparing the values of three-segment function. All nodes in the region can determine their cell by calculation in turn. e nodes in the cell form clusters by themselves, which reduces the complexity of clustering and energy consumption.

Cluster Head Election Algorithms.
Sensor nodes send messages to neighbor nodes, exchanging their N-ID, G-ID, and status. A node with the same G-ID records its N-ID in the list of nodes, and if not, it discards the message. Figure 2 is the structure of this routing network. Each node in the area has a timer, and the length is set to TD. In the timer TD, if the node receives the successful message of other nodes running for cluster head, this indicates that the node fails to run for cluster head and will automatically enter a dormant state. During the dormant period, only its own state and monitoring data are uploaded to cluster head node [11,12]. If the node in the cell does not receive a successful cluster head election message from the node in the region, the cluster head node in the cell is the node and automatically opens the active state to collect messages. At the same time, a timer with the length of TS is set for the sleeping node. When the length of TS increases, the sleeping node becomes active and vice versa; the sleeping node is in the sleeping state, and the transceiver is closed. When the cluster head node exceeds TC, the cluster head node begins to collect data packets of all family members in the cell. e data package includes the N-ID of each node, the G-ID of the node. rough a series of reference values, the ideal cluster head is selected. e cluster head node of the first round is the node closest to the center of mass of the regular hexagon. When the node finds that its energy is less than 70% of the average energy of the node in the election, the next round of cluster head node election will be conducted. Firstly, the node uses formula (2) to calculate the probability of running for cluster head.
In formula i ∈ (1, n), Φ r is the residual energy of node i, Φ a is the average of residual energy of node in cluster, a ∈ [0, 1] is the weight of distance and residual energy, d is the distance between node and center coordinate of regular hexagon, and δ ij is the distance between node i and node j. e greater the probability of Π i , the greater the chance of Mathematical Problems in Engineering 3 becoming a cluster head node. After calculating the election probability of cluster head, the angle ratio is introduced as the reference value of ideal cluster head node as shown in the following formulas: θ � arccos In the formulas, c is the deviation angle, θ is the angle, w is the angle ratio, and (x 1 , y 1 ) and (x 2 , y 2 ) are the two-node coordinates. e closer the w is to the ideal cluster head, the better the skewness angle is for the dynamic election of cluster head nodes. In the election, the first three nodes with Π i value are selected, and then the angle ratios of each node are calculated. At the same time, formula (6) is used to calculate the throughput of each node under ideal conditions.
In the formula, S denotes the area of monitoring area, δ denotes the maximum transmission rate of nodes, l denotes the distance between nodes and base stations, Δ denotes any constant greater than 0, n denotes the number of nodes, and R denotes the transmission radius of nodes. Finally, the cluster head selection function is introduced as follows: In the formula, a, b, c are more than 0 and a + b + c � 1. After calculating the function value of each campaign node, comparing the size of the function value, the largest one is selected as the cluster head node. When the running time is longer than TS, the dormancy state changes to discovery state and is ready to participate in the next round of cluster head election. Successful cluster head nodes enter active state, collect data, and send data fusion to the sink node. When the cluster head node passes through the time length TC, the next round of cluster head election is carried out.

Sink node
Cluster head node

Data Transmission Module.
In the proposed method, data transmission adopts single hop in cluster and mixed multi-hop between clusters. e cluster head node first receives the data forwarded from the sink node and collects information [13]. Establish a reverse routing gradient to the sink node. When choosing the next hop cluster head node, the cost function is calculated by formula (8). When choosing the next hop value cluster head node, the cost function is the smallest, such as formula (8): In the formula, d ij represents the distance between node i and j, d i, sink represents the distance between node i and sink, and d j, sink represents the distance between node j and sink.
In WSN, many parameters can be used to measure the estimated cost, such as distance, number of forwarding hops, communication energy consumption, and residual energy of the next hop cluster head node. In the protocol proposed in this paper, the path cost from intermediate node to target node is calculated according to distance and residual energy [14,15]: Formula c(N i , C) is the estimated path cost from node N i to cluster C, where the target node is located; d(N i , C) is the distance from node N i to cluster geometric center of cluster C, where the target node is located; e(N i ) is the energy consumed by node N i ; θ is the adjustable weight parameter between (0, 1).

Simulation Settings.
Based on the simulation platform of MATLAB, this paper simulates the proposed routing algorithm with literature [6] algorithm, literature [7] algorithm, and literature [8] algorithm and compares their performance. e total energy consumption of the network and the total number of remaining nodes of the network are analyzed and compared, respectively. Detailed parameter settings in the simulation scenario are shown in Table 1.
A free space wireless communication model is adopted. In this model, Φ rx and Φ tx represent the energy consumption of transmitting a bit data to distance d and receiving data, respectively. e calculation formulas are as follows: In the formula, Φ elec is the energy consumption of the circuit for transmitting and receiving unit data (bit), ε fs and ε mp are the attenuation coefficients in free space and multipath fading, and d 0 � (ε fs /ε mp ) 1/2 is the distance threshold.

Comparison and Analysis of Network Energy
Consumption.
e smaller the energy consumption of the algorithm in the integrated situation (such as network conflict, channel competition, and control overhead), the higher the energy efficiency. Figure 3 shows that the total network energy of the algorithm decreases rapidly when the running time exceeds 200 seconds, which indicates that the energy consumption is increasing. When literature [6] algorithm runs to about 1000 s, the total energy of the network is exhausted. Currently, the residual energy of literature [7] algorithm accounts for 27%, literature [8] algorithm for 36%, and the proposed method for 43%. It shows that the proposed algorithm can reduce network energy consumption compared with the first three algorithms. When the running time reaches 800 seconds, the proposed algorithm has obvious advantages over the first three algorithms in reducing network energy consumption, and literature [8] algorithm has relative advantages.
is is because the proposed algorithm utilizes cellular grid clustering and considers the energy, distance, and skewness of nodes in cluster head election.

Comparison and Analysis of Network Lifetime.
In the whole WSN, with the increase of running time, the number of remaining surviving nodes will decrease. In a certain period, the higher the proportion of remaining surviving nodes, the longer the network lifetime of the algorithm. It can be seen from Figure 4 that literature [6] algorithm nodes begin to appear the earliest time of node death, followed by literature [7] algorithm, literature [8] algorithm, and the proposed one later. After the failure of the proposed method and literature [8] algorithm, the failure speed of the other nodes is faster than those of literature [6] algorithm and literature [7] algorithm, which shows that the energy consumption of the proposed algorithm and literature [8] algorithm is more balanced. However, compared with literature [8] algorithm square, the proposed algorithm has better network coverage and less node communication energy consumption, so the number of nodes survived in the proposed algorithm is more. Comparing the number of survived nodes of the literature [6] algorithm with the other three algorithms in Figure 4, we can see that the literature [7] algorithm and literature [8] algorithm of the dead node appeared in the first time around 400 s, and the dead node appeared around 600 s, while that of the proposed algorithm was about 900 s. Compared with literature [6] algorithm, literature [7] algorithm, and literature [8] algorithm, the proposed method can prolong the dead time of nodes. is is because the proposed algorithm divides virtual cells based on cellular structure and describes an effective data transmission strategy of mixed hops between clusters, which effectively realizes the load balancing of the whole network.
Mathematical Problems in Engineering 5

Conclusions
Starting from the actual demand of intelligent charging and switching service for battery management, this paper extends the clustering multi-hop routing protocol based on IEEE802.15.4 protocol according to the business characteristics. In this paper, a hybrid multi-hop routing algorithm based on cellular virtual grid partitioning is proposed according to the actual demand of intelligent charging and switching service for battery management. e algorithm uses the method of virtual partition of cellular grid to make nodes self-cluster. At the same time, a new probability formula of cluster head election is introduced, and some parameters such as skewness angle are added to make cluster head node election more reasonable. In data transmission, a hybrid multi-hop method is used to balance the energy consumption of nodes. Nodes are redundant in most WSNs; i.e., there are multiple paths between different nodes. e proposed virtual grid is based on the above analysis.
If the storage area can be divided into several virtual grids to ensure that any node in the grid can communicate with any node in the adjacent grid; it will be the direction of future efforts to improve.
Data Availability e data included in this paper are available without any restriction.

Conflicts of Interest
e authors declare that they have no conflicts of interest to report regarding the present study.