UAV-Aided Secure Short-Packet Data Collection and Transmission

Benefiting from the deployment flexibility and the line-of-sight (LoS) channel conditions, unmanned aerial vehicle (UAV) has gained tremendous attention in data collection for wireless sensor networks. However, the high-quality air-ground channels also pose significant threats to the security of UAV-aided wireless networks. In this paper, we propose a short-packet secure UAV-aided data collection and transmission scheme to guarantee the freshness and security of the transmission from the sensors to the remote ground base station (BS). First, during the data collection phase, the trajectory, the flight duration, and the user scheduling are jointly optimized with the objective of maximizing the energy efficiency (EE). To solve the non-convex EE maximization problem, we adopt the first-order Taylor expansion to convert it into two convex subproblems, which are then solved via successive convex approximation. Furthermore, we consider the maximum rate of transmission in the UAV data transmission phase to achieve a maximum secrecy rate. The transmit power and the blocklength of UAV-to-BS transmission are jointly optimized subject to the constraints of eavesdropping rate and outage probability. Simulation results are provided to validate the effectiveness of the proposed scheme.

mobile communications [2], [3], the unmanned aerial vehicle (UAV) aided networks have recently attracted significant attention. The benefits of high mobility, low cost, easy deployment, and line-of-sight (LoS) links allow UAVs to be utilized in different scenarios to improve the wireless network performance [4], [5]. With these advantages, UAVs can be deployed as highmobility users, fast-configured base stations (BSs), or longrange relays [6]. Specifically, the flexibility of UAV enables efficient data collection for B5G/6G Internet of things (IoTs) [7], [8], [9], which can tackle the challenge of collecting data from remote or extreme environments. Instead of exhaustively collecting data from each user randomly, the energy efficiency (EE) of UAV can be improved via the proper design of trajectory and user scheduling [10], [11], [12]. Wang et al. proposed an efficient data collecting scheme for a non-orthogonal multiple access (NOMA) UAV network to minimize the flight duration in [10] via jointly designing the trajectory, scheduling, and transmit power. To keep the data freshness of wireless sensor networks, Liu et al. proposed an efficient data collection scheme in [11] to minimize the age of information of all the sensors via properly designing the trajectory of UAV collector. In [12], an energy harvesting wireless sensor scheme was studied by Liu et al., where the UAV transfers energy to support the sensor nodes and minimizes the outage probability of data collection.
However, information security threat resulting from the LoS channels cannot be ignored during the UAV data collection process [13], [14], [15], [16]. In [13], Zhang et al. proposed two secure schemes to enable the information security via cooperative dual UAVs with the energy limit of UAV considered. To preserve the privacy of devices, Yang et al. proposed a federal learning based scheme for UAV-assisted networks in [14] to provide reliable and efficient data collection. In [15], Xu et al. utilized blockchain in a UAV-assisted data collection IoT network to guarantee the information security and improve the EE. In [16], Xu et al. investigated the secure transmission in a dual UAV mobile edge computing system under both time division multiple access and NOMA. To tackle the security challenges, many studies have been focused on improving the security in UAV-related systems [17], [18], [19], [20]. In [17], Chen et al. proposed a resource allocation scheme to realize the secure transmission in circular-trajectory UAV-NOMA networks. Wang et al. introduced the simultaneous wireless information and power transfer into NOMA-UAV networks in [18] to provide secure transmission while guaranteeing the energy supplement for passive receivers. In [19], Zhong et al. This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ leveraged the power and trajectory control over both the UAV transmitter and a friendly UAV jammer to avoid being eavesdropped. Kang et al. integrated the blockchain into UAV communications in [20] to share data securely.
In addition, because of the short packets used in the UAV data collection, the conventional performance analysis based on infinite blocklength cannot characterize the system accurately [21], [22]. This motivates new research to investigate the performance of short-packet transmission, which mainly focuses on improving the reliability and reducing the time delay [23], [24]. When evaluating the performance in typical wireless communications, the infinite blocklength (or sufficient large blocklength) is commonly considered, where the critical performance parameter can be accurately modeled. However, data transmission in IoT applications usually consists of a large amount of time-intolerant and error-intolerant information, where the length of message is short. Thus, applying short packets to UAV-related communications could make the information transmission more effective [25], [26], [27]. In [25], Ranjha and Kaddoum utilized the UAV and reconfigurable intelligent surface to achieve a short-packet IoTs system aiming to minimize the decoding error rate. Ren et al. studied the short-packet communication in UAV-assisted networks [26], where the achievable finite blocklength data rate is investigated under three-dimension channel models. In [27], the blocklength and hovering location of UAV relay were optimized by Pan et al. to minimize the decoding error probability at the receiver.
As observed, using finite blocklength to explore the physical layer security of UAV-aided networks is still under investigation, and the security for IoT networks is also of critical importance. The finite-blocklength security for UAV-assisted data collection and transmission has not been well studied in the aforementioned literature. Thus, in this paper, we propose a short-packet secure UAV data collection scheme to guarantee the information secrecy and freshness. We summarize the main contribution of this paper as follows.
• To our best knowledge, this is the first work considering the secure transmission of short packets for UAV-assisted data collection. Specifically, user scheduling, flight duration, and trajectory are jointly designed to achieve higher EE in the data collection via UAV. Then, in the data transmission to BS, the finite blocklength and transmit power of UAV are jointly optimized to maximize the secrecy rate while restricting the eavesdropping rate and the secrecy outage probability. • During the first phase of data collection, the trajectory and user scheduling problem is formulated as non-convex, which cannot be solved directly. Thus, we utilize the successive convex approximation (SCA) and first-order Taylor expansion to transfer the non-convex problem into two convex subproblems and solve them iteratively to derive the optimal solution for higher EE. • We jointly analyze the monotonicity of the lower bound of secrecy rate, the eavesdropping rate and the outage probability to derive the optimal transmit power and the optimal blocklength for the second secure short-packet transmission phase. Without awareness of the channel state information of the eavesdropper, we perform statistical analysis on the eavesdropping rate to derive the optimal solution for the secure transmission. The rest of this paper is organized as follows. In Section II, we describe the system model. The EE maximization problem is formulated and optimized in Section III. Then, the secrecy rate maximization for short-packet secure transmission is given and solved in Section IV. We present the simulation results in Section V, and conclude the work in Section VI.
Notation: Boldface lowercase and uppercase letters identify vectors and matrices, respectively. C M ×N represents the M × N complex matrix. a H and ∥a∥ are the conjugate transpose and Euclidean norm of vector a, respectively. P r {x} and E [x] are the probability and the expectation of the random variable x. CN (µ, σ 2 ) denotes the complex Gaussian distribution with mean µ and variance σ 2 . I 0 ( * ) represents the first-kind and the zero-order Bessel function. χ 2 (k, λ) represents the noncentral chi-square distribution with k degrees of freedom and the non-centrality parameter of λ.

