{'fraction_non_alphanumeric': 0.02756141402037148, 'fraction_numerical': 0.010975543330246746, 'mean_word_length': 4.592293633871459, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Energy-aware Relay Positioning in Flying Networks

The ability to move and hover has made rotary-wing Unmanned Aerial Vehicles (UAVs) suitable platforms to act as Flying Communications Relays (FCR), aiming at providing on-demand, temporary wireless connectivity when there is no network infrastructure available or a need to reinforce the capacity of existing networks. However, since UAVs rely on their on-board batteries, which can be drained quickly, they typically need to land frequently for recharging or replacing them, limiting their endurance and the flying network availability. The problem is exacerbated when a single FCR UAV is used. The FCR UAV energy is used for two main tasks: communications and propulsion. The literature has been focused on optimizing both the flying network performance and energy-efficiency from the communications point of view, overlooking the energy spent for the UAV propulsion. Yet, the energy spent for communications is typically negligible when compared with the energy spent for the UAV propulsion. In this article we propose Energy-aware RElay Positioning (EREP), an algorithm for positioning the FCR taking into account the energy spent for the UAV propulsion. Building upon the conclusion that hovering is not the most energy-efficient state, EREP defines the trajectory and speed that minimize the energy spent by the FCR UAV on propulsion, without compromising in practice the Quality of Service offered by the flying network. The EREP algorithm is evaluated using simulations. The obtained results show gains up to 26% in the FCR UAV endurance for negligible throughput and delay degradation.


INTRODUCTION
In recent years there has been an increase in the usage of Unmanned Aerial Vehicles (UAVs) for a myriad of applications 1 . Their capability to operate almost everywhere, their ability to hover, and their increasing capacity to carry cargo on board make UAVs suitable platforms to act as Flying Communications Relays (FCRs). This reality has prompted the interest in using flying networks to establish and reinforce communications and enable broadband Internet access in temporary events 2,3 , as depicted in Fig. 1. A major challenge in flying networks when compared with ground networks is the UAV endurance. As the UAVs are not connected to the electrical grid, they rely on their on-board batteries, which can be drained quickly. For this reason, the UAVs typically need to land frequently for recharging or replacing their batteries, which limits the UAV endurance and the flying network availability 4 . The problem is exacerbated if the UAV plays the role of FCR UAV, especially in a flying network composed of a single FCR. Since the FCR UAV is responsible for forwarding the traffic to/from the Internet, its available energy directly affects the Quality of Service (QoS) offered by the flying network. If the FCR UAV becomes unavailable due to energy shortage, the rest of the network will be unable to connect to the Internet.
Energy in flying networks composed of UAVs is used for two main tasks: communications and UAV propulsion 5 . While the energy spent for communications is typically negligible, the energy spent for propulsion should be taken into account when defining the positioning of the UAVs. In this article, we assume the flying network is composed of rotary-wing UAVs, which are divided into two types: Flying Access Points (FAPs) and FCR UAVs. Solutions have been proposed in the literature to define the positioning and trajectories of 1) FAPs, considering the radio coverage, the number of ground users served [6][7][8][9] or the QoS offered to the ground users 3,10-14 , and 2) UAVs acting as relays between ground nodes [15][16][17] . However, most of the works have been focused on optimizing both the flying network performance and energy-efficiency from the communications point of view [18][19][20][21] , overlooking the energy spent for the UAV propulsion.
The main contribution of this article is the Energy-aware RElay Positioning algorithm (EREP) for flying networks with controlled topology. Building upon the conclusion that hovering is not the most power-efficient state 22 , EREP defines the trajectory and speed of a rotary-wing FCR UAV that minimizes its energy consumption for propulsion, without compromising the QoS offered by the flying network. EREP represents a step forward with respect to the algorithm proposed by Coelho et al. 23 , which defines the positioning of an FCR UAV from the network performance point of view, without considering the energy consumption of the UAV.
The rest of this article is organized as follows. Section 2 presents the related work. Section 3 presents the system model and formulates the problem. Section 4 presents the EREP algorithm. Section 5 presents the evaluation of the EREP algorithm using simulations. Finally, Section 6 points out the main conclusions and future work.

