Data Anomaly Detection Method for Solar Inverter Data Based on Improved Residual Network

In recent years, the rapid expansion of photovoltaic (PV) systems has highlighted the critical need for reliable and efficient anomaly detection methods to ensure operational stability. Solar inverters, as core components of PV systems, are prone to various anomalies such as sensor malfunctions, internal damage, and external intrusions, which can lead to significant performance degradation or system failures. Traditional anomaly detection approaches often rely on time-series analysis, but these methods may struggle with capturing complex temporal dependencies and subtle patterns in solar inverter data. To address these limitations, this paper proposes a novel anomaly detection framework that integrates Markov Transition Fields (MTF) for data transformation and an enhanced Residual Network (SCCB-ResNet50) for feature extraction and classification. By converting time-series data into two-dimensional images, the MTF approach amplifies feature representation, while the improved residual network leverages attention mechanisms and optimized training strategies to enhance detection accuracy. This method aims to provide a robust solution for identifying anomalies in solar inverter data, contributing to the maintenance and reliability of PV systems.

The proposed methodology begins with preprocessing historical power time-series data from solar inverters using Markov Transition Fields. This transformation partitions the data into a grid of transition probabilities, effectively increasing the number of feature points and improving the model’s ability to discern abnormal patterns. The resulting images are then fed into the SCCB-ResNet50 model, which incorporates Convolutional Block Attention Modules (CBAM), an advanced Stochastic Gradient Descent (SGD) optimizer, and a cosine annealing learning rate scheduler. These enhancements help the network focus on relevant features, accelerate convergence, and avoid local optima during training. Extensive experiments on a public dataset from the Desert Knowledge Australia Solar Centre (DKASC) demonstrate that our approach outperforms existing methods like GANomaly, LSTM, and ConvLSTM in terms of AUC, recall, and accuracy. The results validate the effectiveness of the proposed framework in detecting anomalies in solar inverter data, thereby supporting the secure operation of grid-connected PV systems.

Solar inverters play a pivotal role in converting DC power generated by PV panels into AC power for grid integration. Any anomalies in these devices can lead to inefficiencies, safety hazards, or complete system shutdowns. Common issues include sensor errors, inverter failures, and environmental obstructions, which necessitate continuous monitoring and timely detection. While previous studies have explored image-based and data-driven techniques, many focus on external factors or simplistic time-series models, often overlooking the intricate internal dynamics of solar inverters. This research bridges that gap by combining Markov-based image transformation with a deep learning model tailored for anomaly detection. The following sections detail the methodology, experimental setup, and results, highlighting the contributions of this work to the field of solar energy systems.

Markov Transition Field for Data Transformation

The Markov Transition Field (MTF) is a powerful technique for converting time-series data into two-dimensional images by leveraging the principles of Markov chains and transition matrices. This transformation captures the temporal dependencies and transition patterns in solar inverter data, enhancing the feature set for subsequent analysis. Given a time-series sequence \( X = \{x_1, x_2, \ldots, x_n\} \), where each \( x_t \) represents the power output of a solar inverter at time \( t \), the MTF construction involves several steps. First, the data is discretized into quantile bins to handle continuous values. Let \( Q = \{q_1, q_2, \ldots, q_k\} \) denote these bins, where each \( x_t \) is assigned to a bin based on its value relative to the distribution. The Markov transition matrix \( A \) is then computed, where each element \( A_{ij} \) represents the probability of transitioning from bin \( i \) to bin \( j \), as defined by:

$$ A_{ij} = P(x_t \in q_j | x_{t-1} \in q_i) $$

This matrix encapsulates the stochastic properties of the time series. To form the MTF, an \( n \times n \) matrix \( M \) is constructed, where each element \( M_{kl} \) corresponds to the transition probability between the quantile bins of \( x_k \) and \( x_l \). Specifically:

$$ M_{kl} = A_{q_k q_l} $$

Here, \( q_k \) and \( q_l \) are the quantile bins for \( x_k \) and \( x_l \), respectively. The MTF matrix \( M \) is expressed as:

$$ M = \begin{bmatrix}
A_{q_1 q_1} & A_{q_1 q_2} & \cdots & A_{q_1 q_n} \\
A_{q_2 q_1} & A_{q_2 q_2} & \cdots & A_{q_2 q_n} \\
\vdots & \vdots & \ddots & \vdots \\
A_{q_n q_1} & A_{q_n q_2} & \cdots & A_{q_n q_n}
\end{bmatrix} $$

Each element \( M_{kl} \) signifies the probability of the solar inverter’s power output transitioning from the state at time \( k \) to the state at time \( l \). By visualizing this matrix as an image, where probabilities are mapped to colors, the MTF provides a rich, structured representation of the time-series data. This approach increases the number of feature points from \( n \) in the original sequence to \( n \times n \) in the image, thereby improving the discriminative power for anomaly detection. Compared to other transformation methods like Gramian Angular Fields, MTF offers better noise resilience by emphasizing significant transition patterns and reducing the impact of sporadic fluctuations caused by weather variations or measurement errors in solar inverter data.

