# Altitude Optimization and Task Allocation of UAV-Assisted MEC Communication System
## 2 System Model and Problem Statement
### System Model  
As shown in Figure 1, we consider a UAV-assisted MEC uplink maritime communication system including a UAV, a maritime user, and an onshore BS, in which, they are all equipped with a single antenna. We use \((x_{U},y_{U},H)\), \((x_{G},y_{G},0)\), and \((x_{B},y_{B},h)\) to denote the three dimensional position of the UAV, the user, and the BS, respectively. We express the distance between the user and the projection of the UAV on the ground as \(r=\sqrt{(x_{U}-x_{G})^{2}+(y_{U}-y_{G})^{2}}\). The user simultaneously offloads the tasks to the BS and the UAV for calculation based on frequency division multiple access (FDMA) scheme. The Sea-to-air (S2A) wireless communication link between user and UAV both contains LoS link and NLoS link [28]. The LoS probability of this link can be expressed as [29; 30]  
\[p_{\mathsf{LoS}}=\frac{1}{1+a\exp[-b(\theta-a)]}, \tag{1}\]  
where \(a\) and \(b\) are constants determined by the environment, \(\theta=\arctan(\frac{H}{r})\) denotes the elevation angle between UAV and the user. The probability of NLoS link between user and UAV is expressed as \(p_{\mathsf{NLoS}}=1-p_{\mathsf{LoS}}\). The path loss of LoS link and NLoS link are as follows, respectively [31],  
\[\mathsf{PL}_{\mathsf{LoS}} =\Big{(}\frac{4\pi f_{c}d_{\mathsf{S2A}}}{c}\Big{)}^{\epsilon} \eta_{\mathsf{LoS}}, \tag{2}\] \[\mathsf{PL}_{\mathsf{NLoS}} =\Big{(}\frac{4\pi f_{c}d_{\mathsf{S2A}}}{c}\Big{)}^{\epsilon} \eta_{\mathsf{NLoS}}, \tag{3}\]  
where \(c\) denotes the speed of light, \(f_{c}\) denotes the carrier frequency, \(d_{\mathsf{S2A}}=\sqrt{H^{2}+r^{2}}\) is the distance between the UAV and the user, \(\epsilon\) denotes the path loss exponent, \(\eta_{\mathsf{LoS}}\) and \(\eta_{\mathsf{NLoS}}\) denote the extra path loss of LoS link and NLoS link, respectively, and we set \(\epsilon=2\)[32; 33]. The average path loss of S2A channel is expressed as follows  
\[\overline{\mathsf{PL}}=p_{\mathsf{LoS}}\mathsf{PL}_{\mathsf{LoS}}+p_{\mathsf{ NLoS}}\mathsf{PL}_{\mathsf{NLoS}}. \tag{4}\]  
The Sea-to-Ground (S2G) wireless communication link between user and BS is modeled as the Rayleigh fading channel [34], and the channel gain is expressed as  
\[h_{\mathsf{S2G}}=\beta_{0}(d_{\mathsf{S2G}})^{-\varphi}\xi_{\mathsf{S2G}}, \tag{5}\]  
where \(\beta_{0}\) is the channel gain at the reference distance of 1 m, \(d_{\mathsf{S2G}}\) represents the distance between the user and the BS, \(\varphi\) denotes the path loss exponent, and we set \(\varphi=3.5\), \(\xi_{\mathsf{S2G}}\) denotes the small-scale fading component conforming to the Rayleigh fading model. The achievable rate of the uplink transmission task from the user to the UAV is given as  
\[R_{\mathrm{UAV}}=B_{\mathrm{UAV}}\log_{2}\Big{(}1+\frac{PG}{\overline{\mathsf{ PL}}N_{0}B_{\mathrm{UAV}}}\Big{)}, \tag{6}\]  
Figure 1: A UAV-assisted MEC uplink communication system. where \(B_{\rm UAV}\) represents the bandwidth allocated by the user to offload tasks to the UAV, \(P\) is the transmit power of the user, and \(N_{0}\) is the spectral density of noise power. \(G\) denotes the gain of the directional antenna [35], it can be described as  
\[G= \begin{cases}\frac{G_{0}}{\left(\frac{\omega}{2}\right)^{2}},&0\leq\phi\leq \frac{\omega}{2},\\ g\approx 0,&otherwise\end{cases}  \tag{7}\]  
where \(\omega\) denotes the beamwidth of UAV's directional antenna, \(G_{0}=30,000/2^{2}\times(\pi/180)^{2}\approx 2.2846\), \(\phi\) denotes the sector angle, \(g\) is the channel gain beyond the beamwidth of the directional antenna. The achievable rate of the uplink transmission task from the user to the BS can be expressed as  
\[R_{\rm BS}=B_{\rm BS}\log_{2}\left(1+\frac{Ph_{\rm BSG}}{N_{0}B_{\rm BS}} \right), \tag{8}\]  
where \(B_{\rm BS}\) denotes the bandwidth allocated by the user to offload the task to the BS. Let \(L\) denotes the total computing tasks, the task allocation ratio is described as \(\alpha\in[0,1]\). The task allocation ratio from the user to the UAV and BS is \(\alpha\) and \(1-\alpha\), respectively.