1 Introduction

The Internet of Things (IoT) is growing rapidly and so more and more wireless sensors are needed to enable IoT-based services [1, 2]. Concurrently, emerging scenarios, such as smart cities and intelligent manufacturing, further drive the growth of wireless sensor network (WSN). Thanks to energy harvesting (EH) advances, wireless sensors are now harnessing the power of renewable energy sources, such as solar, RF and vibration [3]. Simultaneous information and power transfer over the wireless channel utilizing RF-EH technique, and it is a great choice for enabling and deploying WSN [4]. The RF power transfer and wireless information highly rely on distance, and “near-far” fairness issue [5] is challenge with static RF source. The received energy by the sensors varies significantly with their distances to the RF energy source, and the uneven harvested energy leads to poor overall performance.

UAV-assisted wireless power and information systems have attracted attention as the mobility of UAV could relieve the severe impact of the distance [6,7,8,9,10,11]. The overall metrics could be optimized by careful trajectory design of the UAVs. The throughput is maximized in UAV-assisted mobile relaying systems with trajectory optimization [6, 7]. Besides UAV-assisted wireless information system, UAVs can be deployed to charge ground sensors via wireless power transfer (WPT) and collect information via wireless information transmission (WIT) [8,9,10,11]. In [8], the authors minimize the time required by a UAV via jointly optimizing the trajectory of the UAV and the transmission scheduling for all the ground sensors. In [10], the authors propose a reinforcement learning-based approach to plan the route of UAV to collect sensor data from sensor devices scattered in the physical environment. The authors in [11] jointly optimize the sensors’ wake-up schedule and UAV’s trajectory to minimize the maximum energy consumption of all sensors, and then prolong the lifetime of WSN. In [12], a two-way relay system with multiple users and a multi-antenna relay employing SWIPT strategy is considered to provide a rate-energy trade-off.

Previous works [13,14,15,16] have good performance on the mean of harvested energy, while the harvested energy of individual sensor must be above its operational level [17] in practical scenarios, such like in EH-based WSN. The minimal, mean and variance of harvested energies of all ground sensors should be considered together when optimizing the trajectory of UAV [18, 19]. Energy-balanced path planning is needed to cover above three metrics. In this paper, an alternate optimization framework is proposed as follows: Firstly, without considering the UAV speed constraint, the original non-convex problem is transformed into a convex optimization problem. Then the lagrangian method is used to obtain the optimal solution (relaxation solution) of the convex optimization problem [20,21,22]. Secondly, the ant colony algorithm [23,24,25] is used to obtain the optimized flight trajectory of the UAV based on the known relaxation solution. Finally, considering the maximal speed constraint of the UAV, previous UAV flight trajectory is used as the initial value, and the UAV flight trajectory and energy allocation strategy are obtained.

The main contributions of this paper include:

  1. 1.

    Comparing to [5], an energy neutral constraint of ground sensor is introduced. In this paper, the minimal, mean and variance of harvested energies of all ground sensors have been considered for path planning of UAV.

  2. 2.

    The proposed alternate optimization framework obtains UAV flight trajectory and energy allocation strategy to meet the energy-neutral constraint of ground sensor and maximal speed constraint of UAV. The harvested energies of all ground sensors are balanced, and the throughput is maximized. Numerical results show the performance under different sensor distributions, and it demonstrates the effectiveness of the proposed framework.

  3. 3.

    Given an EH-based WSN, the energy-neutral constraint of the ground sensor is determined. The proposed alternate optimization framework could obtain the minimal operational requirement of UAV, which help guide the model selection of UAV. Numerical results show the flight time to meet different settings of energy-neutral constraints.

The rest of this paper is organized as follows: The second section introduces the system model and the optimization problem. The third section introduces the proposed framework. The fourth section gives numerical results to demonstrate the performance. Finally, conclusion is presented.

2 System model

A wireless sensor network based on UAV-assisted wireless power and information system is considered. As shown in Fig. 1, the UAV serves a group of ground sensor equipment, the number is known and it is N, where \(N>1\). The UAV hovered continuously from the initial position to visit M track points, to transfer RF energy to ground sensors and to collect information from the ground sensors within the overall time T. The RF energy transfer and wireless information collection share the same frequency [5, 15]. The parameters of UAV-assisted wireless power and information system are shown in Table 1.

Fig. 1
figure 1

Wireless sensor network supported by UAV.

Table 1 Abbreviations

