Enabling Flexible Arial Backhaul Links for Post Disasters: A Design Using UAV Swarms and Distributed Charging Stations

In this article, our target is to design a permanent long backhaul link using unmanned aerial vehicle (UAV) relays and charge stations (CSs) to transfer data from the nearest core network to disaster area (DA). To this end, we first characterize the communication channel by considering the energy consumption models of the backup UAVs (moving UAVs) and the UAVs in service (hovering UAVs), the position and number of UAVs in service relative to the DA, along with the position of CSs relative to the position of UAVs. Then we define the optimization problem for two different scenarios. First, we design the long backhaul link in such a way that minimizes the implementation cost. In particular, the optimal design includes finding the optimal position for CSs, UAVs in service along with the optimal planning for backup UAVs in such a way as to reduce the implementation cost and guarantee the quality of service of the multi-relay UAV-based wireless backhaul links. The implementation cost is related to the number of CSs, the number of UAVs in service along with the number of backup UAVs. For the second scenario, we assume that the implementation cost is predetermined, and we find the optimal positions for UAVs and CSs along with planning for backup UAVs to minimize the outage probability. By analyzing the effects of optimization parameters, we further propose low complexity sub-optimal algorithms for both scenarios. Then, using simulations, we show that the sub-optimal algorithms achieve a performance that is very close to the optimal solutions.


