To effectively manage the charging and discharging of solar energy, one must consider 1. Utilizing advanced battery storage systems, 2. . Abstract We study the optimal management of a photovoltaic system's battery owned by a self-consumption group that aims to minimize energy consumption costs. We assume that the photovoltaic system is composed of a photovoltaic panel and a battery, where the photovoltaic panel produces energy. . Variations in solar irradiance caused by cloud movement can lead to sudden and unpredictable changes in the power output of large-scale photovoltaic plants. Enhancing grid integration, and 4.