II. SYSTEM MODEL
In the network, a UAV collects data from randomly distributed sensors, and then transmits them to the BS, as shown in Fig. 1. The data transmission consists of two parts, namely the data collection phase and the secure transmission phase. The sensors, the BS, and the eavesdropper are all assumed to equip with a single antenna. The UAV is assumed to have a single receiving antenna and multiple transmitting antennas. In the data collection phase, the UAV flies according to its designed trajectory w and collects data from the sensors according to their scheduling variable t i [n]. After data collection, the UAV transmits the received data via precoding to the legitimate BS while avoiding being eavesdropped by the eavesdropper. The distributed area of sensors is assumed to be much smaller compared with the distance between the UAV and BS, which leads to a tiny impact of the UAV trajectory on the transmission performance towards the BS in the second phase. Therefore, in the proposed scheme, we first design the trajectory of UAV, and then characterize the secure transmission to the BS, which is described as follows.

A. Data Collection Phase
There are S sensors randomly distributed in the square area with the length of each side as L, where the location of the i-th sensor can be expressed as L i (x i , y i , 0) ∈ R 1×3 , ∀i ∈ {1, · · · , S}. During the data collection, the UAV flies over the area with a fixed height H. The data collection phase is conducted for a duration T , which is equally divided into N slots. Therefore, the duration of each time slot can be expressed as ∆t = T N . Then, the trajectory of UAV can be simplified as w = [w [1], · · · , w[n], · · · , w[N ]], where w[n] = (x[n], y[n], H) ∈ R 1×3 , ∀n = {1, · · · , N } is the location of UAV in the n-th slot. Besides, the UAV can adjust its trajectory w and speed v ≤ V max to achieve better transmission performance, where V max is the maximum achievable speed of UAV. Assume that the UAV returns to its original location after finishing the data collection within T , and we have In addition, the duration of each slot is small. Thus, ∆ uav [n] = ||w[n]−w[n−1]|| can be approximately unchanged compared to H, which is expressed as and where 0 < θ ≪ 1.
In the data collection, the i-th sensor should transmit at least B i bits to the UAV during its assigned time slots. Consider that the UAV adopts time-division multiple access, which indicates that the UAV only serves one user within each time slot. Define a boolean symbol t i [n], ∀i ∈ {1, · · · , S} and ∀n ∈ {1, · · · , N }, to describe the scheduling variable for all sensors, where t i [n] = 1 represents that the i-th sensor can send data to the UAV during the n-th slot and t i [n] = 0 indicates that the i-th sensor keeps silence. The scheduling variable t i [n] can be described as Assume that the channel coefficient g siu between the i-th sensor and UAV follows the large-scale LoS channel, which can be described as where ρ 0 is the path loss reference at 1 m for LoS, and α represents the path loss exponent. d siu denotes the distance between the i-th sensor and UAV, which can be denoted as The blocklength of each sensor is assumed to be N s . Apart from the traditional data rate in an infinite system, the capacity  (12) should take the decoding error probability ϵ s at the UAV into consideration. Thus, the transmission rate of the i-th sensor during the n-th slot can be described as where Q −1 ( * ) represents the inverse Q-function. The signalto-noise ratio (SNR) γ i [n] can be described as where σ 2 represents the variance of the Gaussian noise and P s is the transmit power of each sensor. In addition, Thus, the total transmitted data D sen from the distributed sensors within the whole duration T can be defined as The UAV is assumed to be rotary-wing, and its propulsion power is much higher than the communication part. Thus, we only consider the propulsion energy in the trajectory design when maximizing the EE. The power consumed by the UAV during the n-th time slot to support flying can be described as (12), shown at the bottom of the next page, where its parameters can be referred to Table I. Based on (12), the total propulsion energy consumption E uav of UAV can be calculated as Then, the EE r tc can be defined as We also constrain the consumed energy of the i-th sensor to be smaller than its total energy E i as and the transmitted data of the i-th sensor to be no smaller than its sensed data B i as

