WorksEngineering
Extending Grid Foundation Models for Phasor-Domain Dynamic Simulation
Abstract
Grid Foundation Models (GridFMs) are emerging as a powerful framework for learning and transferring knowledge across power grids and grid analysis tasks. This work extends GridFMs from steady-state analysis to dynamic simulation. We present DynGridFM, which uses component-wise tokenization and a structured latent operator to learn shared dynamic representations across heterogeneous grids and enable transfer to unseen systems. Pretrained on nine grids, DynGridFM is adapted to a held-out 48-machine grid, where fine-tuning on 64 trajectories achieves accuracy comparable to training from scratch on 128. On a single GPU, it achieves 924x to 1232x speedup over numerical simulators on one CPU core.
Introduction
Grid Foundation Models (GridFMs) are emerging as a promising framework for learning reusable representations across power grids and analysis tasks [1]. Rather than training a separate model for each task, GridFMs are pretrained on diverse grid configurations to learn a shared model that can be adapted to new systems and applications [2]. Recent studies demonstrate their capabilities in steady-state analysis, including power flow, optimal power flow, and state estimation [3].
Beyond steady-state analysis, power system planning and operation rely extensively on phasor-domain dynamic simulation to analyze post-disturbance responses, transient stability, and oscillation modes [4]. Unlike power flow or state estimation which solve steady-state snapshots, dynamic simulation involves temporal evolution governed by differential equations. Extending GridFMs to this setting therefore requires learning the underlying dynamics that drive this temporal evolution.
Neural networks have long been explored for time-domain simulation, both in power systems and in broader scientific and engineering applications. Yet, existing approaches mainly focus on learning the dynamic responses of a given system [5, 6, 7]. Although these models may cover different operating conditions and parameter settings, they typically rely on a predefined set of state variables and a fixed variable organization. Models developed within this fixed-system formulation do not readily transfer across heterogeneous power systems. Across grids, variations in network topology, component parameters, and operating conditions alter oscillation frequencies, damping characteristics, and modal interactions, while different machine models and controller combinations change the number and physical meaning of the state variables.
This paper develops DynGridFM, a GridFM for transferable phasor-domain dynamic simulation. The key idea is to construct grid-specific latent dynamic operators from shared component-level representations, enabling a single model to predict dynamics across grids with different state spaces and network structures. The key innovations are as follows:
Component-wise tokenization. Rather than directly encoding the entire grid, DynGridFM maps individual buses, machines, and controllers into a common token space. Transmission lines enter as pairwise features that bias the graph-transformer attention. These reusable mappings provide a shared representation across heterogeneous grids.
Latent-space dynamics evolution. Rather than directly fitting system trajectories, DynGridFM learns their evolution through a latent dynamical operator assembled from component-wise representations: self-dynamics blocks capture oscillation and damping, while coupling blocks encode interactions according to physical connectivity. This assembly allows the operator’s dimension and structure to adapt to each grid while sharing learned dynamics across systems.
Pretrained on nine grids with 4 to 26 synchronous machines and diverse controllers, DynGridFM is adapted to a held-out 48-machine, 140-bus grid. Under an equal training budget, the fine-tuned model achieves accuracy comparable to training from scratch with about half as many training samples from the new grid, demonstrating the foundation-model capability of reusing knowledge for data-efficient adaptation. Once adapted, DynGridFM requires roughly three orders of magnitude faster simulation than PST running on one CPU core.
Methodology
Consider phasor-domain power system dynamics governed by differential–algebraic equations (DAEs):
where and denote differential and algebraic states, respectively, specifies the network topology, component models, and parameters, and describes the disturbance, including its type, location, and timing. The goal of DynGridFM is to learn a shared model that predicts dynamic trajectories across grids with different sizes, topologies, and component compositions2:
Overview of the DynGridFM Architecture
To support reuse across heterogeneous grids, DynGridFM represents system dynamics through component-level self-dynamics and coupling blocks, both generated by shared neural modules. These blocks form a grid-specific latent linear operator, whose dimension and structure adapt to each grid. This learned operator governs temporal evolution in the latent space to predict system dynamics, while learned lifting and projection mappings connect the latent and physical states.
Denote 3. Given , the system configuration , and the disturbance , DynGridFM predicts the dynamic trajectory through three stages (Figure 1):
Figure 1. Architecture of DynGridFM: component-wise tokens encode component states in a common space (a), and graph attention combines them with pairwise connection features (b). These reusable representations construct a latent-space operator for dynamic evolution across heterogeneous grids (c).
Here, the lifting map encodes the initial state into latent coordinates, the operator evolves them, and the projection map recovers the physical states.
The neural parameters defining all three stages are shared across grids. To realize this design, we develop component-wise representations to support cross-grid reuse (Section II-B)
and use them to construct the latent operator and the lifting and projection mappings (Section II-C).
Component-Wise Representation
Our representation separates component information from connection information: component tokens map the states and parameters of every single component into a common space, and connection-aware graph attention combines these tokens according to the grid’s physical connections.
Component tokens: The state space of a power system depends on the physical models used for its components. We distinguish component types by their model-specific state variables and parameters. For example, a second-order synchronous machine has rotor angle and speed as its states; a higher-order machine model includes additional electromagnetic states; an exciter has its own controller states. Components of the same type have the same state and parameter definitions across grids, although their parameter values and operating conditions differ. This consistency allows the component encoding to be reused across grids.
To accommodate different state dimensions, we pad each component’s state vector to a common dimension , the largest state count among the component types. A shared encoder maps the component information into a -dimensional token:
Here, contains the normalized initial states padded to entries, and the binary mask identifies the valid entries. The vectors and contain normalized component parameters and disturbance information, respectively. The activity flag is one for components in service and zero otherwise. Component type is not an explicit input: it is conveyed implicitly through the state mask, parameters, and connection features introduced below, and selects the type-specific projection readout (§ 1.1-C).
The output is the initial token representing component ; it is produced by a two-layer perceptron shared across component types and grids. Thus, a grid with components is represented by tokens of dimension , even when the components have different numbers and kinds of states. Because the encoder operates on individual components, its parameters are independent of grid size and composition. Different operating points, disturbances, and component availability change the input values and active tokens, while the same encoding architecture and learned parameters are reused.
Connection-aware graph attention: We then use graph attention to capture interactions between components. The graph has buses, machines, and controllers as nodes, with transmission lines, machine–bus attachments, and controller–machine attachments as edges. Transmission lines are thus represented through connections rather than separate tokens.
For two components and , we define the pairwise features:
Here, the first two terms are one-hot encodings of the graph distance and connection type (i.e., line, machine–bus, controller–machine, self, or no direct connection), respectively. The line parameters , , and are nonzero only for bus pairs directly connected by a transmission line.
Each head aggregates token information via standard attention, with an additional bias encoding the pairwise features [8]:
Here, , , and are learned parameters; is the attention-head dimension; is a small neural network that produces a scalar attention bias. The output combines information from all active components.
Multiple attention heads are combined with residual connections and feed-forward layers to update the tokens. We denote the resulting graph transformer by GT:
where stacks the component tokens , and contains the updated -dimensional tokens incorporating component connection information.
Because the same attention operations apply to every component without parameters tied to grid size or token ordering, these learned models are also reusable across different grids.
Latent-Space Dynamics Evolution
With component and connection information encoded in a reusable form, we now construct the latent dynamics and the mappings between latent and physical states through the three stages shown in Figure 1. Each stage processes using a separate graph transformer; these transformers have the same architecture but separate learned parameters.
Lifting map: The lifting stage maps the component tokens into the latent space through a graph transformer:
where is the updated token for component and is a learned linear map.
Latent operator construction and evolution: Each component’s latent state evolves through its own dynamics and interactions with other components:
where and are self-dynamics and coupling blocks, respectively, and denotes the coupling neighborhood of component .
To construct these blocks, an operator graph transformer first computes , with row representing component . Shared neural networks then generate and . We use these outputs to define the operator blocks as:
where is constrained to be positive and bounded. Because and , the assembled operator satisfies . Consequently, , where is the smallest damping entry. This construction ensures stable latent evolution across grids. The full operator is assembled from and , which governs the latent temporal evolution through . Its dimension and structure adapt to each grid, while the neural modules generating its blocks are shared across grids.
Projection: The projection stage maps the evolved latent coordinates back to component states:
Here, for each component type , a correction neural network and a base matrix are shared across grids. The output is the normalized state deviation. The final prediction of is obtained by reversing the normalization and adding their initial values.
Pretraining and Adaptation
All modules are trained jointly from simulated trajectories using the masked normalized mean squared error:
This loss function is computed over all sampled time points and valid, in-service states in a mini-batch .
During pretraining, each mini-batch contains trajectories from one grid, with grids sampled randomly across training steps. A shared model is trained across the pretraining grids, and its checkpoint is selected by the median validation NMSE.
During adaptation, the pretrained model is fine-tuned on limited trajectories from an unseen grid using the same loss.
Case Study
Experimental Setup
Test Grids
We evaluate DynGridFM on ten grids with 4–48 synchronous generators (Table I), including four standard Power System Toolbox (PST) cases and six variants with different generator and controller compositions. Nine grids are used for pretraining; the 48-machine, 140-bus Northeast Power Coordinating Council (NPCC) grid is held out for adaptation.
| System | Config. | Buses | SG¹ | Exc. | Gov. | PSS |
| 4-SG Two-Area | (i) Base | 13 | 0/0/4 | 4/0 | 4 | 4 |
| (ii) Mixed-SG | 13 | 2/0/2 | 2/0 | 2 | 2 | |
| 10-SG New England (NE) | (i) Base | 39 | 0/10/0 | 0/9 | 10 | 0 |
| (ii) Mixed-SG | 39 | 4/6/0 | 0/5 | 0 | 0 | |
| (iii) Mod.-Control | 39 | 0/10/0 | 0/9 | 0 | 0 | |
| 16-SG NE–NYPS | (i) Base | 68 | 0/0/16 | 16/0 | 0 | 12 |
| (ii) Mixed-SG | 68 | 6/0/10 | 10/0 | 0 | 7 | |
| (iii) Mixed-Exc. | 68 | 0/0/16 | 8/8 | 0 | 6 | |
| 26-SG Composite | (i) Mixed-SG | 107 | 4/10/12 | 12/9 | 0 | 9 |
| 48-SG NPCC² | (i) Base | 140 | 21/27/0 | 0/24 | 0 | 0 |
Table I. Test systems and configurations.
Dataset
We use PST to generate dynamic trajectories under varying operating conditions, component availability, and disturbances. Each scenario samples a load level uniformly from 80–120% of the base load and uses either the intact system or a system with one eligible machine and its controllers out of service, with equal probability. A randomly selected load bus experiences either a load change of ±(5–20)% or a short-circuit fault, also with equal probability. Faults occur at 0.1 s and last 50 ms. Each scenario is simulated for 10 s with a sampling interval of 0.05 s. Scenarios whose power flow fails to converge are discarded and resampled, accounting for 26% of generation attempts, primarily at high load levels. Numerically valid dynamical trajectories are retained even when they exhibit loss of synchronism. For each pretraining grid, we generate 2,000 training, 400 validation, and 400 test trajectories. For the held-out grid, we generate 400 adaptation, 400 validation, and 400 test trajectories.
Training settings
The model has 1.08 million parameters, with token dimension , latent dimension per component, and two layers with four attention heads in each graph transformer. We use AdamW with batch size 16, linear warm-up, and cosine learning-rate decay. No held-out trajectories are used during pretraining. Experiments use an NVIDIA RTX PRO 6000 Blackwell GPU for DynGridFM and an Intel Core Ultra 9 285K CPU for PST.
Pretraining: One Model for Nine Grids
We pretrain DynGridFM on nine grids to learn reusable dynamics representations: a single set of parameters will apply to all grids despite differences in size, machine models, and controller configurations. The pretraining grids contain –163 components, giving latent operators with dimensions from to .
As shown in Figure 2, the pretraining NMSE decreases from 0.85 to , while validation NMSE also consistently decreases across all nine grids. After pretraining, median test NMSE ranges from to 0.010 across these grids.