For practical implementation, the power data from solar inverters is aggregated hourly to mitigate short-term volatility. For instance, if the original data is sampled every 5 minutes, 12 samples per hour are averaged to form a single data point. This results in a 24-hour sequence for each day, which is transformed into a 24×24 MTF image. The color mapping of probabilities highlights transitions, making anomalies more distinguishable. This transformation is crucial for preparing the input for deep learning models, as it converts temporal patterns into spatial features that convolutional neural networks can effectively process.

Improved Residual Network (SCCB-ResNet50)

The core of the anomaly detection framework is the SCCB-ResNet50 model, an enhanced version of the ResNet-50 architecture. Residual networks are chosen for their ability to mitigate vanishing gradient problems in deep networks, thanks to skip connections that allow gradients to flow directly through layers. However, standard ResNet-50 may suffer from attention dispersion and suboptimal convergence in complex tasks like anomaly detection for solar inverters. To address these issues, SCCB-ResNet50 incorporates three key modifications: Convolutional Block Attention Modules (CBAM), an improved SGD optimizer, and a cosine annealing learning rate scheduler.

The ResNet-50 architecture consists of multiple residual blocks, including Conv Block (BTNK1) and Identity Block (BTNK2). The Conv Block reduces dimensionality via 1×1 convolutions, applies 3×3 convolutions for feature extraction, and then restores dimensions with another 1×1 convolution. The Identity Block maintains dimensions and adds the input directly to the output. In SCCB-ResNet50, CBAM is integrated into the second convolutional layer of specific residual blocks to enhance feature selection. CBAM combines channel and spatial attention mechanisms. The channel attention module computes weights by applying global average and max pooling, followed by shared fully connected layers and a sigmoid activation:

$$ M_c(F) = \sigma(W_1(W_0(F_{avg})) + W_1(W_0(F_{max}))) $$

where \( F \) is the input feature map, \( F_{avg} \) and \( F_{max} \) are pooled features, \( W_0 \) and \( W_1 \) are fully connected layers, and \( \sigma \) is the sigmoid function. The spatial attention module concatenates max and average pooled features along the channel dimension, processes them with a 7×7 convolution, and applies sigmoid:

$$ M_s(F) = \sigma(f^{7×7}([F_{avg}; F_{max}])) $$

The output is obtained by multiplying the input with these attention maps. This allows the network to focus on informative regions and channels in the solar inverter data images, improving feature representation.

The optimizer is enhanced with momentum and adaptive learning rates. The update rules for the improved SGD are as follows. First, the gradient \( g_t \) of the loss function \( f(w_t) \) with respect to parameters \( w_t \) at iteration \( t \) is computed:

$$ g_t = \nabla f(w_t) $$

Then, the first momentum \( m_t \) and second momentum \( v_t \) are updated using decay factors \( \beta_1 \) and \( \beta_2 \):

$$ m_t = \beta_1 \cdot m_{t-1} + (1 – \beta_1) \cdot g_t $$
$$ v_t = \beta_2 \cdot v_{t-1} + (1 – \beta_2) \cdot g_t^2 $$

The descent gradient \( n_t \) is calculated by scaling the first momentum with the square root of the second momentum, adjusted by a learning rate \( \alpha \):

$$ n_t = \alpha \cdot \frac{m_t}{\sqrt{v_t} + \epsilon} $$

where \( \epsilon \) is a small constant to prevent division by zero. Parameters are updated as:

$$ w_{t+1} = w_t – n_t $$

This approach reduces oscillations and accelerates convergence. Additionally, the cosine annealing scheduler adjusts the learning rate \( \eta_t \) during training:

$$ \eta_t = \eta_{\min} + \frac{1}{2} (\eta_{\max} – \eta_{\min}) \left(1 + \cos\left(\frac{T_{\text{cur}}}{T_i} \pi\right)\right) $$

where \( \eta_{\min} \) and \( \eta_{\max} \) are the minimum and maximum learning rates, \( T_{\text{cur}} \) is the current epoch, and \( T_i \) is the total epochs for the current restart. This strategy helps escape local minima and improves generalization for solar inverter anomaly detection.

Experimental Design and Setup

To evaluate the proposed method, experiments were conducted using the DKASC dataset, which contains historical power data from solar inverters collected between January 1, 2016, and January 1, 2021. The data includes power output measurements at 5-minute intervals, along with timestamps. Anomalies in the dataset are labeled based on incidents such as sensor failures, inverter damage, obstructions, and panel defects. For preprocessing, hourly averages were computed from the 5-minute data to reduce noise and align with diurnal patterns, resulting in 24 data points per day. Each day’s sequence was transformed into a 24×24 MTF image, generating a dataset of images labeled as normal or anomalous.

