## 1 Introduction  
The most important feature of the research in the study of energy management is the fact that energy management is a vital issue in the development of energy management. The energy management is a vital issue in the development of energy management. ## 1 Introduction  
Global energy demand is rising due to population growth, urbanization, and technological progress [1,2]. This rise creates significant sustainability and economic development challenges, affecting how policymakers, industries, and local communities handle the delicate balance between energy supply and affordability [3]. In response, many are turning to cleaner technologies and supportive policies. Renewable energy systems (RESs) are beneficial because they protect the environment and strengthen local economies, particularly in rural areas where power shortages often occur during peak demand [4]. Investing in these systems can address the world's increasing energy needs while promoting a healthier planet and more resilient economies. One promising solution is using hybrid energy systems (HESs), which combine renewable sources to boost reliability and efficiency [5]. Wind and solar stand out among the various HES options due to their availability and falling costs [6,7]. They have gained considerable attention for improving grid stability and meeting long-term sustainability goals. However, wind and solar power depend on changing weather, making them less reliable [8,9]. To ensure a stable power supply, energy storage systems (ESSs), such as batteries, pumped hydro, and backup systems like generators, must be integrated [10,11]. These components help mitigate fluctuations and maintain reliable service during low wind or sunlight. They also underscore the crucial role of HESs in modern energy planning [12]. HES are now being introduced even where main grid connections exist [13,14,15]. Combining the grid's reliability with the low operating costs of renewables, these hybrid setups can reduce dependence on traditional power sources and lower energy expenses. They also cut greenhouse gas emissions, promote energy independence, and build resilience against price changes or grid disturbances. As a result, using HESs has become a practical way to achieve both economic efficiency and sustainable energy use, ensuring that growing energy demands are met without harming the environment or communities [16,17]. One example of such challenges can be seen in Aras de los Olmos, Valencia, Spain, where frequent power outages and disruptions occur despite an existing grid connection [18]. This indicates that being linked to the main grid does not always guarantee reliable electricity, particularly in areas with aging infrastructure or specific local constraints. Additional measures are required to ensure a stable and high-quality power supply. These measures include backup systems, on-site renewable generation, and advanced energy management. By integrating these strategies, communities like Aras de los Olmos can significantly reduce power outages. Additionally, they can strengthen their energy resilience. This will ultimately improve the overall quality of service for residents and businesses. The region's focus on livestock production generates a large amount of animal waste, making it an excellent source of feedstock for biogas generator (BG) systems [19]. By converting this waste into a renewable energy resource, BG technology lowers greenhouse gas emissions, reduces pollution, and creates a steady power supply. However, it is essential to recognize that biogas production can produce methane emissions if leakage occurs, significantly contributing to greenhouse gas effects due to methane's high global warming potential. Thus, effective control measures and careful system design are essential. Biogas energy production systems can work independently or connect to the main grid, boosting energy reliability and sustainability. Turning a local byproduct into a helpful resource supports a circular economy and lessens dependence on traditional fuels.