Transformer tap position identification with GENCO under fuzzy measurements

#12
by Weijie1996 - opened

Participant: Weijie Xia(with Claude CodeπŸ₯Έ)
Contact: W.xia@tudelft.nl
Code: https://github.com/xiaweijie1996/gridfm-graphkit-weijie/tree/main/weijie_challenge

Transformer tap position identification with GENCO under fuzzy measurements

Abstract

Wrong transformer tap records give a wrong admittance matrix and, with it, wrong power flow and state estimation (SE) results. We use two properties of grid foundation models, differentiability and tolerance to fuzzy inputs, to recover the true tap positions from missing, noisy, and partly outlier measurements.
We first fine-tune GENCO to perform SE with fuzzy measurements. We then freeze the model. For each transformer, we represent the unknown tap position as a soft assignment over its candidate values. These assignments are optimized by gradient descent until the estimated grid state agrees as closely as possible with the measurements.
We evaluate the method on the IEEE 57-bus system, which contains 15 transformers. Fine-tuning reduces the SE power residual under fuzzy inputs by more than 100Γ—. Using the fine-tuned model, the tap search recovers the true positions of all 15 transformers in every one of 40 runs.In contrast, tap recovery is substantially less accurate with the original checkpoint. This comparison shows that, with fine-tuning, GENCO becomes sufficiently accurate to recover the true tap positions.

1. Background and Motivation

Grid foundation models (GridFM) can act as power flow (PF), optimal power flow (OPF) and state estimation (SE) solvers, with two advantages over numerical solvers:

  1. Differentiable. GridFM as a PF/OPF/SE solver, allows gradients flowing from the predicted grid state back to every input, which numerical solvers (Newton–Raphson, interior point, weighted least squares) do not provide. This makes GridFM a very flexible basis for any deep-learning downstream tasks.
  2. Fuzzy inputs. GridFM can inference with missing, noisy and outlier data. Numerical methods need complete, consistent inputs.

Transformer tap positions are often recorded wrongly in industry (stale logs, missed manual updates, wrong step-to-ratio conversion), which gives a wrong admittance matrix Y\mathbf{Y} and, consequently, wrong PF / OPF / SE results.

In this project, leveraging the advantages of GridFM mentioned above, we want to explore can a GridFM model (GENCO), fine-tuned for SE, recover the true tap positions from fuzzy measurements?

2. Problem Definition

Definition. Consider a transmission system with buses B\mathcal{B}, branches E\mathcal{E} and known branch parameters Ξ¦\Phi (resistance, reactance, line charging). Its transformers TβŠ‚E\mathcal{T} \subset \mathcal{E} have unclear tap positions, the tap ratio of transformer ii takes one of a finite set of discrete values ai∈Ai={ai1,ai2,… }a_i \in \mathcal{A}_i = \{a_{i1}, a_{i2}, \dots\}, but the true one, aiβ‹†βˆˆAia_i^\star \in \mathcal{A}_i, is unknown. Given Ξ¦\Phi, the tap candidate sets {Ai}i∈T\{\mathcal{A}_i\}_{i \in \mathcal{T}} and fuzzy measurements {zs}s=1N\{\mathbf{z}_s\}_{s=1}^{N}, find the taps a⋆=(ai⋆)i∈T\mathbf{a}^\star = (a_i^\star)_{i \in \mathcal{T}} that explain the measurements.

Taps and admittance. The taps of transformers affect the admittance matrix, which we write as an operation

Y=Y(Ξ¦,a),a∈A=A1Γ—β‹―Γ—A∣T∣. \mathbf{Y} = \mathcal{Y}(\Phi, \mathbf{a}), \qquad \mathbf{a} \in \mathcal{A} = \mathcal{A}_1 \times \dots \times \mathcal{A}_{|\mathcal{T}|}.

Y\mathcal{Y} assembles the Ο€-model of every branch, and tap aia_i rescales only the entries of transformer ii (see Appendix A.1 for more details). A wrong tap record therefore gives a wrong Y\mathbf{Y}.

Fuzzy observations. We observe the system in SS snapshots with different load and generation but, fundamentally, the same taps a⋆\mathbf{a}^\star. In each snapshot ss, the meters give measurements zs\mathbf{z}_s of the bus power injections (P,Q)(P, Q), the bus voltage magnitudes (Vm)(V_m) and the branch power flows. These measurements are fuzzy, some are missing, all are noisy, and some are outliers.

