betaFeedback

WorksEngineering

Towards Efficient Edge AI for Power Flow in Renewable-Rich Grids with Volt/VAR Control

Abstract

AI models of the power grid must capture how wind and solar plants support the voltage, adjusting their reactive power to the local voltage along a grid-code Q(V) characteristic. This research examines whether grid foundation models, fast neural network models for power-flow analysis, can represent this behaviour. We introduce the Q(V) bus, a new bus type for the open-source GridFM GraphKit, whose physics decoder evaluates the reactive injection from the plant characteristic at the predicted voltage in every correction step. Training data comprise 7882 hourly operating points of a modified IEEE 118-bus system, matched to Energinet DK1/DK2 measurements and solved with pandapower. Compared with a physics-informed baseline that represents the parks as negative load, the Q(V) bus lowers the voltage-magnitude RMSE 2.3-fold, reduces the power-balance mismatch at the parks from 25 to 0.66 MVA, and raises the F1 score for voltage-band violations from 0.40 to 0.76. An ablation over five configurations shows that the Q(V) bus type provides the accuracy and the physics loss provides the power balance. For edge monitoring, we distil the trained 2.0×1072.0\times10^{7}-parameter model into students of 6×1056\times10^{5} and 1.3×1061.3\times10^{6} parameters; a flat-start initialisation prevents their collapse into an incorrect low-voltage state in which the characteristic saturates. With output distillation, the 12-step student reaches 1.4 times the teacher's error and, for edge inference on an NVIDIA Jetson Orin Nano (15 W), solves an hourly scenario in 12.2 ms, within the 20 ms synchrophasor interval.

*Corresponding author(s). E-mail(s): link text; link text; Contributing authors: link text;

keywords: Grid foundation model; Volt/VAR control; Physics informed NN; Knowledge distillation; Edge AI; Power flow; Renewable energy

Introduction

Converter-interfaced wind and solar plants now supply a large share of the electricity in systems such as the Danish grid, and they also take part in voltage control. Grid codes require these plants to adjust their reactive power to the local voltage according to a volt/VAR, or Q(V)Q(V), characteristic [1, 2, 3]. A power-flow (PF) model of such a grid must therefore treat the reactive power of a renewable plant as a function of its own voltage, not as a fixed value.

Graph neural networks are a natural representation of a power grid [4], and grid foundation models (GridFMs) extend this idea to graph transformers pretrained on a masked PF objective with a Kirchhoff physics loss [5, 6]. While implementing two gaps remain for renewable-rich grids. First, the bus types in GridFM follow the classical PQ, PV and slack convention, so a Q(V)Q(V)-controlled plant can only be represented as a PQ bus, whose reactive power is either given, although it is unknown in operation, or masked. Second, the models are sized for data-centre inference, whereas monitoring of low-inertia grids increasingly asks for inference next to the measurement, within one synchrophasor reporting frame of 20–100 ms [7, 8, 9]. In earlier work we compressed a GridFM by knowledge distillation (KD) into a 32.5×32.5\times smaller student for an NVIDIA Jetson device and found that output matching carried most of the gain [10]; that study used only the classical bus types.

This paper addresses both gaps. We add a Q(V)Q(V) bus type to GridFM, train it on hourly Danish system data, and compress it into small students for edge inference. The contributions are:

  • An element-aware Q(V)Q(V) bus type for GridFM, in which the reactive power of a park follows its Q(V)Q(V) characteristic at the predicted voltage, and an ablation over five teacher configurations showing that the Q(V)Q(V) bus type provides the accuracy and the physics loss the power balance, which requires the correct reactive reference that the characteristic supplies at the parks.

  • A dataset of 7 882 hourly scenarios built from measured Danish consumption and production (Energinet, DK1/DK2, October 2025 to September 2026) on a modified IEEE 118-bus grid with 32 Q(V)Q(V)-controlled parks, solved with pandapower [11] and written in the GridFM DataKit format [6].

  • Students of the Q(V)Q(V) model (0.6 M and 1.3 M parameters): a flat-start initialisation for reliable training, an evaluation of output and trajectory distillation, and a latency and throughput evaluation on an NVIDIA Jetson Orin Nano against a Newton–Raphson solver with Q(V)Q(V) control.

Section § 2 reviews related work, § 3 describes the grid, data and models, § 4 presents the teacher, student and edge-inference results, § 5 discusses their implications and limitations, and § 6 concludes.

Related work

Learning-based power flow and grid foundation models.

The first graph neural solver for AC PF was trained by minimising the Kirchhoff violation directly [12]; physics-guided variants followed for PF [13], state estimation [14] and optimal power flow [15]. Message-passing surrogates such as PowerFlowNet report speed-ups of 4–48× over Newton–Raphson [16], while generalisation across topologies remains open [17]. GridFMs address this by pretraining on many topologies and operating points [5, 6]; their power-flow model keeps the graph-neural-solver idea of refining the state over several correction steps with physics residuals. These models use the classical bus types; to our knowledge, none represents voltage-dependent reactive control of renewable plants as a bus type of its own.

Volt/VAR control of renewable plants.

IEEE Std 1547-2018 defines volt/VAR functions for distributed resources, in which the reactive power follows a piecewise-linear function of the local voltage, saturating at the reactive limits outside a voltage band [3]; transmission-connected plants follow similar characteristics set by the national grid codes [1, 2]. In conventional PF tools such characteristics are handled by an outer loop around the Newton–Raphson iteration [11]. A learned PF model has to include the characteristic in its prediction to learn from, which changes both the masking (what is known and unknown at a bus) and the physics loss.

Knowledge distillation and compact models for the edge.

KD trains a small student to reproduce a larger teacher through its outputs, intermediate states or attention maps [18, 19, 20], and has been extended to graph networks [21]. Student accuracy and fidelity to the teacher are known to diverge [22]. Edge intelligence for power systems is an active field [9], and for graph networks the number of message-passing layers dominates the latency on embedded devices [23]. Our earlier study distilled a GridFM into a half-depth student on a renewable IEEE 118-bus benchmark and measured it on a Jetson device [10]; it used only the classical bus types.

Grid, data and models

DK118 grid and Energinet scenarios