I. INTRODUCTION
Climate change is supercharging the increasing frequency and intensity of extreme weather that has led to severe storms, flooding, and hurricanes in recent years.Over the recent period of (2016-2022), the United States experienced 122 separate mega disasters that killed at least 5,000 people and cost more than $1 trillion [1].Also, Europe has seen a sixty percent increase in extreme weather events [2] from the past three decades.Other parts of the world that have never experienced severe weather should be ready and plan for it now, while those who are more used to extreme natural events should be prepared for more [2].Natural disasters can potentially cut or completely destroy fiber infrastructure in a disaster area (DA).
Any disruption to the fragile fiber causes data disconnections that take days to find and repair.
Beside natural disasters, man-made disasters like terrorist attacks, can be more destructive and costly.Terrorist attacks on the telecommunications infrastructure of advanced cities are potentially attractive targets for what might be called "incremental" terrorism [3].If no physical damage is done to network which is disrupted in an attack, the communications capabilities are likely to be recoverable in a relatively short time [3].However, terrorist threats can include a simultaneous physical attack on the incoming optical fiber links at unknown and key points in the telecommunication infrastructure, which is time-consuming to find and fix.By carrying out such attacks, the entire network of the subject area along with applications based on the Internet of Things (IoT) will be unavailable for a long time.Network outage disrupts most of the daily services such as banks, hospitals, transportation, or local government services.It affects the performance of companies and causes heavy financial losses in the stock market.Moreover, the modern power grid relies on the internet to coordinate power plants and without it, power grid would become unbalanced and with outages.In general, developed countries face greater vulnerability to the terrorist attacks on network infrastructure as IoT becomes more widespread in these countries.
In order to prepare against network infrastructure failures due to natural disasters or terrorist attacks, we must look into alternative solutions for fast network recovery until the communication infrastructure is reconnected.Due to the significant progress made in recent years, the use of backhaul satellite links can be offered as an initial solution to quickly connect the urban network to the global network.However, due to the limited capacity, satellite links cannot provide a capacity equivalent to fiber infrastructure, and thus, planning based on satellite links alone is not sufficient.Therefore, in addition to using the capacities of the satellite backhaul solutions, it is necessary to plan for an alternative/additional flexible wireless solutions to connect the network of DA with the nearest core network (CN).In some cases, the distance to the nearest CN may be tens of kilometers and providing an alternative terrestrial wireless backhaul connectivity encounters serious challenges, including creating a line of sight (LoS) between the DA to the nearest CN, especially in forest and mountainous areas [4].Due to their unique capabilities such as flexibility, maneuverability, and adaptive altitude adjustment, unmanned aerial vehicles (UAVs) can be considered as a promising solution to provide a temporary wireless backhaul connectivity, while improving reliability of backhaul operations [5], [6], [7], [8].
Recently, UAV-based backhaul links have been studied in few works [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23].In [9], the performance of a 3D two-hop UAV-based network is studied for both amplify-and-forward (AF) and decode-and-forward (DF) relaying protocols.A novel wireless architecture is proposed in [10] by reflecting the backhaul signal using aerial-RIS to provide LoS connectivity in an urban area.Both wireless access and backhaul millimeter wave (mmWave) links are analyzed in [11] to address multi path propagation in an urban environment.A dynamic algorithm for integrated access and backhaul systems is proposed in [12] for both UAV positioning and tracking of temporal user/traffic activity.In [13], the authors investigate the successful content delivery performance in the UAV integrated terrestrial cellular networks where each UAV uses mmWave communications for self-backhaul.In [14], the authors studied the security, privacy, intelligence, and energy-efficiency issues faced by swarms of UAVs to address massive connectivity issues to guarantee ultra-high throughput connectivity in extreme or emergency situations.An adaptive deployment scheme is proposed in [15] for a UAV-aided communication network, where the UAV adapts its distance to serve randomly moving users.Age-of-information-based UAV trajectory is studied in [16] for fresh data collection.In [17], [18], the performance of UAV-based mmWave and terahertz (THz) links is investigated when UAVs are equipped with square array antennas.In [19], the authors addressed the joint UAV location and bandwidth allocation problems to maximize the total profit without exceeding the backhaul and access capacities.A novel spectrum management architecture for UAV swarm is proposed in [20] by considering the special feature of mmWave links.
Considering the importance of providing reliable backhaul links for post-disaster network recovery, in this work, we focus on the analysis, design, and feasibility of long UAV-based backhaul links, which consists of a set of UAVs in service, a set of backup UAVs and a set of mobile charge stations (CSs) to provide a permanent long backhaul link.Our goal is to design the considered long backhaul links including the optimal number and position of UAVs in service, and the optimal number and position of CSs along with optimal planning for backup UAVs.To this end, we first characterize the tackled communication channel by considering the energy consumption models of the backup UAVs (moving UAVs) and the UAVs in service (hovering UAVs), along with the channel parameters such as the actual antenna pattern, the intensity of UAVs' instabilities and its effect on antenna misalignment, the position and number of UAVs in service relative to the nearest CN and DA, the position of CSs relative to the position of UAVs, and the effects of large-and small-scale fading channel coefficients.Then, we formulate the optimization problem for two different scenarios.First, we assume that the link length and channel conditions are known and we want to design the backhaul link in such a way that minimizes the implementation cost, while guaranteeing the requested quality of service (in this work, we target outage probability as the suitable quality of service indicator for such scenario).In the second scenario, for pre-disaster recovery planning, we assume the cost (the number of UAVs and CSs) is known and after the disaster, we try to locate UAVs and CSs along with planning for backup UAVs in such a way to minimize the outage probability.By analyzing the effects of optimization parameters, while simplifying the optimal algorithm, we propose sub-optimal algorithms for both scenarios.Then, using the simulations, we show that the sub-optimal algorithms achieve performance very close to the optimal solutions while their computational load and running time are much less.Moreover, to give a holistic view to the reader, we investigate the effect of key channel parameters as the ratio of the number of UAVs in service to total number of UAVs, the obtained planning for backup UAVs to prevent the UAVs in service from falling, and the number of CSs along with the effect of battery energy density.

II. THE SYSTEM MODEL
We consider a series of UAVs in order to relay data from the nearest CN to the DA as shown in Fig. 1(a) (see Table I for notation).The main challenge of this link is that the UAVs have a limited flight time.Therefore, in order to create a permanent link, it is necessary that along with the UAVs in service, a set of backup UAVs are also available to replace the UAVs in service as shown in Fig. 1(a).Let N s , N r , and N c denote the number of UAVs in service, number of backup UAVs, and number of CSs, respectively, U i represents the ith UAV in service for i ∈ {1, . .., N s }, U r j is the jth backup UAV for j ∈ {1, . .., N r }, and C m is the mth CS for m ∈ {1, . .., N c }.We consider that the nearest CN and DA are at [0, 0, 0] and [L cr , 0, 0] in a Cartesian coordinate system [x, y, z] ∈ R 1×3 , respectively, where L cr is the link length between CN and DA.Also, p u i = (x u i , y u i , z u i ) and p c m = (x c m , y c m , z c m ) represent the positions of the ith UAV in service and the mth CS, respectively.
When U i is running out of charge, to replace it, the backup UAV flies from C m toward the U i with speed v im .In particular, the backup UAV flies in a sloping path to reach the U i where the velocity of the backup UAV in the sloping path is denoted by v i = (v im , φ im , θ im ) in spherical coordinate as shown in Fig. 1(b).The parameters φ im and θ im are formulated as (1)