3. Methodology

Idea. A wrong tap gives a wrong Y\mathbf{Y}, and an SE solver that uses a wrong Y\mathbf{Y} cannot reproduce the measurements well, which leaves a loss. We therefore look for the taps whose Y\mathbf{Y} gives the smallest loss. As the SE solver we use a grid foundation model, it accepts fuzzy measurements, and it is differentiable with respect to Y\mathbf{Y}, so the taps can be found by gradient descent. Figure 1 gives an overview of the method.

image

Figure 1. Method overview. (1) A pretrained grid foundation model is fine-tuned as an SE solver on fuzzy measurements. (2) The model is frozen, and only the soft tap assignment is optimized by gradient descent on the tap loss. (3) The tap assignment converges to the estimated tap positions.

Fine-tuning. We first fine-tune a pretrained grid foundation model as an SE solver on fuzzy data.

Taps and admittance. As defined in Section 2, the taps enter the grid through the admittance matrix, Y=Y(Ξ¦,a)\mathbf{Y} = \mathcal{Y}(\Phi, \mathbf{a}). Y\mathcal{Y} is differentiable with respect to a\mathbf{a}.

Grid foundation model as SE solver. Let gf(β‹…)gf(\cdot) be the fine-tuned GENCO model. It takes the fuzzy measurements zs\mathbf{z}_s of snapshot ss and an admittance matrix Y\mathbf{Y}, and estimates zsr\mathbf{z}^r_s, the real system state of snapshot ss (bus VmV_m, ΞΈ\theta, PP and QQ) without noise, outliers or missing values:

gf(zs,Y)=z^srβ‰ˆzsr. gf(\mathbf{z}_s, \mathbf{Y}) =\hat{\mathbf{z}}^r_s \approx \mathbf{z}^r_s.

The approximation holds when Y\mathbf{Y} is correct, with a wrong Y\mathbf{Y}, z^sr\hat{\mathbf{z}}^r_s no longer fits the measurements. Since gfgf is differentiable with respect to Y=Y(Ξ¦,a)\mathbf{Y} = \mathcal{Y}(\Phi, \mathbf{a}) and Y\mathcal{Y} with respect to a\mathbf{a}, the estimate z^sr(a)=gf(zs,Y(Ξ¦,a))\hat{\mathbf{z}}^r_s(\mathbf{a}) = gf\big(\mathbf{z}_s, \mathcal{Y}(\Phi, \mathbf{a})\big) is differentiable with respect to the taps.

Note: In practice, only the fuzzy measurements zs\mathbf{z}_s are available, and the real state zsr\mathbf{z}^r_s cannot be observed. Since we assume, as is common in SE studies, that the noise is zero-mean Gaussian, zsr\mathbf{z}^r_s can be approximately seen as the mean of many fuzzy observations under the same system condition.

Tap loss. For a tap vector a\mathbf{a}, the loss measures how well the estimates z^sr(a)\hat{\mathbf{z}}^r_s(\mathbf{a}) reproduce the measurements, over all snapshots:

L(a)=1∣Mβˆ£βˆ‘s=1Nβˆ‘q∈Msρ ⁣(z^s,qr(a)βˆ’zs,qΟƒs,q),a^=arg⁑min⁑a∈AL(a), \mathcal{L}(\mathbf{a}) = \frac{1}{|\mathcal{M}|} \sum_{s=1}^{N} \sum_{q \in \mathcal{M}_s} \rho\!\left( \frac{\hat{z}^r_{s,q}(\mathbf{a}) - z_{s,q}}{\sigma_{s,q}} \right), \qquad \hat{\mathbf{a}} = \arg\min_{\mathbf{a} \in \mathcal{A}} \mathcal{L}(\mathbf{a}),

where Ms\mathcal{M}_s is the set of measured quantities of snapshot ss and ∣M∣=βˆ‘s∣Ms∣|\mathcal{M}| = \sum_s |\mathcal{M}_s|. For ρ\rho we use the Huber loss, which limits the influence of outliers, and Οƒs,q\sigma_{s,q} is the expected size of the residual, combining the meter accuracy and the error of gfgf itself.

