# Handover Management for D2D Communication in 5G Networks
## 4 Proposed Approach
### Choosing Handover Target
We use our utility function to guide both users to re-connect to a new serving eNB. From Line 7 to Line 15, we have the historical position records of both users. The turning angle with respect to the initial moving direction for each user can be calculated accordingly. Subsequently, from Line 16 to Line 21, the turning angles of both users can be obtained. We then examine whether any user's turning angle is larger than the predefined threshold. If such a condition happens, we reset the set of handover candidates to empty and start a new assessment of the handover candidates. In addition, we would observe the proximity of each user with respect to each eNB to update the corresponding \(D_{counter}\) values and have appropriate new eNBs added to the list, as seen from line 23 to line 33. Consequently, from Line 36 to Line 38, we first choose the eNB with the largest \(D_{counter}\) value to be the handover target. While there may be multiple eNBs satisfying this condition, we further choose the eNB with the largest utility to be the handover target. Moreover, after choosing the handover target, it is necessary to make the decision about whether or not to hand over to the target. This handover decision process, referring to Line 35 to Line 39, will be discussed in the next section. Also, after the D2D pair successfully hand over to the target, some related parameters should be refreshed, which can be seen from Line 40 to Line 45. ```
Input:\(\varphi\) and \(\rho\) Output: Target eBN for \(i\)-th pair of D2D users
1:Initialization: \(\Gamma_{i}=\varnothing\); \(\overset{\text{PUU}}{\
u_{k}^{\text{PUU}}}=\overset{\text{\tiny{$\rightarrow$} }}{\vartheta}\) \(D_{counter}^{m_{i}}(t-1)=0,\ \forall m\in\{1,2,\cdots,m\}\) \(P_{k}(t-1)=P_{k}(t),\ \forall k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)
2:whiletrue do
3: Get \(P_{k}(t)\) and \(RSRP_{k}^{\text{report}}\), \(\forall k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)
4:if\(DUE_{i}^{1}\) and \(DUE_{i}^{2}\) not connected to any eNB then
5: Connect it to the serving eNB (SeBN) by (8)
6:end

Figure 2: An example of a user’s moving process. ```
7:for each \(k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)do
8:\(\overset{mw}{V_{k}}=P_{k}(t-1)P_{k}(t)\)
9:if\(V_{k}^{old}=\overset{\rightarrow}{0}\)then
10:\(V_{k}^{old}=V_{k}^{new}\)
11:end
12:if\(V_{k}^{old}\
eq\overset{\rightarrow}{0}\) and \(\overset{\rightarrow}{V_{k}^{new}}\
eq\overset{\rightarrow}{0}\)then
13: Calculate the tuning angle \(\theta_{k}\) by (7)
14:end
15:end
16:if\(\theta_{DUE_{i}^{1}}>\rho\) or \(\theta_{DUE_{i}^{2}}>\rho\)then
17: Set \(\Gamma_{i}\) to \(\varnothing\)
18:for each \(k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)do
19:\(V_{k}^{old}=V_{k}^{new}\)
20:end
21:end
22:\(C_{i}(t)=\varnothing\)
23:for each \(m\in N\)do
24:if\(RSRP_{DUE_{i}^{1}}^{m}\
eq 0\) and \(RSRP_{DUE_{i}^{2}}^{m}\
eq 0\)then
25:for each \(k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)do
26: Calculate \(d_{k}^{m}(t-1)\) and \(d_{k}^{m}(t)\) using \(P_{k}(t-1)\) and \(P_{k}(t)\)
27:if\(d_{k}^{m}(t-1)\geq d_{k}^{m}(t)\)then
28:\(C_{i}(t)=C_{i}(t)\cup m\)
29:\(D_{counter}m^{\prime}(t)=D_{counter}m^{\prime}(t-1)+1\)
30:end
31:end
32:end
33:end
34:\(\Gamma_{i}=\Gamma_{i}\cup C_{i}(t)\)
35:if\(RSRP_{DUE_{i}^{1}}^{S\text{eNB}}<\varphi\) or \(RSRP_{DUE_{i}^{2}}^{S\text{eNB}}<\varphi\) then
36:for\(j\in\left\{\Gamma\backslash\text{eNB}\right\}\) with the largest \(D_{counter}\)do
37: Set \(j\) with the largest utility value to be the target eNB (TeNB) by (8)
38:end
39: Handover decision made by **Algorithm 2**
40:if the handover is successful then
41: Set \(\Gamma_{i}\) to \(\varnothing\)
42:for each \(k\in\left[DUE_{i}^{1},DUE_{i}^{2}\right]\)do
43:\(V_{k}^{old}=V_{k}^{new}\)
44:end
45:end
46:end
47:\(t=t+1\)
48:end
```
**Algorithm 2**

### Handover Decision

After we select the potential handover target eNB for each D2D pair by jointly considering each user's movement and the received signal conditions of both users of the same D2D pair, we then need to decide whether or not to handover the D2D pair to the chosen target.