## 3 Design, Implementation and Test of the DXN Engine
### DXN Tests Scenarios and Experiments
#### 3.4.1 Network Load-Based Optimisation Algorithm  
Using the DNN model, this algorithm is responsible for balancing the network load by selecting the best available MN at the time. This will take effect when an EN is within the range of more than one MN. In this case, DXN will select the MN with the higher score (better resources), and this helps balance the traffic in the network. In this case, all the heavy computations and analysis are performed at the host server leaving the node with minimum tasks. The selected MN's address will be included in the downlink (Ack message from the GW to the EN); the EN will then only respond to that MN and will ignore any other MNs within its range. To test this, we used a scenario that we have tested previously for better results comparison. The scenario, as shown in Figure 5, consists of two MNs (MN1 and MN2) and five ENs (EN1, EN2,..., N5). The nodes' position is chosen so that MN1 is within EN1, EN2 and EN3's range and MN2 is within EN3, EN4 and EN5's range. This scenario was implemented to test the ability to create a bridge to link the GW to what was unreachable EN. However, this randomness will create an imbalance in the network, especially when MN1 and MN2 are transmitting at different intervals, leading to one of them having a higher chance of being selected by the EN. Since EN3 is within both MNs' range, the selection is random based on which MN is discovered first (meaning, each time EN3 has something to send it will listen until the first rescue message from either MN1 or MN2 is received, and it will respond to that message). In summary, with the use of DXN, each MN will now be given a score based on its current status, and EN3 will be instructed to respond to the one with the higher score (better resources) and will ignore messages received from others. Table 1 shows the difference in the EN3 behaviour between the two scenarios (with/without DXN). From Table 1, it is clear that without DXN, EN3 is almost equally selecting between MN1 and MN2 (as both send at equal intervals) which, on paper, looks better balanced. However, by examining the MNs' statistics, it shows otherwise (see Table 2). It shows that with the use of DXN, the forwarding capacity is spread between MN1 and MN2 unevenly, but according to the score, MN2 clearly has better resources and thus the added capacity. To test the dynamic aspect of DXN, EN1 and EN2 (connecting through MN1) were removed during the test. This affected the MN1 score, since it had no ENs connecting through it, making its score higher than MN2\({}^{\prime}\)s score. EN3 then changed its behaviour and started to forward through MN1 since it had better recourses. Another scenario was implemented to highlight the effect of the DXN engine on a larger network, where a total of five MNs and 11 ENs were deployed. The nodes were deployed in an arranged setup where almost every EN is within the range of more than one MN. The MNs' scores were somewhat different. Figure 6 illustrates the difference between the scenario in Figure 5 with and without the DXN engine by showing the load (number of packets being forwarded) and the score for each MN. In addition, DXN creates a more balanced network when forcing MNs that have a higher score to forward more packets. \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline  & & & \multicolumn{4}{c}{**Without DXN**} & \multicolumn{4}{c}{**With DXN**} \\ \cline{2-10}
**EN\#** & **Total Tx** & **Packets** & **Packets** & **Processets** & **Processets** & **Processets** & **Processets** & **Processets** & **Processets** & **Processets** \\
**Packets** & **through** & **through** & **Delivered** & **PDF** & **Overzill Tx** & **through** & **Through** & **Delivered** & **PDF** & **Overzill Tx** \\  & **MN1** & **MN2** & **Packets** & & **Time (sec)** & **MN1** & **MN2** & **Packets** & **Processets** & **Time (sec)** \\ \hline EN3 & 1152 & 569 & 583 & 1152 & 100\% & 4.1 & - & 1152 & 1151 & 99.9\% & 4.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The effect of DXN on EN3 behaviour.