Soft tap assignment. A\mathcal{A} is discrete, but gradient-based training needs a continuous, smooth search space, so we relax it. We stack the candidate tap ratios in a matrix C∈R∣Tβˆ£Γ—P\mathbf{C} \in \mathbb{R}^{|\mathcal{T}| \times P}, where Cij=aijC_{ij} = a_{ij} is the tap ratio of candidate position jj of transformer ii, ∣Ai∣|\mathcal{A}_i| is the number of candidate positions of transformer ii and P=max⁑i∣Ai∣P = \max_i |\mathcal{A}_i| (shorter rows are padded). The learnable parameters are a logit matrix W∈R∣Tβˆ£Γ—P\mathbf{W} \in \mathbb{R}^{|\mathcal{T}| \times P}, one logit per transformer and candidate position, which is mapped to a probability matrix Ξ \boldsymbol{\Pi} and then to the soft tap ratios a~\tilde{\mathbf{a}}:

Ξ =softmax⁑(W/T),a~=(Ξ βŠ™C) 1,i.e. a~i=βˆ‘jΞ ij Cij, \boldsymbol{\Pi} = \operatorname{softmax}(\mathbf{W} / T), \qquad \tilde{\mathbf{a}} = (\boldsymbol{\Pi} \odot \mathbf{C})\,\mathbf{1}, \quad \text{i.e.}\ \tilde{a}_i = \sum_{j} \Pi_{ij}\, C_{ij},

where the softmax is taken over each row and gives padded positions zero weight. Row ii of Ξ \boldsymbol{\Pi} is thus a probability distribution over the candidate taps of transformer ii, and a~i\tilde{a}_i is their weighted average.

L(a~)\mathcal{L}(\tilde{\mathbf{a}}) is then differentiable with respect to W\mathbf{W}, through gfgf and Y\mathcal{Y}. The logits start with most weight on the recorded (wrong) taps and are trained with Adam while the temperature TT is lowered, at high TT the probabilities are spread over many positions, and at low TT each row of Ξ \boldsymbol{\Pi} becomes nearly one-hot, so a~i\tilde{a}_i settles on a single candidate.

Decoding. After training, each transformer takes its most likely position, a^i=Cijβˆ—\hat{a}_i = C_{ij^*} with jβˆ—=arg⁑max⁑jΞ ijj^* = \arg\max_j \Pi_{ij}.

4. Experiment Design

Overall Setup. We use the IEEE-57 system, which has 15 transformers. Each transformer's candidate set Ai\mathcal{A}_i is its true tap Β±kβ‹…0.0125\pm k \cdot 0.0125 within [0.875,1.10][0.875, 1.10], which gives 18–19 positions per transformer and ∣Aβˆ£β‰ˆ7.5Γ—1018|\mathcal{A}| \approx 7.5 \times 10^{18} tap combinations. The data is the gridfm/pf_small_case57_ieee dataset, split 80 / 10 / 10 (173 604 / 21 662 / 21 694 snapshots). The starting model is the published GENCO PF checkpoint (gridfm/genco-pf-datakit, case57_ieee).

Hyperparameters.

Fine-tuning. GENCO is fine-tuned as an SE solver on fuzzy data with 30 % of every measurement group missing, 2 % noise and 10 % outliers, with a new random draw in every epoch. The loss is the MAE against the true values, weighted 0.35 Vm+0.35 θ+0.1 P+0.1 Q0.35\,V_m + 0.35\,\theta + 0.1\,P + 0.1\,Q. We train with AdamW (lr 10βˆ’410^{-4}, reduced by a factor 0.7 after 5 epochs without improvement) and batch size 64 for up to 50 epochs, with early stopping on the validation loss.

Tap position idenfitication. Each run uses N=64N = 64 test snapshots. The loss is the Huber loss with Ξ΄=1.5\delta = 1.5 and Οƒs,q=(0.02β€‰βˆ£zs,q∣)2+sgf2\sigma_{s,q} = \sqrt{(0.02\,|z_{s,q}|)^2 + s_{gf}^2}, where sgfs_{gf} is 1.25 times the model's validation MAE. The logits start at 5.0 on the recorded (wrong) position and 0 elsewhere, and are trained with Adam (learning rate 0.1) for 300 steps while TT is lowered geometrically from 1 to 0.1. The refinement tries single Β±1\pm 1 moves and joint Β±1\pm 1 moves of the parallel pair 4β†’18.

