Detecting False Data Injection Attacks on Distribution-Network Battery Energy Storage with a CNN–GRU–Attention Model

Battery energy storage has shifted from a demonstration asset to a working component of medium- and low-voltage distribution networks. Containerized lithium-ion installations now provide peak shaving, voltage and reactive-power support, smoothing of photovoltaic output, islanded backup and frequency response, often on the same feeders that carry the most variable distributed generation. Because these services are delivered by closed-loop control, the installation is only as reliable as the measurements it receives. That dependence turns the telemetry chain into a security perimeter, and it makes false data injection a direct threat to the physical integrity of the storage asset.

Storage Control Rests on Data an Attacker Can Reach

A grid-connected energy battery storage unit is a layered system: battery racks and modules, a battery management system that tracks cell voltage, pack current, temperature and state of charge, a power conversion system that sets active and reactive output, and a step-up transformer connecting the unit to the feeder. The control layer does not observe any of this directly. It reconstructs the plant state from sampled measurements of pack voltage and current, module temperature, state of charge and state of health, converter output, bus voltage and feeder current, together with the network-side quantities used by the distribution management system.

Those samples travel through merging units, remote terminal units, phasor measurement units and substation gateways before reaching state estimation and dispatch functions, and setpoints travel back along the same path. Each interface — sensor, gateway, protocol converter, communication link — is a possible entry point for an adversary who can alter values in transit. The attack does not require malware on the controller; rewriting a stream of plausible-looking numbers is sufficient.

Containerized lithium-ion battery racks inside a grid-scale energy storage installation

The consequences propagate in a characteristic order. Biased measurements distort state estimation, the estimator returns an incorrect picture of the feeder, and dispatch decisions follow that picture. A storage unit commanded on the basis of falsified state of charge may be driven into overcharge or deep discharge, which accelerates degradation and, in the extreme, raises thermal-runaway risk. Falsified voltage or flow readings can also mis-coordinate protection, produce spurious tap changes and capacitor switching, and corrupt the arbitration of charge and discharge schedules that determines the asset’s revenue. Because storage is a fast, controllable device, errors are acted upon quickly rather than absorbed by the inertia of the network.

Attack Model and Detection Problem

Let $\mathbf{x}_t$ denote the network and storage state at sample $t$, and $\mathbf{h}(\cdot)$ the measurement function that maps state to the metered quantities. The received measurement vector is

$$\mathbf{z}_t = \mathbf{h}(\mathbf{x}_t) + \mathbf{e}_t + \mathbf{a}_t,$$

where $\mathbf{e}_t$ is noise and $\mathbf{a}_t$ is the injection. The classical bad-data detector tests the residual between the measurement and its estimated value,

$$\left\| \mathbf{z}_t – \mathbf{h}(\hat{\mathbf{x}}_t) \right\|_2 \le \tau ,$$

and any injection that satisfies a linearised version of the same condition is invisible to it:

$$\mathbf{a}_t = \mathbf{H}\,\Delta\mathbf{x}_t, \qquad \mathbf{H} = \left. \frac{\partial \mathbf{h}}{\partial \mathbf{x}} \right|_{\mathbf{x}_t}.$$

Such an injection displaces the estimated state by $\Delta\mathbf{x}_t$ while leaving the residual small, which is why residual tests alone are insufficient when the adversary understands the network model.

The detection task is therefore recast as classification over a window of measurements rather than over a single sample. A sliding window of $T$ consecutive samples across $n$ channels forms the input $\mathbf{X} \in \mathbb{R}^{T \times n}$, and the detector outputs a label $\hat{y} \in \{0,1\}$ with a probability that the window contains an injection. Three properties of the data shape the design. Attack signatures are weak relative to normal load and photovoltaic variation, so the discriminative evidence is distributed over time rather than concentrated in one instant. Channels are physically coupled — converter current, bus voltage and state of charge move together — so joint patterns across channels carry information that univariate thresholds miss. And detection must run inside the control cycle, which rules out architectures whose inference cost grows with window length.

