betaFeedback

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):

x˙(t)=fC,d(x(t),y(t),t),0=gC,d(x(t),y(t),t)(1)\dot{x}(t) = f_{C,d}(x(t), y(t), t), \qquad0 = g_{C,d}(x(t), y(t), t) \tag*{(1)}

where xx and yy denote differential and algebraic states, respectively, CC specifies the network topology, component models, and parameters, and dd 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:

(x(0),y(0),C,d)⟼{x(tk),y(tk)}k=1Nt(2)\left(x(0),y(0),C,d\right)\longmapsto\left\{x(t_k),y(t_k)\right\}_{k=1}^{N_t} \tag*{(2)}

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 X(t)=col⁡(x(t),y(t))X(t)=\operatorname{col}(x(t),y(t))3. Given X(0)X(0), the system configuration CC, and the disturbance dd, 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).

Z(0)=L(X(0),C,d)(3)Z(0)=\mathcal{L}\left(X(0),C,d\right) \tag*{(3)}
Z(t)=eKtZ(0),K=K(X(0),C,d)(4)Z(t)=e^{\mathcal{K}t}Z(0),\qquad\mathcal{K}=\mathcal{K}\left(X(0),C,d\right) \tag*{(4)}
X^(t)=P(Z(t),C,d)(5)\widehat{X}(t)=\mathcal{P}\left(Z(t),C,d\right) \tag*{(5)}

Here, the lifting map L\mathcal{L} encodes the initial state into latent coordinates, the operator K\mathcal{K} evolves them, and the projection map P\mathcal{P} 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.

  1. 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 SS, the largest state count among the component types. A shared encoder maps the component information into a DD-dimensional token:

ui=[X~i(0);mi;θ~i;αi;d~i],hi(0)=αiϕtok(ui)(6)u_i=\left[\widetilde{X}_i(0);m_i;\widetilde{\theta}_i;\alpha_i;\widetilde{d}_i\right],\qquad h_i^{(0)}=\alpha_i\phi_{\mathrm{tok}}(u_i) \tag*{(6)}

Here, X~i(0)\widetilde{X}_i(0) contains the normalized initial states padded to SS entries, and the binary mask mim_i identifies the valid entries. The vectors θ~i\widetilde{\theta}_i and d~i\widetilde{d}_i contain normalized component parameters and disturbance information, respectively. The activity flag αi\alpha_i 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 hi(0)h_i^{(0)} is the initial token representing component ii; it is produced by a two-layer perceptron ϕtok\phi_{\mathrm{tok}} shared across component types and grids. Thus, a grid with NN components is represented by NN tokens of dimension DD, 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.

  1. 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 ii and jj, we define the pairwise features:

pij=[onehot⁡(ηij);onehot⁡(ϵij);Rij,Xij,Bij](7)p_{ij} = \left[\operatorname{onehot}(\eta_{ij});\operatorname{onehot}(\epsilon_{ij});R_{ij},X_{ij},B_{ij}\right] \tag*{(7)}

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 RijR_{ij}, XijX_{ij}, and BijB_{ij} 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]:

aij=softmax⁡j((WQhi)T(WKhj)dh+ϕpair(pij))(8)a_{ij} = \operatorname{softmax}_{j}\left(\frac{(W_Qh_i)^{\mathsf{T}}(W_Kh_j)}{\sqrt{d_h}}+\phi_{\mathrm{pair}}(p_{ij})\right) \tag*{(8)}
oi=∑jaijWVhj(9)o_i = \sum_j a_{ij}W_Vh_j \tag*{(9)}

Here, WQW_Q, WKW_K, and WVW_V are learned parameters; dhd_h is the attention-head dimension; ϕpair\phi_{\mathrm{pair}} is a small neural network that produces a scalar attention bias. The output oio_i 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:

Hout=GT⁡(H(0),{pij})(10)H^{\mathrm{out}} = \operatorname{GT}\left(H^{(0)},\{p_{ij}\}\right) \tag*{(10)}

where H(0)H^{(0)} stacks the component tokens hi(0)h_i^{(0)}, and HoutH^{\mathrm{out}} contains the updated DD-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 H(0)H^{(0)} using a separate graph transformer; these transformers have the same architecture but separate learned parameters.

  1. Lifting map: The lifting stage maps the component tokens into the latent space through a graph transformer:

HL=GT⁡L(H(0),{pij}),zi(0)=WLhiL(11)H^{\mathcal{L}} = \operatorname{GT}_{\mathcal{L}}\left(H^{(0)},\{p_{ij}\}\right), \qquad z_i(0) = W_{\mathcal{L}}h_i^{\mathcal{L}} \tag*{(11)}

where hiLh_i^{\mathcal{L}} is the updated token for component ii and WLW_{\mathcal{L}} is a learned linear map.

  1. Latent operator construction and evolution: Each component’s latent state evolves through its own dynamics and interactions with other components:

z˙i=Kiizi+∑j∈NiKijzj(12)\dot{z}_i = \mathcal{K}_{ii}z_i+\sum_{j\in\mathcal{N}_i}\mathcal{K}_{ij}z_j \tag*{(12)}

where Kii\mathcal{K}_{ii} and Kij\mathcal{K}_{ij} are self-dynamics and coupling blocks, respectively, and Ni\mathcal{N}_i denotes the coupling neighborhood of component ii.

To construct these blocks, an operator graph transformer first computes G=GT⁡K(H(0),{pij})G=\operatorname{GT}_{\mathcal{K}}(H^{(0)},\{p_{ij}\}), with row gig_i representing component ii. Shared neural networks then generate (Ai,γi)=ψself(gi)(A_i,\gamma_i)=\psi_{\mathrm{self}}(g_i) and (K~ij)=ψcouple([gi;gj;pij])(\widetilde{K}_{ij})=\psi_{\mathrm{couple}}([g_i;g_j;p_{ij}]). We use these outputs to define the operator blocks as:

