6.1 Unmanned Aerial Vehicle–Assisted Mobile Edge Computing (MEC) Networks

MEC has emerged as a promising solution to enable resource-limited mobile devices to execute real-time applications (e.g., face recognition, augmented reality, unmanned driving) [81]. With the deployment of MEC servers—such as base stations (BSs) and access points—at the network edges, mobile users can offload computation-intensive and latency-critical tasks to the network edges for computing, instead of to the central cloud, to improve the computation performance of mobile users in a cost-effective and energy-saving manner. However, terrestrial MEC networks are not reliably established in some scenarios, such as in disasters, on battle fields, and in emergency areas. Recently, MEC assisted by unmanned aerial vehicles (UAVs) has drawn significant research interest because of the advantages it offers, such as fully controllable mobility, flexible deployment, and strong line-of-sight channels with ground devices [82]. Therefore, UAV-assisted MEC can be flexibly deployed in scenarios where terrestrial MEC networks might not be convenient.

As shown in Fig. 6.1, under an emergency scenario, terrestrial MEC infrastructures could be destroyed in a disaster, leaving many rescue tasks unable to be computed or executed. UAVs mounted with edge servers could be dispatched to compute the rescue tasks in time. It is sometimes difficult to establish terrestrial MEC networks to compute inspection tasks, such as for turbines at offshore wind farms or power lines in a smart grid, due to a harsh environment. In this case, a UAV-assisted MEC network can play a very important role. In hotspots, the high volumes of computation tasks offloaded from millions of mobile users can exhaust the computation resources of edge servers, which leads to increased processing latency that decreases the user’s quality of experience. The assistance of UAVs can improve the user’s quality of experience.

Fig. 6.1
figure 1

A UAV-assisted MEC network framework

Fig. 6.2
figure 2

Three UAV-assisted MEC network scenarios

Recent research has focused on the advances of employing UAV-assisted MEC to help ground mobile users [83–85, 88, 90, 95, 96]. As shown in Fig. 6.2, according to the application scenarios, UAVs can play different roles in MEC networks [83], as follows.

  • Exploiting MEC computing capabilities: When the UAV has limited computation capability and needs to execute computation-intensive tasks, it can function as a user to offload tasks to the terrestrial MEC server for computing.

  • Serving as a computing server: When terrestrial MEC networks are not reliably established, the UAV functions as an MEC server to help ground mobile users perform tasks computation.

  • Serving as a relay for computation offloading: When the UAV is not equipped with an MEC server and the offloading link between the mobile user and the terrestrial BS with the MEC server is poor, the UAV works as a relay to assist the mobile user offload tasks to the terrestrial BS.

6.2 Joint Trajectory and Resource Optimization in UAV-Assisted MEC Networks

Resource allocation and optimization are important for improving computation performance while realizing the economical operation of UAV-assisted MEC networks. Unlike resource allocation in conventional terrestrial MEC networks, resource allocation in UAV-assisted MEC networks must consider the resources to be optimized in computation task offloading, local computation, and UAV flight [83]. The details for the resource allocation and optimization are presented in the following for the three UAV-assisted MEC network scenarios.

6.2.1 Resource Allocation and Optimization in the Scenario of a UAV Exploiting MEC Computing Capabilities

In the scenario of exploiting MEC computing capabilities, UAVs can exploit a partial offloading mode or a binary offloading mode to offload computation-intensive tasks to the terrestrial MEC server for computation. For computation task offloading, the multiple access techniques used for terrestrial MEC networks can also be applied to the UAVs’ computation task offloading procedure. Multiple access techniques can be classified into two categories: orthogonal multiple access (OMA) and non-orthogonal multiple access (NOMA). The typical OMA techniques used in UAV-assisted MEC are time division multiple access (TDMA) and orthogonal frequency division multiple access (OFDMA). NOMA can improve user connectivity and spectral efficiency compared with OMA. In the UAVs’ computation task offloading procedure, the terrestrial MEC server allocates the communication resources (communication bandwidth, offloading time, offloading power, etc.) for task offloading. In local computation, the terrestrial MEC server allocates and optimizes the CPU frequency for the computation of the UAVs’ tasks. For the UAVs’ flight, their trajectories are optimized under speed and acceleration constraints.