We use a modified IEEE 118-bus grid onto which hourly Energinet measurements of consumption and of wind, solar and conventional production in the Danish bidding zones DK1 and DK2 are mapped [24]. The 118 buses are split into two connected areas of 59 buses, a synthetic representation of DK1 and DK2, and all active-power quantities are scaled by one common factor that maps the largest measured Danish gross consumption to the nominal IEEE 118-bus demand of 4 242 MW. The 54 generator buses of the IEEE case are assigned to technologies in the proportions of the Danish transmission system, which has a high renewable share: 32 wind and solar power park modules (hereafter parks) are modelled as Q(V)Q(V) buses, and 20 synchronous units and 2 synchronous condensers as PV buses (Table 1), with larger units placed on more strongly connected buses. Wind and solar parks are listed separately in Table 1 because they follow different production profiles; however ,while in data generation and learning models they are treated alike as parks in Q(V)Q(V) control. In every hour, the wind and solar production of each zone equals its scaled Energinet value and is shared among the parks of that zone. Most units are connected at 138 kV; four parks are connected to the 345 kV network.

Unit typeDK1DK2
Wind, Q(V)Q(V)1, 4, 6, 8, 12, 18, 19, 34, 36, 46, 49, 61, 6525, 73, 80, 87, 89, 100, 111
Solar, Q(V)Q(V)10, 15, 26, 40, 42, 54, 5924, 27, 31, 32, 103
Synchronous, PV55, 56, 62, 66691, 70, 72, 74, 76, 77, 85, 90, 91, 92, 99, 104, 105, 107, 110, 112
Condensers, PV–113, 116

Table 1. Renewable-dominated generation fleet placed on the IEEE 118-bus grid (IEEE bus numbers)

Each hourly scenario is solved with pandapower [11], which serves as ground truth. The lines, transformers and shunts of the IEEE case are converted with pandapower’s MATPOWER converter,and the scaled loads and injections are added for every hour: synchronous units as voltage-controlled generators with reactive limits, the slack unit as an external grid, HVDC exchanges as fixed injections, and wind and solar parks as static generators whose reactive power follows their Q(V)Q(V) characteristic. Because pandapower’s built-in Q(V)Q(V) controller, a damped fixed-point loop, diverges for these steep characteristics, the park injections are instead updated by a Newton step around pandapower’s power flow; synchronous units switch between PV and PQ at their reactive limits in both directions, and the zonal AC losses are kept within the measured consumption. Voltage set-points and the centres of the Q(V)Q(V) characteristics are initially set by a loss-minimising optimal power flow over training days only. The period from 7 October 2025 to 1 September 2026 (330 days) gives 7 898 complete hours, of which 16 do not converge and are excluded, leaving 7 882 scenarios in the GridFM DataKit format [6, 25]. The scenarios are split by whole days, assigned at random, into training, validation and test sets (230/50/50 days, about 70/15/15 %), with 5 489, 1 197 and 1 196 hours.

The Q(V) bus: an element-aware bus type

In the masked PF task of GridFM, the unknown quantities at a bus depend on its type: PQ buses predict (Vm,Va)(V_m,V_a), PV buses predict (Va,Qg)(V_a,Q_g) and the slack bus predicts (Pg,Qg,Vm)(P_g,Q_g,V_m) [5, 26]. A PQ bus is normally a load bus, and a unit with a fixed output can be represented on it as an opposite injection. Starting with this, we design a baseline models that represents each renewable park in this way: its known active power enters as negative load. Its reactive power, however, is unknown in operation under Q(V) control and is therefore masked; the existing GridFM decoder then sets it to zero (§ 3.3).

The proposed model, GridFM-Q(V), The proposed model, GridFM-Q(V), keeps the architecture and training procedure of GridFM as base with modifications making each bus aware of the element connected to it. It adds a fourth bus type, the Q(V) bus: At a Q(V) bus, the active power is known and (Vm,Va)(V_m, V_a) are predicted; the reactive power is not an input but follows from the characteristic, Qg=q(Vm)Q_g = q(V_m). In existing architecture, the park’s PQ flag is cleared, an indicator marks it as Q(V), and its active power is given as generation. In addition, the physics decoder evaluates the park’s reactive power from its Q(V) characteristic at the predicted voltage in every correction step, while the network itself receives only the indicator; the curve parameters come from the case data.

Each park follows the same Q(V) characteristic, shifted to its own curve centre V0V_0 (Figure 1). With breakpoints (v1,v2,v3,v4)=V0+(−0.06,−0.01,+0.01,+0.06) pu(v_1, v_2, v_3, v_4) = V_0 + (-0.06, -0.01, +0.01, +0.06)\,\mathrm{pu},

Figure 1. Q(V) characteristic normalised by rated power PnP_n. Solid: V0=1.00V_0 = 1.00 pu with breakpoints v1v_1–v4v_4 and dead band (shaded). Dashed: V0=0.95V_0 = 0.95 and 1.051.05 pu, the range of curve centres in the data.

Qg=q(Vm)=Qmax⁡clip⁡(v2−Vmv2−v1)+Qmin⁡clip⁡(Vm−v3v4−v3),(1)Q_g = q(V_m) = Q_{\max}\operatorname{clip}\left(\frac{v_2 - V_m}{v_2 - v_1}\right) + Q_{\min}\operatorname{clip}\left(\frac{V_m - v_3}{v_4 - v_3}\right), \tag*{(1)}
clip⁡(x)=min⁡(1,max⁡(0,x)),\operatorname{clip}(x) = \min(1,\max(0,x)),

so the park injects reactive power below a dead band of ±0.01\pm0.01 pu around V0V_0, absorbs above it, and saturates at its limits. Here Qmax⁡=−Qmin⁡=0.33 PnQ_{\max} = -Q_{\min} = 0.33\,P_n, with PnP_n the rated power of the park, and V0V_0 is fixed per park between 0.95 and 1.05 pu by the voltage schedule (§ 3.1). These settings lie within the NC RfG voltage control requirements for power park modules [1, 2]; the breakpoints themselves are a study assumption.

GridFM-Q(V) thus differs from existing GridFM in two respects: the Q(V) bus type, with the characteristic in the physics decoder, and the physics loss evaluated with this characteristic. An ablation study separates their effects; it defines the teacher configurations of § 3.3, and its results are analysed in § 4.

