## 3 Basic System Operation
### SBD Routing
Hence, in order to accurately find the closest _SH_, the round trip time (RTT) method has been used as well. According to this method, each Member Node (MN) sends a packet request to all candidate SHs in the list and waits for an immediate acknowledgment. After receiving the acknowledgment the MN calculates the distance of the corresponding SH from time of flight (TOF). It then calculates a ranking number for each candidate SH based on both RSSI and TOF and selects a SH from the candidate list that has highest ranking (see Algorithm 3). According to this method, the time of flight, referred to as _Tror_ is calculated as follows  
\[T_{ror}=\frac{T_{err}-T_{err}}{2} \tag{17}\]  
Here, _TRTT_ = Round Trip Time of Flight. _TTCP_ = Time to Compute Packet. The distance between two nodes can be calculated as  
\[d_{RTT}=T_{TOF}\times c \tag{18}\]  
Here, \(c\) = Speed of Light  
The Equation (18) can further be rewritten after adding the faultiness as [13]:  
\[d_{RTT}=d+\varepsilon_{RTT}^{LOS}+\varepsilon_{RTT}^{NLOS} \tag{19}\]  
Here, \(\varepsilon_{RTT}^{LOS}=\) Error occurs for ranging in a line of sight setting. \(\varepsilon_{RTT}^{NLOS}=\) Error due to ranging in a non-line of sight environment. The negative impacts of multipath effects, a big factor, in \(\varepsilon_{RTT}^{LOS}\) can be minimized using an empirical approach [14]. Uncertainties and noise in the hardware especially jitter effects play a key role in \(\varepsilon_{RTT}^{NLOS}\). Considering the jitter component _TTOF_ can be calculated as [15]  
\[T_{ror}=\frac{T_{RTT}-T_{TCP}-(J_{all}+J_{all}+T_{TCP}+J_{c2}+J_{c2})}{2} \tag{20}\]  
\[T_{err}=J_{{}_{\alpha}}+J_{{}_{\alpha}}+TOF_{\pi}+TOF_{\pi}+J_{{}_{\alpha}}+ J_{{}_{\alpha}}+T_{{}_{\alpha}} \tag{21}\]  
In Equations (20) and (21), _TOFR_ = TOF for the request packet. _TOFA_ = TOF for the acknowledgment packet. _JtN_ = jitter caused by the clock of transceiver. _JtN_ = jitter caused by the clock of microcontroller. The timestamps that are used to calculate the time between sending a request packet and receiving an acknowledge packet contain the jitter values _Jt0_, _Jc0_, _Jt3_ and _Jc3_. Another two timestamps that are considered in calculating the computation time between receiving a packet and sending the first bit of the ACK packet contain the jitter values _Jt1_, _Jc1_, _Jt2_ and _Jc2_. The _MNs_ then calculate the rank matrix for each candidate _SH_ as  
\[rank_{i}=\left( \begin{matrix}RSSI&\Big{/}\max\limits_{n_{i}}\big{(}RSSI_{i} \big{)}\end{matrix} \right)+d\Bigg{/}\Bigg{/}\Bigg{/}\Bigg{/}\Bigg{.}\Bigg{.} \Bigg{.}\Bigg{.}\Bigg{.}\Bigg{.}\Bigg{.}\Bigg{.}\Bigg{.} \tag{22}\]  
In Equation (22), _MN_ is the total number of member nodes in _N_th sector. The _MN_s, then send an association request to the _SH_, which has the highest rank in its list. This ensures the association of a member node to its closest head node (see Algorithm 3). The SHs create a child table listing all the member nodes from which they receive association request. In the third stage of the learning phase, SHs broadcast a packet containing \(\,C_{k}\) (\(0\leq k\leq\)3), \(\Delta t\) and an array \(\gamma\), where \(\gamma=\{m_{1},\,m_{2},\,m_{3},\,\ldots,\,m_{i}\}\) and \(|\gamma|=M_{k}\). In \(\gamma\), \(m_{i}\) and \(i\) denote the member node ID and index of this member node in the array, respectively. Each member node then calculates the intra-sector transmission slot based on their position in the array \(\gamma\) by:  
\[t_{i}=\{(i\times\ell)+(C_{i-1}\times\Delta t)\mid\gamma[i]\gets M_{s-0}, \gamma[i]\gets\gamma[j]\} \tag{23}\]  
In Equation (23), \(\ell\) and \(M_{S-ID}\) are the length of the intra-sector TDMA time slot and the node's self-network address, _i.e._, node's self-ID, respectively. The number of member nodes in a sector varies due to the dynamic nature of the Member-SH association procedure.