Moreover, different objectives can be achieved through resource allocation and optimization in the scenario of a UAV exploiting MEC computing capabilities, such as energy consumption minimization, completion time minimization, and utility maximization.

6.2.1.1 Energy Consumption Minimization

The energy consumption in the case of a UAV exploiting MEC computing capabilities results from the UAV’s task offloading process, the local computing process, and the UAV’s flight. In [84], N. Motlagh et al. studied the offloading of video data processing to an MEC node compared to the local processing of video data on UAVs. Moreover, a testbed was developed to demonstrate the efficiency of the MEC-based offloading approach in saving the scarce energy of UAVs. In [85], M. Hua et al. studied energy consumption minimization for computation task offloading from multiple UAVs to a terrestrial BS, comparing the performance impacts of different the access schemes of multiple UAVs.

6.2.1.2 Completion Time Minimization

In [86], X. Cao et al. considered an MEC system with a single UAV and a set of ground BSs with MEC functionality. The UAV offloads computation tasks to ground BSs for remote execution. The computation tasks can be arbitrarily partitioned into smaller subtasks that can be offloaded to different ground BSs. The mission completion time of these subtasks is discretized into N time slots, whose number is minimized by jointly optimizing the UAV trajectory and computation offloading, subject to the UAV’s maximum speed constraint and the computation capacity constraint of the ground BSs.

6.2.1.3 Utility Maximization

In [87], the authors defined the utility of UAV task offloading by considering energy consumption, time delay, and computation cost. The best possible trade-off between energy consumption, time delay, and computation cost can be achieved by maximizing a global utility function.

6.2.2 Resource Allocation and Optimization in the Scenario of a UAV Serving as a Computing Server

In the scenario of a UAV serving as a computing server, terrestrial users exploit a partial offloading mode or a binary offloading mode to offload computation-intensive tasks to the UAV for computation. The multiple access techniques of TDMA, OFDMA, and NOMA can be used to offload terrestrial user tasks. In the offloading procedure, the UAV allocates the communication resources (communication bandwidth, offloading time, offloading power, etc.) to terrestrial users for task offloading. For the UAV flight and computing process, the resources to be optimized are the CPU frequency, the trajectory, the flight speed, and the acceleration velocity of the UAV. There are two computing techniques based on the UAV CPU frequency. When the UAV computation circuit has a fixed CPU frequency, the local computation is performed at a constant rate. When the UAV adopts a dynamic voltage and frequency scaling technique, the CPU frequency can be adjusted based on the scale of the computation task. Different optimization objectives can be achieved through resource allocation when the UAV serves as a computing server, such as energy consumption minimization, computation bit maximization, completion time minimization, and computation efficiency maximization.

6.2.2.1 Energy Consumption Minimization

The energy consumption in the case of a UAV serving as a computing server results from the local computing process, the task offloading process, and the UAV’s flight. In particular, the energy consumed in the local computing process is determined by the CPU frequency. In the offloading process, the energy consumed depends on the transmission power and the offloading time. In the UAV’s flight, the energy consumed should consider the UAV’s speed, acceleration velocity, and flight time. Joint trajectory and resource allocation was studied in [88] to minimize total mobile energy consumption while satisfying the quality of service requirements of the offloaded mobile application. A UAV-assisted MEC network with stochastic computation tasks was investigated in [89], where the average weighted energy consumption of the smart devices and the UAV is minimized subject to constraints on the UAV’s computation offloading, resource allocation, and flight trajectory scheduling.

6.2.2.2 Computation Bit Maximization

The total number of computation bits is the sum of the number executed in the local computation and the number executed in the offloading. The maximization of the number of computation bits was studied in a UAV-assisted MEC wireless powered system under both partial and binary computation offloading modes in [90], subject to a causal energy harvesting constraint and a UAV speed constraint. The weighted-sum completed task input bits of users was maximized in [91] under task and time allocation, information causality, energy causality, and the UAV’s trajectory constraints. The optimization problem was solved by jointly optimizing the task and time allocation, as well as the UAV’s transmission power and trajectory.

6.2.2.3 Completion Time Minimization