RELATED WORK
In order to ensure energy-efficiency in communications, the literature has been focused on optimizing the performance of different communications layers: 1) network layer, by designing energy-aware routing protocols that define the forwarding tables based on the energy available in the UAVs [24][25][26] ; 2) data link layer, by enhancing the MAC scheme, including the usage of sleep modes on idle communications nodes 27,28 ; and 3) physical layer, by optimizing the hardware and the communications tasks related to the signal transmission and processing 29 . Nevertheless, the energy used in communications is typically negligible when compared with the energy spent for the UAV propulsion. For instance, a typical IEEE 802.11n Network Interface Card has a maximum power consumption of about 2 W 30,31 , while the propulsion power consumption of a UAV in hovering state can be higher than 150 W, as depicted in Fig. 3. A reference work on joint energy-efficiency and trajectory optimization for an FCR UAV was done by Zeng et al. 32 . The authors derived a theoretical model for estimating the energy spent for the UAV propulsion, based on the speed, direction, and acceleration of the UAV, and proposed a circular trajectory in which the radius and the flight speed are optimized to maximize the energy efficiency -defined as bit∕J. However, the proposed model is tailored for fixed-wing UAVs and considers a single ground user only. Li et al. 33,34 proposed an energy-efficiency model for a multi-UAV flying network, including components regarding the UAVs' energy consumption and the deployment strategy for recharging the UAVs, in order to provide seamless long-term coverage. However, the UAVs are positioned in hovering state to provide communications cells and their movement to/from the charging station is not performed at the speed that minimizes their energy consumption.
When it comes to the FCR UAV positioning challenge, Coelho et al. 23 proposed a traffic-aware positioning algorithm for flying networks with controlled topology. The proposed algorithm considers the traffic generated by each of the FAPs to define the position of the FCR, which acts as a flying gateway between the FAPs and the Internet. However, the proposed algorithm neglects the energy consumption for the UAV propulsion. A reference work on energy-efficiency for rotary-wing UAVs was done by Zeng et al. 22 , who have concluded that the power consumption does not have a uniform behaviour: the power consumption for low speed values is lower than the power consumption for hovering and it becomes higher as the speed increases. Therefore, hovering is not the most power-efficient UAV state. In order to improve energy-efficiency, the authors propose a fly-hover approach, in which the FCR UAV moves between different waypoints, where it hovers for a period of time for providing communications for each ground user, in a Time-Division Multiple Access scheme. Demir et al. 35 studied the power-aware deployment of a UAV, considering flight dynamics and QoS guarantees for the users being served. Still, their work is focused on the influence of the altitude, hardware components, and payload weight in the UAV power consumption, considering the UAV is hovering. Wang et al. 36 proposed a two-stage joint hovering altitude and power control model for space-air-ground communications using UAVs. A related research work was carried out by Babu et al. 37,38 , who derived the optimal altitude for rotary-wing UAVs acting as FAPs, taking into account both the UAVs energy consumption and the communications performance. Nevertheless, these works consider the UAVs in hovering state only.

