Skip to content

Graph attention for fault diagnosis in power converters

6 min read
  • graph-neural-networks
  • attention
  • fault-diagnosis
  • power-systems
  • design-notes

Fault diagnosis in power electronics has a property most machine learning problems lack: the system under test has a wiring diagram. The switches, sensors, and passive components of a photovoltaic inverter are connected in a known topology, and a fault propagates along that topology. For years the standard approach ignored this and fed sensor channels into a classifier as an unordered feature vector. This post is about what changes when you stop ignoring it and model the inverter as a graph, and about why one graph turned out not to be enough.

The problem as it presents itself

A grid-tied inverter produces a handful of measured signals: phase currents, DC-link voltage, sometimes switch-level measurements. An open-switch fault in one of the power transistors distorts these signals in a characteristic way. The diagnostic task is to detect that a fault has occurred and to localise it to the responsible switch, from a short window of measurements, under noise and under operating conditions that were not all present in the training data.

Two things make this hard. The distortions for different switch locations can be similar in the time domain and separate more cleanly in frequency content. And the training data is almost always imbalanced, because healthy operation dominates any realistic recording and some faults are rare.

Building the graph

The first design decision is what a node is. The natural choice is one node per measured channel. The second decision is what an edge is, and here the physical topology gives you a starting point: two channels are connected if the components they measure are electrically adjacent. That gives a spatial graph whose structure is fixed by the circuit.

Adjacency alone is not enough, though. Two channels that are electrically distant can be strongly coupled during a fault because the fault current finds a path through both. So the spatial graph is usually augmented with learned or correlation-based edges, weighted by how strongly the channels co-vary in the current window. The result is a graph whose backbone is physical and whose fine structure is data-dependent.

Why a second graph

If you build one graph and one attention network over it, the model does well on faults that manifest as time-domain relationships between channels and poorly on faults whose signature lives in frequency content. Concatenating spectral features onto each node’s input vector helps a little, but the attention weights, which decide which neighbours matter, are still driven predominantly by time-domain similarity.

The fix that worked was to give the spectral view its own graph. Transform each channel into a frequency representation, build a spectral graph whose edges reflect similarity in spectral content, and run a separate graph attention branch over it. The two branches see the same physical system through different lenses and learn different neighbourhood weightings.

Attention, and what it learns

Graph attention is the right aggregation operator here for a specific reason: the importance of a neighbour depends on the fault. Under a fault on one leg of the inverter, the channels on that leg should dominate the representation of their neighbours. Under a different fault, a different set should dominate. A fixed aggregation, such as mean pooling over neighbours, cannot express this. Attention learns a per-edge weight conditioned on the current node states, so the effective graph reshapes itself around the fault.

Inspecting the learned attention weights is also the most useful diagnostic tool during development. When the spatial branch places high weight on the channels physically nearest the faulted switch, and the spectral branch places high weight on channels sharing the fault’s harmonic signature, the model is learning what you hoped. When attention collapses to near-uniform weights, something upstream, usually normalisation or the graph construction, is wrong.

Fusing the branches without letting one dominate

Late fusion, where each branch produces a graph-level embedding and the embeddings are concatenated before the classifier, is simple and works. The failure mode to watch is one branch dominating because its embedding has larger scale or because the optimiser finds it easier to fit. Two mitigations helped: normalising each branch embedding before concatenation, and adding a light auxiliary classification loss on each branch alone so neither is allowed to become a passenger.

Imbalance is a loss problem, not an architecture problem

It is tempting to attribute poor recall on rare faults to model capacity and respond with a bigger network. In my experience the gains come almost entirely from the loss and the sampling. Class-weighted cross-entropy or a focal loss, combined with balanced mini-batch sampling, moved recall on minority faults far more than any architectural change. The architecture determines whether the model can separate the classes. The loss determines whether it bothers to.

Robustness under noise

Measurement noise is the other practical adversary. Injecting noise during training at a range of signal-to-noise ratios is the obvious defence, and it works, but the graph structure itself contributes something. Because a node’s representation is an attention-weighted aggregate over its neighbours, independent noise on individual channels is partially averaged out before it reaches the classifier. This is one of the concrete reasons a graph model degrades more gracefully than a per-channel model when the test conditions are noisier than the training conditions.

Connections to unsupervised detection

Everything above assumes labelled faults. In earlier work on power converters the setting was unsupervised: learn what healthy operation looks like and flag departures from it. The two settings are complementary. An unsupervised detector answers “is something wrong?” without needing examples of every fault; a supervised graph model answers “what and where?” for the faults it has seen. A deployed system wants both, with the detector as the first stage and the classifier as the second.

Where this is going

The natural extension is from a single inverter to a network of them, and then to the distribution grid they feed. The graph gets larger and more heterogeneous, with nodes of different types and edges that represent different physical relationships. Attention still applies, but the graph construction becomes the dominant design problem, and combining topological reasoning with language-model-based decision support for operators is the direction I am currently working on.