An xlstm-linformer photovoltaic power generation power prediction method based on diffad data repair and abnormal feature enhancement
By combining the DiffAD and XLSTM-Linformer models, the problem of abnormal data processing in photovoltaic power generation prediction was solved, achieving accurate prediction and anomaly detection for photovoltaic power plants, and improving the model's adaptability and prediction accuracy.
Patent Information
- Application Number
- CN202510546991.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2026-11-03
AI Technical Summary
Existing photovoltaic power generation prediction models have shortcomings in handling abnormal data, resulting in decreased prediction accuracy and difficulty in accurately detecting and predicting abnormal operating conditions and future power of photovoltaic power plants.
By combining DiffAD and XLSTM-Linformer models, a photovoltaic power generation prediction model is constructed through data cleaning, anomaly detection and repair. DiffAD is used for data anomaly detection and repair, while XLSTM-Linformer model is used to extract local time series features and Linformer model is used to capture global features for photovoltaic power generation prediction.
It improves the accuracy and stability of photovoltaic power generation prediction, effectively detects anomalies, adapts to changes in different environmental factors, and enhances the model's generalization ability and prediction accuracy.
Smart Images

Figure SMS_1 
Figure SMS_2 
Figure SMS_3
Abstract
Description
[0001] This invention relates to the field of photovoltaic power generation technology, and in particular to an XLSTM-Linformer photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement.
[0002] The photovoltaic (PV) industry is a strategic emerging industry strongly supported by the state and receives key support from national industrial policies. In recent years, numerous supportive policies have been introduced for the PV industry, guiding its growth and development through measures such as guiding installed capacity, setting industry standards, providing financial subsidies, and offering preferential policies. As a renewable energy source, PV power generation plays a crucial role in the global energy structure transformation. Accurate PV power generation forecasting is of great significance for grid dispatching, electricity market trading, and energy storage system optimization. It can help grid operators rationally arrange power generation plans, improving grid stability and economic efficiency.
[0003] However, while the photovoltaic industry is developing rapidly, it is essential to ensure the safety of photovoltaic power generation. Outliers may appear in photovoltaic power generation data due to equipment malfunctions, data acquisition errors, and other reasons. These outliers can affect the accuracy of training and prediction results for photovoltaic power generation prediction models. Therefore, anomaly detection and cleaning of photovoltaic power generation data are crucial steps in improving prediction accuracy.
[0004] To improve the safety and stability of power systems, it is crucial to accurately detect abnormal operating conditions of photovoltaic (PV) power plants and predict their future power output and generation. The power generation efficiency of PV power plants is affected by various uncertainties, making power prediction challenging. Traditional methods have limitations when handling complex data and numerous outliers. Currently, there is an urgent need to develop an XLSTM-Linformer PV power prediction method based on DiffAD data repair and anomaly feature enhancement to improve prediction accuracy and anomaly detection capabilities. Summary of the Invention
[0005] In view of the problems existing in the construction methods for photovoltaic power generation prediction models, such as inadequate handling of outlier data and decreased prediction accuracy when data is missing, this invention has emerged. Therefore, this invention aims to solve the problem of how to construct a photovoltaic power generation prediction XLSTM-Linformer model and system that combines DiffAD technology.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] Firstly, this invention provides a method for constructing a photovoltaic power generation prediction model combining DiffAD and XLSTM-Linformer. The method includes: acquiring operational data and meteorological data from distributed photovoltaic power plants; data loading, cleaning, and normalization; using the DiffAD model to detect anomalies in the data; marking these outliers and performing data repair to improve data quality; marking the detected outliers as new features; integrating the repaired data and outlier features into a new dataset; dividing the dataset into training and test sets to complete dataset creation; then, based on this, constructing an XLSTM-Linformer model; training the model using the training set to obtain the trained model; saving the weights of the trained model to complete model training; inputting the test set into the trained model to obtain test results; and then evaluating the model using MAE, RMSE, and RMS based on the test results. 2 The model's performance was then evaluated. The model was then applied to photovoltaic power generation prediction, and the predicted data was compared and analyzed with the actual data.
[0008] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the operational data and meteorological data include meteorological parameters and electrical parameters; the meteorological parameters include wind speed, temperature, relative humidity, global horizontal radiation, diffuse horizontal radiation, wind direction, weather temperature, and weather relative humidity; the electrical parameters include average current phase value, active power, wind speed, weather temperature, weather relative humidity, global horizontal radiation, diffuse horizontal radiation, and wind direction, as well as historical photovoltaic power generation parameters. These parameters, after a series of processing steps by DiffAD, form training and testing sets, which are used as input to the XLSTM-Linformer model to improve the accuracy and stability of photovoltaic power generation prediction.
[0009] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the data preprocessing method is data normalization, and the data normalization formula is as follows:
[0010] In the formula, x(t) is the original data before normalization, x min It is the minimum value of the data, x max It is the maximum value of the data, x norm (x) is the normalized data.
[0011] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the data processing includes a point selection strategy based on density ratio, calculation of change fraction based on density ratio, and selection of observation points. The formula for calculating the window density ratio is as follows: g k (x)=f k-1 (x) / f k (x)
[0012] In the formula, f k f(x) is the estimated probability density of the (x)th window, f k-1(x) This is the estimated probability density of the (k-1)th window, and the formula for the change fraction is as follows:
[0013] In the formula, s represents the window length; g k (x) represents the window density ratio; the formula for calculating the probability of selecting an observation point is as follows:
[0014] In the formula, d i This represents the distance between point i and the last selected point; Represents the change fraction of the i-th window. This represents the average change score across all windows; the formula for calculating the average change score of a window is as follows:
[0015] In the formula, H represents the total number of windows.
[0016] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the observation points are selected from the top 10% of points with the highest probability, and the other points are used as mask points.
[0017] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the selected observation points and mask points are combined as input in the conditional weighted incremental diffusion model. The input combination method of the diffusion model is as follows:
[0018] In the formula, s is a binary sequence, x ob Let be the observation point, (1-s)⊙(·) be the value of the mask point, g(·) be the bitriangular interpolation function, and γ be the weighting function.
[0019] The reverse diffusion process, the estimated average value of the reverse process, the generation process, and the weighting function formula of the diffusion model are as follows: h(t-1)=N0e -λ(t-1)
[0020] In the formula, μ θ (·) represents the estimated average value of the reverse process. a is a fixed constant. t Let N be the state at time step t, N0 be the initial quantity, λ be the hyperparameter of the exponential decay constant, and z be a noise vector that follows a normal distribution.
[0021] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, a multi-scale S4 U-Net combined with a density ratio selection strategy is employed. The selected observation points and their corresponding true values serve as one of the input conditions for the multi-scale S4 based U-Net. U-Net learns the long-term dependencies and multi-scale features of time-series data through these observation points, thereby more accurately estimating missing values and imputed data. Combined with the conditional weighted incremental diffusion model, in the reverse diffusion process of the diffusion model, the multi-scale S4 based U-Net acts as a denoising neural network responsible for generating clean samples. It utilizes the observation point conditions and weighted information to gradually remove noise by capturing long-term dependencies and multi-scale features, generating high-quality imputed data, and then performing data anomaly detection.
[0022] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the detection criterion is to compare the anomaly score with a decision threshold, and the formulas for the anomaly score and the decision threshold are as follows:
[0023] In the formula, d represents the dimension of the multivariate time series. and For the estimated value and the true value, l(c) i ) represents the loss function value, l avg This is the average loss function.
[0024] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the detection criterion is that an anomaly score greater than the decision threshold is considered abnormal, otherwise it is considered normal.
[0025] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the abnormal scores of the data detected by the DiffAD model or the data after adding binary labels are retained. The abnormal detection results are integrated with the original data after data repair to form new input features. Then, a dataset is generated and randomly divided into a training set of 90% and a test set of 10%.
[0026] Secondly, this invention provides a method for constructing a photovoltaic power generation prediction model combining DiffAD and XLSTM-Linformer. The method includes acquiring operational data from distributed photovoltaic power plants and meteorological data; after anomaly detection using DiffAD, using anomaly labels as additional input features; combining these with the original time-series data after data repair to form new input features, which are then input into the XLSTM-Linformer model. In this way, the XLSTM model extracts local time-series features, using the output sequence as input to the Linformer model. Through the linearized attention mechanism of the Linformer, it further captures global feature sequence relationships, thus outputting a feature sequence that incorporates global dependencies. Then, the local time-series features output by the XLSTM and the global time-series features of the Linformer are weighted and fused or fused using an attention mechanism, and finally passed through a fully connected layer to obtain the final photovoltaic power generation prediction. When learning the temporal characteristics of time-series data, the XLSTM-Linformer model can simultaneously consider the abnormal states of the data, thereby better understanding the fluctuations and changes in the data and improving the accuracy and robustness of the prediction. The model is trained using data from the training set; then, the test set is used to obtain test results, based on MSE, RMSE, and R... 2 The model is evaluated, then applied to photovoltaic power generation prediction to obtain power prediction data, and the obtained power prediction data is compared and analyzed with the actual power data.
[0027] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, XLSTM aims to extract local temporal features. XLSTM mainly consists of sLSTM and mLSTM. sLSTM is a scalar memory LSTM designed to address the problem of unrepeatable storage decisions in LSTM. The core calculation formula of the sLSTM model is as follows: c t =f t ·c t-1 +i t ·z t nt =f t ·n t-1 +i t or
[0028] In the formula, c t It represents the state of the memory unit at the current time step. t i t z t These are the output of the forget gate, the output of the input gate, and the activation function of the input unit, n. t The normalized state is used for stable computation, h t It is in a hidden state, o t It is the output of the output gate. It is the hidden state after normalization, and the gating mechanism input gate i t Forgotten Gate t Using the exponential activation function, output gate o t Use the sigmoid activation function.
[0029] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, mLSTM is a matrix memory unit LSTM designed to improve storage capacity and parallel computing capabilities. The core calculation formula of the mLSTM model is as follows: n t =f t ·n t-1 +i t ·k t or
[0030] In the formula, C t It represents the state of the memory unit at the current time step. t i t This is the output of the forget gate and the input gate. t k t It is a value and key vector, n t It is a normalized state update, h t It is in a hidden state, o t It is the output of the output gate, qt It is a query vector. It is the normalized hidden state. At the same time, the gating mechanism of mLSTM is the same as that of sLSTM. The input gate and forget gate use the exponential activation function, and the output gate uses the sigmoid activation function.
[0031] As a preferred embodiment of the photovoltaic power prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, sLSTM blocks and mLSTM blocks are stacked using xLSTM blocks. The sLSTM blocks and mLSTM blocks are then embedded into residual blocks based on their respective designs. The sLSTM blocks include updates to the input gate, forget gate, output gate, and memory units, and use a post-projection structure to enhance nonlinear expressive power. The mLSTM blocks include updates to the matrix memory unit keys, value vectors, and query vectors, and use a pre-projection structure to adapt to high-dimensional space computation. The sLSTM blocks and mLSTM blocks are then stacked in a certain proportion. Each xLSTM block contains residual connections to facilitate gradient flow, thereby improving training stability.
[0032] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, Linformer improves efficiency for long-sequence data by reducing computational complexity. Linformer, through its optimized self-attention mechanism, aims to capture global features and long-term dependencies. The core calculation formula of the Linformer model is as follows:
[0033] In the formula, It is a linear transformation of the query matrix Q. It is a linear projection of the bond matrix. It is a linear projection of the value matrix, where the key and value matrices are simultaneously projected into a low-dimensional space of k×d.
[0034] In this way, the context mapping matrix The calculation becomes:
[0035] Then the context embedding is calculated as follows:
[0036] Linformer, based on the low-quality property of the attention matrix, can maintain performance through a low-rank approximation. Therefore, Linformer introduces E... i and F i This projectes the original key-value matrix into a lower-dimensional space, thereby reducing computational complexity and lowering the original self-attention complexity from O(n^2).2 The model is reduced to O(nk), where k is the projection dimension, and the model construction is completed.
[0037] Specifically, XLSTM extracts local features and short-term dependencies from time series data through its improved gating mechanism and memory structure, while Linformer captures global features and long-term dependencies using its optimized self-attention mechanism. The weights of the XLSTM and Linformer outputs are dynamically adjusted using an attention mechanism, and their outputs are then fused. The fused features are passed through a fully connected layer to obtain the final photovoltaic power generation prediction result. The trained model is then trained using data from the training set.
[0038] The trained model is then applied to photovoltaic power generation prediction to obtain prediction data. The predicted data is then compared and analyzed with the actual data to evaluate the model performance.
[0039] The test set is input into the trained model, and the model is evaluated based on the test results, using MAE, RMSE, and R. 2 To evaluate model performance, MAE, RMSE, R 2 The calculation formula is as follows:
[0040] In the formula, y i It is the actual value. This is the predicted value, and n is the number of data points.
[0041] Then, real-time monitoring data of the photovoltaic power station is acquired, and the data is cleaned and preprocessed. The processed data is then input into the trained XLSTM-Linformer model to obtain real-time photovoltaic power generation prediction data.
[0042] The beneficial effects of this invention are that it combines the DiffAD model with the XLSTM-Linformer model, enabling the overall model to perform well under different data characteristics and application scenarios, thus improving generalization ability. In photovoltaic power plants in different regions, facing varying environmental factors such as sunlight and temperature, the combined model can accurately predict photovoltaic power generation by adapting to changes in data characteristics, and effectively detect potential anomalies. Simultaneously, in photovoltaic data processing, it can not only analyze the trend of power data over time and the spatial characteristics of different locations, but also utilize the multi-scale analysis capabilities of DiffAD to deeply mine hidden patterns and anomalies in the data, thereby improving the accuracy of judging the operating status of the photovoltaic system. In photovoltaic power generation data, it can resolve situations where a large number of outliers occur due to equipment failure and data acquisition errors, thereby improving the accuracy of the training and prediction results of the photovoltaic power generation prediction model. Attached Figure Description
[0043] To make the technical solutions of the embodiments of the present invention easier to understand, the model flowcharts used to illustrate the technical details in the description of the embodiments will be introduced next. These model flowcharts only show some embodiments of the present invention. For those skilled in the art with conventional knowledge and skills, other drawings that can reflect the technical features of the present invention can be derived and obtained based on these existing model flowcharts without additional creative effort.
[0044] Figure 1 Flowchart of the construction method for the XLSTM-Linformer photovoltaic power generation prediction method used for DiffAD data repair and anomaly feature enhancement
[0045] Figure 2 Power prediction system architecture diagram
[0046] Figure 3 XLSTM architecture diagram
[0047] Figure 4 Linformer architecture diagram Detailed Implementation
[0048] To make the above-mentioned objects, features, and advantages of the present invention more readily understood, the specific embodiments of the present invention will be described in detail below. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without inventive effort should fall within the scope of protection of the present invention.
[0049] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art may make similar extensions without departing from the spirit of the invention.
[0050] S1: Acquire operational data and meteorological data from distributed photovoltaic power stations, including data loading, cleaning, and normalization. Utilize the DiffAD model for anomaly detection, labeling outliers and performing data repair to improve data quality. Mark detected outliers as new features, integrate the repaired data and outlier features into a new dataset, and divide the dataset into training and test sets. Then, build an XLSTM-Linformer model based on this dataset, train it using the training set, and save the model's weights. Input the test set into the trained model to obtain test results, and then evaluate the model using MAE, RMSE, and R... 2The model's performance was then evaluated. The model was then applied to photovoltaic power generation prediction to obtain predicted data, which was then compared and analyzed with actual data.
[0051] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the operating data and meteorological data include meteorological parameters and electrical parameters; the meteorological parameters include wind speed, temperature, relative humidity, global horizontal radiation, diffuse horizontal radiation, wind direction, weather temperature, and weather relative humidity, and the electrical parameters include average current phase value, active power, wind speed, weather temperature, weather relative humidity, global horizontal radiation, diffuse horizontal radiation, and wind direction.
[0052] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the data preprocessing method is data normalization, and the data normalization formula is as follows:
[0053] In the formula, x(t) is the original data before normalization, x min It is the minimum value of the data, x max It is the maximum value of the data, x norm (t) represents the normalized data.
[0054] Data processing includes dividing the time series data into windows during the observation point selection phase to facilitate the calculation of density ratios and fractional changes for selecting observation points. In the conditionally weighted increasing diffusion model, the observed value x... ob Bicubic interpolation is used to adjust the dimensionality to ensure it matches the initial state dimensionality, meeting the model input requirements and enabling the model to function correctly and accurately estimate missing values. The relevant calculation formulas are as follows: g k (x)=f k-1 (x) / f k (x)
[0055] In the formula, f k (x) is the estimated probability density of the k-th window, f k-1 (x) is the estimated probability density of the (k-1)th window, and the formula for the change fraction is as follows:
[0056] In the formula, s represents the window length; g k (x) represents the window density ratio; the formula for calculating the probability of selecting an observation point is as follows:
[0057] In the formula, di This represents the distance between point i and the last selected point; Represents the change fraction of the i-th window. This represents the average change score across all windows; the formula for calculating the average change score of a window is as follows:
[0058] In the formula, H represents the total number of windows. The observation points are selected from the top 10% of points with the highest probability, and the other points are used as mask points.
[0059] In the conditional weighted incremental diffusion model, the selected observation point and the mask point are combined as input. The input combination method of the diffusion model is as follows:
[0060] In the formula, s is a binary sequence, x ob Let be the observation point, (1-s)⊙(·) be the value of the mask point, g(·) be the bitriangular interpolation function, and γ be the weighting function.
[0061] S2: The reverse diffusion process, the estimated average value of the reverse process, the generation process, and the weighting function formula of the diffusion model are as follows: h(t-1)=N0e -λ(t-1)
[0062] In the formula, μ θ (·) represents the estimated average value of the reverse process. a is a fixed constant. t Let N be the state at time step t, N0 be the initial quantity, λ be the hyperparameter of the exponential decay constant, and z be a noise vector that follows a normal distribution.
[0063] S3: This approach combines U-Net with a density ratio selection strategy within the multi-scale S4 model. The selected observation points and their corresponding true values serve as one of the input conditions for the U-Net-based multi-scale S4 model. U-Net learns the long-term dependencies and multi-scale features of the time-series data through these observation points, thereby more accurately estimating missing values and imputed data. Combined with the conditional weighted incremental diffusion model, the multi-scale S4 model, based on U-Net, acts as a denoising neural network during the reverse diffusion process, responsible for generating clean samples. It utilizes the observation point conditions and weighted information to progressively remove noise by capturing long-term dependencies and multi-scale features, generating high-quality imputed data.
[0064] S4: The detection standard compares the anomaly score with a decision threshold. The formulas for the anomaly score and the decision threshold are as follows:
[0065] In the formula, d represents the dimension of the multivariate time series. and For the estimated value and the true value, l(c) i ) represents the loss function value, l avg This is the average loss function.
[0066] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, the detection criterion is that an anomaly score greater than a decision threshold is considered an anomaly, otherwise it is considered normal. Subsequently, the detected anomalies are marked as new features, and the repaired data and the anomaly features are integrated into a new dataset to complete the dataset generation.
[0067] S5: Construct an XLSTM-Linformer model as a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention. XLSTM aims to extract local time-series features. XLSTM mainly consists of sLSTM and mLSTM. sLSTM is a scalar memory unit LSTM designed to solve the problem of unrepeatable storage decisions in LSTM. The core calculation formula of the sLSTM model is as follows: c t =f t ·c t-1 +i t ·z t n t =f t ·n t-1 +i t or
[0068] In the formula, c t It represents the state of the memory unit at the current time step. t i t z t These are the output of the forget gate, the output of the input gate, and the activation function of the input unit, n. t The normalized state is used for stable computation, h t It is in a hidden state, o t It is the output of the output gate. It is the hidden state after normalization, and the gating mechanism input gate i t Forgotten Gate tUsing the exponential activation function, output gate o t Use the sigmoid activation function.
[0069] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, mLSTM is a matrix memory unit LSTM designed to improve storage capacity and parallel computing capabilities. The core calculation formula of the mLSTM model is as follows: n t =f t ·n t-1 +i t ·k t or
[0070] In the formula, C t It represents the state of the memory unit at the current time step. t i t This is the output of the forget gate and the input gate. t k t It is a value and key vector, n t It is a normalized state update, h t It is in a hidden state, o t It is the output of the output gate, q t It is a query vector. It is the normalized hidden state. At the same time, the gating mechanism of mLSTM is the same as that of sLSTM. The input gate and forget gate use the exponential activation function, and the output gate uses the sigmoid activation function.
[0071] As a preferred embodiment of the photovoltaic power generation prediction model construction method combining DiffAD and XLSTM-Linformer described in this invention, Linformer improves the efficiency of processing long-sequence data by reducing computational complexity. Linformer, through its optimized self-attention mechanism, aims to capture global features and long-term dependencies. The core calculation formula of the Linformer model is as follows:
[0072] In the formula, It is a linear transformation of the query matrix Q. It is a linear projection of the bond matrix. It is a linear projection of the value matrix, where the key and value matrices are simultaneously projected into a low-dimensional space of k×d.
[0073] In this way, the context mapping matrix The calculation becomes:
[0074] Then the context embedding is calculated as follows:
[0075] Linformer, based on the low-quality property of the attention matrix, can maintain performance through a low-rank approximation. Therefore, Linformer introduces E... i and F i This projectes the original key-value matrix into a lower-dimensional space, thereby reducing computational complexity and lowering the original self-attention complexity from O(n^2). 2 The model is reduced to O(nk), where k is the projection dimension, and the model construction is completed.
[0076] Specifically, XLSTM extracts local features and short-term dependencies from time series data through its improved gating mechanism and memory structure, while Linformer captures global features and long-term dependencies using its optimized self-attention mechanism. The weights of the XLSTM and Linformer outputs are dynamically adjusted using an attention mechanism, and their outputs are then fused. The fused features are passed through a fully connected layer to obtain the final photovoltaic power generation prediction result. The trained model is then trained using data from the training set.
[0077] S6: Apply the trained model to predict photovoltaic power generation, obtain predicted data, and compare and analyze the predicted data with the actual data to evaluate the model performance.
[0078] The test set is input into the trained model, and the model is evaluated based on the test results, using MAE, RMSE, and R. 2 To evaluate model performance, MAE, RMSE, R 2 The calculation formula is as follows:
[0079] In the formula, y i It is the actual value. This is the predicted value, and n is the number of data points.
[0080] S7: Obtain real-time monitoring data of photovoltaic power plants, perform data cleaning and preprocessing, and input the processed data into the trained XLSTM-Linformer model to obtain real-time photovoltaic power generation prediction data.
[0081] The beneficial effects of this invention are that it combines the DiffAD model with the XLSTM-Linformer model, enabling the overall model to perform well under different data characteristics and application scenarios, thus improving generalization ability. In photovoltaic power plants in different regions, facing varying environmental factors such as sunlight and temperature, the combined model can accurately predict photovoltaic power generation by adapting to changes in data characteristics, and effectively detect potential anomalies. Simultaneously, in photovoltaic data processing, it can not only analyze the trend of power data over time and the spatial characteristics of different locations, but also utilize the multi-scale analysis capabilities of DiffAD to deeply mine hidden patterns and anomalies in the data, thereby improving the accuracy of judging the operating status of the photovoltaic system. In photovoltaic power generation data, it can resolve situations where a large number of outliers occur due to equipment failure and data acquisition errors, thereby improving the accuracy of the training and prediction results of the photovoltaic power generation prediction model.
Claims
1. A photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement using XLSTM-Linformer, characterized in that: This process includes: acquiring operational data from distributed photovoltaic power stations and meteorological data; data loading, cleaning, and normalization; using the DiffAD model to detect anomalies; labeling these outliers and performing data repair to improve data quality; marking detected outliers as new features; integrating the repaired data and outlier features into a new dataset; dividing the dataset into training and test sets; constructing an XLSTM-Linformer model based on this dataset; training the model using the training set; saving the weights of the trained model; inputting the test set into the trained model to obtain test results; and then evaluating the model using MAE, RMSE, and RMS metrics. 2 To evaluate the model's performance, the model was then applied to predict photovoltaic power generation, and the predicted data was compared and analyzed with the actual data. The data preprocessing method is data normalization, and the data normalization formula is as follows: In the formula, x(t) is the original data before normalization, x min It is the minimum value of the data, x max It is the maximum value of the data, x norm (t) represents the normalized data; Data processing includes a density ratio-based point selection strategy, which selects data observation points based on the change fraction calculated using the density ratio. The formula for calculating the window density ratio is as follows: g k (x)=f k-1 (x) / f k (x) In the formula, f k (x) is the estimated probability density of the k-th window, f k-1 (x) is the estimated probability density of the (k-1)th window, and the formula for the change fraction is as follows: In the formula, s represents the window length; g k (x) represents the window density ratio; the formula for calculating the probability of selecting an observation point is as follows: In the formula, d i This represents the distance between point i and the last selected point; Represents the change fraction of the i-th window. This represents the average change score across all windows; the formula for calculating the average change score of a window is as follows: In the formula, H represents the total number of windows; The observation points are selected from the top 10% of the points with the highest probability, and the other points are used as mask points. In the conditional weighted incremental diffusion model, the selected observation point and the mask point are combined as input. The input combination method of the diffusion model is as follows: In the formula, s is a binary sequence, x ob Let be the observation point, (1-s)⊙(·) be the value of the mask point, g(·) be the bitriangular interpolation function, and γ be the weighting function; The reverse diffusion process, the average value of the reverse estimation process, the weighting function, and the generation process formula of the diffusion model are as follows: h(t-1)=N0e -λ(t-1) In the formula, μ θ (·) represents the estimated average value of the reverse process. a is a fixed constant. t Let N be the state at time step t, N0 be the initial quantity, λ be the hyperparameter of the exponential decay constant, and z be a noise vector that follows a normal distribution. This approach combines a multi-scale S4-based U-Net with a density ratio selection strategy. The selected observation points and their corresponding true values serve as one of the input conditions for the multi-scale S4-based U-Net. U-Net learns the long-term dependencies and multi-scale features of the time series data through these observation points, thereby more accurately estimating missing values and imputed data. Combined with a conditional weighted incremental diffusion model, the multi-scale S4-based U-Net acts as a denoising neural network during the reverse diffusion process of the diffusion model, responsible for generating clean samples. It utilizes the observation point conditions and weighted information to progressively remove noise by capturing long-term dependencies and multi-scale features, generating high-quality imputed data for anomaly detection. The final detection criterion is to compare the anomaly score with a decision threshold. The formulas for the anomaly score and the decision threshold are as follows: In the formula, d represents the dimension of the multivariate time series. and For the estimated value and the true value, l(c) i ) represents the loss function value, l avg The average loss function; The detection standard is that an anomaly score greater than the decision threshold is considered abnormal, otherwise it is considered normal. Specifically, the abnormal scores of the data at each time point detected by the DiffAD model or the data after adding binary labels are retained. The abnormal detection results are concatenated with the original data after data repair to form new input features. Then, a dataset is generated and randomly divided into 90% as the training set and 10% as the test set.
2. The XLSTM-Linformer photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement as described in claim 1, characterized in that: Operational data and meteorological data from distributed photovoltaic (PV) power plants are acquired. After DiffAD anomaly detection, anomaly labels are used as additional input features. These, along with the original time-series data after data restoration, form new input features. The dataset is then divided into training and test sets. The training set is input into the XLSTM-Linformer model. The XLSTM model extracts local time-series features, using the output sequence as input to the Linformer model. Through the Linformer's linearized attention mechanism, it further captures global feature sequence relationships, resulting in a feature sequence that incorporates global dependencies. The local time-series features from the XLSTM and the global time-series features from the Linformer are then weighted and fused, or fused using an attention mechanism, before being passed through a fully connected layer to obtain the final PV power prediction. The XLSTM-Linformer model, when learning the temporal features of time-series data, can simultaneously consider data anomalies, thus better understanding data fluctuations and change patterns, improving prediction accuracy and robustness. After model training, the test set is input into the trained model, and the results are evaluated based on MSE, RMSE, and R... 2 The model is evaluated and tested, then applied to photovoltaic power generation prediction to obtain the predicted power. Finally, the predicted power data is compared and analyzed with the actual power data.
3. The XLSTM-Linformer photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement as described in claim 2, characterized in that: The dataset includes a training set and a test set, and the dataset is randomly divided into a training set of 90% and a test set of 10%.
4. The XLSTM-Linformer photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement as described in claim 3, characterized in that: XLSTM aims to extract local temporal features. XLSTM mainly consists of sLSTM and mLSTM. sLSTM is a scalar memory LSTM designed to address the problem of unrepeatable storage decisions in LSTM. The core calculation formula of the sLSTM model is as follows: c t =f t ·c t-1 +i t ·z t n t =f t ·n t-1 +i t In the formula, c t It represents the state of the memory unit at the current time step. t i t z t These are the output of the forget gate, the output of the input gate, and the activation function of the input unit, n. t The normalized state is used for stable computation, h t It is in a hidden state, o t It is the output of the output gate. It is the hidden state after normalization, and the gating mechanism input gate i t Forgotten Gate t Using the exponential activation function, output gate o t Use the sigmoid activation function; mLSTM is a matrix-memory LSTM designed to improve storage capacity and parallel computing capabilities. The core calculation formula of the mLSTM model is as follows: n t =f t ·n t-1 +i t ·k t In the formula, C t It represents the state of the memory unit at the current time step. t i t This is the output of the forget gate and the input gate. t k t It is a value and key vector, n t It is a normalized state update, h t It is in a hidden state, o t It is the output of the output gate, q t It is a query vector. It is the normalized hidden state. At the same time, the gating mechanism of mLSTM is the same as that of sLSTM. The input gate and forget gate use the exponential activation function, and the output gate uses the sigmoid activation function. XLSTM blocks are stacked to form sLSTM and mLSTM blocks. The sLSTM and mLSTM blocks are then embedded into residual blocks based on their respective designs. The sLSTM blocks include updates to the input gate, forget gate, output gate, and memory cells, using a back-projection structure to enhance nonlinear expressive power. The mLSTM blocks include updates to the matrix memory cell keys, value vectors, and query vectors, using a front-projection structure to adapt to computation in high-bit space. The sLSTM and mLSTM blocks are then stacked in a certain proportion. Each XLSTM block contains residual connections to help gradient flow, thereby improving training stability. Linformer improves efficiency for long sequence data by reducing computational complexity. Through its optimized self-attention mechanism, Linformer aims to capture global features and long-term dependencies. The core computational formula of the Linformer model is as follows: In the formula, It is a linear transformation of the query matrix Q. It is a linear projection of the bond matrix. It is a linear projection of the value matrix, where the key and value matrices are simultaneously projected into a low-dimensional space of k×d. In this way, the context mapping matrix The calculation becomes: Then the context embedding is calculated as follows: Linformer, based on the low-quality property of the attention matrix, can maintain performance through a low-rank approximation. Therefore, Linformer introduces E... i and F i This projectes the original key-value matrix into a lower-dimensional space, thereby reducing computational complexity and lowering the original self-attention complexity from O(n^2). 2 The model construction is completed by reducing the cost to O(nk), where k is the projection dimension. In this process, XLSTM extracts local features and short-term dependencies from time series data through its improved gating mechanism and memory structure, while Linformer captures global features and long-term dependencies using its optimized self-attention mechanism. The weights of the XLSTM and Linformer outputs are dynamically adjusted using an attention mechanism, and their outputs are then fused. The fused features are passed through a fully connected layer to obtain the final photovoltaic power generation prediction result. The trained model is then trained using data from the training set.
5. The trained model is then applied to photovoltaic power generation prediction to obtain prediction data. The predicted data is then compared and analyzed with the actual data to evaluate the model performance. The test set is input into the trained model, and the model is evaluated based on the test results using MAE, RMSE, and R. 2 To evaluate model performance, MAE, RMSE, R 2 The calculation formula is as follows: In the formula, y i It is the actual value. This is the predicted value, and n is the number of data points.
6. Then, real-time monitoring data of the photovoltaic power station is acquired, and the data is cleaned and preprocessed. The processed data is then input into the trained XLSTM-Linformer model to obtain real-time photovoltaic power generation prediction data.
7. The XLSTM-Linformer photovoltaic power generation prediction method based on DiffAD data repair and anomaly feature enhancement as described in claim 5, characterized in that: This approach enables the overall model to perform well under different data characteristics and application scenarios, enhancing its generalization ability. In photovoltaic power plants across different regions, facing varying environmental factors such as sunlight and temperature, the combined model can accurately predict photovoltaic power generation by adapting to changes in data characteristics, and effectively detect potential anomalies. Furthermore, in photovoltaic data processing, it can not only analyze the time-varying trends of power data and the spatial characteristics of different locations, but also utilize DiffAD's multi-scale analysis capabilities to deeply uncover hidden patterns and anomalies in the data, thereby improving the accuracy of judging the operating status of the photovoltaic system. In photovoltaic power generation data, it can address situations where a large number of outliers occur due to equipment failures or data acquisition errors, thus improving the accuracy of the photovoltaic power generation prediction model's training and prediction results.
8. A system for constructing an XLSTM-Linformer photovoltaic power prediction method based on DiffAD data repair and anomaly feature enhancement, based on the XLSTM-Linformer photovoltaic power prediction method based on DiffAD data repair and anomaly feature enhancement as described in any one of claims 1 to 7, characterized in that: include, The acquisition module is used to acquire operational data and meteorological data from distributed photovoltaic power stations, as well as data loading, cleaning, and normalization. The analysis module is used to analyze the data. Specifically, it includes using the DiffAD model to detect anomalies in the data, marking these outliers and performing data repair to improve data quality, marking the detected outliers as a new feature, integrating the repaired data and outlier features into a new dataset, dividing the dataset into training and test sets, and completing the creation of the dataset. The building module is used to build the XLSTM-Linformer model, train the model using the training set, obtain the trained model, save the weights of the trained model, and complete the model building process. The evaluation module is used to evaluate model performance, testing the model performance using a test set and measuring MAE, RMSE, and R. 2 To evaluate model performance; The prediction module is used to predict real-time photovoltaic power generation using a model. It applies the model to predict real-time photovoltaic power generation to obtain real-time power prediction data, and then compares and analyzes the obtained real-time power prediction data with the actual power data.