Here, we define \(n \in \{1, \cdots , N\}\),\(m \in \{1, \cdots , M\}\) and use \(\alpha _{n, m}(t)\) to represents the working mode of the UAV, define a binary variable \(\alpha _{n, m}(t) \in \{0,1\}, \forall \mathrm {n}, \mathrm {m}, \mathrm {t}\), when \(\alpha _{n, a}(t)=1, \alpha _{b, m}(t)=0, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\) represents the downlink wireless energy transmission mode. \(\alpha _{n, a}(t)=0, \alpha _{b, m}(t)=1, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\), which represents the uplink wireless sensor data transmission mode. The coordinates of UAV projected on the horizontal plane are expressed as: \(\mathrm { P}_{m}(\mathrm {t})=\left[ x_{m}(\mathrm {t}), \mathrm {y}_{m}(\mathrm {t})\right] ^{T}, \mathrm {~m} \in \{1, \cdots , M\}, 0 \le \mathrm {t} \le \mathrm {T}\), and have \(P_{m}(0)=P_{m}(T)\). Suppose the UAV is flying on a horizontal plane with a fixed height of H. When \(\alpha _{n, a}(t)=1, \alpha _{b, m}(t)=0, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\) , at any given time \(\mathrm {t}\), \(0 \le \mathrm {t} \le \mathrm {T}\), the distance between the UAV and each user is expressed as follows:

$$\begin{aligned} d_{n, m}(\mathrm {P}(\mathrm {t}))=\sqrt{\left\| P_{m}(t)-g_{n}\right\| ^{2}+H^{2}} \end{aligned}$$
(1)

It is assumed that the doppler effect caused by the maneuverability of the UAV is well compensated at the receiving end. The wireless channels between the UAV and ground sensors are dominated by LoS link, the free-space path model is assumed. At any given time \(\mathrm {t}\), \(0 \le \mathrm {t} \le \mathrm {T}\), the channel power gain between UAV and user n [5, 15] can be expressed as:

$$\begin{aligned} h_{n, m}\left( P_{m}(t)\right) =\mu _{0} d_{n, m}^{-2}\left( P_{m}(t)\right) =\frac{\mu _{0}}{\left\| P_{m}(t)-g_{n}\right\| ^{2}+H^{2}} \end{aligned}$$
(2)

The UAV uses constant power \(PT_{m}\) for wireless energy transmission. When \(0 \le \mathrm {t} \le \mathrm {T}, \alpha _{n, a}(t)=1, \alpha _{b, m}(t) = 0, \quad \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\},\) the energy collected by each user from the UAV can be expressed as:

$$\begin{aligned} \begin{aligned} E_{n, m}\left( P_{m}(t), \alpha _{n, m}(t)\right)&=\eta PT_{m} \alpha _{n, a}(t) h_{n, m}\left( P_{m}(t)\right) \\&=\frac{\eta PT_{m} \mu _{0} \alpha _{n, a}(t)}{\left\| P_{m}(t)-g_{n}\right\| ^{2}+H^{2}} \end{aligned} \end{aligned}$$
(3)

where \(0<\eta \leqslant 1\) is the conversion efficiency of radio frequency (RF) energy into direct current (DC). Ground sensor equipment uses radio frequency energy to supply energy, collect data and transmit it to the UAV wirelessly. When \(\alpha _{n, a}(t)=0, \alpha _{b, m}(t)=1, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\), the signal-to-noise ratio corresponding to user n can be expressed as:

$$\begin{aligned} \varepsilon _{n, m}\left( C_{n}(t), h_{n, m}(t)\right) =\frac{C_{n}(t) h_{n, m}\left( P_{m}(t)\right) }{\sigma ^{2}} \end{aligned}$$
(4)

The achievable data transmission rate (bps/Hz) of each user n is:

$$R_{{n,m}} \left( {\alpha _{{n,m}} (t),P_{m} (t),C_{n} (t)} \right) = \alpha _{{b,m}} (t)\log _{2} \left( {1 + \varepsilon _{{n,m}} \left( {C_{n} (t),h_{{n,m}} (t)} \right)} \right)$$
(5)

Therefore, the average upload rate of N users can be expressed as:

$$\begin{aligned} \mathrm {R}=\frac{1}{T} \sum _{t=0}^{T} R_{b, m}\left( \alpha _{n, m}(t), P_{m}(t), C_{n}(t)\right) \end{aligned}$$

The maximum speed of UAV and energy neutrality of the UAV are expressed as follows:

$$\begin{aligned} \left\| \dot{\mathrm {P}}_{m}(\mathrm {t})\right\| \le V_{\max }, \quad 0 \le \mathrm {t} \le \mathrm {T} \end{aligned}$$
(6)
$$\begin{aligned} \sum _{t=0}^{T} \alpha _{b, m}(t) C_{n}(t) \le \sum _{t=0}^{T} E_{n, m}\left( \alpha _{n, a}(t), P_{m}(t)\right) , 0 \le \mathrm {t} \le \mathrm {T} \end{aligned}$$
(7)

The energy neutral of ground sensor node is the energy collected by each user node must be greater than the set energy threshold \(P_{t h}\). The optimization goal is to maximize the system throughput under the condition of meeting energy neutral and UAV’s maximum speed constraint. The mathematical expression of the optimization problem is:

$$\begin{aligned} \max _{\left\{ \alpha _{n, m}(t), C_{n}(t), P_{m}(t)\right\} } \min _{n \in \{1, \cdots , N\}} R_{n, m}\left( \left\{ \alpha _{n, m}(t), P_{m}(t), C_{n}(t)\right\} \right) \end{aligned}$$

