This section presents a model for energy management of distributed generation sources in microgrids, which reduces energy supply costs. Therefore, the artificial bee colony optimization algorithm has been used for optimization. The goal of optimal use of resources in microgrids is to reduce operating costs. In addition to ABC algorithm, the Lightning Search Algorithm (LSA), Genetic Algorithm (GA), Particle Swarm Algorithm (PSO), and Modified Bat Algorithm (MBA) are used for optimization. It should be noted that all these algorithms were used in13. Studies have been repeated for four different radiation conditions: warm sunny, cold sunny, warm cloudy, and cold cloudy. In Figs. 5, 6 and 7, the results are shown as constant radiation in terms of global HZ irradiance (GHI), direct normal irradiation (DNI), and different seasons (Diff).
Intensity of solar radiation in GHI conditions.

Intensity of solar radiation in DNI conditions.

Intensity of solar radiation in Diff conditions.
Next, in Fig. 8, the ambient temperature is shown in different conditions. Figure 9 illustrates the amount of electrical power requested in the microgrid for 24 h for four different situations.

Ambient temperature in different conditions.

The first scenario: (optimization results for a hot sunny day)
In the initial phase of the optimization, we focused on minimizing the operating costs of the microgrid under the conditions of a hot, sunny day. To achieve this objective, the optimization algorithms are employed to determine the most cost-effective power generation schedule for the microgrid during the specified period. It is important to note that each algorithm was executed 50 times to ensure statistical reliability, and the corresponding results are summarized in Table 2.
The results indicate that all the employed optimization algorithms produced relatively similar outcomes, with only slight differences in their objective function values. Nonetheless, even small variations in operational cost can accumulate to significant amounts over extended periods. For the ABC algorithm, the minimum and maximum values of the objective function were recorded at $363.21 and $391.17, respectively. In comparison, the GA yielded a minimum of $367.69 and a maximum of $380.34. A notable finding is that the standard deviation of the ABC algorithm was lower than that of the other optimization methods. A lower standard deviation suggests that the algorithm delivers more stable and accurate performance, reducing the likelihood of converging on an optimal solution by chance. Specifically, the standard deviation for the ABC algorithm was calculated to be 11.16, demonstrating greater consistency and reliability. In terms of reliability index, all algorithms achieved values below 2%. However, the ABC algorithm attained a reliability index of 1.45%, which is the lowest among the tested algorithms, further confirming its superior performance. Following optimization with the ABC algorithm, the power generation levels for each distributed energy resource were determined. If the output power of the distributed generation units is scheduled according to Figure (10), the total energy supply cost within the microgrid will be minimized under this scenario.
As anticipated, during peak electricity price hours, the electrical demand is primarily met by the distributed generation units. Conversely, during periods of low electricity prices, the utility grid supplies the required load power. Figures (11) illustrates the variation in the electricity price exchanged with the grid, as well as the battery’s charging and discharging profile, when optimized using the Artificial Bee Colony (ABC) algorithm.
The second scenario: (optimization results for a cold sunny day)
In the second scenario of the simulations, the cost reduction of using resources in the microgrid for a chilly summer day has been studied. As in the first scenario, optimization algorithms were used in new conditions to reduce costs. Algorithms have been executed 50 times; Table 3 shows the results.
Compared to the first scenario, a significant reduction in operational costs was observed, primarily due to decreased energy consumption. The best solution obtained using the proposed ABC algorithm was $292.86, while the optimal result from multiple executions of the GA reached $297.83. This indicates that the ABC algorithm achieved approximately $5 in cost savings over the GA method for microgrid optimization. In this scenario, a higher standard deviation was observed, suggesting greater dispersion in the optimization outcomes. However, the reliability index for the microgrid improved compared to the first scenario, indicating a reduction in the level of unsupplied energy. Specifically, the LPSP index was recorded at 1.23% for the ABC algorithm, consistent with the values obtained from other algorithms. After applying the ABC optimization algorithm, the generation power levels of each distributed energy source and the amount of electric power exchanged with the national grid were determined. Figure 10 illustrates the contribution of each distributed generation source in the second scenario.

The contribution of each distributed generation source in the second scenario.
Similar to the first scenario, energy supply during peak electricity price hours was primarily managed using lower-cost distributed generation sources. During off-peak hours, the national grid provided a substantial portion of the microgrid’s load demand. The analysis of the second scenario also includes the hourly profile of electricity prices exchanged with the national grid and the battery storage’s charge/discharge behavior under optimization by the ABC algorithm. These results further confirm the algorithm’s ability to effectively manage energy resources while minimizing operational costs. Figure 11 shows the electricity price and battery power at different hours in the second scenario.