SYSTEM MODEL AND PROBLEM FORMULATION
The flying network, which is assumed to be organized into a two-tier architecture, is composed of two types of UAVs: 1) FAPs, which provide Internet access to ground nodes; 2) a single FCR UAV, which forwards the traffic to/from the Internet, as depicted in Fig. 2. The positions of the FAPs are assumed to be defined by a state of the art FAP positioning algorithm, such as the centralized algorithm proposed by Almeida et al. 3 . The FAP positioning algorithm is assumed to run on a Central Station (CS). The CS periodically determines the coordinates of the FAPs based on the traffic demand of the ground nodes, which is collected by the FAPs themselves and transmitted to the CS. The FCR UAV positioning is defined by the CS considering the current FAPs' coordinates and traffic demand. Finally, the CS is in charge of sending the updated positions to both the FAPs and the FCR UAV, which position themselves accordingly.
In the following, we formulate the problem addressed in this article. To calculate the received power, as there is Line-of-Sight (LoS) between the FCR UAV and the FAPs, the Free-Space Path Loss model defined in (1) 39 is considered. This assumption is supported by Khuwaja et al. 40 and Almeida et al. 14 , who have concluded, based on experimental results, that Free-Space Path Loss model is the most adequate to characterize the wireless link between a UAV and a communications node close to the ground in terms of the path loss component.
In (1), stands for the power received at the FCR UAV, is the transmission power of each FAP, the wavelength is equal to ∕ , where is the speed of light in vacuum and is the carrier frequency, is the mathematical constant defined in Euclidean geometry as the ratio of a circle's circumference to its diameter, and represents the distance between the transmitter and receiver UAVs. We assume that the maximum channel capacity is equal to the data rate associated to the Modulation and Coding Scheme (MCS) index selected by the nodes. Each MCS index requires a minimum value of Signal-to-Noise Ratio, = ∕ 0 , which is derived from considering a constant noise power 0 . The wireless medium is shared, so we assume that every UAV can listen to the other UAVs. For Medium Access Control (MAC) the Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is employed.

