## 2 The Network Architecture
### Vehicle-Ground Networking Architecture  
The vehicle-ground network architecture is shown in Figure 2. We assume that the trackside nodes are randomly distributed along the tunnel wall, and the k-means algorithm  
Figure 1: In-vehicle network architecture.  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **Security Service** & **Non-Security** \\ \hline
**Strict Security Service** & **Sub-Security Service** & **Service** \\ \hline Operation control system (OCS) & Train operation status monitoring (TOSM) & Passenger multimedia service (PIS) & service \\ Operational voice communication system (OVC) & Closed-circuit television (CCTV) & \\ \hline \hline \end{tabular}
\end{table}
Table 1: The categories of urban rail services.  
is utilized to divide clusters. Assuming that the trackside nodes are \(x_{1},x_{2},x_{3},\cdots,x_{n}\) the clustering process can be divided into the following steps:  
* Step 1: Determine the number of clusters, which is denoted as K. Then, randomly select K nodes as the center of each cluster, which are denoted as \(u_{1}^{(0)},u_{2}^{(0)},u_{3}^{(0)},\cdots,u_{k}^{(0)}\);
* Step 2: Calculate the loss function \(J(c,\mu)=\min\sum\limits_{i=1}^{n}\|x_{i}-\mu_{c_{i}}\|^{2}\), where \(c_{i}\) is the cluster for \(x_{i}\). Then, repeat Step 3 and Step 4 until cluster members do not change with the repetition;
* Step 3: Assign \(x_{i}\) to the cluster with the minimum \(J\);
* Step 4: Recalculate cluster central nodes as \(u_{1}^{(1)},u_{2}^{(1)},u_{3}^{(1)},\cdots,u_{k}^{(1)}\);  
In Step 1, we depend on the sum of the square errors and cluster load to determine K, which can be expressed by the following formula:  
\[SSE=\sum\limits_{i=1}^{k}\sum\limits_{p\in C_{f}}|p-u_{c_{i}}|^{2}, \tag{1}\]  
\[CL=\sum\limits_{i=1}^{n_{c_{i}}}L_{c_{i}}, \tag{2}\]  
where \(p\) is the cluster member of \(c_{i}\), \(L_{c_{i}}\) is the packet length of \(p\). For \(K\in[k_{1},k_{n}]\), the value that can minimize the clustering evaluation value is selected as the number of clusters. The clustering evaluation value can be calculated by Equation (3):  
\[EV=a_{1}*SSE+a_{2}*CL, \tag{3}\]  
where \(a_{1}\) and \(a_{2}\) are evaluation coefficients. Cluster load is an importance parameter in an urban rail transit scenario, which affects whether the network is congested, and square error is also a valuable evaluation parameter. Based on this, \(a_{1}\) and \(a_{2}\) are set to the same value in this paper. Therefore, we have \(a_{1}=a_{2}=0.5\).  
Similarly, the communication nodes in the vehicle-ground network system include relay nodes, cluster head nodes, and sink nodes.  
1. Relay nodes. Relay nodes are responsible for forwarding the information from the vehicle to the trackside cluster heads. Unlike in-vehicle service nodes, relay nodes do not carry specific services but only play the role of the wireless relay. Each relay node has equal status and the same communication ability and can participate in cluster-head election.
2. Cluster head nodes. Cluster head nodes in the vehicle-ground network have the same function as in the in-vehicle network.
3. Sink nodes. In the in-vehicle network, sink nodes are deployed on the top center of the carriage, but in the vehicle-ground network, sink nodes are located at the stations. Sink nodes in the vehicle-ground network are responsible for forwarding the data from cluster heads to the core network. Considering the time delay, when the train is in the first-half area between two stations, the data packets are forwarded to the sink node of the previous station and vice versa to the sink node of the next station.