Abstract
The increasing penetration of renewable energy presents substantial challenges to frequency stability, particularly in low-inertia microgrids. This study introduces an agent-based microgrid model that integrates generators, loads, an energy storage system (ESS), and renewable sources, mathematically formalized through the discrete-event system specification (DEVS) to ensure both structural clarity and extensibility. To dynamically simulate power system behavior, the model incorporates multiple control strategies—including ESS scheduling, automatic generation control (AGC), predictive AGC, and grid-forming (GFM) inverter control—each posed as an mathematically defined control problem. Simulations on the IEEE 13-bus system demonstrates that the coordinated operation of ESS, GFM, and the proposed strategies markedly enhances frequency stability, reducing frequency peaks by 1.14, 1.14, and 0.72 Hz, and shortening the average recovery time by 9.05, 0.15, and 2.58 min, respectively. Collectively, the model provides a systematic representation of grid behavior and frequency regulation mechanisms under high renewable penetration, and establishes a rigorous mathematical framework for advancing microgrid research.
Keywords:
renewable-integrated microgrid; agent-based model; grid-forming; frequency regulation; discrete-event system specification MSC:
93A16; 93C65; 68U20; 37M05
1. Introduction
1.1. Challenges in the Microgrid System
A microgrid refers to a small-scale power system. As shown in Figure 1, it typically comprises distributed generation units, energy storage systems (ESS), loads, and control devices, and can achieve local energy self-sufficiency. Among these components, renewable energy sources such as solar and wind power are increasingly integrated into microgrids because of their low cost and minimal environmental impact [1,2]. However, this increasing integration also presents new challenges. Renewable energy generation is inherently uncertain. For instance, solar output is highly sensitive to weather conditions and cloud coverage [3], while wind power depends on fluctuating wind speeds [4]. These variations can cause unpredictable power outputs, leading to demand–supply imbalances that trigger frequency fluctuations within the system. Furthermore, renewable energy is typically integrated through power-electronic interfaces [5], which lack the mechanical inertia of conventional synchronous generators. Consequently, they cannot inherently provide or absorb kinetic energy to buffer power deviations, resulting in weak frequency support capability [6]. These issues are particularly severe in microgrids, which, owing to their small scale and extremely low inertia [7,8,9], face considerable difficulties in maintaining frequency stability. Additionally, the allowable frequency deviations vary across networks, voltage levels, and standards. For example, large interconnected transmission systems usually impose strict limits [10], whereas distribution systems or microgrids with high renewable penetration often tolerate larger short-term deviations, sometimes exceeding 1–2 Hz [11]. This distinction underscores the unique challenges of maintaining frequency stability in microgrids.
Figure 1.
Diagram of a microgrid.
In recent years, the grid-forming (GFM) inverter, an advanced inverter control strategy, has been proposed to mitigate demand–supply imbalances caused by the high penetration of renewable energy sources. It acts as a controlled voltage source within the circuit, and through the GFM inverter, nonsynchronous generators are enabled to emulate the behavior of synchronous generators, thereby providing frequency regulation and virtual inertia support through power electronic interfaces [12]. Accordingly, analyzing its influence on power systems, particularly in microgrids, has become essential. Research on GFM inverters has expanded rapidly; however, compared to conventional inverters, their deployment and application remain associated with relatively higher costs.
To support effective adoption and cost efficiency, modeling and simulation provide valuable alternatives. Computational models are capable of capturing and reproducing complex, nonlinear, and stochastic behaviors that are often difficult to represent with traditional approaches. Moreover, because they do not require physical construction, computational models allow the exploration of diverse structures, scenarios, and even extreme conditions solely through computer-based experimentation, thereby ensuring both modeling accuracy and operational flexibility. In particular, as illustrated in Figure 2, agent-based models are highly modular, intelligent, and easily extensible, rendering them especially well-suited for representing complex power systems.
Figure 2.
Agent-based model framework.
1.2. Discrete-Event System Specification
In this study, all agent models are designed using the discrete-event system specification (DEVS) formalism [13]. Originally proposed by B. P. Zeigler in 1976, DEVS is an event-based modeling approach for discrete-event systems. Within this framework, each model receives inputs, updates its state, and sends outputs to interact with other models.
DEVS provides a general and modular modeling framework for representing dynamic systems whose behavior evolves over time in a discrete-event manner, rather than continuous time. By alternating between state trajectories and discrete events, it can uniformly represent purely discrete-event systems as well as hybrid systems that combine both continuous and discrete dynamics. An additional advantage lies in its ability to clearly distinguish external inputs, internal state transitions, and output processes, thereby enabling each component to be defined independently and hierarchically composed to construct complex systems.
A simulation model (SM) is the fundamental unit and specifies the dynamics of the model [14]. As described in [14], an SM is formally defined as a 7-tuple, as expressed in Equation (1):
where
: a set of input events;
: a set of output events;
a set of states;
: , an external transition function;
: , an internal transition function;
an output function;
(non-negative real number), a time advance function.
More specifically, the input event set is defined as the collection of all possible external inputs, the output event set represents the collection of all possible outputs, and the state set represents the collection of all possible internal states. The external transition function describes how the system responds to inputs based on its current state and received input, while the internal transition function represents how the system’s state evolves after a certain period in the absence of external inputs. The output function determines how the system generates outputs based on its current state before an internal transition, and the time advance function defines how long the system remains in its current state without external inputs, which is key to simulation time stepping and event scheduling.
When applying this modeling approach to the power system in this study, the input event set typically includes commands such as generator on/off switching and power set value instructions. The output event set includes information such as power output, system frequency status, and ESS capacity. The state set represents the operational status of components such as generators and ESS. The external transition function may include logic such as updating the power output of a generator upon receiving a new power set value while in an active state. The internal transition function could cover behaviors such as updating the state of charge and output power of the ESS at each simulation time step. The output function includes, for instance, the ESS transmitting its current power and capacity information prior to the internal state update.
In summary, this systematic modeling approach establishes a mathematically rigorous framework that accurately characterizes input–output mappings, internal state transitions, and overall system behavior. Each component is formally defined by sets (X, Y, S) and functions (, , , ta), ensuring that the dynamic processes of event inputs, state evolution, and output responses are strictly and unambiguously represented. Given the inherent complexity of power systems, the absence of such formal specification often results in vague descriptions, limiting the ability to capture internal interactions and thereby constraining in-depth investigations into system dynamics and the effectiveness of control strategies. By adhering to the unified formalism of the DEVS, the proposed model overcomes these limitations, enabling precise interpretation, validation, and reproducibility of the modeling process. Furthermore, the inherent modularity and composability of DEVS allow model to be flexibly replaced or extended without altering the global structure, making the framework particularly suitable for power system studies, where accurate representation and analysis of complex dynamic interactions among heterogeneous components under diverse operating conditions are essential.
1.3. Literature Survey
Several models have been proposed in recent years to address the challenges associated with high renewable energy penetration in microgrids. Tamrakar et al. [15] designed and implemented an islanded microgrid model to mitigate frequency instability caused by the extensive integration of renewable energy sources such as solar power. By introducing a solar-based output regulation method, their model enabled dynamic management of both voltage and frequency within the microgrid. Watson and Kimball [16] proposed a framework based on model predictive control (MPC), which constructs a predictive model of the microgrid and solves optimization problems to alleviate large frequency deviations and slow control responses resulting from low system inertia. Du et al. [17] developed an electromechanical model of three-phase GFM and GFL inverters that supports dynamic simulation of unbalanced three-phase distribution systems with high levels of inverter-based distributed energy resources. Their study confirmed that GFM inverters provide significant advantages in maintaining voltage and frequency stability in power systems. Similarly, Vignesh Babu et al. [18] developed a photovoltaic (PV)–battery integrated microgrid model to address voltage and frequency instability under high renewable penetration. By simulating and comparing GFL and GFM inverter control models across multiple operating scenarios, the study demonstrated the superior performance of GFM inverters in maintaining both voltage and frequency stability. Yameen et al. [19] proposed an adaptive MPC framework to improve the performance of GFM inverters in addressing frequency stability challenges under high renewable energy penetration. By combining offline reinforcement learning with online MPC and employing a hybrid optimization algorithm for parameter tuning, their results demonstrated that the approach enhanced frequency stability to some extent under grid disturbances. Vanashi et al. [20] introduced a multiagent architecture-based control method to mitigate frequency stability issues in microgrids caused by the integration of active devices such as inverters. Their approach combines adaptive dynamic programming with particle swarm optimization and applies it to frequency control in inverter-dominated islanded microgrids, significantly improving the dynamic performance of the system. The study also validated its effectiveness under centralized, distributed, and hierarchical structures, with the hierarchical configuration offering notable advantages in enhancing dynamic performance and reducing communication overhead. Bitew et al. [21] proposed a model-based hierarchical control framework to strengthen the frequency regulation capability of microgrids integrating PV and battery energy storage systems. The model includes switches, loads, PV units, and storage devices, and is formulated primarily with differential equations. In this approach, the controllers are tightly coupled, and overall system behavior depends on centralized coordinated control.
Despite these advances, the above studies present several limitations. Studies [15,16] focused mainly on traditional inverter-based control strategies or algorithmic approaches, without considering GFM inverters—an innovative and effective solution for frequency instability under high renewable energy penetration. Studies [17,18,19,20], although verifying the advantages of GFM inverters for frequency regulation, primarily emphasized the effectiveness of GFM itself while overlooking the potential contributions of additional control strategies that may coexist within the system. As for [21], although the model is capable of dynamic voltage and frequency control, its predefined structure, fixed module interfaces, and high complexity limit its flexibility. It does not readily support microgrid topology expansion or component replacement, thereby constraining the integration of diverse control strategies and reducing adaptability to different operating scenarios and configurations. A summary of the related work and its limitations is presented in Table 1.
Table 1.
Contributions and limitations of the related work.
Therefore, a review of the related studies indicates that most existing models exhibit notable limitations, which can be summarized as follows:
- Many studies overlook the critical role of the GFM inverter in frequency regulation under high renewable energy penetration.
- Excessive emphasis is often placed on a single control strategy, without fully considering the coexistence of multiple control strategies within the system, resulting in limited validation of the effectiveness of individual or coordinated strategies.
- Model structures are often complex, rigid, and lack formalized representation at the mathematical level. This limits their flexible adaptation to different system configurations and operating scenarios. Additionally, it impairs the models’ readability and interpretability (e.g., the internal logic of the system is difficult to capture and understand, and tracing the causal relationships between inputs and outputs is challenging). Moreover, it also restricts extensibility, hindering the integration of new modules or adjustment of existing ones.
1.4. Motivation and Main Contributions
To address the aforementioned limitations, this study integrates GFM inverters and multiple control strategies into an agent-based modeling approach for constructing a microgrid model. In this framework, system components—such as generators, ESS, and loads—are represented as agent-based models. This representation decouples the complex structure of the power system and captures the interactions among system components. Simultaneously, it enables flexible configuration, making the model adaptable to diverse scenarios across different scales and operating conditions. Furthermore, GFM inverters and control strategies are embedded within specific agent models, thereby supporting effective performance evaluation. Through these design choices, the model provides a simplified yet reliable digital twin framework for frequency management in microgrids with high renewable energy penetration.
The main contributions of this study can be summarized as follows:
- By recognizing the critical role of the GFM inverter in frequency stability under high renewable penetration, this study designs and embeds the GFM inverter into specific agent-based models, thereby enabling efficient verification of its effectiveness in frequency regulation within microgrids.
- Multiple frequency regulation strategies—including ESS scheduling, Automatic Generation Control (AGC), and Predictive Automatic Generation Control (PAGC)—are integrated into the model, enabling systematic verification of diverse control strategies within the microgrid framework. Importantly, the framework offers high extensibility, allowing additional control strategies to be incorporated and tested in future applications by simply modifying the corresponding Python files (Python 3.7).
- All system components are modeled based on agents and rely on DEVS to achieve rigorous mathematical formalized representation. DEVS endows the modeling process of each component with mathematical logic and derivation basis, while the modular characteristics of agents ensure the flexibility of the overall model. Specifically, the addition, removal, or reconstruction of components can be realized only by adjusting the mathematical parameters and interaction rules of the corresponding agents, without changing the overall mathematical architecture and logical topology of the model. This further ensures that the model can accurately adapt to power systems of different scales and operating scenarios under strict mathematical constraints.
Validation on the IEEE 13-bus test system demonstrates that the coordinated operation of the ESS, GFM inverters, and the proposed control strategies significantly enhances frequency stability. Specifically, frequency peaks are reduced by 1.14, 1.14, and 0.72 Hz, while the average frequency recovery time is shortened by 9.05, 0.15, and 2.58 min, respectively. These results confirm the reliability of the proposed model. Moreover, experiments conducted under diverse system configurations and scenarios demonstrate the exceptional flexibility and scalability of the model. In summary, this research not only achieves rigorous modeling of power systems through mathematical formalization but also provides deeper insights into the optimization of complex power systems and supports the development of high-fidelity, future-oriented microgrid models.
1.5. Organization of the Paper
2. Model Design
2.1. System Component Introduction
In microgrid systems, components such as buses, transmission lines, and transformers lack active control capabilities, with their operational states determined primarily by external variables such as voltage and current. Consequently, these elements are classified as passive components and are uniformly represented in the environmental model, which characterizes the fundamental physical configuration and background of the microgrid. By contrast, components such as generators, ESS, and loads can adjust their behaviors—for example, modifying power generation, charging or discharging, or varying load demand—in response to system conditions or external control commands, thereby demonstrating active control capabilities. Because their dynamic characteristics directly influence system operation, these elements are modeled as agent-based models to capture decision-making mechanisms and interactive dynamics during microgrid operation. Notably, in this design, the GFM inverter is treated as an inherent attribute of generators and is incorporated into the generator model. The names, functions, and classifications of the system components are summarized in Table 2.
Table 2.
System components information.
2.2. Agent-Based Model Design
The proposed microgrid model comprises five core model types and two computational modules: (1) controller model, (2) environment model, (3) generator model, (4) ESS model, and (5) load model, together with (a) a frequency analysis module and (b) a power flow analysis module. The overall model structure is shown in Figure 3.
Figure 3.
Structure of the microgrid model.
Passive components such as buses, lines, and transformers are incorporated into the environment model, whereas active components, including generators, ESS, and loads, are modeled individually as agents. A dynamic instantiation mechanism is applied to active components, allowing their numbers to be flexibly adjusted according to specific application scenarios, while the controller and environment models remain as single instances throughout the simulation. The frequency and power flow analysis modules compute the key operational parameters of system components and provide essential information for the real-time adjustment of generator and ESS power setpoints, thereby supporting comprehensive system assessment and control.
Interactions among the models are conducted through a structured messaging system comprising four message types: command, power, report, and environment. Each type carries specialized information relevant to its function, as summarized in Table 3.
Table 3.
Message details.
This architecture supports coordinated system operation through continuous message exchange between modules and component models, as well as among the component models themselves. It ensures stable model performance while enabling decentralized control and facilitating adaptive control without compromising distributed operation. The detailed simulation process is illustrated in Figure 4.
Figure 4.
Action sequence and mechanism of agent models.
In this framework, the simulation time step T denotes the fixed interval governing interactions among agent models. At each time step of length T, every model exchanges information and updates its state, which corresponds to the time required for generators, ESS, loads, and the environment model to produce outputs. In this study, the simulation timeline is divided into fixed-duration slices of 1 min. Within each step, agents sequentially complete information exchange and state updates to maintain synchronous progression of the overall system. At the beginning of each simulation time step, the environment model sends an environment message (env msg.) to the controller, containing system operating parameters such as active power (P), reactive power (Q), system frequency (F), and voltage magnitude (V). These parameters represent the current grid conditions and form the basis for control decisions. Upon receiving the environment message, the controller executes the corresponding control algorithms—for instance, determining the ESS output based on power imbalance, deciding whether AGC is necessary depending on the frequency deviation, and enabling PAGC according to the current time. It then issues command messages (command msg.) to generators and ESS, specifying target active power values. At the end of each simulation time step, generators, ESS, and loads execute the control commands and provide feedback through power messages and report messages, which are used to update the system state and support subsequent adaptive adjustments. The environment model then collects the power messages from all components, recalculates the system state, and generates the next round of environment messages. This process establishes a continuous iterative closed-loop interaction that persists until the simulation time reaches the predefined termination point. Through this mechanism, information exchange among agents is conducted in an event-driven manner, ensuring synchronous coordination throughout the simulation.
2.2.1. Environment Model
The environment model simulates the operation of passive components in the grid, including buses, lines, and transformers. Although this part essentially belongs to a continuous-time system, in this study, its behavior is segmented by time steps and modeled as a discrete-event system. This choice reflects the fact that, while the physical behavior of power systems is inherently continuous, state changes are triggered by events. By correctly defining the simulation time step, event-driven abstract modeling simplifies the system structure while accurately capturing dynamic behavior, thereby closely approximating the characteristics of a continuous-time system.
The environment model is defined as shown in Equation (2):
where:
S = {START, CONTINUE, END};
The initial state of the model is START. In this state, the model sends an environment message and then transitions to the CONTINUE state. The DEVS structure of the environment model is illustrated in Figure 5, and the model parameters are summarized in Table 4.
Figure 5.
Environment model.
Table 4.
Environment model parameter.
At each fixed simulation time step T, the environment model invokes the frequency analysis and power flow analysis modules to compute active and reactive power data from various components, along with the current system frequency and bus voltage. The computed results are then packaged into an environment message and transmitted to the controller model. While in the CONTINUE state, if the simulation end time has not been reached, the model sends an environment message at every interval of T and remains in the CONTINUE state. Once the simulation end time is reached, the model transitions to the END state. For the two states excluding START, if a power message input is received, the external transition function is invoked. When the model is in the CONTINUE state and receives the power message, it remains in the current state but updates the remaining time to , thereby resetting the state residence time to ensure the model can respond to the new input. By contrast, when the model is in the END state, it ignores all messages and enters a passive state with an infinite time advance value, indicating that no further events will occur.
The frequency analysis module calculates the power imbalance to estimate frequency deviation, which is then added to the nominal frequency to determine the current frequency of the system.
The frequency analysis module is primarily designed to calculate microgrid frequency dynamics under varying operating conditions. The total system active power imbalance is calculated by Equation (3):
Here, represents the total power of all loads, denotes the total power of all ESSs, and , represents the total power of the two types of generators. Subsequently, the system frequency deviation is computed using Equation (4):
Here, the shown in Equations (4) and (5) refer to the droop coefficient of the system,
which reflects the comprehensive response capacity of all synchronous generators in the system to the frequency deviation. Finally, the current system frequency , as shown in Equation (6), is determined by combining the nominal frequency valued with the frequency deviation .
For the power flow analysis module, the environment model primarily relies on the PyPSA library [22], which enhances both computational efficiency and accuracy. The analysis process is based on the Newton–Raphson method [23]. Using the system parameters provided by the environment model—including active power, reactive power, bus voltage magnitudes, and line parameters—the corresponding nonlinear equations are formulated and solved iteratively to determine the power flow distribution. These results then support subsequent frequency regulation and the implementation of control strategies.
2.2.2. Controller Model
The controller model simulates the operational mechanisms of the control strategies and algorithms within the microgrid. The control system regulates the power output of various energy sources by comprehensively considering the current system state, load demand, and generation status.
The controller model is defined as shown in Equation (7):
where
S = {WAIT, CONTROL};
The initial state of the model is WAIT. When an environment message containing the current active and reactive power, voltage, and system frequency values is received in this state, an external transition occurs and the model moves to the CONTROL state. In the CONTROL state, the model processes the received environment and report messages through the control algorithm and generates a command message. It then transitions back to the WAIT state via the internal transition function and outputs the command message via the output function
The DEVS structure representing this process is shown in Figure 6, and the parameters of the controller model are summarized in Table 5.
Figure 6.
Controller model.
Table 5.
Controller model parameters.
- Control algorithms
Based on the operational status of synchronous generators and the configuration of ESS, AGC, and PAGC, the controller dynamically allocates active power to ensure both frequency stability and economic performance.
The controller model incorporates two types of control algorithms: AGC and PAGC. When AGC is activated, it gradually adjusts the power allocation of synchronous generators according to the deviation between the current system frequency and the nominal frequency, while simultaneously considering the economic dispatch and the regulation capability of each generator. In addition, the no-load frequency of each synchronous generator—defined as the natural frequency under zero load and used in this study as an indicator of frequency regulation sensitivity—is updated (to monitor whether AGC is activated and the extent of its adjustment). This process achieves fast response and high control accuracy, making it suitable for real-time frequency regulation. The details of power allocation based on economic dispatch are discussed in the following section. By contrast, PAGC is a feedforward control strategy that operates periodically at predefined time intervals. The controller predicts load demand over upcoming steps using current system data, historical load trends, and a predefined prediction accuracy. It then proactively adjusts the power set values of synchronous generators in advance, thereby enhancing system stability under fluctuating and uncertain demand conditions.
- Economic dispatch solution
In this model, the optimal active power allocation of synchronous generators is solved by using the economic dispatch based on the Lagrange multiplier approach. This method incorporates the system constraints into the objective function, enabling the derivation of an optimal solution that satisfies these constraints. Specifically, the model aims to coordinate n synchronous generators to minimize the total generation cost of the system while meeting both the total power demand P and the individual output constraints of each generator. The generation cost of each synchronous generator is represented as a quadratic function, following the modeling approach in [24], as expressed in Equation (8):
where y represents the generation cost of generator i, represent the cost coefficients of the generator i, and denotes its output power. The output power of each generator is subject to its respective physical upper limit and lower limit , which serve as the constraints of this optimization problem. The theoretical optimal solution of the economic dispatch problem is achieved when the incremental costs of all generators are equal. The incremental cost of each generator is obtained by differentiating its generation cost function with respect to its output power as shown in Equation (9):
By identifying the Lagrange multiplier that equalizes the incremental costs across all generators, while ensuring that the sum of their output powers matches the total generation demand, the optimal power allocation can be determined. Notably, if the calculated output power for any generator violates its physical output limits, the output of that generator will be fixed at its corresponding maximum or minimum value. Subsequently, the generator is excluded from the optimization process, and the economic dispatch calculation is repeated for the remaining generators. This iterative process continues until all generators satisfy their operating constraints. The final result represents the optimal active power allocation among synchronous generators. The parameters used for economic dispatch in this model are listed in Table 6.
Table 6.
Economic dispatch-related parameters.
- Algorithms execution
Figure 7 illustrates the detailed flow of the control algorithm used in the proposed model, where the boxed areas in the diagram represent the specific control processes.
Figure 7.
Control algorithm flow chart.
The execution of control algorithms follows a predefined hierarchy of priorities. First, ESS control is activated with the highest priority to buffer power imbalances in the system. The controller determines the charging or discharging power of the ESS based on the current imbalance and the status of the ESS, as expressed in Equation (10):
The difference between the current time load power and the sum of all synchronous generator output power is used to determine whether the ESS should charge or discharge. Subsequently, if AGC is activated, the frequency deviation at the current time is calculated as the difference between the measured frequency value and the nominal frequency value , as shown in Equation (11):
If the absolute value of the current frequency deviation exceeds the preset threshold , the AGC is triggered, as shown in Equation (12):
Once activated, AGC allocates active power among synchronous generators based on economic dispatch. At the same time, the no-load frequency of each synchronous generator is adjusted., as shown in Equation (13). The no-load frequency is obtained by adding the nominal frequency and the no-load frequency deviation
Here, the no-load frequency deviation is calculated using Equation (14), where slope represents the regulation coefficient and represents the output power of the synchronous generator at the current time.
In this study, the parameter refers to the extent of no-load frequency adjustment caused by a unit change in the active power output of a synchronous generator. It integrates the nominal frequency , the control coefficient of the synchronous generator, and its nominal power . The specific calculation is shown in the following Equation (15):
Unlike conventional power systems, where AGC operates at fixed intervals, the proposed model adopts an event-triggered mechanism. Once the frequency deviation exceeds the threshold, AGC is activated and executed in the subsequent simulation time step. This design reduces coupling with interval-based control logic and mitigates performance degradation during simulation.
As AGC has a higher priority than PAGC, PAGC is not invoked when AGC is active. If AGC is disabled while PAGC is enabled, the algorithm predicts future active power demand within a predefined time interval, as shown in Equation (16):
where both the future load demand and renewable energy output are determined by Equation (17):
The predicted power value equals the actual power value multiplied by a random factor within the range [, ]. Then PAGC performs power allocation accordingly, following economic dispatch principles. Once the active power allocation is completed, relevant parameters are transmitted through command messages, thereby completing the whole control process.
In summary, the controller model provides fine-grained dynamic adjustment, rapid response capabilities, and the flexibility to switch between different control strategies, making it highly adaptable to diverse and complex operating scenarios.
2.2.3. Generator Model
The generator model functions as a key active control agent in a microgrid system. It simulates generator operations, including turning on, turning off, and adjusting generation output. The model receives turn-on, turn-off, and power-setting command messages from the controller model and dynamically adjusts its output according to the generator type, thereby achieving fine-grained control of power supply.
The generator model is defined in Equation (18):
where
The DEVS structure representing this process is illustrated in Figure 8. The parameters of the generator model are listed in Table 7.
Figure 8.
Synchronous generator model.
Table 7.
Generator model parameters.
The initial state of the model is determined by input data. If the generator is on at the beginning, the initial state is GEN; otherwise, it is STOP. In the STOP state, when the model receives a command with the instruction on, it transitions to GEN. Conversely, in the GEN state, if a command message is received, the model sets the power values of the synchronous generator according to the instruction content and remains in GEN, as specified by the external transition function . If no command message is received within time T in the GEN state, the model outputs a power message and a report message. At that point, if the control command is off, the model transitions to STOP; otherwise, it remains in GEN, as defined by the internal transition function and output function . The operation is performed in the GEN state with a fixed simulation time step T. The generator model supports the operating logic of synchronous generators, nonsynchronous generators, and nonsynchronous generators with GFM inverters.
For synchronous generators, upon receiving a command message, the model gradually adjusts the current output power toward the target setpoint within the allowed ramp rate. Based on the updated power output, it recalculates the no-load frequency and derives the corresponding frequency deviation, which is then used in the frequency correction mechanism. By contrast, nonsynchronous generators without GFM inverters cannot independently regulate active or reactive power. Their operation is not directly linked to frequency control; instead, their output is retrieved from a database according to predefined generation data. Figure 9 shows the variation in daily output for the renewable energy source (nonsynchronous generator without GFM inverter) used in this model.
Figure 9.
Solar (left) and wind (right) energy output over one day.
For the nonsynchronous generator equipped with GFM inverter, its DEVS structure representing this process is illustrated in Figure 10.
Figure 10.
Nonsynchronous generator model.
The core functionality lies in their frequency response based on a droop control mechanism, as illustrated by the droop characteristic curve in Figure 11.
Figure 11.
Droop characteristics of a nonsynchronous generator with a GFM inverter.
Through this mechanism, nonsynchronous generators emulate the behavior of synchronous generators, thereby enabling autonomous regulation and rapid response to frequency fluctuations. Importantly, this response is governed by a local control strategy rather than external commands from the controller model. The nonsynchronous generator actively participates in establishing and stabilizing system frequency. Specifically, as shown in Equation (19):
When a system frequency deviation occurs, the model calculates the corresponding active power adjustment based on the difference between the current frequency and the reference frequency , using a predefined droop coefficient . This adjustment is applied to the original power , resulting in a new active power output set value , enabling the generator to respond to supply–demand imbalances and mitigate frequency fluctuations. For reactive power, the model simplifies the behavior by maintaining constant apparent power, redistributing active and reactive power accordingly. This approach approximates a constant power factor and reduces computational complexity. At each simulation time step T, all generator models output their current power values and states, which are sent separately to the environment model and the controller model. Through these mechanisms, the generator model achieves high-fidelity simulation of physical behavior and functions as a key component in realizing the dynamic, autonomous, and coordinated control required for microgrid simulation and operation.
2.2.4. ESS Model
The ESS model simulates the operational mechanisms of a real-world battery. In practical power systems, ESS units perform charging and discharging operations in response to supply–demand imbalances, thereby enhancing stability and continuity of power supply. When load demand exceeds supply, the ESS discharges to release stored energy; conversely, it charges during periods of generation surplus.
The ESS model is defined as Equation (20):
where
X
=;
S =;
;
;
The initial state of the ESS model is GEN. In this state, if the model receives the command message containing the power instruction p_set, it calculates the future power set values and corresponding ESS capacity based on the provided active and reactive power values; subsequently, the model updates the residence time in the current state. At every interval T, the model outputs the power message and the report message and then transitions back to the GEN state, as defined by the internal transition function and the output function
Figure 12.
ESS model.
Table 8.
ESS power parameters.
The ESS model executes charge and discharge operations and updates its state based on control commands from the controller model. At each simulation time step T, the model interprets the received power message and calculates the actual power output and capacity change for the next step, considering the specified power, current available capacity, and charge/discharge efficiency. If the instructed power exceeds physical limits, the model applies boundary constraints and updates the SOC accordingly. All updated results are recorded for the current step and transmitted as power and report messages to the environment and controller models, enabling interaction with other system components.
In the ESS model, the above process can be described by Equation (21):
When indicating a discharge period, the actual discharging power is determined by the minimum of the current time power difference , the maximum discharging power , and the current time remaining in storage . Conversely when , indicating charging mode, the actual charging power is determined by the minimum of the absolute value of the power difference , the maximum charging power , and the current time remaining in storage , where represents the upper limit of ESS capacity.
This process ensures that ESS operations comply with physical constraints such as capacity and power limits during dynamic processes, while providing accurate and responsive support for energy management and optimal system control.
2.2.5. Load Model
The load model simulates the operational characteristics of actual loads. In practical power systems, loads consume electrical energy from the grid.
The load model is defined as Equation (22):
where
X
=;
S =;
;
;
;
.
The DEVS structure is shown in Figure 13. The parameters of the load model are shown in Table 9. The parameters of the load power factor are shown in Table 10.
Figure 13.
Load model.
Table 9.
Load model parameters.
Table 10.
Load power factor parameters.
The output of the load model is not influenced by command messages from the controller. Instead, it retrieves corresponding values from the database. Figure 14 illustrates the daily variation in the nine loads used in this model.
Figure 14.
Load variations over one day.
2.3. Model Implementation
All the agent models based on DEVS were implemented using PythonDEVS [25], a simulation engine capable of executing discrete-event models in Python.
Figure 15 illustrates the overall workflow of the model implementation.
Figure 15.
Overall workflow of the model implementation.
Within the microgrid simulator, the controller, equipped with embedded algorithms, receives environment messages (env msg.) from the environment model and generates command messages (command msg.) based on system conditions. These commands are delivered to generators, ESS, and loads, which in turn provide feedback through power messages (power msg.) and report messages (report msg.) to the environment model and controller. The environment model is coupled with power flow analysis and frequency analysis modules to compute key operational parameters and update the system state. All simulation processes are executed on the simulation engine (Python PDEVS). Simulation parameter files in CSV format supply system configuration and time-series data inputs, which are managed by the data manager. The data manager provides simulation configuration to the microgrid simulator, collects simulation results (raw data), and converts them into visualization data. Finally, the visualizer generates graphical outputs such as active and reactive power, frequency, voltage magnitude, and SOC over time, thereby providing an intuitive representation of system dynamics.
3. Experiments
3.1. Experimental Setup
The proposed model was validated using the IEEE 13-bus system, a standardized test model widely applied in distribution network simulation and power system analysis [26]. The system consists of 13 buses interconnected through various lines and transformers. The configuration employed in this study is illustrated in Figure 16. It includes a total of 9 loads, 2 photovoltaic generators, 2 wind turbines, 1 microturbine (MT) generator, and 1 ESS. Bus 650 is designated as the slack bus and equipped with the slack generator G0, which compensates for system losses. The system investigated in this study is a medium-voltage network operating at 4.16 kV.
Figure 16.
IEEE-13-bus system single-line diagram.
Table 11.
Experimental parameters design.
Table 12.
Parameters of MT and G0 generators.
3.2. Experimental Scenarios
To validate the effectiveness of the proposed model, three experimental scenarios were designed, as specified in Table 13. These scenarios aim to verify the key contributions of the model.
Table 13.
Experimental scenarios and viewpoint.
Experiment 1 is designed to analyze the role of the ESS in mitigating generator output fluctuations and reducing frequency variations. This experiment also demonstrates the capability of the model for modular agent-based component design and its flexibility in adapting to diverse system configurations and experimental scenarios.
Experiment 2 evaluates the system’s ability to integrate and coordinate multiple control strategies, such as ESS scheduling, AGC, and PAGC. This scenario demonstrates how the proposed model captures the combined effects of these strategies on frequency regulation and power balance, thereby validating its effectiveness in simulating coordinated control mechanisms.
Experiment 3 is designed to verify the effectiveness of the GFM inverter in enhancing system frequency stability under high renewable energy penetration. This scenario further demonstrates the model’s ability to evaluate the performance of GFM inverters.
3.3. Experimental Results and Analysis
Figure 17, Figure 18 and Figure 19 and Table 14, Table 15 and Table 16 present the experimental results. The conclusions were derived by analyzing variations in parameters including active power, frequency, reactive power, voltage magnitude, ESS capacity, and no-load frequency. In all figures depicting active and reactive power, the legends from top to bottom correspond to the following: generator MT (blue), G0 (orange), PV_634 (green), PV_611 (red), WT_646 (purple), WT_675 (brown), ESS (pink), Loss (gray), Total power output (light green), and Load demand (light blue). The no-load frequency is used to indicate the extent to which synchronous generators optimize their adjustments within the limits of their regulating capabilities after the application of AGC and PAGC. The analysis of results focuses primarily on indicators such as maximum frequency, minimum frequency, peak-to-peak value, maximum frequency deviation rate, and frequency recovery time, defined as the period during which the frequency deviation exceeds 0.2 Hz. A brief introduction to each evaluation metric is provided below.
Figure 17.
ESS impact analysis. Subfigures labeled (a-i–c-i) and (a-ii–c-ii) represent the cases with and without ESS, respectively.
Figure 18.
Sudden load change impact analysis. Subfigures labeled (a-i–d-i) and (a-ii–d-ii) represent the cases with and without sudden load change, respectively.
Figure 19.
GFM impact analysis. Subfigures labeled (a-i–d-i) and (a-ii–d-ii) represent the cases with and without GFM, respectively.
Table 14.
Experimental 1 evaluation indicators.
Table 15.
Experimental 2 evaluation indicators.
Table 16.
Experimental 3 evaluation indicators.
- Maximum frequency
The maximum frequency represents the highest frequency observed during the operation of the power system. A high frequency suggests an oversupply of power in the system. Thus, this metric helps evaluate the effectiveness of control strategies or the GFM inverter in mitigating power oversupply.
- Minimum frequency
The minimum frequency represents the lowest frequency recorded during the operation of the power system. A low frequency typically indicates an insufficient power supply or a sudden surge in load. This indicator is mainly used to assess the effectiveness of control strategies in supporting the system during load surges or sudden power shortages.
- Peak to peak value
Peak-to-peak value represents the difference between the maximum frequency and minimum frequency during power system operation, as defined in Equation (23). This value reflects the amplitude of frequency fluctuations; smaller values indicate lower overall variations in system frequency. Hence, it serves as an indicator of the system’s oscillatory behavior and is useful for evaluating the damping effectiveness of various control strategies or the GFM inverter.
- Maximum frequency deviation rate
Maximum frequency deviation rate refers to the maximum relative deviation percentage of the system frequency from the nominal frequency , as defined in Equation (24). It indicates the extent of frequency deviation from the nominal frequency, with this study primarily focusing on the maximum deviation observed during operation.
- Frequency recovery time
Frequency recovery time refers to the time taken for the system frequency to return within a specified threshold after exceeding it during power system operation. As shown in Equation (25), represents the average frequency recovery time, denotes the number of times the system frequency exceeds the threshold, and and represent, respectively, the end time and start time of each frequency threshold deviation. This metric primarily reflects the dynamic response speed and regulation capability of the system.
Specifically, during the simulation process of this study, the start time of each deviation is recorded whenever the frequency deviation exceeds the threshold. When the frequency returns to within the threshold range, the corresponding time is marked as the endpoint. The duration of each deviation is then calculated, and the average across all events is determined. This average frequency recovery time is subsequently used to evaluate the ability of the system to restore frequency stability.
Figure 17 demonstrates that in the absence of ESS, the substantial output fluctuations of synchronous generators result in pronounced frequency variations, with the frequency peak reaching approximately 62.14 Hz, thereby making frequency stability difficult to maintain. By contrast, the buffering effect of the ESS significantly reduces the frequency peak from over 62 Hz to approximately 61 Hz, thereby stabilizing the system frequency and underscoring the pivotal role of ESS in load sharing. Notably, in practical applications, ESS capacity is inherently limited.
Table 14 presents the frequency performance indicators before and after the integration of ESS. With ESS operation, the maximum frequency peak decreased by 1.14 Hz, the peak-to-peak value was reduced by 1.05 Hz, the maximum frequency deviation rate dropped by 0.67%, and the average frequency recovery time was shortened by approximately 9.05 min.
The experimental results further reveal that depletion of the ESS at 1200 min forces synchronous generators to abruptly increase output to compensate for the resulting power deficit, thereby producing observable frequency fluctuations.
This experiment verifies the critical role of ESS in maintaining frequency stability. Moreover, by enabling comparison between the two scenarios—with and without ESS—the experiment also demonstrates the capability of the model to support modular component modeling and flexible system configuration.
Figure 18 demonstrates that, at approximately 200, 400, and 800 min, sudden load increases and decreases caused abrupt changes in system power demand, resulting in significant frequency fluctuations. Nevertheless, the experimental results show that, despite multiple deviations exceeding 2 Hz, the system frequency remained stable at around 60 Hz. This finding indicates that, provided the duration of load fluctuations is relatively short and remains within the ESS capacity range, the coordinated action of ESS, AGC, and PAGC can effectively restore system frequency stability.
Table 15 presents the frequency performance indicators under conditions with and without sudden load changes. In the presence of significant load disturbances, the maximum frequency peak increased by 1.14 Hz, the peak-to-peak amplitude rose by 1.66 Hz, the maximum frequency deviation rate increased by 0.87%, and the average frequency recovery time was extended by approximately 0.15 min.
These experimental results demonstrate that the proposed model can effectively integrate generation data, load variations, and related information, and, through the coordinated operation of multiple control strategies, rapidly respond to load changes while maintaining frequency stability under fluctuating conditions. This not only verifies the value of the designed control strategies themselves but also highlights the model’s capability for comprehensive validation. In other words, the proposed model can serve as a reliable platform for evaluating the effectiveness of frequency regulation strategies.
Figure 19 demonstrates that, compared with the scenario without GFM technology, the amplitude of frequency fluctuations is reduced and the self-stabilization capability of the system is enhanced. During peak fluctuation periods, such as 600–800 min, nonsynchronous generators equipped with GFM functionality can respond rapidly to system changes and adjust their output, reducing frequency fluctuations by approximately 1 Hz compared with the non-GFM case. Therefore, when the system frequency experiences significant deviations, GFM technology strengthens inertial support by adjusting the output of non-synchronous generators, thereby mitigating short-term frequency anomalies caused by supply–demand imbalances. This reduces the frequency regulation burden on synchronous generators and improves overall system frequency stability.
Table 16 presents the frequency performance indicators before and after the application of the GFM inverter. With GFM implementation, the maximum frequency peak decreased by 0.72 Hz, the peak-to-peak amplitude was reduced by 0.72 Hz, the maximum frequency deviation rate declined by 0.82%, and the average frequency recovery time was shortened by approximately 2.58 min.
This experiment results verifies the model’s capability to assess the effectiveness of the GFM inverter in enhancing frequency regulation.
4. Conclusions
This paper proposed an agent-based microgrid model designed to address the frequency stability challenges posed by the high penetration of renewable energy sources such as solar and wind power. The model adopted a modular architecture and incorporated the DEVS, a set-theoretic mathematical formalism, to represent each agent. This framework ensured a clear and rigorous definition of model components. Within it, control strategies including ESS scheduling, AGC, PAGC, and GFM inverters were embedded into specific agent models. Simulation results demonstrated that the model accurately simulated and evaluated the effectiveness of multiple control strategies as well as GFM inverters. Furthermore, the model was adaptable to power systems of varying scales and configurations and supported simulation under diverse and complex scenarios, thereby exhibiting high flexibility and robustness. Overall, the proposed model could be regarded as a highly interpretable and reliable framework for microgrid research, well-suited to advancing power system modeling and simulation.
Despite these contributions, certain limitations remained. In the modeling process, the physical characteristics of some system components, the complexity of load fluctuations, variations in electricity market prices, and generation cost factors were simplified. These simplifications may constrain the applicability of the model to more complex and dynamic real-world scenarios. Future research will therefore proceed in two main directions. Firstly, the model will be expanded to the smart grid level, incorporating power and information exchange mechanisms among multiple microgrids to examine the impact of inter-regional coupling on system stability. Secondly, advanced methods such as reinforcement learning will be integrated to enhance the adaptability of the model in complex, uncertain, and highly dynamic environments. Through these extensions, the model is expected to demonstrate greater feasibility for practical applications and provide stronger support for the development of smart grids.
Author Contributions
Conceptualization, S.L. and S.C.; data curation, D.P.; formal analysis, D.P.; funding acquisition, S.L. and S.C.; investigation, D.P.; methodology, D.P. and S.C.; project administration, S.C.; software, D.P.; supervision, S.C.; validation, D.P. and S.L.; writing—original draft, D.P.; writing—review and editing, S.L. and S.C. All authors have read and agreed to the published version of the manuscript.
Funding
This work was supported in part by the Korea Institute of Energy Technology Evaluation and Planning (KETEP) grants funded by the Korea government (MOTIE) (RS-2023-00231709, Operation and demonstration of grid-forming core technology for distributed energy grid access), and in part by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (RS-2025-23523897).
Data Availability Statement
The raw data supporting the conclusions of this article will be made available by the authors on request.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Yan, R.; Saha, T.K.; Modi, N.; Masood, N.-A.; Mosadeghy, M. The combined effects of high penetration of wind and PV on power system frequency response. Appl. Energy 2015, 145, 320–330. [Google Scholar] [CrossRef]
- Chen, Y.; Wu, J. Agent-based energy management and control of a grid-connected wind/solar hybrid power system. In Proceedings of the IEEE 2008 International Conference on Electrical Machines and Systems (ICEMS), Wuhan, China, 17–20 October 2008; pp. 2362–2365. [Google Scholar]
- Yu, D.; Zhu, H.; Han, X.; Holburn, D. Dynamic multi-agent-based management and load frequency control of PV/fuel cell/wind turbine/CHP in autonomous microgrid system. Energy 2019, 173, 554–568. [Google Scholar] [CrossRef]
- Motewasel, M.; Seifi, A.R. Expert energy management of a micro-grid considering wind energy uncertainty. Energy Convers. Manag. 2014, 83, 58–72. [Google Scholar] [CrossRef]
- Anttila, S.; Döhler, J.S.; Oliveira, J.G.; Boström, C. Grid forming inverters: A review of the state of the art of key elements for microgrid operation. Energies 2022, 15, 5517. [Google Scholar] [CrossRef]
- Song, J.; Zhou, X.; Zhou, Z.; Wang, Y.; Wang, Y.; Wang, X. Review of low inertia in power systems caused by high proportion of renewable energy grid integration. Energies 2023, 16, 6042. [Google Scholar] [CrossRef]
- Banerji, A.; Sen, D.; Bera, A.K.; Ray, D. Microgrid: A review. In Proceedings of the IEEE Global Humanitarian Technology Conference: South Asia Satellite (GHTC-SAS), Trivandrum, India, 23–24 August 2013; pp. 27–35. [Google Scholar]
- Denholm, P.; Cochran, J.; Brinkman, G.; Jorgenson, J. Inertia and the Power Grid: A Guide Without the Spin; National Renewable Energy Laboratory (NREL): Golden, CO, USA, 2020. [Google Scholar]
- Saha, S.; Saleem, M.I.; Roy, T.K. Impact of high penetration of renewable energy sources on grid frequency behaviour. Int. J. Electr. Power Energy Syst. 2023, 145, 108701. [Google Scholar] [CrossRef]
- Hanley, M.; Ilic, J. Frequency Instability Problems in North American Interconnections; DOE/NETL-2011/1473; National Energy Technology Laboratory (NETL): Pittsburgh, PA, USA; Morgantown, WV, USA; Albany, OR, USA, 2011. [Google Scholar]
- IEEE Std 1547-2018 (Revision of IEEE Std 1547-2003); IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces. IEEE: New York, NY, USA, 2018; pp. 1–138.
- Serban, I.; Ion, C.P. Microgrid control based on a grid-forming inverter operating as virtual synchronous generator with enhanced dynamic response capability. Int. J. Electr. Power Energy Syst. 2017, 89, 94–105. [Google Scholar] [CrossRef]
- Zeigler, B.P.; Praehofer, H.; Kim, T.G. Theory of Modeling and Simulation, 2nd ed; Academic Press: Orlando, FL, USA, 2000. [Google Scholar]
- Kim, B.S.; Kim, T.-G.; Choi, S.H. CoDEVS: An extension of DEVS for integration of simulation and machine learning. Int. J. Simul. Model. 2021, 20, 661–671. [Google Scholar] [CrossRef]
- Tamrakar, U.; Hansen, T.M.; Tonkoski, R.; Copp, D.A. Model predictive frequency control of low inertia microgrids. In Proceedings of the IEEE 28th International Symposium on Industrial Electronics (ISIE), Vancouver, BC, Canada, 12–14 June 2019; pp. 2111–2116. [Google Scholar]
- Watson, L.D.; Kimball, J.W. Frequency regulation of a microgrid using solar power. In Proceedings of the IEEE Applied Power Electronics Conference and Exposition (APEC), Fort Worth, TX, USA, 6–10 March 2011; pp. 321–326. [Google Scholar]
- Du, W.; Tuffner, F.K.; Schneider, K.P.; Lasseter, R.H.; Xie, J.; Chen, Z.; Bhattarai, B. Modeling of grid-forming and grid-following inverters for dynamic simulation of large-scale distribution systems. IEEE Trans. Power Deliv. 2021, 36, 2035–2045. [Google Scholar] [CrossRef]
- Babu, V.V.; Roselyn, J.P.; Nithya, C.; Sundaravadivel, P. Development of Grid-Forming and Grid-Following Inverter Control in Microgrid Network Ensuring Grid Stability and Frequency Response. Electronics 2024, 13, 1958. [Google Scholar] [CrossRef]
- Yameen, M.; Lu, Z.; El-Sousy, F.F.M.; Younis, W.; Zardari, B.A.; Junejo, A.K. Improving frequency stability in grid-forming inverters with adaptive model predictive control and novel COA-jDE optimized reinforcement learning. Sci. Rep. 2025, 15, 16540. [Google Scholar] [CrossRef] [PubMed]
- Vanashi, H.K.; Mohammadi, F.D.; Verma, V.; Solanki, J.; Solanki, S.K. Hierarchical multi-agent based frequency and voltage control for a microgrid power system. Int. J. Electr. Power Energy Syst. 2022, 135, 107535. [Google Scholar] [CrossRef]
- Bitew, G.T.; Beza, T.M.; Shahzad, M. Model-based hierarchal control framework for frequency and voltage stability in islanded microgrids with low inertia. APL Energy 2025, 3, 026104. [Google Scholar] [CrossRef]
- Sharma, R.; Dhillon, J. PyPSA: Open Source Python Tool for Load Flow Study. J. Phys. Conf. Ser. 2021, 1854, 012036. [Google Scholar] [CrossRef]
- Tinney, W.F.; Hart, C.E. Power flow solution by Newton’s method. IEEE Trans. Power Appar. Syst. 1967, PAS-86, 1449–1460. [Google Scholar] [CrossRef]
- Durvasulu, V.; Hansen, T.M. Market-based generator cost functions for power system test cases. IET Cyber-Phys. Syst. Theory Appl. 2018, 3, 197–205. [Google Scholar] [CrossRef]
- Van Tendeloo, Y. Activity-Aware DEVS simulation. Master’s Thesis, University of Antwerp, Antwerp, Belgium, 2014. [Google Scholar]
- Schneider, K.P.; Mather, B.A.; Pal, B.C.; Ten, C.-W.; Shirek, G.J.; Zhu, H.; Fuller, J.C.; Pereira, J.L.R.; Ochoa, L.F.; de Araujo, L.R.; et al. Analytic considerations and design basis for the IEEE distribution test feeders. IEEE Trans. Power Syst. 2018, 33, 3181–3188. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).