The optimization variables include UAV trajectory \(\left\{ P_{m}(t)\right\}\), transmission mode \(\left\{ \alpha _{n, m}(t)\right\}\), and user uplink energy consumption \(\left\{ C_{n}(t)\right\}\). For the convenience of representation, let \(\mathrm {A}=\left\{ \alpha _{n, m}(t), \forall \mathrm {t}, \mathrm {n}, \mathrm {m}\right\}\), \(\mathrm {Q}=\left\{ P_{m}(t), \forall \mathrm {t}, \mathrm {m}\right\}\), \(\mathrm {P}=\left\{ C_{n}(t), \forall \mathrm {t}, \mathrm {m}\right\}\). Define function:

$$\begin{aligned} \omega (A, Q, P)=\min _{n \in \{1, \cdots , N\}} R_{n, m}\left( \left\{ \alpha _{n, m}(t), P_{m}(t), C_{n}(t)\right\} \right) \end{aligned}$$

Regarding \(\omega (\mathrm {A}, \mathrm {Q}, \mathrm {P})\) as a function of A, Q, P, the optimization problem can be further described as (OP1):

$$\begin{aligned} \max _{{\omega ,A,Q,P}} \omega {\text{s}}{\text{.t: }} & \frac{1}{T}\sum\limits_{{t = 0}}^{T} {R_{{n,m}} } \left( {\alpha _{{b,m}} (t),P_{m} (t),C_{n} (t)} \right) \ge \omega , \\ & \forall n \in \{ 1, \cdots ,N\} ,m \in \{ 1, \cdots ,M\} \\ \end{aligned}$$
(8)
$$\begin{aligned} P_{t h} \le E_{n, m}\left( \alpha _{n, a}(t), P_{m}(t)\right) , \forall n \in \{1, \cdots , M\}, 0 \le \mathrm {t} \le \mathrm {T} \end{aligned}$$
(9)
$$\begin{aligned} \sum\limits_{{t = 0}}^{T} {\alpha _{{b,m}} } (t)C_{n} (t) \le & \sum\limits_{{t = 0}}^{T} {E_{{n,m}} } \left( {\alpha _{{n,a}} (t),P_{m} (t)} \right) \\ & \forall n \in \{ 1, \cdots ,N\} ,m \in \{ 1, \cdots ,M\} \\ \end{aligned}$$
(10)
$$\begin{aligned} \left\| \dot{\mathrm {P}}_{m}(\mathrm {t})\right\| \le V_{\max }, 0 \le \mathrm {t} \le \mathrm {T}, \forall \mathrm {m} \in \{1, \cdots , M\} \end{aligned}$$
(11)
$$\begin{aligned} \sum _{n=1}^{N} \alpha _{n, m}(t) \le 1, 0 \le \mathrm {t} \le \mathrm {T}, \forall \mathrm {m} \in \{1, \cdots , M\} \end{aligned}$$
(12)
$$\begin{aligned} \sum _{m=1}^{M} \alpha _{n, m}(t) \le 1, 0 \le \mathrm {t} \le \mathrm {T}, \forall \mathrm {n} \in \{1, \cdots , N\} \end{aligned}$$
(13)
$$\begin{aligned} 0 \le \mathrm {PT}_{m} \le PT_{\max }, m\in \{1, \cdots , M\} \end{aligned}$$
(14)

where (10) denotes energy threshold constraint of the ground sensor node, (11) denotes the energy neutral constraint of the UAV, and (12) is the maximum speed constraint of the UAV. The objective function of the problem is a non-concave function. Constraints (11) and (12) are non-convex, and there are coupled variables A, Q and P, which contain infinite optimization variables in continuous time. It is difficult to obtain the optimal solution for this problem. In order to solve this complicated optimization problem, the specific solution is given in the third section below.

3 Alternate optimization (AO) framework

As the original problem (OP1) is a non-convex optimization problem, an alternate optimization (AO) framework is presented in Fig. 2. Firstly, without considering the maximum speed constraint of the UAV, the non-convex problem (OP1) is transformed into a convex optimization problem (OP2). With the solution of relaxation problem (OP2), the UAV flight trajectory optimization is transformed into a traveling salesman problem. The shortest flight trajectory of the UAV based on the relaxation solution is obtained.

Secondly, (OP1) is discretized into (OP3) where maximum speed constraint of the UAV is considered. Based on (OP3) and relaxation solution of (OP2), A UAV trajectory optimization update method (OP4) is proposed to solve the UAV flight trajectory and energy allocation strategy via the alternative optimization algorithm of genetic algorithm and continuous convex optimization. The UAV’s flight trajectory can maximize the throughput of the wireless sensor network under the conditions of satisfying the maximum speed constraint of the UAV, the neutral energy constraint of the ground user, and meeting the energy threshold constraints of all nodes.

Fig. 2
figure 2

The flow chart of proposed framework

