# An Improved Routing Approach for Enhancing QoS Performance for D2D Communication in B5G Networks
## 3 System Model
### Mobility of Relay Devices Evaluation  
Mobile device movement is unpredictable in a wireless network, which frequently changes the topology of the network, adversely affecting the route and network stability. Therefore, device mobility is considered in the MBCLR approach during the route computational procedure in order to improve network performance. Device mobility pattern is predicated by exploiting the well-known random waypoint model (RWP), which is widely used in wireless networks owing to its effectiveness and better QoS performance [38]. The RWP model predicts device mobility behavior using various metrics, such as velocity, moving time, pause time, and distance between devices. The RWP model consistently predicts device mobility and, meanwhile, selects a uniformly and randomly destination point (\"waypoint\") according to the aforementioned metrics. Once the devices reach their selected waypoint, they stop for a specific time duration (pause time), and the procedure is repeated for all network devices. The RWP configures the device maximum and minimum velocities (\(v_{\max}\) and \(v_{\min}\)) along with the pause and moving time duration of the device. The device mobility distribution \(f_{(a,b)}(v)\) in the network can be computed as follows:  
\[f_{(a,b)}(v)=p_{mov}.\frac{1}{v\;ln(v_{\max}/v_{\min})}+p_{pause}.\delta(v) \tag{4}\]Here, \(v\) refers to the velocity function range that varies \(v\in[v_{\text{max}}-v_{\text{min}}]\); \(p_{pause}\) and \(p_{mov}=(1-p_{pause})\) refer to the device's probabilities during the pause and the moving stage, respectively; and \(\delta(v)\) refers to the Dirac delta function, which depends upon the device's velocity, and it ranges between 0 and 1. When the device velocity is maximal, \(\delta(v)\) is updated to 0, and while the device velocity is minimal, \(\delta(v)\) becomes 1. The device pause time is considered to be \(t_{p}\geq 0\), and the pause time \(p_{pause}\) probability value is computed as follows:  
\[p_{pause}=\frac{t_{p}}{t_{p}+E[D]\frac{\ln(v_{\text{max}}/v_{\text{min}})}{(v_{ \text{max}}-v_{\text{min}})}} \tag{5}\]  
Here, \(E[D]\) refers to the expected distance covered by the device movement in the whole network. When a device initiates from a pause state \(p_{pause}\), the pause time of the device is set to be \(t_{p}\), while the device velocity is set to be in a range of \(v\in[v_{\text{max}}-v_{\text{min}}]\) when the device starts from the moving state \(p_{mov}\). In other words, \(p_{pause}\) is the device probability in the pause state, whereas \(t_{p}\) indicates the time taken by the device in a pause state. Therefore, the device mobility in the network is computed as follows:  
\[\text{Mobility}=\min_{v\in[v_{\text{max}}-v_{\text{min}}]}\sum_{(a,b)\in N}f_ {(a,b)}(v) \tag{6}\]  
Established route stability is depending upon the relay devices between the source and the destination devices. Moreover, a route goes unstable when the constituent relay device mobility is high. Therefore, the MBLCR approach selects relay devices with less mobility in the optimal route in order to maintain the route and network stability for D2D communication over IoT-based 5G networks.