Demand for electric vehicles (EVs) is growing steadily, which causes a number of big problems. One of the biggest problems is that there aren't enough charging stations. Nations are working to speed up the growth of renewable energy sources that can be used to power charging stations. This is to reduce the damage that carbon emissions do to the environment. Battery switching stations (BSSs) that are powered by photovoltaic cells (PV) use the traditional integration of renewable resources that are used to provide electricity for electric vehicles (EVs). The charging strategy of PV-based battery storage systems has a big impact on the availability, cost, and carbon footprint of the switching service (BSSs). In this study, an optimal charging method is proposed to. Cat-and-mouse optimization is used to figure out how much the battery should cost based on how many cars can park there, how much power the PV system can produce, how much load is connected to the PV system, and how many electric cars are available (EVs). By keeping the BES at the best speed for charging and discharging the battery, the battery will last longer.