The flow of framework is given:

  1. (a)

    Initialization Sensor node location \(g_{n}\). Node weight \(W_{n}\).

  2. (b)

    Calculation The relaxation problem solution \(P_{m}\) without the maximum speed constraint.

  3. (c)

    Repeat Judge whether the relaxation solutions \(P_{m}^{*}, \alpha ^{*}, \beta ^{*}, \gamma ^{*}\) obtained by using the gradient descent method and the Karush-Kuhn-Tucher condition meet the node energy threshold. If not return to step b, otherwise proceed to step d.

  4. (d)

    Set Obtain the optimal solution for the relaxation problem, \(P_{m}=P_{m}^{*}, \alpha =\alpha ^{*}, \beta =\beta ^{*}, \gamma =\gamma ^{*}\).

  5. (e)

    Optimization The ant colony algorithm is used to optimize the flight trajectory of the UAV based on the known relaxation solution, and the trajectory is used as the initial value to alternately optimize the UAV flight trajectory Q and the energy allocation strategy A, P to get the optimal solution of the general problem:\(P_{m}^{*}[k], \alpha _{n, m}^{*}[k], C_{n}^{*}[k]\).

  6. (f)

    The end: Obtain the optimal solution to the original problem.

3.1 The optimal solution of the relaxation problem

Firstly, the non-convex optimization problem (OP1) is converted into a convex optimization problem (OP2). By relaxing the binary variables to continuous variables, and without considering the maximum speed constraint of the UAV, the non-convex optimization problem can be rewritten as (OP2):

$$\begin{aligned} ({\text{OP2}}):\max _{{\omega ,A,Q,P}} \omega {\text{ }} \\ & {\text{s}}{\text{.t: }}\frac{1}{T}\sum\limits_{{t = 0}}^{T} {R_{{n,m}} } \left( {\alpha _{{b,m}} (t),P_{m} (t),C_{n} (t)} \right) \\ & \ge \omega ,\forall b \in \{ 1, \cdots ,N\} ,\forall m \in \{ 1, \cdots ,M\} \\ & P_{{th}} \le E_{{n,m}} \left( {\alpha _{{n,a}} (t),P_{m} (t)} \right),\forall a \in \{ 1, \cdots ,M\} ,0 \le {\text{t}} \le {\text{T}} \\ & \sum\limits_{{t = 0}}^{T} {\alpha _{{b,m}} } (t)C_{n} (t) \le \sum\limits_{{t = 0}}^{T} {E_{{n,m}} } \left( {\alpha _{{n,a}} (t),P_{m} (t)} \right) \\ & 0 \le {\text{PT}}_{m} \le PT_{{\max }} ,m \in \{ 1, \cdots ,M\} \\ \end{aligned}$$

Construct the lagrangian function according to the relaxation problem, that is, using the existing mathematical model \(R_{n, m}\), \(E_{n, m}\) can construct a Lagrange function:

$$\begin{aligned} \begin{aligned}&\mathcal {L}_{n, \mathrm {~m}}\left( \{A, Q, \mathrm {P}\}, \mathrm {R}, \alpha _{n}, \beta _{n}, \gamma _{n}\right) \\&\quad =\left( 1-\alpha _{n}\right) \omega +\alpha _{b, m}(t)\left( \frac{\alpha _{n}}{T} \log _{2}\left( 1+\varepsilon _{\mathrm {n}, \mathrm {m}}\left( \mathrm {Q}_{\mathrm {n}}(\mathrm {t}), \mathrm {h}_{\mathrm {n}, \mathrm {m}}(\mathrm {t})\right) \right) \right) \\&-\alpha _{b, m}(t)\left( \beta _{n} Q_{n}(t)+\gamma _{n} P_{t h}\right) +\left( \gamma _{n}+\beta _{n}\right) \left( \frac{\eta PT_{m} \mu _{0} \alpha _{n, a}(t)}{\left\| p_{m}(t)-g_{n}\right\| ^{2}+H^{2}}\right) \end{aligned} \end{aligned}$$
(15)

Secondly, consider using the UAV working mode \(\alpha _{n, m}(t)\) to decompose the convex optimization problem into several equivalent sub-optimization problems [26, 27]. When the UAV is working in the downlink wireless energy transmission mode, there are \(\alpha _{n, a}(t)=1, \alpha _{b, m}(t)=0, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\). So the convex optimization problem can be transformed into:

$$\begin{aligned} {\mathcal{L}}_{{n,{\text{a}}}} \left( {\{ A,Q,{\text{P}}\} ,{\text{R}},\alpha _{n} ,\beta _{n} ,\gamma _{n} } \right) = & \left( {1 - \alpha _{n} } \right)\omega \\ & + \left( {\gamma _{n} + \beta _{n} } \right)\left( {\frac{{\eta PT_{m} \mu _{0} \alpha _{{n,a}} (t)}}{{\left\| {P_{m} (t) - g_{n} } \right\|^{2} + H^{2} }}} \right) \\ \end{aligned}$$
(16)

When the UAV is working in the uplink wireless data transmission mode, there are \(\alpha _{n, a}(t)=0, \alpha _{b, m}(t)=1, \forall \mathrm {a} \in \{1, \cdots , M\}, \mathrm {b} \in \{1, \cdots , N\}\). The convex optimization problem can be transformed into:

