Abstract
The growing penetration of renewable energy sources (RESs) in modern microgrid architectures has intensified the need for real-time, resilient, and self-adaptive load frequency control (LFC) systems—particularly under low-inertia conditions and highly intermittent generation. This paper proposes a novel real-time adaptive LFC framework for standalone PV–HFC hybrid microgrids, designed to operate with near-zero reliance on diesel backup. The proposed strategy integrates a disturbance-sensitive Balloon Effect (BE) identifier for online sensitivity estimation with the Crayfish Optimization Algorithm (CrOA) for continuous gain adaptation of a structurally simple integral controller. Extensive simulation experiments under severe operating scenarios—including sudden load disturbances, parametric uncertainty, and renewable source disconnection—demonstrate that the CrOA+BE controller significantly outperforms benchmark metaheuristics such as GTO, Jaya, and SCA. The framework is further validated through hardware-in-the-loop (HIL) implementation, ensuring practical readiness for real-time deployment. Remarkably, the system achieves up to 95% reduction in diesel consumption, leading to major savings in operating cost and CO2 emissions. Overall, the proposed scheme represents a robust pathway toward intelligent, fossil-free, and economically viable frequency regulation for next-generation renewable microgrids. The proposed controller explicitly integrates Information Technology through intelligent computational algorithms that enhance real-time microgrid stability.
Keywords
Introduction
Background
Rising global energy needs, combined with the adverse environmental consequences of fossil-fueled power generation, have prompted a strong international push toward renewable and low-emission energy sources. Despite the dominance of coal, oil, and natural gas in electricity production across many regions, these fuels are responsible for the majority of greenhouse gas (GHG) emissions—contributing roughly 73% of global CO2 emissions. 1 Moreover, thermal power plants are not only carbon-intensive but also water-intensive, consuming vast quantities of freshwater and emitting harmful pollutants such as nitrogen oxides and particulates.2,3 Conversely, renewable energy (RE) options like solar photovoltaics (PV), wind, and hydrogen derived from clean sources have gained considerable momentum due to their zero-emission profiles, widespread availability, and cost competitiveness.4–6 Solar PV, in particular, has seen rapid deployment, with over 270 million tons of CO2 avoided in 2021 alone, 7 and evidence suggests that it can reduce air pollution in cities by more than 30%.8,9 Additionally, because PV systems do not require water during operation, they present a viable solution in regions facing water scarcity.10,11
However, incorporating RE technologies (especially in isolated microgrids (µGs)) poses technical difficulties due to their variability and lack of inertia.12,13 These systems often operate without the stabilizing presence of conventional synchronous machines, rendering them vulnerable to frequency instabilities during supply-demand mismatches.14,15 To maintain grid stability in such environments, flexible energy storage systems are essential. Hydrogen fuel cells (HFCs) are among the leading candidates, offering rapid response capabilities and full alignment with decarbonization goals.16,17 When integrated with battery storage, HFCs can support effective frequency control, reliable energy buffering, and long-term storage functionality.18–20
Motivation
Although renewable energy-based microgrids have demonstrated strong potential for sustainable electrification, especially in remote and underserved regions,21,22 their practical deployments still depend heavily on diesel generators or other fossil-fuel backup units to maintain frequency stability under uncertain and intermittent power conditions.23,24 This dependency significantly undermines the environmental and economic benefits of renewables, resulting in continued carbon emissions, high fuel logistics cost, and frequent maintenance requirements.25–27 Furthermore, most existing LFC strategies either rely on fixed-gain PI/I controllers or employ offline-tuned metaheuristic algorithms, which cannot adapt to fast-changing disturbances, communication delays, or nonlinear interactions in highly dynamic hybrid microgrids.28–33 Even recent optimization-based LFC approaches still fall short in real-time adaptability and lack experimental (HIL) validation, raising concerns about their practical deplorability.
Meanwhile, Hydrogen Fuel Cells (HFCs) have emerged as a promising zero-emission and fast-response alternative to diesel, but their full potential has not yet been realized in intelligent real-time LFC frameworks.34–36 Likewise, the Crayfish Optimization Algorithm (CrOA), despite its strong optimization capability, has not yet been applied to real-time adaptive frequency regulation in renewable-dominant microgrids.37–40 This critical gap (the absence of a real-time, fossil-free, experimentally validated adaptive LFC solution) directly motivates the present research. Accordingly, this work proposes a CrOA+BE–driven online adaptive control framework that enables resilient, low-emission, and real-time frequency stabilization, aligning with global sustainability goals (e.g., SDGs 7, 9, and 13).
State of the art
As the complexity of modern microgrids continues to grow (particularly those dominated by renewable energy sources (RESs)) the demand for more advanced and responsive load frequency control (LFC) strategies has intensified.41,42 While conventional controllers such as proportional-integral (PI) and integral-only types remain widely used due to their ease of implementation, their fixed-parameter configurations are ill-suited for the dynamic behavior introduced by renewable variability and irregular load profiles. 43 In practice, these traditional schemes tend to struggle under conditions involving nonlinear dynamics, communication lags, and unpredictable disturbances. 44 To address these shortcomings, many researchers have adopted metaheuristic optimization techniques that support real-time, self-adjusting control strategies. 45 Algorithms like Grey Wolf Optimization (GWO), Jaya, Whale Optimization Algorithm (WOA), Harris Hawks Optimization (HHO), and Artificial Gorilla Troops Optimization (GTO) have all demonstrated their effectiveness in enhancing system performance—offering quicker response, better disturbance rejection, and lower overshoot. 46 Still, these methods are not without drawbacks: GWO can be slow to converge, Jaya tends to falter in high-noise environments, and both HHO and WOA require considerable computational overhead, which may hinder practical deployment due to premature convergence issues. 47
Despite these developments, many existing control approaches continue to depend on diesel generators as backup, which ontradicts the sustainability goals often associated with renewable integration. 48 Hydrogen Fuel Cells (HFCs), though cleaner and capable of fast dynamic response, remain underutilized in adaptive frequency regulation schemes. 49 Similarly, the Crayfish Optimization Algorithm (CrOA)—a relatively recent bio-inspired method with strong balance between exploration and exploitation—has seen limited application in LFC contexts. 50 The Balloon Effect (BE) identifier, which offers potential for enhancing controller responsiveness to abrupt changes, has also received little attention. 51 Furthermore, a key limitation across much of the literature is the reliance on purely simulated validation, with minimal engagement in hardware-in-the-loop (HIL) testing or experimental trials. 52
In recent studies, researchers have begun incorporating adaptive mechanisms such as the Balloon Effect (BE) into metaheuristic-tuned controllers to enhance transient awareness and sensitivity. For example, SCO+BE–based controllers in 40 demonstrated faster response during abrupt disturbances, but were applied only to motion control systems rather than real microgrids, and lacked any discussion of fossil-free operation or real-time deployment. Likewise, GTO+BE strategies applied to PV-fed microgrids 53 showed improved damping and emission reduction, but still retained diesel support, and were validated only through offline simulation—not HIL. BE-supported Bat Algorithm (BA+BE) schemes have also emerged, yet these rely on batch/offline tuning rather than online adaptive learning, making them less suited for time-critical LFC applications. 45 Additionally, several HFC-based fuzzy or fractional controllers have been proposed in 2023–2024 literature, but they do not integrate intelligent online gain tuning, nor do they achieve fully diesel-free operation in practice. Despite these advancements, no existing study provides a real-time, fossil-free, CrOA+BE-based adaptive LFC with HIL validation—which directly motivates the present work.
Research gap
Although significant progress has been made in developing frequency regulation techniques for microgrids powered by renewable energy, several critical research gaps remain unresolved. One of the most persistent issues is the continued dependence on fossil-fueled backup systems, particularly diesel generators. This reliance underscores the technical and operational challenges that hinder a complete transition to renewable-only configurations. Diesel generators still serve as essential components for ensuring grid stability; however, their negative environmental footprint highlights the urgency of integrating cleaner alternatives to reduce fossil fuel reliance.
Hydrogen Fuel Cells (HFCs) offer an attractive solution due to their quick dynamic response, modularity, and emission-free nature. Despite these advantages, their incorporation into adaptive control strategies has seen limited development. On the algorithmic front, although established metaheuristic methods are frequently used for optimizing controller parameters, newer approaches—such as the Crayfish Optimization Algorithm (CrOA), known for its strong global and local search capabilities—have not been adequately explored for load frequency control (LFC). In parallel, techniques like the Balloon Effect (BE) Identifier, which can significantly improve control sensitivity under rapid or irregular system changes, remain underutilized.
Comparative summary of previous control strategies in hybrid microgrids.
Research objectives and contributions
This study aims to develop a real-time adaptive load frequency control (LFC) framework for standalone hybrid microgrids that integrate photovoltaic (PV) generation with Hydrogen Fuel Cells (HFCs) as the primary clean energy storage and near-zero reliance on diesel backup. The objective is to ensure fast, robust, and sustainable frequency regulation under realistic operating uncertainties such as abrupt load disturbances, renewable intermittency, and parameter variations.
The proposed control strategy is built upon a structurally simple integral controller that is enhanced with two intelligent real-time mechanisms. ➢ Balloon Effect (BE) Identifier—provides online disturbance sensitivity estimation to detect system stress in real time. ➢ Crayfish Optimization Algorithm (CrOA)—performs adaptive online gain tuning to guarantee optimal response under varying conditions.
This CrOA+BE synergy enables self-learning, disturbance-aware, and high-resilience frequency control, surpassing the limitations of offline-tuned or fixed-parameter controllers.
Main Contributions and Innovations of This Work.
Unlike previous LFC studies, this work introduces the first real-time CrOA+BE-driven adaptive control architecture that is designed for fossil-free operation (when diesel is disabled) and is experimentally validated through hardware-in-the-loop (HIL)—a combination not previously reported in existing literature. To validate the effectiveness of the proposed approach, a comparative performance analysis will be conducted between CrOA and other well-established metaheuristic algorithms, including Artificial Gorilla Troops Optimization (GTO), Jaya, and Sine Cosine Algorithm (SCA).
The key scientific contributions are summarized as follows: • First application of CrOA for real-time adaptive frequency control in renewable-dominant microgrids. • Novel integration of BE-based online disturbance sensitivity with CrOA for self-adjusting gain tuning, ensuring superior robustness against abrupt grid fluctuations. • Validated through both simulation and HIL, bridging the gap between theoretical development and practical field deployment. • Achieves up to 95% reduction in diesel dependency, significantly lowering fuel cost and emissions. • Includes an economic evaluation (LCOE+payback period), confirming its financial viability for real-world adoption. • Aligns with global sustainability targets, directly supporting SDG 7 (Clean Energy), SDG 9 (Innovation), and SDG 13 (Climate Action).
Power system model
The microgrid analyzed in this research, depicted in Figure 1, functions independently from the main grid in islanded mode. It consists of three primary elements: a 30 MW diesel generator that supplies dispatchable power, a 6 MW solar photovoltaic (PV) array contributing variable renewable energy, and a Hydrogen Fuel Cell (HFC) that operates under dynamic control to store energy and assist in maintaining frequency stability. The system is designed to support a constant base load demand of 18.6 MW, which is classified as critical and cannot be adjusted. To ensure frequency stability, a centralized control system coordinates the responses of both the diesel generator and the HFC. Hybrid microgrid architecture with diesel generator, PV, and HFC units.
To model the behavior of the microgrid, a state-space framework is used, which captures the evolution of internal states over time, incorporating the effects of control actions and external influences
In these formulations, X refers to the internal state vector of the system, U encompasses both control actions and external disturbances, and Y signifies the system’s output, typically focusing on frequency deviation. The system’s natural behavior is captured by the matrix A, while matrices B and D illustrate how external inputs affect the progression of internal states and the resulting outputs, respectively
A basic representation of frequency behavior, derived from the mismatch between power supply and demand, can be formulated as
The time-dependent power output of the diesel generator (DGP) can be described by the following expression
Hydrogen fuel cell modeling
The hydrogen fuel cell (HFC) is incorporated into the frequency control system to mitigate sudden changes in power demand or supply variations. Its dynamic response is represented by a first-order transfer function as follows
Crayfish Optimization Algorithm (COA)
The Crayfish Optimization Algorithm (COA), introduced by Heming and colleagues, is based on the behavioral patterns of crayfish (specifically foraging), competition, and seeking summer refuges. These behaviors are mapped into three algorithmic phases that balance exploration and exploitation. The summer resort phase represents exploration, while competition and foraging relate to exploitation. At the start, a population of solutions (referred to as a crayfish colony) is initialized and represented as
During foraging, each crayfish evaluates its current solution using a fitness function and compares it with an ideal solution, adjusting its behavior based on the size and quality of the “food.” If the food is too large, crayfish use their limbs to break it down before proceeding. Overall, COA mimics crayfish survival strategies by alternating between exploration (temperature-based) and exploitation (solution refinement), seeking optimal solutions through this biologically inspired process. 61
Initialization phase of the CrOA
In this research, a controller is introduced that incorporates both minimum and maximum bounds for its parameters. To guide the algorithm toward achieving a global objective, the initial population in the Crayfish Optimization Algorithm (CrOA) is generated within these defined limits using fundamental mathematical operations. The initialization of each individual in the population is carried out using the following equation
The CrOA algorithm begins by randomly creating a set of candidate solutions, denoted as
The fitness of each solution is evaluated, and the one with the highest fitness value among all candidates is identified as the best solution. The calculation of the fitness value is carried out using the following expression
Crayfish temperature and food intake definition
The behavior of crayfish is heavily influenced by temperature variations, which dictate the phase they enter within the algorithm. The temperature is calculated according to equation (13). When the ambient temperature rises above 30°C, crayfish instinctively seek cooler environments, corresponding to the summer resort phase. When temperatures are within a favorable range, crayfish shift to the foraging phase.
Temperature not only affects their behavioral phase but also governs their food intake. Crayfish exhibit optimal feeding behavior when the temperature ranges between 15°C and 30°C, with 25°C being the most ideal. The relationship between temperature and crayfish intake is mathematically modeled using equation (14)
Among these parameters, σ and C1 are employed to adjust the crayfish’s food intake based on varying temperatures, while µ indicates the optimal temperature preferred by crayfish.
Exploration phase (summer resort stage)
When the temperature rises above 30°C, it is deemed excessively high, prompting crayfish to seek shelter in caves as part of their summer vacation behavior. The location of the cave, denoted as
The competition among crayfish for cave spaces occurs randomly. If a randomly generated number satisfies
During the summer resort phase, the primary objective of the crayfish is to approach the cave, symbolizing the optimal solution. As a result, crayfish move toward the cave, striving to minimize their distance to the best solution. Through this movement, individuals progressively get closer to the optimal point, enhancing the exploitation ability of the CrOA algorithm and leading to faster convergence toward the global optimum.
Exploitation phase (competition stage)
When the temperature surpasses 30°C and the randomly generated value satisfies
During the competition stage, crayfish compete for access to caves. Each crayfish, represented by
Exploitation phase (foraging stage)
When the temperature
The size of the food, denoted by
When
This mechanism allows crayfish to adjust their feeding strategy based on the size of the available food, promoting efficient consumption and optimal resource use.
Once the food is broken into smaller, crumbly pieces, crayfish will alternately use their second and third walking legs to pick up the food and bring it to their mouths. This alternating motion is modeled using a combination of sine and cosine functions. Additionally, the amount of food intake is directly linked to the quantity of food obtained. The foraging behavior is mathematically described as follows
During the foraging phase, crayfish adopt various feeding strategies based on the size of the food, represented by
Additionally, the randomness incorporated into the crayfish’s food intake adjustment is managed under controlled execution, ensuring a more effective movement toward the optimal solution during the foraging process. Through these adaptive behaviors, the CrOA algorithm progressively moves closer to the optimal point, thereby enhancing its exploitation ability and improving its convergence performance. The overall process is illustrated in the flowchart shown in Figure 2. While Figure 3 illustrates the proposed control loop, it shows how CrOA adaptively tunes the PI controller to regulate the HFC unit, ensuring fast correction of frequency deviations. Flowchart of the crayfish optimization algorithm (CrOA)
61
. Schematic of crayfish behavior phases in CrOA.