Electricity price and battery power at different hours in the second scenario.
The third scenario: (optimization results for a hot cloudy day)
Continuing the process of simulations, in the third scenario, reducing the cost of using resources in the microgrid for a hot, cloudy day has been studied. Like the previous two scenarios, genetic algorithms, particle swarm, artificial bee, modified fake bee, lightning search, and the proposed artificial bee colony algorithm were used for optimization. The results of running the algorithm 50 times are given in Table 4.
The optimal, worst, and average values of the objective function obtained using the proposed ABC algorithm were $267.77, $300.38, and $289.61, respectively, with a standard deviation of $14.21. These results demonstrate superior performance compared to other optimization algorithms, indicating the consistency and reliability of the ABC algorithm in minimizing operational costs. In this scenario, the value of the LPSP reliability index increased, primarily due to reduced photovoltaic power generation caused by cloud cover and decreased solar irradiance, coupled with increased energy demand. When using the ABC algorithm, the LPSP index reached 1.76%. The hourly distribution of generation power for each distributed energy source and storage system, as well as the power exchanged with the national grid, is represented as a bar graph (Fig. 12). Notably, during high-cost electricity hours, the average exchanged power with the national grid was negative, indicating that electricity was sold to the grid, resulting in increased profitability for microgrid operators.

The contribution of each distributed generation source in the third scenario.
Conversely, during low-cost electricity periods, such as early morning hours, a significant portion of the microgrid’s demand was met through purchases from the national grid. Additionally, batteries were primarily charged during these cheaper periods and discharged when electricity prices were higher, enhancing the overall economic performance of the system. Figure 13 shows the electricity price and battery power at different hours in the third section.

Electricity price and battery power at different hours in the third scenario.
The fourth scenario: (optimization results for a cold, cloudy day)
Finally, in the fourth scenario of the simulations, the operation cost reduction in the studied microgrid for a cold, cloudy day has been done. Like the previous three scenarios, the optimization algorithms were executed 50 times, and their results are summarized in Table 5.
Following optimization using the ABC algorithm, the best result across 50 independent runs was recorded at $266.14, while the worst solution reached $340.83. For comparison, the best solutions obtained using other algorithms, GA, PSO, standard ABC, Improved Fake Bee Algorithm, and the LSA, were calculated as $271.51, $269.88, $268.17, $267.00, and $267.11, respectively. These findings highlight the superior performance of the proposed ABC method in minimizing microgrid operational costs. In this scenario, the reliability index, measured by the LPSP, remained below the acceptable threshold of 2% for all algorithms. However, the LPSP value resulting from the ABC algorithm was calculated at 1.61%, which is lower than all other methods tested, indicating better reliability and energy supply security. The hourly distribution of generation power from distributed energy resources, the battery’s charging and discharging behavior, and the energy exchanged with the national grid were also evaluated under ABC optimization. Figure 14 illustrates the contribution of each distributed generation source in the fourth section.

The contribution of each distributed generation source in the fourth scenario.
As anticipated, during periods of high electricity prices, local distributed generation units were primarily responsible for supplying the load. Conversely, during hours with lower electricity prices, the majority of the microgrid’s energy demand was met through imports from the grid. Subsequently, the variation in electricity exchange prices and the battery’s charging/discharging profile under ABC optimization are illustrated, confirming an economically and operationally efficient energy management strategy. Figure 15 shows the electricity price and battery power at different hours in the fourth scenario.

