# Robust Downlink Mechanism for Industrial Internet of Things Using LoRaWAN Networks
## 3 Materials and Methods  
### Technology Introduction  
The LoRaWAN standard, as introduced in the previous section, can be found in [3], and information on the physical level LoRa can be found in [1]. This section introduces the most relevant aspects of the technology so that the explanation of the proposed enhancements is understandable. LoRaWAN introduces three operation modes that a node can select to transmit or receive data:Class A describes the original LoRaWAN mode of communication. Communication is bidirectional, with the limitation that nodes can only receive a downlink packet from the GW if they have previously sent an uplink message, which is a great limitation for some applications. However, battery savings in this class are greater than in the other classes. * Class B is bidirectional, but in this case nodes can also receive in scheduled time slots. When operating in class B, nodes can send uplink messages following the class A mechanism (i.e., sending data at any time the duty cycle allows), but they do not need to enable the RX windows, as the GW establishes planification, reserving slots for all class B nodes in the network. Other temporal parameters can be seen in Figure 1. This mechanism requires every node to be synchronized with the GW. This is achieved using periodic beacons broadcast by the GW every 128 s. The time window between beacons is then divided into slots that can be assigned to nodes to enable downlink messages without the need for previous upload packets. * Class C keeps the radio interface permanently active and allows bidirectional communication so long as the duty cycle is respected, at the cost of consuming more energy than any other operation mode. This work focuses on downlink traffic which needs to be decoupled from the uplink stage. This means the GW does not have to wait until a message from a node is received to send a message to this node, as occurs in class A. Furthermore, class C drains the batteries of devices faster and is more affected by collisions than class B, which introduces scheduling to reduce this problem. Therefore, class B is the selected mode of operation because it fits the application requirements better than the others. Nevertheless, class B also introduces some challenges that need to be considered: scalability and performance. Having scheduled channel access means nodes have defined slots and therefore chances of receiving data, which prevents collisions with other nodes, but also means there is a limited number of available slots--so when the number of nodes grow, this schedule can be a problem. There are several events that can hinder the operation of a class B node:  
* The pingslot selected has already been assigned to another node when the number of nodes is higher than the available pingslots--situation 1 (indicated with a 1) in Figure 2.
* The assigned pingslot is already in use (because the previous downlink transmission is still active)--situation 2 (indicated with a 2) in Figure 2.
* Pingslot assigned is too close to the previously active one (even if it finished) and cannot be used due to duty cycle regulations--situation 3 (indicated with a 3) in Figure 2.  
Figure 2 above shows a temporal representation of a class B beacon period in a network where N possible nodes are receiving from the GW. Nodes 1, i, j and N represent any four nodes of the network. Node 1 is used as the node that receives successfully, while node i does not receive due to having the same assigned timeslot as node 1. The packet for node j is also discarded as it occurs while the transmission for node 1 is still happening. Lastly, after sending the packet to node 1, the GW must respect the duty cycle, which means any outgoing packet for another node, such as node N, is also discarded. Beacons can be also lost due to the duty cycle: even if there are beacon guards and reserved times, if the last pingslot active is too close to the beacon's sending time, the duty cycle limitation can cancel  
Figure 1: Class B beacon window temporal parameters. the transmission.