## 3 HMC-MAC Protocol
### Channel Allocation Scheme and Node Activity  
The role of the \(NC\) is to divide time into intervals and inform all nodes of this time segmentation using the beacon frame. In this paper, we assume that each node has only one radio interface (nodes should be low cost and use energy efficient hardware components), the sink can have several radio interfaces. We consider the availability of \(16\) orthogonal communication channels as allowed by the IEEE 802.15.4 standard [21]. All nodes willing to communicate with the same node compete on the same channel in order to access the medium and send information using CSMA/CA algorithm. Topology is organized into several depths based on the ZigBee Custer-Tree topology [22]. We consider that all the traffic is destined to the \(NC\), for that, exchanges can be sequenced according to the depth of the nodes in the topology and channels can be allocated taking into account the traffic orientation. In order to increase the throughput, the \(NC\) should remain in reception mode and the nodes in depth \(1\) should should alternate between sending mode and reception mode in order to keep part of them in transmission mode. Thus, we divided the network into two groups (Figure 3), \(Group\)\(1\) includes odd depth nodes that are descendants of an even child of an interface (\(B\), \(D\), \(F\) are even children of an interface), and also includes even depth nodes that are descendants of an odd child of an interface. All other nodes are included in \(Group\)\(2\). For example, in Figure 3\(Group\)\(1\) includes nodes \(G\), \(H\), \(B\), \(M\), \(D\), \(O\), \(P\), \(F\). All the other nodes are part of the second group. When nodes of \(Group\)\(1\) are in transmission mode, nodes of \(Group\)\(2\) are in reception mode, and vice versa. This insures that interfaces of the \(NC\) always have nodes in transmission mode forwarding them traffic (this can be ensured using methods of topology control, but it is out of the scope of this paper). Figure 4 depicts the algorithm that is executed by each node in order to calculate the index of the branch to which it is affiliated. The index of the branch will allow the node to which group it belongs. We use the hierarchical addresses of ZigBee based on the Cskip formula as explained in the standard [22]. For channel allocation, each node has a 3-hop neighborhood bitmap which enables it to choose dynamically its own channel. The node with the highest priority in the 3-hop neighborhood chooses its channel first. Priorities are assigned according to the network addresses. The node with the smallest network address has the highest priority. A node proceeds to its channel allocation as soon as it becomes the node with the smallest address among its 3 hop-neighborhood that is not yet assigned a channel. A bitmap that represents all the nodes is also used to announce which nodes have completed the channel allocation process in order for each node to know if it is its turn to choose a channel. When a node chooses its channel, it broadcasts it in the beacon frame. Each node then builds a 16-bit bitmap for nodes that belong to \(Group\)\(1\). It also builds 16-bit bitmap for nodes that belong to group \(Group\)\(2\). Where each bit in the bitmaps indicates the occupancy of the equivalent channel in 1-hop neighborhood. These bitmaps are then included to the beacon which allows nodes to build a 2-hop channel allocation bitmaps. All four bitmaps are then included in the beacon to build a 3-hop channel allocation view for each group of nodes. Figure 4: Algorithm for calculating the index of the branch to which a node is affiliated. Figure 3: Network segmentation. Each interface divides its descendants into two branches. In the first branch, even depth nodes belongs to \(Group\)\(1\), odd depth nodes belongs to \(Group\)\(2\). In the second branch, odd depth nodes belongs to \(Group\)\(1\), even depth nodes belongs to \(Group\)\(2\).