Electricity price and battery power at different hours in the fourth scenario.
Trade-off between operational cost and system reliability
The Artificial Bee Colony (ABC) algorithm effectively balances the trade-off between minimizing operational costs and ensuring system reliability in microgrid energy management. This is achieved through a penalty-based objective function, as defined in Eqs. (1)–(3), which minimizes costs related to fuel consumption, start-up, energy exchange with the national grid, and penalties for unserved load, while enforcing reliability constraints, specifically maintaining the Loss of Power Supply Probability (LPSP) below 2%. Candidate solutions that violate reliability constraints are penalized, guiding the algorithm toward solutions that optimize cost while ensuring reliable energy supply. The ABC algorithm’s adaptive mechanisms, including the waggle dance-inspired information sharing and scout bee exploration, enable efficient navigation of the solution space, avoiding local optima and ensuring consistent performance.
The performance of the ABC algorithm in managing this trade-off is evaluated across four operational scenarios (hot sunny, cold sunny, hot cloudy, and cold cloudy), with results compared against other metaheuristic methods: Genetic Algorithm (GA), Particle Swarm Optimization (PSO), Modified Bat Algorithm (MBA), and Lightning Search Algorithm (LSA). Table 6 summarizes the best operational cost and corresponding LPSP values for each algorithm across all scenarios, highlighting the ABC algorithm’s superior ability to achieve lower costs while maintaining high reliability.
As shown in Table 6, the ABC algorithm consistently achieves the lowest operational costs across all scenarios (e.g., $363.21 in Scenario 1, $292.86 in Scenario 2, $267.77 in Scenario 3, and $266.14 in Scenario 4) while maintaining the lowest LPSP values (1.45%, 1.23%, 1.76%, and 1.61%, respectively). This demonstrates its ability to optimize the cost-reliability trade-off effectively. For example, in Scenario 3 (hot cloudy day), where reduced photovoltaic generation due to cloud cover increases LPSP, the ABC algorithm still achieves the lowest cost ($267.77) and an LPSP of 1.76%, well within the acceptable limit of 2%. In contrast, GA and PSO yield higher costs ($273.18 and $271.56) and higher LPSP values (1.99% and 1.89%), indicating a less favorable trade-off.
The ABC algorithm’s superior performance can be attributed to its robust exploration and exploitation mechanisms. Unlike GA, which may converge to local optima due to its crossover and mutation operations, or PSO, which can be sensitive to parameter tuning, the ABC algorithm leverages a simpler structure with fewer control parameters. The scout bee phase ensures diversity in the solution space, while the onlooker bee phase refines promising solutions, leading to lower standard deviations (e.g., 16.11 in Scenario 1 vs. 19.85 for GA) and more consistent results. Compared to MBA and LSA, which perform well but achieve slightly higher costs and LPSP values, the ABC algorithm’s adaptive information-sharing mechanism (via the waggle dance) enhances its ability to balance cost and reliability effectively.
These results confirm that the ABC algorithm outperforms other metaheuristic methods in managing the trade-off between operational cost and system reliability, making it a robust and efficient tool for microgrid energy management under diverse operating conditions.
Performance of the ABC algorithm across different time horizons
The performance of the Artificial Bee Colony (ABC) algorithm in microgrid energy management varies depending on the scheduling time horizon—hourly, daily, or weekly—due to differences in computational requirements, data resolution, and the handling of uncertainties. The current study employs a daily (24-hour) scheduling horizon, optimizing the allocation of distributed energy resources (DERs) and battery storage on an hourly basis within a single day. This section evaluates how the ABC algorithm’s performance, in terms of computational time, operational cost, and system reliability (measured by Loss of Power Supply Probability, LPSP), is expected to vary across hourly, daily, and weekly scheduling horizons, based on the simulation results and typical algorithm behavior.
-
Hourly Scheduling: In an hourly scheduling framework, the ABC algorithm optimizes resource allocation for each hour independently or in short time blocks, using high-resolution forecasts of load, solar irradiance, and wind speed. This approach allows precise control of DERs and battery storage, enabling the algorithm to respond dynamically to short-term variations. However, frequent re-optimization increases computational demand, potentially leading to higher simulation times (e.g., estimated at 10–20 s per hour based on the daily simulation times of 84–125 s for 24 h). While operational costs and reliability remain comparable to daily scheduling (e.g., LPSP < 2%), the need for rapid computation may limit real-time applicability in large microgrids.
-
Daily Scheduling: The current study uses a daily scheduling horizon, as detailed in Sect. 6.1–6.4, where the ABC algorithm optimizes a 24-hour schedule based on hourly forecasts. This approach balances computational efficiency and solution quality, achieving operational costs of $266.14–$363.21 and LPSP values of 1.23–1.76% across the four scenarios (Tables 2, 3, 4 and 5). The daily horizon leverages a full day’s forecast, reducing the impact of short-term uncertainties while maintaining manageable computational times (84–125 s). This makes it well-suited for both planning and near-real-time applications in the tested benchmark microgrid.
-
Weekly Scheduling: For a weekly scheduling horizon (168 h), the ABC algorithm optimizes resource allocation over an extended period, requiring forecasts for load, solar, and wind profiles over seven days. While this enables strategic planning (e.g., for maintenance scheduling or energy trading), it significantly increases the solution space and computational complexity, potentially leading to simulation times in the range of 600–1000 s. Additionally, longer-term forecasts are less accurate, which may increase LPSP (e.g., estimated at 1.8–2.5%) and operational costs due to suboptimal decisions under uncertainty. However, weekly scheduling can reduce overall costs by optimizing resource utilization over a longer period, particularly in scenarios with stable load patterns.
Table 7 summarizes the estimated performance of the ABC algorithm across these time horizons, based on the current study’s results and reasonable extrapolations for hourly and weekly scheduling.
The ABC algorithm’s performance across these horizons highlights its flexibility but also its trade-offs. Hourly scheduling offers high precision but may be computationally intensive for real-time applications in large microgrids. Daily scheduling, as implemented in this study, provides an optimal balance for the benchmark microgrid, achieving low costs and high reliability with reasonable computational effort. Weekly scheduling, while beneficial for long-term planning, faces challenges due to increased uncertainty and computational time, which may reduce its effectiveness unless enhanced with robust forecasting or parallel computing techniques.
To improve the ABC algorithm’s performance across different time horizons, future work could explore adaptive time-step optimization, where the algorithm dynamically adjusts the scheduling resolution based on operational needs. Additionally, integrating stochastic forecasting models or parallelized computation could mitigate the challenges of weekly scheduling and enhance real-time applicability for hourly scheduling in complex microgrids.
Discussion
The simulation results presented in Sect. 6.1–6.6 highlight the effectiveness of the Artificial Bee Colony (ABC) algorithm in optimizing energy management for a benchmark microgrid under diverse load and solar irradiance conditions. Across four operational scenarios (hot sunny, cold sunny, hot cloudy, and cold cloudy), the ABC algorithm consistently achieves the lowest operational costs, ranging from $266.14 to $363.21, while maintaining high system reliability, with Loss of Power Supply Probability (LPSP) values between 1.23% and 1.76%, well below the 2% threshold (Tables 2, 3, 4 and 5). These findings, particularly those in Subsection 6.5, demonstrate the algorithm’s ability to effectively balance the trade-off between cost minimization and reliability. The ABC algorithm outperforms other metaheuristic methods, including Genetic Algorithm (GA), Particle Swarm Optimization (PSO), Modified Bat Algorithm (MBA), and Lightning Search Algorithm (LSA), as evidenced by its lower costs (e.g., $266.14 vs. $271.51 for GA in Scenario 4) and lower LPSP values (e.g., 1.61% vs. 1.88% for GA in Scenario 4). The algorithm’s lower standard deviation (e.g., 16.11 in Scenario 1 compared to 19.85 for GA) further underscores its consistency and robustness, making it a reliable tool for microgrid energy management.
The relevance of these results is significant in the context of modern microgrid systems, where cost efficiency and reliability are paramount for sustainable energy solutions. As discussed in Subsection 6.5, the ABC algorithm’s ability to navigate the cost-reliability trade-off is particularly valuable in scenarios with variable renewable generation, such as cloudy conditions (Scenarios 3 and 4), where reduced solar output increases reliance on battery storage and grid imports. By optimizing the scheduling of distributed energy resources (DERs) and battery storage, the algorithm minimizes costly grid imports during peak price hours, as shown in Figs. 16, 17, 10, 11, 12, 13, 14 and 15. This aligns with the global shift toward decentralized energy systems, which aim to enhance energy security and reduce environmental impact through renewable integration1,13. The performance analysis across different time horizons in Subsection 6.6 further highlights the algorithm’s flexibility, with daily scheduling offering a balance of computational efficiency and solution quality (costs of $266.14–$363.21, LPSP of 1.23–1.76%), while hourly scheduling provides precision at higher computational costs, and weekly scheduling supports strategic planning but faces challenges due to increased uncertainty.

