Data-driven dynamic modeling for inverter-based resources using neural networks

Domain: physics
Published: 2025-11-28
Editorial outcome: major_revision

Abstract
Dynamic models are a cornerstone of power system stability and control. The growing penetration of inverter-based resources, driven by global decarbonization, significantly complicates power system dynamics. For large-scale power systems, existing dynamic models of these resources have long struggled to accurately capture their complex behaviors, limited primarily by explicit formulations based on simplified physical governing equations. This study presents a data-driven modeling approach that uses neural networks to learn and represent these dynamics exclusively from accessible data. Its tailored architecture combining long short-term memory network for temporal dependencies with a cross layer to model nonlinear feature interactions. Physical constraints from an inverter dynamic model are enforced to enhance consistency and prevent implausible outputs. Validated on a real-world power system (including a wind farm, a photovoltaic power station, and a grid-forming battery energy storage station), the proposed model shows superior accuracy and extrapolates across out-of-distribution scenarios. These findings are further confirmed in a large-scale power system and an inverter-dominated system. The presented approach provides an effective methodology to capture and simulate complex inverter dynamics, enabling more reliable transient stability assessment crucial for the secure operation of future grids.

Introduction
The transition towards decarbonizing electricity is accelerating globally, driven by substantial increases in renewable energy capacity1. Renewable energy is expected to meet all additional electricity demand through 20262, with wind and solar power generation already contributing over 40% or even 60% in some countries3. Wind and solar power generation require inverter-based interfaces to connect power resources to power grids. Renewable energy sources integrated into the power grid via these interfaces are classified as inverter-based resources (IBRs). The fast and complex dynamic behavior of IBRs, characterized by reduced system inertia, rapid power-electronic transients, and diverse control interactions, complicates the modeling and transient analysis of power systems4,5. Given that dynamic models are the cornerstone of power system stability and control6, several analyses of recent power system disturbances have raised serious concerns about the accuracy of IBR dynamic modeling7–9, highlighting the need for improved modeling methods to support power system security and stability at higher levels of renewable energy penetration.

The transient analysis of large-scale power systems incorporating IBRs typically relies on time-domain simulations utilizing dynamic models, also known as the root mean square (RMS) model, phasor-domain model, electromechanical transient model, positive sequence model, etc. Despite vendors developing proprietary dynamic models (vendor models), significant concerns have emerged regarding confidentiality and software-specific implementations10. Therefore, in 2010, the first-generation generic dynamic models for wind turbines and photovoltaic (PV) systems were released by the Western Electricity Coordinating Council (WECC)11. Due to the inherent limitations, such as low accuracy and limited model customization capabilities, the International Electrotechnical Commission (IEC) and WECC collaborated to release the second-generation generic models in 201512. These generic models are fundamentally developed using physics-based approaches derived from simplified physical governing equations. Although continuous refinements have been made in the subsequent years13,14, inherent challenges persist. These limitations stem from several factors: (1) The precise operational mechanisms of IBRs are often obscured by proprietary concerns. Inverter characteristics are primarily dictated by control algorithms, which vendors may not fully disclose for reasons of commercial confidentiality5,10. (2) The growing diversity of control strategies employed in inverters, broadly categorized into grid-following and grid-forming paradigms, challenges the efficacy and universality of single generic models. (3) The mismatch in temporal resolution makes it infeasible to explicitly formulate the detailed physical mechanisms, thereby inherently limiting the fidelity and accuracy of the models5,15. This is because IBR dynamic models are typically simulated at the millisecond timescale, which is coarser than the microsecond timescale governing the physical processes within some IBR devices of IBRs.

Given these limitations of physics-based approaches, data-driven modeling methods have emerged as a promising alternative. The proliferation of measurement devices, such as wide-area measurement systems (WAMS)16 and supervisory control and data acquisition (SCADA)17, facilitate the development of data-driven dynamic models. By using measured data, models can be optimized or tuned to represent the dynamics of IBRs without relying on detailed physical understanding and information. Recent studies18–20 use measured data to cluster IBRs, and then perform parameter identification to establish dynamic models. These methods, however, may not fully overcome the inherent limitations derived from physics-based modeling methods. Neural networks, with their data-driven nature and powerful expressive capabilities, hold significant potential for addressing the challenges associated with IBR dynamic modeling. Xiao et al. 21 form a neural network-based modeling framework to accurately capture the dynamics of power system components. They further propose a design for power system time-domain simulators to accommodate neural networks22. Some studies also analyze and improve the methods for incorporating neural networks into time-domain simulation23,24. In ref. 25, a data-driven dynamic model of synchronous generators is proposed. Ref. 26 utilizes the data-driven method to precisely model the profiles and dynamics of the load with IBRs. In ref. 27, a black-box dynamic model for microgrids with IBRs is proposed by using long short-term memory (LSTM). In ref. 25,27, the similarity between LSTM and differential algebraic equations (DAEs) describing power system dynamics is discussed in detail. In ref. 28, a dynamic equivalent model is developed for the hybrid renewable energy source in the form of a deep LSTM network. Ref. 29 proposes a high-precision dynamic modeling framework for PV power stations using LSTM. Despite their ability to achieve high accuracy in dynamic modeling, purely neural network-based approaches inherently lack the capacity to enforce physical laws or integrate prior knowledge, occasionally, leading to physically inconsistent or even implausible predictions30. This potential for unreliable outputs poses a significant concern, particularly in safety-critical applications like power system operation and planning31.

