## 4 UAV-TPUA: UAV Trajectory Progress Updating Algorithm
### Updating Trajectory Progress  
The specific three-stages BWSAR framework will be described in detail below. In the initial stage, firstly, the UAV autonomously scans the entire emergency area using configurable beams and transmitting power. Secondly, the UAV can estimate the directions of all UEs with higher Signal-to-Noise Ratios (SNRs). During the second stage, the UAV can further optimize the angles of transmitting signals within the initially estimated directions. In the third stage, when the UAV approaches the emergency area, it can conduct three-dimensional positioning of the UEs (including AoA and ToA). **Stage 1: DL-SSB only. ** In the initial phase, which is when the UAV is in the far part of the emergency zone, the altitude of the UAV is relatively high. Specifically, let \(z_{uav}>\gamma_{1}\) be the remote area judgment condition, where \(\gamma_{1}\) is the preset height value, which can be set according to the performance and experience of the UAV 5G base station. In this phase, the strategy is to quickly fly the UAV to the target area, while the UE positioning accuracy is not high. Therefore, during this phase, the UAV uses the DL-SSB to quickly search the entire airspace and obtain all UE Angle information \((\theta^{sb}_{i,j},\phi^{sb}_{i,j}),i=1,2,\ldots,U,j=0,1,\ldots,N\), where \(\theta^{sb}_{i,j}\) and \(\theta^{sb}_{i,j}\) represent the pitch angle and azimuth angle of the ith UE in frame \(j\), respectively. Next, within this refresh interval \(\Delta T\), the UAV selects the direction with the largest RSRP among all UEs and flies in that direction at the preset flight speed. Let \((\theta^{sb}_{i,i,j},\phi^{sb}_{i,j,i})\) be the chosen target direction information, then after jth refresh interval, the position of the UAV can be expressed as:  
\[ \begin{split}& P^{(j+1)}_{uav}=\left(x^{(j+1)}_{uav},y^{(j+1)}_{ uav},z^{(j+1)}_{uav}\right)=f(x^{(j)}_{uav},y^{(j)}_{uav},z^{(j)}_{uav},\theta^{ ssb}_{i,j},\phi^{sb}_{i,j,i},\Delta s)\\ &=\left(\begin{array}{c}\Delta s\sin\theta^{sb}_{i,j}\cos \theta^{sb}_{i,j,i}+x^{(j)}_{uav},\\ \Delta s\sin\theta^{sb}_{i,j}\sin\theta^{sb}_{i,j,i}+y^{(j)}_{uav},\\ \Delta s\cos\theta^{sb}_{i,j,i}+z^{(j)}_{uav}\end{array}\right)\end{split}  \tag{8}\]  
**Stage 2: DL-SSB+RS Directly. ** In this stage, given the proximity of the UAV base station to the approximate center of the UEs, we employ the DL-SSB+PRS technology for precise UEs localization and direct flight of the UAV towards the destination location. Initially, we continue to utilize the SSB coarse angle measurement technique from the **Stage 1** to identify the potential target area. Subsequently, the UAV re-configures DL-PRS with finer beams within the direction chosen by UEs in **Stage 1**. UEs select the best beam and report beam identifier and RSRP, which can be used to estimate \([\theta^{prs}_{i,j},\phi^{prs}_{i,j},\tau^{prs}_{i,j}]\). Thus, the UEs' location can be estimated as shown in Equation (9):  
\[ \begin{split}&\hat{P}_{u{c}_{i,j+1}}=\left(\xi_{u{c}_{i,j+1}}, \beta_{u{c}_{i,j+1}},\pi_{u{c}_{i,j+1}}\right)\\ &=\left(\begin{array}{c}x^{(j)}_{uav}+\tau^{prs}_{i,j+1}\frac{ \sin\theta^{prs}_{i,j+1}\cos\theta^{prs}_{i,j+1}\cos\theta^{prs}_{i,j+1}}{\sin \theta^{prs}_{i,j+1}\cos\theta^{prs}_{i,j+1}},\\ y^{(j)}_{uav}+\tau^{prs}_{i,j+1}\frac{\sin\theta^{prs}_{i,j+1}\cos\theta^{prs}_{ i,j+1}}{\sin^{2\theta^{prs}_{i,j+1}\cos\theta^{prs}_{i,j+1}}\cos\theta^{prs}_{i,j+1}},\\ z^{(t)}_{uav}+\tau^{prs}_{i,j+1}\frac{\sin^{2\theta^{prs}_{i,j+1}\sin\theta^{prs }_{i,j+1}}}{\sin^{2\theta^{prs}_{i,j+1}\cos\theta^{prs}_{i,j+1}}\cos\theta^{prs }_{i,j+1}}\end{array}\right)\\ \end{split}  \tag{9}\]where \(\theta^{prs}_{ij+1}\), \(\phi^{prs}_{ij+1}\) and \(\tau^{prs}_{ij+1}\) represent the elevation and azimuth, respectively. On this basis, according to Equation (1), we can easily get all UEs corresponding EA regions as follows:  
\[