Fuzzy levels. We test 4 fuzzy levels, with 5, 10, 20 and 30 % of every measurement group missing (noise 2 % and outliers 10 % fixed). At each level, the measurements are drawn once and shared by all runs.

Wrong tap initializations. At each fuzzy level, we start the tap training from 10 different wrong tap records, to test whether the result depends on the starting point. In every record all 15 taps are wrong, by 1 to 16 positions:

Evaluation metrics.

  • SE accuracy (fine-tuned vs original, on all 21 694 test snapshots): the mean absolute power residual (PBE mean, in MW), 1∣Bβˆ£βˆ‘k∣S^kβˆ’Sk∣\frac{1}{|\mathcal{B}|}\sum_{k} |\hat S_k - S_k| averaged over snapshots, where S^k\hat S_k is the complex power injection computed from the estimated state and SkS_k the true one.
  • Tap identification: for each transformer, the offset of the found tap from the true one, in positions, oi=(a^iβˆ’ai⋆)/Ξ”o_i = (\hat a_i - a_i^\star)/\Delta, where Ξ”=0.0125\Delta = 0.0125 is the tap ratio step between neighbouring positions, so oi=0o_i = 0 means the true tap is found.

5. Results

5.1 SE accuracy: fine-tuned vs original model

In this section, we first analyse the improvement from fine-tuning GENCO on SE tasks with fuzzy inputs.

5.1.1 Overall comparison

image

Figure 2. Performance comparison between the fine-tuned GENCO, the original GENCO and the raw meters over different fuzzy levels. Performance is measured by the mean absolute power residual (MW), shown in log scale.

Fuzzy level Original (MW) Fine-tuned (MW) Improvement Raw meters (MW)
5 % 79.7 0.70 114Γ— 1.75
10 % 84.6 0.73 115Γ— 2.94
20 % 93.8 0.82 115Γ— 5.36
30 % 102.0 0.92 111Γ— 7.78

Figure 2 and the table above show that fine-tuning lowers the power residual by more than two orders of magnitude (111–115Γ—) at every fuzzy level. The fine-tuned model degrades gently as more measurements go missing (0.70 β†’ 0.92 MW from 5 % to 30 %), and it is 2.5–8.5Γ— more accurate than the raw meters. The original model, trained only for PF with exact inputs, cannot handle fuzzy inputs, its residual is 80–102 MW, far above its PF accuracy of 0.0144 MW (dotted line in Figure 2).

5.1.2 Error by variable

image

Figure 3. Per-variable performance comparison between the fine-tuned GENCO and the original GENCO over different fuzzy levels. Each panel shows the mean absolute error of one variable (Vm,ΞΈ,P or Q)(V_m, \theta, P \text{ or } Q), in log scale.

Variable Original (5 % β†’ 30 %) Fine-tuned (5 % β†’ 30 %) Improvement
VmV_m (p.u.) 0.030 β†’ 0.044 0.0012 β†’ 0.0014 25–32Γ—
ΞΈ\theta (deg) 9.6 β†’ 9.2 0.09 β†’ 0.12 77–104Γ—
PP (MW) 70.3 β†’ 88.6 0.54 β†’ 0.72 122–131Γ—
QQ (MVAr) 27.1 β†’ 37.6 0.34 β†’ 0.42 81–91Γ—

Figure 3 and the table above show that fine-tuning improves every variable. The largest gains are for PP and for the voltage angle ΞΈ\theta, although ΞΈ\theta is never measured, the fine-tuned model infers it within about 0.1Β°, while the original model is off by more than 9Β°. The gain for VmV_m is smaller because VmV_m stays close to 1 p.u., so even the original model's error is moderate.

5.2 Tap identification

5.2.1 Loss landscape

image

Figure 5. Tap loss landscape at 30 % fuzzy inputs. Each panel sweeps one transformer's tap over all its candidate positions while the other 14 stay at their true taps. The loss is divided by the loss at the true taps, so 1 means the same loss as the true taps (log scale). The dashed line marks the true tap and the open marker the minimum.

Figure 5 shows that, with the fine-tuned model, the loss has its minimum at the true tap for all 15 transformers. A few transformers have shallow loss surfaces (e.g. the parallel pair 4β†’18 and 40β†’56), but their minimum is still at the true tap. With the original model, the loss minimum misses the true tap for 14 of the 15 transformers, the only exception being 11β†’43. Its loss therefore carries almost no information about the taps.