Consequently, a physics-informed neural network (PINN) is proposed by combining physical mechanisms with neural network models32–34. This approach has gained significant attention across various power system applications, as summarized in recent reviews31, and has been adapted for tasks such as creating dynamic equivalents35 and improving state estimation36. However, a primary challenge for applying PINN to IBRs is its reliance on accurate, explicit governing equations. As established previously, such equations are often unavailable due to vendor confidentiality, mismatch in temporal resolution, etc. Furthermore, the multilayer perceptron (MLP), the foundation of PINN, is not suitable for such time-series regression tasks.

In summary, the existing modeling landscape presents a clear challenge: physics-based models struggle with accuracy due to simplifications and proprietary details; purely data-driven models, while accurate, lack physical grounding and can produce implausible results; and PINN is hampered by its reliance on known governing equations.

In this work, we propose a data-driven IBR dynamic model for time-domain simulation, composed of an LSTM, a Cross layer, and a physical Inverter dynamic model (LSTMCI). The Cross layer is designed to capture the interactions, which are important and prevalent in power system dynamics15,37–40. LSTMCI uses the advantages of neural networks while ensuring that the dynamic behavior of its output is governed by a physical inverter dynamic model. This design enforces LSTMCI to be strictly constrained by physical mechanisms, providing reliable and accurate outputs. This work aims to enhance foundational transient stability studies by providing such a precise model, thereby supporting more accurate grid planning and operational security assessments.

Results
Design of LSTMCI
The structure of the LSTMCI is shown in Fig. 1. Inspired by the similarity between LSTM and the DAEs that describe IBR dynamics, we employ LSTM as the most fundamental component of the LSTMCI to provide the primary dynamic characteristics of the neural network. To enhance expressive ability, a Cross layer is added to introduce additional interactions. The Cross layer connects to an inverter dynamic model via a fully connected layer (FC), which compresses the variable dimensions to match the inputs required by the inverter model. In this study, the inverter model used is REGC_A41, a widely adopted generic inverter model of WECC, though other inverter models can also be applied. The outputs of the LSTMCI, Ip and Iq, are generated through the inverter dynamic model, whose inputs are the active and reactive current commands (Ipcmd and Iqcmd). Neural networks, including LSTM, the Cross layer, and FC, are employed to emulate components other than the inverter, such as energy conversion systems (e.g., wind turbines, PV panels, and battery systems) and various controllers. These networks process input signals, such as voltage and environmental information, to generate corresponding command signals. This structure aligns with the functional design of IBRs. Detailed formulations and algorithm descriptions are provided in “Architecture of the LSTMCI” section, while a comprehensive overview of the data generation process for model training can be found in Supplementary Note 3. The model’s compatibility and adaptability with measured data were further verified, with full details provided in Supplementary Note 11.

Test system and scenarios
To comprehensively analyze the dynamic responses of IBRs, we examine a representative real-world power system located in southeastern China as depicted in Fig. 2. This power system includes 59 buses, 70 transmission lines, 6 synchronous generators, and 3 IBRs, including a wind farm, a PV power station, and a battery energy storage station (BESS). In particular, the BESS is grid-forming, and the remaining are grid-following. While all leverage IBR technology, wind farms, PV power stations, and BESSs exhibit substantial variations in composition, topology, and control. Also, the grid-forming and grid-following IBRs differs significantly in structure, control, and dynamics: grid-following inverters in the wind farm and PV power station rely on phase-locked loops (PLLs) for synchronization, while the grid-forming BESS typically lacks PLLs and instead maintains system frequency and voltage through direct control. Therefore, this paper studies and analyzes the three IBRs as examples. Although they cannot fully encompass all of the characteristics of IBRs, they are the most important and widely representative.

The test system is simultaneously constructed in two time-domain simulators: PSD-BPA and an in-house simulator. PSD-BPA is a commercial off-the-shelf (COTS) time-domain simulator42, where the three IBRs are modeled using their default models, which are based on the second-generation generic model. The parameters of the default model employed in this study are used in practice. The in-house simulator is designed for time-domain simulations utilizing the proposed LSTMCI. Except for the dynamics of the IBRs, the simulation results of the two simulators are consistent (illustrated in Supplementary Note 2).

To validate the differences between the default model of PSD-BPA and the LSTMCI, we subjected three representative examples, one for each of the three IBRs, to four typical disturbances. These disturbances included two low-voltage ride-through (LVRT) scenarios and two high-voltage ride-through (HVRT) scenarios, corresponding to scenarios a, b, c, and d illustrated in Figs. 3–5. All models maintain consistent parameters across the four scenarios. The parameters of the default models are well-suited for scenarios a and c, resulting in the lowest errors in these scenarios compared to the other two. The scenarios and purposes, the model outputs Ip and Iq have been transformed into P and Q. The default model performs poorly in scenarios b and d, particularly in the voltage recovery curve in scenario b. This is because a single set of default model parameters cannot adequately accommodate all scenarios. Instead, the trained LSTMCI demonstrates enhanced accuracy and adaptability across all scenarios. As depicted in Fig. 3a, b, the proposed LSTMCI model effectively captures key dynamic characteristics, exemplified by the post-fault recovery of active and reactive power.

