A Joint Resource Allocation Algorithm for D2D Communication

The emergence of multimedia services has meant a substantial increase in the number of devices in mobile networks and driving the demand for higher data transmission rates. The result is that, cellular networks must technically evolve to support such higher rates, to be equipped with greater capacity, and to increase the spectral and energy efficiency. Compared with 4G technology, the 5G networks are being designed to transmit up to 100 times more data volume with devices whose battery life is 10 times longer. Therefore, this new generation of networks has adopted a heterogeneous and ultra-dense architecture, where different technological advances are combined such as device-to-device (D2D) communication, which is one of the key elements of 5G networks. It has immediate applications such as the distribution of traffic load (data offloading), communications for emergency services, and the extension of cellular coverage, etc. In this communication model, two devices can communicate directly if they are close to each other without using a base station or a remote access point. Thus, eliminating the interference between theD2Dand cellular communication in the network. The interference management has become a hot issue in current research. In order to address this problem, this paper proposes a joint resource allocation algorithm based on the idea of mode selection and resource assignment. Simulation results show that the proposed algorithmeffectively improves the system performance and reduces the interference as compared with existing algorithms.


Introduction
In recent years, wireless local area networks (WLANs) have become quite popular due to their low cost of deployment and easy implementation, which enables the rapid proliferation of personal networks. But some unfavorable points should not be overlooked such as the operation in frequency bands where there is no interference control or guaranteed safety control [1][2][3]. These aspects motivate the inclusion of a new communication channel in mobile networks: Device-to-Device communication (D2D), which is currently under investigation to be included in the LTE-Advanced standard. The creation of IMT-Advanced promotes the application of new technologies that satisfy their requirements, from which the LTE-Advanced arises and begins to be standardized at the end of 2009 [4][5][6][7][8][9]. The LTE corresponds to the name of the commercial standard developed by the 3rd Generation Partnership Project (3GPP) for the evolution of UMTS mobile terrestrial radio access networks (e-UTRAN) standardized as of Release 8. D2D communication enables the establishment of a peer-to-peer communication mode between two LTE-A terminals, in such a way that there would be a better use of the LTE network resources and a higher throughput would be provided to the terminals in D2D communication [10].
In order to improve the performance of cellular networks and meet the user's demand for speed, related technologies to improve the utilization of spectrum resources have become the research hotspots, such as cognitive radio and D2D communication technologies [11][12][13][14]. In traditional cellular networks, data is transmitted through base stations or other network elements. By using the D2D communication technology, when user terminals are relatively close, data can be directly transmitted. It cannot only increase the system throughput but also reduces the equipment power consumption and improves the system's spectrum utilization [15,16]. It also brings new challenges to wireless resource management, especially when D2D users reuses the cellular user resources, there is relatively serious co-channel interference. In order to reduce the co-channel interference, some interference management schemes have been proposed one after another [17][18][19][20]. Reference [21] proposes a power control scheme to ensure the SINR of the cellular link. Reference [22] proposes an optimal power allocation scheme in single-cell user and single D2D pair scenarios. Reference [23] proposes a game-based joint scheduling and resource allocation algorithm. Reference [24] proposes a resource allocation scheme based on interference perception. However, the above studies assumed that, the D2D pair reuses one cellular user resource. In fact, in downlink transmission, when the D2D pair is far from the eNB, the D2D pair can reuse one or more cellular user resources, thereby further improving the system throughput. When the D2D pair is close to the eNB, it suffers from greater interference and can use dedicated resources for communication.
This paper proposes a joint mode selection and resources allocation scheme based on the location of D2D users in the cell. In this method, the eNB first classifies the D2D pair according to the distance from the eNB. When the D2D pair is closer to the eNB, it is considered as a nearend D2D pair, and the eNB preferentially allocates the dedicated resources. When the D2D pair is far from the eNB, it is a remote D2D pair, and the eNB preferentially allocates the multiplexing resources. As the cycle progresses, the eNB will dynamically adjust the resource allocation for the D2D pair according to the resources and the terminal link rate, so that the D2D pair can be allocated appropriate resources. The simulation results show that the proposed scheme effectively reduces the interference between the users and improves the system throughput.

