Spaces:
Running
Transformer tap position identification with GENCO under fuzzy measurements
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:
- 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.
- 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 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 , branches and known branch parameters (resistance, reactance, line charging). Its transformers have unclear tap positions, the tap ratio of transformer takes one of a finite set of discrete values , but the true one, , is unknown. Given , the tap candidate sets and fuzzy measurements , find the taps that explain the measurements.
Taps and admittance. The taps of transformers affect the admittance matrix, which we write as an operation
assembles the Ο-model of every branch, and tap rescales only the entries of transformer (see Appendix A.1 for more details). A wrong tap record therefore gives a wrong .
Fuzzy observations. We observe the system in snapshots with different load and generation but, fundamentally, the same taps . In each snapshot , the meters give measurements of the bus power injections , the bus voltage magnitudes 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 , and an SE solver that uses a wrong cannot reproduce the measurements well, which leaves a loss. We therefore look for the taps whose 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 , so the taps can be found by gradient descent. Figure 1 gives an overview of the method.
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, . is differentiable with respect to .
Grid foundation model as SE solver. Let be the fine-tuned GENCO model. It takes the fuzzy measurements of snapshot and an admittance matrix , and estimates , the real system state of snapshot (bus , , and ) without noise, outliers or missing values:
The approximation holds when is correct, with a wrong , no longer fits the measurements. Since is differentiable with respect to and with respect to , the estimate is differentiable with respect to the taps.
Note: In practice, only the fuzzy measurements are available, and the real state cannot be observed. Since we assume, as is common in SE studies, that the noise is zero-mean Gaussian, can be approximately seen as the mean of many fuzzy observations under the same system condition.
Tap loss. For a tap vector , the loss measures how well the estimates reproduce the measurements, over all snapshots:
where is the set of measured quantities of snapshot and . For we use the Huber loss, which limits the influence of outliers, and is the expected size of the residual, combining the meter accuracy and the error of itself.
Soft tap assignment. 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 , where is the tap ratio of candidate position of transformer , is the number of candidate positions of transformer and (shorter rows are padded). The learnable parameters are a logit matrix , one logit per transformer and candidate position, which is mapped to a probability matrix and then to the soft tap ratios :
where the softmax is taken over each row and gives padded positions zero weight. Row of is thus a probability distribution over the candidate taps of transformer , and is their weighted average.
is then differentiable with respect to , through and . The logits start with most weight on the recorded (wrong) taps and are trained with Adam while the temperature is lowered, at high the probabilities are spread over many positions, and at low each row of becomes nearly one-hot, so settles on a single candidate.
Decoding. After training, each transformer takes its most likely position, with .
4. Experiment Design
Overall Setup. We use the IEEE-57 system, which has 15 transformers. Each transformer's candidate set is its true tap within , which gives 18β19 positions per transformer and 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 . We train with AdamW (lr , 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 test snapshots. The loss is the Huber loss with and , where 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 is lowered geometrically from 1 to 0.1. The refinement tries single moves and joint 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), averaged over snapshots, where is the complex power injection computed from the estimated state and the true one.
- Tap identification: for each transformer, the offset of the found tap from the true one, in positions, , where is the tap ratio step between neighbouring positions, so 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
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
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 , in log scale.
| Variable | Original (5 % β 30 %) | Fine-tuned (5 % β 30 %) | Improvement |
|---|---|---|---|
| (p.u.) | 0.030 β 0.044 | 0.0012 β 0.0014 | 25β32Γ |
| (deg) | 9.6 β 9.2 | 0.09 β 0.12 | 77β104Γ |
| (MW) | 70.3 β 88.6 | 0.54 β 0.72 | 122β131Γ |
| (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 and for the voltage angle , although 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 is smaller because stays close to 1 p.u., so even the original model's error is moderate.
5.2 Tap identification
5.2.1 Loss landscape
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
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
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 . Branch from bus to bus is a Ο-model with series admittance , line-charging susceptance and tap ratio , where for a line and for transformer . It contributes
and adds these blocks into rows and columns of for every branch. A tap therefore acts only on its own transformer's entries.





