# Multi-Controller Deployment in SDN-Enabled 6G Space-Air-Ground Integrated Network
## 2 Problem Formulation and Solution
### Problem Formulation
#### 2.1.2 Hierarchical Multi-Controller Deployment Modeling  
Network Delay Model  
The propagation delay between the switch and the controller is the distance between two points in space divided by the speed of light. The propagation delay unit is ms. Let the known data be the longitude, latitude and altitude information of the satellite node and controller, as shown in Figure 3.  
Assuming that point A is the latitude and longitude of a controller \(c_{j}=\left(\theta_{cj},\varphi_{cj}\right)\), and point B is the latitude and longitude of a satellite node \(s_{i}=\left(\theta_{si},\varphi_{si}\right)\), first convert the geographical coordinates into three-dimensional Cartesian coordinates by using (1) and (2):  
\[\left(x_{cj},y_{cj},z_{cj}\right)=r*\left(\cos\theta_{cj}\cos\varphi_{cj},\sin \theta_{cj}\cos\varphi_{cj},\sin\varphi_{cj}\right) \tag{1}\]  
\[\left(x_{si},y_{si},z_{si}\right)=R*\left(\cos\theta_{si}\cos\varphi_{si},\sin \theta_{si}\cos\varphi_{si},\sin\varphi_{si}\right) \tag{2}\]  
Figure 3: The 3D coordinate diagram of the satellite operation. where \(R\) is the radius of the orbit and \(r\) is the radius of the Earth; theoretically, \(R=r+h\), and \(h\) is the altitude of the satellite. Then, the distance between \(A\) and \(B\) is (Equation (3)):  
\[d_{ij}=\|\overrightarrow{A}\overrightarrow{B}\|=\sqrt{\left(x_{cj}-x_{si} \right)^{2}+\left(y_{cj}-y_{si}\right)^{2}+\left(z_{cj}-z_{si}\right)^{2}} \tag{3}\]  
Finally, the propagation delay from the switch \(s_{i}\) to the controller \(c_{j}\) in t time chip is expressed by using (4):  
\[L_{ij}(t)=\frac{1}{\mathbb{C}}d_{ij}(t) \tag{4}\]  
where \(\mathbb{C}\) represents the speed of light \(3\times 10^{8}\) m/s. In addition, because the satellite node is dynamic, set a maximum delay \(L_{max}\); when \(L_{ij}>L_{max}\) the satellite switch node is not in the jurisdiction of the current controller. The above analysis leads to the optimization of sub-goal 1 as follows: (Equation (5)):  
\[f_{1}=\min L_{ij},\{i=1,2,\ldots,n.j=1,2,\ldots,m\} \tag{5}\]  
Controller Load Model  
There are three main considerations for controller load: number of the packet-IN packet requests to the controller, memory load \(B_{m}\), and CPU load \(B_{c}\). If the packet-IN packet rate of the switch node \(s_{i}\) is \(q_{i}(t)\), the controller load for time slice t is expressed by using (6):  
\[B_{j}(t)=\alpha\times\frac{\sum_{s_{i}\in S_{c_{j}}}q_{i}(t)*e_{ij}}{Q_{c_{j}} }+\beta\times B_{\text{m}}(t)+\gamma\times B_{C}(t) \tag{6}\]  
where \(s_{cj}\) is the set of switch nodes governed by the controller \(c_{j}\), \(Q_{c_{j}}\) is the resource capacity of the controller \(c_{j}\), and \(\{\alpha+\beta+\gamma=1|\alpha,\beta,\gamma\in(0,1)\}\) is the variable parameter [34]. In addition, the maximum resource capacity of the controller is \(Q_{max}\), when \(B_{j}>\rho*Q_{max}\), which means that the current controller cannot move into the switch node, and \(\rho\in(0,1)\) is a variable parameter. In order to achieve load balance among the controllers, the optimization sub-goal is defined as minimizing the variance of the controller load. The physical meaning of variance is to measure the deviation between the random variable and its mathematical expectation (i.e., the mean); thus, the variance can be used to measure whether the controllers are in equilibrium with each other. The above analysis leads to the optimization of sub-goal 2 as follows (Equation (7)):  
\[f_{2}=\min\frac{\sum_{j=1}^{m}\left[B_{j}-\frac{1}{m}\sum B_{j}(t)\right]^{2} }{m} \tag{7}\]  
The existence of the loss function is mainly used to determine whether to update the position coordinates of the controller and the relationship between the switch and the controller. The loss function is defined as the weighted sum of the maximum delay of the network and the total average load of the controller.