## 3 Design, Implementation and Test of the DXN Engine
### DXN Algorithms and Suitable AI Engine Implementation  
We decided on implementing the following deployment scenario that reflects the issues mentioned in the problem statement in Section 3.2. As shown in Figure 2A, and as described in Section 3.2.2, this is a typical IoT network scenario that illustrates some SNs unable to reach the GW using LoRa. Specifically, SN2-SN4 are shown to be out of the GW range, therefore, they will switch to listening mode waiting for rescue messages. SN6-SN11 are directly communicating with the GW as they are within its range, and they are operating as regular LoRaWAN SNs. On the other hand, SN12 and SN13 are likely to become bridging SNs (MN1 and MN2) for SN2-SN4 as they are within their reach. Furthermore, SN1 was connected directly to the GW, but when an obstacle was introduced, it will become EN1 and will start communicating through its neighbour SN12 (MN1). As SN5 was moved away from the GW, it also becomes EN5 and started forwarding through SN13 (MN2). Figure 2B illustrates the deployment after the bridging algorithm took effect. In consideration for the design of DXN, this scenario suffers from the following issues due to the geographical location and the transmission timing of the network nodes (see Section 3.2): (1) lack of MN selection mechanism, which cause an imbalance of the network load (power consumption eventually) due to the randomness of selecting the MN out of the available ones (if any); (2) lack of synchronisation mechanism (as it is costly to implement) and that will cause miscommunications; (3) high power consumption, due to the inconsistency in the transmission intervals which leads to long waiting time ENs spent in many cases waiting for a rescue message to be received. Therefore, we implemented our DXN engine to overcome these issues by using a Deep Neural Network (DNN) model [15] to predict the status/resources of each available MN. Then, based on that, it will assign a score for each MN; the better the resource, the higher the score will be for each MN. These scores will influence the MN selection in case more than one is available. DXN will keep monitoring the received messages and updating the scores as the MNs' status changes so to choose the next MN for any new blocked SN (Figure 3). The same DNN model is used to predict the time required for any chosen MN to forward a message for any specific EN and its corresponding reply/Ack message. This is to minimise the waiting (listening) time spent by the ENs (based on the connection status and the number of ENs available). The model will feedback the predicted timer for each bridged EN. Figure 2: (**A**) The implemented IoT network deployment, (**B**) The same deployment with the bridging algorithm. DXN also uses a Time Series model [16] in combination with its DNN to predict the SNs' activity by forecasting the trend of their collected connectivity data to unify the transmission intervals for each chosen MN and its connected ENs (Figure 3). For testing (see Section 3.4), DXN's AI engine is trained using a dataset of the relevant data collected from all SNs messages in the IoT Network. This dataset contains around 6300 entries; each entry contains information about a packet received by the server from a specific SN (EN/MN). The dataset contains two types of information, first is the information provided by each node (such as node address, battery level, location, the role (EN, MN or just SN) and Tx interval), and the second is information calculated upon receiving the packet at the host server (receiving time, RSSI, SNR and time since the last packet). Each dataset was split into 80% for training and 20% for testing as it was the best effective use setup. Again, as illustrated in Figure 4, DXN is continuously making new decisions to improve the network performance. It follows a continuous cycle of analysing the collected data (the current network status), making new changes and then implementing them, and will start over by analysing the newly collected data (new network status) and so on.