FIGURE 2
Flying network organized into a two-tier architecture. The FAPs provide Internet access to the ground users and the FCR UAV forwards the traffic to/from the Internet. The flying network is controlled by a Central Station (CS) deployed at the Edge or in the Cloud. An example trajectory defined by the EREP algorithm is depicted by the red arrows 23 . The power consumed by the UAV for propulsion was defined by Zeng et al. 22 as having three components: 1) blade profile, which is the power required to overcome the profile drag of the blades; 2) induced, which is required to overcome the induced drag of the blades; and 3) parasite, required to overcome the fuselage drag. As such, while the blade profile power increases quadratically with , the parasite power increases cubically with . On the other hand, the induced power decreases with . The equation for calculating the power consumed by the UAV while moving at speed is given in (2) In (2), the first addend represents the blade profile component, where is a constant representing the blade profile power in hovering state, and denotes the tip speed of the rotor blade. The second addend represents the induced power component, where is a constant representing the induced power in hovering state, and 0 is the mean rotor induced velocity in hovering state. The third addend represents the parasite component, where 0 is the fuselage drag ratio, denotes the air density, represents the rotor solidity, and represents the rotor disc area. These parameters can be obtained from the UAV specifications, with the exception of , whose value depends on the environment. The analysis of (2) made by Zeng et al. 22 shows that there is a range of UAV speeds for which the power consumed by the UAV is lower than the power consumed for hovering. By defining = 0 in (2), we conclude that the power consumption in hovering state is equal to + , which represents a finite value that changes according to factors such as the UAV weight, air density, and rotor disc area. When increases, ( ) firstly decreases and then increases with . This allows to conclude that hovering is not the most efficient state when it comes to the UAV power consumption. This behavior is depicted in Fig. 3. In our problem, the flying network is modeled as a directed graph = ( , ) where = { 0 , ..., −1 } is the set of UAVs positioned at = ( , , ) and ⊆ × is the set of directional links between UAVs and , with ( , ) ∈ and , ∈ . Let us assume that each , ∈ {1, ..., − 1}, performs the role of FAP and transmits a traffic flow 0, towards 0 , which performs the role of FCR UAV. In this sense, we have a tree ( , ) that is a subgraph of , where ⊂ is the set of direct links between each and 0 . This tree defines the flying network active topology, which is composed of single-hop paths.
Considering the 0 endurance and 0 ≤ ≤ , we aim at determining the trajectory 0 ( ) = 0 ( ), 0 ( ), 0 ( ) of 0 , such that the power 0 ‖ ‖̇ 0 ( ) ‖ ‖ consumed by 0 for propulsion is minimal, where ‖ ‖̇ 0 ( ) ‖ ‖ represents the 0 speed at time instant , and the transfer of all traffic flows 0, with bitrate ( ), in bit/s, is guaranteed, taking into account the maximum power 0 and the maximum speed 0 allowed by 0 . For that purpose, a wireless link with high enough capacity 0, ( ) to accommodate ( ) must be ensured between each , ∈ {1, ..., − 1}, and 0 , while the aggregate capacity of the wireless links must be lower than or equal to the maximum capacity of the wireless channel. This is accomplished by ensuring the minimum at that enables the selection of an MCS index characterized by a data rate higher than or equal to ( ) bit/s, which depends on the Euclidean distance between each and 0 , and the transmission power of the UAVs, whose maximum value is defined based on the wireless technology used. Our objective function is defined in (3a).
subject to: In the defined optimization problem, the following constraints are considered for any time instant : • (3b) ensures that the propulsion power consumption is higher than 0, in order to enable the operation of 0 , and lower than or equal to the maximum power 0 supported by 0 .
• (3c) guarantees that the transmission power is between 0 and the maximum value defined based on the wireless cards used.
• (3d) assures that the speed of 0 at any time instant is lower than or equal to the maximum speed 0 allowed by 0 .
• (3e) ensures that the position of 0 , which we aim at determining, is different from any composing the flying network, in order to avoid collisions. We assume the position of any , ∈ {1, ..., − 1}, is defined by a state of the art FAP positioning algorithm, such as the one proposed by Almeida et al. 3 , which avoids collisions between them.
• (3f) ensures that a wireless link between each and 0 is always available. • (3g) guarantees that the capacity of the wireless link established between each and 0 is higher than or equal to the traffic demand of .
• (3h) assures that the aggregate capacity of the wireless links is lower than or equal to the maximum capacity of the wireless channel.
• (3i) ensures the minimum that enables the selection of an MCS index characterized by a data rate higher than or equal to ( ) bit/s, which depends on the Euclidean distance between each and 0 , and the transmission power of the UAVs, whose maximum value is defined based on the wireless technology used.
(3a) requires defining the trajectory of 0 such that the propulsion energy consumption is minimal and the capacity of the wireless links established between the FAPs and 0 is high enough to accommodate the traffic demand of each FAP. The UAV trajectory planning has been shown in the literature to be an NP-hard problem 41,42 . As such, we propose a heuristic algorithm to achieve a solution for this problem.