B. Secure Short-Packet Transmission Phase
After receiving the data from the sensors, the UAV transmits them to the BS with M antennas in blocklength N u , where the BS locates at in the n-th time slot between the UAV and BS follows the large-scale LoS path loss, which can be expressed as ||, ∀n ∈ {1, · · · , N }, is the distance between the UAV and BS at the n-th slot, and represents the LoS channel components between the M antennas of UAV and the BS, In addition, there exists a terrestrial eavesdropper located near the BS, and the UAV does not know its accurate location. Thus, we analyze the secure transmission under the worst situation, where the closest location of the eavesdropper to the UAV is estimated at L e (x e , y e , 0) ∈ R 1×3 . Assume that the channel coefficient g e [n] during each time slot between the UAV and eavesdropper follows a large-scale path loss and a small-scale Rician fading as which cannot be obtained by the UAV. d e [n] ≜ ||L e − w[n]||, ∀n ∈ {1, · · · , N }, is the distance between the UAV and eavesdropper during the n-th time slot. c L = K 1+K and c N = 1 1+K are the LoS and non-LoS (NLoS) channel coefficients of Rician fading, where K is the Rician factor. The LoS chan- Assume that the UAV performs the maximum ratio transmission (MRT) via precoding towards the BS, where the precoding vector u[n] during each slot at the UAV can be described as The UAV precodes the transmitted signal of blocklength N u with transmit power P a , where the received SNR at the BS during the n-th slot can be described as Similar to the SNR at the BS, the SNR at the malicious eavesdropper can be described as Similar to (8), the channel capacities from the UAV to both the BS and eavesdropper are smaller than the traditional infinite blocklength transmission. The maximum achievable transmission rate R b [n] of each slot can be expressed as where n ∈ {1, · · · , N }. ϵ is the maximum allowed error decoding probability. The maximum achievable eavesdropping rate at the eavesdropper can be demonstrated as where n ∈ {1, · · · , N }, and δ e is the information leakage probability.
Based on [28], the lower bound to the secrecy rate R s [n] during each time slot can be described as (24), shown at the bottom of the next page.
The secure transmission outage occurs when the transmission rate R 0 [n] of the n-th slot is larger than the secrecy rate capacity. To guarantee the security, we define the secrecy outage probability p out [n] in each time slot as In the following, the EE maximization for data collection is investigated in Section III, while the secrecy rate in short-packet transmission is maximized in Section IV.

