## 2 Methodology
### An Optimal Energy Resources Allocation Method Based on Clustering Optimization
#### 2.2.1 Clustering and Cluster Head Initialization Based on Improved K-Medoids
When using the other two routing protocols, the nodes of the sub-network begin to fail after 190 rounds, and the trend of node failure is similar, but the effect of MOFCA is slightly better. In Figure 8, the total residual energy of all nodes represents the energy-saving effectiveness of different routing protocols. When using these three protocols, the curve of total residual energy changes smoothly, but based on the proposed protocol in this paper, the total residual energy of nodes is more, and the rounds of communication are more. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Description** & **Value** \\ \hline \(E_{d}\) & Circuit energy consumption parameter & 45 \\ \(\rho_{f}\) & Free space energy consumption parameters (\(d^{2}\)) & 8 \\ \(\rho_{m}\) & Multipath fading energy consumption & 0.0012 \\  & parameter (\(d^{4}\)) & 0.0012 \\ \(E_{i}\) & Initial energy & 0.02 \\ \(T\) & Number of sensor nodes & 200 \\ \(l\) & Packet size & 100 \\ \(k_{opt}\) & Number of clusters & 8 \\ \(m\) & Population size & 100 \\ \(p_{m}\) & Mutation rate & 0.015 \\ \(p_{c}\) & Crossover rate & 0.8 \\ \(t\) & Maximum number of iterations & 400 \\ \(\alpha\) & Position adjustment factor of sink node & 0.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Simulation parameters of routing protocol based on clustering optimization. As shown in Figure 9, the variance of residual energy of each node is smaller than that of the other two protocols when using our routing protocol. It means that the energy consumption of each node in the sub-network is more balanced, and it is more conducive to improving the overall effective life cycle of the system. As shown in Figure 10, the proposed routing protocol can ensure that the sink node receives more information about the service status of railway infrastructure and operating environment. Therefore, the proposed routing protocol not only improves the life cycle of the sub-network, but also increases

Figure 8: Comparison of the total residual energy of all nodes. Figure 7: Comparison of the effective life cycle of the system. the amount of data received by the sink node, which would provide abundant data and information support for the stable operation of the railway monitoring system. For partial coverage model, a total of 200 sensor nodes were randomly distributed in the monitoring area, the initial energy of wireless sensor node was 100, the number of target was 40. The initial value of coverage vector \(\theta\) was 0.7, vector step was 0.05, the final value was 1. The simulation result is shown in Figure 11.

Figure 10: Comparison of the amount of data received by the sink node. Figure 9: Comparison of the variance of the residual energy of each node. As shown in Figure 11, the lifetime of the network decreases linearly with the increase of partial coverage vector in fixed step. It shows that the coverage vector is inversely proportional to the network lifetime. In the process of node \(s_{k}\) monitoring target \(r_{k}\), the increase of fixed step of coverage vector is equivalent to the linear increase of coverage time, so the coverage time of node \(s\) increases, it leads to the increase of energy consumption, so the lifetime of network decreases linearly. ## 4 Discussion and Conclusions

The special wireless sensor network for railway status monitoring is dedicated to real-time acquisition of service status information of railway infrastructure and its operating environment, and it can rapidly transmit monitoring data to remote data centers for the diagnosis and prediction of the service status of the system. However, due to the limited energy storage of each node in the special wireless sensor network, improving the energy efficiency of the nodes in the network and prolonging the lifetime of the network are the focus of the research. Many researchers begin with the design and optimization of routing protocols in wireless sensor networks for status monitoring [25; 26; 27].