Environmental concerns and higher energy demand require more energy. Solar and wind are renewable energies. One of the most important and available renewable energy sources is the use of wind and solar sources. This study examines energy generation and battery storage systems for lowering peak load and smoothing a residential substation's load curve. This study aims to present a useful and effective mechanism for improving the design of a hybrid system using solar panels and wind turbines to provide the common peak load and as much actual load demand as possible at the desired location. The proposed method provides the optimal solution after obtaining light radiation, wind speed, and load demand. Training and learning-based algorithms optimize. This study focuses on reducing lifetime costs. Prices and equipment are accurate, and power plant costs include initial and ongoing costs. PSO optimizes Karachi's anemometer and radiation data. The results showed that the network's summer, fall, and winter peak outputs are 12368 kW, 14865 kW, and 77 147 kW; the systems are 68.31 kW, 29.38 kW, and 2337 kW. Using the seasonal average rather than the annual average improves the system's dependability and provides a more accurate response to the desired peak load. Wind and solar hybrid systems connected to the grid can reduce the grid's peak load and total cost over time.