III. ENERGY EFFICIENCY MAXIMIZATION
Owning to the energy limitation, the maximum flying duration of UAV is limited. To balance between the flight duration of UAV and the amount of collected data, we optimize the trajectory of UAV and the scheduling variable of each sensor to achieve higher EE for data collection in this section.
Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.

A. Problem Formulation
The trajectory w of UAV and the scheduling vector t ≜ {t i [n], ∀i = {1, · · · , S} , ∀n = {1, · · · , N }} are optimized. In addition, we also optimize the total flight duration of UAV to achieve a higher EE. By optimizing the trajectory w of UAV, the scheduling vector t, and the flight duration T , we aim at maximizing EE r tc . The optimization problem can be formulated as which has a non-convex structure and is difficult to solve. Thus, we propose an iterative algorithm to solve the proposed problem via SCA. We first optimize the scheduling vector t and flight duration T with a given trajectory w. Then, with the optimized t and T , the trajectory w can be updated.

B. Optimization of Scheduling and Flight Duration
According to the definition of ∆t, we reformulate P1 as the optimization of ∆t instead of T , since r tc is the expression of ∆t. Thus, for a given trajectory w of UAV, the problem P1 can be simplified as where E uav = E ucvx (∆t) + E uN cvx (∆t). E ucvx (∆t) is the convex component in E uav with respect to ∆t, and can be described as E uN cvx (∆t) is the non-convex component in E uav with respect to ∆t, and can be described as From (27), we can see that ∆t is non-concave and E uN cvx (∆t) is non-convex, which makes P1.1 mathematically unsolvable. Therefore, we introduce an to transfer the non-concave (27a) into a different version, the numerator part of which can be changed into In addition, we introduce another auxiliary parameter z[n] to upper bound a complex component in E uN cvx as By performing the simple algebra transformation on (32), we have which changes E uN cvx (∆t) in (29) into Then, P1.1 can be transformed as To ensure that (35) is mathematically solvable, we need to change (35c) and (35e) into concave ones with respect to ∆t. Also, (35d) and (35f) need to be changed into concave ones with respect to R N [i] and z[n], respectively. We apply the first-order Taylor expansion to change the above-mentioned functions into their concave versions. Then, iteratively performing SCA, the optimal values of t, ∆t, R N [i], z[n] can be achieved.
The first-order Taylor expansion of (35c) with a given point ∆t (r) can be expressed as where ∆t (r) is assumed to be the optimal value of ∆t in (35) from the r-th iteration.
Similarly, (35d) can be expanded at a given point R (r) where R (r) is assumed to be the optimal value of R N [i] in (35) from the r-th iteration.
Also, according to the hyperbolic constraint [29], we have (35e) if and only if We can replace (35e) with (38). The expansion of (35f) at a given point z (r) [n] can be changed to where z (r) [n] is assumed to be the optimal value of z[n] in (35) from the r-th iteration. Thus, P1.1.a can be changed into a mathematically solvable problem as which is convex, and can be solved by existing convex programming tools such as CVX.