Figure 3e shows the mean absolute error (MAE) of the four scenarios. The accuracy advantage of the LSTMCI is particularly evident, achieving the lowest error level across almost all scenarios. The mean squared error (MSE) is more sensitive to outliers, providing a perspective that prioritizes the impact of these outliers. Figure 3f shows the MSE of the four scenarios. Across the four scenarios, LSTMCI outperformed the default model, decreasing the overall MAE by 56.1% (from 5.97% to 2.63%) and the MSE by a remarkable 90.9% (from 2.72% to 0.248%). The obvious reduction in MSE suggests that LSTMCI is effective at suppressing large prediction errors and mitigating the extremity of outliers. For more details on error analysis, please refer to Supplementary Note 10. We validated the model’s practical workflow through an incremental learning study, which enhanced accuracy in scenario d by fine-tuning with a limited set of measurements (see Supplementary Note 11). It should be noted that while data are normalized for the neural network training process, model outputs are denormalized back to their original physical scale before the calculation of any performance metrics. Therefore, all reported MAE and MSE values are based on the actual per unit (p.u.) values. The definitions of the MAE and the MSE are given by the following:

MAE = 1/N * sum(|ξi - ξ^i|) (1)

MSE = 1/N * sum((ξi - ξ^i)^2) (2)

where ξi is the true value at time step i, ξ^i is the model output at time step i, and N is the number of all data points.

Example 2: PV power station. In this example, the PV power station (rated at 500 MW) comprises 500 PV panels, each rated at 1.05 MW. The brief parameters of a PV panel are listed in S4. Each PV string is connected to the collection system via a 1.14 kV/37 kV step-up transformer. Here, we also compare the performance of the default model and the proposed LSTMCI with the measurements. Measurements are also sampled at the PCC of the PV power station with a sampling frequency of 100 Hz and processed by a low-pass filter with a cut-off frequency of 1 Hz. Figure 4 presents a comparative analysis of four different scenarios.

In scenarios a and b shown in Fig. 4a, b, the default model suffers from overshooting during the power recovery phase after the LVRT. In scenarios c, d, the default model exhibits deviations during the occurrence and recovery of the HVRT process. Figure 4e, f show the MAE and MSE of the default model and LSTMCI relative to the measurement. The default model exhibits poorer MAE and MSE in scenarios b, d. This is further highlights the default model's inability to perform accurately in all scenarios, underscoring the limitations of the existing dynamic model of IBRs in terms of accuracy. Across four scenarios, LSTMCI reduced errors compared to the default model, lowering the overall MAE by 70.4% (from 4.53% to 1.34%) and the MSE by 91.1% (from 1.95% to 0.174%). The LSTMCI demonstrates a significant accuracy advantage across all scenarios, aligning more closely with the measured data.

Example 3: grid-forming BESS. The previously analyzed wind farm and PV power station operate with grid-following inverters, which depend on the grid to provide voltage and command signals for maintaining power output. During outages, these inverters disconnect rather than actively contribute to system recovery. In contrast, grid-forming inverters have garnered significant attention for their ability to enhance system stability by autonomously regulating voltage and frequency. To further investigate this capability, we validate a 100 MW/200 MWh grid-forming BESS. The BESS is at the planning stage. The measurements are from field tests and processed by a low-pass filter with a cut-off frequency of 1 Hz.

Figure 5 shows the comparison results between the LSTMCI and the default model of the PSD-BPA. As in the above examples, the parameters of the default model here are optimized and suited for the test scenarios. Compared to the modeling results for the grid-following wind farm and PV power station (presented in Figs. 3 and 4), the default model exhibits insufficient accuracy in capturing reactive power dynamics during disturbance processes and performs poorly in unoptimized scenarios. These limitations are absent in the LSTMCI model. As shown in Fig. 5e, f, LSTMCI achieves significantly lower MAE and MSE across all four scenarios. Across the four scenarios, LSTMCI significantly outperformed the default model, decreasing the overall MAE by 73.8% (from 8.04% to 2.11%) and the MSE by 94.9% (from 2.83% to 0.145%). This highlights LSTMCI’s capability to accurately model grid-forming inverter and BESS dynamics.

Time-domain simulation with LSTMCI
The superior accuracy of LSTMCI demonstrated across the three examples exhibits notable deviations compared to existing generic dynamic models of IBRs in specific scenarios, thereby allowing for more accurate power system stability assessments.

