Resource allocation of offshore ships' communication system based on D2D technology

D2D communication technology has been more and more widely used as a mobile communication technology that can perform specific services in specific areas. This paper introduces D2D technology into the offshore ships' communication system and proposes a channel resource allocation scheme for interference control in the system, so as to increase the number of devices in the network. This paper first establishes the model of the offshore ships' communication system and then applies the Hungarian algorithm based on the maximization of the average position. Finally, the comparative simulation experiments of the algorithms are proposed, which could show that the Hungarian algorithm based on model application can effectively control interference, and reduce the impact after introducing D2D communication devices into the network.

co-frequency interference between D2D users and cellular users. If there is no corresponding coordination strategy, serious co-channel interference will greatly reduce the communication performance of the communication system. Therefore, the research on interference management of D2D communication have received more and more attention. These researches are currently focusing on mode selection (Chou & Chang, 2017), power control, and resource allocation (Hajiaghajani et al., 2016;Hoang et al., 2017;Zuo & Yang, 2018). The mode selection includes cellular mode, dedicated mode and multiplexing mode. Both the cellular mode and dedicated mode would allocate channels for D2D communication devices, so the utilization efficiency of spectrum resources is relatively low. Considering that the model studied in this paper aims to realize the reuse of spectrum resources under any number of nodes, this paper only analyses and discusses resource allocation algorithms in combination with power control based on the resource allocation mode.
Aiming at the problem of channel allocation (Zhao et al., 2018) after introducing D2D communication device pairs into the network, most of the current applications are based on fixed allocation or random allocation algorithms. These algorithms are relatively simple and require less computing ability, however, they do not take changes in the channel into account. It is difficult to have better performance in the actual complex environment (Yu & Qi, 2016). If the spectrum sensing strategy is adopted, although the algorithm is advanced, it has high requirements for base station and communication devices, which is difficult to apply in reality. Combining the actual environment of offshore ship communication, this paper analyses the environmental interference based on the available location information of ships and performs channel allocation so that there are more pairs of D2D communication devices that can communicate in the environment.
The rest of this paper is organized as follows. In Section 2, the mathematical model of the offshore ships' communication system would be described, and the problems in this paper will be analyzed and put forward. Spectrum resource allocation algorithm is provided in Section 3. The MATLAB simulation result is provided in Section 4. The paper ends with the conclusion in Section ?? and the acknowledgment in the last part.

Model analysis
The communication system model can be simply divided into three parts: base station, cellular users and D2D communication equipment pairs. The base station is employed to maintain communication with offshore ships, and at the same time perform resource scheduling and allocation (Zaki et al., 2017); cellular users are the ships which are communicating with a base station; D2D communication equipment pairs are ships directly communicating with each other, as shown in Figure 1. And in this figure, D2Dt represents the transmitting end of D2D communication equipment, and D2Dr represents the receiving end of D2D communication equipment.
Since this paper adopts the multiplexing mode, spectrum multiplexing may occur when there are many devices in the network. In other words, D2D communication device pairs can reuse the channel resources used by cellular network users. The resources include cellular uplink channel resources and cellular downlink channel resources. However, when D2D communication device pairs reuse uplink channel resources, the base station suffers the most interference (Wang et al., 2017). Compared with ships' communication devices, the base station has stronger computing and processing capabilities, thus it could alleviate the impact of interference. In addition, the transmit power of the base station is much greater than the transmit power of ships. If downlink channel resources are reused, ships will suffer severe interference from the base station. At the same time, the transmission instruction design of the control signal and the synchronization signal in the downlink channel is more complicated. Considering that in traditional cellular network, the uplink resource utilization is generally lower than the downlink resource utilization, this paper analyses based on multiplexing uplink channel resources.

Mathematical model establishment
For the model, this paper assumes that the base station can cover an area with a network radius of R in the offshore environment, and there are N cellular users, M D2D communication device pairs. Let C denotes the set of cellular users and here C = {C 1 , C 2 , C 3 , . . . , C i , . . . , C N }, where C i represents cellular user i. In the same way, this paper uses set D = {D 1 , D 2 , D 3 , . . . , D i , . . . , D N } to represent D2D communication device pairs, and D j means D2D communication device pair j. Assuming that the spectrum resources in the system are divided into A mutually orthogonal channel resources, each cellular user or D2D communication device pair occupies one channel resource. Taking the mode selection of this paper into account, the relationship is as follows: Without loss of generality, for N cellular users and M pairs D2D communication devices in the network, when the jth D2D communication device pair multiplexes the ith cellular user channel, the signal to interference plus noise ratio (SINR) of the cellular user at the base station is: Among them, P C,i represents the transmit power of cellular user i and P D,j represents the transmitting end's transmit power of the D2D communication device pair j; N 0 means the additive white Gaussian noise power. In addition, this paper uses G B i or G B j to respectively represent the channel gain between the base station and the cellular user i or the transmitting end in the D2D communication device pair j. x is defined as the channel resource reuse factor with a value of 0 or 1. Therefore, the occupancy of the channel can be expressed by x according to Equation (3).
D2D communication device pair j reuse the channel resource 0, There is no reuse (3) In the same way, the signal to interference plus noise ratio at the receiving end of the jth D2D communication device pair is shown as follows: In the above equation, g j,j and g i,j , respectively, represent the channel gain between the transmitting end and the receiving end of the D2D communication device pair j, and the multiplexed channel gain between the receiving end of the D2D communication device pair j and the cellular user i.