Teacher models and ablation design

The teacher is a heterogeneous GridFM graph transformer with 12 message-passing steps, hidden size 48 and 8 attention heads (20.1 M parameters), trained with GridFM GraphKit. The loss combines the masked mean-squared error of weight 0.9 with the nodal power-balance residual of weight 0.1; the physics term weights step kk of an LL-step model by 0.5L−k0.5^{L-k}. Five configurations, each trained with three seeds, form the ablation study (Table 2).

ConfigurationBus-type awarePark QgQ_g in the correction stepsPhysics loss at park buses
GridFM-Base1nofrom the nodal balancePP only
GridFM-Base2noQg=0Q_g = 0PP and QQ
GridFM-Q(V)yesQg=q(Vm)Q_g = q(V_m)PP and QQ
GridFM-MSEnoQg=0Q_g = 0none
GridFM-Q(V)-MSEyesQg=q(Vm)Q_g = q(V_m)none

Table 2. Teacher configurations (three seeds each). Park QgQ_g in the correction steps: reactive power of the parks used in the power-balance residual that the model computes in every step; physics loss: the part of this residual included in the training loss

In GridFM-Base1 and GridFM-Base2, each park is treated as an ordinary PQ bus, with its active power as negative load and its reactive power masked. Since a physics residual is only meaningful for known injections, GridFM-Base1 retains only the active-power residual at the park buses, as GridFM does for the unknown reactive power of PV buses. GridFM-Base2 is the existing GridFM without modification, which evaluates the residual for both active and reactive power with the masked park reactive power set to zero; it is kept as the reference that a direct application of GridFM would give. The proposed GridFM-Q(V) uses the Q(V) bus and evaluates the park’s reactive power with Eq. (1) in the residual. GridFM-MSE and GridFM-Q(V)-MSE are the corresponding models trained without any of the physics loss for baseline and proposed models respectively.

All teachers are trained for 200 epochs with AdamW (learning rate 5×10−45 \times10^{-4}, batch size 64), a linear warm-up over five epochs and cosine decay to 10−610^{-6}, keeping the weights with the lowest validation loss. In a preliminary comparison, a reduce-on-plateau schedule (200 and 400 epochs) lowered the learning rate prematurely and was therefore not used.

Student models and distillation

Students keep the teacher’s input interface and loss, with hidden size 24 and 4 attention heads (96 numbers per bus per step, against 384 for the teacher). We use a 6-step student (0.62M parameters, 32.5× smaller) and a 12-step student (1.31M parameters, 15.3× smaller). Following our earlier finding that the output term carries nearly all of the distillation gain [10], students are trained without KD, with output distillation, in which the teacher’s predictions act as a second label next to the pandapower solution, or with output plus trajectory distillation. We set λout=0.75\lambda_{\mathrm{out}} = 0.75 and add this weighted output-distillation term to the supervised and physics losses. The teacher’s parameters remain frozen during student training. Base1 students of the same sizes are trained with and without output KD from the GridFM-Base1 teacher as a reference.

Specifically, the training objective is

Ltotal=LGraphKit+λoutLout+λtrajLtraj.(2)\mathcal{L}_{\mathrm{total}} = \mathcal{L}_{\mathrm{GraphKit}} + \lambda_{\mathrm{out}}\mathcal{L}_{\mathrm{out}} + \lambda_{\mathrm{traj}}\mathcal{L}_{\mathrm{traj}}. \tag*{(2)}

where LGraphKit=0.9Lsup+0.1Lphys\mathcal{L}_{\mathrm{GraphKit}} = 0.9\mathcal{L}_{\mathrm{sup}} + 0.1\mathcal{L}_{\mathrm{phys}} combines the supervised voltage loss against the pandapower solution with the physics loss over the correction steps. The output-distillation term is

Lout=12[1∣Mb∣∑(i,d)∈Mb(y^S,i,db−y^T,i,db)2+1∣Mg∣∑j∈Mg(y^S,jg−y^T,jg)2].(3)\mathcal{L}_{\mathrm{out}} = \frac{1}{2}\left[\frac{1}{\lvert\mathcal{M}_{b}\rvert}\sum_{(i,d)\in\mathcal{M}_{b}}\left(\hat{y}^{b}_{S,i,d}-\hat{y}^{b}_{T,i,d}\right)^{2}+\frac{1}{\lvert\mathcal{M}_{g}\rvert}\sum_{j\in\mathcal{M}_{g}}\left(\hat{y}^{g}_{S,j}-\hat{y}^{g}_{T,j}\right)^{2}\right]. \tag*{(3)}

Here, SS and TT denote the student and teacher, respectively. The set Mb\mathcal{M}_{b} contains the masked voltage-magnitude and angle entries, and Mg\mathcal{M}_{g} contains the masked generator active-power entries in the minibatch. The predictions y^\hat{y} use the training normalisation. The factor 1/21/2 averages the bus and generator matching losses.

All final students use flat-start initialisation: the weights of the voltage-magnitude output row are initialised to zero and its bias to 1 pu. These parameters remain trainable.

We compare no KD, output KD, and output plus trajectory KD, with (λout,λtraj)(\lambda_{\mathrm{out}},\lambda_{\mathrm{traj}}) equal to (0,0)(0,0), (0.75,0)(0.75,0) and (0.75,0.75)(0.75,0.75), respectively. The trajectory loss is the mean masked MSE of voltage magnitude and angle across all student correction steps, including the final step. Student step kk matches teacher step m(k)=round⁡(kLT/LS)m(k) = \operatorname{round}(kL_T/L_S), where LT=12L_T = 12 and LSL_S is the student depth. Thus six-step students match teacher steps 2, 4, 6, 8, 10 and 12; twelve-step students match corresponding steps. The teacher remains frozen and the exact Q(V)Q(V) curve is retained.

Evaluation metrics

