## 3 HMC-MAC Protocol
### Network Creation and Beacon Propagation  
The first node to be activated in the network is the node that will create the network and start broadcasting periodical beacons. When a new node is activated and wants to join the network, it starts by scanning for beacons. If no beacon is detected, the node will consider that it is the first node in the network and create a new network. This node is known as the Network Coordinator (\(NC\)) and is on depth \(0\). In case the new node receives at least one beacon, it chooses the most suitable one and sends an association request to the node that is broadcasting it. The choice of the beacon can be based on different criteria such as the RSSI and the LQI for robust links, or the number of hops separating the source of the beacon from the destination node for minimum end-to-end delay, or a combination of both depending on the application needs. In our case we consider the current number of children of the source in order to achieve load balancing at the association phase.  
In the case where two nodes create new networks at the same time and are able to detect each other, the \(NC\) with a bigger ID quits its own network and joins the network of the \(NC\) with the smaller ID. The case where the \(NCs\) are not in range is out of the scope of this paper and will be studied in future works.  
Time is divided into cycles (Figure 1). Each cycle is divided into intervals during which communications are organized in a specific manner. Each cycle begins with a TDMA beacon propagation period \([T_{0};T_{1}]\) that is followed by a data exchange period \([T_{1};T_{2}]\) and an inactive period \([T_{2};T_{0}]\). Depending on the application needs, the duration of these intervals can be adjusted to absorb the generated traffic.  
During \([T_{0};T_{1}]\) the \(NC\) broadcasts a beacon that is propagated in a multi-hop manner to reach all the nodes of the network based on the MaCARI protocol [19]. Each node in the network has a unique beacon transmission slot during which it broadcasts its beacon. The beacon contains information that enables each node to know in which slot it should propagate its beacon. When a new node joins the network, its address is sent to the \(NC\) in order to update the propagation order. The \(NC\) will then include this address in the beacon for \(m\) consecutive cycles. Similarly, in case of a node departure, a leave request is sent to the \(NC\) (it can be sent by the node that is willing to leave the network, or sent by neighboring nodes that detected that a node has failed. The latter aspect is out of the scope of this paper). This allows nodes to update their local propagation order. The propagation order is maintained in each node and updated using the beacon. The order of the addresses defines the order in which the beacon is propagated: if the address of a node has the index 3 in the propagation order, it means that it is the third node to send the beacon during \([T_{0};T_{1}]\) (more details on this aspect can be found in [5,20]). This guarantees that beacons are not sent at the same time and thus avoids collisions. The beacon is propagated using a known common channel. This way new nodes scan only one channel to discover the network.  
Figure 1: Global cycle. \([T_{0};T_{1}]\) is a synchronization period, \([T_{1};T_{2}]\) is dedicated for data exchange.