## 3 Proposed Algorithm
### Data Transmission Phase  
In the TSEP algorithm, the cluster head directly transmits data to the base station. Therefore, the cluster head far from the base station will consume a large amount of energy and reduce the network's lifetime. In our improved protocol, each cluster head selects a route path to send data to the base station. The path is selected based on the consumption energy of the cluster head that sends data to the base station.  
Each cluster head estimates the communication energy consumption during the transmission of \(l\) bit messages directly to the base station, which is defined as \(E_{Ci-BS}\). The value of \(E_{Ci-BS}\) is given by (12) [6]:  
\[E_{Ci-BS}(l.d_{Ci-BS})=\begin{cases}1E_{elec}+l\varepsilon_{fs}d^{2}{}_{Ci-BS}, &\quad d_{Ci-BS}<do\\ 1E_{elec}+l\varepsilon_{mp}d^{4}{}_{Ci-BS},&\quad d_{Ci-BS}\geq do\end{cases}, \tag{12}\]  
where \(E_{elec}\) is the energy consumption per bit in the transmitter and receiver, \(d_{Ci-BS}\) is the distance between the cluster head \(i\) and the base station, and \(do\) is the threshold. \(\varepsilon_{fs}\) and \(\varepsilon_{mp}\) are parameters in the free-space propagation model and path attenuation propagation model of the radiofrequency amplifier, respectively. The distance is measured based on the value of \(do\) whose value is given by (8), and the value of \(d_{Ci-BS}\) is given by (10). As can be seen from (12), if \(d_{Ci-BS}<do\), then the energy consumption of nodes should be calculated using the upper part of the (12) (free-space propagation model). If \(d_{Ci-BS}\geq do\), then the energy consumption of nodes should be calculated using the lower part of (12) (path attenuation propagation model). Then, each cluster head decides whether to find an intermediate cluster head for the current round. This decision is based on the following conditions:  
\[E_{Ci-BS}(l.d_{Ci-BS})\geq E\big{(}l.d_{Ci-Cj}\big{)}+E\big{(}l.d_{Ci-BS}\big{)}, \tag{13}\]  
where \(d_{Ci-Cj}\) is the distance between the cluster head \(i\) and the cluster head \(j\), \(d_{Ci-BS}\) is the distance between the node \(j\) and the base station. The value of \(d_{Ci-Cj}\) and \(d_{Ci-BS}\) is given by (14) and (15):  
\[d_{Ci-Cj}=\sqrt{\big{(}x_{Ci}-x_{Cj}\big{)}^{2}+\big{(}y_{Ci}-y_{Cj}\big{)}^{ 2}}, \tag{14}\]  
\[d_{Ci-BS}=\sqrt{\big{(}x_{Cj}-x_{BS}\big{)}^{2}+\big{(}y_{Ci}-y_{BS}\big{)}^{ 2}}, \tag{15}\]  
Each cluster head starts by estimating the communication energy dissipation \(E_{Ci-BS}(l.d_{Ci-BS})\). If \(E_{Ci-BS}(l.d_{Ci-BS})\geq E\big{(}l.d_{Ci-Cj})+E(l.d_{Ci-BS})\), then the node \(j\) should serve as an intermediate node in its route. Otherwise, the intermediate node is not required. Therefore, a path with a minimum sum of energy consumption would be selected for data transmission, and it will be more efficient for some cluster heads that are at a long distance to use the intermediate node to communicate with the base station.  
After the cluster head completes the data transmission, we should change the state of the nodes. If the node and its neighbor node are not dead, then the two nodes should keep their current state.  
If a pair has one dead node, its partner would keep an active status and try to find another node to complete a pair. This indicates the completion of this round, after which all nodes prepare for the next round.