$$\begin{aligned} {\mathcal{L}}_{{b,~{\text{m}}}} \left( {\{ A,Q,{\text{P}}\} ,{\text{R}},\alpha _{n} ,\beta _{n} ,\gamma _{n} } \right) = & \left( {1 - \alpha _{n} } \right)\omega - \alpha _{{b,m}} (t)\left( {\beta _{n} Q_{n} (t) + \gamma _{n} P_{{th}} } \right) \\ & + \alpha _{{b,m}} (t)\left( {\frac{{\alpha _{n} }}{T}\log _{2} \left( {1 + \varepsilon _{{n,m}} \left( {Q_{n} (t),h_{{n,m}} (t)} \right)} \right)} \right) \\ \end{aligned}$$
(17)

where \(\begin{aligned} C_{n} \triangleq & \max \left( {0, - \left( {\left[ {\frac{{\alpha _{n} }}{{T\beta _{n} \gamma _{n} \ln 2}}} \right] - \left[ {\frac{{\sigma ^{2} {\text{H}}^{2} }}{{\mu _{0} }}} \right]} \right)} \right),Q_{j} = 0, \\ & \forall {\text{j}} \in \{ 1, \cdots ,N\} ,{\text{j}} \ne {\text{n}}. \\ \end{aligned}\)The gradient descent method and Kuhn-Tucker conditions are used to iteratively solve the sub-problems in order to obtain the solution of the convex optimization problem.

Finally, consider the node energy threshold constraint. That is, initialize the weight of each node \(W_{n}\). Then calculate the energy value collected by each node, and compare the energy value of each node \(E_{n, m}\left( \alpha _{n, a}(t), P_{m}(t)\right)\) and the set energy threshold \(P_{t h}\). If the energy value collected by the node is greater than the set threshold, update the node weight. Otherwise, recalculate the UAV flight path \(\mathrm {p}_{m}(t)\).

3.2 Optimizing UAV trajectory based on relaxation solution

Firstly the UAV flight trajectory optimization problem is converted into a traveling salesman problem. In order to use the standard traveling salesman optimization method to solve the UAV flight trajectory, a virtual hovering position, that is, M + 1 hovering positions, is added. The distance between them is \(d_{{\mathrm{M}}+1, {\mathrm{n}}}=d_{n, \mathrm{M}+1}=0, \forall \mathrm{n} \in \{1, \cdots , \mathrm{M}+1\}\). This virtual hovering position is a virtual node, which does not physically exist. After the solution is finished, delete the path related to the virtual position.

Then, based on the known flight track points of the UAV, a continuous hovering UAV flight trajectory design scheme is proposed. First, we define a set of binary variables \(\left\{ f_{a, b}\right\} , \forall a, b \in \{1, \cdots , M\}, a \ne b\) , here \(f_{a, b}=1\) and \(f_{a, b}=0\) indicate whether the UAV is flying from position a to position b, \(d_{a, b}=\left\| p_{a}-p_{b}\right\|\) represents the distance of the UAV from a to b. Then use the traveling salesman optimization problem to solve the UAV flight trajectory optimization problem, and most of the traveling salesman problem is solved by the ant colony algorithm. Here, the ant colony algorithm is used to solve the shortest UAV flight trajectory under M hovering coordinates. [27, 28]. The flight trajectory related to the virtual node is deleted, and the UAV flight trajectory that meets the energy threshold of all nodes is obtained.

3.3 UAV trajectory and energy allocation strategy for solving non-convex problems

The convex optimization problem is transformed into multiple sub-problems through the UAV working mode. The problem (OP2) could be discretized into (OP3). The period T is divided into K time periods, expressed as: \(\mathrm {k}=1, \cdots , \mathrm {K}\). The length of each time period \(\delta _{t}\) can be expressed as: \(\delta _{t}=\frac{T}{K}\). In this way, when each k is divided into \(\mathrm {M}\) sub-time periods, \(\alpha _{n, a}[k], \forall \mathrm {a} \in \{1, \cdots , M\}\) represent the time for the UAV downlink wireless energy transmission. In addition, N sub-times \(\alpha _{b, m}[k], \forall \mathrm {b} \in \{1, \cdots , N\}\) represent the time for user uplink wireless data transmission. And the energy consumed by wireless data transmission is \(\mathrm {C}_{n}[k]\). In this way, even at the maximum speed \(V_{\max }\), it can be ensured that the position of the UAV can be approximately unchanged in each small period of time, and the accuracy requirements can be met by selecting the size of K.

