# Narrowband-Internet of Things Device-to-Device Simulation: An Open-Sourced Framework
## 4 Simulation Output and Discussions
The queuing matrix \((mtrxCH(:,n))\) can explain the queue at each CH in the proposed NB-IoT D2D simulator but CH No. 170 and CH No. 171 have been chosen randomly as an example (Figure 27A,B). As a result, the values of parameters such as energy consumption and delay time are reduced because the path loss between users' equipment is generally applied in class 1. As demonstrated in Figures 26 and 28, the queues at the BSs are longer when the LEACH routing algorithm in the network layer of NB-IoT is not used because all the devices in the traditional NB-IoT attocell network topology submit uplink/downlink requests at the same time. This causes the energy dissipation in the traditional NB-IoT attocell communications to amplify, and the delay time rises (Figure 29 vs. Figure 30), degrading the battery lifetime. It can be observed that path loss increases proportionally to the distance. Consequently, many nodes in the NB-IoT attocell network topology need to connect using class 2, which also increases the energy consumed. In the LEACH protocol scenario, however, each NCH selects the nearest CH to join to its cluster, and thus most communications are through class 1 (Figure 27). Figures 31 and 32 depict the energy dissipation profile of an advanced node and normal node, respectively in the proposed NB-IoT D2D framework, which can be used to determine the SOC and SOH of a device's battery so they can be included in systems of battery management. This will significantly contribute to reducing overhead costs. Figure 33 depicts the number of transmitted packets in NB-IoT D2D attocell network per round \(r\). Figure 34 explains the NB-IoT attocell network throughput (successful received packets rate) using the LEACH algorithm. In other words, the data rate that delivery successfully in the context of LEACH protocol is efficient. Figures 35 and 36 compare  
the number of live nodes per round \(r\) in the NB-IoT attocell network using the LEACH algorithm and without using LEACH, respectively. In the presence of the LEACH algorithm (Figure 35), all sensor nodes are live until more than 300 rounds. While without using the LEACH protocol, as shown Figure 36, sensor devices start to die at the round number 18 and at the round number 51, there is no live sensor device in a traditional NB-IoT attocell network. However, all the above measurements are analyzed to present a comprehensive evaluation of the proposed open-sourced simulator. Finally, Figure 37 illustrates NB-IoT attocell network topology when all devices die: In other words, when all nodes have consumed the batteries' powers entirely. Figure 25: Queue at BSs No. 18 and No. 19 in the proposed NB-IoT D2D framework. Figure 26: Queue at BSs No. 18 and No. 19 in a traditional NB-IoT. Figure 27: Queue CH No. 170 and No. 171 using LEACH protocol. Figure 21.0 NB-IoT network without a LEACH scheme showing all nodes sending data at the same time (300 users). Figure 21.1 Power profile of a normal node (power consumption for user’s device No. 50). Figure 21.2 Power profile of advanced node (power consumption for user’s device No. 23). Figure 21.3 Delay time at BS No. 24 in proposed NB-IoT D2D framework. Figure 21.4 Delay time at BS No. 24 in conventional NB-IoT. Figure 21.5 Number of packets per round \(r\) in NB-IoT D2D atocell network. Figure 21.6 NB-IoT D2D attocell network throughput. Figure 21.7 Number of live nodes per round \(r\) using the LEACH algorithm in NB-IoT D2D attocell network.