The contribution of each distributed generation source in the first scenario.

Electricity price and battery power at different hours in the first scenario.
Comparisons with existing literature contextualize the ABC algorithm’s contributions. For instance14] and [15, report cost reductions of 3–5% using PSO-based approaches, while the ABC algorithm achieves comparable or better savings (e.g., 5% lower costs than GA in Scenario 2). The integration of battery storage optimization, as explored in23, complements the current study’s focus on efficient resource utilization. However, Subsection 6.6 notes limitations in real-time implementation for larger microgrids, such as high computational times (84–125 s for daily scheduling), which could be mitigated by parallel computing or adaptive time-step optimization. These findings align with46, which emphasizes the role of adaptive controllers in enhancing microgrid performance, suggesting that combining ABC with such controllers could further improve real-time applicability.
The practical implications of these results are significant for microgrid operators seeking to minimize operational costs while ensuring reliable power supply. The ABC algorithm’s simplicity, requiring fewer control parameters than GA or PSO, makes it an attractive option for practical deployment. However, challenges such as computational complexity in large-scale systems and sensitivity to forecasting errors, as discussed in related literature48, must be addressed to fully realize its potential. Future research could explore integrating stochastic optimization or advanced forecasting techniques to enhance robustness, as well as incorporating demand response strategies45 to further reduce costs by 2–5%. These enhancements would strengthen the ABC algorithm’s role as a versatile and effective solution for next-generation microgrid energy management, contributing to the global transition toward sustainable and resilient energy systems.