#### Abstract

We investigate GPSR algorithms of WSN and propose an improved routing algorithm based on energy gradient and APIT grid to solve the problem of high and unbalanced energy consumption of GPSR. In GPSR, network uses greedy algorithm and right-hand rule to establish routing paths, and the path keeps running till some nodes within the path are invalid because energy is exhausted, which would lead to the high energy consumption of some nodes in the path and the low energy consumption of others nearby the nodes not in the path as well as bringing high and unbalanced energy consumption of the network. Regarding these problems, we use APIT localization algorithm and APIT grid to query and establish routing paths and establish the corresponding energy gradient when messages are transmitted along the routing paths. When some nodes are approaching the threshold status, we use right-hand rule and recursion greedy algorithm in advance to plan a new routing path towards the target area. When query messages arrive at the event area, the network uses a different method to transmit data according to the density of sensor nodes. Simulation experiments show that the improved routing algorithm is capable of reducing the energy consumption of network and extending the lifecycle of network.

#### 1. Introduction

WSN is composed of abundant cheap sensor nodes, and these sensor nodes are self-organized by wireless communication way in monitoring area to perceive, collect, and process information, furthermore, to transmit data to users by multihop way [1]. WSN aggregates many technologies including sensor technology, information fusion technology, and information processing technology and is widely used in environment monitoring, military investigation, industrial production, medical health, rescue and relief, and so on. WSN has features of networking flexible, expandability, easy deployment, mobility, and low cost [2].

In the application of WSN, the viability of node is a key issue related to the lifecycle of network. High energy consumption of sensor nodes will reduce the lifecycle of network. Moreover, the locations of sensor nodes decide the energy consumption of communication between two sensor nodes. In consequence, routing protocols based on accurate localization technology are widely used in some critical applications such as forest fire prevention. In routing protocols based on geography, each node should be aware of the location of itself and its neighbor nodes. When transmitting messages, the network packages location information in data and transmits it to the next hop by greedy algorithm [3].

#### 2. Related Works

GPSR is a classical routing algorithm which is applied in ad hoc and WSN geography-based routing protocol, and this algorithm includes two types of data transmission methods: greedy transmission and border transmission [4]. When investigating and improving a GPSR-based algorithm, three parts of knowledge are necessary including greedy transmission, border transmission, and APIT localization algorithm. In this section, we introduce the basic knowledge and research status of GPSR-based algorithms.

##### 2.1. Greedy Transmission

In GPSR, source node packages location information of target node and transmits data to neighbor node with location information, and the optimal next hop should be the nearest neighbor node. According to this principle, data can be transmitted to sink node in multihop way. The detailed process of greedy transmission is shown in Figure 1 [4]. The little dotted circle represents the communication radius of node x, and node D is sink node. Node x will find node y as its next hop which is the one that is nearest to node D by greedy method. In this way, data will arrive at node D.

##### 2.2. Border Transmission

In greedy transmission, if a node cannot find any other node in its neighborhood which is nearer than itself to target node, a routing void forms. GPSR uses surrounding stateless routing algorithms to solve this problem. In the algorithm, a plane graph is constructed to describe network topology and make sure that any two edges do not cross each other [5]. As shown in Figure 2, x is nearer to target node D than its neighbor nodes w and y. Set D as center of the circle and the distance between D and x as radius of the circle. There are two routing paths to target node D: (x → y → z → D) and (x → w → v → D); however, node x cannot transmit data to either node y or node w according to greedy algorithm. Thus, the network generates a routing void.

If relay node is aware of a routing void, it can use right-hand rule to find a new routing path. The right-hand rule is shown in Figure 3. From node y to node x, the next edge is linked x and y in the direction from x to y. The right-hand rule selects another edge by anticlockwise rotation way and then traverses the closed polygonal area [6]. In Figure 2, when node x finds out a routing void, the routing path by right-hand rule is x → w → v → D → z → y → x, and then the border transmission is finished.

In GPSR algorithm, when sensor node chooses routing path it only needs to know the geography location of itself, the neighbor nodes, and the target node, and it is not necessary to maintain global network topology [5].

##### 2.3. APIT Localization

APIT (Approximate Perfect Point-In-Triangulation Test) algorithm is a classical range-free localization algorithm of WSN. The basic idea of APIT is that unknown node selects three beacon nodes randomly from surrounding area and makes them compose a triangle and then judges the location relationship between this triangle and itself using PIT (Perfect Point-In-Triangulation Test) [7]. If the unknown node is in this triangle, label the node. Using this method each sensor node will be tested by PIT and the algorithm finds out the intersection area of all the triangles containing this unknown node and works out the center coordinate of the area as its location [8].

