## 3 Proposed Algorithm
### Cluster Head Selection  
In the TSEP algorithm, the cluster head election mechanism does not consider the remaining energy of the node and the distance between the node and base station, and each node has the probability of being selected as a cluster head. This leads to the premature death of these nodes and reduces the network's lifetime. Therefore, the proposed method introduces the residual energy of nodes into a threshold to reduce the probability of low energy nodes becoming cluster heads. The transmitted data is carried by the electromagnetic wave in the wireless communication system. The energy of the electromagnetic wave is absorbed by air and other objects. This reduces the energy of the received data. The difference in energy between transmitted data and received data is the consumption energy. In the wireless sensor networks, consumption energy for \(l\) bit data transmitted from one node to the other is normally expressed as:  
\[E_{Tx}=\left\{ \begin{array}{l}l(E_{elec}+\varepsilon_{fs}d^{2}),d<r\\ l(E_{elec}+\varepsilon_{mp}d^{4}),d>r\end{array} \right. \tag{5}\]  
where \(E_{elec}\) is the consumption energy for coding and modulating, \(d\) is the distance between the two nodes, \(r\) is the communication range of the node. Based on (5), we can see that the consumption energy is in direct proportion to distance. Therefore, it also introduces the average distance between nodes into a threshold to increase the coverage of the clusters and make the distance between nodes and the cluster head short to reduce the energy consumption of cluster heads. The distance between nodes is also considered to avoid having a cluster node that is far from the base station and consumes too much energy at the data transmission phase. Therefore, the improved threshold formula will solve the above problem. It is expressed as  
\[T(s)=\left\{ \begin{array}{l l}\frac{p}{1-p\times r\times mod(1/p)}\times \omega_{i}&,\,if\,\,s\in G\\ 0&,\,if\,\,s\
otin G\end{array} \right. \tag{6}\]  
where \(r\) is the current round number, \(i\) is node ID, \(\omega_{i}\) is  
\[\omega_{i}=C_{1}\times\frac{1}{d(i)}+C_{2}\times\left(1-\frac{1}{Number(i)} \right)+C_{3}\times\frac{S(i).E}{E_{ave}\times K_{opt}}+C_{4}\times\frac{1}{d_ {Ci-BS}} \tag{7}\]  
where \(S(i).E\) is the residual energy of the current node, \(d_{Ci-BS}\) is the distance from node i to base station, \(Number(i)\) is the number of nodes in the range of _do_, \(d(i)\) is average distance from node i to other nodes,\(E_{ave}\) represents the average energy of the current node,\(K_{opt}\) is a constant, _do_ and \(d(i)\) are expressed as  
\[do=\sqrt{\frac{\varepsilon_{fs}}{\varepsilon_{mp}}}, \tag{8}\]  
\[d(i)=\frac{\sum\limits_{j=Number(i)}d(i,j)}{Number(i)}, \tag{9}\]  
\[d_{Ci-BS}=\sqrt{\left(x_{Ci}-x_{BS}\right)^{2}+\left(y_{Ci}-y_{BS}\right)^{2}} \tag{10}\]  
where \(d(i,j)\) is the distance between node \(i\) and node \(j\), \(\varepsilon_{fs}\) and \(\varepsilon_{mp}\) are the parameters for the amount of energy consumption per bit in the radio frequency amplifier. The values \(C_{1}\), \(C_{2}\), \(C_{3}\), and \(C_{4}\) are the control parameters of the relative distance between nodes, the degree of the node, the residual energy of the node, and the distance from a node to the base station, respectively, and satisfy that  
\[C_{1}+C_{2}+C_{3}+C_{4}=1, \tag{11}\]From (7), we can make the following four conclusions:  
1. A higher value for \(S(i).E\) means a higher value for \(\omega_{i}\). Therefore, there is a high probability that a node with a large energy value will become a cluster head. 2. A lower value for \(D(i)\) means a higher value for \(\omega_{i}\). Therefore, it is more likely that a node closer to the base station will become a cluster head. 3. A higher value for \(Number(i)\) means a higher value for \(\omega_{i}\). Therefore, if there is more coverage within the cluster, there is a greater probability of a node becoming a cluster head. 4. A lower value for \(d(i)\) means a higher value for \(\omega_{i}\).