A. UAV POWER CONSUMPTION MODEL
To design the considered system, we need to accurately model the power consumption of the UAV as a function of the flying model and speed.For the considered system, in service mode, UAVs are in hovering mode, and in backup mode, they are in flight mode.

1) FLYING MODE
Following [24], [25], the power consumption of the UAV in the forward flight mode is modeled as follows: where P blade (v im ) and P fuselage (v im ) are respectively the required powers to overcome the profile drag forces of the blades, and the fuselage that oppose its forward movement, while, P induce (v im ) is the induced power from the rotation of rotors and they are formulated as [26]: ( , 2577 , v tip is the tip speed of rotors, A f is the fuselage area, C d is the drag coefficient, p is the profile drag coefficient, s is the rotor solidity, M rot is the number of rotors, and w is the weight of UAV in Newton.

2) HOVERING MODE
The UAVs in service are in hovering mode, in which the power consumption of the UAV is modeled as [26]:

B. CHANNEL MODELING
To relay information by a set of UAVs to the disaster area, we need a point-to-point high-capacity wireless backhaul link.
According to the topology, the best option is to use directional high-frequency mmWave or THz links [17].Let h i denotes the instantaneous channel coefficients between The directional UAV-based THz channel can be well modeled as [27] where h p i is the normalized pointing error (or misalignment fading), h a i is the small-scale fading, G 0 is the maximum antenna pattern gain, denotes the molecular absorption loss where K( f ) is the frequency dependent absorption coefficient, and L i is the link length.We consider that each U i has two N u × N u array antennas, one of which is directed to U i+1 and the other to U i−1 .Directional mmWave/THz links are sensitive to UAV instabilities and cause random misalignment errors known as pointing errors.Following the results of [27, Theorem 1], for a N u × N u array antenna, the distribution of the pointing errors of inter-UAV links is modeled as , and σ 2 u is the variance of antenna orientation fluctuations of UAV node.Also, following the results of [28,Theorem 2], for a N g × N g array antenna, the distribution of the pointing errors of ground-to-UAV link is modeled as where w Bg = 1 N g is the antenna beamwidth of the ground station, g is the variance of antenna misalignment of the ground station, and G g0 π N 2 g .In THz channels, the α-μ distribution is one of the most widely used models employed for the distribution function of RV h a i which is given as where α > 0 reflects the nonlinearity of the fading channel, μ is the normalized variance of the fading channel envelope, , W = μ ĥa α , and ĥa is the α-root mean value of the fading channel envelope.

III. PROBLEM FORMULATION
To design the considered system, we tackle two different optimization approaches that match realistic setups, which are explained below.

A. MINIMIZATION OF THE COST FUNCTION
The cost of implementing such a system includes the number of UAVs in service, the number of backup UAVs, and the number of CSs, which is formulated as: where Cost u is the cost of the each UAV, Cost C is the cost of each charge station, and α c = Cost c /Cost u .The goal is to design the considered system in such a way that the cost function is minimized while guaranteeing the requested quality of service (QoS).For wireless links, usually outage probability (OP) (denoted by P ou ) is used as the QoS [29].To this end, we have where P ou,th is the threshold OP.The tunable parameters for optimization include two categories of discrete and continuous parameters.The tunable discrete parameters include N s , N r and N c .The tunable continuous parameters include the position of the UAVs in service denoted by p u i for i ∈ {1, . .., N s }, the position of the CSs denoted by p c m for m ∈ {1, . .., N c }, and the speed of the backup UAVs which flies from C m to U i denoted by v im for i ∈ {1, . .., N s }.In addition to these parameters, another important tunable parameter is the planning for backup UAVs to cover UAVs in service.
In particular, how many and which UAVs in service can be covered by the jth backup UAV for j ∈ {1, . .., N r }, which we will discuss more in the next section.To formulate this assignment planning for the backup UAVs, we define vector which is a vector with M j elements.M j specifies the number of UAVs in service supported by the jth backup UAV.For example, s 3 = [2, 4, 6, 9] indicates that M 3 = 4 and U 2 , U 4 , U 6 , and U 9 are covered by U r 3 .For this assignment, all UAVs in service must be covered, and vectors s j and s i should be disjoint (their intersections should be empty) for any i, j ∈ {1, . .., N r } and i = j, which are formulated as: Let E i (t ) represent the instantaneous energy of U i .In order to prevent U i from falling while in service, its energy must be greater than a threshold E min , which is expressed as E i (t ) > E min .Also, for flight safety, the speed of the UAV cannot exceed a maximum value as v im < v max .Finally, based on the explanations, the optimization problem to reduce the implementation cost is formulated as follows: min where the set of tunable parameters S c1 is