##### 2.4. Research Status of Improved Algorithms of GPSR

Most of the GPSR-based algorithms are improved through the aspects such as optimizing routing path selection, avoiding routing void, using geography-based promotion and network status-based promotion, referencing moving nodes strategy, and enhancing transmission efficiency of special nodes.

Aiming at routing void problem, Karp and Kung proposed GPSR (greedy perimeter stateless routing), which adopts surrounding stateless model to transfer data package to target node through the set of neighbor nodes in plane network [9]. On the other hand, GPSR abandons the procedures of establishing, maintaining, and storing routing table with little delay of data transmission. However, there are some disadvantages of energy consumption due to data inconsistency in GPSR. Nithyanandan et al. proposed optimal routing algorithm based on energy option aiming at network data inconformity of GPSR, which ensures energy balance feasibility in unsymmetrical WSN [10]. Shanmuga Raja et al. also adopted energy optimal routing method to ensure the communication efficiency between nodes for reliable communication, which can prolong network lifecycle [11]. Liu et al. proposed an improved algorithm with dynamic load balance ability based on awareness of neighbor nodes, which can solve the problem of reducing network lifecycle caused by routing void [12]. The authors of O-GPSR [13] proposed a new routing algorithm based on opportunistic forwarding principle. It uses three elements including distance, direction, and neighbor density to calculate each neighbor’s decision metric, by which next-hop node can be chosen. The new algorithm can reduce end-to-end delay and routing load; moreover, it improves routing efficiency. The neighbor’s decision metric is shown in

In (1), represents measure of greedy forwarding; represents measure of perimeter forwarding. is the Euclidean distance between source and destination. is the Euclidean distance between neighbors of source and destination. is the deflection angle between node and destination, is the amount of neighbors; is the total number of nodes in the network. , , and are, respectively, the greedy forwarding weighting coefficients of distance, direction, and neighbor density. , , and are, respectively, the perimeter forwarding weighting coefficients distance factor, the angle factor, and the node density factor. From these two equations, we can draw a conclusion that O-GPSR algorithm needs three extra parameters, distance, direction, and neighbor density, which are changed frequently depending on network topology, so the routing path will be changed frequently. Therefore, this algorithm will generate great energy consumption of calculation. A GPSR-based algorithm proposes a regional perimeter routing based on left- and right-hand rules. When GPSR shows the routing void, there will be a line connecting the routing void node and destination node. The region is divided into two complementary subsets, and it can combine with left- and right-hand rule. When it uses the right (left) rule, the network cannot find the corresponding node, so it should go back to the source node and use the left (right) rule. According to the location of next hop node, the algorithm compares the two distances from current node to target node and from greedy node to target node, and if the distance from the target node current node is shorter, network returns to the greedy forwarding mode. The protocol solves the phenomenon that the sensor nodes are not easy to route the void in the low density of the sensor nodes [14]. From the above analysis we can conclude that this algorithm will lead to network circuit because of using greedy mode. The authors of LQ-VV-GPSR propose a routing technology based on link quality and velocity vector. When selecting next hop, a node does not select the neighbor node closest to target node by traditional greedy forwarding strategy but selects a group of forward list based on measurement standard of link quality (LQ) information each time. After that, it selects optimal node depending on velocity vector (VV) information to improve the performance of the routing path [15]. According to these analyses, LQ-VV-GPSR does not consider the energy consumption of normal nodes, which will produce uneven energy balance of network. Another routing algorithm which can be referenced proposes a fuzzy logic dynamic beaconing (FLDB) strategy, which is based on the correlation between node moving speed (NMS), number of neighboring nodes (NoNNs), and beacon packet interval time (BPIT) using fuzzy logic control (FLC) mechanism. In ad hoc network, FLC mechanism suggests that high node movement and a small number of neighboring nodes need to increase the number of beacon packets dispatched by reducing BPIT, and infrequent node movements and large number of neighboring nodes need to decrease the number of beacon packets dispatched by increasing BPIT. Improving the reliability of nodes’ neighbor list by optimizing time between transmissions of beacon packets can be feasible [16]. This paper researches the control strategy of beacon packet overhead and transmission time for GPSR mobile ad hoc network, which can be referenced in researching WSN. However, this algorithm does not consider protecting the nodes with large energy consumption which will reduce the uneven energy balance. A trust-based algorithm proposed a secure routing protocol named secured greedy perimeter stateless routing (S-GPSR) protocol. The trust level includes the accuracy and sincerity of neighbor nodes and is ensured by their contribution to packet transmission. Instead of default minimal distance, a new trust distance parameter is created in neighbor table using trust levels conjunct with geographical distance. It can reduce the overhead and improve the delivery ratio of the networks [17]. The thesis considers the weight of nodes’ contribution to transferring to select next hop which can enhance transmission efficiency; however, it increases energy consumption of being trusted nodes continuously.