Kii=12(Ai−AiT)−diag⁡(γi)(13)\mathcal{K}_{ii}=\frac{1}{2}\left(A_i-A_i^{\mathsf{T}}\right)-\operatorname{diag}(\gamma_i) \tag*{(13)}
Kij=12(K~ij−K~jiT)(14)\mathcal{K}_{ij}=\frac{1}{2}\left(\widetilde{K}_{ij}-\widetilde{K}_{ji}^{\mathsf{T}}\right) \tag*{(14)}

where γi\gamma_i is constrained to be positive and bounded. Because Kji=−KijT\mathcal{K}_{ji}=-\mathcal{K}_{ij}^{\mathsf{T}} and γi>0\gamma_i>0, the assembled operator satisfies K+KT=−2diag⁡(γ)\mathcal{K}+\mathcal{K}^{\mathsf{T}}=-2\operatorname{diag}(\gamma). Consequently, ∥eKt∥2≤e−γmin⁡t\lVert e^{\mathcal{K}t}\rVert_2\le e^{-\gamma_{\min}t}, where γmin⁡\gamma_{\min} is the smallest damping entry. This construction ensures stable latent evolution across grids. The full operator is assembled from {Kii}i\{\mathcal{K}_{ii}\}_i and {Kij}j∈Ni\{\mathcal{K}_{ij}\}_{j\in\mathcal{N}_i}, which governs the latent temporal evolution through z(t)=eKtz(0)z(t)=e^{\mathcal{K}t}z(0). Its dimension and structure adapt to each grid, while the neural modules generating its blocks are shared across grids.

  1. Projection: The projection stage maps the evolved latent coordinates back to component states:

HP=GT⁡P(H(0),{pij})(15)H^{\mathcal{P}}=\operatorname{GT}_{\mathcal{P}}\left(H^{(0)},\{p_{ij}\}\right) \tag*{(15)}
Ci=ψτ(i)(hiP)+Bτ(i)(16)C_i=\psi_{\tau(i)}(h_i^{\mathcal{P}})+B_{\tau(i)} \tag*{(16)}
ξ^i(t)=mi⊙Ci(zi(t)−zi(0))(17)\widehat{\xi}_i(t)=m_i\odot C_i\left(z_i(t)-z_i(0)\right) \tag*{(17)}

Here, for each component type τ\tau, a correction neural network ψτ(i)\psi_{\tau(i)} and a base matrix Bτ(i)B_{\tau(i)} are shared across grids. The output ξ^i(t)\widehat{\xi}_i(t) is the normalized state deviation. The final prediction of X(t)X(t) 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:

L=NMSE⁡B(X^r,i(tk)−Xr,i(tk))(18)\mathcal{L}=\operatorname{NMSE}_{\mathcal{B}}\left(\widehat{X}_{r,i}(t_k)-X_{r,i}(t_k)\right) \tag*{(18)}

This loss function is computed over all sampled time points and valid, in-service states in a mini-batch B\mathcal{B}.

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.

SystemConfig.BusesSG¹Exc.Gov.PSS
4-SG Two-Area(i) Base130/0/44/044
(ii) Mixed-SG132/0/22/022
10-SG New England (NE)(i) Base390/10/00/9100
(ii) Mixed-SG394/6/00/500
(iii) Mod.-Control390/10/00/900
16-SG NE–NYPS(i) Base680/0/1616/0012
(ii) Mixed-SG686/0/1010/007
(iii) Mixed-Exc.680/0/168/806
26-SG Composite(i) Mixed-SG1074/10/1212/909
48-SG NPCC²(i) Base14021/27/00/2400

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 D=128D = 128, latent dimension dz=8d_z = 8 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 N=23N = 23–163 components, giving latent operators with dimensions from 184×184184 \times184 to 1304×13041304 \times1304.

As shown in Figure 2, the pretraining NMSE decreases from 0.85 to 6.4×10−36.4 \times10^{-3}, while validation NMSE also consistently decreases across all nine grids. After pretraining, median test NMSE ranges from 7×10−47 \times10^{-4} to 0.010 across these grids.

Training and validation NMSE during pretraining

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.

Prediction accuracy of the DynGridFM model on testing trajectories

Figure 3. Prediction accuracy of the DynGridFM model on the testing set of pretraining grids, compared with PST. VV and θ\theta denote bus voltage magnitude and phase angle; δ\delta and EfdE_{fd} 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.

Prediction accuracy plots for DynGridFM on the held-out NPCC test set

Figure 4. Prediction accuracy of DynGridFM on the held-out NPCC test set after fine-tuning, compared with PST. Eq′E^{\prime}_{q} denotes the generator qq-axis transient internal voltage.

Median test NMSE versus number of training trajectories

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×.

GridPST (s)DynGridFM (ms)Speed-up
4-SG Two-Area3.642.961,232×
10-SG NE3.172.991,063×
16-SG NE–NYPS3.593.161,136×
26-SG Composite4.243.731,137×
48-SG NPCC5.015.42924×

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. [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. [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. [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. [4]P. Kundur and O. P. Malik, Power system stability and control, vol. 7. McGraw-Hill New York, 1994.
  5. [5]S. L. Brunton, J. N. Kutz, et al., “Data-driven science and engineering,” Machine learning, dynamical systems, and control, p. 2019, 2019.
  6. [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. [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. [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.

Paper details

vlnc:W_zxvndpty
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 17

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Engineering

Not recorded for this paper

View statement
Looking for related papers…
Contents