B. MINIMIZATION OF THE OUTAGE PROBABILITY
Optimization problem ( 12) is suitable for reducing the implementation cost of the system.It is better to optimize the system based on (12) for bad environmental conditions.After the implementation of the system, the number of CSs and UAVs is known, and minimizing the cost is no longer an issue.In this case, with every change of channel conditions, we have to update the optimal system parameters while the number of UAVs and CSs is known.Therefore, after the implementation, the goal is to optimize the system parameters to improve the system performance, or in other words, the OP is minimized.
Let N tot be the number of UAVs, which is now a constant parameter.In this case, optimization problem ( 12) is modified as follows: min (12c), (12d), (12e), and, (12f), where the set of tunable parameters S c1 is The difference between the optimization parameters defined in (13) and (15) is that in (15), N c is a constant value and we also know that N s + N r = N tot .
As can be seen, both optimization problems ( 12) and ( 14) are mixed integer nonlinear programming problem.Therefore, in the next section, several sub-optimal algorithms are introduced to solve the above two optimization problems.

IV. OPTIMAL SYSTEM DESIGN
Next, we will try to solve the optimization problem by analyzing the parameters of the considered system.To this end, the positioning of UAVs and CSs is investigated first, and then, with the obtained results, we proceed to optimize of the rest of the parameters.

A. UAVS POSITIONING
Regardless of the rest of the system parameters, the OP is only a function of the UAVs in service and their positions.Therefore, in the following, we first obtain the OP as a function of the number and position of UAVs in service.

1) OUTAGE PROBABILITY ANALYSIS
For the considered decode-and-forward multi-relay system, the OP is obtained as where h th is the channel coefficient threshold.Given that h i s are independent, ( 16) is simplified as where P g ou j is the outage probability of the first ( j = 1) and last link ( j = N s + 1), while P u ou i is the outage probability of the inter UAV links for i ∈ {2, . .., N s }.Using ( 5), ( 6), ( 8) and following the results of [27], P u ou i is obtained as where is the Whittaker function [30], and 2 .Also, using ( 5), ( 7), (8) and following the results of [28], P g ou j is obtained as where 2

) POSITIONING TO MINIMIZE THE COST
The outage probability provided in ( 17) is a function of all the real channel parameters, such as the number of UAVs in service, positions of the UAVs, antenna pattern, UAVs' vibrations, link length, and small-scale fading.For the optimization problem (12), condition (12b) must be satisfied, which is directly related to the positioning of U i s.Let L 1 , L N s +1 represent the link lengths of the first ground-to-UAV (GU) link and last UAV-to-ground (UG) links, respectively, and L i for i ∈ {2, . .., N s } represent the links between U i−1 and U i .According to the symmetry of the problem, we know that the inter-UAV links are equal, i.e., L i = L j for i ∈ {2, . .., N s }.Therefore, the optimal solution is simplified to find the three continuous parameters L 1 , L 2 , L N s +1 and N s which is formulated as: min Based on ( 17), (18), and ( 19), these parameters L 1 , L 2 , L N s +1 , and N s are correlated together.Therefore, optimization problem (20a) is a 4-dimensional optimization problem with three continuous variables and one discrete variable.As a sub-optimal method, for the low OPs, ( 17) can be simplified as: We also assume that the UAVs are positioned in such a way that the OP between all links is equal.Using this and based on (19), and ( 21), the parameters L 1 and L N s +1 are obtained separately as: Note that the term |P g ou j (L j ) − P ou N s +1 | is a Convex function of L j and as a result, the sub-optimal value for L 1 and L N s +1 are easily obtained from (22).Using obtained L 1 and L N s +1 , the position of U 1 and U N s are computed as where ψ s,min and ψ d,min are respectively the minimum acceptable elevation angles of CN and DA to provide LoS connectivity for considered THz links as shown in Fig. 1(a).Now, using ( 18) and ( 21), the maximum acceptable value of L i for i ∈ {2, . .., N s } is derived as Since the number of UAVs is an integer variable, it is not possible to reach the value obtained in (24) for L i .However, (24) tells us that the UAVs should be placed on the connecting line between p u 1 and p u Ns with equal distances in such a way that the distance between the UAVs is not greater than L i,max .Therefore, the sub-optimal values for L i and N s are obtained as: where 3: Find N s and L i for i ∈ {2, . .., N s } using( 18), (24), and (25).4: Compute p u i for i ∈ {2, . .., N s − 1} using ( 27) and (28).
Using results of ( 25), the sub-optimal position of U i for i ∈ {2, . .., N s − 1} is obtained as: where In Algorithm 1, the sub-optimal method is provided to find N s , and p u i s, which is much faster than the 4-dimensional optimization problem (20a).
Remark 1: Considering that the value of N s is discrete, in the simulations, it is shown that in most cases, the sub-optimal value of N s obtained from Algorithm 1 is equal to the optimal value obtained from (20a).