All models are evaluated on the 1 196 test hours and reported as mean ±\pm standard deviation over three seeds. Accuracy is the root-mean-square error (RMSE) of the quantities that are unknown at each bus type: VmV_m and VaV_a at PQ and Q(V) buses, VaV_a at PV buses and VmV_m at the reference bus. The unknown generator injections follow from the predicted voltages through the power balance or the Q(V) characteristic and are not scored separately. Whether the predicted voltages satisfy the power-flow equations is measured by the power-balance mismatch (PBE), the mean nodal apparent-power mismatch of the predicted voltages over the known injections: active power at all buses except the reference bus, reactive power at PQ buses and q(Vm)q(V_m) at Q(V) buses. The PBE uses the true device behaviour for every model, so no model is judged by its own decoder. The operational value is measured by the precision, recall and F1 score of detecting buses outside the 0.98–1.04 pu operating band. As a no-skill reference, each bus’s VmV_m and VaV_a are predicted by their mean over the training hours.

Results

Teacher models: voltage accuracy and power balance

The teacher comparison tests the central hypothesis of this work: that representing renewable parks by their Q(V) control behaviour, rather than as negative load, yields voltages that are both more accurate and consistent with the power-flow equations. GridFM-Q(V) confirms this (Figure 2): it reaches a voltage-magnitude RMSE of 0.0029 pu at PQ buses and 0.0023 pu at the parks, closes the power balance at the parks to 0.66 MVA and predicts their reactive power with an RMSE of 1.9 Mvar. Its errors are low across the grid (Figure 3) and concentrated in few hours: its RMSE is 2.6 times its mean absolute error, against 1.4–1.7 for the other teachers, and the largest deviations, up to 0.07 pu, occur in the hours with the heaviest load and the lowest voltages, which are rare in the training data. Over all buses where it is unknown, its voltage-magnitude RMSE is 0.0028 pu, 2.3 times lower than that of GridFM-Base1 (0.0065 pu).

Test errors of the teachers by bus type

Figure 2. Test errors of the teachers by bus type: RMSE of VmV_m and VaV_a and mean PBE (1 196 test hours, mean ± standard deviation over three seeds). Each quantity is evaluated only where it is unknown; the PBE is evaluated for the known injections. Shading: error relative to the lowest error in each column, including the training-mean reference (darker = larger).

Voltage-magnitude RMSE per bus on the grid layout for GridFM-Base1, GridFM-Base2, and GridFM-Q(V)

Figure 3. Voltage-magnitude RMSE per bus on the grid layout over the test hours, averaged over three seeds. PV buses (grey) have a known voltage magnitude and are not evaluated.

GridFM-Base1, which keeps the parks as negative load but restricts the physics residual to the known injections, is the stronger of the two physics-informed baselines. It gives more accurate angles than GridFM-Q(V) (RMSE 0.5–0.8°, against 0.6–1.3°), but its voltage-magnitude RMSE is 2.0 times higher at PQ buses (0.0058 pu) and 3.4 times higher at the parks (0.0078 pu), where it remains above the training mean (0.0066 pu). At PQ and PV buses, both models satisfy the power balance closely (0.4–0.6 MVA), but at the parks that of GridFM-Base1 is violated by 25 MVA and their reactive power is off by 30 Mvar: without an equation for the park’s reactive power, the predicted voltages are consistent with some reactive injection, but not with the Q(V) characteristic. Eq. (1) supplies this missing equation. For both models, the voltage of the reference bus, released when the slack unit reaches its reactive limit, lies above the training mean (0.0059 and 0.0064 pu against 0.0034 pu); for GridFM-Q(V) it is the largest voltage error

The existing GridFM residual (GridFM-Base2) additionally checks the reactive balance at the parks against Qg=0Q_g = 0. This incorrect reference raises the voltage-magnitude RMSE 4.5 to 7.5 times relative to GridFM-Base1, above the training mean at every bus type, while the angles change much less: it distorts the reactive power-voltage relation, most strongly around the 345 kV parks in DK1 (Figure 3).

The voltage errors translate directly into operational value (Table 3). GridFM-Base2 raises mostly false band-violation alarms (precision 0.07), as its biased voltages move compliant buses out of the band, whereas GridFM-Base1 detects only 28 % of the violations. GridFM-Q(V) combines a precision of 0.94 with a recall of 0.64 (F1 0.76): its alarms can be trusted, and it finds more than twice as many violations as GridFM-Base1.

ModelPrecisionRecallF1
Training mean0.850.200.33
GridFM-Base20.07±0.010.07 \pm0.010.58±0.050.58 \pm0.050.13±0.010.13 \pm0.01
GridFM-Base10.69±0.150.69 \pm0.150.28±0.010.28 \pm0.010.40±0.030.40 \pm0.03
GridFM-Q(V)0.94±0.010.94 \pm0.010.64±0.040.64 \pm0.040.76±0.030.76 \pm0.03

Table 3. Detection of buses outside the 0.98–1.04 pu band on the test set (5 038 violations; mean ± standard deviation over three seeds)

Student Models and Distillation

The students test whether the accuracy of GridFM-Q(V) can be retained in a model small enough for edge deployment, and whether knowledge distillation helps. All students have hidden size 24 and 4 heads, with 12 steps (1.3 M parameters) or 6 steps (0.6 M), against 20.1 M for the teacher.

StudentNo KDOutput KDOutput + trajectory KD
Q(V), 12 steps (1.3M)0.0045±0.00040.0045 \pm0.00040.0040±0.00090.0040 \pm0.00090.0037±0.00060.0037 \pm0.0006
Q(V), 6 steps (0.6M)0.0054±0.00010.0054 \pm0.00010.0057±0.00020.0057 \pm0.00020.0061±0.00040.0061 \pm0.0004
Base1, 12 steps (1.3M)0.0090±0.00020.0090 \pm0.00020.0090±0.00110.0090 \pm0.0011—
Base1, 6 steps (0.6M)0.0114±0.00060.0114 \pm0.00060.0104±0.00090.0104 \pm0.0009—

Table 4. Voltage-magnitude RMSE (pu) over unknown outputs for Q(V) and Base1 students on the test set. Values are mean ± standard deviation over three seeds. All students use flat-start initialisation. The corresponding teacher RMSEs are 0.002795 pu for Q(V) and 0.006487 pu for Base1. Dashes indicate variants that were not evaluated.

At twelve steps, output KD reduces mean voltage-magnitude RMSE by 10.6 % and mean PBE from 0.835 to 0.658 MVA compared with no KD. Angle error improves in all three matched seeds, while voltage-magnitude error improves in two. Adding trajectory KD further lowers mean voltage-magnitude RMSE to 0.003718 pu, but increases mean PBE to 0.754 MVA and angle RMSE from 1.065 to 1.207 degrees.