To investigate these implications, a severe three-phase ground fault is applied at the largest generator of the test system, G1. This event triggers low-frequency oscillations in the rotor angle of the grid, as illustrated in Fig. 6 for simulations employing the vendor model, LSTMCI, and a default model (with consistent parameters maintained across all simulations for a fair comparison). Vendor models, widely regarded within the industry as the most accurate and detailed representations, nevertheless suffer from significant practical drawbacks: they are computationally intensive, proprietary, and tied to specific software platforms10,44. These limitations render them unsuitable for the large-scale dynamic studies required by the industry and consequently motivate efforts, such as those by WECC and IEC, to develop generic dynamic models13. Notably, Fig. 6 shows that the rotor angle response simulated with LSTMCI closely mirrors the vendor model’s results, while the response using the default model exhibits a distinctly different oscillatory pattern. The stability characteristics of these oscillations are quantified below using Prony analysis.

To further characterize these oscillations, Prony analysis is conducted on the rotor angle responses to extract dominant modes45,46. The Prony analysis results of rotor angle low-frequency oscillations in generator G2 are summarized in Table 1, where the frequency, amplitude, phase, damping, and damping ratio are provided for each model. The simulations based on the vendor model and LSTMCI both reveal a dominant low-frequency mode, with closely aligned frequencies (0.799 Hz and 0.794 Hz, respectively). Critically, both the vendor model and LSTMCI simulations yield positive damping values (0.020 and 0.021) and corresponding negative damping ratios (−0.395 and −0.411), indicating an unstable response under the fault scenario. In contrast, the simulation using the default model exhibits a different oscillatory profile, characterized by a slightly higher frequency (0.887 Hz), a negative damping value (−0.005), and a corresponding positive damping ratio (0.024), suggesting a stable mode.

These Prony analysis findings highlight the significant accuracy improvements of time-domain simulations with LSTMCI. By accurately capturing the dominant oscillatory behavior and the instability tendency predicted by the baseline vendor model, LSTMCI offers a more reliable assessment of power system stability compared to the default model, which exhibits qualitatively different and potentially erroneous stability characteristics. This highlights the importance of employing accurate IBR dynamic models, such as LSTMCI, for comprehensive power system stability studies in power systems with high IBR penetration. To further underscore this point, a detailed comparative analysis in an IBR-dominated, low-inertia system, where the impact of model accuracy is even more critical, is provided in Supplementary Note 9.

Performance comparison
This section validates the proposed LSTMCI model by comparing its extrapolation capability against the default model, and its accuracy and efficiency against other data-driven approaches (including purely neural networks and a PINN). These comparisons serve to demonstrate the superiority of our tailored architecture.

Extrapolation capability. Model evaluation distinguishes between in-distribution data, resembling the training data, and out-of-distribution data, representing novel conditions or out-of-range inputs. Model generalization capability hinges on its extrapolation capability: accurate predictions on out-of-distribution inputs, demonstrating generalization beyond training patterns47,48. To validate the extrapolation capability of the model across different scenarios, we tested a continuous LVRT scenario for a wind farm. Initially, the wind farm drops down to 0.4 p.u. 200 ms later, a zone-based protection operates, then the PCC voltage of the wind farm returns to 0.75 p.u. Another protection operates 400 ms later, which returns the voltage to normal. In this scenario, we evaluated the performance of the vendor model, the default model, and the LSTMCI. The time-domain simulation results for each model are shown in Fig. 7a. It is important to note that the training data for LSTMCI is based on single disturbances only. Thus, the blue region in Fig. 7a is within the distribution of the training set or in-distribution, and the other region is out-of-distribution. Despite operating in an untrained scenario, LSTMCI still demonstrated high accuracy. Its dynamic response of the active and reactive power is similar to the vendor model: the MAE between the LSTMCI and the vendor model is 2.04% for active power and 0.73% for reactive power. The default model here is specifically tuned for the 0.4 p.u. LVRT scenario, but it performed poorly in this complex scenario, especially in capturing the active power recovery characteristics. The MAE between the default model and vendor models is 13.61% for active power and 2.62% for reactive power. This illustrates that the default model cannot achieve high accuracy across all scenarios. It highlights that the extrapolation capability of LSTMCI is better across multiple scenarios.

Comparison with other neural networks. Compared to other existing neural network models, our method has distinct theoretical advantages: the outputs of our method are more reliable and explainable. The output of our method is generated by an inverter model, and its dynamic behaviors are compelled to meet the physical constraints of the inverter.

Basically, the IBR dynamic modeling is a time-series regression problem. To provide comparative benchmarks, we evaluated several established sequence models against our proposed approach, including LSTM, RNN, gated recurrent unit (GRU), temporal convolutional neural network (TCN)49, and Transformer50. Furthermore, to situate our work in the context of physics-informed methods, we also include a state-of-the-art PINN in our comparison51. The PINN is constructed using the second-generation generic model equations as its physical basis. In order to ensure a fair comparison, the data used for the training of each model, the data normalization method, etc., are kept consistent. Additionally, when feasible, we match the number of parameters of the models to that of the proposed model as closely as possible. Table 2 shows the features of the evaluated models. To reflect the practical scarcity of measured data, the neural network in this study is trained using a limited number of data samples. Details of the data generation process are provided in Supplementary Note 3.