3) POSITIONING TO MINIMIZE THE OP
In this case, because N tot = N s + N r is known, then the optimal number of N s depends on N r .However, for each N s , the optimal position for U i s is obtained as: min As a sub-optimal method, we assume that P u ou i P g ou j .Therefore, for each L 2 , we can calculate L 1 and L N s +1 as: Using (30), for any given N s , Algorithm 2 is provided to find the sub-optimal values of L i s.The parameter L pric in Algorithm 2 is defined for the accuracy of the calculations.Remark 2: In (30), the parameters L 1 and L N s +1 are convex functions of the terms J 1 = |P For the proof of Remark 2, please refer to Appendix A. Remark 3: It should be noted that, unlike Algorithm 1, in Algorithm 2, we cannot determine N s because we need to know N r , while N r itself is a function of other parameters that will be discussed further.

B. POSITIONING OF CS
The position of charge stations is a function of N s , N r , N c , and the position of UAVs in service.For any given N s and N c , we have: where the parameter X is a function of θ 1N s used to limit the search interval and increase the optimization time.
Remark 4: To find the optimal position for CSs, as starting points, we fist find the the sub-optimal positions p c m for m ∈ {1, . .., N c } as Then, according to whether θ 1N s is positive or negative, the optimal positions shift towards the disaster area or CN.
For the proof of Remark 2, please refer to Appendix B. Using the results of Remark 4 helps us to limit the range of optimal positions for CSs and increase the speed of solving the optimal problem.

C. OPTIMAL PLANNING FOR BACKUP UAVS
Having optimal planning for backup UAVs helps to reduce the implementation cost and the replacement time.Designing an optimal plan for backup UAVs includes finding the optimal vectors s j for j ∈ {1, . .., N r } along with the UAVs' speed v im s to manage the time and energy consumption of backup UAVs.

1) SIMPLE SUB-OPTIMAL SOLUTION
As a sub-optimal and simple solution, we backup one UAV for each UAV in service, i.e.N s = N r .In this case, there is no need to optimize s j and v im .In simulations, the performance of this method is compared with the rest of the proposed algorithms.