System Model
Assuming that the eNB in the macro cell is in the center of the cell, the cell contains two types of users, namely D2D and cellular users. D2D users exist in pairs, where each pair includes a transmitting and a receiving terminal. The D2D and cellular users are randomly distributed in the cell. The distance between the D2D transmitting and receiving terminals in the same D2D pair meets the maximum distance constraint, thereby ensuring the quality-of-service (QoS). Fig. 1 shows the scenario of downlink transmission. Assuming that, there is C number of cellular user equipment (CUE), K number of D2D pairs in the macro cell, and the position of the D2D pairs in the cell does not change.  According to the distance between the eNB and receiving terminal of the D2D pair, the eNB divides the user pair into two types, namely the near-end D2D pair close to the eNB and the far-end D2D pair far away from the eNB. Assuming that, there are N orthogonal sub-channels (N > C) in the cell with bandwidth B, and n fixed sub-channels are allocated to the cellular users. Define a set of binary variables x k,n to represent the use of sub-channels for D2D users. When x k,n = 1, the D2D user uses the sub-channel n for k. When x k,n = 0, the D2D user does not uses the sub-channel n for k. The D2D pair in the scheme has two communication modes, namely multiplexing mode and dedicated mode. In the multiplexing mode, the D2D user communicates on multiplexing cellular sub-channels. In dedicated mode, the D2D pair uses a dedicated sub-channel for communication N n=C+1 ≤ 1, ∀k ∈ {1, 2, . . . , K} , at the same time, each dedicated sub-channel can only be allocated to one D2D pair K k=1 ≤ 1, ∀n ∈ {C + 1, C + 2, . . . , N} . Assume that, the eNB and D2D working in multiplexing mode have fixed power for each cellular sub-channel transmission, which is P B and P D respectively. Since the D2D pair working in the dedicated mode will not cause interference to other users, therefore, it uses the maximum power P max D for transmission. The SINR of a D2D pair working in the dedicated mode is expressed as: Among them, G D k represents the channel gain between the D2D pair k, N 0 represents the thermal noise power of the receiving terminal.
The SINR of a D2D pair working in the multiplexing mode is expressed as where, G B k represents the channel gain between the receiving terminal of D2D pair k and the eNB; G D j,k represents the channel gain between the transmitting D2D pair j and the receiving D2D pair k; I D k,n = x k,n P B G B k + j∈{j|x j,n =1∩j =k} P D G D j,k is the interference when using sub-channel n for k. The interference is divided into two parts: one part is generated by eNB, and the other part is generated by D2D pair using the same sub-channel n.
The rate when the D2D user uses the sub-channel n for k is The link transmission rate of D2D users to k is expressed as The SINR of CUE can be expressed as Among them, G C n represents the channel gain between the CUE n and eNB, G C k,n represents the channel gain between the transmitting terminal of D2D pair k and CUE n, and I C n represents the interference received by CUE n.
The link rate of CUE n is expressed as: The total throughput of the system is expressed as: In the downlink, the interference in the multiplexing mode mainly comes from the eNB and the D2D pair using the same sub-channel. Since the transmit power of the eNB is much greater than the transmit power of the D2D terminal, when the D2D pair and eNB are closer, then the interference is greater. At the same time, when the D2D pairs using the same sub-channel are closer, the interference between them is also greater. Therefore, the user pairs are classified according to the distance between the D2D pair and the eNB. When d k ≤ d th (where d th is the judgment threshold, d k is the distance from the D2D pair k to the eNB), the D2D pair k is the near-end D2D and the eNB preferentially allocates the dedicated resources. When d k > d th , the D2D pair k is the remote D2D pair, and the eNB preferentially allocates the cellular user resources to it.
In practice, the value of d k can be obtained from the pilot signal receiving power sent by the eNB, such as the reference signal receiving power (RSRP). Therefore, d th can correspond to a power threshold P th . Suppose that, the D2D pair k receives the reference signal received power from the eNB as P k . When P k ≥ P th , the D2D pair k is the near-end D2D pair. Otherwise, it is considered as the far-end D2D pair.

Proposed Algorithm
This paper proposes a joint mode selection and resources allocation scheme based on the position of the D2D pair in the cell. The algorithm is divided into 3 stages, namely, the initial stage, dedicated resource allocation stage, and the multiplexed resource allocation stage. After the initial phase is completed, the dedicated resource allocation phase and the multiplexed resource allocation phase will be cycled. Through continuous cycles, the eNB will allocate appropriate resources to the D2D pair.