ENERGY-AWARE RELAY POSITIONING ALGORITHM
As previously mentioned, there is a range of UAV speeds wherein the UAV consumes less power than when it is hovering. This assumption is the basic principle for the Energy-aware RElay Positioning (EREP) algorithm proposed herein. The EREP algorithm is built upon the GWP algorithm proposed by Coelho et al. 23 , and takes into account the constraints included in the problem formulation presented in Section 3. GWP takes advantage of the knowledge of the FAPs positions and traffic demands, provided by a state of the art FAP positioning algorithm such as the one presented by Almeida et al. 3 . Then, it defines the position of the FCR UAV (named GW UAV) that maximizes the aggregated throughput between the FAPs and the FCR UAV. For that purpose, GWP computes a three-dimensional (3D) subspace that results from the intersection of the spheres centered at each FAP composing the flying network. Each sphere has a radius equal to the maximum distance that enables the minimum SNR value required for selecting a target MCS index. The target MCS index is characterized by a data rate higher than or equal to the traffic demand of the corresponding FAP.
The EREP algorithm improves the GWP algorithm by considering the power consumption of the FCR UAV. Instead of hovering in the position defined by the GWP algorithm, with EREP the UAV is moved along a trajectory, within the 3D subspace, at the speed that minimizes the power consumption, given by (2). Since any position within the 3D subspace allows to ensure the minimum SNR required for selecting the target MCS index, the trajectory defined by EREP for the FCR UAV does not compromise the QoS offered by the flying network when compared with the positioning defined by the GWP algorithm. The main differences between the EREP and GWP algorithms are presented in Table 1.
The first step of the EREP algorithm consists in determining the minimum that enables the usage of an MCS index capable of accommodating the traffic demand ( ) bit/s offered by (line 1 of Alg. 1). For that purpose, the relation between the SNR and the fair share of the wireless channel capacity is considered, following the rationale proposed by Coelho et al. 23 . For illustrative purposes, let us assume the use of the IEEE 802.11ac technology with one spatial stream, 800 ns Guard Interval (GI), and 160 MHz channel bandwidth. Considering the minimum SNR required to use a target MCS index, which is characterized by a theoretical data rate, in Table 2 we calculate the fair share for 2 FAPs that use the same wireless channel, taking into account in this example the minimum and maximum MCS indexes only. The fair share is defined as the maximum capacity of the wireless link between each FAP and the FCR UAV, and assumed to be equal to the data rate of index over the number of FAPs sharing the medium. The minimum required for using imposes a minimum received power at . Then, considering a transmission power for , initially set to 0 dBm, EREP calculates the maximum transmission range for , in order to achieve the minimum , as presented in Fig. 4a for 1 and 2 (line 1 of Alg. 1); we assume is equal for all FAPs. In 3D space, represents the radius of a sphere centered at . Next, EREP finds the volume that results from the intersection of the spheres centered at each FAP; the volume resulting from the intersection of the spheres centered at two FAPs is illustrated in Fig. 4a (lines 3, 4, and 8 of Alg. 1). The intersection between the spheres defines the volume inside which the FCR UAV can move without compromising the QoS. If no intersection is found, is successively increased by 1 dBm ( increases) until an intersection between the spheres occurs (lines 5 and 6 of Alg. 1).
Once an intersection volume is found, the altitude corresponding to the highest area inside the intersection volume is selected (line 11 of Alg. 1). A constant altitude for the trajectory to be completed by the FCR UAV is defined, since significant changes in the UAV altitude imply additional power consumption 35,43,44 . The centroid of that area is the position defined by the GWP algorithm, where all possible trajectories for the FCR UAV must pass through (line 12 of Alg. 1). The next step consists in defining the waypoints for the possible trajectories. EREP computes three possible trajectories and five waypoints that maximize the length of each trajectory, so that the FCR UAV can move as long as possible. Three different trajectories are calculated due to the different shapes of the area of intersection, which varies according to the distances between the FAPs and the number of FAPs. An example of the three trajectories computed is given in Fig. 4. For the first trajectory (Fig. 4b), apart from the centroid, the waypoints are defined as the points in the intersection area with the highest and lowest values of in both extremes of the -axis (line 13 of Alg. 1). For the second trajectory (Fig. 4c), the waypoints are defined as the points in the intersection area with the highest and lowest values of in both extremes of the -axis (line 13 of Alg. 1). For the third trajectory (Fig. 4d), the waypoints are defined as the four extreme points in the area of intersection that have the same or coordinate as the centroid (line 13 of Alg. 1). The selected trajectory is the one that has the highest total sum of distances between successive waypoints (line 14 of Alg. 1), in order to maximize the time the FCR UAV is moving at the speed consuming the lowest power.
The trajectory is defined by 5 waypoints: the centroid (Pc) and the edges of the area (P1, P2, P3, and P4). The UAV starts in Pc and goes to P1. Afterward, it moves to P2 and then to P3, passing through Pc. Before returning to Pc, the UAV passes through P4. The UAV hovers for 1 s at each of the waypoints to invert the movement direction. The 1 second hovering is used as an approximation to the energy consumed during the change of direction. This was considered in EREP because, to the best of our knowledge, there is no model in the state of the art available to characterize the energy consumption for this action of the UAV. The 1 second hovering approximation considered by the EREP algorithm is represented in the optimization problem defined in (3) by a set of consecutive equal waypoints 0 ( ) during 1 second.
In EREP, the transmission range of the wireless link established between each FAP and the FCR UAV is represented by a sphere centered at each FAP. The volume resulting from the intersection of all spheres (cf. Fig. 4a) corresponds to the Inter-sectionPoints variable in Algorithm 1. DesiredAltitude is the coordinate where the -plane with the largest area is located, considering the intersection volume between the spheres (IntersectionPoints variable). This is the plane that allows to define the longest trajectory to be completed by the FCR UAV, thus contributing to minimize the energy consumption (lowest energy consumption when compared to hovering). The centroid corresponds to the position of that plane that minimizes the distance between the FCR UAV and all the FAPs. Finally, the maximumDistance variable represents the Euclidean distance of the longest trajectory amongst the three trajectories (cf. Fig. 4b, Fig. 4c, and Fig. 4d) defined in that plane by EREP, considering as input the Cartesian coordinates of the waypoints to be covered by the FCR UAV for completing each corresponding candidate trajectory.

