## 2 Multilevel Edge Network Task Offloading Model
### Offloading Node Resources
#### 2.2.2 UAV Offloading  
When the terminal equipment cannot support task computing, the terminal equipment can offload the task to the edge computing server. The UAV in this model can be used as a MEC server or as a relay node to relay the task data to the G-MEC for calculation. This section discusses the UAV serving as a MEC server to provide computing offloading services for terminal equipment. The UAV offloading utility function is also divided into the delay and energy parts. The delay partial utility function considers the transmission (\(T_{\text{uav-}c}\)), propagation (\(T_{\text{uav-b}}\)), and computational (\(T_{\text{uavx}}\)) delays as follows:  
\[T_{uuv-c}=\frac{Z}{R_{uuv-b}}, \tag{5}\]  
\[T_{uuv-b}=d/v, \tag{6}\]  
\[R_{uuv-b}=B\log_{2}(1+\frac{P_{u}h_{0}^{2}d_{u}^{-q}}{\sigma^{2}}), \tag{7}\]  
\[T_{uuv-x}=\frac{N_{z}}{R_{uuv}}, \tag{8}\]  
where \(R_{uuv-b}\) is the transmission speed, \(B\) is the channel bandwidth, \(h_{0}\) is the channel gain, and \(\sigma\) is the noise power. \(q\) is the path decay index. Meanwhile, \(d_{u}\) denotes the transfer distance from the terminal to the UAV, \(P_{u}\) denotes the terminal transmit power, and \(R_{uuv}\) denotes the task running rate on the UAV. Additionally, \(v\) is the propagation rate (approximately the speed of light). Total delay function (\(T_{uuv-z}\)) is obtained by combining the transmission, propagation, and computational delays as follows:  
\[T_{uuv-z}=T_{uuv-x}+T_{uuv-c}+T_{uuv-b}. \tag{9}\]  
The return result data are small, and the data return time is ignored here. The energy utility function considers the energy consumed by the UAV calculation (\(E_{uav}\)), by the UAV operation (\(E_{uuv-u}\)), and by the signal emitted by the terminal (\(E_{uuv-u}\)). Thus, \(E_{uuv}\), \(E_{uuv-u}\), and \(E_{uuv-u}\) are given by as follows:  
\[E_{uuv-u}=P_{u}T_{uuv-c}, \tag{10}\]  
\[E_{uuv}=N_{z}\cdot\delta_{uuv}, \tag{11}\]  
\[E_{uuv-u}=P_{uuv-u}T_{uuv-c}, \tag{12}\]  
where \(\delta_{uuv}\) is the energy consumed by the task of performing a cycle at the UAV and \(P_{uuv-u}\) is the UAV operating mechanical power. Green energy charging, such as solar panels, can increase the working time of the UAV, enhance the reliability of UAV processing tasks, provide more unloading services for terminal devices, and make the offloading system more flexible and easy to implement. This model considers using WPT technology to recharge the UAV with solar or wind energy. The tasks are assumed to be independent of one another, and the energy is in a dynamic process. The model differentiates the energy stored in the UAV from high to low into four levels, \(E_{\text{level}}\) = {1, 2, 3, 4}. Energy level 4 is the state of abundant electricity between 100% and 75%. Energy level 3 is the power of the UAV after a period of operation, with electricity between 75% and 50%. Energy level 2 is the amount of electricity that the UAV runs for an extended time between 50% and 25%. Finally, energy level 1 is the state in which the UAV energy will run out, with electricity between 25% and 0%. Figure 3 shows the UAV energy level relationship. In general, the UAV energy level is a decreasing process with the task processing from the high energy to low energy level. However, considering the UAV function for green energy supply, a certain probability distribution of the UAV energy level is present when the next task is completed, depending on the size of the task and the access ratio. In this study, we assume that the tasks are independent of one another. That is, when the current task arrives, the energy level of the UAV is a random distribution of a certain probability; the probability of energy levels 2 and 3 is higher, and the probability of energy levels 1 and 4 is lower. The different energy levels of the UAV will affect the ability of the UAV operation and processing tasks, namely, the performance coefficient of the energy consumption part of the UAV in the energy utility function. Furthermore, different energy levels correspond to different performance coefficients.