# Energy-Efficient Spatial Query-Centric Geographic Routing Protocol in Wireless Sensor Networks
## 3 QTGrid Routing Protocol
### CH and PCH Election
#### 3.2.2 PCH Election
This was because when designing the QTGrid, the energy balance of nodes in the network was concerned. To avoid the premature death of nodes with less residual energy, the in-cluster nodes

Figure 9: The comparison of the number of surviving nodes. (**a**) Network with 200 nodes; (**b**) network with 400 nodes; (**c**) network with 800 nodes. with better conditions were selected as CHs. Therefore, the more nodes there were in the network meant that the energy consumption of the network was balanced to more candidate nodes in the same cycle, thus prolonging the network life. When the total number of nodes was 200, as shown in Figure 9a, GCCR had more surviving nodes than QTBDC, but when the total number of nodes was 400 and 800, as shown in Figure 9b,c, the result was reversed. Therefore, as far as network life is concerned, QTGrid had the longest and GeoGrid had the shortest. Compared with GCCR, QTBDC was more suitable for energy saving of nodes in a large-scale network. ### Spatial Query

In this section, we selected energy consumption and network transmission delay as metrics for the spatial query of the four routing protocols. All four protocols transmitted data in a grid-by-grid manner through CHs. The size of the grid was evenly divided, and CH was generally close to the center of the grid. It can be considered that the distances between CHs were almost the same. Therefore, we considered the number of transmission hops as the length of the transmission path. Figure 10: _Cont._

The number of data transmission hops was of great significance to multi-hop WSNs. Usually, the shorter data transmission path (the fewer forwarding hops), the higher success rate of data forwarding [7]. In addition, increasing the number of data forwarding hops had a direct impact on network latency. Since the delay of data transmission was mainly caused by problems such as radio link contention, message processing time, and message queuing in per hop. The more forwarding hops, the greater network delay, and the more times of data receipt and transmission correspondingly, that is to say, the faster energy consumption. In summary, we simulated network latency by comparing the average number of routing hops. The energy consumption of a spatial query used the average spatial query energy consumption (\(\overline{E}\)) of the monitoring area and the average number of routing hops for forwarding data as metrics. \(\overline{E}\) is given as follows:

\[\overline{E}=\frac{\sum\limits_{n=1}^{N}E_{Txi}+\sum\limits_{n=1}^{N}E_{Rxi}+ E_{C}}{N}, \tag{9}\]

where \(N\) is the number of nodes, \(E_{Txi}\) is the power consumption to transmit the message, \(E_{Rx}\) is the power consumption to receive the message, and \(E_{C}\) is the power consumption for calculation. Generating the network, we set up five different query windows, and slid the query window along the edge of the network until it covered the network completely. A query for each window was regarded as a round, and CHs were reselected every 10 rounds. Comparisons of QTGrid with three other algorithms in terms of \(\overline{E}\) for the network randomly distributed with 200, 400, and 800 sensor nodes are shown in Figure 10a-c, respectively. The network latency corresponding to each scenario was compared, as shown in Figure 11a-c.

Figure 10: The comparison of spatial query energy consumption. (**a**) Network with 200 nodes; (**b**) network with 400 nodes; (**c**) network with 800 nodes. From Figure 10, we can observe the following:

Figure 11: The comparison of an average number of routing hops for the spatial query. (**a**) Network with 200 nodes; (**b**) network with 400 nodes; (**c**) network with 800 nodes. 1. The three protocols improved \(\overline{E}\) to varying degrees compared with GeoGrid, except for the network with 200 nodes where only one grid was covered. The reason was that compared with GeoGrid, the three other algorithms needed to consume more energy in CH election and replacement to obtain more energy-saving routes.