FIGURE 4
Transmission range for each FAP and candidate FCR trajectories, considering a simplified networking scenario for illustrative purposes 46 . Calculate Intersection ⊳ Determine the intersection between the spheres centered at the FAPs, if possible (cf. Fig. 4a) 5: if No intersection is found then 6: Increase for all FAPs by 1dBm ⊳ Increase transmission power of all FAPs, initially set to 0 dBm, by 1 dBm 7: else 8: IntersectionPoints ← Intersection ⊳ Volume determined after the intersection of all spheres has been achieved 9: end if 10: end while 11: DesiredAltitude ← Altitude with more points ⊳ -plane enabling the longest trajectory to be completed by the FCR UAV 12: Find the centroid ⊳ Position at that minimizes the distance between the FCR UAV and all FAPs 13: Define waypoints for the first, second and third trajectories ⊳ According to Fig. 4b, Fig. 4c, and Fig. 4d. 14: Selected Trajectory ← maximumDistance(first, second, third) ⊳ Longest trajectory (Euclidean distance) of the three defined

PERFORMANCE EVALUATION
This section presents the evaluation of the EREP algorithm considering both the FCR UAV energy consumption and the corresponding flying network performance. It includes the simulation setup, the simulation scenarios defined, the performance metrics considered, and the simulation results obtained.