The completion time, in the case of a UAV serving as a computing server, is another fundamental optimization objective, especially for time-sensitive applications. In the binary computation mode, the completion time can be determined by the local computation time or the offloading time. In the partial computation mode, the completion time depends on both the local computation time and the offloading time. The minimization of the task completion time is studied in [92] while assuming the condition of a minimum number of computation bits.

6.2.2.4 Computation Efficiency Maximization

Different from the individual optimization of computation latency, energy consumption, and the number of computation bits, computation efficiency is defined as the ratio of the total number of computation bits to the total energy consumption, to achieve a good trade-off between the number of computation bits and energy consumption. A computation efficiency maximization problem was formulated in a multi-UAV-assisted MEC system in [93], where, based on the partial computation offloading mode, user association, the allocation of CPU cycle frequencies, power and spectrum resources, as well as UAV trajectory scheduling are jointly optimized.

6.2.3 Resource Allocation and Optimization in the Scenario of a UAV Serving as a Relay for Computation Offloading

In the scenario of a UAV serving as a relay for computation offloading, users deployed at the cell edge offload computation-intensive tasks to a terrestrial MEC server via UAV relay for computing. In the offloading procedure, the terrestrial MEC server allocates the communication resources (e.g., communication bandwidth, offloading time, relaying power) to the users and the UAV for task offloading and relaying. In the local computation, the terrestrial MEC server allocates and optimizes the CPU frequency for users’ task computations. In the UAV flight process, the UAC’s trajectory is optimized under speed and acceleration constraints. The different optimization objectives can be achieved through resource allocation where the UAV serves as a relay, such as in user latency minimization, energy consumption minimization, and minimum throughput maximization.

6.2.3.1 User Latency Minimization

In [94], J. Lyu et al. proposed utilizing UAVs as computing nodes as well as relay nodes to improve the average user latency. They formulated the optimization problem with the objective of minimizing the average latency of all users.

6.2.3.2 Energy Consumption Minimization

In [95], J. Lyu studied a UAV-assisted MEC architecture where a UAV roamed around the area, serving as a server to compute the tasks of mobile users or acting as a relay to offload computation tasks to an access point. The problem of minimizing the weighted-sum energy consumption of the UAV and the mobile users was formulated subject to task constraints, information causality constraints, bandwidth allocation constraints, and UAV trajectory constraints.

6.2.3.3 Minimum Throughput Maximization

In [96], a UAV was leveraged as a relay for offloading the computation tasks of mobile users to a terrestrial BS. Furthermore, a resource optimization problem for maximizing the minimum throughput of mobile devices was formulated. The results demonstrate that computation performance can be significantly improved by optimizing UAV trajectories.

6.3 Case Study: UAV Deployment and Resource Optimization for MEC at a Wind Farm

Most recent research has focused on advances employing UAV-assisted MEC to help ground mobile users in task computation or relaying in a hotspot scenario. Nevertheless, UAV-assisted MEC has seldom been studied in a harsh environment (at a wind farm, in rough seas, etc.). In this section, we consider the situation in which a UAV functions as an MEC server to inspect the turbines at a wind farm and performs task computation. Wind power is a clean and widely deployed alternative for reducing dependence on fossil fuel power. Under this trend, a large number of turbines are being installed at wind farms. The deployment of UAVs for the automated inspection of the turbines and related task computation is a promising method to reduce costs and improve inspection and computation efficiency. Different from UAV-assisted MEC in a hotspot scenario, the random realization of extreme weather conditions at a wind farm impacts the flight speed and range of UAVs [99]. For example, UAVs can crash if the wind speed at a wind farm is over their maximum wind speed resistance. Therefore, the influence of wind speed and wind direction is important to consider in UAV placement and routing at a wind farm. In this section, we study the optimal deployment of UAVs to inspect all turbines at a wind farm. The joint trajectory–resource optimization for inspection and task computation will be discussed in the following sections.

Fig. 6.3
figure 3

The deployment of multiple UAVs for automated inspection at a wind farm

6.3.1 UAV Deployment for MEC at a Wind Farm

6.3.1.1 A Wind Model