At six steps, neither KD variant improves mean voltage-magnitude error or PBE, although both reduce mean angle error. The benefit of distillation therefore depends on student depth. The best twelve-step voltage result remains about 1.3 times the teacher’s error, at 15.3 times fewer parameters.

The effect of output KD differs between the two model families. For twelve-step Base1 students, mean voltage-magnitude RMSE remains approximately 0.0090 pu, while its standard deviation across seeds increases from 0.0002 to 0.0011 pu. Mean PBE nevertheless decreases from 12.074 to 11.421 MVA. The Q(V) students retain lower absolute voltage-magnitude and balance errors, although their advantage is also present without KD. Comparing the three-seed mean RMSEs, the twelve-step output-KD student has 42.6 % higher voltage-magnitude error than its teacher for Q(V), compared with 39.3 % for Base1. Thus the more accurate Q(V)Q(V) student still has a larger relative gap to its stronger teacher. At six steps, output KD reduces Base1’s voltage-magnitude RMSE by 8.5 %, whereas it increases the Q(V)Q(V) student’s error by 5.5 %. Both families improve their mean angle accuracy at this depth. Table 5 compares the angle and power-balance errors across student depths and distillation settings.

StudentTrainingAngle RMSE (°)Mean PBE (MVA)
Q(V)Q(V), 12 stepsNo KD1.298 ± 0.0540.835 ± 0.163
Q(V)Q(V), 12 stepsOutput KD1.065 ± 0.0990.658 ± 0.202
Q(V)Q(V), 12 stepsOutput + trajectory KD1.207 ± 0.4680.754 ± 0.276
Q(V)Q(V), 6 stepsNo KD1.633 ± 0.0521.715 ± 0.125
Q(V)Q(V), 6 stepsOutput KD1.465 ± 0.0481.763 ± 0.060
Q(V)Q(V), 6 stepsOutput + trajectory KD1.503 ± 0.0511.790 ± 0.172
Base1, 12 stepsNo KD0.957 ± 0.16512.074 ± 0.515
Base1, 12 stepsOutput KD0.921 ± 0.37511.421 ± 1.430
Base1, 6 stepsNo KD1.486 ± 0.26112.242 ± 0.847
Base1, 6 stepsOutput KD1.277 ± 0.25711.946 ± 0.498

Table 5. Student voltage-angle RMSE and mean PBE on the test set, reported as mean ± standard deviation over three seeds.

Edge inference

The models were deployed on an NVIDIA Jetson Orin Nano Developer Kit, a 15 W embedded module that combines a six-core Arm CPU with an integrated Ampere GPU (1 024 CUDA cores, 32 Tensor Cores) and 8 GB of memory shared by both. The module ran in its 15 W power mode with fixed clocks (CPU 1.5 GHz, GPU 625 MHz; JetPack 5.1.3, PyTorch 2.1.0, CUDA 11.4), and the desktop environment was stopped during all measurements, since screen redraws share the integrated GPU. Each hourly scenario is one power-flow problem, so latency is measured at batch size one, as in online monitoring, over all 1 196 test scenarios after 50 warm-up runs; throughput is measured with batches of up to 128 scenarios. One trained seed of each model is deployed in float32 and reproduces its stored test predictions to within 2×10−62 \times10^{-6} pu.

At batch size one, a forward pass consists of about 200 small GPU kernels per correction step. In standard execution, the CPU launches each kernel separately, and this kernel-launch overhead would dominate the run time. We therefore employ a CUDA graph: the complete forward pass, including the Q(V)Q(V) physics step, is recorded once and replayed for every scenario with a single launch, and the inputs of the scenario reach the GPU in one host-to-device copy. This aligns with the normal power-flow operation considered here: the branch projections are computed once, while the bus types, setpoints, loads, injections and Q(V)Q(V) parameters are copied in per scenario. The timed region contains the copy and one replay.

The classical reference is a Newton–Raphson power flow with each park’s q(Vm)q(V_m) in the mismatch and its slope in the Jacobian, built on pandapower’s Jacobian routines. It receives the same inputs as the models, runs from a flat start (Vm=1V_m = 1 pu, Va=0V_a = 0) and from the solution of the preceding hourly scenario (warm start), and agrees with the dataset to within 3×10−83 \times10^{-8} pu. The solve is timed on one CPU core; the six-core run serves as a throughput reference.

Latency and throughput.

On the Jetson, the 12-step student solves a scenario in 12.2 ms and the 6-step student in 6.2 ms, 2.6 and 5.1 times faster than the Q(V) Newton–Raphson solver at the median and also faster than its warm start (Table 6). The teacher (24.6 ms) is faster than the flat start but slower than the warm start, and exceeds the 20 ms reporting interval of a 50 Hz synchrophasor stream. The latency of the models is deterministic (99th percentile within 0.5 % of the median), whereas the varying iteration count of Newton–Raphson (4.5 on average, up to 7) places its 99th percentile 50 % above its median. In batches, the 12-step student processes 355 scenarios per second, 2.3 times as many as Newton–Raphson on all six cores, while the teacher (73 scenarios/s) stays below it. Latency follows the number of correction steps rather than the number of parameters: halving the steps halves the student’s latency, and the teacher, four times wider than the 12-step student with the same number of GPU operations, is twice as slow. Since the deployed models run in float32, their accuracy is that of § 4.2; the 12-step student, with 1.4 times the teacher’s voltage error, is therefore the edge model of choice, whereas the 6-step student detects too few band violations for monitoring. We acknowledge that in a trial run on a workstation CPU (AMD Ryzen Threadripper PRO 7955WX, 16 cores), Newton–Raphson solved a scenario nearly twice as fast as the 12-step student on the Jetson. However, this work focuses on energy-efficient inference at the edge, and the workstation solver required about 2.6 times the energy per solution of the 12-step student on the Jetson.

MethodMeanMedianp99Speed-upThroughput
Teacher, 12 steps (20.1 M)24.5924.5924.641.473
Student, 12 steps (1.3 M)12.1812.1812.212.9355
Student, 6 steps (0.6 M)6.166.166.195.6710
Q(V) NR, flat start34.7731.2246.821.029
Q(V) NR, warm start24.3423.3131.181.441
Q(V) NR, 6 CPU cores––––152

