# A Cluster-Based Dual-Adaptive Topology Control Approach in Wireless Sensor Networks
## 3 The Improved Clustering Scheme
### Cluster Formation
#### 3.2.3 Selecting SCHs
In Algorithm 5, if the transmission power from the FCH to the MCH is different from that from the FCH to the SCH, the largest one is adopted to broadcast a PAREP packet so that the MCH and the SCH all receive it (see lines 23\(\sim\)30). There may not exist a SCH in a cluster. At this time, the goal of power adjustment is to ensure that the FCH can be just connected to the MCH (see line 32). Since the transmission power computed by the Equation (11) is an approximate value, it does not ensure that the sending node can be connected to the corresponding receiving node. Therefore, if the receiving node does not receive the PAREP packet in time, it will retransmit the PAREQ packet. In turn, this makes the sending node retransmit the PAREP packet at the transmission power increased by \(\varepsilon\) (see lines 34\(\sim\)39). ```  
Run at a MCH node (e.g., \(u\))  
Input: \(N_{max}\)  
Output: NULL  
Initialize \(N\) as zero  
Send a PAREQ packet at its maximum transmission power to the FCH (e.g., \(w\))  
Set the timer \(t_{\sigma}\) as \(\sigma\)  
**while** the timer \(t_{\sigma}\) does not expire **do**  
**if** receive the PAREP packet from the FCH (e.g., \(w\)) **then** return  
**end while**  
**if**\(N\) < \(N_{max}\) **then**\(\{N\)++; go to step 2\(\}\) **else** return **end if**  
Run at a SCH node (e.g., \(v\))  
Input: \(N_{max}\)  
Output: NULL  
**if** hear the PAREQ packet from the MCH (e.g., \(u\)) **then**  
Initialize \(N\) as zero  
Send a PAREQ packet at its maximum transmission power to the FCH (e.g., \(w\))  
Set the timer \(t_{\rho}\) as \(\rho\)  
**while** the timer \(t_{\rho}\) does not expire **do**  
**if** receive the PAREP packet from the FCH (e.g., \(w\)) **then** return  
**end while**  
**else**  
**Go to step 8**  
**end if**  
Run at a FCH node (e.g., \(w\))  
Input: the hello messages of all neighbors and the very small real number \(\varepsilon\)  
Output: the adjusted transmission power from FCH to MCH/SCH  
**if** receive the PAREQ packet from the MCH (e.g., \(u\)) **then**  
Adjust the transmission power \(p^{t}{}_{w,u}\) according to the Formula (11) and initialize _FLAG_ as _true_  
Set the timer \(t_{\phi}\) as \(\psi\)  
**while** the timer \(t_{\phi}\) does not expire **do**  
**if** receive the PAREQ packet from the SCH (e.g., \(v\)) **then**  
Adjust the transmission power \(p^{t}{}_{w,v}\) according to the Formula (11)  
**if**\(p^{t}{}_{w,u}\) > \(p^{t}{}_{w,v}\) **then**  
Broadcast a PAREP packet at \(p^{t}{}_{w,u}\) and set _FLAG_ as _false_  
**else**  
Broadcast a PAREP packet at \(p^{t}{}_{w,v}\) and set _FLAG_ as _false_  
**end if**  
**end while**  
**if**\(\{FLAG==true\}\) **then** Broadcast a PAREP packet at \(p^{t}{}_{w,u}\)  
**end if**  
**if** receive the repeated PAREQ packet from the MCH (e.g., \(u\)) or the SCH (e.g., \(v\)) **then**  
**if**\(\{FLAG==true\}\) **then**\(\{p^{t}{}_{w,u}=p^{t}{}_{w,u}+\varepsilon\); Broadcast a PAREP packet at \(p^{t}{}_{w,u}\}\)  
**else if**\(p^{t}{}_{w,u}\) > \(p^{t}{}_{w,v}\) **then**\(\{p^{t}{}_{w,u}=p^{t}{}_{w,u}+\varepsilon\); Broadcast a PAREP packet at \(p^{t}{}_{w,u}\}\)  
**else**\(\{p^{t}{}_{w,v}=p^{t}{}_{w,v}+\varepsilon\); Broadcast a PAREP packet at \(p^{t}{}_{w,v}  
In the Algorithm 6, in order to reduce message overhead, when the FCH receives the first PAREP packet from any cluster member, it must wait for the time \(\phi\) to carry as many cluster members' _ID_s as possible in the same power acknowledge list message (see lines 4-7). For a cluster member (e.g., \(x\)), upon receiving the PAREQ packet from the FCH (e.g., \(w\)), it first adjusts its transmission power (e.g., \(p^{t}x\),\(w\)) requested to reach this FCH according to the Equation (11), and then sends a PAREP packet back at the transmission power \(p^{t}x\),\(w\) (see lines 11-14).