Figure 6.3 shows the deployment of multiple UAVs to monitor the condition of turbines. The total number of turbines at the wind farm is T. The coordinates of the kth turbine are \({\mathbf{q}_k} = [{x_k},{y_k}]\). When UAVs fly to inspect a wind turbine, they face two wind conditions: tail wind and head wind. The wind velocity is \(\mathbf{w} = [{w^x},{w^y}]\), and the wind speed is \({w_s} = {\left\| \mathbf{w} \right\| _2}\). In the polar coordinate system, the wind direction is \(\theta _w^{pol}\), which can be calculated by \(\theta _w^{pol} = arc\tan \frac{{{w^y}}}{{{w^x}}}\). In meteorological measurements, the wind direction is \(\theta _w^{met}\). Since the phase goes clockwise in meteorological measurements, however, the phase in the polar coordinate system is represented in the counterclockwise direction. Therefore, the relation between wind direction in the polar coordinate system and in meteorological measurement is denoted as

$$\begin{aligned} \theta _w^{pol} = \frac{{3\pi }}{2} - \theta _w^{met} \end{aligned}$$
(6.1)

6.3.1.2 A UAV Model

At the wind farm, each UAV inspects the turbines that are assigned to it. Assume that the UAVs all fly at the same altitude, so the z-axis can be ignored. The ith UAV will be placed at \({\mathbf{q}_i} = [{x_i},{y_i}]\), and the set of turbines assigned to the ith UAV is denoted by \({\mathcal{N}_i}\). When a UAV flies to inspect a wind turbine, the condition of the wind is to be considered in the decision making of the UAV. The velocity of the ith UAV flying from turbine k to turbine l is \({\mathbf{v}_{i,k,l}} = \left[ {v_{i,k,l}^x,v_{i,k,l}^y} \right] \), which is the UAV’s initial velocity. The resultant velocity of the ith UAV is \({\mathbf{s}_{i,k,l}} = \left[ {s_{i,k,l}^x,s_{i,k,l}^y} \right] \), which is the velocity influenced by the wind. The relation between the UAV velocity, the wind, and the resultant velocity can therefore be expressed as

$$\begin{aligned} {\mathbf{s}_{i,k,l}} = {\mathbf{v}_{i,k,l}} + \mathbf{w}\mathrm{{ }} \end{aligned}$$
(6.2)

where \({\left\| {{\mathbf{v}_{i,k,l}}} \right\| _2}\) and \({\left\| {{\mathbf{s}_{i,k,l}}} \right\| _2}\) are the airspeed and ground speed of the UAV, respectively, both limited by the maximum speed limit of \(u_i^{\max }\). In particular, when the UAV faces a tail wind, the ground speed is limited to \(u_i^{\max }\). Then, for the headwind case, the airspeed is limited to \(u_i^{\max }\).

The time for the UAV to fly from turbine k to turbine l can be calculated as

$$\begin{aligned} {t_{i,k,l}} = \frac{{{{\left\| {{\mathbf{q}_l} - {\mathbf{q}_k}} \right\| }_2}}}{{{{\left\| {{\mathbf{s}_{i,k,l}}} \right\| }_2}}} \end{aligned}$$
(6.3)

The maximum flight time for the UAV is \(\mathrm{{ }}t_i^{\max }\), which represents an upper limit of the total flight time. The UAV’s flight range under the wind condition can be expressed as

$$\begin{aligned} B_i^\mathbf{w}\left( {{\rho _i}} \right) = \left\{ {x,y \in :{{\left\| \mathbf{r} \right\| }_2} \le {\rho _i}} \right\} \end{aligned}$$
(6.4)

where \(\mathbf{r} = \left[ {x - {x_r},y - {y_r}} \right] \), \( {{\rho _i}}\) is the UAV’s actual flight distance, which can be calculated by \({\rho _i} = \frac{{u_i^{\max }t_i^{\max }}}{2}\). The UAVs’ flight range is regarded as a circle with \({{x_r}}\) and \({{y_r}}\) as the center of the circle, which can be calculated as \({x_r} = {x_i} + {w^x}t_i^{\max }\) and \({y_r} = {y_i} + {w^y}t_i^{\max }\), respectively. Since the UAV’s flight range is influenced by different wind conditions, it is the intersection of the flight range under different wind conditions: \({Z_i} = \mathop \cap \limits _\mathbf{w} B_i^\mathbf{w}\left( {{\rho _i}} \right) \).