Table 6. Latency per scenario on the Jetson Orin Nano (float32, batch size one, 1 196 test scenarios) and best throughput in scenarios per second. NR: Newton–Raphson. Speed-up: mean latency of the Q(V) NR solver from a flat start divided by that of the method. Throughput of the models at batch size 128; classical solvers on one CPU core, except the last row. Latency (ms).

Discussion

Bus type and physics loss.

The study examines the suitability of a physics loss and how it improves the power balance of a learned power-flow model. With existing bus representation of a park as a PQ bus with Qg=0Q_g = 0, a reactive injection the park does not produce, and this wrong reference degrades the voltages (Sect. 4.1) as in GridFM-Base2. Leaving QgQ_g free, as in GridFM-Base1, removes the error but treats the park as an unconstrained reactive source: its reactive power follows from the nodal balance as at a PV bus, only the active-power equation remains, and the voltage magnitude at the park is determined by the data alone. Under Q(V) control, the reactive power of a park is neither fixed, as at a PQ bus, nor unconstrained, as at a PV bus; in steady state, the plant controller sets it from the local voltage within its reactive limits. The Q(V) characteristic therefore defines the reactive power of the park through its control law, which the numerical power flow used to generate the data also enforces, and provides the reactive-power equation at the park bus.

Table 7 separates the contributions of the bus type and the physics loss. The Q(V) bus type gives the lowest voltage-magnitude errors of all teachers, with and without the physics loss (0.0023 pu without and 0.0028 pu with the physics loss, against 0.0050 and 0.0065 pu for the PQ representation), and the highest F1 scores. Without the physics loss, however, the predicted voltages leave a power-balance mismatch of 15 MVA on average and 19 MVA at the parks. The physics loss reduces this mismatch to below 1 MVA at a slightly higher voltage-magnitude RMSE, so that GridFM-Q(V) is the only model that combines a low voltage error with a satisfied power balance among the studied ones.

ModelPark busPhysics lossVmV_mVaV_aΔVa\Delta V_aAllParksF1
GridFM-MSEPQno0.00500.760.5235420.43
GridFM-Base1PQyes0.00650.720.137.1250.40
GridFM-Q(V)-MSEQ(V)no0.00230.350.2215190.73
GridFM-Q(V)Q(V)yes0.00281.120.170.610.660.76

Table 7. Ablation of park representation and physics loss (test set, mean over three seeds). RMSE of VmV_m (pu) and VaV_a (∘^\circ) over all buses where they are unknown, and of the angle difference across the branches, ΔVa\Delta V_a (∘^\circ); PBE: mean power-balance mismatch (MVA) over all buses and at the parks.

Voltage angle.

As we reviewed the result, the voltage angle error of GridFM-Q(V) have different indication. Its voltage angles are less accurate than those of GridFM-Q(V)-MSE and GridFM-Base1 (RMSE 1.12° against 0.35 and 0.72°, and 0.7-1.5° across seeds), but the angle differences across the branches, which set the active-power flows, at least as accurate as without the physics loss (0.17 against 0.22°). The error therefore lies in the angles relative to the reference bus and does not affect the flows or the power balance. Its cause requires further investigation.

Student models -Distillation.

The benefit of distillation depends on student depth and on the quantity being predicted. For the twelve-step Q(V)Q(V) student, output KD improves mean voltage-magnitude, angle and power-balance errors. For the six-step Q(V)Q(V) student, it reduces angle RMSE from 1.633 to 1.465 degrees, but increases voltage-magnitude RMSE from 0.005427 to 0.005726 pu. Mean PBE also increases slightly, from 1.715 to 1.763 MVA. These results show that the tested distillation loss does not improve every output of the smaller PF model; they do not establish that it has reached a capacity limit.

Trajectory KD gives a further voltage-magnitude improvement only for the twelve-step Q(V)Q(V) student. Relative to output KD, it reduces mean voltage-magnitude RMSE by 6.7 %, but increases angle RMSE from 1.065 to 1.207 degrees and mean PBE from 0.658 to 0.754 MVA. It also increases voltage-magnitude error at six steps. The extra trajectory term therefore changes the balance between the evaluated quantities, rather than providing a consistent improvement across them. Its benefit in these experiments is the lower mean voltage-magnitude error of the twelve-step student.

PBE can be evaluated from the predicted state, known injections, and the supplied network and device models without a reference PF solution. It therefore provides an online check of the power balance during inference. Its use to trigger a numerical-solver fallback was not evaluated in this study.

Student depth.

Each GridFM correction step combines attention-weighted message passing over the graph connections with voltage prediction and power-balance residual feedback. Attention weights messages from connected neighbours. Additional steps therefore allow information from more distant nodes to influence the predictions and provide further stages of refinement. For Q(V)Q(V) students with output KD, increasing depth from six to twelve steps reduces mean voltage-magnitude RMSE by 30.4 %, angle RMSE by 27.3 % and mean PBE by 62.7 %; operating-band F1 increases from 0.224 to 0.532. However, parameter count also increases from 0.62M to 1.31M, so this comparison does not isolate information propagation from additional model capacity. The final students have the same hidden size and number of heads, and therefore do not establish the effect of width. Additional steps increase sequential computation; their latency cost is measured in § 4.3.

Performance across the network.

The Q(V)Q(V) voltage-magnitude advantage extends beyond the renewable parks, but is larger at the RE buses. For twelve-step output-KD students, mean voltage-magnitude RMSE at RE buses decreases from 0.010696 pu for Basel to 0.003017 pu for Q(V)Q(V). At non-RE buses, it decreases from 0.008205 to 0.004345 pu. The ordering between the two bus groups also reverses: Basel has larger voltage errors at RE buses than elsewhere, whereas Q(V)Q(V) has smaller errors there. The balance improvement is concentrated at the parks, where mean PBE is 40.368 MVA for Basel and 0.711 MVA for Q(V)Q(V). At the other eligible buses, Base1 has the lower mean PBE, 0.524 versus 0.638 MVA. Both models have larger mean PBE at RE buses than elsewhere, but this comparison does not establish the cause of that difference.

Operating-band detection.