Initialization
When the communication link of the D2D pair is established, the reference signal from the eNB is first received and compared with the threshold P th , and the result is fed back to the eNB. The eNB classifies the D2D pair according to the feedback information.
If the D2D pair k reference signal received power P k satisfies P k ≥ P th , then the D2D pair k belongs to the near-end D2D pair set S 1 , otherwise, it belongs to the far-end D2D pair set S 0 , namely During initialization, the near-end D2D pair works in a dedicated mode and uses the dedicated resources. The far-end D2D pair works in a multiplexing mode and reuses the cellular user resources. As the cycle progresses, the eNB dynamically allocate the resources to the D2D pair according to the resources and link rate.

Allocation of Dedicated Resources
In the dedicated resource allocation phase, the scheduler allocates the dedicated sub-channels in proper order. In the first dedicated resource allocation stage, the number of cycles t = 1. At the beginning of scheduling, the first confirm dedicated D2D pair set S 1 participates in the scheduling, that is, the D2D pair scheduled in this stage is composed of the near-end D2D pair S 1 and the D2D pair whose terminal rate is less than the threshold in the multiplexing resource allocation stage. In each scheduling cycle, the scheduler will dedicate a sub-channel to the D2D pair with the highest priority (the priority of the D2D pair is calculated according to Eq. (9)). In this way, the dedicated sub-channels in the cell will be allocated to the D2D pair based on the priority. When the D2D pair k is allocated to the dedicated sub-channel n, the scheduler will delete such pair and dedicate the sub-channel n from set S 1 and dedicate the sub-channel set U D sub , respectively. When all dedicated sub-channels in the cell are allocated or all D2D pairs are scheduled, the dedicated resource allocation will be terminated. If the dedicated resource allocation is terminated, the set S 1 = Ø and the scheduler will add the D2D pair to the multiplexed set S 2 , so that it can communicate through multiplexing cellular user resources. In this way, the system efficiency has been improved.
The priority function Q k (t) of the D2D pair is mainly composed of the estimated link rate η D k (t) and the additional cost C k (t) of the D2D pair in the t-th cycle, which is expressed as follows: Among them, the additional cost is expressed as C k (t) = δ t−1 t=t−1−m η D k (t), which consists of the sum of the fairness coefficient δ (δ ≥ 0) and the link rate obtained by D2D pair k in the first m cycles, where η D k (t) = 0, t ∈ {−m, . . . , 0}. When δ is large, the sum of link rates obtained by D2D in the previous m cycles of D2D has a greater impact on the current priority calculation. Since there is no historical rate record of the D2D pair in the scheduler at the beginning of the cycle, the priority of the D2D pair is judged according to the estimated transmission rate in the first cycle, that is, C k (1) = 0.

Allocation of Reused Resources
Reusing the D2D pairs in the set S 2 will communicate through multiplexing the cellular subchannels, but it does not guarantee that the throughput of the entire system will increase. It is because, when the D2D pairs multiplexing the cellular sub-channels, it gets a certain rate gain, but suffers from certain interference, which affects the link rate, and vice versa. While considering the cellular rate and D2D's constraints on the maximum transmit power, better system throughput can be achieved through a reasonable allocation of resources. In the multiplexing resource allocation stage, the scheduling is performed in the form of tokens. In the first multiplexing resource allocation, the D2D pairs in the set S 2 do not reuse any cellular sub-channels. The resource allocation is summarized in the following steps.
Step 1: Confirm the multiplexed D2D pair set S 2 participating in the scheduling, that is, the pair scheduled in this stage is composed of the remote D2D pair and the pair that is not allocated to the dedicated sub-channel in the dedicated resource allocation stage.
Step 2: When the token is passed to the D2D pair k, it will check whether the cellular sub-channels are multiplexed by themselves one by one. If it is multiplexed, go to step 3; otherwise, go to step 4. If the D2D pair k has detected all the cellular sub-channels U C sub = {U sub1 , U sub2 , . . . , U subC }, then the scheduler will delete the D2D pair k from set S 2 . If S 2 is not an empty set after deletion, the token will be passed to the next D2D pair. If S 2 is deleted, the loop will end, and the D2D pair whose link rate is lower than the threshold R D th will be added to the set S 1 .
Step 3: Suppose that, when the D2D pair k multiplexes the cellular sub-channel U subn , the rates of D2D pair k and D2D pair j j ∈ j | x j,n = 1 ∩ j = k using the same sub-channel are η D k,n and η D j,n respectively. The link rate of CUE n is η C n . If the D2D pair k does not use the subchannel n, the rate of D2D pair j will becomeη D j,n which is expressed in Eq. (10) as follows Wherein,γ D j,n represents the SINR of jth user when kth user do not uses the sub-channel n; I D j,n (see Eq. (2)) represents the interference of the D2D user to j when its user uses the sub-channel n for k.
When the D2D users multiplexes the cellular sub-channel n to j, the rate change value is In the same way, the link rate of the CUE n will becomẽ whereγ C n represents the SINR of CUE n after D2D users releases the sub-channel n to k; I C n (see Eq. (5)) represents the interference to CUE n when the D2D user uses the sub-channel n for k. The link rate change value of CUE n is expressed as If η D k,n , Δη D j,n , Δη C n , R C th (cellular link rate threshold) meets the following η D k,n < j∈{j|x j,n =1∩j =k} then the D2D pair k will stop using the sub-channel n, otherwise, it will continue to use the sub-channel n. Go back to step 2.
Step 4: Assume that, the D2D user do not reuse the sub-channels of CUE n for k. First, determine whether the transmit power of D2D to k is less than the maximum transmit power P max D . If the total transmit power of D2D to k is equal to the maximum transmit power P max D , return to step 2, otherwise perform the following steps.
Assume that, the rate of the D2D pair j ∈ j | x j,n = 1 of multiple CUE n sub-channels is η D j,n , the link rate of CUE n is η C n . If the D2D users uses the sub-channel n for k, the rate of D2D for j will beη D j,n which is as follows where,γ D j,n represents the SINR of the D2D user to j after using the sub-channel n for k; I D j,n represents the interference of the D2D users to j when kth user do not use the sub-channel n.
When the D2D pair multiplexes the cellular sub-channel n to j, the rate change value is In the same way, the link rate of the CUE n will becomẽ Among them,γ C n represents the SINR of CUE n after D2D multiplexes k to CUE n; I C n represents the interference to the CUE n when the D2D uses the subchannel n for k. The rate change value of the CUE n is If η D k,n , Δη D j,n , Δη C n , R C th (cellular link rate threshold) meets the following then the D2D pair will uses the sub-channel n for k, otherwise it will not be allocated the subchannel. Go back to step 2.