Problem description and analysis
As the number of D2D communication device pairs increases in the offshore environment, the communication interference will be stronger for the base station.
With the increase in the number of offshore ships, there would be more and more D2D communication equipment pairs (Sima et al., 2017). And at this time, the base station is more susceptible to interference. If a reasonable channel allocation strategy and power control are not adopted, it may cause D2D communication device pairs to reuse the link that is using by the cellular network users, which affects the communication quality and may cause communication failure (Liang & Lin, 2016). Therefore, this paper expects to find a channel allocation strategy to allocate communication channels for cellular network users and D2D communication device pairs in the offshore environment. And under this strategy, with the increase of ships' number in the environment, the number of D2D communication devices that can communicate normally in the network has a better performance.
After the above analysis, the optimization problem can be established based on the goal of maximizing the number of D2D communication device ships that can communicate in the environment, as shown in Equation (5a).
Equations (5b)-( 5d) are constraints of this optimization problem. Equation (5b) ensures that the transmit power of all devices is not greater than their own threshold, where P C max and P D max represent the maximum communication transmit power of cellular users and D2D communication device pairs, respectively, and P C i and P D j represent the transmit power of cellular user i and D2D communication device pair j, respectively. Equation (5c) ensures that each pair of D2D communication devices can only reuse one cellular channel. And the last constraint needs to make sure that the SINR of the base station and D2D communication device pairs is greater than the corresponding thresholds γ B min and γ D min to realize normal communication.
In this subsection, the problem is described through the optimization model; however, the optimization goal proposed in this paper is only a reflection rather than an accurate result. Therefore, it is complicated and meaningless to unilaterally pursue the maximum number of D2D communication device pairs that can communicate normally in the network through common evolutionary computation algorithms such as PSO algorithm (Xu et al., 2018). This paper will consider solving the problem from the aspect of the channel allocation algorithm.

Channel allocation strategy
Channel allocation, that is, in the communication network where the D2D communication device pairs multiplexed the channels which the cellular users are using (Zheng et al., 2017), it is necessary to schedule which channel that the D2D communication device pairs multiplex. An appropriate channel allocation strategy helps to reduce the communication impact caused by channel interference.

Random algorithm
Random algorithm is to randomly assign channels to D2D communication equipment pairs (Shah et al., 2015), therefore, the principle of this algorithm is relatively simple to implement. Combining with the model, this paper proposes two random allocation methods which are named the completely random channel allocation algorithm and the semi-random channel allocation algorithm.
The completely random channel allocation algorithm is to randomly allocate the required spectrum resources for D2D communication device pairs from A channels, which does not consider the channels' occupancy by cellular users. The semi-random channel allocation algorithm considers to first occupy A-N channels which is out of the channels using by cellular users. If these A-N channels are allocated done, and there still have D2D communication device pairs need communication channels, the channels using by cellular users are continued to be randomly allocated. The channel allocation diagram of the above two algorithms is shown in Figure 2.

Channel allocation based on Hungarian algorithm
Although random algorithms are relatively simple to implement, this method does not take the state of channels into account. Thus if the channels are used by cellular users, D2D communication equipment pairs would compete with the cellular users and are affected by interference, which affects the optimization goals. Therefore, if the occupancy of the channels are considered, it would reduce the adverse impact of the complex network communication.
Due to the limited transmission power of communication devices, the interference generated at a far distance will be very low. Thus if the distance between the cellular user and the D2D communication device pair is relatively far, and in case that D2D communication device pair reuses the communication channel between the cellular user and the base station, the impact of the interference will be relatively small. Therefore, this subsection proposes a channel allocation scheme with the maximum average distance between cellular users and D2D communication device pairs in an offshore ship environment, the acquisition of the maximum average matching distance is based on the Hungarian algorithm.

