To optimize the capacities and locations of newly installed photovoltaic (PV) and battery energy storage (BES) into power systems, a JAYA algorithm-based planning optimization methodology is investigated in this article. . This paper investigates the construction and operation of a residential photovoltaic energy storage system in the context of the current step–peak–valley tariff system. Firstly, an introduction to the structure of the photovoltaic–energy storage system and the associated tariff system will be. . In the context of increasing renewable energy penetration, energy storage configuration plays a critical role in mitigating output volatility, enhancing absorption rates, and ensuring the stable operation of power systems. For this purpose, a series of mathematical models with constraint conditions. . However, how to optimally configure photovoltaic and energy storage capacity to achieve the best economy is essential and a huge challenge to overcome. In this paper, based on the historical data-driven search algorithm, the photovoltaic and energy storage capacity allocation method for PES-CS is. . Ensuring the economic viability and stability of a PV-storage-charging integrated system hinges on the rational configuration of photovoltaic (PV) capacity, battery energy storage systems (BESS), and charging piles. Below is a structured approach covering technical principles, calculation methods. .