Adaptive frequency control
BE identifier
The balloon effect (BE) refers to the influence of air pressure on the size of a balloon. In a similar manner, disturbances and parameter uncertainties in a system can significantly impact Effect of balloon effect (BE) on objective function in optimization process.
The transfer function representing the studied microgrid at any given moment
In summary, the balloon effect (BE) functions as an online identifier capable of detecting system challenges, such as load disturbances or parameter variations. This capability enhances the performance of the integrated optimization technique.
CrOA+BE
Figure 5 presents a simplified model of the microgrid, which is used to determine the parameters of a second-order closed-loop system for the controlled area Simplified model for controlled microgrid area.

Results and discussion
System nominal parameters for load frequency control.
Optimization algorithm parameters for CrOA, GTO, Jaya, and SCA.
First case
In the first scenario, a sudden load increase of 0.02 pu was applied at t = 4 s to challenge the microgrid’s frequency stability. Initially, the PV and HFC supplied the load demand (approximately 1.5 MW from PV and 1.6 MW from HFC) while the diesel generator remained mostly idle. Upon the disturbance, the system’s frequency dropped sharply, activating the adaptive controllers tuned by CrOA+BE, GTO+BE, Jaya+BE, and SCA+BE. As illustrated in Figure 6, CrOA+BE achieved the best response, with a minimal overshoot of 0.017 Hz and a fast-settling time of 5.6 s. GTO+BE followed, stabilizing in 7.0 s with a 0.024 Hz overshoot. Jaya+BE and SCA+BE showed slower recoveries, settling after 8.5 s and 10.2 s, respectively, accompanied by higher overshoots. The corresponding performance indices (ISE and ITAE) for each method are summarized in Table 4. Frequency deviation response of microgrid under step load disturbance. Performance metrics comparison—step load disturbance.
During the disturbance as shown in Figure 7, the HFC ramped up its output sharply, reaching about 1.8 MW within a few seconds, effectively absorbing most of the sudden load increase. The PV output remained relatively stable, fluctuating slightly around 1.5 MW due to normal irradiance variations. Meanwhile, the diesel generator showed only a slight delayed response, increasing its output to approximately 0.3 MW after 6 s, reflecting the system’s preference for renewable-based compensation. Overall, although the integration of the Balloon Effect improved the responsiveness of all optimization algorithms, CrOA+BE distinctly outperformed the others, demonstrating the smoothest transient behavior, the lowest error indices, and reinforcing the system’s sustainable operation with minimal reliance on the diesel generator. Power Output Contributions from PV, HFC, and Diesel Generator for case 1.
Second case
In a second stress scenario, the dynamic resilience of the microgrid was tested by intentionally modifying its physical characteristics. At t = 4 s, the system inertia was doubled and the damping was halved (a situation that mimics the gradual deterioration of components over time or unexpected operational changes). This sudden alteration immediately challenged the system’s frequency stability. As shown in Figure 8, the initial disturbance was absorbed by all controllers, however, their ability to maintain stability soon diverged. CrOA+BE responded with remarkable steadiness, displaying a modest deviation and quickly regaining nominal frequency. GTO+BE followed with a slightly slower, but successful recovery. Frequency response following system parameter variation.
Performance metrics comparison—system parameter variation.
Looking deeper into the system’s internal response, Figure 9 shows how the energy sources adapted during this stressed period. The hydrogen fuel cell reacted first, swiftly ramping up its output to approximately 2 MW. The photovoltaic array maintained a steady contribution near 1.5 MW, despite minor fluctuations due to normal irradiance variations. The diesel generator, characteristically slow to engage, began contributing after about 6 s, with a limited increase to roughly 0.4 MW. Through this coordinated response, the system was able to absorb the stress without heavily depending on fossil-based generation. Once again, CrOA+BE demonstrated not just better frequency control but also a clear advantage in sustaining cleaner and more efficient microgrid operation even under degraded conditions. Power Output Contributions from PV, HFC, and Diesel Generator for case 2.
Third case
To further test the system’s robustness, the microgrid was exposed to highly variable solar generation, simulating the effects of passing clouds and intermittent shading. Fluctuations were deliberately introduced into the PV output starting from t = 4 s. The resulting frequency deviations, shown in Figure 10, reflect the challenges imposed by this dynamic environment. Across all controllers, variations were observed: CrOA+BE maintained excursions within ±0.006 Hz, while GTO+BE, Jaya+BE, and SCA+BE exhibited wider deviations reaching up to ±0.008 Hz, ±0.010 Hz, and ±0.013 Hz, respectively. Frequency deviation under variable PV power generation.
As depicted in Figure 11, the Hydrogen Fuel Cell (HFC) dynamically adjusted its output to counteract the PV fluctuations, while the diesel generator provided limited support during deeper PV drops. The PV array itself oscillated around its nominal value, responding to the imposed variability. Performance indices under these conditions are presented in Table 6, where differences between the control approaches are clearly quantified. Power Output Contributions from PV, HFC, and Diesel Generator for case 3. Performance metrics comparison—variable PV generation.
Fourth case
To further challenge the stability of the microgrid, a sudden disconnection of the Hydrogen Fuel Cell (HFC) was introduced at t = 20 s. This abrupt event induced an immediate disturbance, providing a real-world test for the responsiveness of the different control strategies. As illustrated in Figure 12, prior to the disconnection, frequency deviations were well-contained within ±0.005 Hz across all methods. Following the HFC outage, the controllers’ performance diverged significantly. CrOA+BE limited the resulting frequency excursions to within ±0.012 Hz and achieved a new steady-state in approximately 7.4 s. GTO+BE followed with a deviation band of ±0.017 Hz, settling in around 9.1 s. Meanwhile, Jaya+BE and SCA+BE exhibited broader deviations of ±0.021 Hz and ±0.025 Hz, respectively, with prolonged settling times exceeding 11 s. Figure 13 tracks the active power behavior during the event. Upon HFC disconnection, the diesel generator swiftly ramped its output from approximately 0.3 MW to 1.0 MW to cover the lost capacity, while PV generation remained relatively constant, reflecting its dependence on available irradiance rather than grid demands. This highlights the importance of dispatchable sources in maintaining frequency stability during unexpected renewable disruptions. A summary of the controllers’ quantitative performance during this event is provided in Table 7, detailing variations in ISE and ITAE among the tested methods. Frequency deviation following HFC sudden disconnection. Power contributions after HFC sudden disconnection. Performance metrics comparison—HFC disconnection scenario.

