# Narrowband-Internet of Things Device-to-Device Simulation: An Open-Sourced Framework
## 3 NB-IoT D2D Framework, Model, and Simulation
### NB-IoT D2D Architecture
\begin{table}
\begin{tabular}{l l} \hline \hline
**Simulation Parameters** & **Value** \\ \hline maximum number of rounds & 999 \\ threshold value: T(n) & design parameter \\ probability of a node becoming a CH: p & random \\ packet generation frequency, i.e., one packet per two hours [per day]: S & 0.5 \(\times\) 24 \\ probability of uplink request: \(p_{u}\) & 0.8 \\ network protocol & Low Energy Adaptive \\ MAC protocol & Clustering Hierarchy \\ uplink and downlink frame length moments: \(l_{a}\), \(m_{a}\) & OFDMA and SC-FDMA \\ transmission power spectral density: TxSpctrlDnsty & 500 bits, 5 kbit \\ penetration loss: TidB & design parameter \\ average length of RA signaling: \(\tau\) & 0.01 s \\ average length of control signaling: u & 0.002 s \\ tones & \(Tones\in[12,6,3,2,1]\) \\ bandwidth: B & 180 kHz \\ arrival frequency of control data initiated by BS: \(\lambda_{bs}\) & 1/CF \\ noise figure: Nsfigr & 2.5 \\ noise power spectral density: NsSpctrldnsy & design parameter \\ devices’ fraction belongs to coverage classes \(c_{1}\) and \(c_{2}\): \(f_{1}\), \(f_{2}\) & 0.5, 5 \\ path loss between CHs and BSs: \(PL_{CH-BS}\) & design parameter dB \\ path loss between NB-IoT D2D nodes: \(PL_{D2D}\) & design parameter dB \\ Signal to Interference plus Noise Ratio: SINR & design parameter \\ distance from CH to BS: \(d\_{eNB}\) & 1, 2 \\ repetition order: \(c_{1}\), \(c_{2}\) & 21.10 dB \\ antenna gain of transmitter: \(G_{TX}\) & 19.18 dB \\ antenna gain of receiver: \(G_{RX}\) & 5, 5 kbit/s \\ uplink data rate: \(R_{1}\), \(R_{2}\) & 15, 15 kbit/s \\ downlink data rate: \(\Re_{1}\), \(\Re_{2}\) & Bi-direction \\ synchronization delay: \(D_{sy1}\), \(D_{sy2}\) & 0.33, 0.66 s \\ maximum coupling loss: MCL & 144, 155, 164 dB \\ frame fraction used by reference signals: \(b\) & 0.2 \\ thermal noise spectral density: \(N_{0}\) & \(-\)174 dBm/Hz \\ greatest waiting time to obtain RAR: \(T_{th}\) & 2 s \\ number of RA resources: \(M1\),\(M2\) & 16, 16 preambles \\ period of time between two NPRACH schedules: \(t\) & design parameter \\ period of time between two NPDCCH schedules: \(td\) & frequency-division duplex mode \\ expected energy consumption in uplink class \(j\) communication: \(\xi_{uj}\) & \\ expected energy consumption in downlink class \(j\) communication: \(\xi_{dj}\) & \\ expected battery lifetime: \(L_{j}\) & \\ energy consumption in listening: \(E_{sy}\) & \\ energy consumption in RAR message: \(E_{rar}\), \(E_{rr}\) & 1000 Joules \\ initial energy for a node: \(Eo\) & 0.50 \\ interference: \(I\) & 0.2, 0.01, 0.1 Watts \\ power spending in sending, idle, and listening: \(P_{l}\), \(P_{l}\), \(P_{l}\) & design parameter km \\ distance from each node in the cluster to the closest cluster head CH per round r: \(d_{CH-N}\) & 0.01 Watts \\ power spending in electronic circuits: \(Pc\) & 14 dBm \\ transmission power: \(PTX_{j}\) & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of MATLAB-based NB-IoT D2D simulation framework. Figure 1: Graphical User Interface (GUI) of the NB-IoT open-sourced simulator. Figure 2: NB-IoT attocell networking topology and field distribution.