In this paper, we discuss the disadvantage of ignoring to protect the sensor nodes approaching invalid status for big energy consumption and propose a new GPSR-based algorithm to reduce energy consumption of network, even energy balance, and prolong network lifecycle. The improved algorithm uses energy gradient and APIT grid to adjust the working status of sensor nodes by an energy threshold settled in advance to reduce invalid nodes. We choose three types of algorithms for comparison, including classical GPSR, geography-based algorithm, and optimizing next hop selection algorithm. They are GPSR, O-GPSR, and GPSR-AD.

#### 3. Improved Algorithm

##### 3.1. Energy Consumption Gradient

In WSN applications, sensor nodes are deployed in random way, and the energy of sensor nodes is limited; therefore, it is a key issue to reduce network energy consumption and extend network lifecycle. In this paper, we propose an improved GPSR algorithm based on energy gradient and APIT grid to solve the problems.

In the improved algorithm, APIT localization algorithm is used to locate all of the unknown sensor nodes, and the grid information and grid length are recorded when processing localization. When sink node sends message to interested area, a routing path from sink node to event area can be established by greedy algorithm. With processing routing path requirement, algorithm records energy gradient information according to the energy data of each node in the querying path and establishes a routing path in reverse direction. When the routing path is transporting data and the algorithm is running, right-hand rule with energy threshold is designed to optimize the routing maintain mechanism. After querying to establish routing path, in process of data transmission, an energy threshold, , is settled in advance according to data package energy consumption in the routing path and left energy of the sensor node. When transmitting data along a routing path, each sensor node should compare its left energy with . Along with consuming the energy of a routing path, if one node’s left energy is less than or equal to , algorithm uses right-hand rule to bypass this node and modify the current routing path, and then the bypassed node still monitors and collects environment data but does not transmit data from other sensor nodes. So, the lifecycle of big energy load sensor nodes can be prolonged and the energy consumption of network can be distributed equally.

As shown in Figure 4, greedy routing path without routing void is . When of node y is less than or equal to , draw two circles; the center of one circle is D and its radius is the distance between node D and node y, and the center of the other circle is x and its radius is communication radius. Algorithm finds optimal next hop, node a, in intersection area using right-hand rule and greedy algorithm recursively until the routing path arrives at target node D. The new routing path of improved algorithm is . Furthermore, when showing routing void the improved algorithm uses right-hand rule to find out new routing path.

When query message arrives at event area, proper sensor nodes density should be set as in advance, and then nodes density of event area should be figured out. If nodes density is more than or equal to , event area should be divided into several subareas using grid length of APIT algorithm and each subarea has only one leader node. Moreover, leader node should be closest to the center of subarea. If one node is set as a leader, it sends message with its ID to all of nodes in this subarea so that each node in this subarea transmits data through it. On the other hand, if nodes density is less than , sensor nodes of this subarea use flooding routing algorithm [1] to transmit data outward instead of multihop way till all data packages are sent out and the transmission process is finished. Transmission process is shown in Figure 5.

##### 3.2. Energy Consumption Model

In this paper, we adopt the wireless communication energy consumption model proposed by Heinzelman et al. [18]. The energy consumption of bit data transmission of wireless sensor node is ; it is shown in

In (2), is communication radius, and the energy consumption of receiving bit data is , which is shown in

In (3), is amplification factor of signal amplifier, is energy consumption of free space, is energy consumption of emission and receiving electronic circle, and is distance between two sensor nodes requiring data transmitting.

#### 4. Simulation Experiment

##### 4.1. Simulation Experiment Environment and Parameters

In this paper, simulation experiments are performed in MATLAB R2011b to compare this improved algorithm with other three GPSR-based algorithms on network energy consumption and valid sensor nodes amount. Furthermore, we conduct experiments about the left energy of each node in event area ranked by experimental rounds and the left energy variance analysis of different energy thresholds ranked by experimental rounds.

The monitoring area of experiments is 1000 m 1000 m. There are 300 sensor nodes being deployed randomly. Communication radius is 250 m. The proportion of beacon nodes is 30% and initial energy is 0.5 J. Node is the sink node. The lower left corner of the monitoring area is event area, and its length is 1.6 times of the grid length of APIT (25 m 1.6 = 400 m). In experiments, each sensor node knows the location of itself using APIT algorithm.

##### 4.2. Simulation Experiment Result Analysis

