## 4 LECP-CP Details
### Data Transmission Phase  
In the data collection phase, each CM collects local data from the environment periodically and then sends the data to the CH within its time slot according to the TDMA scheduling list to avoid collisions among the members in the same cluster. When the data from all of the member nodes have arrived, the CH aggregates the data and sends them to the BS. Thus, this section is divided into two subphases, intra-cluster communication and inter-cluster communication. CMs sense and collect local data from the environment and send the collected data to the CHs. This process is called intra-cluster communication. For simplification, CMs communicate with CHs directly, just like LEACH. In the inter-cluster communication phase, we will construct a routing tree on the elected CH set, and each CH will forward the data it has collected and aggregated from their CMs to the BS by other CHs. This multi-hop communication from CHs to the BS will further reduce and balance the energy consumption. Several nodes need to be selected as child nodes of the BS from all of the CHs and communicate with the BS directly. Therefore, each CH determines whether to be selected as the child node of the BS depending on its distance to the BS according to a threshold Euclidean distance \(DIST\). If the distance from the CH \(s_{i}\) to the BS is less than \(DIST\), \(s_{i}\) communicates with the BS directly and sets the BS as its next hop. Otherwise, it communicates with the BS through a multi-hop routing tree. The concrete process is as follows. We set the duration as \(T_{4}\). At the beginning, each CH broadcasts a \(Route\_Msg\) message within the radius \(R_{r}\) with the values of the \(id\), the node energy consumption ratio and the distance to the BS. To ensure the connectivity of all CHs, we set the radius \(R_{r}\) = 3\(R_{a}\). If the distance from the CH \(s_{i}\) to the BS is less than \(DIST\), it chooses the BS as its next hop. Otherwise, it chooses its next hop according to the received \(Route\_Msg\). The CH \(s_{i}\) chooses the neighbor CH node with a lower _ratio_ and closer to the BS as its next hop. Figure 2: Construction of inter-cluster communication routing. In the cluster setup phase, we adopt the same competition radius to construct clusters of even sizes; thus, the energy consumption among CMs can be balanced well, but the energy consumption of long distance transmission from CHs to BS is large; thus, we construct the routing tree among CHs with the method described above. For instance, in Figure 2, node \(s_{1}\) chooses its next hop CHs, which are closer to the BS than it; here, only \(s_{4}\) is chosen. For \(s_{2}\), when it chooses its next hop based on the distance to the BS, \(s_{1}\),\(s_{4}\),\(s_{5}\) are selected as candidate relay nodes; since \(s_{5}\) has the minimum ratio, \(s_{5}\) is finally selected. For \(s_{4}\), firstly \(s_{7}\) and \(s_{9}\) are selected, since \(ratio(s_{7})<ratio(s_{9})\), \(s_{7}\) is finally selected. For \(s_{9}\), \(s_{10}\) and \(s_{11}\), since their distances to the BS are smaller than \(DIST\), they communicate with the BS directly. The following pseudo-code gives the details of the data transmission phase. **begin** (routing tree construction algorithm)  
Broadcast the \(Rout\_Msg\)  
**if**\(disttoBS<DIST\)**do**  
\(nexthop\)\(\leftarrow\) BS  
**else**  
**while** (\(T_{4}\) has not expired) **do**  
Receive the \(Rout\_Msg\)  
Update CH neighborhood  
table CHNT1[ ]  
**if**\(s_{j}\) has the smaller value of disttoBS  
in CHNT1[ ] **do**  
update CHNT2[ ]  
**end**  
**if**\(s_{k}\) has the min ratio value in CHNT2[ ] **do**  
\(nexthop\)\(\leftarrow\) BS  
**end**  
and one \(Router\_Msg\). It also needs to receive \(n\)\(Join\_Msgs\) and one \(Router\_Msg\).