MAEs of the comparison results are shown in Fig. 7b. Among the three examples, the proposed method outperforms all other models, as demonstrated by the fact that the MAEs are at the lowest levels. Among the purely data-driven networks, the MLP show the maximum errors across the three IBRs, which confirms its unsuitability for time-series regression tasks. The PINN, by incorporating physical information, achieves a lower error than the standard MLP, confirming the benefit of physics-informed approaches. Nevertheless, the proposed LSTMCI model still demonstrates higher accuracy than the PINN across all three IBR cases. This remaining performance gap can be attributed to the two key limitations of the PINN framework in this application: its accuracy is inherently limited by the accuracy of the simplified generic model equations it relies on, and its MLP-based structure is less adept at capturing complex temporal dependencies compared to LSTMCI. Figure 7d compares the loss function descent process of LSTMCI and LSTM in the validation set. The LSTMCI reaches lower loss faster, which demonstrates better training efficiency.

To determine the optimal structure, this study tested several related alternative structures for the three IBRs validated as examples. Every related alternative structure is detailed in Table 2 and the validation results are shown in Fig. 7c. The error of the LSTM+Inv. is reduced relative to LSTM. This indicates that using the inverter model can effectively regulate the dynamic behavior of LSTM and improve its accuracy. With the Cross layer, the accuracy of LSTM+Cro. is improved relative to LSTM in all scenarios. It shows that the Cross layer adds effective interactions between the variables to LSTM and improves its expressive accuracy. Deep & Cross network (DCN) is specifically designed to provide the interactions52, but is not effective enough in this problem. DCN provides redundant structures and parameters that complicate the model, resulting in LSTM+DCN+Inv, which is even less accurate than LSTM. The accuracy of RNN+Cro.+Inv. is lower than that of LSTMCI since LSTM is improved from RNN.

Methods
Architecture of the LSTMCI
The proposed network architecture of LSTMCI is shown in Fig. 1. The model architecture reflects the physical structure of IBRs. LSTMCI uses neural networks, LSTM, Cross layer, and FC to capture and express non-inverter dynamics. Subsequently, an inverter model employs the output of the neural network to generate current for injection into the grid. This study employs an inverter model, REGC_A, and other inverter models are also available. Among the neural networks, the LSTM serves as the foundational element. The selection of LSTM over RNN is due to the fact that RNNs suffer from the vanishing gradient problem, making them ineffective at capturing the crucial long-term dependencies in power system dynamics. Compared to the similarly efficient GRU, the LSTM’s more expressive structure with separate forget and input gates allows for more flexible control over the model’s memory, which is critical for modeling the complex, path-dependent behavior of IBRs following a disturbance27–29. It processes the hidden state of the last time step, h(t−1), cell state of the current time step, c(t−1), and input variable of the current time step x(t), to output the middle hidden state, h'(t). Notably, the input vector x(t) includes voltage magnitude and phase angle, while system frequency is omitted. This is because, within the phasor-domain framework used for transient stability, frequency dynamics are implicitly captured by the time derivative of the phase angle. FC processes h'(t) to output the inputs of the REGC_A, Ipcmd and Iqcmd. In the end, REGC_A outputs Ip and Iq as the output of the LSTMCI. Supplementary Note 1 provides detailed information on the REGC_A model, including its structure, parameters, and practical availability. The LSTMCI offers a unified framework for modeling the dynamics of IBRs. The flexibility of this approach allows for the modeling of diverse IBR types by simply adjusting the inputs to LSTMCI.