The initial routing path being established is shown in Figure 6. Blue star nodes represent 300 sensor nodes and red star node represents sink node. Left bottom corner area surrounded by dotted black lines represents event area and the solid black line represents routing path. Sink node sends query message to event area and the routing path is established according to the reversed direction of query message path.

Left energy of network is a key issue to evaluate performance of WSN, so experiments are performed to compare the four algorithms on the left energy of each round. As shown in Figure 7, horizontal coordinate represents the number of rounds and vertical coordinate represents the total left energy of all of sensor nodes in network. The experiments are about the left energy of network in each round before nodes of event area are invalid because of energy exhausted. Red line represents the curve reflecting of using this improved GPSR algorithm. Purple line represents that of using O-GPSR algorithm. Blue line represents that of using GPSR-AD algorithm. Green line represents that of using GPSR algorithm. From Figure 7 it can be concluded that in each round this improved GPSR algorithm has more left energy than the other three algorithms, and this improved algorithm can reduce network energy consumption and extend network lifecycle.

When the nodes in event area are invalid because energy is exhausted, the amount of valid sensor nodes of network is another key factor to evaluate the performance of routing algorithm. As shown in Figure 8, horizontal coordinate represents experiments rounds and vertical coordinate represents the amount of live nodes. The experiments are about the amount of live sensor nodes of each round before all sensor nodes in event area are invalid because energy is exhausted. Red line represents the condition of using this improved GPSR algorithm. Purple line represents that of using O-GPSR algorithm. Blue line represents that of using GPSR-AD algorithm. Green line represents that of using GPSR algorithm. From Figure 8, it can be concluded that all of the sensor nodes in event area are invalid at more than 600 rounds by these four algorithms, and the amount of valid nodes of network is about 230 in GPSR algorithm, 220 in GPSR-AD algorithm, and 250 in both O-GPSR and this improved algorithm. Furthermore, from 100 rounds to 500 rounds, the amount of valid nodes using this improved algorithm is obviously more than that using the other GPSR-based algorithms.

As follows, we investigate the even energy balance of this improved algorithm. Figure 9 presents the left energy of each node in event area ranked by 100, 200, 300, 400, and 500 rounds. Figure 10 illustrates the left energy variance analysis of each sensor node in event area with different energy thresholds, and we can judge which energy threshold can make less left energy variance and achieve more even energy balance.

In Figure 9, horizontal coordinate represents node ID in event area and vertical coordinate represents the left energy of nodes. Red line represents the left energy of nodes in event area at 100 rounds. Blue line represents that at 200 rounds. Light blue represents that at 300 rounds. Yellow line represents that at 400 rounds. Black line represents that at 500 rounds. From Figure 9 we can draw a conclusion that along with rounds increasing energy exhaust of each node has the same tendency and the differential section of nodes is increasing persistently. When close to invalid status, nodes in event area have most difference of left energy and dissipative energy.

In Figure 10, horizontal coordinate represents experimental rounds and vertical coordinate represents the left energy variance of nodes in event area. Red line represents the left energy variance when energy threshold is 0.1 J. Blue line represents that when energy threshold is 0.05 J. Black line represents that when energy threshold is 0.15 J. From Figure 10 we can draw a conclusion that before 200 rounds the values of left energy variance at the three thresholds are all located between 0.015 and 0.02, and after 200 rounds variance distribution of these three thresholds is different. Threshold 0.1 J has the most stable variance distribution. However, both threshold 0.05 J and threshold 0.15 J have large change in tendency of variance. Threshold 0.15 can lead to less left energy variance so large value of energy threshold can lead to small variance value of left energy, which can enhance the energy balance of the network.

#### 5. Conclusion

In this paper, we propose an improved GPSR algorithm based on energy gradient and APIT grid to solve problems of high energy consumption and uneven energy balance of GPSR. In the new algorithm, network establishes path gradient based on energy consumption and energy remains through query message sending and sets energy threshold in advance. And then, if current sensor node energy is approaching the threshold according to the energy gradient, network uses right-hand rule and iterative greedy algorithm to establish new routing path. Moreover, this improved routing algorithm uses APIT localization algorithm to locate sensor nodes and records the grid distribution information to design the mechanism of query message transmission and event message transmission. Meanwhile, this improved routing algorithm uses right-hand rule and border transmission strategy to predict and avoid routing void. The new routing algorithm takes the uneven energy consumption balance in routing path into account and designs dynamic updating routing path mechanism to avoid nodes failing quickly due to energy excessive consumption, and hence energy consumption can be shared in the whole network which can reduce network energy consumption. Simulation experiment results show that improved algorithm can suspend the appearance of invalid sensor nodes, reduce energy consumption of network, and extend network lifecycle.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

This work was supported by the Natural Science Foundation of China (NSCF) (no. 61275080).