## 4 Proposed Protocol
### The Set-up Period  
_Step 1:_ Grid cell division of balancing the number of nodes  
Firstly, BS receives messages HELLO which contains the current energy status and the location of all sensing nodes in the network transmitted to the sink device. Then, the sink divides the whole network sensing region into virtual grid cells that balance the number of sensing nodes, and each cell is considered a cluster. As shown in Figure 4, in which we assume a monitoring network region of \(100\times 100\) square meters divided into nine grid cells with unequal rectangle sizes. Let \(N_{row}\) and \(N_{col}\) be the grid's number of rows and columns, respectively. In the case of uniform distribution, node \(i\)-th can calculate the grid cell to which it belongs to the geographic coordinates (\(x\), \(y\)) by using Equation (11). \[cell(i)=(i\;div\;N_{row})N_{row}+(i\;mod\;N_{row}) \tag{11}\]  
\[d_{cell}=\sqrt{a^{2}+b^{2}} \tag{12}\]  
where \(d_{cell}\) indicates the diagonal of the grid cell; \(a\) and \(b\) are the length and width of one cell, respectively. The process of network area division into grid cells is illustrated in Algorithm 1 below:  
```
0:\(N\) sensor nodes with \(x\), \(y\) positions, and current energy level
0:\(N\) sensors are distributed in logical \(N_{cell}\) in a grid with \(N/N_{cell}\) nodes for each cell. 1: Set \(N\) = The number of alive nodes in the network;
2: Sort \(N\) nodes non-decreasing according to the coordinates value x-axis;
3: Distribute balancing \(N\) nodes into \(N_{column}\) as shown in Figure 5;
4:for each \(col\) in {Number of columns} do
5: Sort \(N_{column}\) nodes non-decreasing according to the coordinates value y-axis;
6:for each \(col\) in {Number of columns} do
7: Distribute balancing nodes \(N_{column}\) into cells;
8:endfor
9:endfor
10:Return {List of nodes in cells};
```  
**Algorithm 1** Grid Division  
Figure 4 depicts the simulation results in the NS2 tool in comparison of the energy efficiency in kilobytes per joule and different numbers of cells; it is clear that EEGT is the  
Figure 4: The energy efficiency of EEGT with different numbers of cells and the position of the sink device. most appropriate when the number of cells approximates about 4%, 5%, or 6% of the total of nodes. These values are also suitable with the optimum number of clusters, \(k_{opt}\), which is indicated in Equation (13) [21]. \[k_{opt}=\frac{\sqrt{N}}{2\pi}\sqrt{\frac{E_{fsp}}{E_{trg}}}\frac{R}{d_{toSink}^{2}} \tag{13}\]  
In addition, if the location of the sink device is nearer the network sensing region, the network performance achievement is better. _Step 2:_ CHNs selection  
In the set-up period of each round, EEGT will select a CHN for each cell based on several criteria following:  
**Average residual energy \(EC_{avg}(i,j)\):**\(EC_{avg}(i,j)\) is the average current energy level of alive sensor nodes in cell \(i\)-th at round \(j\)-th (where \(i\) range from 1 to \(N_{cell}\)). This is the most important characteristic of candidate nodes to become CHN because of more energy consumed in transmitting to the sink device. \[EC_{avg}(i,j)=\frac{1}{nc}\sum_{i=1}^{nc}E_{i}(r) \tag{14}\]  
where \(nc\) and \(E_{res}(t)\) are the number of nodes in cell \(i\)-th and the residual energy of sensor node \(t\)-th, respectively. **Distance to BS (\(d_{toSink}\)):**\(d_{toSink}\) should be considered because according to Equation (8), the longer data transmission in the distance is, the more energy consumes (equal to the distance in the exponent of four). The Euclidean distance from the node \(i\)-th to the sink device is calculated below:  
\[|d_{toSink}(i,S)|=\sqrt{\left(x_{i}-x_{S}\right)^{2}+\left(y_{i}-y_{S}\right)^ {2}} \tag{15}\]  
where \(x\) and \(y\) and \(x_{sink}\) and \(y_{sink}\) are the coordinates of node \(i\)-th and the sink device, respectively.