A key challenge in IBR dynamic modeling is representing the numerous and significant nonlinear interactions among state variables. Fundamentally, these interactions arise from the underlying physics: for instance, quantities like active and reactive power are products of voltage and current, and the essential d/q-axis transformations central to inverter control involve nonlinear trigonometric functions of the phase angle. While a standard LSTM can capture temporal patterns, it cannot efficiently or explicitly model these crucial pairwise and higher-order feature interactions25. To address this, in this study, the cross-layer is designed to add pairwise interactions between all variables (including h'(t), x, and y) to the LSTM equations. The input of the Cross layer includes V(t), θ(t), Φ(t), Ip(t−1), and Iq(t−1). By multiplying or squaring these variables, relevant electrical power information can be incorporated. The input of the Cross layer also includes h'(t), allowing for other inputs of the Cross layer to simulate additional pairwise interactions. The equations of the cross layer are shown in (3) and (4). The calculation process is depicted in Fig. 8a.

I = (Mh ⊗ lT)Wl (3)

l = [hT(t), xT(t), yT(t−1)]T (4)

where I represents all the interactions, Wl denotes weights, l is a column vector composed of all the variables, ⊗ is the Kronecker product, Mh is an nh × nh unitary matrix, nh is the number of dimensions of h, also the number of state variables.

Implementation details
Initialization. The parameters of the neural networks of the LSTMCI are initialized with Xavier normal55, and the parameters of the inverter model are set according to the rated values collected from vendors. The variables of the REGC_A are initialized according to the power flow results.

Data preprocessing. The comprehensive overview of the data generation process for model training can be found in Supplementary Note 3. All of the data used is low-pass filtered. For the dynamic model, the signals of the IBRs are centered around the steady-state operating point, with significant deviations occurring during faults. Therefore, we propose a mean centering adjustment based on min-max normalization to normalize the input used by the LSTM and the cross-layer of the LSTMCI. The normalization is defined by the following:

z* = (z - z_min) / (z_max - z_min) - 1/N * sum((z_i - z_min) / (z_max - z_min)) (5)

where z* is the normalized data, z is the original data points, z_min and z_max are the minimum and maximum values of z, Ni is the dimension of the z.

Training. In this paper, we use the MAE as the evaluation metric, which is commonly used in time-series regression and dynamic model validation43,56. The loss function employed by this study is defined as follows:

L = L_MAE(ξ, ξ^) + λk * L_MAE(ξk, ξ^k) (6)

where L_MAE is the MAE function referring to (1), ξ^ is the output of the LSTMCI, ξ^k is the output of the LSTMCI during the key time period (i.e., pre-fault, fault, and post-fault period), ξ and ξk are the corresponding true values, and λk is a parameter which controls the importance of the key time period.

We select the pre-fault period as the key time period in the loss function to ensure the model accurately establishes the initial steady-state conditions. Furthermore, to develop a more physically grounded internal state representation, the model can be trained to predict key physical quantities in addition to its primary outputs. This is achieved through a multi-task learning strategy. In addition to the primary task of predicting terminal quantities (e.g., currents Ip and Iq), the model is simultaneously trained to predict a set of auxiliary physical variables. These auxiliary targets are selected based on two criteria: their physical significance in representing the IBR’s internal dynamics and their practical availability from measurement data (e.g., DC-link voltage, PLL states). This is achieved by defining a composite loss function as shown in Eq. (6), which includes weighted loss terms for both the primary and auxiliary outputs. This process encourages the network to learn a more complete and accurate representation of the IBR’s internal dynamics if the internal state's physical quantities can be obtained.

We use the adaptive moment estimation (Adam) optimizer57 with a batch size of 4 to optimize the parameters of the models. The step size is set to 0.001, the decay rate for momentum is 0.9, and the decay rate for squared gradients is 0.999. All the parameters, including the parameters of the neural networks and the inverter model, are optimized in a synchronous manner. In this study, the neural networks and the REGC_A model are constructed and trained using PyTorch58.

Representation of different control strategies. The proposed data-driven framework accounts for various IBR control strategies, such as grid-following and grid-forming, by learning their resultant dynamic behaviors. It is important to clarify that while these control strategies correspond to physically different characteristics (i.e., controlled current sources and controlled voltage sources), the model’s structure of providing a current injection as output based on terminal voltage as an input is consistent for both. This input-output format is dictated by the standard numerical interface of large-scale time-domain simulators, which requires all component models to provide their corresponding current injections.

Therefore, the model learns to replicate the correct current injection response for any given control strategy within this simulation-compatible modeling framework. Rather than containing explicit parameters or switches for different control modes, the model learns from operational data that inherently embeds the unique dynamic characteristics produced by a specific control strategy in response to grid events. By training on a dataset from an IBR with a grid-forming scheme, for instance, the LSTMCI model learns to replicate that specific grid-forming behavior. Differentiation between control types is thus achieved by training distinct model instances on representative datasets for each strategy. This universal modeling philosophy is illustrated schematically in Supplementary Note 12.

Integration with the time-domain simulator. The proposed model is incorporated into a time-domain simulator using the alternating iteration method, a widely used technique in COTS time-domain simulation software for power systems23. Figure 8b shows the brief process of LSTMCI incorporation into a time-domain simulator. At each time step of the alternating iteration, the time-domain simulator feeds the bus voltages to the dynamic models, which in turn feed the current injections back to the simulator. On the next time step, the dynamic model saves and transfers the converged state variables for use in the next time step. Please see Supplementary Note 2 for details.

Peer review rounds
[{"round": 1, "reviewer_comments": {"reviewer_1": "1. The size of the system under study is very small. More practical large-scale system simulations are necessary to enhance the quality of this manuscript.\n2. Please discuss the main reason why the proposed model features a tailored architecture that combines long short-term memory (LSTM) with a Cross layer to model both temporal dependencies and nonlinear interactions can outperform existing models in analytical aspects.\n3. Please address the practical application values of the proposed model for modern power grid planning and stability assessment.", "reviewer_2": "The manuscript proposes a data-driven approach to represent the dynamic behavior of IBRs using neural networks. A cross layer is developed to model the interactions.\n1. The novelty of the paper should be better emphasized by explicitly comparing the proposed approach with existing methods.\n2. How do data resolution and measurement accuracy impact the performance of the proposed LSTMCI?\n3. How much data is required for the training process?\n4. It is unclear how the model differentiates between various control strategies (grid-following and grid-forming). Clarification is needed regarding how BESS grid-forming control strategies are embedded or reflected in the training data and LSTMCI.\n5. Why only voltage magnitude and phase angle are used as inputs, while system frequency, which is an essential variable, is omitted?\n6. Which parameters of the default model need to be optimized in the three examples?\n7. The LSTMCI model is validated under low-voltage (LV) and high-voltage (HV) fault conditions. Its performance under other critical conditions—such as frequency variations, N-1 contingencies, or islanding events—remains unverified. Additionally, if historical fault or disturbance data is not available for training, can the model still be effectively used?\n8. Including all pairwise interactions through a Kronecker product increases computational cost and may not scale well to large systems, such as large-scale multi-inverter systems. Clarification is needed regarding whether the model can run in real time in large systems and its computational requirements.\n9. It is assumed that parameters of the inverter model (REGC_A or others) are available from vendors — this is not always realistic in real-world utility contexts where such data is proprietary or incomplete.\n10. The paper claims numerical stability, but alternating iteration between LSTMCI and the time-domain simulation could diverge or oscillate. Moreover, the numerical convergence is not guaranteed and depends on proper damping/regularization. Clarification is needed regarding the convergence criteria.", "reviewer_3": "This paper proposes a data-driven IBR dynamic model, which integrates LSTM, a cross layer, and a physical inverter model. The results demonstrate the effectiveness of the proposed model. Although the proposed model demonstrates some values, ML/AI based IBR modeling has been widely studied and there is a large body of literature published in power system specific journals. The reviewer is not convinced that the contributions of this paper are enough for a nature paper. Some specific comments are provided below:\n1. The key idea of this paper is to integrate multi-layer neural networks with a physical inverter dynamic model to derive a data-driven IBR dynamic model. Although the proposed model is compared with other ML/AL based models, a comparison with state-of-the-art physics-informed ML/AI based models is needed but lacking in the paper.\n2. This paper presents results for both grid-following and grid-forming inverters. Also, the authors mentioned that the proposed LSTMCI outputs current injection, which is also supported by the problem formulations provided in the method section. As a current source, the model is applicable to grid-following inverters. However, grid-forming inverters are voltage sources, the reviewer feel confused why the LSTMCI model is also applicable to grid-forming BESS case. Please clarify.\n3. The authors provided time-domain simulation results. With the adoption of LSTMCI, will the traditional inverter controllers, such as P/Q control and droop control, be still needed? Please clarify.\n4. All the presented studies are based on single device analysis, and the test system only includes three IBRs. Please provide a situation analysis that is based on an IBR-dominated grid. This is important to prove the practical feasibility for the proposed data-driven model.", "reviewer_4": "The paper presents a hybrid deep learning and physics-based approach to modeling the dynamics of IBRs. The methodology involves feeding inputs such as voltage, frequency, and weather data into an LSTM layer to capture temporal dependencies for each feature, independently (voltage, frequency). A cross-layer is then employed to model interactions between input features, followed by a fully connected (FC) layer to adjust the output dimensions for inverter input. While the topic is relevant, it is not entirely novel, and there are existing works with similar approaches. Additional comments are given below.\n1. Complexities of power systems due to integration of IBR and limitations of existing models must be clearly defined.\n2. Several reference, such as [31, 35, 36] are included without providing detailed relevance.\n3. The authors correctly identify that MLP is not suitable for time-series modeling, their selection of LSTM with a cross layer is not fully justified. There are several models, such as RNN, GRU and others are available. The authors need to provide stronger justification for selection of their approach.\n4. Are the reported MAE and MSE values based on actual values or normalized values?\n5. The authors mention that a drop in MSE means the model is more robust to outliers. But this might not be entirely accurate, because MSE is very sensitive to large errors. So, a lower MSE could just mean the model reduced big errors—not necessarily that it handles outliers better in general. The authors should explain this more or show extra analysis to prove it.\n6. The proposed model does not perform well in some situations, such as scenario d shown in Figure However, no justification for this is provided.\n7. The statement that some state variables of h are assigned as physical quantities such as wind power and direct voltage is intriguing. Could the authors clarify how these variables are selected and whether this mapping is learned or manually defined?", "reviewer_5": "This study proposes a hybrid neural network architecture for inverter-based resource (IBR) modeling, combining LSTM and Cross layers with a physics-based inverter model. The resulting framework, LSTMCI, is shown to effectively replicate vendor-simulated dynamic behaviors across a variety of IBRs. While the proposed method demonstrates high accuracy and extrapolation performance, several aspects regarding its practical deployment, data assumptions, and methodological positioning could benefit from further clarification.\nComment 1:\nThe manuscript convincingly demonstrates that the proposed model can accurately emulate vendor-simulated dynamic behaviors under a wide range of disturbance scenarios. However, the intended use cases for the LSTMCI model are not clearly defined. It remains unclear whether the model is designed for transient stability analysis, fast screening in system planning, approximation for real-time control, or diagnostic simulations. To clarify the model's role and impact in practical power system operations, it is necessary to present specific application scenarios or use cases where the proposed approach would be particularly beneficial.\nComment 2:\nThe LSTMCI model is trained using high-fidelity simulation data provided by vendors, which serve as ground truth. While this approach ensures consistent supervision, it may limit practical applicability in scenarios where vendor models are not available. Although the authors mention the potential to use real-world measurements for training, the feasibility of this direction is not sufficiently explained. For instance, would it be necessary to assume that inverter command signals such as $I_{pcmd}$ and $I_{qcmd}$ can be individually measured for each IBR in the actual system? The practical viability of such an assumption remains unclear to the reader. Furthermore, as suggested in the caption of Fig. 1, if environmental inputs such as wind speed and solar irradiance are to be included, it is important to clarify where and how these measurements are obtained, what temporal resolution they have, and how they are synchronized with electrical variables. Overall, to assess the real-world implementability and potential impact of the proposed framework, it is essential to more clearly define the conditions under which the model can be trained and updated using field data.\nComment 3:\nThe dynamic behavior of IBRs can change over time due to device aging, firmware updates, and control parameter tuning. While the authors mention that incremental learning or transfer learning could be employed to maintain accuracy, the paper does not describe how these techniques would be operationalized. There is no discussion of how and when retraining should be triggered, how retraining data would be collected and verified, or how performance degradation would be monitored in practice. Given that one of the paper’s goals is to support long-term simulation accuracy, these operational concerns deserve more attention.\nComment 4:\nThis paper positions LSTMCI as a physics-informed model by incorporating an inverter module into the network architecture to ensure physically consistent outputs. This approach is practically significant in that it balances high-fidelity emulation through neural networks with electrical engineering validity. However, recent studies in the field of PINNs have proposed not only the use of penalty terms or surrogate components, but also the direct incorporation of physical laws as hard constraints through architectural design. To better clarify the contribution of this work, it would be helpful to situate the proposed method in relation to such recent developments and explicitly discuss the differences. In particular, clarifying the implementation advantages of the proposed framework—such as the accessibility of required physical quantities (e.g., control signals, environmental measurements), and the extent to which prior knowledge that is realistically available in the intended use cases can be reflected in the design—would further highlight the novelty and practical value of the research.\nComment 5:\nIn the Dataset Generation section of the Supplementary Information, a reference is indicated as “[?]” rather than with a proper citation. Please revise the document to provide the correct reference.", "reviewer_6": "I co-reviewed this manuscript with one of the reviewers who provided the listed reports. This is part of the Nature Communications initiative to facilitate training in peer review and to provide appropriate recognition for Early Career Researchers who co-review manuscripts."}, "author_response": "Responses to Reviewers\nNCOMMS-25-27912\nsubmitted to\nNature Communications\nAugust5,2025\nDear reviewers,\nThanksforreviewingourmanuscriptNo. NCOMMS-25-27912titled“Data-drivendynamicmodel-ingforinverter-basedresourcesusingneuralnetwork”. Thecommentsfromtheeditorandreviewersare invaluableinguidingourrevisions. Wehavecarefullyaddressedallthefeedbackandarenowsubmitting therevision.\nIntheremainderofthisdocument,weprovideresponsestoallthecommentsfromreviewers. Also, toassisttheassessmentoftherevisedversion,allmajorchangesinthemanuscriptarequotedinthetext boxes, enclosed with comment replies. Furthermore, a supplemental bibliography for the reply to each reviewerisattachedattheendofthecorrespondingreplysection. Correspondingchangescanbeeasily locatedinthemanuscriptastheyhavebeenhighlightedinblue.\nBestregards,\nAuthors\n[... Author responses to all reviewers follow ...]"}, {"round": 2, "reviewer_comments": {"reviewer_2": "The revised version addresses most of my concerns. The reviewer has two more comments.\n1. It is suggested to further clarify whether distributed or parallel computation is required for deployment at large scale study cases.\n2. Practical strategies for model retraining, transfer learning, or online adaptation are expected to be discussed.", "reviewer_3": "The authors have address my questions. No further comments.", "reviewer_4": "Modifications to the paper along with detailed comments have clarified the doubts.", "reviewer_5": "The authors' responses and the revisions made to the manuscript appropriately address the concerns raised by the reviewer. This reviewer has no further comments.", "reviewer_6": "I co-reviewed this manuscript with one of the reviewers who provided the listed reports. This is part of the Nature Communications initiative to facilitate training in peer review and to provide appropriate recognition for Early Career Researchers who co-review manuscripts."}, "author_response": "Responses to Reviewers\nNCOMMS-25-27912A\nsubmitted to\nNature Communications\nOctober5,2025\nDeareditorandreviewers,\nThanksforreviewingourmanuscriptNo. NCOMMS-25-27912Atitled“Data-drivendynamicmod-eling for inverter-based resources using neural network”. The comments from the editor and reviewers are invaluable in guiding our revisions. We have carefully addressed all the feedback and are now submittingtherevision.\nIntheremainderofthisdocument,weprovideresponsestoallthecommentsfromreviewers. Also, toassisttheassessmentoftherevisedversion,allmajorchangesinthemanuscriptarequotedinthetext boxes, enclosed with comment replies. Furthermore, a supplemental bibliography for the reply to each reviewerisattachedattheendofthecorrespondingreplysection.\nBestregards,\nAuthors\n[... Author responses to all reviewers follow ...]"}]

Decision letter