$$\begin{aligned} (\text {OP3}): \max _{\{A, P, Q\}} \omega \end{aligned}$$
$$\begin{aligned} {\text{s.t.: }} & \frac{1}{T}\sum\limits_{{n = 1}}^{N} {R_{{n,m}} } \left( {\alpha _{{b,m}} [k],P_{m} [{\text{k}}],C_{n} [{\text{k}}]} \right) \\ & \ge \omega ,\forall n \in \{ 1, \cdots ,N\} ,m \in \{ 1, \cdots ,M\} \\ \end{aligned}$$
(18)
$$\begin{aligned} P_{t h} \le E_{n, m}\left( \alpha _{n, a}[\mathrm {k}], P_{m}[\mathrm {k}]\right) , \forall k \in \{1, \cdots , K\} \end{aligned}$$
(19)
$$\begin{aligned} \sum _{n=1}^{N} \alpha _{b, m}[\mathrm {k}], C_{n}[\mathrm {k}] \le \sum _{\mathrm {n}=1}^{N} E_{n, m}\left( \alpha _{n, a}[k], P_{m}[\mathrm {k}]\right) ,\nonumber \\ \forall k \in \{1, \cdots , K\} \end{aligned}$$
(20)
$$\begin{aligned} \Vert P_{m}[k+1]-P_{m}[k]\Vert ^{2} \le V_{\max }^{2}, \quad \forall \mathrm {k} \in \{1, \cdots , K-1\} \end{aligned}$$
(21)
$$\begin{aligned} \sum _{a=1}^{M} \alpha _{n, a}[k]+\sum _{b=M+1}^{M+N} \alpha _{b, m}[k] \le \delta _{t}, \quad \forall k \in \{1, \cdots , K\} \end{aligned}$$
(22)
$$\begin{aligned} 0 \le \mathrm {PT}_{m} \le PT_{\max },\forall m\in \{1, \cdots , M\} \end{aligned}$$
(23)

In the original problem, where (21) denotes the discretization of node energy threshold constraints. (22) denotes the discretization of energy neutral constraints. (23) is the discretization of UAV maximum speed constraints. A method of continuously approaching UAV flight trajectory is updated. According to the nature of the inequality, continuous approximation obtains the optimal \(R_{n, m}\left( \alpha _{b, m}[k], C_{n}[k], \mathrm {P}_{m}[\mathrm {k}]\right)\), and obtains the updated UAV flight trajectory \(p_{m}^{i+1}[k]\). The inequality can be expressed as follows:

$$\begin{aligned} R_{n, m}\left( \alpha _{b, m}[k], C_{n}[k], \mathrm {P}_{m}[\mathrm {k}]\right) \ge R_{n, m}^{i}\left( \alpha _{b, m}[k], C_{n}[k], \mathrm {P}_{m}[\mathrm {k}]\right) \end{aligned}$$
(24)

The result after each iteration should satisfy this inequality, otherwise the result of this iteration is discarded, and the next iteration is entered. And the known flight trajectory of the UAV is taken as the initial value, and the equivalent expression of \(R_{n, m}^{i}\left( \alpha _{b, m}[k], C_{n}[k], \mathrm {P}_{m}[\mathrm {k}]\right)\) can be obtained:

$$\begin{aligned} \begin{aligned}&R_{n, m}^{i}\left( \alpha _{b, m}[k], C_{n}[k], \mathrm {P}_{m}[\mathrm {k}]\right) \triangleq \alpha _{b, m}[k] \log _{2}\left( 1+\varepsilon _{n, m}\left( C_{n}[\mathrm {k}], h_{n, m}[k]\right) \right) \\&\,\,\,\,-\frac{\varepsilon _{n, m}\left( C_{n}[\mathrm {k}], h_{n, m}[k]\right) \alpha _{b, m}[\mathrm {k}] \log _{2}\left( C_{k}[k]-C_{k}^{i}[k]\right) }{C_{k}^{i}[k]+H^{2}+\xi C_{n}[\mathrm {k}] \alpha _{b, m}[\mathrm {k}]} \end{aligned} \end{aligned}$$
(25)

Here \(C_{k}^{i}[k] \triangleq \left\| P_{m}^{i}[k]-g_{n}\right\| ^{2}\) , \(C_{k}[k] \triangleq \left\| P_{m}{ }^{i}[k]-g_{n}\right\| ^{2}\) , \(\xi =\mu _{0} / \sigma ^{2}\) . Load the above constraint conditions to get a mathematical model for updating the flight trajectory of the UAV (OP4), which can be expressed as:

(OP4):

$$P_{m}^{{i + 1}} [k] = \max _{{P_{m} [k]}} \min _{{k \in \{ 1, \cdots ,K\} }} \frac{1}{T}\sum\limits_{{n = 1}}^{N} {R_{{n,m}}^{i} } \left( {\alpha _{{b,m}} [k],P_{m} [{\text{k}}],C_{n} [{\text{k}}]} \right)$$
(26)
$$\begin{aligned} & {\text{s.t.: }}P_{{th}} \le E_{{n,m}} \left( {\alpha _{{n,a}} [{\text{k}}],P_{m} [{\text{k}}]} \right), \\ & \forall k \in \{ 1, \cdots ,K\} ,n \in \{ 1, \cdots ,N\} \\ & \sum\limits_{{n = 1}}^{N} {\alpha _{{b,m}} } [{\text{k}}],C_{n} [{\text{k}}] \le \sum\limits_{{{\text{n}} = 1}}^{N} {E_{{n,m}} } \left( {\alpha _{{n,a}} [k],P_{m} [{\text{k}}]} \right), \\ & \forall m \in \{ 1, \cdots ,M\} ,k \in \{ 1, \cdots ,K\} \\ & \left\| {P_{m} [k + 1] - P_{m} [k]} \right\|^{2} \le V_{\max}^{2}, \forall k \in \{ 1, \cdots ,K - 1\} \\ & \sum\limits_{{a = 1}}^{M} {\alpha _{{n,a}} } [k] + \sum\limits_{{b = M + 1}}^{{M + N}} {\alpha _{{b,m}} } [k] \le \delta _{t} ,\forall k \in \{ 1, \cdots ,K\} \\ & 0 \le {\text{PT}}_{m} \le PT_{{\max }} ,\forall m \in \{ 1, \cdots ,M\} \\ \end{aligned}$$