2) OPTIMAL FLIGHT SPEED
To prevent UAV crashes and based on (12e), for all U i s we must to have: where E tot is the maximum battery capacity or energy of the UAV, E f im (θ im , v im ) = P f im (θ im , v im )t f im is the energy consumption of UAV to fly from C m to U i with flight time t f im = L im v im , E h i = P h t h i , is the energy consumption of hovering U i during service time t h i .Moreover, L im is the link length from C m to U i , and θ im is its Zenith angle as shown in Fig. 1(b), which are formulated as: Optimal flight speed v im is a function of L im and t h i .For any given L im , the optimal v im is equal to the speed that maximizes the hovering time of U i .Therefore, we have: To get a better view, in Fig. 2(a)-(c), we respectively plot the power consumption, energy consumption, and hovering time versus v im .The result of Fig. 2(a) shows that the optimal selection of v im is important to minimize the power consumption.However, it should be noted that although the power consumption may be reduced by reducing the speed, it increases the flight time and increases the energy consumption.Therefore, in Fig. 2(b) and (c), we have drawn energy consumption and hovering time over a wide range of (L im = 2 − 20 km).It can be easily concluded that the optimal value for v im is the maximum acceptable value, i.e., v im = v max , where v max is the maximum allowed speed of the UAV to ensure the safety of the flight.Moreover, the maximum speed during the replacement of UAVs helps us to make the replacement time faster and a backup UAV can cover a larger number of UAVs.Therefore, the maximum hovering time of U i as a function of L im is obtained as 3) OPTIMAL PLANNING In order for the jth backup UAV to be able to cover the set of UAVs in service s j , we must have: where t c is the charging time of the UAV at the charge station.
To get a better understanding of (37), a graphical example is provided in Fig. 3, where the first backup UAV using the first charging station wants to cover the set of U 1 , U 2 , and U 3 .In this example, we have s 1 = [1, 2, 3] and M j = 3.As we can see, when the backup UAV replaces U 1 , until the time interval of the next replacement, the backup UAV must fly the routes 1-6 specified in Fig. 3.In addition, it needs to be recharged M j = 3 times along the flight.Therefore, to prevent the U i s from falling for i ∈ {1, 2, 3}, we must have: Using (36) and (37), to prevent the U i s from falling, the following condition must be met: Using the obtained results, as a sub-optimal design of the considered system, we propose Algorithms 3 and 4 to reduce cost and to decrease end-to-end OP, respectively.In Algorithm 3, x and x are the floor and ceil functions of x, respectively.To run Algorithm 3, we already obtained the sub-optimal values for N s and p u i s in Compute p c m using (32).7: Compute L im using (34) for i ∈ 1, . .., M j .8: if condtion (39) is true for i∈s j L im then 9: N s = N s − M j , N r = N r − 1, M = M + M j .10: else 11: Return to line 3. 12: end if 13: end for 14: if Cost > N c + N r + N s then 15: Assign U i s For i ∈ {M + 1, . .., M + M j } to s j .16: Cost = N c + N r + N s .17: end if 18: end for Algorithm 1. Finally, by using Algorithms 1 and 3, a suboptimal design of the considered system is obtained including the number of UAVs in service and their positions, the number of backup UAVs and their timing and the UAVs covered by them, as well as the number and positions of CSs.Also, by running Algorithm 3, we can reach the optimal design of the considered system, on the condition that we use the optimal values for N s , and P u i s obtained in (20), as well as the optimal values for P c m s obtained in In order to obtain the optimal values in (20) and we use optimization solvers that reach the solution by exhaustive search.However, decrease the optimization running time, one can use the obtained sub-optimal results as the initial values and narrow the search range, which increases the optimization speed.Return to line 1. 11: end if 12: end for After designing and implementing the system by Algorithm 3, with every change in channel conditions, we must update the optimal design of the system by Algorithm 4. As we show in the simulations, due to the discreteness of values of N s , N r , and N c , the results of the sub-optimal algorithms are equal or very close to the optimal values.

