# HARE: Supporting Efficient Uplink Multi-Hop Communications in Self-Organizing LPWANs
## 5 Protocol Stack
### Network Layer
#### 5.3.2 Association  
To cope with multiple association requests in a short period of time, the system is able to admit new STAs through two different mechanisms: an active, global, scheduled one, called _network association mechanism;_ and a passive, singular one, called _STA association mechanism_.  
* **Network association mechanism** The _network association mechanism_ allows a large amount of STAs to associate to the network in a short period of time. Once the GW is activated, or after a pre-determined number of _primary beacons_\((N_{\text{pr}})\), the GW broadcasts a _network association primary beacon_. Depending on the RSSI value received in the _network association primary beacon_ and three configuration parameters embedded in it (maximum RSSI, number of association turns, and amplitude in dB of each turn), STAs determine their association turn (generally, the greater the RSSI received, the earlier association turn is selected). Then, a number is selected uniformly at random by the STA, determining its association slot within the association turn. The number of association turns \((a_{t})\), association slots per turn \((a_{s})\), and the length of a slot \((T_{a})\) are parameters set by the GW and included in every _network association primary beacon_. STAs then follow with a discovery message sent via broadcast, which is responded by the GW and all the already associated STAs, provided they are within the coverage range. The process of selecting the best path to reach the GW is detailed in Subsection 5.3.3. After taking into account all the received association requests during a \(T_{g}\) time period, the GW notifies the joining of new STAs by means of a summary broadcast message sent immediately after every association turn.
* **STA association mechanism** The _STA association mechanism_ provides a solution to those specific nodes that (i) have not found a path to the GW during the _network association mechanism_; (ii) have been powered on between two consecutive _network association primary beacons_; or (iii) have simply suffered routing problems in their path to the GW. This mechanism follows the same pattern as the _network association_ one, with the single exception that there is only one association turn located immediately after each _data primary beacon_ to be used by non-associated STAs.  
Inactive or erratic STAs are removed from the network and the GW's routing table to create, if necessary, new routing paths that ensure correct packet reception from remaining network STAs. Disassociations can be controlled by the GW through the _disassociation mechanism_ or by the STAs themselves through the _self-disassociation mechanism_:  
* **Disassociation mechanism** The GW removes an STA from the network if not receiving any data packets during a pre-determined number of consecutive _primary beacons_\((N_{\text{pd}})\). A roster with the latest disassociated STAs is included in every _primary beacon_. This information is not only useful for malfunctioning STAs, which can make immediate use of the _STA association mechanism_, but also for their parents, as they can check the current state of their children. Hence, if all its children became disassociated, a parent would go to sleep during the RX time period allocated to its ring.
* **Self-disassociation mechanism** The goal of this mechanism is to avoid repetitive association requests and other energy-consuming procedures that could make STAs run out of battery when no connection with the GW is possible. All STAs have a timer that is activated after being switched on or when receiving a _primary beacon_. From that moment on, if an STA does not receive any other beacon during a predetermined period \((T_{d})\), it turns itself off. Thus, the STA is considered _dead_ and it will need to be reactivated by manual procedures.