Given the energy allocation strategy and the known flight trajectory of the UAV as the initial value, the mathematical model is used to iteratively update the UAV trajectory \(p_{m}^{i+1}[k]\).

Finally, the optimal UAV flight trajectory and energy allocation strategy are solved, substitute the updated UAV flight trajectory into the original discretized mathematical model, reconstruct the constraints of the problem and use genetic algorithm to find the optimal energy distribution strategy \(\alpha _{b, m}[k], Q_{n}[k]\). In this way, the UAV trajectory \(p_{m}[\mathrm {k}]\) and the corresponding energy distribution strategy \(\alpha _{b, m}[k], Q_{n}[k]\) are continuously alternately optimized and calculated, until the accuracy requirements are met and the optimal solution of the original problem \(p_{m}^{*}[k]\) and \(\alpha _{n, m}^{*}[k], Q_{n}^{*}[k]\).

4 Experiments

4.1 Experiments design

In this section, numerical simulation results will be given to verify the performance of the proposed UAV flight trajectory and transmission energy distribution strategy in wireless sensor networks. The experimental setting is shown in Table 2.

Table 2 Experimental parameter setting table [5, 15]

In the simulation, the UAV flight height H, the number of ground user nodes N, and the UAV received noise power \(\sigma ^{2}\) parameters are set. And when the reference distance \(d_{0}=1 \text {~m}\), the channel power gain \(\mu _{0}\), energy collection efficiency \(\eta\), the maximum speed of the UAV \(V_{\max }\), the transmission power \(\text{PT}\) of the UAV. Var is used to represent the variance of energy collected by ground sensors, which is used to evaluate the fairness of energy collected by each sensor.

4.2 UAV trajectory simulation with constant threshold

The proposed framework is firstly validated under a constant energy threshold. In this case, N = 9 ground users are randomly distributed in a two-dimensional area of 20 × 20 m2. Figure 3 shows the flight trajectory of the UAV before and after the energy threshold is set. According to the simulation results in Fig. 3, there are 12 best hovering positions for the UAV, and comparing the flight trajectory after setting the energy threshold, the best hovering position of the UAV is changed and the flight trajectory of the UAV is improved. Figure 4 shows that the continuous hovering flight trajectory and the alternately optimized flight trajectory obtain higher public throughput than the static hovering, and when the flight time is small, the alternately optimized flight trajectory is better than the continuous hovering flight trajectory. However, if T is large enough, the throughput obtained by the multi-position continuous hovering flight trajectory will gradually approach the throughput obtained by the alternately optimized UAV flight trajectory. This verifies that the relaxation solution is effective as the initial value of the alternate optimization, and the proposed alternate optimization algorithm is feasible to solve the UAV trajectory planning and transmission energy allocation scheme optimization.

Fig. 3
figure 3

UAV flight trajectory before and after threshold optimization

Fig. 4
figure 4

The relationship between uplink throughput and flight time

Figures 5 and 6 are the simulation results of the average throughput of the uplink sensor data transmission and the energy collected by the user nodes before and after the energy threshold is set. With the threshold optimization, the minimal, average and variance of harvested energy are improved. In Fig. 5, the minimal harvested energy has been guaranteed so that the energy collected by each sensor device is greater than the energy consumed by the sensor data collection. Meantime, it can be seen that the energy collected by the ground user node has been effectively balanced, ensuring the normal operation of the ground sensor node far away from the UAV. Figure 6 shows that after setting the energy threshold, the average throughput of the system has increased significantly, which further verifies that setting the energy threshold can improve the performance of the system and ensure the overall lifespan of the sensor network.

Fig. 5
figure 5

The energy collected under the random distribution of user nodes

Fig. 6
figure 6

Average uplink throughput under the random distribution of user nodes

Fig. 7
figure 7

Energy harvesting under the obey poisson distribution of user nodes

Fig. 8
figure 8

Average uplink throughput under the obey poisson distribution of user nodes

Figures 7 and 8 show the result under the Poisson distribution with a Poisson coefficient of 0.06 for the user nodes. The proposed framework has similar performance as under the random distribution. In Figs. 9 and 10, the number of user nodes increases, setting the energy threshold can also effectively balance the energy collected by the user nodes, and the public throughput of the system’s uplink sensor data remains relatively stable.

Fig. 9
figure 9