V. SIMULATION RESULTS
In this section, using simulations, we evaluate the performance of the considered system.The proposed algorithms were different for the two approaches, in the first step we evaluate the optimal design to reduce the cost of implementation.The parameter values used for simulations are listed in Table 2, which are the commonly used values in the literature [25], [26], [27], [28].
In Fig. 4, for a 54 km link length between the CN and DA, and for a different number of CSs, the minimum number of UAVs required to establish such a link has been obtained using the proposed algorithm.The results of the proposed algorithm are compared with the results obtained from the optimal algorithm.The results of the optimal algorithm have been obtained from an extensive search and the use of MATLAB optimization toolbox according to the explanations provided in the previous section, which is very time-consuming.Also, TABLE 2. Parameter Values Used in the Simulation a simple planning method was provided to assign a backup UAV for each UAV in service.For simulations, the battery capacity of each UAV is considered to be E tot = 200 Wh.From the results of Fig. 4, we understand that the number of UAVs in service to guarantee the requested QoS is equal to 22, because the number of backup UAVs obtained by the simple planning method is equal to the number of UAVs in service.As we observe, the proposed sub-optimal algorithm performs much better than the simple planning method, and with a smaller number of backup UAVs, it can guarantee that none of the UAVs in service will crash.Another important point is that the proposed algorithm, despite having lower complexity and computational load, reaches the optimal algorithm performance in most cases.The reason for this is that the variables related to the number of UAVs are discrete.
The results of Fig. 4 only give us information about the minimum number of UAVs and CSs.To get a better view of the results of Fig. 4, the position and clustering of UAVs obtained by the proposed algorithm are shown in Fig. 5(a)-(c).The results show that when only one CS is used, the distance between the CS and the UAVs at the beginning and end of the relay system increases, and as a result, the backup UAV must spend more time and energy to replace the UAVs in service.Therefore, for the number of UAVs with a longer distance, we will have to backup one UAV for each UAV in service.However, by increasing the number of CSs to 2 and 3, we can see that the distance between the CSs and the UAVs in service is reduced and the proposed algorithm can support more UAVs in service with each backup UAV so that UAVs do not fall.However, choosing the optimal number of CSs depends on the cost difference between the CS and the UAV.Usually, in addition to this cost, CSs face the cost of positioning and maintenance, which varies depending on the geographical and environmental conditions.
One of the important parameters affecting the optimal design of the desired system is the battery capacity of the UAV.Unlike surface electrical vehicles, weight is a fundamentally limiting factor in determining the battery capacity of UAVs and makes UAV power systems particularly complex.Today's typical lithium-ion batteries produce around 250 Wh/kg [31].Lithium Sulfur battery is a next-generation technology, which provides a lighter option for UAV-based applications that require higher energy density [32].In comparison to the extent lithium-ion battery technologies in the market, lithium Sulfur provides higher energy density (theoretically up to 2600 Wh/kg) [32], [33].To this end, in Fig. 6, we have analyzed the energy density feature of batteries which is a function of technology and materials.In particular, by considering the same weight for the batteries, we assumed that the batteries have different energy densities and thus, have different capacities.The results of Fig. 6 are obtained for a wide range battery capacity (E tot = 100 − 300 Wh).The results clearly show that by increasing the battery capacity from 100 to 200 Wh, the number of required backup UAVs decreases from 15 to 6. Therefore, choosing the right battery considering the capacity, weight, price, and charging speed is very important in the optimal design of the considered system.
The aim of designing this system is to prepare for critical conditions and quickly establish a backhaul link to the DA from the nearest CN.Therefore, this design should be done before the crisis, and equipment related to UAVs and charging stations should be ready.Therefore, the initial design to reduce the cost of implementation should be done in such a way that covers a wide range of channel link lengths.After the initial design, the number of UAVs N tot and charging stations is known, and we only need to have a positioning and planning for them using Algorithm 4 to improve the performance of the system.Therefore, in Fig. 7, the performance of Algorithm 4 has been examined for E tot = 200 Wh, N c = 2, and a wide range of link lengths.Based on the results of Fig. 7(a), in order to guarantee the QoS of the backhaul link, N tot = 25 can cover a maximum of 47 km link, while for N tot = 30 and 40, the backhaul link of 57 and 70 km can be covered.Likewise, in Fig. 7(b), using Algorithm 4, the optimal number of backup UAVs according to each link length is provided to achieve the best performance.The results show that with each change in the link length, re-planning is required for the backup UAVs.

VI. CONCLUSION
The main goal of this work is to design a long backhaul link using a set of UAVs to connect the DA to the nearest CN.To this end, we considered two scenarios.In the first scenario, for the case where the physical characteristics of an area (such as the link length, obstacles, wind speed) are known, we proposed an optimal algorithm that, while finding the optimal position for UAVs in service and the optimal position for CSs, it also obtains an optimal planning for backup UAVs so that while guaranteeing the outage probability, the implementation cost decreases.For the second scenario, when the number of UAVs and CSs are known, we proposed an optimal algorithm that finds the optimal positions for UAVs and CSs along with planning for backup UAVs to minimize the outage probability.Finally, by providing simulations, we studied the effect of important parameters such as the number of required UAVs and the number of CSs to provide a reliable long backhaul link.We showed that increasing the number of CSs reduces the flight path in the replacement mode and reduces the number of backup UAVs.Also, the effect of UAV battery capacity and link length on the required number of UAVs was investigated.

APPENDIX A
The function P u ou 2 (L 2 ) conditioned on L 2 is constant and positive.Also, P g ou 1 (L 1 ) is a positive and ascending function of L 1 .Moreover, based on the results of [28], for L 1 = L 2 , we have P g ou 1 (L 1 ) ≤ P u ou 2 (L 2 ), which results in the optimal value of L 1 ∈ [L 2 , ∞].Therefore, by increasing L 1 from L 2 , first, P g ou 1 (L 1 ) increases towards P u ou 2 (L 2 ), and thus, J 1 tends to zero.Then, with the further increase of L 1 , P g ou 1 (L 1 ) becomes larger than P u ou 2 (L 2 ), and as a result, J 1 increases again and we can conclude that J 1 is convex function of L 1 .Similarly, it can be shown that J N s +1 is also a convex function of L N s +1 .On the other hand, since the transmission power of the ground station is greater than the UAV due to the UAV's power limitations, for L 1 = L 2 = L N s +1 , we always have P g ou 1 (L 1 ) ≤ P g ou Ns+1 (L N s +1 ) ≤ P u ou 2 (L 2 ), and thus, we conclude that the following relationship exists between the optimal values of L 1 , L 2 , and L N s +1 as As can be seen, ( 40) is used in lines 2-10 of Algorithm 2 for faster convergence.