C. Optimization of UAV Trajectory
Then, we optimize the trajectory w of UAV with the given scheduling vector t and flight duration T . The optimization problem can be reformulated as where the numerator of (41a) is non-concave, E uN cvx (∆t) is non-convex, and (41e) is non-concave with respect to w. Thus, we need to transform them into a mathematically solvable problem. The first-order Taylor expansion is utilized to change them into a mathematically solvable convex expression. First, R i [n] can be expanded at a given point w (r) [n] to where is assumed to be the optimal value of w[n] in (41) from the r-th iteration, and R where ∂γ (r) and ∂V (r) Then, (41e) can be changed into Similar to (32), we have where the right hand is non-concave with respect to z[n], which can be expanded into In (49), z (r) [n] is assumed to be the optimal value of z[n] in (41) from the r-th iteration. Finally, (41) can be changed into a mathematically solvable problem as which can be solved by existing convex programming tools such as CVX. Then, the optimal trajectory w * , flight duration T * , and scheduling vector t * can be obtained by iteratively solving P1.1.b and P1.2.a.

IV. SECRECY RATE MAXIMIZATION
During the data collection, the UAV also transfers the received data from the sensors together with its own data to the BS. Meanwhile, it should prevent the adversarial eavesdropping, with the secrecy outage probability requirement satisfied. Therefore, we should optimize the transmit power P a and the information blocklength N u to maximize the secrecy rate, while keeping the secrecy outage probability and the eavesdropping rate lower than the constraints.
Thus, the optimization can be formulated as where P amax is the maximum allowed transmit power of UAV, N umax represents the maximum allowed information blocklength, and r and ξ denote the thresholds of eavesdropping rate and outage probability, respectively. The environmental noise is usually smaller than the signal power. In the rest of this paper, we consider the large SNR situation, where both (52) Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.
Then, the expression of p out [n] is derived in Proposition 1. Since is a random variable, we transform q[n] for analysis simplicity as . It is proved in [30] that h eN [n]u[n] ∼ CN (0, 1). According to [31], q[n] ∼ χ 2 (2, b 2 ) and the probability density function of q[n] can be expressed as Therefore, p out [n] in (54) can be changed into (53). Proposition 1 is proved.
Then, since the trajectory is optimized in P1, the maximization of (58a) To derive the optimal transmit power P * a of UAV and the optimal blocklength N * u , we analyze the monotonicity of R s [n], R e [n], and p out [n] with respect to P a and N u in the following propositions.
Proposition 2:R s [n] monotonically increases with respect to P a and N u .
Proof: From the expression in (52), we have the first-order derivative ofR s [n] with respect to P a as − |h e u| 2 ρ 0 / ln 2 (d e [n] α σ 2 + |h e u| 2 P a ρ 0 ) With the definition of each parameter in (59), it is easy to conclude ∂Rs[n] ∂Pa > 0, which indicates thatR s [n] monotonically increases with the transmit power P a at the UAV.
In addition, we have the first-order derivative ofR s [n] with respect to N u as from which, we can conclude thatR s [n] monotonically increases with N u . Proposition 2 is proved. Therefore, to achieve higherR s [n], we need to set larger N u and P a . Then, the first-order derivative of eavesdropping rate R e [n] with respect to P a and N u is analyzed in Proposition 3.
Proposition 3: R e [n] monotonically increases with P a and N u .
Proof: First, in the large SNR scenario, the first-order derivative of eavesdropping rate R e [n] with respect to P a can be derived as Then, the first-order derivative of eavesdropping rate R e [n] with respect to N u can be derived as Thus, we can conclude that the increase of P a and N u will both result in a larger R e [n]. Proposition 3 is proved. Furthermore, we have the first-order derivative of p out [n] with respect to P a and N u in Proposition 4.
Proposition 4: p out [n] monotonicially decreases with P a and N u .
Proof: The first-order derivative of R e [n] with respect to P a can be described as where we can derive the first-order derivative of f (P a ) with respect to P a from (55) as ln c[n]M Paρ0 where From (63) and (64), we can see that ∂pout[n] ∂Pa < 0, which indicates that p out [n] monotonically decreases with P a . Thus, to achieve a smaller p out [n], we need to increase the transmit power at the UAV.
Besides, we have the first-order derivative of p out [n] with respect to N u as where we set g(N u ) = f (P a ). ∂g(Nu) ∂Nu can be derived as Thus, we can conclude that ∂pout[n] ∂Nu < 0, which indicates that we should increase N u to achieve a smaller secrecy outage probability p out [n].
Proposition 4 is proved.
Then, the solution to P2.1 can be derived in Proposition 5. Proposition 5: The optimal transmit power P * a and blocklength N * u at the UAV for P2.1 can be derived as where N * u can be derived via the traversal algorithm to maximizeR s [n](P Nu a , N u ). Proof: To satisfy (58d), we need to keep the transmit power P a and the blocklength N u small. However, the decrease of both P a and N u will result in the decrease of R s [n] and the increase of p out [n]. Therefore, we set P a and N u as large as possible with (58d) satisfied.
We first derive the upper bounds of P a and N u with (58d) taking the equality, and then figure out the optimal pair of (P * a , N * u ) to maximizeR s [n] while guaranteeing (58e). However, there exists a trade-off between P a and N u owing to that both of their increase can improve the performance. Since N u is an integer, we derive the expression of the upper bound of P a from R e [n] = r as P Nu  (N u , r).
Proposition 5 is proved. Remark: According to (68), P a should be reduced to P amax whenR e [n] −1 (N * u , r) > P amax . Then, N * u should also be adjusted accordingly by maximizingR s [n](P amax , N u ).