N = 15, The energy values collected under the random distribution of user nodes

Fig. 10
figure 10

N = 15, Average uplink throughput under the random distribution of user nodes

4.3 UAV trajectory simulation with different threshold

The proposed framework is then analyzed under a variable energy threshold. The ground user nodes obey the random distribution, different energy thresholds are set, and the energy collected by the user nodes and the throughput of uplink sensor data transmission are simulated and analyzed. The simulated energy threshold is \(P_{\mathrm {th}}=0.3 \times 10^{-3} \;\mathrm{J}\), \(P_{\mathrm {th}}=0.6 \times 10^{-3}\; \mathrm{J}\) and \(P_{\mathrm {th}}=0.9 \times 10^{-3}\; \mathrm{J}\) [29, 30], which represents low,middle,high energy requirement, respectively.

Fig. 11
figure 11

The energy value collected by the node under different thresholds

Fig. 12
figure 12

The average uplink throughput of different thresholds

As shown in Figs. 11 and 12 the collected energy of each sensor node is effectively balanced, the improved average common throughput of sensor node further ensures the overall lifespan of the entire sensor network. When the energy threshold is set to \(P_{\mathrm {th}}=0.3 \times 10^{-3} \mathrm {~J}\), compared with Fig. 6, it can be seen that after the energy threshold is set, the energy collected by the ground sensor nodes cannot be effectively balanced. When the energy threshold is set to \(P_{\mathrm {th}}=0.6 \times 10^{-3} \mathrm {~J}\), the energy collected by ground sensors can be effectively balanced, and the average throughput of the system’s uplink sensor data transmission can be improved. Therefore, in order to maximize the system throughput, ensure that the ground sensor nodes use the collected energy to upload sensor data information to the greatest extent, and ensure the overall life of the sensor network, it is necessary to set an effective energy threshold. According to different energy thresholds, the change of the energy collected by the user node over time is simulated, and the variance of the energy collected by the node is solved. The following gives the node-free energy threshold, low energy threshold, and high energy threshold, the changes in the energy collected by the node over time (Fig. 12).

Fig. 13
figure 13

No energy threshold, average energy and variance of energy over time

Fig. 14
figure 14

Low energy threshold, average energy and variance of energy over time

Fig. 15
figure 15

High energy threshold, average energy and variance of energy over time

Figures 13, 14 and 15 show the average energy collected by the ground user node and the variance of the energy collected by the node under no energy threshold, low energy threshold: \(P_{\mathrm {th}}=0.6 \times 10^{-3} \mathrm {~J}\), high energy threshold: \(P_{\mathrm {th}}=5 \times 10^{-3} \mathrm {~J}\), respectively. By comparing the case of the no energy threshold in Fig. 13 with the lower energy threshold in Fig. 14. When the flight time can meet a cycle of flight, after setting the energy threshold constraint, the variance of the energy collected by the node is significantly reduced, indicating that a lower energy threshold can effectively balance the energy collected by each ground node. Figure 15 setting the high energy threshold, without UAV resource restrictions, the ground nodes can collect more energy. However, considering that the high energy threshold requires more flight time to meet its energy threshold constraint, the energy value collected by the user node will never meet the set energy threshold, and the energy threshold constraint will become invalid. In different application scenarios, the energy required by the sensor to work normally varies greatly, this framework is suitable for setting different energy thresholds. In actual deployment, the energy required by the sensor is often determined in advance, and the energy collected by the sensor node can be guaranteed based on the energy threshold. Based on proposed framework, the minimum energy requirement of the UAV can be used to guide the model selection of UAV in practical scenarios.

5 Conclusions

In this paper, by alternately optimizing the UAV flight trajectory and the transmission energy allocation strategy, the flight trajectory of the UAV is optimized to maximize the wireless sensor network throughput when considering the overall life of the wireless sensor network and all constraints. In order to solve this complicated problem, firstly, the maximum speed constraint of the UAV is ignored, and the non-convex optimization problem is transformed into a convex optimization problem. Secondly, the convex optimization problem is solved by judging whether each relaxation solution meets the energy threshold. The energy collected by each ground user node is required to be greater than the energy consumed by the uplink data transmission. Thirdly, on the basis of the known relaxation solution, the UAV flight trajectory optimization is transformed into a travelling salesman problem, and a UAV flight trajectory is optimized using the ant colony algorithm. Finally, considering the non-convex optimization problem with the maximum speed constraint of the UAV, an approximation UAV trajectory update method is designed by using the known UAV trajectory as the initial value, and alternately optimizing the UAV flight trajectory and energy transmission, resource allocation strategy.

A discrete UAV flight trajectory is obtained after performing alternate optimization in this paper. Numerical results show that setting the energy threshold can effectively balance the energy collected by each ground user node. The UAV flight path in the wireless sensor network satisfies the constraints and maximizes the throughput of the wireless sensor network. A continuous and smooth trajectory of UAV has advantages in implementing UAV flight control and decreasing UAV energy consumption. In addition, multiple UAVs cooperatively assisting wireless power and information transfer could be expanded.