## 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
In this paper, polynomial time algorithm is used to construct a new partial coverage model, which transforms the nonlinear programming problem into a linear programming problem, and the optimal solution of partial coverage can be obtained within the computable complexity. Suppose there is a partial coverage vector \(\theta=\{\theta_{1},\theta_{2},\ldots,\theta_{n}\}\) in the whole life cycle \(L\), it makes the target \(r_{k}\) satisfy the mathematical relation \(f\): There exists node \(s_{k}\) which covers monitoring target \(r_{k}\) at least in \(L\)-\(\theta_{k}\) time. If Boolean variable \(y_{i,k}\) is true, it means that node \(s_{k}\) meets coverage needs, and it is responsible for the monitoring of target \(r_{k}\). So, the partial coverage problem can be described as follows:

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]5

where the objective function \(t_{p}\) is the time segment of mathematical relation \(f\), \(C\) represents the cluster in working condition. By optimizing Equation (5), we can summarize the analysis of partial coverage problem as follows: The objective function of partial coverage model is \(T_{opt}\), the variable of the model is the total time \(b_{i,k}\) of node \(s_{k}\) covering target \(r_{k}\). So partial coverage model can be defined as:

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]6

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]7

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]8

\[E_{R}^{i}(r)=E_{R}^{i}(r-1)-E_{C_{0}}^{i}(r-1) \tag{8}\]9

For target \(r_{k}\), node coverage condition is \(b_{i,k}>0\). For sensor node \(s_{k}\), the time length when it covers \(r_{k}\) is \(b_{i,k}\). \[E_{Co-CH}(r-1)=E_{R}(r-1)+E_{D}(r-1)+E_{T}(r-1) \tag{9}\]0 Node coverage of wireless sensor network. ## 3 Experiments and Results

In this section, the proposed optimization model based on clustering optimization for optimal allocation of energy resources in railway wireless sensor networks is simulated and validated. By comparing with the two representative algorithms (FAF-EBRP algorithm [23] and MOFCA algorithm [24]) in terms of life cycle and the amount of data collected by sink nodes, the advantage of the proposed optimization model in energy efficiency is verified. In the experiment, a 600-m-long track and surrounding infrastructure were selected as monitoring objects. The monitoring area can be approximated to a 600-m-long and 60-m-wide rectangular area. All sensors used for monitoring were randomly distributed in the monitoring area. Then the monitoring area was evenly divided into 10 monitoring sub-networks, each of which was a square area of \(60\) m \(\times\) 60 m. A sink node was located in the center of each sub-network monitoring area. The sensor nodes in the sub-network transmit the monitoring data to the corresponding cluster head and sink node, and then transmit the monitoring data to the base station by the sink node. One of the sub-networks was selected as the simulation environment to verify the energy-saving effect of routing protocols. In the simulation scenario, a total of 200 sensor nodes were randomly distributed in the monitoring area by setting the track as X-axis and the endpoint far from the base station as the coordinate origin. The simulation parameters are shown in \[E_{Co-CH}(r-1)=E_{R}(r-1)+E_{D}(r-1)+E_{T}(r-1) \tag{9}\]1

In this paper, the effective life cycle of the system, the total residual energy of all nodes, the variance of the residual energy of each node, and the amount of data received by the sink node were used as evaluation indexes to compare the energy efficiency of the proposed algorithm with that of the other two algorithms. The simulation results are shown in Figures 7-10. As shown in Figure 7, when using the proposed routing protocol to communicate, the nodes of the special wireless sensor network for railway status monitoring begin to fail due to energy exhaustion only after 200 rounds of communication.