6.3.1.3 Deployment of Multiple UAVs at a Wind Farm

Since a single UAV has a limited operation time and battery, it is challenging to serve a large number of mobiles users in a geographical coverage area. Compared with a single UAV, a collaboration of multiple UAVs can expand the coverage area and support more computation tasks within a shorter time, which can remarkably boost the applications of UAV-assisted MEC in emergency and complicated scenarios. Therefore, it is important to design a multiple-UAV deployment scheme before task computation, to reduce the computation cost and improve computation performance. Several recent works have focused on utilizing multiple UAVs and placing them for an optimal topology [97, 98]. An efficient deployment of multiple UAVs that provides coverage for ground mobile devices was analyzed in [97], where the three-dimensional locations of the UAVs were optimized to maximize the total coverage area. Furthermore, the minimum number of UAVs to guarantee a target coverage probability for a given geographical area was determined. A polynomial-time algorithm with the placement of successive UAVs was designed in [98] to minimize the number of UAVs needed to provide wireless coverage for a group of distributed ground terminals. However, recent works seldom study the deployment of UAVs for task computation in harsh environments, such as in rough seas or at a wind farm. We address the deployment problem of UAVs at a wind farm by considering wind, since it can have a considerable influence on the flight range and speed of UAVs.

Initially, N candidates UAVs are placed at the wind farm. The matrixes \(\mathbf{A} = {\left[ {{a_i}} \right] _{1 \times N}}\), \(\mathbf{B} = {\left[ {{b_{i,k}}} \right] _{N \times T}}\) and \(C = {\left[ {{c_{i,j}}} \right] _{N \times N}}\) denote the states of candidate UAVs, the association between UAVs and turbines, and the communication link between UAVs, respectively, where \({a_i} = 1\) indicates that the ith candidate UAV needs to be positioned at the wind farm, and \({a_i} = 0\) indicates it needs to be removed. Additionally, if \({b_{i,k}} = 1\), turbine k is assigned to the ith UAV; otherwise, \({b_{i,k}} = 0\). When determining the topology of the UAVs, we need to ensure that they can maintain communication links with each other so that collisions can be prevented. Thus, \({c_{i,j}} = 1\) indicates that the ith and jth UAVs have a communication link; otherwise, \({c_{i,j}} = 0\). The objective function is to minimize the number of UAVs that need to be placed at the wind farm. Thus, the deployment problem, considering the influence of wind, can be formulated as

$$\begin{aligned} \begin{array}{l} ~~~~~~\mathop {\min }\limits _{\mathbf{A}, \mathbf{B},\mathbf{C},{x_i},{y_i}} \sum \limits _{i = 1}^N {{a_i}} \\ \mathrm{such}\,\, \mathrm{that}\\ \mathrm{{C1:}}~{a_i},\mathrm{{ }}{b_{i,k}},{c_{i,j}} \in \left\{ {0,1} \right\} \\ \mathrm{{C2:}}\sum \limits _{i = 1}^N {{b_{i,k}}} \le 1,\forall k,\sum \limits _{k = 1}^T {{b_{i,k}}} \le p,\forall i\\ \mathrm{{C3:}}\left[ {{x_k},{y_k}} \right] \in {Z_i},\left[ {{x_i},{y_i}} \right] \in \left\{ {\left[ {{x_k},{y_k}} \right] } \right\} ,\forall {b_{i,k}} = 1\\ \mathrm{{C4:}}\sum \limits _{j = 1,i \ne j}^N {{c_{i,j}}} \ge 1,\sqrt{{{\left( {{x_i} - {x_j}} \right) }^2} + {{\left( {{y_i} - {y_j}} \right) }^2}} \le d,\forall i,j \end{array} \end{aligned}$$
(6.5)

