In response to the adverse impact of uncertainty in wind and photovoltaic energy output on microgrid operations, this paper introduces an Enhanced Whale Optimization Algorithm (EWOA) to optimize the energy storage capacity configuration of microgrids. In this research work mainly concentrate to develop intelligent control based grid integration of hybrid PV-Wind power system along with battery storage system. The grid integration hybrid PV – Wind along with intelligent controller based battery management system has been developed a. A two-layer optimization model and an improved snake optimization algorithm (ISOA) are proposed to solve the capacity optimization problem of wind–solar–storage multi-power microgrids in the whole life cycle. Equipped with energy storage device, the crogrid is a system composed of load and icro power. It can provide both electricity and heat. The objective is to ensure stable microgrid.