5.2.2 Identification under different fuzzy levels

image

Figure 6. Tap identification performance of the fine-tuned GENCO and the original GENCO over different fuzzy levels. Each point is the mean over the 10 wrong initializations, and the bar shows the min–max range.

Fuzzy level Fine-tuned: found Fine-tuned: within Β±1 Original: found Original: within Β±1
5 % 15.0 (15–15) 15.0 2.0 (2–2) 3.4
10 % 15.0 (15–15) 15.0 0.6 (0–1) 2.0
20 % 15.0 (15–15) 15.0 0.0 (0–0) 2.0
30 % 15.0 (15–15) 15.0 1.0 (1–1) 1.0

Figure 6 and the table above show that the fine-tuned model finds the true tap position (\(o_i = 0\)) of all 15 transformers in all 40 runs, at every fuzzy level and from every wrong record. The original model stays at the level of a random guess (0–2 of 15, dashed line in Figure 6), with its found taps 4–5 positions off on average, and it reaches nearly the same wrong taps from every initialization. The experiment shows that, although the fine-tuned model still has an error on the SE task (0.70–0.92 MW, Section 5.1), this error is small enough for the model to serve as a frozen solver through which the tap positions can be learned.

5.2.3 Convergence

image

Figure 7. Convergence of the tap search with the fine-tuned GENCO and the original GENCO at 30 % fuzzy inputs, from two wrong initializations (I1 and I2). Each line is one transformer's soft tap, shown as its distance from the true tap in positions, where 0 means the predicted tap is the true tap.

Figure 7 shows that, with the fine-tuned model, all 15 taps move to their true position within about 50 optimization steps in both initializations, from offsets of up to 15 positions, and stay there. With the original model, the taps also settle quickly, but on wrong positions.

6. Conclusion

We asked whether a grid foundation model, fine-tuned for SE, can recover the true transformer tap positions from fuzzy measurements in section 1. On IEEE-57 the answer is yes, by freezing the fine-tuned GENCO and fitting only a soft tap assignment through it, we found the true tap position of all 15 transformers in all 40 runs, from wrong records up to 16 positions off and with up to 30 % of the measurements missing, noisy and partly outliers.

Fine-tuning is what makes this work. It lowers the SE power residual under fuzzy inputs by more than 100Γ—, and it turns the tap loss from almost flat into a landscape with its minimum at the true tap for every transformer. The original PF checkpoint, given the same inputs and the same procedure, stays at random-guess level and consistently converges to the same wrong taps. The two properties of GridFM we set out to use, differentiability and tolerance to fuzzy inputs, are thus both needed, the first makes gradient-based tap search possible, and the second, gained through SE fine-tuning, makes the search point to the right taps.

Limitations: The study uses one grid typology and one true tap setting, the one the model was trained on, testing other true settings (with re-solved power flows) and larger grids is the most important next step. Finally, the same approach applies to other wrong grid parameters, such as line impedances or switch states.

Appendix

A.1 Admittance operation Y(Ξ¦,a)\mathcal{Y}(\Phi, \mathbf{a}). Branch ee from bus ff to bus tt is a Ο€-model with series admittance ye=1/(re+jxe)y_e = 1/(r_e + j x_e), line-charging susceptance beb_e and tap ratio aea_e, where ae=1a_e = 1 for a line and ae=aia_e = a_i for transformer ii. It contributes

[Yff(e)Yft(e)Ytf(e)Ytt(e)]=[ye+j be/2ae2βˆ’yeaeβˆ’yeaeye+j be/2], \begin{bmatrix} Y^{(e)}_{ff} & Y^{(e)}_{ft} \\ Y^{(e)}_{tf} & Y^{(e)}_{tt} \end{bmatrix} = \begin{bmatrix} \dfrac{y_e + j\,b_e/2}{a_e^2} & -\dfrac{y_e}{a_e} \\ -\dfrac{y_e}{a_e} & y_e + j\,b_e/2 \end{bmatrix},

and Y\mathcal{Y} adds these 2Γ—22 \times 2 blocks into rows and columns f,tf, t of Y\mathbf{Y} for every branch. A tap therefore acts only on its own transformer's entries.

Sign up or log in to comment