where constraint C1 indicates that \({a_i}\), \({b_{i,k}}\), and \({c_{i,j}}\) are binary variables; C2 indicates that each turbine can only be assigned to one UAV, and each UAV can be associated with up to p turbines, respectively; C3 ensures that the location \(\left[ {{x_k},{y_k}} \right] \) of turbine k assigned to the ith UAV must be in the flight range of the ith UAV, and each UAV should be placed inside the turbines assigned to it; and constraint C4 guarantees that the minimum number of communication links each UAV must have and the distance between any two UAVs should be lower than d. The formulation in (6.5) is a mixed integer linear programming problem that cannot be solved directly, because it contains binary parameters. In this case, if the dimension of the problem increases, the problem will become NP-hard. Thus, a heuristic algorithm is designed to solve problem (6.5).

For the deployment of multiple UAVs, the flight range is an important parameter that can be influenced by the wind conditions at the wind farm. However, wind conditions in the future are unknown to UAVs, and different UAVs have different maximum wind speed resistance levels. Since the deployment is used to determine the required number of UAVs and their placement, it can be considered the planning stage and can use historic wind data. We choose the Walney Wind Farms, a group of offshore wind farms in the United Kingdom. The wind data are obtained from the Centre for Environmental Data Analysis [103], which provides hourly average wind velocities and directions. Given the wind velocity and directions, a UAV’s flight range can be obtained from (6.4).

Then, with a known flight range, the topology of the UAVs at the wind farm can be designed. Initially, T UAVs are placed at the wind farm so that each turbine has one UAV assigned to it. The turbines inside a UAV’s flight range are assigned to it. After initialization, some UAVs might have to associate with more than p turbines. To eliminate redundant connections between the UAV and the turbines, the distances between the UAV and its assigned turbines are sorted in decreasing order and the turbines associated with the UAV are then reassigned accordingly.

After this procedure is completed, some turbines might be assigned to more than one UAV. In addition, the current number of UAVs placed has not been minimized. To address these issues, the UAVs are sorted based on the number of turbines intersecting with other UAVs in decreasing order. Then, if any turbine associated with the ith UAV can also be served by another UAV, the ith UAV can be removed; otherwise, the connection between the UAV and the turbine is deleted based on the distance.

6.3.1.4 Performance Analysis

The performance of the deployment strategy is evaluated based on a real-world dataset for the Walney Wind Farms in the United Kingdom. The data are from the Centre for Environmental Data Analysis [103] and Kingfisher Information Service – Offshore Renewable & Cable Awareness [104]. The UAV is an AscTec Falcon 8 [105], which has a maximum wind speed resistance of 15 m per second. The maximum distance of the communication between UAVs is set to 5 km. Each UAV can be assigned to inspect up to five turbines. To clearly present the deployment, we pick 47 of the 189 turbines in the dataset. Figure 6.4 shows the final deployment results, where 17 UAVs are required to cover all the wind turbines at the wind farm. Additionally, all the turbines are assigned to the UAVs, and each UAV serves no more than five turbines.

6.3.2 Joint Trajectory and Resource Optimization of UAV-Aided MEC at a Wind Farm

Different from the joint trajectory–resource optimization in UAV-assisted MEC for ground mobile users, in this section we study how to route UAVs to inspect wind turbines and execute computation tasks at a wind farm. For a given topology in Fig. 6.3, a UAV and its assigned turbines can be represented in a graph, denoted as \({\mathcal{G}_i} = \{ {\mathcal{N}_i},{\varepsilon _i}\}\), where \({\mathcal{N}_i}\) represents the nodes in the graph, which denote the set of turbines assigned to the ith UAV, and \({\varepsilon _i}\) is the set of edges that connect each turbine. After the detection of turbine k, the UAV computes the detection tasks while flying to turbine l. The detection tasks must be completely processed before the UAV arrives at turbine l. With the graph structure, we can create adjacency matrixes denoted by \({\mathbf{D}_i}\) and \(\mathbf{E}_i^m\). The value of the kth column and lth row in \({\mathbf{D}_i}\) is \({t_{i,k,l}}\), which represents the flight time from turbine k to turbine l. The value of the kth column and lth row in \(\mathbf{E}_i^m\) is \({e_{i,k,l}}\), which represents the energy consumption of the UAV flying from turbine k to turbine l. The detection task of turbine k is denoted by \({I_k} = \{ {d_k},{c_k}\}\), where \(d_k\) denotes the task size and \({c_k}\) is the required number of CPU cycles to compute one bit of task. Let \({f_{i,k}}\) denote the computation resource that the UAV allocates to turbine k. The computation time of the detection task for turbine k can be expressed as \({t_{i,k}} = \frac{{{c_k}{d_k}}}{{{f_{i,k}}}}\), where \({t_{i,k}} \le {t_{i,k,l}}\). The energy consumption of the detection task computation for turbine k can be expressed as \({e_{i,k}} = {\gamma _c}{c_k}{d_k}{\left( {{f_{i,k}}} \right) ^2}\).

