## 4 The Optimization of BS Location  
One way to improve the longevity and general energy performance of a large WSN network is to add an RN inside the network's large area, calculate the BS's suitable location, and move the BS from one desired point to another. First, we will discuss the impact of the mobile BS-optimized locations in the network large area. The second step will cover introducing an RN in a large-scale WSN. The best point to place the BS is chosen using a new algorithm that considers the distinction in the network's large region between SNs and BS virtual points in the grid. Let A be the number of alive SNs, and V denote the number of BS virtual points. V is used to find the optimal points v\({}^{*}\). Let us define the SN coordinates n as \((x_{n}\,\ y_{n})\) and the coordinates of the virtual point v as \((x_{v}\,\ y_{v})\). If \(D\) is the distance between consecutive virtual points within the grid, the equation below can be used to calculate the number of virtual points within a large network area. \[\Omega={(\frac{M}{D}-1)}^{2} \tag{12}\]  
The distance between each SN n and virtual point m is illustrated by:  
\[d(n,v)=\sqrt{\left[(x_{n}-x_{v})^{2}+(y_{n}-y_{v})^{2}\right]} \tag{13}\]  
A weight function W\({}_{f}\) is used to establish the computation between alive SNs and virtual point v as follows:  
\[W_{f}=\sum_{n=1}^{S}d(n,v) \tag{14}\]  
The point that provides the shortest distance from all alive SNs is selected as the best BS location from calculated weights and is given as:  
\[v*=argmin\left(W_{f}\right) \tag{15}\]  
The proposed system enhances the SEP algorithm by introducing a three-tier energy heterogeneity model for SNs, categorizing them as normal, medium, and superior based on their initial energy levels to ensure balanced power consumption. A strategically placed central relay node facilitates efficient data aggregation, while a mobile BS dynamically optimizes communication and reduces energy-intensive transmissions. The modified SEP algorithm calculates the probability of nodes becoming CHs based on their energy levels, with superior nodes having the highest likelihood, followed by medium and normal nodes. This hierarchical energy model, combined with the relay node and mobile BS, reduces energy consumption, evenly distributes the load, and extends the network lifespan. The flowchart in Figure 5 illustrates the integration of these components and demonstrates how the transmission process between SNs and the BS achieves significant energy efficiency improvements. When the WSN operates in a large deployment area, some of the SNs will die as their energies are depleted. Using the BS suitable location computation, the BS placement can be altered according to the number of alive SNs that are still present. The new best BS location is determined by recalculating the overall distances between each virtual point and the left-alive SNs, subsequently choosing the virtual point with the shortest distance from every SN that is still alive. BS moves to the new location where it can receive sensor node data the best. Algorithm 1 shows the operation of the proposed algorithm without relays. When a relay node R is added to the center of the network large area, the RN receives the data that the CHs have collected if the distance between a CH and the RN is smaller than the distance between the CH and the BS. The RN then resends its  
The path loss \(\mathrm{L(d)}\) (measured in dB) is approximated by,  
\[L\ (d)=L_{0}+10n\times log(d/\ d_{0}) \tag{17}\]  
where \(p\) is the path loss factor, which fluctuates with terrain and surroundings, and \(L_{0}\) is the path loss at an arbitrary reference distance \(d_{0}\).