## 4 Gs-Eera
### Algorithm Procedure
Firstly, at the initial time, each node calculates the Euclidean distance to the other nodes separately, which takes time as \(O\big{(}n^{2}\big{)}\). Another key parameter of GS-EERA is the number of iterations. Suppose a single node in the network has at most \(m\) neighbor nodes. In the worst case, the network is linear. The process will be repeated for \(n-1\) times and the time taken \(O(mn)\). Therefore, the total time complexity of GS-EERA can write \(O\big{(}n^{2}\big{)}+O(mn)=O\big{(}n^{2}\big{)}\). ## 5 Simulation Results and Analysis

In this section, we use the MATLAB platform to depict the performance of our algorithm, GS-EERA, under different parameter settings and compare them with SAGREH [8], EHR [6] and EHPRP [11]. ### Simulation Parameters Setting

The simulation experiments are conducted on MATLAB 2018a, and the PC configurations are Intel(R) Core(TM) i5-1135G7 2.40 GHz, 8 GB RAM, Windows 10 operating system. The specific network parameter settings are shown in Table 2. In this simulation, sensor nodes are randomly deployed in a square field of 200 \(\times\) 200 m\({}^{2}\), each node with the same initial energy \((E_{0})\) of 5-15 J. The battery capacity \(E_{m}=20\)\(J\) and the two thresholds for battery energy (_Level_ 1 and _Level_ 2) are set to 5 and 15%\(E_{m}\), respectively (empirical values [1]). The energy consumption is caused by three parts: (1) sending packets (including initial information packets, ACK packets, reply packets and the data packets), (2) receiving packets (corresponds to the energy of sending packets) and (3) dissipation energy consumption of hardware for maintaining the node operation (including the energy required for modulation, coding, listening, etc.). The data buffer can contain at most 20-60 packets \((B_{max})\). Buffer upper threshold \((B_{upper})\) is the boundary value that adjusts reception state from the receive mode to no-receive mode. If \(B_{upper}\) is too small, it would result in buffer space wastage. While too large, it would easily cause packet loss. Similarly, buffer lower threshold \((B_{lower})\) is the boundary value that adjusts the reception state from the no-receive mode to receive mode. If \(B_{lower}\) is too large, it may cause the node to adjust its data reception state frequently, resulting in energy wastage. While too small, the node may have to wait for a long time duration to recover to the receive mode. In general, \(B_{upper}\) and \(B_{lower}\) are set to 90 and 70%\(D\)\(B_{max}\), respectively (empirical values). Data packets are generated by nodes following Poisson process with average packets generation rate \((PGR)\) of 1-5 packets/s. To ensure the fairness of measurement factors, we set the four weighting factors in Formula (27) to be equal. ### Simulation Metrics

(1) Packet delivery ratio \((PDR)\). It is measured using the ratio of the number of packets received by destination to the number of packets transmitted by source. \[PDR=\frac{number\ of\ packets\ received\ by\ destination}{number\ of\ packets\ sent\ by\ source} \tag{31}\]

(2) Network energy variance. The average network residual energy can be calculated as:

\[\bar{E}_{r}(t)=\sum_{i=1}^{n}E_{r}^{i}(t) \tag{32}\]

The residual energy variance of the network can be expressed as:

\[D(t)=\frac{1}{n}\sum_{i=1}^{n}\Bigl{(}E_{r}^{i}(t)-\bar{E}_{r}(t)\Bigr{)}^{2} \tag{33}\]

(3) Average end-to-end delay. It is the average time that a packet sends from source to destination. \[T=\frac{1}{N_{s}}\sum_{i=1}^{N_{s}}\Bigl{(}t_{r}^{i}-t_{s}^{i}\Bigr{)} \tag{34}\]