Simulation Results
A link-level simulation program is established to test the scheme, and the simulation results are compared with the D2D scheme of multiplexing a cellular sub-channel and the pure cellular scheme.

Simulation Configuration and Parameters
Consider a single-cell scenario, where the cellular users and D2D pairs are randomly distributed in the cell. The distance between the terminals in a D2D pair meets the maximum distance constraint for communication. The received power P i = P j L ij h ij 2 , where P i and P j represents the received and transmit power, respectively. L ij represents the path loss between the transmitting and the receiving terminal. h ij represents the complex Gaussian channel coefficient, and h ij ∼ CN(0, 1). For the cellular link, the path loss is calculated according to the COST-231 Hata model, and for the D2D link, the path loss is calculated according to the modified model of short-distance communication [25]. The specific parameters are shown in Tab. 1.

Simulation Results
The system throughput simulation results of different schemes are shown in Fig. 2. When the channel quality of the direct link is good, the system throughput of the proposed algorithm and D2D pair multiplexing a cellular sub-channel scheme is greater than that of the pure cellular scheme. Although the D2D communication brings an increase in the total system throughput by reusing the cellular resources, the gain in the total system throughput decreases as the distance between the D2D pair and the terminal increases. When the maximum distance between the D2D pair is 50 m, the proposed scheme increases the performance by 41% as compared to the D2D pair multiplexing one cellular sub-channel scheme.   3 shows the simulation results of the average user rate of different scenarios. It can be seen from Fig. 3 that, the average user rate proposed scheme is higher than the single-cellular subchannel and the traditional cellular schemes. As the number of D2D pairs increases, the average user rate has also been improved in the proposed scheme whereas the single-cellular sub-channel and traditional schemes shows fixed average user rate.
The simulation results prove that the proposed scheme effectively reduces the interference between users and improves the system throughput.

Conclusions
This paper analyzes the interference between the cellular users and D2D users and proposes a joint resource allocation scheme. In the solution, the eNB optimizes the communication mode and resource allocation of the D2D users according to their location in the cell and the terminal interference. The simulation results show that, compared with the traditional cellular scheme and the D2D-pair multiplexing single-cellular sub-channel scheme, the proposed scheme can better improve the total system throughput and terminal link rate, and reduces the interference between the users. Further research as an extension to this work is to consider the QoS and energy efficiency aspects and evaluate the performance.

Availability of Data and Material:
The data used for the findings of this study is available upon request.

Conflicts of Interest:
The authors declare that they have no conflicts of interest to report regarding the present study.