At twelve steps, the Q(V)Q(V) students retain higher operating-band F1 than their Base1 counterparts, but remain below the Q(V)Q(V) teacher. For the output-KD student, precision decreases from the teacher’s 0.939 to 0.891, while recall decreases more substantially, from 0.636 to 0.385. With trajectory KD, precision is 0.918 and recall is 0.399. Thus most generated alarms still identify genuinely out-of-band buses, but many actual out-of-band bus-hours are missed. At six steps, the comparison changes: the output-KD Q(V)Q(V) student has higher precision than Base1 (0.682 versus 0.592), but much lower recall (0.134 versus 0.300), resulting in lower F1 (0.224 versus 0.398). Lower voltage-magnitude RMSE therefore does not consistently translate into better operating-band detection. These scores concern the 0.98–1.04 pu operating band, not the hard voltage limits.

Inference optimisation.

Floating-point formats trade resolution for speed. We first applied float16 to the whole network, with weights and intermediate values in float16 and only the physics step in float32. Float16 resolves voltages near 1 pu only to about 10−310^{-3} pu, the size of the teacher’s error: the output heads round the voltages, and the hidden state accumulates rounding errors over the correction steps. This raised the teacher’s voltage error by 20%, far beyond the 1% we accepted relative to float32, and bfloat16, with an even coarser resolution, failed in the same way. We then applied mixed precision (FP16-mixed), as in automatic mixed precision: only the query, key, value and skip projections, which hold nearly all of the arithmetic, run in float16, with their inputs cast to float16 and their outputs back to float32, while attention, normalisation, the hidden state, the output heads and the physics step stay in float32. With FP16-mixed, the errors stay within 0.2% of float32 for all models (Table 8), and the teacher becomes 1.36 times faster (24.6 to 18.2 ms), so that the most accurate model fits within the 20 ms synchrophasor interval.

ModelLatency (ms)Speed-upThroughputError change (%)
float32FP16-mixedVmV_mVaV_a
Teacher, 12 steps24.5918.151.361.370.0+0.1
Student, 12 steps12.1812.001.021.08−0.1−0.1
Student, 6 steps6.166.091.011.07−0.1+0.2

Table 8. FP16-mixed (query, key, value and skip projections in float16, everything else in float32) against float32 on the Jetson Orin Nano: latency per scenario (batch size one), gain in throughput, and relative change of the voltage-magnitude and angle errors over all test scenarios at the buses where they are unknown (+: larger error)

For the students, FP16-mixed shortens the latency by only 1–2%, because their run time is set by the roughly 200 small GPU operations per correction step, whose number does not depend on the width, rather than by arithmetic.

Limitations.

The study has several limitations. All parks follow one generalised Q(V)Q(V) characteristic, whereas in practice settings differ between parks and other control modes are used; HVDC links are represented as fixed injections without the voltage support of their converters. The fleet is a synthetic placement of Danish production on the IEEE 118-bus grid, and the data cover normal operation only, without faults, outages or other abnormal events. The voltage of the reference bus, released when the slack unit reaches its reactive limit, remains the largest voltage error of GridFM-Q(V)Q(V). Robustness to changed curve settings, park locations and topologies requires further out-of-distribution tests. The physics and data terms of the loss use fixed weights (0.1/0.9) that were not tuned for the Q(V)Q(V) bus type.Finally,the edge deployment assumes the fixed topology of normal operation; line outages or switching actions would require a CUDA graph per topology, so the reported latencies are a lower bound for operation under contingencies.

Conclusions and future work

We introduced a Q(V)Q(V) bus type for GridFM, in which the reactive power of a renewable park follows its Q(V)Q(V) characteristic at the predicted voltage, and trained it on measured Danish hourly data on a modified IEEE 118-bus grid. Compared with a physics-informed baseline that represents the parks as negative load, it lowers the voltage-magnitude RMSE 2.3-fold, reduces the power-balance mismatch at the parks from 25 to 0.66 MVA and raises the F1 score for voltage-band violations from 0.40 to 0.76. The ablation shows that the bus type provides the accuracy and the physics loss the power balance. Distilled students of the Q(V)Q(V) model collapse without further measures, as train reliably with a flat start. With output distillation, the 12-step student reaches 1.4 times the teacher’s error and solves a scenario on an NVIDIA Jetson Orin Nano in 12.2 ms, about three times faster than a Newton–Raphson solver with Q(V)Q(V) control and within the 20 ms synchrophasor interval; with mixed precision, the teacher also meets this interval.

Several questions remain open. The bus model should be extended to individual curve settings and other control modes, and its behaviour under topology changes, abnormal operating points and the voltage support of HVDC converters remains to be investigated. The cause of the angle error relative to the reference bus and its dependence on the weighting of the physics loss require further investigation. Methods and edge devices that further reduce the latency of the students should be explored, and the power-balance mismatch remains to be evaluated as an online trigger for a fall-back to a numerical solver.

Declarations

Funding

This work was supported by the Villum Foundation through the Villum Investigator project Smart Battery (project no. 222860) at Aalborg University.

Competing interests

The authors declare no competing interests.

Not applicable.

Clinical trial number

Not applicable.

Not applicable.

Data availability

The hourly consumption and production data are publicly available from Energinet’s Energi Data Service. [24]. The derived grid dataset and the trained models are available from the corresponding author on reasonable request.

Code availability

The source code and scripts supporting the findings of this study are available from the corresponding author on reasonable request.

Author contributions

S.R.R.P.: Conceptualization, Methodology, Investigation, Writing – original draft, Writing – review & editing. V.S.: Investigation, Writing – original draft, Writing – review & editing. R.T.: Conceptualization, Writing – original draft, Writing – review & editing. All authors read and approved the final manuscript.

Use of generative AI

In line with the Springer Nature policy on large language models (LLMs), we document their use. An LLM-based coding assistant (Claude Code, Anthropic) was used to write, debug and run the code for data generation, training and evaluation, to produce figures, to help draft and edit the manuscript text, and as a discussion aid during the design and analysis of the experiments. All experimental design decisions and the interpretation of results were made by the authors, who cross-checked the code, results, figures and text and take full responsibility for the content of this paper. No LLM is listed as an author.

References