Figure 2. Training and validation NMSE during pretraining. Colors distinguish systems; line types denote system configurations (see Table I).
Figure 3 further compares predicted trajectories with PST simulations under faults and load changes. The predictions closely follow the oscillations and component responses throughout the 10-s simulation horizon, despite differences in SG and controller configurations across systems. The agreement in oscillation frequency, amplitude, and overall response trends demonstrates that the shared model captures the dynamics of different components across heterogeneous grids.

Figure 3. Prediction accuracy of the DynGridFM model on the testing set of pretraining grids, compared with PST. and denote bus voltage magnitude and phase angle; and denote generator rotor angle and field voltage.
Adaptation to an Unseen Grid
We next evaluate DynGridFM on the held-out 48-machine NPCC grid. After fine-tuning on 400 trajectories, the predicted trajectories closely follow the PST simulations in oscillation frequency, amplitude, and overall response trends (Figure 4). The median test NMSE is 0.064, higher than on the pretraining grids, likely because the NPCC grid has nearly twice as many generators as the largest pretraining grid and includes component parameters outside the pretraining ranges. The trend in Figure 5 suggests that additional adaptation data may further reduce this error, which will be part of our future work.

Figure 4. Prediction accuracy of DynGridFM on the held-out NPCC test set after fine-tuning, compared with PST. denotes the generator -axis transient internal voltage.