Energy Consumption Evaluation
To perform the evaluation of the EREP algorithm in terms of the FCR UAV energy consumption, we developed a custom simulator in Python, named UAVPowerSim, implementing the EREP algorithm and the power consumption model presented in (2). The simulator is publicly available 47 . The simulator was used to evaluate the power consumption when the FCR UAV moves along the trajectory defined by EREP against the baseline -the FCR UAV hovering at Pc, which is defined by the GWP algorithm 23 . The physical attributes of the UAV and the environment constants considered were the ones used by Zeng et al. 22 Table 3. For these values, the speed that minimizes the power consumption is ≈ 10.2 m∕s. The evaluation of the EREP algorithm was performed under random networking scenarios, considering 2, 5, 10, and 20 FAPs. For that purpose, a set of 160 networking scenarios for each number of FAPs was generated using BonnMotion 48 , a mobility scenario generation tool. In the simulations for the same number of FAPs using UAVPowerSim, all the FAPs were generating the same amount of traffic. The results are shown in Fig. 5. Since we considered a set of 160 random networking scenarios for each number of FAPs, the gains regarding the FCR UAV endurance ( ) are presented by means of the 25 th , 50 th , 75 th , and 95 th percentiles, considering as baseline the endurance achieved when using the GWP algorithm. From the results it is possible to observe that the average gains oscillate between approximately 7% and 8%, while the 95 th percentile gains go up to 13%. Overall, the gains are maximized when the distance between the FAPs is minimized, since the volume resulting from the intersection of the spheres centered at the FAPs is maximized. Considering that the performance evaluation carried out takes into account random positions for the FAPs, the maximum gains achieved by EREP can be even greater if the positions of the FAPs are defined to maximize the volume of intersection between the corresponding spheres. On the other hand, the FCR UAV's endurance gains basically do not depend on the number of FAPs; this is mainly due to the volume of intersection between the FAPs, which has roughly the same value regardless of the number of FAPs, since the intersection is found when the minimum value of transmission power for it to exist is achieved. A gain of 13% means that for a drone with a 2-hour endurance, it will keep flying for 16 minutes more when compared against the baseline, which considers the FCR UAV hovering at the position defined by the GWP algorithm. The evaluation of EREP against the baseline was carried out under the same exact conditions and assumes a negligible wind speed. The analysis of the wind effect on the performance achieved by EREP is left for future work.
The problem addressed by the EREP algorithm is an evolution of the problem addressed by the GWP algorithm 23 . While the GWP algorithm aims at improving the overall flying network performance, considering the minimum required transmission power for the Network Interface Cards carried on board the UAVs to reduce interference, the EREP algorithm aims at minimizing the power consumed by the FCR UAV for propulsion. GWP places the FCR UAV in hovering state at a fixed position, which is not the most energy-efficient UAV state 22 . The considerable number of networking scenarios used in the performance evaluation provides statistical relevance to the results presented.

Network Performance Evaluation
In order to assess the flying network performance when using the EREP algorithm, the ns-3 simulator 49 was used. In ns-3, each simulated UAV was carrying a Network Interface Card configured with 20 dBm transmission power and using the IEEE 802.11ac standard operating in Ad Hoc mode and in channel 50, which enables 160 MHz channel bandwidth. The wireless links established between the FCR UAV and the FAPs were using a single spatial stream and 800 ns GI. UDP Poisson traffic using data packets of 1400 bytes was considered. The data rate was automatically defined by the MinstrelHtWifiManager mechanism and the transmission queues were controlled by the Controlled Delay (CoDel) algorithm 50 , using the default parameters in ns-3 51 , in order to mitigate the bufferbloat problem 52 . A summary of network parameters is included in Table 3. A set of networking scenarios consisting of 2, 5, and 10 FAPs at different distances from each other were considered. They represent extreme scenarios in terms of the distance between the FAPs, aiming at evaluating the flying network performance achieved when the FAPs are positioned close to each other and away from each other. The random Cartesian coordinates of the FAPs for each networking scenario are presented in Table 4. The traffic demand of each FAP was defined based on an estimation for the maximum capacity achievable in the wireless channel, which we assume to be equal to approximately 65% of the data rate that characterizes the highest Modulation and Coding Scheme (MCS) index for the network configuration used (65% × 780 Mbit∕s ≈ 500 Mbit∕s) over the number of FAPs sharing the medium, in order to take into account the MAC inefficiency and consider a margin with respect to the theoretical maximum channel capacity (780 Mbit∕s).
The network performance evaluation carried out took into account two metrics: • Aggregate throughput: the number of bits received per second by the FCR UAV.
• Delay: the time taken for each data packet to be delivered to the sink application of the FCR UAV, since the instant the packet was sent by the source application of each FAP, including queueing, transmission, and propagation delays. It was measured considering the packets collected every 10 ms.
The results for each scenario, considering all values collected in 20 simulation runs, are represented by means of the Cumulative Distribution Function (CDF) for the delay and by the Complementary CDF (CCDF) for the aggregate throughput. The CDF ( ) gives the percentage of samples for which the delay is less than or equal to , while the CCDF ′ ( ) gives the percentage of samples for which the throughput is greater than . For analysis purposes, the values obtained for the 90 th percentile are considered.
A summary of the obtained results, considering the different networking scenarios employed, is presented in Table 4. In complement to the analysis presented in Section 5.1, we can conclude that, for the same number of FAPs, the FCR UAV endurance gains increase as the distance between the FAPs decreases; this is due to the increased volume of intersection between the spheres centered at the FAPs.