Fifth case
To assess the adaptability of the control strategies under partially degraded conditions, a temporary reduction in the Hydrogen Fuel Cell (HFC) output was introduced. At t = 30 s, the HFC capacity was limited to 50% of its nominal value, emulating potential scenarios such as hydrogen supply fluctuations or minor technical issues. The reduced operating mode was maintained for 20 s before the HFC resumed full capacity at t = 50 s.
Figure 14 illustrates the system’s frequency behavior throughout this event. Prior to the reduction, frequency deviations across all methods were confined within ±0.005 Hz. Following the decrease in HFC output, frequency oscillations became more pronounced. CrOA+BE limited the excursions to within ±0.010 Hz and recovered the system within 6.9 s. GTO+BE experienced slightly higher deviations of ±0.014. Frequency deviation during temporary HFC capacity reduction.
Hz with a recovery time of 8.4 s, while Jaya+BE and SCA+BE exhibited broader deviations of ±0.018 Hz and ±0.022 Hz, stabilizing after more than 10 s. The evolution of active power sources during this period, shown in Figure 15, highlights the system’s response. As the HFC output declined, the diesel generator increased its production from around 0.3 MW to approximately 0.7 MW to help maintain load balance, while PV output remained relatively steady. Following the restoration of full HFC capacity, the diesel generator output gradually decreased, reflecting effective load redistribution. Table 8 summarizes the key performance indices during the HFC reduction event, capturing the differences between the control strategies in handling partial generation loss. Power contributions during temporary HFC capacity reduction. Performance metrics comparison—temporary HFC capacity reduction.
Real-time simulation results
Building upon the comparative analysis carried out in the previous simulation studies, a real-time simulation platform was developed to validate the proposed control strategies under practical conditions. The islanded microgrid model was implemented using a computer equipped with a QUARC pid_e data acquisition card, and the output frequency signals were captured using a digital storage oscilloscope (DSO-X 2014A, Keysight, Santa Rosa, CA, USA). The block diagram of the real-time simulation setup is presented in Figure 16, while the physical hardware configuration is shown in Figure 17. Block diagram of the studied system using real-time simulation. Setting up a lab in real time.