The dataset was split into training, validation, and test sets with a ratio of 70:15:15. The model was implemented in Python 3.8 using PyTorch, and training was performed on a system with an NVIDIA 2080Ti GPU and Xeon E5-2678W v4 CPU. The initial learning rate was set to \( 2 \times 10^{-3} \), with \( \beta_1 = 0.9 \) and \( \beta_2 = 0.99 \) for the improved SGD optimizer. The cosine annealing scheduler was configured with \( T_i = 10 \) epochs per restart. The CBAM modules were inserted into the S4 stage of ResNet-50 based on ablation studies to balance performance and computational efficiency. The network was trained for 200 epochs with a batch size of 32.

Evaluation metrics included Area Under the ROC Curve (AUC), Recall, and Accuracy, defined as:

$$ \text{Accuracy} = \frac{TP + TN}{TP + FP + FN + TN} $$
$$ \text{Recall} = \frac{TP}{TP + FN} $$
$$ \text{FPR} = \frac{FP}{FP + TN}, \quad \text{TPR} = \frac{TP}{TP + FN} $$

where TP, TN, FP, and FN represent true positives, true negatives, false positives, and false negatives, respectively. AUC is computed from the ROC curve plotting TPR against FPR.

Ablation Studies

Ablation experiments were conducted to assess the impact of individual components in SCCB-ResNet50. The baseline ResNet-50 model was incrementally enhanced with CBAM, improved SGD, and cosine annealing. The placement of CBAM was varied across residual blocks, and performance was measured using accuracy. The results are summarized in the table below:

Component AUC (%) Recall (%) Accuracy (%)
ResNet-50 (Baseline) 93.0 76.8 92.0
+ CBAM 94.5 79.8 94.5
+ Improved SGD 94.0 80.3 94.3
+ Cosine Annealing 95.1 80.8 94.9
Full SCCB-ResNet50 95.8 81.5 96.0

The table shows that each addition improves performance, with the full model achieving the highest scores. Specifically, CBAM enhances feature focus, improved SGD stabilizes training, and cosine annealing aids convergence. Compared to using only channel or spatial attention, CBAM provides a synergistic boost, as seen in the following table:

Attention Mechanism AUC (%) Recall (%) Accuracy (%)
Channel Attention Only 95.0 80.7 94.8
Spatial Attention Only 94.7 80.3 94.3
CBAM (Full) 95.8 81.5 96.0

These results confirm the effectiveness of the proposed modifications for solar inverter data anomaly detection.

Comparative Experiments

The proposed method was compared against three state-of-the-art anomaly detection techniques: GANomaly, LSTM, and ConvLSTM. All models were trained and tested on the same DKASC dataset under identical conditions. The ROC curves were plotted, and AUC values were calculated. The results demonstrate that SCCB-ResNet50 with MTF transformation achieves superior performance, as shown in the table below:

Model AUC (%) Recall (%) Accuracy (%)
GANomaly 61.1 50.0 80.0
LSTM 83.8 72.0 85.0
ConvLSTM 91.2 77.0 81.5
Proposed Method 95.8 81.5 96.0

The proposed method outperforms others by significant margins, with a 4.6% improvement in AUC over ConvLSTM. Additionally, when MTF is replaced with Gramian Angular Fields (GAF) in the same framework, performance drops, highlighting MTF’s advantage in handling solar inverter data:

Transformation Method AUC (%) Recall (%) Accuracy (%)
GAF + SCCB-ResNet50 95.3 81.1 95.2
MTF + SCCB-ResNet50 95.8 81.5 96.0

This underscores MTF’s robustness against noise and its ability to capture essential transition patterns in solar inverter data.

Anomaly Detection Testing

To validate practical applicability, the trained model was tested on specific days with known anomalies. For example, on September 24, 2020, obstruction caused abnormal power outputs, and on November 24, 2020, an inverter short-circuit led to deviations. The model generated anomaly scores, and a threshold of 0.8 was set for alert triggering. The scores for these days exceeded the threshold, correctly identifying anomalies, while other methods like LSTM and ConvLSTM showed lower scores or missed detections. This demonstrates the model’s reliability in real-world scenarios for solar inverter monitoring.

Conclusion

This paper presents a comprehensive anomaly detection framework for solar inverter data, combining Markov Transition Fields for data transformation and an improved residual network for classification. The MTF approach effectively converts time-series data into images, enriching feature representation and enhancing model discriminability. The SCCB-ResNet50 model incorporates attention mechanisms, an advanced optimizer, and a dynamic learning rate scheduler to improve accuracy and convergence. Experimental results on the DKASC dataset confirm that the proposed method achieves state-of-the-art performance in AUC, recall, and accuracy compared to existing techniques. Future work could explore extending this approach to multi-variable time-series data or integrating it with real-time monitoring systems for proactive maintenance of solar inverters. By ensuring the reliability of solar inverters, this research contributes to the overall stability and efficiency of photovoltaic power generation.

Scroll to Top