## 2 Queue Scheduling and Optimization Mechanism of Large-Scale LEO Satellite Communication Networks
### Queue Analysis and Optimization Mechanism Based on PSO Algorithm
The maximum position of each particle is  
\[X_{max}=(u_{max},n_{max})=(200,7) \tag{4}\]  
The minimum position of each particle is  
\[X_{min}=(u_{min},n_{min})=(1,2) \tag{5}\]  
The maximum velocity of each particle is \(V_{max}=(2,2)\), and the minimum velocity of each particle is \(V_{min}=(0,0)\). In this study, the initial positions of each particle in the population were randomly initialized as  
\[X_{i}=(u_{i},n_{i}),1\leqslant i\leqslant 20 \tag{6}\]  
The initial velocity of each particle in the swarm is randomly initialized as \(V_{i}\). The fitness function value of each particle at the initial position is calculated as  
\[p_{i}=[MTU\cdot u_{i}\cdot(n_{i}-1)-L_{peak}]^{2} \tag{7}\]  
The historical optimal position of each individual particle is \(\textit{{pbest}}_{i},1\leqslant i\leqslant 20\). And the global optimal position of the swarm is _gbest_. According to the individual historical optimal position of each particle and the global historical optimal position of the population, the velocity update formula is used to update the velocity of each particle \(V_{i}^{{}^{\prime}}\) and further update the position of each particle \(X_{i}^{{}^{\prime}}\). The velocity update formula can be defined as  
\[V_{i}^{{}^{\prime}}=\omega\cdot V_{i}+c_{1}\cdot rand()\cdot(\mathit{pbest}_{i}- X_{i})+c_{2}\cdot rand()\cdot(\mathit{gbest}-X_{i}) \tag{8}\]  
\[X_{i}^{{}^{\prime}}=X_{i}+V_{i}^{{}^{\prime}} \tag{9}\]  
where the \(rand\) function returns a random number uniformly distributed in the interval (0, 1). The fitness function value of each particle \(p_{i}^{{}^{\prime}}\) is recalculated, and the individual historical optimal position of each particle \(\mathit{pbest}_{i}\) and the global optimal position of the swarm \(\mathit{gbest}\) are updated. Then, the individual historical optimal position of each particle \(\mathit{pbest}_{i}\) and the global optimal position of the swarm \(\mathit{gbest}\) are iteratively calculated until the number of iterations reaches \(T=10^{3}\). At this time, the global optimal position of the swarm \(\mathit{gbest}=(u_{b},u_{b})\) is the optimal solution for the lengths and numbers of the queues within the output ports of each satellite node in the large-scale LEO constellation for transmitting time-sensitive traffic. The optimal solution \(\mathit{gbest}\) obtained by the optimization algorithm is just enough to withstand the highest time-sensitive traffic load \(L_{\mathit{peak}}\). The lengths and numbers of queues can only be positive integers, so \(u_{b}\) and \(n_{b}\) must be rounded. If the lengths and numbers of queues are rounded down, the total depth of the queues used to transmit time-sensitive traffic is insufficient to withstand \(L_{\mathit{peak}}\), resulting in packet loss. To this end, the length and number of queues need to be rounded up. To reduce the packet loss rate of time-sensitive service traffic, \(u_{b}\) and \(n_{b}\) should be rounded up. This can be defined as  
\[U_{b}=\lceil u_{b}\rceil,N_{b}=\lceil n_{b}\rceil \tag{10}\]  
Check whether \(U_{b}\) and \(N_{b}\) meet the following condition:  
\[MTU\cdot U_{b}\cdot(N_{b}-1)-L_{\mathit{peak}}\geqslant 0 \tag{11}\]  
If the conditions are met, then \(L_{b}=MTU\cdot U_{b}\), and \(N_{b}\) is the optimal solution for the lengths and numbers of the queues within the output ports of each satellite node in the large-scale LEO constellation for transmitting time-sensitive traffic. The process of optimizing the lengths and numbers of the queues by this mechanism is shown in Algorithm 1. After optimizing the queue lengths and numbers for scheduling and forwarding time-sensitive traffic flows, the number of queues may exceed two, deviating from traditional CQF forwarding. Similar to CQF, among the n queues designated for scheduling and forwarding time-sensitive traffic, at any given moment, only one queue is in the Open state, referred to as the sending queue; the rest are in the Close state, known as receiving queues.