V. SIMULATION RESULTS AND DISCUSSION
Simulation results are provided to demonstrate the effectiveness of the proposed scheme. There are six sensors randomly distributed within a square ground with each side of 1500 m. The UAV is flying above the square area with a fixed altitude H = 100 m. The maximum velocity of UAV is set as V max = 50 m/s, and the flight duration T is divided into N = 60 time slots. For the aerodynamic propulsion parameters of UAV, the profile power of blades P bld = 79.86 W, the tip speed of rotor blades v t = 120 m/s, the fuselage drag ratio r drag = 0.6, the density of air ρ air = 1.225 kg/m 3 , the solidity of rotor h rtor = 0.05, the disc area of rotor S rtor = 0.50 m 2 , the induced power P ind = 88.61 W when ∆uav[n] ∆t = 0, and the mean induced speed of motorv = 4.03 m/s according to [32]. The number of antennas at the UAV is set to M = 8. Assume that the BS locates at L b (7000, 0, 100) and the estimated closest location of eavesdropper is at L e (7500, 0, 0) in meters. In addition, the environmental noise power variance is set as σ 2 = −110 dBm. The large-scale channel fading reference at 1 m can be set to ρ 0 = 10 −6 . The channel fading parameters are assumed as K = 5 and α = 2. According to [33], N u > 100 is usually set. In the simulation, we also examine the case when N u < 100 to show the influence of blocklength.

