# Sensing and Device Neighborhood-Based Slot Assignment Approach for the Internet of Things
## 4 Proposed Neighborhood-Enabled TDMA Approach
### Device Mobility in the Operational IoT Network  
The proposed neighborhood-enabled TDMA approach supports the mobility of member device \(C_{i}\) from the coverage area of one server \(S_{j}\) to another server \(S_{j+1}\). If a particular member device \(C_{i}\) is interested in changing its position, then it must inform the respective server module \(S_{j}\) by sending a response message with a value of L to the query message of the respective server module \(S_{j}\). Once a server module \(S_{j}\) receives query response message with value L, then it is added to the reserved slot class, which are assigned to those devices \(C_{i}\) that have migrated from the coverage area of another server \(S_{j}\). Additionally, these slots may be assigned to another requesting device if it has initiated a request for multiple slots. During the movement, it is assumed that the member device is not allowed to send any message, as it is not currently a member of any cluster. Once this device \(C_{i}\) reaches its intended destination, then it responds to the query message of that server \(S_{j+1}\) with value \"\(\gamma\)\", which has the minimum possible distance from its current position and the maximum value of the RSSI as described in Equation (9)  
\[\forall_{i=0...n}\ C_{i}\in\sigma(S_{j})\ \ \textbf{iff}\frac{\sqrt{(C_{x_{i}}-S_{x_{j+1 }})^{2}+(C_{y_{i}}-S_{y_{j+1}})^{2}}}{(x_{i}\ +\ y_{j+1})}\ <=\ \delta \tag{9}\]  
Server \(S_{j+1}\) assigns a time slot to the requesting device \(C_{i}\) if it is available and increases its number of member devices \(C_{i}\). However, it is to be noted that dedicated time slots are not assigned to the mobile requesting device, as time slots are fixed and assigned via a preemptive policy. Furthermore, it high likely that the respective server module \(S_{j}\) has an empty time slot, which is possible only if one its own member device \(C_{i}\) is moved, wherein it is then assigned permanently. Additionally, this device \(C_{i}\) (preferably the one which is moved) can communicate via a secondary server module \(S_{j+2}\) if and only if a slot is available, and the optimized server module \(S_{j+1}\) does not have any empty time at a particular time interval. This is possible only if the respective device \(C_{i}\) responds to the query messages of both servers as depicted in Algorithms 1 and 2. ```
0: Revised TDMA where Neighbor related Information is Utilized
0: Allocation of Free Slots to Devices \(C_{i}\)
1:\(Member\ -\ Devices\ \leftarrow\ \textbf{Null}\)
2:\(NonMember\ -\ Devices\ \leftarrow\ \textbf{Null}\)
3:\(\triangle\ \leftarrow\ 30\ \text{ms}\)
4:\(j\) (Variable)\(\leftarrow\) Server Module \(S_{j}\)
5:\(i\) (Variable)\(\leftarrow\)\(C_{i}\)
6:for Server \(S_{j}\in\)\(IoMTs\)do
7: Create \"\(MSG_{a}\)\"
8: Set value \"\(-\)\(Request\ -\)\(Join\ :\ 0\)\"
9: Transmit \"\(MSG_{a}\)\"
10:endfor
11:for Device \(C_{i}\in IoMT\)do
12:if Value of (RSSI) of Current Server, i.e., (\(S_{j+1...m}<S_{j}\)) & (\(\triangle\):zero) then
13: Update Message \"\(MSG_{a}\)\"
14: Put value \"\(Request\ -\)\(Join\ :\ one\)\"
15: Update Destination Module \"\(S_{j}\)\"
16: Timer (Back-off) = random(0-10,000 ms)
17: Transmit \"\(MSG_{a}\)\"
18:endif
19:endfor
20:for Server \(S_{j}\in\)\(IoMT\)do
21:if (\(Request\ -\)\(Join\ :\ one\)) then
22: Place Device \(C_{i}\) in \(Member\ -\ Devices\)
23: Generate Free Slot for Device \(C_{i}\)
24:else
25: Place Device \(C_{i}\) in \(NonMember\ -\ Devices\)
26:endif
27:endfor
28:return Time Slots based on Neighborhood Information
```  
**Algorithm 1** Proposed Algorithm for mobile devices \(C_{i}\)  
A neighborhood-enabled TDMA algorithm for mobile devices \(C_{i}\) and servers (static) \(S_{j}\) was developed as presented below. In this approach, a device \(C_{i}\) is bounded to wait for a defined interval time, i.e., 30 ms in this case, to collect messages, and accept join requestsfrom numerous servers \(S_{j}\), which are deployed in the respective vicinity.