Fig. 6.4
figure 4

UAV deployment

Denote the number of required routes to inspect the turbines as M. We introduce the routing matrix \(\mathbf{U}_i^m = {[U_{i,k,l}^m]_{\left| {{\mathcal{N}_i}} \right| \times \left| {{\mathcal{N}_i}} \right| }}\) to denote the mth route for UAV i. Specifically, \(U_{i,k,l}^m=1\) indicates that the UAV chooses to fly from turbine k to turbine l; otherwise, \(U_{i,k,l}^m=0\). Our objective is to minimize the energy consumption of the ith UAV for turbine detection and task computation. The joint trajectory–computation resource optimization problem can be formulated as

$$\begin{aligned} \begin{array}{l} \mathop {\min }\limits _{\scriptstyle M,\mathbf{U}_i^m,\mathbf{E}_i^m,{f_{i,k}},\atop \scriptstyle {\mathbf{v}_{i,k,l}}, {\mathbf{s}_{i,k,l}},\theta _{i,k,l}^{s,v}} \sum \limits _{m = 1}^M {\sum \limits _{k \in {\mathcal{N}_i}} {\sum \limits _{l \in {\mathcal{N}_i}\backslash \{ k\} } {U_{i,k,l}^m\left( {{e_{i,k,l}} + {e_{i,k}}} \right) } } } \\ \mathrm{such}\,\, \mathrm{that}\\ \mathrm{C1}:U_{i,k,l}^m \in \{ 0,1\} ,\mathrm{{ }}\forall k,l \in {\mathcal{N}_i}\\ \mathrm{C2}:\sum \limits _{k \in {\mathcal{N}_i}} {U_{i,s,k}^m} \mathrm{{ = }}\sum \limits _{k \in {\mathcal{N}_i}} {U_{i,k,s}^m} = 1,\forall m\\ \mathrm{C3}:\sum \limits _{k,l \in {\mathcal{N}_i}} {{t_{i,k,l}}U_{i,k,l}^m} \le t_i^{\max }\\ \mathrm{C4}:\mathrm{{ }}{t_{i,k}} \le {t_{i,k,l}},\sum \limits _{k \in {\mathcal{N}_i}} {{f_{i,k}}} \le f_i^{\max }\\ \mathrm{C5}:\mathrm{{ }}{\left\| {{\mathbf{v}_{i,k,l}}} \right\| _2} \le u_i^{\max },{\left\| {{\mathbf{s}_{i,k,l}}} \right\| _2} \le u_i^{\max } \end{array} \end{aligned}$$
(6.6)

where constraint C1 indicates that \(U_{i,k,l}^m\) is a binary parameter; C2 indicates that the starting point of every route should be s, which is the position of the UAV; C3 ensures that the sum of the flight times of all the routes does not exceed \(t_i^{\max }\); constraint C4 guarantees that the total computation time of the detection tasks for each turbine does not exceed the flight time, and the computation resources allocated for computing the detection tasks do not exceed the maximum computation resources \(f_i^{\max }\) of the ith UAV; and C5 ensures that the airspeed and ground speed are each bounded by the maximum speed.