To maintain consistency with the previous evaluations, the real-time tests compared the performance of the four optimization-based adaptive control strategies: CrOA+BE, GTO+BE, Jaya+BE, and SCA+BE. The first test involved applying a step load change under nominal system parameters. The corresponding frequency responses are shown in Figure 18. It can be observed that the controller optimized by CrOA+BE achieved the smallest frequency deviation and fastest settling time, followed by GTO+BE, while Jaya+BE and SCA+BE exhibited slower responses with larger overshoots. Real time simulation for case 1.
In the second real-time experiment, key system parameters were deliberately varied, with the inertia constant (H) doubled and the damping coefficient (D) halved, replicating the degraded dynamics studied previously. Figure 19 illustrates the system’s frequency response under these altered conditions, demonstrating that CrOA+BE maintained better dynamic performance compared to the other optimization methods. Real time simulation for case 2.
A third real-time evaluation was conducted under random variations in both load and PV generation. Figure 20 compares the frequency response achieved by the four controllers under these highly variable conditions. Once again, the CrOA+BE-based controller demonstrated superior adaptability and frequency regulation, with GTO+BE following, while Jaya+BE and SCA+BE showed more pronounced oscillations and longer recovery times. Real time simulation for case 3.
Overall, the real-time simulation results align closely with the earlier simulation studies, reinforcing the advantages of the proposed CrOA+BE control strategy. Additionally, the implementation through real-time data acquisition and computational adaptation highlights the potential of the proposed method for future large-scale applications, particularly when combined with Phasor Measurement Units (PMUs) and real-time tuning of critical microgrid parameters such as inertia (H) and damping (D). To ensure the practicality of the proposed CrOA+BE–based adaptive controller, its computational burden was also examined. The real-time execution analysis confirmed that the optimization and gain-updating process remains lightweight, with an execution time consistently below 40 ms per control cycle, which is well within the accepted latency margin for real-time load frequency control (typically <100 ms). This indicates that the proposed strategy is fully deployable on embedded platforms such as PLCs, DSPs, or industrial microcontrollers, without causing any delay-induced instability. Moreover, since the algorithm dynamically adjusts only a single control gain (rather than recomputing full control laws), its scalability remains efficient even under fast disturbances or higher system volatility.
Economic impact and cost analysis
Integrating photovoltaic (PV) arrays and hydrogen fuel cells (HFCs) into the hybrid microgrid has significantly reduced dependence on the diesel generator for frequency stabilization and load compensation. Simulation results presented in Sections 5.1 through 5.5 clearly show that PV and HFC units assume the primary role in power balancing during disturbances, with the diesel generator contributing only marginally. As depicted in Figure 21 and summarized in Table 9, the PV system supplies roughly 37.5% of the required corrective power, the HFC unit delivers about 50%, while the diesel generator is responsible for just 12.5%. This optimized sharing of dynamic support relieves the diesel generator from intensive operational demands, enhancing both economic efficiency and environmental performance. In conventional setups, meeting the full load requirement of 18.6 MW using only diesel generation would entail a fuel consumption rate of approximately 4650 L per hour—translating to a fuel expenditure of around 5115 USD per hour. With an annual operation period of 5000 h, this would result in an overwhelming fuel cost nearing 25.6 million USD, as outlined in Table 10. Power source contributions during disturbances (MW). Power source contribution comparison. Annual operational cost comparison.
With the proposed hybrid control strategy, where the diesel generator covers only about 5% of the total load, diesel consumption drops dramatically to 232.5 L per hour (equivalent to 255.75 USD/hour), resulting in an annual fuel cost of roughly 1.278 million USD. This represents a remarkable operational cost saving of approximately 24.3 million USD per year, achieving a reduction rate of about 86% compared to the traditional system.
Payback period and investment summary.
It is important to note that the cost assumptions for Hydrogen Fuel Cells (HFCs) in this study are aligned with recent projections reported by IRENA (2024), which indicate that the cost of green hydrogen is expected to decline toward the range of 3–5 USD/kg by 2030, depending on renewable electricity prices and electrolyze scale. Even under a conservative sensitivity scenario of ±30% cost fluctuation, the proposed hybrid microgrid remains economically viable, as the annual diesel-saving margin (≈24 million USD/year) far exceeds any variation in HFC operational cost. This confirms that the proposed solution is not only technically robust but also economically resilient and future-ready.
Although Hydrogen Fuel Cells inherently experience gradual efficiency degradation under frequent load cycling, the proposed BE-driven strategy naturally moderates the ramp intensity by adaptively reinforcing control effort only when necessary. As a result, unnecessary over-reactions are avoided, which helps preserve HFC stack lifespan. Moreover, even when accounting for potential long-term O&M impact, the annual diesel fuel savings (>24 M USD/year) remain an order of magnitude higher than any projected maintenance-related cost escalation—ensuring a strong positive net benefit in the long run.
Conclusion
This work introduces a real-time adaptive load frequency control (LFC) strategy tailored for islanded hybrid microgrids comprising photovoltaic (PV) panels, hydrogen fuel cells (HFCs), and minimal reliance on diesel generators. The approach leverages the Crayfish Optimization Algorithm (CrOA) in conjunction with a Balloon Effect (BE) identifier to enable dynamic tuning of control parameters in response to system disturbances, model uncertainties, and variability in renewable generation. The proposed CrOA+BE-based controller was rigorously tested under diverse operational conditions and validated through hardware-in-the-loop (HIL) experiments, confirming its resilience, adaptability, and practical effectiveness.
Compared to existing metaheuristic methods like GTO, Jaya, and SCA, the new control scheme achieved notable improvements in frequency regulation, including reduced overshoot, faster settling times, and superior performance indices. Importantly, the integration of HFCs alongside PV generation led to a drastic reduction—up to 95%—in diesel fuel usage and related CO2 emissions. These outcomes underscore the dual benefit of the system: significant cost savings and a meaningful contribution to environmental sustainability. By moving beyond simulation and demonstrating real-time applicability, this study addresses a critical gap in the field of adaptive control for microgrids. The proposed framework offers a robust and scalable solution that aligns with long-term decarbonization efforts and climate action objectives. Future research may focus on scaling the architecture to larger microgrid systems, integrating predictive control strategies, and enhancing real-time observability through phasor measurement unit (PMU)-based feedback.
Although the proposed CrOA+BE–based controller demonstrates superior real-time performance and fossil-free capability, several practical considerations must be acknowledged. Like most intelligent optimization-based methods, its efficiency may be influenced by the choice of hyperparameters (e.g., agent population or learning gain), which may require fine-tuning under extreme uncertainty. Furthermore, while the current study validates the framework for a single-area configuration, large-scale interconnected or multi-area microgrid architectures may introduce additional coordination and communication latency challenges. These aspects will be addressed in future work by developing lightweight embedded implementations and adaptive agent-scaling strategies to further enhance scalability and real-time deplorability.
Future scope
While the present work successfully demonstrates real-time, fossil-free frequency stabilization in a single-area PV–HFC hybrid microgrid, the proposed CrOA+BE framework is intrinsically scalable and can be extended in future research toward multi-area coordinated microgrids, wind-integrated systems with higher forecast uncertainty, and sector-coupled architectures involving EVs or hydrogen mobility infrastructure. Further enhancements may also include predictive BE-based adaptation using AI-driven disturbance forecasting, as well as embedded hardware optimization (e.g., adaptive agent scaling for ultra–low-latency DSP/FPGA deployment)—paving the way for fully autonomous, industry-grade smart microgrid control.
Footnotes
Acknowledgments
The Researchers would like to thank the Deanship of Graduate Studies and Scientific Research at Qassim University for financial support (QU-APC-2025).
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Qassim University (QU-APC-2025).
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Appendix
Symbol/Abbreviation
Description
F
System frequency (Hz)
Δf
Frequency deviation (Hz)
H
Inertia constant (s)
D
Damping coefficient (pu/Hz)
R
Governor droop (Hz/pu)
Tg
Governor time constant (s)
Td
Turbine time constant (s)
ΔPd
Diesel generator power change (pu)
ΔPL
Load power change (pu)
ΔPg
Governor power change (pu)
G_FC(s)
Transfer function of the hydrogen fuel cell
K_HFC
Gain of HFC system
T_HFC
Time constant of HFC system (s)
X
State vector
U
Input vector (control+disturbances)
Y
Output vector (frequency deviation)
A, B, C, D
State-space matrices
σ, µ, C1
Parameters related to crayfish optimization behavior
T
Environmental temperature (°C)
OF
Objective function
PV
Photovoltaic
HFC
Hydrogen fuel cell
LFC
Load frequency control
µG
Microgrid
RE
Renewable energy
EST
Energy storage technology
CrOA
Crayfish optimization algorithm
BE
Balloon effect
GTO
Gorilla troops optimization
SCA
Sine cosine algorithm
HIL
Hardware-in-the-Loop
ISE
Integral of squared error
ITAE
Integral of time-weighted absolute error
PMU
Phasor measurement unit
CO2
Carbon dioxide
SDGs
Sustainable development goals