References

  1. [1]European Commission: Commission Regulation (EU) 2016/631 of 14 April 2016 establishing a network code on requirements for grid connection of generators. Off J Eur Union L112, 1–68 (2016)
  2. [2]Energinet: NC RfG – National requirements for grid connection of generation facilities. Doc. 26/06860-2, version 6, Energinet, Fredericia (2026). Effective 17 April 2026. Accessed 30 October 2026. https://energinet.dk
  3. [3]IEEE: IEEE Standard for Interconnection and Interoperability of Distributed Energy Resources with Associated Electric Power Systems Interfaces. IEEE Std 1547-2018. IEEE Standards Association (2018)DOI
  4. [4]Liao, W., Bak-Jensen, B., Pillai, J.R., Wang, Y., Wang, Y.: A review of graph neural networks and their applications in power systems. J Mod Power Syst Clean Energy 10(2), 345–360 (2022)arxiv.org/abs/2101.10025
  5. [5]Hamann, H.F., Brunschwiler, T., Gjorgiev, B., Martins, L.S.A., Puech, A., Varbella, A., et al.: Foundation models for the electric power grid. Joule 8(12), 3245–3258 (2024)arxiv.org/abs/2407.09434
  6. [6]Puech, A., Mazzonelli, M., Cintas, C., Govindasamy, T.R., Mngomezulu, M., Weiss, J., et al.: gridfm-datakit-v1: A Python library for scalable and realistic power flow and optimal power flow data generation. arXiv:2512.14658 (2025). https://arxiv.org/abs/2512.14658
  7. [7]Milano, F., Dörfer, F., Hug, G., Hill, D.J., Verbic, G.: Foundations and challenges of low-inertia systems. In: Power Systems Computation Conference (PSCC), pp. 1–25 (2018). https://doi.org/10.23919/PSCC.2018.8485080
  8. [8]IEEE: IEEE Standard for Synchrophasor Measurements for Power Systems. IEEE Std C37.118.1-2011. IEEE Standards Association (2011)DOI
  9. [9]Gooi, H.B., Wang, T., Tang, Y.: Edge intelligence for smart grid: A survey on application potentials. CSEE J Power Energy Syst 9(5), 1623–1640 (2023)DOI
  10. [10]Sănduleac, V.A., Puthanpurayil, S.R.R., Khan, N., Teodorescu, R.: Physics-aware distillation of a grid foundation model for real-time edge inference. arXiv preprint arXiv:2610.21833 (2026)arxiv.org/abs/2610.21833
  11. [11]Thurner, L., Scheidler, A., Schäfer, F., Menke, J.H., Dollichon, J., Meier, F., et al.: pandapower—An open-source Python tool for convenient modeling, analysis, and optimization of electric power systems. IEEE Trans Power Syst 33(6), 6510–6521 (2018)DOI
  12. [12]Donon, B., Clément, R., Donnot, B., Marot, A., Guyon, I., Schoenauer, M.: Neural networks for power flow: Graph neural solver. Electr Power Syst Res 189, 106547 (2020)DOI
  13. [13]Hu, X., Hu, H., Verma, S., Zhang, Z.L.: Physics-guided deep neural networks for power flow analysis. IEEE Trans Power Syst 36(3), 2082–2092 (2021)DOI
  14. [14]Ngo, Q.H., Nguyen, B.L.H., Vu, T.V., Zhang, J., Ngo, T.: Physics-informed graphical neural network for power system state estimation. Appl Energy 358, 122602 (2024)arxiv.org/abs/2312.17738
  15. [15]Nellikkath, R., Chatzivasileiadis, S.: Physics-informed neural networks for AC optimal power flow. Electr Power Syst Res 212, 108412 (2022)DOI
  16. [16]Lin, N., Orfanoudakis, S., Ordonez Cardenas, N., Giraldo, J.S., Vergara, P.P.: PowerFlowNet: Power flow approximation using message passing graph neural networks. Int J Electr Power Energy Syst 160, 110112 (2024)
  17. [17]Arowolo, O., Cremer, J.L.: Towards generalization of graph neural networks for AC optimal power flow. arXiv:2510.06860 (2025). https://arxiv.org/abs/2510.06860
  18. [18]Hinton, G., Vinyals, O., Dean, J.: Distilling the knowledge in a neural network. arXiv:1503.02531 (2015). https://arxiv.org/abs/1503.02531
  19. [19]Romero, A., Ballas, N., Kahou, S.E., Chassang, A., Gatta, C., Bengio, Y.: FitNets: Hints for thin deep nets. In: International Conference on Learning Representations (2015). https://arxiv.org/abs/1412.6550
  20. [20]Gou, J., Yu, B., Maybank, S.J., Tao, D.: Knowledge distillation: A survey. Int J Comput Vis 129(6), 1789–1819 (2021)DOI
  21. [21]Tian, Y., Pei, S., Zhang, X., Zhang, C., Chawla, N.V.: Knowledge distillation on graphs: A survey. ACM Comput Surv 57(8), 1–16 (2025)arxiv.org/abs/2302.00219
  22. [22]Stanton, S., Izmailov, P., Kirichenko, P., Alemi, A.A., Wilson, A.G.: Does knowledge distillation really work? In: Advances in Neural Information Processing Systems, vol. 34 (2021). https://arxiv.org/abs/2106.05945
  23. [23]Barillaro, L., Zucco, C., Milano, M., Agapito, G., Cannataro, M.: Evaluating GNN inference on edge computers. In: Companion Proceedings of the 16th ACM International Conference on Bioinformatics, Computational Biology and Health Informatics (2025). https://doi.org/10.1145/3768322.3769021
  24. [24]Energinet: Energi Data Service: hourly production and consumption data for DK1 and DK2. https://www.energidataservice.dk
  25. [25]GridFM Project: gridfm-datakit: Scalable generation of power flow and optimal power flow datasets. GitHub repository. Accessed 30 October 2026 (2025). https://github.com/gridfm/gridfm-datakit
  26. [26]GridFM Project: gridfm-graphkit: Graph-based foundation models for the electric power grid. GitHub repository. Accessed 30 October 2026 (2025). https://github.com/gridfm/gridfm-graphkit

Paper details

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

views · 0

downloads · 0

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

  • Engineering

Claude Code

View statement
Looking for related papers…
Contents