In problem (6.6), the optimal values of several parameters should be found. In addition, the variables at the upper bounds of the summation and the binary parameters make the problem difficult to be solved. To address the challenge, the solution of (6.6) is separated into two stages. In the first stage, the optimal UAV trajectory is found that minimizes the flight energy consumption by fixing the energy consumption \({e_{i,k}}\) of the UAV for task computation. We must calculate \({\mathbf{s}_{i,k,l}}\), \({\mathbf{v}_{i,k,l}}\), \({{t}_{i,k,l}}\), and \({{e}_{i,k,l}}\) for all \(k,l \in {\mathcal{N}_i}\). The calculation of \({\mathbf{s}_{i,k,l}}\) and \({\mathbf{v}_{i,k,l}}\) differs, depending on whether the UAV is facing headwind or tailwind. The variable \(\theta _{i,k,l}^{s,w}\) is utilized to determine wind conditions, and it can be calculated as the inner product of \({\mathbf{s}_{i,k,l}}\) and \(\mathbf{w}\). The power consumption \(p\left( {{v_{i,k,l}}} \right) \) of a UAV flying with airspeed \({\mathbf{v}_{i,k,l}}\) can be modeled according to [102]. With \({\mathbf{s}_{i,k,l}}\), \({\mathbf{v}_{i,k,l}}\), and \({{t}_{i,k,l}}\), the flight energy consumption \({{e}_{i,k,l}}\) of a UAV flying from turbine k to turbine l can be obtained by multiplying \({{t}_{i,k,l}}\) with \(p\left( {{v_{i,k,l}}} \right) \).

A heuristic algorithm is then designed to find the UAV’s optimal trajectory. In particular, a brute force algorithm is developed to search for the optimal trajectory without considering time limits. The optimal trajectory obtained is then modified according to the maximum flight time. Based on the optimal trajectory found, a test is run to see if the UAV can fly back to its starting point when it decides to detect turbine l from turbine k. We now compare the cumulative flight time of a UAV from its starting point to turbine l via turbine k and the time it takes the UAV to fly from turbine l back to its starting point. If both of the times are less than the maximum time, \(U_{i,k,l}^m = 1\); otherwise, \(U_{i,k,l}^m = 0\), the UAV needs to fly back to the starting point from turbine k, and another detection round is added, starting from turbine l. In the second stage, based on the trajectory obtained, we solve the problem of the optimal computation resource allocation of the UAV detecting each turbine to minimize the energy consumption for computation. Since both the objective function and constraint C4 are convex, the Lagrange duality method can be utilized to solve this problem.

Fig. 6.5
figure 5

Trajectory of UAV 15

Fig. 6.6
figure 6

Computation of the energy consumption of UAV 15 versus different sizes of detection tasks

6.3.2.1 Performance Analysis

The results of the deployment are applied to show how to route the UAVs to inspect the wind turbines and execute the computation tasks. We use UAV 15 as an example. The UAV is placed at the turbine whose code is B110. Figure 6.5 shows the result of the trajectory. To minimize flight energy consumption, the UAV should avoid headwind. The UAV goes to C214 first and then chooses E105. After E105, the UAV uses the tailwind to go to A106 and A411. The total flight time for detection and computation is 15.3 min, and the energy consumption for the flight is 137.7 KJ. For comparison with the proposed method, a branch and bound method is used to find the optimal trajectory of the UAV according to (6.6). The total flight time calculated with the branch and bound method is 15.7 min, and the energy consumption for the flight is 141.5 KJ. Thus, the optimality of the proposed method can be proven.

Furthermore, Fig. 6.6 compares the computation energy consumption of the proposed method with that of the branch and bound method. Since constraint C4 in optimization problem (6.6) illustrates that the computation time of the detection tasks for each turbine must not exceed the flight time, and the flight time obtained by the branch and bound method is longer than that obtained by the proposed method, we can conclude that the computation energy consumption of the proposed method is less than that of the branch and bound method. In addition, the computation energy consumption of the two methods increases with increasing detection task size.

6.4 Conclusions

In this chapter, we illustrated the application of UAV-assisted MEC in scenarios in which terrestrial MEC networks cannot be reliably established. According to the application scenarios, we analyzed the different roles of UAVs in MEC networks and presented the details for resource allocation and optimization in three UAV-assisted MEC network scenarios. In addition, we focused on UAV-assisted MEC at a wind farm and studied the wind’s effect on UAVs’ flight characteristics. The optimal number of UAVs to be deployed to inspect all the turbines at the wind farm was investigated. Then, the joint trajectory–computation resource optimization of the UAVs for inspection and task computation at the wind farm was studied. A two-stage method was developed to solve the problem of UAV trajectory optimization and computation resource allocation to detect each turbine, in order to minimize the total energy consumption.