# Efficient Cluster Tree Topology Operation and Routing for IEEE 802.15.4-Based Smart Grid Networks
## 4 Proposed Scheme
### Proposed SD Selection Scheme  
Initially, the gateway displays the SD slot it occupies and the SD slot of the one-hop neighboring node in the CH Info # field and broadcasts a beacon frame. It is assumed that three channels are used and that the number of allocatable SDs is six. It is also assumed that the maximum value of the NCM field of the gateway is set to six and that of the NCM field of the other cluster heads is set to two. In this case, the gateway preempts SD numbers 1 and 3 in advance on channel 1, SD numbers 2 and 4 on channel 2, and SD numbers 3 and 6 on channel 3 in preparation for connecting the 6 cluster heads. Figure 7 shows an example of the proposed SD selection algorithm that operates in a network using three channels.  
Figure 6: Proposed cluster join process.  
In Figure 7, the tree level of the gateway is zero, the channel number is one, and the SD number is set to one. If a random node transmits a beacon frame when connected, it examines the beacon frame, selects wireless channel No. 1 and SD No. 2, and functions as a cluster head. Figure 8 shows an example of a new node joining a network following Figure 7.  
As shown in Figure 8, when a new node is connected to a network, it may receive a beacon frame from the gateway and CH1. An examination of the received beacon frame reveals that the SD numbers available for channel 1 are 3, 5, and 6; those for channel 2 are 1, 3, 4, and 6; and those for channel 3 are 1, 2, 4, and 5. Therefore, the new node selects channels 2 and 3 to connect to the gateway and operates as a cluster head in the corresponding resource. Figure 9 shows an example of a third node joining a gateway.  
In Figure 9, it can be observed that, if the new node receives the beacon frame from the gateway and CH2, the channels that can be selected through the beacon frame received are numbers 2 and 3. The node can observe that the available SD numbers are 1, 4, and 6 on channel 2 and 1, 2, and 4.5 on channel 3. Accordingly, the node selects channel 3 with a large number of available SD numbers and reports it as CH2. Figure 10 shows an example of a new node joining CH1 as a cluster member.  
Figure 8: Second example of the proposed SD allocation algorithm.  
Figure 7: Example of resource selection for the first node joining the gateway in the proposed scheme.  
Figure 9: Third example of the proposed SD allocation algorithm.  
In Figure 10, if the new node receives the beacon frame from CH1 and CH2, the channels that can be selected through the received beacon frame are numbers 1 and 2. It can be observed that SDs 1, 4, and 6 can be used in channel 2 and that SDs 3, 5, and 6 can be used in channel 1. In this case, because the number of available SDs is identical, the selection of the parent cluster does not matter. Here, CH1-2 selected CH1. Figure 11 shows an example of a new node joining CH2.  
Figure 11 shows that, when the new node receives the beacon frame from CH1-1 and CH2, the configurable channels through the received beacon frame are numbers 1 and 2. In addition, because the tree level of CH2 is 1 and that of CH1-1 is 2, the node selects CH2 (with a small tree-level value) as the parent cluster head. This would then be referred to as CH1-1. Figure 12 shows an example of a new node joining CH3.  
Figure 12 shows that, if the new node receives beacon frames from CH2, CH3, and CH2-1, it has configurable channels 2 and 3. The SDs that can be used in channel 2 are numbers 1 and 6, and those that can be used in channel 3 are numbers 1, 2, and 5. Accordingly, channel 3 (with more available SDs) was selected. This fact was noted for CH2 and CH2-1 (i.e., the fifth example of the proposed SD allocation algorithm).  
Figure 11: Fifth example of the proposed SD allocation algorithm.  
Figure 10: Fourth example of the proposed SD allocation algorithm.