Hungarian algorithm based on scenario application
The Hungarian algorithm was originally proposed by D.Konig, a Hungarian mathematician, who proved in the theorem that 'The maximum number of independent 0 elements in the coefficient matrix is equal to the minimum number of lines that can cover all 0 elements'. After that, the Hungarian algorithm gradually evolved into the '0-1 assignment problem', and it still called the 'Hungarian algorithm'. The so-called '0-1 assignment problem', that is, assigning M individuals to complete N tasks in order to maximize efficiency, so as to allocate resources reasonably. Extending to the channel allocation strategy of this paper, it is to allocate N channels for M pairs of D2D communication devices when there is no additional idle channels.
The base station in the offshore area can obtain the position information of all ships through AIS, and then traverse the communication distance matrix D N×M = (d i,j ) N×M from each pair of D2D communication device in the network to each cellular user. d i,j represents the distance from the receiving end of the jth D2D communication device pair to the ith cellular user. In addition, let S N×M = (x i,j ) N×M represents the resource multiplexing indicator matrix which is also an N × M matrix, where x represents the channel occupancy state, and the value is shown in Equation (6b).
Therefore, the channel allocation algorithm based on the maximum average matching distance from cellular users to D2D communication device pairs can be established as: Among the above constraints, the first constraint of Equation (6b) guarantees that each D2D communication device pair can only reuse one channel. Since there may have idle channels in the actual environment, the second constraint of Equation (6b) indicates that a cellular user may be multiplexing its own channel with D2D communication device pair, or it may only be using the channel by itself. When the channel is multiplexed, the value of the second constraint is equal to 1, otherwise it is 0.

Model-based Hungarian algorithm improvement
Considering the special cases in the actual environment, if there are few D2D communication device pairs that are far from cellular users, it will cause the optimization goal of Equation (6a) to be inconsistent with the expectation; in addition, the Hungarian algorithm is only for the case where M and N are equal, so it needs to be optimized in combination with the model.
(1) In order to achieve the optimization of the above problems, set F = max{d i.j } and establish an efficiency matrix E = (e i,j ) N×M = (F − d i,j ) N×M . Thus the problem of the maximum average matching distance is equivalent to the problem of the maximum total matching distance, and the following objective function optimization is performed according to the maximum total matching distance problem based on the Hungarian algorithm.
(2) In case of the number of D2D communication device pairs and the number of cellular users is not equal, the Hungarian algorithm cannot handle it, that is to say the matrix mentioned above is not a square matrix. It is necessary to introduce virtual rows or columns to form a standard square matrix from a mathematical point of view, then use the Hungarian algorithm for subsequent calculations. In order to realize the construction of the square matrix, this article makes the following rules: If the number of D2D communication device pairs is greater than the number of cellular users, virtual rows are introduced, and the values are all 0. If the number of cellular users is larger, virtual columns are introduced, and the values are all infinity. The reason for this consideration is that the value of zero means that the distance between D2D communication device pairs and cellular users is zero, thus at this time, the interference is the largest, some D2D communication device pairs may not be assigned any channels; and the value of infinity means the distance is infinite and interference can be ignored. Combining with the above analysis, it can be concluded that the rules proposed in this article is reasonable. • Initialize position information to generate efficiency matrix E = (F − d i,j ) N×M , and initialize S N×M to 0. • Subtract the smallest element of the corresponding row from each row element in the efficiency matrix E, and then subtract the smallest element from each column of the resulting matrix, so that 0 element appears in each column, generating matrix E 1 . • Use the smallest line number u to cover all 0 elements in the matrix in the previous step and get the matrix E 2 . • Judge if u = N, stop running and find all independent 0 elements in the E 2 matrix, then set it to 1. At the same time, set other elements to 0 to get the optimal resource reuse indicator matrix S N×M = E 2 ; if u < N, continue to the next step. • When u < N, find the minimum w from the numbers in the matrix E 2 that are not covered by the line, then subtract w from the uncovered elements, add w to the intersection of the lines, and keep the remaining elements covered by the straightline unchanged, then get matrix E 3 . • Find all independent 0 elements in the E 3 matrix and set them to 1, and set other elements to 0 to obtain a matrix containing only 0 and 1 elements S N×M = E 4 , which is the resource reuse indicator matrix.

Experiment results
This section compares and analyses three channel allocation methods proposed in this paper and conducts simulation experiments. It should be noted firstly that this paper assumes that all communication devices can work normally and do not depend on each other, and the channel parameters and channel fading conditions are ideal and independent of each other. Table 1 shows the channel state and the parameters of the offshore environment. This paper gives a schematic diagram of the scatter points in the radiation range of the base station in Figure 3, which is based on the offshore ships communication system model proposed in this paper.
In this paper, by setting different base station interference thresholds, different channel allocation algorithms are simulated by MATLAB, and the relationship diagram of the number of D2D communication device pairs under this algorithm is obtained.
Through observation from Figures 4 to 6, it can be found that regardless of the relationship between the number of cellular network users and the number of D2D communication device pairs in the environment, the Hungarian algorithm proposed in this paper can well increase the number of D2D communication device pairs in the network. Only when the number of allocated channels is greater than the number of users in the network, that is, there are idle channels, the semi-random channel allocation algorithm performs better than the random channel allocation algorithm.

Conclusion
The Hungarian algorithm proposed in this paper takes the actual situation of the channel into account, comparing with random channel allocation algorithms, it can effectively perform interference control and increase the number of D2D communication device pairs that can communicate normally in the network without having too much impact on the base station.
After experimental simulation, no matter what the relationship between the number of cellular users and the number of the D2D communication device pairs are, the Hungarian algorithm would have better performance.