Model-based residual schemes depend on accurate topology, line parameters and state estimation quality, all of which drift as reconfiguration and new connections change the feeder. Single data-driven models have complementary weaknesses: a convolutional network captures local cross-channel structure but treats the window as an unordered set of short patterns, while a recurrent network captures temporal drift but dilutes the short-range correlations that separate a genuine injection from a load step. Combining the two, with a learned weighting over time steps, addresses both.

Architecture of the Detector

The detector stacks three stages — a one-dimensional convolutional front end, a gated recurrent unit, and an attention layer — followed by a softmax classifier. Measurements are normalized per channel before windowing, so that quantities with different units and ranges contribute comparably.

The convolutional stage slides $L$-tap kernels along the time axis and across channels, producing feature maps

$$c_t^{(k)} = \phi\!\left( \sum_{i=1}^{F} \sum_{j=0}^{L-1} w_{k,i,j}\, x_{t+j,i} + b_k \right),$$

with $\phi$ a rectified linear unit, $F$ the number of input channels and $k$ indexing the filters. Each filter responds to a local configuration — for example a simultaneous rise in converter current and fall in bus voltage sustained over a few samples — and pooling compresses the window while preserving the position of the strongest response. This stage is what gives the model its sensitivity to physically inconsistent combinations of readings, which a per-channel threshold cannot express.

The recurrent stage consumes the convolutional feature sequence and models how the signature evolves. A gated recurrent unit maintains a hidden state $\mathbf{h}_t$ through an update gate $\mathbf{z}_t$ and a reset gate $\mathbf{r}_t$:

$$\mathbf{z}_t = \sigma(\mathbf{W}_z \mathbf{c}_t + \mathbf{U}_z \mathbf{h}_{t-1} + \mathbf{b}_z), \qquad \mathbf{r}_t = \sigma(\mathbf{W}_r \mathbf{c}_t + \mathbf{U}_r \mathbf{h}_{t-1} + \mathbf{b}_r),$$

$$\tilde{\mathbf{h}}_t = \tanh(\mathbf{W}_h \mathbf{c}_t + \mathbf{U}_h (\mathbf{r}_t \odot \mathbf{h}_{t-1}) + \mathbf{b}_h), \qquad \mathbf{h}_t = (1-\mathbf{z}_t)\odot \mathbf{h}_{t-1} + \mathbf{z}_t \odot \tilde{\mathbf{h}}_t .$$

With two gates instead of three, the unit carries roughly a quarter fewer parameters than an equivalent long short-term memory cell, which matters when labelled attack data are scarce and when inference must fit inside a sampling interval.

Not every step in the window is equally informative; a long stretch of normal operation usually surrounds a short attack segment. The attention layer scores each hidden state and forms a weighted summary,

$$e_t = \mathbf{v}^{\top} \tanh(\mathbf{W}_a \mathbf{h}_t + \mathbf{b}_a), \qquad \alpha_t = \frac{\exp(e_t)}{\sum_{s=1}^{T} \exp(e_s)}, \qquad \mathbf{c} = \sum_{t=1}^{T} \alpha_t \mathbf{h}_t ,$$

and the classifier maps $\mathbf{c}$ to class probabilities,

$$\hat{\mathbf{y}} = \mathrm{softmax}(\mathbf{W}_o \mathbf{c} + \mathbf{b}_o).$$

Training minimizes the cross-entropy between $\hat{\mathbf{y}}$ and the label, with dropout on the recurrent output and early stopping on a held-out split. At run time a window is flagged when the attack probability exceeds a threshold $\tau_d$; $\tau_d$ is set from the relative cost of a missed attack and a false alarm rather than fixed at 0.5.

