# Robust Downlink Mechanism for Industrial Internet of Things Using LoRaWAN Networks
## 3 Materials and Methods
### DROB: Adaptive Downlink Rate Optimization for Class B  
The LoRaWAN specification features the Adaptive Data Rate (ADR), which is a mechanism that allows resources to be saved while improving lower quality communications. This mechanism optimizes airtime and energy consumption in end devices, but devices remain decisive in whether or not to activate this mechanism.  
Put simply, when the mechanism is activated, devices start a transmission counter, and if they do not receive acknowledgements the counter is increased until the devices chose either to increase the transmission power if possible, or, if power is already the maximum allowed, try to decrease the data rate (DR), which is equivalent to increasing the spreading factor (SF). On the other side, the GW registers the SNR (signal to noise ratio) for the packets received from each device. After receiving sufficient samples (typically 20, but this can be altered), the SNR margin is computed by comparing the maximum SNR registered against requirements in order to receive the packets, and a predefined margin to ensure operation at each data rate. With these operations the GW is able to inform (via a MAC command) each device whether it can increase the data rate. The flow chart in Figure 3 summarizes how this mechanism operates.  
The proposal for the downlink traffic follows the same logic but considers some key points, as introduced as part of previous work in [14]: the maximum DR the GW can use is set as DR3, because higher DRs affect the strict timing for pingslots that enables synchronised and scheduled transmissions, which would mean changing timing parameters that might prevent communication. Additionally, the increments of power before changing DR are not considered, as the GW is not limited by batteries and always operates at the maximum allowed, because it has to reach as far as possible and to multiple destinations. This is different in a node, which only needs to adjust its power to reach the GW and usually operates with battery limitations.  
Figure 2: Possible events affecting downlink transmissions.  
Considering these assumptions, the GW computes the same statistics for each node, and when the pingslot assigned to a certain node is reached, the GW will use the DR it calculates to send the downlink packet. For this to work, nodes need to send information to the GW during uplink, as received SNR and pingslot acknowledgment is required to perform the ADR operation. This information can be sent as piggyback data in regular uplink messages, or in downlink acknowledgments, whichever happens first. The GW also tracks the packet loss ratio (PLR) for each node, that is, the ratio of downlink lost packets, updating this value periodically via a sliding window algorithm, and whenever the PLR value for a given node is above the selected limit, called \(\text{PLR}_{\text{max}}\), according to the requirements of the application, the GW informs the node that the following packets will be sent after decreasing the DR. Figure 4 shows the flow chart describing the operation of the proposed DROB mechanism.  
This implementation differs from the decreasing method of a traditional ADR mechanism, but it allows for faster reaction to changes in the channel, allowing the DR to be adapted to the changing conditions of the environment, and ensures stability without triggering too many unneeded changes.