APPENDIX B
As a sub-optimal solution, we assume that θ 1N s 0. Under this assumption, due to the symmetry, the optimal position of the charge stations is obtained as a function of the position of the UAVs in service as follows: for m ∈ {1, . .., N c }.For θ 1N s < 0, the UAVs' altitudes at the beginning of the line (UAVs close to the CN) increase, and the UAVs' altitudes at the end of the line (UAVs close to the DA) decrease, which increases the link length between C m and the UAVs close to the CA, and reduces the link length between C m and the UAVs close to the DA.Therefore, in this case, compared to the initial position obtained in (41), the optimal position p c m is shifted towards the CN.Similarly, it can be justified that if θ 1N s > 0, the optimal position p c m shifts towards the DA.

FIGURE 1 .
FIGURE 1.(a) An illustration of the considered permanent backhaul links using charge stations and backup UAVs to transfer data from the nearest CN to the DA.(b) The backup UAV flies from C m toward the U i with speed vector v i = (v im , φ im , θ im ).

FIGURE 2 .
FIGURE 2. Investigating the effect of UAV's speed on (a) power consumption for different UAV's weight; (b) Energy consumption for different flying lengths; and (c) maximum obtained hovering time for different flying lengths of backup UAV.

FIGURE 3 .
FIGURE 3. Graphical example of planning for the first backup UAV where U r1 uses the first CS and covers the set of U 1 , U 2 , and U 3 .

Algorithm 3 :
Backup Planning to Minimize the Cost for any given N s .Input: N s , p u i Output: N r , N c , Cost, s j for j ∈ {1, . .., N r } Initialize C ost = 3N s .1:

FIGURE 4 .
FIGURE 4. Minimum number of obtained backup UAVs from the sub-optimal algorithm versus N c for a 54 km link length and comparing it with the minimum number of backup UAVs obtained from the optimal and simple planning algorithms.

Algorithm 4 :
Backup Planning to Minimize the OP when N c and N tot = N r + N s are known.Input: N c , p c m , N tot Output: N s , N r , P ou Initialize N s = N tot .1: Update N s = N s − 1. 2: Find P ou and p u i using Algorithm 2. 3: N r = N tot − N s , N r = N r , N s = N s .4: for j = 1 : N r do 5: M j = N s /N r , m = jN c /N r .6: Compute L im using (34) for i ∈ 1, . .., M j .7: if condtion (39) is true for i∈s j L im then 8: N s = N s − M j , N r = N r − 1, M = M + M j .9: else 10:

FIGURE 5 .
FIGURE 5. Graphical illustration of the results obtained from Fig. 4, including the position of UAVs in service and how they cover by backup UAVs for (a) N c = 1; (b) N c = 2); and (c) N c = 3.

FIGURE 6 .
FIGURE 6. Investigating the effect of UAV battery capacity on the number of backup UAVs for two different numbers of N c .

FIGURE 7 .
FIGURE 7. (a) Minimum outage probability obtained from Algorithm 4 versus L cr for different values of N tot .(b) Number of backup UAVs obtained from Algorithm 4 versus L cr for different values of N tot .

Algorithm 2 :
Ns+1 (L N s +1 ) − P u ou 2 (L 2 )|, respectively.We also know that L 1 > L N s +1 .Using this information in lines 2 and 10 of Algorithm 2, it can be seen that the algorithm converges quickly.Positioning of UAVs in Service to Minimize the OP for any Given N s .Input: N s , L cr , ψ s,min , ψ d,min , L pric Input: {L 1 , . .., L N s +1 } Initialize L 2 = L cr /(N s + 1).Initialize L 2,max = L cr /(N s + 1), L 2,min = 0. while |L sd − L cr | > L pric do 5: if L sd < L cr then 6: Update L 2,max = L 2 , and L 2 = Do lines 1-3 and update L 1 , L N s +1 , and L sd .11: end while g ou