Discussion
In general, the gain in the UAV endurance achieved by EREP depends on the volume of intersection between the spheres centered at each FAP. For the same distance and number of FAPs, the gain will be higher if the transmission power is further increased to augment the volume of intersection on purpose, given the fact that the increase in a few dBm in will be negligible when compared to the power consumption 0 of the UAV. The higher the volume the higher the gain. However, it is important to note that EREP will always increase the UAV endurance, without compromising network performance.
In this article, the EREP algorithm is used only for the FCR UAV because it represents a single point of failure in the flying network. If the FCR UAV becomes unavailable due to energy shortage, the flying network will not be able to connect to the Internet, since the FCR UAV is the only communications node in charge of forwarding the traffic to/from the Internet. Some flexibility is inherent to the access network. Some FAPs can be removed for power charging during the network operation, and the transmission power and positioning of the remaining FAPs can be temporarily modified, in order to ensure the alwayson coverage of the ground users, even if the network performance can be temporarily compromised. The usage of the EREP algorithm for the FAPs positioning brings additional challenges, since the movement of the FAPs must be performed so that the traffic demand of the ground users is met, while simultaneously ensuring the backhaul links established with the FCR UAV provide high enough capacity for accommodating the traffic demand. In addition, the collision avoidance problem should be considered, since multiple FAPs would be moving simultaneously. The improvement of EREP for multiple UAVs is left for future work. The current version of the EREP algorithm can also be used to define the positioning of the FCR UAV in a networking scenario composed of fixed terrestrial Wi-Fi Access Points or cellular Base Stations.
The EREP algorithm improves the FCR UAV endurance by defining a trajectory at the speed that consumes minimum power. At the same time, this trajectory aims at ensuring that the wireless link established between each FAP and the FCR UAV has a minimum SNR that induces the selection of a target MCS index by the auto rate mechanism used. The target MCS indexes are characterized by a data rate higher than or equal to the traffic offered by each FAP, in order to maximize the number of bits per second received in the FCR UAV. In its current version, the EREP algorithm allows to maximize the endurance of the FCR UAV. However, the SNR experienced by the UAVs in real-world flying networks may present some deviation with respect to the theoretical values, leading to QoS degradation in some scenarios, since EREP considers the Free-Space Path Loss model to calculate the minimum theoretical SNR values required for selecting the target MCS indexes. In order to overcome this challenge, the use of an SNR margin with respect to the theoretical values computed by means of the Free-Space Path Loss model may be considered. The use of the SNR margin will result in a smaller intersection volume between the spheres (transmission ranges) centered at the FAPs, leading to a shorter trajectory for the FCR UAV and avoiding network performance degradation due to the SNR degradation that can occur in some scenarios, at the expense of a lower FCR UAV endurance gain when compared with the current version of EREP. This aspect is left for future work.

CONCLUSIONS
This article proposed an energy-aware relay positioning algorithm (EREP) for an FCR UAV, with the goal of minimizing the FCR UAV power consumption for propulsion. The EREP algorithm defines a trajectory to be completed by the FCR UAV, which is accomplished at the speed that consumes minimum power. The obtained simulation results show that the proposed algorithm can achieve relevant gains in terms of UAV endurance, without compromising the QoS offered by the flying network. As future work, we will consider the improvement of the EREP algorithm to other possible trajectories. Moreover, the improvement of EREP for positioning multiple UAVs and the use of an SNR margin with respect to the values obtained by means of the theoretical propagation models are research challenges worthy of being considered.