A. Data Collection Phase
The trajectories of UAV are compared in Fig. 2, when the lower bound of collected data for each sensor is set to B i = 40 bit/Hz, B i = 60 bit/Hz, B i = 80 bit/Hz in the proposed EE algorithm, and B i = 40 bit/Hz for the benchmark, respectively. The transmit power P s at each sensor is set to 0.1 W. The proposed scheme focuses more on the EE. In the benchmark, the UAV boosts to its maximum velocity V max to fly to each sensor and then hovers above it to collect 40 bit/Hz data in each round. We use different colors to represent the time slots assigned to different users during the collection. From the results, we can see that the trajectories of the proposed scheme in different settings tend to be shorter, and the UAV tends to hover above the two central users for a longer time. This is because a shorter path can reduce the energy consumption of UAV and thus increase EE. Hovering around the centered users can also save energy. In addition, we can see that the UAV tends to fly closer to other edge users when B i increases.
In Fig. 3, the EE r tc and sum collected data are compared between the proposed EE scheme and the benchmark with different B i . The transmit power P s in each scheme is set as 0.1 W. From the results, we can see that the proposed scheme is superior in both EE and collected data. Specifically, the collected data of both schemes increase with B i . On the other hand, the EE of the proposed scheme decreases with B i while that of the benchmark monotonically increases with B i . This is because higher data requirement results in a longer flight duration for the proposed scheme, which increases the energy consumption of UAV and thus reduces the EE.  The impacts of the transmit power P s at each sensor on the EE and collected data are plotted in Fig. 4, where the proposed scheme is compared to the benchmark. The minimum collected data in both schemes is set as B i = 40 bit/Hz. From the results, we can observe that regardless of the values of transmit power P s , the proposed scheme can achieve better performance of both EE and collected data. Moreover, the collected data of the proposed scheme decreases with the incremental of the transmit power P s . This is due to the fact that the increase of P s of each sensor results in a higher transmission rate, which can satisfy the minimum collected data B i with a shorter flight duration. Fig. 5 shows the impact of P a on the average achievable eavesdropping rate R e , transmission rate R b and secrecy rate R s . We set B i = 40 bit/s, P s = 0.1 W and N u = 20. From the results, we can see that although the eavesdropping rate R e increases with P a , the transmission rate R b towards the BS increases more rapidly, which enables the secrecy rate R s to increase with P a . This is because the MRT can result in higher SINR at the legitimate receiver.

B. Short-Packet Transmission Phase
The impacts of the blocklength N u on R b , R e , and R s are investigated in Fig. 6. We have P s = 0.1 W, B i = 40 bit/Hz and P a = 0.1 W. From the results, we can see that R e , R b , Fig. 5.
Comparison of the average achievable eavesdropping rate Re, transmission rate R b and secrecy rate Rs with different transmit power Pa of UAV. Comparison of the average achievable eavesdropping rate Re, transmission rate R b and secrecy rate Rs with different blocklength Nu. and R s all increase with the blocklength N u . This is because the MRT can bring a higher SINR at BS, which enables R b to increase faster than R e .
Then, the impact of P a and N u on the secrecy outage propability p out is shown in Fig. 7. We have P s = 0.1 W, B i = 40 bit/Hz and R 0 [n] = 1.8 bit/s/Hz. From the results, we can see that the secrecy outage probability p out decreases with P a . In addition, the increase of N u can also lead to the reduction of p out . Thus, a smaller p out can be achieved by either a higher P a or a larger N u .
Finally, the impacts of the blocklength N u and eavesdropping rate threshold r on the maximum achievable secrecy rate R s and R b are investigated in Fig. 8. We have B i = 40 bit/s and P s = 0.1 W. The transmit power P * a is derived from (68). From the results, we can see that R b decreases with N u with a given r, which indicates that the optimal transmit power P a also decreases with N u . This is because there is a trade-off between the maximum allowed transmit power P a and the blocklength N u under a given threshold r. In addition, the maximum achievable R s first increases with N u sharply, and then reaches a saturation level. This is because increasing the blocklength can enlarge the achievable secrecy rate, however, bounded by Shannon capacity. To evaluate the effectiveness   of the proposed scheme, we investigate the optimized P * a and N * u under different values of the eavesdropping rate threshold r in Fig. 9, where 100 ≤ N u ≤ 200. From the results, we can see that P * a increases as r, while N * u equaling to the smallest value when r is small but increases when r gets bigger. This indicates that N u has more impact on R e compared with R b when r is small, and smaller N u can achieve larger R s . However, larger N u is preferred when r increases.

VI. CONCLUSION
A secure short-packet data collection and transmission scheme for UAV-assisted wireless networks has been proposed in this paper. First, the trajectory together with the flight duration of UAV and the user scheduling are jointly designed to maximize the EE in the data collection phase. The formulated optimization problem is non-convex and mathematically unsolvable. We utilize the first-order Taylor expansion to convert it to two convex subproblems, which are solved via SCA. Then, in the data transmission phase, with the derived optimal trajectory of UAV, we optimize the transmit power and the blocklength of the secure short-packet transmission from the UAV to BS against the malicious eavesdropping to achieve a maximum secrecy rate while guaranteeing the reliability. Finally, simulation results are presented to evaluate the effectiveness of the proposed scheme.