Figure 5. Fine-tuning versus training from scratch: median test NMSE on the held-out NPCC grid with varying numbers of training trajectories.
To assess whether a foundation model offers an advantage over building a separate model for each new grid, we compare fine-tuning with training from scratch. Both use the same training trajectories, learning rates, and number of training epochs. As shown in Figure 5, fine-tuning consistently achieves lower test NMSE than training from scratch. With only 64 trajectories, it matches the accuracy of training from scratch with 128; with 256 trajectories, it outperforms training from scratch with 400. Cross-grid pretraining therefore reduces the number of new simulations required for accurate prediction on a new grid, demonstrating the advantage of adapting a foundation model over training a separate model for each grid.
Computational Efficiency
Finally, we compare the runtime of DynGridFM on one GPU with PST on a single CPU core for an individual 10-s simulation. Following [3], DynGridFM runtime includes data transfer, normalization, trajectory prediction, and inverse normalization, excluding model loading and warm-up.
As shown in Table II, DynGridFM predicts complete trajectories in approximately 3–5 ms, compared with 3–5 s for PST, achieving speedups of 924×–1,232× across the tested grids. With GPU batching and ideal 24-core parallelism for PST, DynGridFM retains a throughput advantage of 67×–4,155×.
| Grid | PST (s) | DynGridFM (ms) | Speed-up |
| 4-SG Two-Area | 3.64 | 2.96 | 1,232× |
| 10-SG NE | 3.17 | 2.99 | 1,063× |
| 16-SG NE–NYPS | 3.59 | 3.16 | 1,136× |
| 26-SG Composite | 4.24 | 3.73 | 1,137× |
| 48-SG NPCC | 5.01 | 5.42 | 924× |
Table II. Runtime of a single 10-s simulation: PST on one CPU core; DynGridFM with one scenario per forward pass on one GPU.
Conclusion
This paper presents DynGridFM, which extends GridFMs to phasor-domain dynamic simulation. The key challenge is to learn a reusable model that captures temporal evolution governed by differential equations across grids with different state-space dimensions and compositions. We address this challenge through component-wise tokens and a structured latent operator generated by neural modules shared across grids. The results demonstrate accurate dynamic prediction, data-efficient adaptation to unseen grids, and substantial computational acceleration over conventional numerical simulation.
Our future work will extend DynGridFM to larger grids, inverter-based resources, broader disturbances, and longer simulation horizons.
References
- [1]H. F. Hamann, B. Gjorgiev, T. Brunschweiler, L. S. Martins, A. Puech, A. Varbella, J. Weiss, J. Bernabe-Moreno, A. B. Massé, S. L. Choi, et al., “Foundation models for the electric power grid,” Joule, vol. 8, no. 12, pp. 3245–3258, 2024.arxiv.org/abs/2407.09434
- [2]A. Puech, M. Mazzonelli, C. Cintas, T. R. Govindasamy, M. Mn-gomezulu, J. Weiss, M. Beu, A. Varbella, F. Mirallès, K. Kim, et al., “gridfm-datakit-v1: A python library for scalable and realistic power flow and optimal power flow data generation,” arXiv preprint arXiv:2502.14658, 2025.
- [3]A. Puech, M. Mazzonelli, T. R. Govindasamy, M. Mngomezulu, H. Maeso-García, T. Tolhurst, J. Bayazi, A. Moeini, N. Simumba, C. Cintas, et al., “Genco-a unified neural solver embedded in a development framework for steady-state grid analysis,” arXiv preprint arXiv:2608.09921, 2026.arxiv.org/abs/2608.09921
- [4]P. Kundur and O. P. Malik, Power system stability and control, vol. 7. McGraw-Hill New York, 1994.
- [5]S. L. Brunton, J. N. Kutz, et al., “Data-driven science and engineering,” Machine learning, dynamical systems, and control, p. 2019, 2019.
- [6]Y. Zhou and P. Zhang, “Neural electromagnetic transients program,” in 2022 IEEE Power & Energy Society General Meeting (PESGM), pp. 1–5, IEEE, 2022.DOI
- [7]M. Tancik, P. Srinivasan, B. Mildenhall, S. Fridovich-Keil, N. Raghavan, U. Singhal, R. Ramamoorthi, J. Barron, and R. Ng, “Fourier features let networks learn high frequency functions in low dimensional domains,” Advances in neural information processing systems, vol. 33, pp. 7537–7547, 2020.
- [8]C. Ying, T. Cai, S. Luo, S. Zheng, G. Ke, D. He, Y. Shen, and T.-Y. Liu, “Do transformers really perform badly for graph representation?,” Advances in neural information processing systems, vol. 34, pp. 28877–28888, 2021.