Table 1. Stages of the detector, their function, and what the ablation shows when each is removed.
Stage Function Outcome when removed
1-D convolution Extracts short-window, cross-channel patterns that distinguish an injection from a load or photovoltaic swing Weakest deep configuration in the comparison; precision and F1 fall most under gradual injections
GRU Encodes how the signature evolves across the window and links successive injections Recall drops, most visibly for low-amplitude and slowly ramping manipulations
Attention Weights the time steps that actually carry the signature, suppressing long normal segments Largest single- stage loss of recall and F1 among the three components
Full model Joint spatial–temporal representation with learned temporal weighting —

Training and Evaluation Protocol

Attack samples are generated by simulating the distribution feeder with the storage unit in service and injecting fabricated values into the measurement channels, so that labels are exact. Normal data cover the operating range of the feeder: daily load profiles, varying photovoltaic output, charge and discharge cycles, and transformer tap positions. Injections vary in magnitude, onset time and duration, and five representative injection patterns are used to represent the space of plausible manipulations rather than a single template — the intent is to prevent the classifier from learning one attacker’s fingerprint.

Performance is reported through the confusion-matrix quantities

$$P = \frac{TP}{TP+FP}, \qquad R = \frac{TP}{TP+FN}, \qquad F_1 = \frac{2PR}{P+R},$$

together with overall accuracy. Recall deserves particular attention in this application: a missed injection leaves a corrupted state estimate in the control loop, whereas a false alarm costs an operator verification. Five models are compared under identical windows and splits — a convolutional network alone, a gated recurrent unit alone, a long short-term memory network, a conventional machine-learning classifier, and the full CNN–GRU–attention detector. Robustness is tested by adding measurement noise to the test set, and generalization by transferring the trained model to a second, differently sized test feeder without retraining on its attack samples.

Results: Where the Gain Comes From

All five models clear 90% accuracy on the test scenarios, so the informative part of the comparison is the separation between them rather than the absolute level. The full detector ranks first on accuracy, precision, recall and F1 in each of the five attack scenarios. The margin is widest where the injection is small relative to normal operating variation or ramps in slowly enough to resemble a load trend, and narrowest for abrupt, large-amplitude injections that any model can recognize. Averaged over scenarios, the improvement over the strongest single-model baseline reaches several percentage points in recall and F1, and the corresponding gains are also recorded in the percentage-point form used for reporting recall improvements.

The ablation supports the design logic. Each added stage improves every metric, the attention layer contributes the largest single gain, and the convolutional-only variant is the weakest of the deep models — consistent with the view that cross-channel correlation alone does not separate an injection from ordinary operating transients. The conventional classifier trails all deep models, which is expected given that hand-crafted features cannot represent the joint temporal structure of a window.

Under added measurement noise every model loses accuracy and the ranking is preserved, with the composite detector degrading least; the attention weights concentrate on the noisy segments that still carry the signature, so the loss is absorbed rather than propagated. On the second feeder, accuracy falls for all models because the load and generation statistics differ from the training feeder, but the composite model retains the lead, indicating that it has learned attack dynamics rather than feeder-specific constants. Reported goodness-of-fit statistics for the recurrent stage are close to 0.99, and the two-gate design keeps parameter count and inference time below the long short-term memory baseline, which matters for deployment inside a control cycle.

Deployment Constraints and Open Issues

The method assumes that labelled attack data can be produced by simulation. In practice an operator has no record of real injections, so the training distribution is a model of the threat rather than the threat itself; an adversary who knows the detector’s window length and channel set can shape an injection to fall below its sensitivity. Combining the classifier with physics-based residual checks and with plausibility rules on state of charge and converter limits therefore remains necessary — the learned detector complements model-based screening rather than replacing it.

Three further constraints shape field use. Class imbalance is severe, since attacks are rare events, so the decision threshold and the retraining schedule must be managed explicitly; a detector tuned for balanced test sets will over-alarm in service. Feeder reconfiguration, new storage connections and seasonal load shifts change the input distribution, and a model trained once will drift. Finally, an operator who acts on an alarm needs to know which measurements triggered it, and the attention weights provide a partial answer by pointing to the time steps and, indirectly, the channels that dominated the decision — a property that matters as much for operator trust as for detection accuracy.

Scroll to Top