## 3 Improved LEACH Protocol
### LEACH Protocol Based on Replication Computing
#### 3.4.2 Protocol Implementation  
In the proposed LEACH protocol, the clustering and scheduling algorithms all need to know a lot of information about the states of other nodes, like the residual energy and the scheduled transmission times. Exchanging this information needs extensive information exchange, which will decrease the performance of the network significantly. So, replication computing is introduced to the proposed LEACH protocol to reduce the signaling.  
In general, an operation suitable for replication computing should satisfy the following conditions:  
1. The inputs of the operation are variable.
2. Multiple nodes must know the operation results.
3. The operation is deterministic.  
The clustering and scheduling operations satisfy all the conditions required by the replication computing. For the clustering, the residual energy of each node, which is the input of the clustering algorithm, is changed every round. All nodes must know the clustering results. The clustering method proposed in Section 3.2 is deterministic. For the scheduling, the destination nodes, i.e., the cluster head nodes, which are the input of the scheduling algorithm, change every round. Each sensor node must know the transmission schedules of other nodes to avoid collision. The scheduling method proposed in Section 3.3  
Figure 3: An example of using replication computing to reduce communication in parallel computing.  
is deterministic. Hence, replication computing can be used to reduce the signaling in the clustering and transmission phases of the proposed LEACH protocol.  
The basic idea of applying replication computing to the proposed LEACH protocol is that each node can calculate the states of all other nodes in the whole network independently through replication computing if the initial states of other nodes are known, including the residual energies and transmission schedules. Based on this idea, the steps of the proposed protocol are as follows:  
1. Initialize a table in each node that contains information about the location, initial energy, and schedule order of all nodes in the network.
2. Activate the network by transitioning from standby to active mode for the communication task. Each node updates the residual energies of all nodes in the network according to the following formula: \[E_{i}^{\prime}=E_{i}-E_{standby}\] (23) where \(E_{i}^{\prime}\) is the updated residual energy of the \(i\)th node, \(E_{i}\) is the initial residual energy, and \(E_{standby}\) is the energy consumption during the standby mode.
3. Each node independently computes a consistent network clustering result using the proposed clustering algorithm through replication computing.
4. Each node establishes an identical packet scheduling table using the proposed scheduling algorithm through replication computing.
5. Sensor nodes and cluster head nodes send packets at predetermined times.
6. Each node updates the residual energies of all nodes in the network through replication computing. The energy update process differs between sensor nodes and cluster head nodes as follows: For sensor nodes: \[E_{i}^{n\prime}=E_{i}^{n}-E_{i}^{nt}\] (24) where \(E_{i}^{n\prime}\) is the updated residual energy of the \(i\)th sensor node, \(E_{i}^{n}\) is its initial residual energy, and \(E_{i}^{nt}\) is the energy consumed by the \(i\)th sensor node during transmission. For cluster head nodes: \[E_{i}^{ht}=E_{i}^{h}-E_{i}^{ht}-E_{i}^{hc}\] (25) where \(E_{i}^{ht}\) is the updated residual energy of the \(i\)th cluster head node, \(E_{i}^{h}\) is its initial residual energy, \(E_{i}^{ht}\) is the energy consumed by the \(i\)th cluster head node during transmission, and \(E_{i}^{hc}\) is the energy consumed by the \(i\)th cluster head node during data reception.
7. Continue with the next round of communication or enter standby mode.  
Note that nodes in the network will periodically synchronize their residual energy and other information during idle periods when there is no communication task to avoid accumulated calculation errors of replication calculation.