A rural mobile energy storage load prediction error compensation optimization system and method

By constructing a Transformer-based time-series forecasting model and multiple error compensation models, the problem of large forecasting errors in rural electricity load has been solved, achieving high-precision and stable load forecasting, and improving the safety of power grid operation and the capacity for renewable energy absorption.

CN122173962APending Publication Date: 2026-06-09WEIHAI POWER SUPPLY COMPANY OF STATE GRID SHANDONG ELECTRIC POWER COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WEIHAI POWER SUPPLY COMPANY OF STATE GRID SHANDONG ELECTRIC POWER COMPANY
Filing Date
2026-03-09
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing technologies are insufficient for accurately predicting the diverse electricity loads in rural areas. In particular, the load prediction error is large due to the volatility and seasonality of distributed renewable energy output, which affects the safe and stable operation of the power grid and the absorption of renewable energy.

Method used

We employ a Transformer-based time series prediction model combined with BiLSTM, GRU, and XGBoost error models. Through multi-dimensional dataset construction, DBSCAN anomaly detection, Lagrange interpolation, and data normalization, we construct multi-type error prediction models. Finally, we select the optimal error compensation model through LA-Kmeans clustering to achieve accurate compensation for prediction errors.

Benefits of technology

It has improved the accuracy of rural energy load forecasting, enhanced the model's adaptability and stability in complex scenarios, and achieved high-precision forecasting and intelligent error compensation for electricity load in multiple rural scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173962A_ABST
    Figure CN122173962A_ABST
Patent Text Reader

Abstract

This invention discloses a rural mobile energy storage load forecasting error compensation optimization system and method, relating to the field of mobile energy storage regulation technology. The invention collects electricity load, power generation, and meteorological data from typical rural scenarios to construct a multi-dimensional dataset covering the entire year. After outlier identification, missing value imputation, and normalization, a feature matrix is ​​formed. A time-series forecasting model based on the Transformer architecture is constructed for training and validation to obtain initial load forecasts and their corresponding forecast error sequences. Multiple error forecasting models are constructed in parallel to independently predict the error sequences. After pairing and interpolating the actual error sequences with the predicted values ​​of each model by time, cluster analysis is performed in two-dimensional space based on their distance from the ideal decision line. The optimal error forecasting model is dynamically selected, and the optimal error compensation value is determined to obtain the final load forecast after error compensation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mobile energy storage regulation technology, specifically to a rural mobile energy storage load prediction error compensation optimization system and method. Background Technology

[0002] The electricity consumption structure in rural areas is becoming increasingly diversified, and the penetration rate of distributed renewable energy is increasing year by year, which puts forward higher requirements for the operation, regulation and planning of the power distribution network. Typical electricity consumption scenarios in rural areas cover a variety of load types, including residential life, agricultural irrigation, aquaculture and electric vehicle charging. At the same time, they are significantly affected by the output of distributed generation such as photovoltaic and wind power and meteorological conditions, exhibiting strong fluctuations, intermittency and seasonality.

[0003] Accurate forecasting of rural power load is a key technological support for ensuring the safe and stable operation of rural power grids, promoting the consumption of new energy sources, and improving the quality of power supply. Summary of the Invention

[0004] The purpose of this invention is to provide a rural mobile energy storage load prediction error compensation optimization system and method to solve the problems raised in the prior art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for optimizing rural mobile energy storage load forecasting errors, the method comprising the following steps: Step S100: Collect feature data of typical rural scenes, including load data, power generation data, and meteorological data, and construct a multi-dimensional dataset covering a complete year to include seasonal features; divide the collected feature data into training and validation sets according to time order, and use the DBSCAN algorithm to identify and mark abnormal data points; fill in missing data points using Lagrange interpolation polynomials; and perform min-max normalization on data of different dimensions as the basis for subsequent time series prediction. Step S101: Collect electricity load data, power generation data, and meteorological data for typical rural scenarios. The load data includes residential electricity load, agricultural irrigation electricity load, aquaculture electricity load, and electric vehicle charging load. The power generation data includes photovoltaic and wind power generation. The meteorological data includes wind speed, light intensity, temperature, and rainfall. Construct a multi-dimensional dataset with a time granularity of 15 minutes, covering a complete year to include seasonal features. Step S102: Divide the collected data into a training set and a validation set in chronological order, with the training set accounting for 80% and the validation set accounting for 20%. This ensures that the training set contains complete seasonal cycles and typical scene load characteristics. The training set is used for subsequent model training, and the validation set is used for model validation and error analysis. Use the DBSCAN algorithm to traverse all training and validation sets, identify noise points as outliers, and remove them. Use Lagrange interpolation polynomials to fill in missing data points, generating smooth time-series data. Perform min-max normalization on the time-series data. Fuse the time-series data with meteorological, seasonal, and scene feature labels to construct a feature matrix, which serves as the basis for subsequent time-series prediction.

[0006] Step S200: Construct a Transformer-based time series forecasting model. The core of the time series forecasting model consists of three stacked encoder layers. Each layer contains a key multi-head self-attention module and a feedforward neural network. The time series forecasting model is trained using a training set: mean squared error is used as the loss function, and the Adam optimizer is used for iterative updates. After training, the validation set is input into the time series forecasting model to obtain the corresponding initial load forecast value sequence. Finally, the initial load forecast value sequence is compared with the historical real load values ​​point by point to calculate the prediction error sequence. The error sequence quantifies the deviation of the Transformer model on unknown data and serves as the basic input data for error prediction, interpolation clustering, and compensation correction in subsequent steps. Step S201: Construct a temporal prediction model based on the Transformer architecture. The temporal prediction model receives the feature matrix as input and maps it to a 256-dimensional vector space through a linear embedding layer, forming an embedding vector matrix E. Since the temporal prediction model itself does not contain recurrent or convolutional structures, to preserve the temporal order information of the input sequence, a position encoding matrix PE is generated using sine and cosine functions. Position encoding is added to the embedding vector matrix E. The formula for the position encoding matrix PE is: ; ; In the formula, pos is the time step, i is the dimension index, and PE is the time step. (pos,2i) PE represents the positional encoding value corresponding to the even-numbered index dimension at time step pos. (pos,2i+1) This represents the positional encoding value corresponding to the odd-indexed dimension at the pos-th time step; 10000 2i / dmodel The scaling factor represents the position encoding and is used to control the frequency of change of position encoding in different dimensions; The embedding vector matrix E and the position encoding matrix PE are added element by element to obtain the input sequence that fuses content and sequence information. This sequence is used as the input to the encoder layer of the time-series prediction model. The encoder layer consists of three layers, each with an 8-head self-attention mechanism module and a feedforward neural network, which are used to capture the complex dependencies of the input sequence from multiple scales and perspectives. Step S202: Train the time series prediction model using the training set. Specifically, input the feature matrix of the training set into the model, use the mean squared error as the loss function, employ the Adam optimizer, set the learning rate to 0.001, and set the maximum number of iterations to 100. After the time series prediction model is trained, input the feature matrix of the validation set into the model to obtain the corresponding initial load prediction sequence P. pred The initial load prediction value sequence P pred The historical true load value sequence P corresponding to the verification set actual Perform point-by-point comparisons to calculate the prediction error sequence, denoted as loss, using the formula loss = P. pred -P actual .

[0007] Step S300: Construct a multi-type error prediction model to compensate for the prediction error of the time series prediction model. The multi-type error prediction model includes a BiLSTM error model, a GRU error model, and an XGBoost error model. Train the multi-type error prediction model using the training set. After training, input the error sequence corresponding to the validation set into the trained multi-type error prediction model to obtain multiple error prediction value sequences. Step S301: Construct a multi-type error prediction model to perform sequence compensation for the prediction error of the time series prediction model. The multi-type error prediction model includes a BiLSTM error model, a GRU error model, and an XGBoost error model. Train the multi-type error prediction model independently using a training set. Use the prediction error sequence loss corresponding to the training set as input and the error value at the corresponding future time as output for training. Use the mean absolute error as the evaluation index for the training. Optimal parameter configuration of the multi-type error prediction model is selected through model hyperparameter optimization to complete the training and parameter solidification. Step S302: Input the prediction error sequence (loss sequence) corresponding to the validation set into the trained multi-type error prediction model, and perform forward computation to obtain multiple sets of error prediction value sequences corresponding to the time steps of the validation set. The error prediction value sequence value is denoted as c. x The c x Including c BiLSTM c GRU c XGBoos The c BiLSTM cGRU c XGBoos These are the predicted values ​​output by the BiLSTM error model, GRU error model, and XGBoost error model, respectively. They represent the independent calculation results of the corresponding error prediction models for future errors, providing a direct input data basis for data pairing, interpolation, and optimal model selection in subsequent steps.

[0008] Step S400: Combine the prediction error sequence loss with the output c of each error prediction model. x Pairing by time series specifically involves using timestamps as the matching criteria, matching the prediction error sequence at the same time step with the prediction error value sequence c at the corresponding time step. x One-to-one binding, forming time step + loss value + c x The data consists of three data sets; an intermediate value is inserted between every two adjacent data sets using a Lagrange interpolation polynomial to improve the temporal resolution and smoothness of the data.

[0009] Step S500: Construct a graph with the loss value as the vertical axis and c as the horizontal axis. x Two-dimensional data points, represented by values ​​on the horizontal axis, symbolize the error matching status under different model combinations. Based on the Euclidean distance of each two-dimensional data point to the optimal decision line, they are divided into near-optimal and far-optimal classes. Initial points are selected from these near-optimal and far-optimal classes for LA-Kmeans clustering. After iterative updates, three clusters are obtained, each corresponding to a multi-type error prediction model. The optimal model is selected, and its output c is... x The value is determined to be the optimal error compensation value c. opt ; Step S501: Using the interpolated loss value as the ordinate, the corresponding three data sets c x The values ​​are used as the horizontal axis to form two-dimensional data points. These two-dimensional data points represent the error matching state under different model combinations at a specific time. The Euclidean distance from all two-dimensional data points to the optimal decision line is calculated. The optimal decision line is a straight line with loss=c, where c represents the ideal situation where the prediction error and the predicted error value are equal. This is set by professionals. The Euclidean distances are sorted from smallest to largest, and all two-dimensional data points are divided into near-optimal and far-optimal categories. The near-optimal category consists of the top 50% of the two-dimensional data points in terms of Euclidean distance, and the far-optimal category consists of the bottom 50% of the two-dimensional data points in terms of Euclidean distance. Step S502: Randomly select k / 2 data points from both the nearest and far-nearest clusters as initial cluster centers for LA-Kmeans clustering, with k set to 3. Calculate the Euclidean distance from each data point to each initial cluster center and assign it to the cluster of the nearest cluster center. For each cluster, calculate the distance between all data points on the loss ordinate and c. xThe mean value on the horizontal axis is used as the new cluster center for the current cluster. This completes one iteration of LA-Kmeans clustering. This iteration is repeated until the change in the position of the cluster center is less than a preset threshold. At this point, LA-Kmeans clustering converges, resulting in k=3 final clusters. Each cluster corresponds to a multi-type error prediction model. The multi-type error prediction model with the shortest Euclidean distance is selected as the optimal model. The multi-type error prediction model corresponding to the optimal model outputs c at the current time. x The value was selected as the optimal error compensation value c. opt .

[0010] Step S600: According to formula P final =P pred -c opt The initial load forecast value P of the time-series forecast model based on the Transformer architecture. pred After correction, the final load forecast value P after error compensation is obtained. final .

[0011] A rural mobile energy storage load prediction error compensation optimization system, the system includes a data acquisition and preprocessing module, a time series prediction model construction and training module, a multi-model error prediction module, an error data alignment and interpolation module, an optimal model selection module, and a final prediction correction module; The data acquisition and preprocessing module collects multi-dimensional feature data of typical rural scenarios throughout the year, including load, power generation and meteorological data. Through data cleaning, normalization and feature fusion, a time-aligned feature matrix is ​​constructed to provide standardized input for subsequent prediction models. The time series prediction model construction and training module constructs a time series prediction model based on the Transformer architecture, uses the training set to train the model, generates an initial load prediction value sequence on the validation set, and calculates the key prediction error sequence by comparing the predicted values ​​with the actual values, providing a basis for subsequent error compensation. The time series prediction model construction and training module includes a model architecture construction unit and a model training and error sequence generation unit; The model architecture building unit is responsible for building the core structure of the Transformer prediction model. It maps the feature matrix into a high-dimensional vector through a linear embedding layer and adds sine and cosine position encoding to preserve temporal information. The prediction model adopts a three-layer encoder, each layer containing a multi-head self-attention mechanism and a feedforward neural network to capture complex temporal dependencies. The model training and error sequence generation unit is responsible for training and preliminary evaluation of the prediction model. Using the training set, the prediction model is trained with mean squared error as the loss function and Adam as the optimizer. After training, the validation set is input into the model to obtain the initial prediction value sequence, which is compared with the true value sequence point by point to calculate the prediction error sequence as the basis for subsequent analysis.

[0012] The multi-model error prediction module constructs and trains multiple types of error prediction models, aiming to predict the error sequence generated by the aforementioned Transformer model. By independently training each error model, it obtains multiple sets of error prediction value sequences for future errors, providing candidate data for selecting the optimal compensation strategy. The error data alignment and interpolation module is responsible for data alignment and refinement. Based on the timestamp, it pairs the original prediction error sequence with the prediction value sequence of each error model to form a three-dimensional data set. Lagrange interpolation is performed between adjacent data sets to improve the temporal resolution and smoothness of the data, and to prepare a high-quality dataset for subsequent cluster analysis. The optimal model selection module constructs a two-dimensional space based on the interpolated data, performs initial screening by calculating the distance from the data points to the ideal decision line, divides the data points into three clusters using the LA-Kmeans clustering algorithm, and finally selects the model with the shortest Euclidean distance as the optimal model. The output of the optimal model is determined to be the optimal error compensation value. The optimal model selection module includes an error matching state partitioning unit and a cluster analysis and optimal model determination unit. The error matching state partitioning unit uses the interpolated prediction error sequence as the vertical axis and the error prediction value sequence as the horizontal axis to form two-dimensional data points representing the error matching state. It calculates the Euclidean distance from all the two-dimensional data points to the ideal decision line, which represents the ideal state where the prediction error and the error prediction value are equal. The two-dimensional data points are divided into near-optimal and far-optimal classes to provide high-quality initial samples for subsequent clustering. The clustering analysis and optimal model selects initial centers from near-optimal and far-optimal clusters, and uses the LA-Kmeans algorithm for iterative clustering to obtain three stable clusters. Each cluster corresponds to an error prediction model. By comparing the average distance of the data points in each cluster to the decision line, the optimal model is selected, and the output value of the optimal model is determined as the optimal error compensation value at the current time.

[0013] The final prediction correction module uses the optimal error compensation value to correct the initial load prediction value, thereby obtaining the final load prediction value and completing a closed loop from initial prediction to error compensation.

[0014] Compared with the prior art, the beneficial effects of the present invention are: 1. Improve the accuracy of rural energy load forecasting: By constructing a Transformer-based time-series forecasting model and combining it with three error forecasting models, BiLSTM, GRU, and XGBoost, for joint compensation, the complex dependencies and error characteristics of load changes are captured from multiple perspectives, reducing forecast bias and achieving high-precision forecasting of electricity load in multiple rural scenarios.

[0015] 2. Enhance the model's adaptability to complex scenarios: A multi-dimensional dataset covering all seasons is used, combined with DBSCAN anomaly detection, Lagrange interpolation, and data normalization preprocessing to ensure data quality and consistency. The optimal error compensation model is dynamically selected through LA-Kmeans clustering to improve the prediction stability in the variable rural environment.

[0016] 3. Intelligent error compensation and decision optimization: A two-dimensional data point construction mechanism with prediction error and error prediction value as coordinates is introduced. Combined with Euclidean distance analysis and clustering methods, dynamic optimization and adaptive fusion of the error compensation model are realized, enhancing the operability and reliability of the system in practical applications. Attached Figure Description

[0017] Figure 1 This is a schematic diagram illustrating the steps of applying the present invention to a rural mobile energy storage load prediction error compensation optimization system; Figure 2 This is a schematic diagram of the structure of an optimization method for load prediction error compensation of rural mobile energy storage, which is based on the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Example: Figures 1-2 As shown, the present invention provides a technical solution, a method for optimizing rural mobile energy storage load prediction error compensation, the method comprising the following steps: Step S100: Collect feature data of typical rural scenes, including load data, power generation data, and meteorological data, and construct a multi-dimensional dataset covering a complete year to include seasonal features; divide the collected feature data into training and validation sets according to time order, and use the DBSCAN algorithm to identify and mark abnormal data points; fill in missing data points using Lagrange interpolation polynomials; and perform min-max normalization on data of different dimensions as the basis for subsequent time series prediction. Step S101: Collect electricity load data, power generation data, and meteorological data for typical rural scenarios. The load data includes residential electricity load, agricultural irrigation electricity load, aquaculture electricity load, and electric vehicle charging load. The power generation data includes photovoltaic and wind power generation. The meteorological data includes wind speed, light intensity, temperature, and rainfall. Construct a multi-dimensional dataset with a time granularity of 15 minutes, covering a complete year to include seasonal features. Step S102: Divide the collected data into a training set and a validation set in chronological order, with the training set accounting for 80% and the validation set accounting for 20%. This ensures that the training set contains complete seasonal cycles and typical scene load characteristics. The training set is used for subsequent model training, and the validation set is used for model validation and error analysis. Use the DBSCAN algorithm to traverse all training and validation sets, identify noise points as outliers, and remove them. Use Lagrange interpolation polynomials to fill in missing data points, generating smooth time-series data. Perform min-max normalization on the time-series data. Fuse the time-series data with meteorological, seasonal, and scene feature labels to construct a feature matrix, which serves as the basis for subsequent time-series prediction.

[0020] Step S200: Construct a Transformer-based time series forecasting model. The core of the time series forecasting model consists of three stacked encoder layers. Each layer contains a key multi-head self-attention module and a feedforward neural network. The time series forecasting model is trained using a training set: mean squared error is used as the loss function, and the Adam optimizer is used for iterative updates. After training, the validation set is input into the time series forecasting model to obtain the corresponding initial load forecast value sequence. Finally, the initial load forecast value sequence is compared with the historical real load values ​​point by point to calculate the prediction error sequence. The error sequence quantifies the deviation of the Transformer model on unknown data and serves as the basic input data for error prediction, interpolation clustering, and compensation correction in subsequent steps. Step S201: Construct a temporal prediction model based on the Transformer architecture. The temporal prediction model receives the feature matrix as input and maps it to a 256-dimensional vector space through a linear embedding layer, forming an embedding vector matrix E. Since the temporal prediction model itself does not contain recurrent or convolutional structures, to preserve the temporal order information of the input sequence, a position encoding matrix PE is generated using sine and cosine functions. Position encoding is added to the embedding vector matrix E. The formula for the position encoding matrix PE is: ; ; In the formula, pos is the time step, i is the dimension index, and PE is the time step.(pos,2i) PE represents the positional encoding value corresponding to the even-numbered index dimension at time step pos. (pos,2i+1) This represents the positional encoding value corresponding to the odd-indexed dimension at the pos-th time step; 10000 2i / dmodel The scaling factor represents the position encoding and is used to control the frequency of change of position encoding in different dimensions; The embedding vector matrix E and the position encoding matrix PE are added element by element to obtain the input sequence that fuses content and sequence information. This sequence is used as the input to the encoder layer of the time-series prediction model. The encoder layer consists of three layers, each with an 8-head self-attention mechanism module and a feedforward neural network, which are used to capture the complex dependencies of the input sequence from multiple scales and perspectives. Step S202: Train the time series prediction model using the training set. Specifically, input the feature matrix of the training set into the model, use the mean squared error as the loss function, employ the Adam optimizer, set the learning rate to 0.001, and set the maximum number of iterations to 100. After the time series prediction model is trained, input the feature matrix of the validation set into the model to obtain the corresponding initial load prediction sequence P. pred The initial load prediction value sequence P pred The historical true load value sequence P corresponding to the verification set actual Perform point-by-point comparisons to calculate the prediction error sequence, denoted as loss, using the formula loss = P. pred -P actual .

[0021] Step S300: Construct a multi-type error prediction model to compensate for the prediction error of the time series prediction model. The multi-type error prediction model includes a BiLSTM error model, a GRU error model, and an XGBoost error model. Train the multi-type error prediction model using the training set. After training, input the error sequence corresponding to the validation set into the trained multi-type error prediction model to obtain multiple error prediction value sequences. Step S301: Construct a multi-type error prediction model to perform sequence compensation for the prediction error of the time series prediction model. The multi-type error prediction model includes a BiLSTM error model, a GRU error model, and an XGBoost error model. Train the multi-type error prediction model independently using a training set. Use the prediction error sequence loss corresponding to the training set as input and the error value at the corresponding future time as output for training. Use the mean absolute error as the evaluation index for the training. Optimal parameter configuration of the multi-type error prediction model is selected through model hyperparameter optimization to complete the training and parameter solidification. Step S302: Input the prediction error sequence (loss sequence) corresponding to the validation set into the trained multi-type error prediction model, and perform forward computation to obtain multiple sets of error prediction value sequences corresponding to the time steps of the validation set. The error prediction value sequence value is denoted as c. x The c x Including c BiLSTM c GRU c XGBoos The c BiLSTM c GRU c XGBoos These are the predicted values ​​output by the BiLSTM error model, GRU error model, and XGBoost error model, respectively. They represent the independent calculation results of the corresponding error prediction models for future errors, providing a direct input data basis for data pairing, interpolation, and optimal model selection in subsequent steps.

[0022] Step S400: Combine the prediction error sequence loss with the output c of each error prediction model. x Pairing by time series specifically involves using timestamps as the matching criteria, matching the prediction error sequence at the same time step with the prediction error value sequence c at the corresponding time step. x One-to-one binding, forming time step + loss value + c x The data consists of three data sets; an intermediate value is inserted between every two adjacent data sets using a Lagrange interpolation polynomial to improve the temporal resolution and smoothness of the data.

[0023] Step S500: Construct a graph with the loss value as the vertical axis and c as the horizontal axis. x Two-dimensional data points, represented by values ​​on the horizontal axis, symbolize the error matching status under different model combinations. Based on the Euclidean distance of each two-dimensional data point to the optimal decision line, they are divided into near-optimal and far-optimal classes. Initial points are selected from these near-optimal and far-optimal classes for LA-Kmeans clustering. After iterative updates, three clusters are obtained, each corresponding to a multi-type error prediction model. The optimal model is selected, and its output c is... x The value is determined to be the optimal error compensation value c. opt ; Step S501: Using the interpolated loss value as the ordinate, the corresponding three data sets c xThe values ​​are used as the horizontal axis to form two-dimensional data points. These two-dimensional data points represent the error matching state under different model combinations at a specific time. The Euclidean distance from all two-dimensional data points to the optimal decision line is calculated. The optimal decision line is a straight line with loss=c, where c represents the ideal situation where the prediction error and the predicted error value are equal. This is set by professionals. The Euclidean distances are sorted from smallest to largest, and all two-dimensional data points are divided into near-optimal and far-optimal categories. The near-optimal category consists of the top 50% of the two-dimensional data points in terms of Euclidean distance, and the far-optimal category consists of the bottom 50% of the two-dimensional data points in terms of Euclidean distance. Step S502: Randomly select k / 2 data points from both the nearest and far-nearest clusters as initial cluster centers for LA-Kmeans clustering, with k set to 3. Calculate the Euclidean distance from each data point to each initial cluster center and assign it to the cluster of the nearest cluster center. For each cluster, calculate the distance between all data points on the loss ordinate and c. x The mean value on the horizontal axis is used as the new cluster center for the current cluster. This completes one iteration of LA-Kmeans clustering. This iteration is repeated until the change in the position of the cluster center is less than a preset threshold. At this point, LA-Kmeans clustering converges, resulting in k=3 final clusters. Each cluster corresponds to a multi-type error prediction model. The multi-type error prediction model with the shortest Euclidean distance is selected as the optimal model. The multi-type error prediction model corresponding to the optimal model outputs c at the current time. x The value was selected as the optimal error compensation value c. opt .

[0024] Step S600: According to formula P final =P pred -c opt The initial load forecast value P of the time-series forecast model based on the Transformer architecture. pred After correction, the final load forecast value P after error compensation is obtained. final .

[0025] A rural mobile energy storage load prediction error compensation optimization system, the system includes a data acquisition and preprocessing module, a time series prediction model construction and training module, a multi-model error prediction module, an error data alignment and interpolation module, an optimal model selection module, and a final prediction correction module; The data acquisition and preprocessing module collects multi-dimensional feature data of typical rural scenarios throughout the year, including load, power generation and meteorological data. Through data cleaning, normalization and feature fusion, a time-aligned feature matrix is ​​constructed to provide standardized input for subsequent prediction models. The time series prediction model construction and training module constructs a time series prediction model based on the Transformer architecture, uses the training set to train the model, generates an initial load prediction value sequence on the validation set, and calculates the key prediction error sequence by comparing the predicted values ​​with the actual values, providing a basis for subsequent error compensation. The time series prediction model construction and training module includes a model architecture construction unit and a model training and error sequence generation unit; The model architecture building unit is responsible for building the core structure of the Transformer prediction model. It maps the feature matrix into a high-dimensional vector through a linear embedding layer and adds sine and cosine position encoding to preserve temporal information. The prediction model adopts a three-layer encoder, each layer containing a multi-head self-attention mechanism and a feedforward neural network to capture complex temporal dependencies. The model training and error sequence generation unit is responsible for training and preliminary evaluation of the prediction model. Using the training set, the prediction model is trained with mean squared error as the loss function and Adam as the optimizer. After training, the validation set is input into the model to obtain the initial prediction value sequence, which is compared with the true value sequence point by point to calculate the prediction error sequence as the basis for subsequent analysis.

[0026] The multi-model error prediction module constructs and trains multiple types of error prediction models, aiming to predict the error sequence generated by the aforementioned Transformer model. By independently training each error model, it obtains multiple sets of error prediction value sequences for future errors, providing candidate data for selecting the optimal compensation strategy. The error data alignment and interpolation module is responsible for data alignment and refinement. Based on the timestamp, it pairs the original prediction error sequence with the prediction value sequence of each error model to form a three-dimensional data set. Lagrange interpolation is performed between adjacent data sets to improve the temporal resolution and smoothness of the data, and to prepare a high-quality dataset for subsequent cluster analysis. The optimal model selection module constructs a two-dimensional space based on the interpolated data, performs initial screening by calculating the distance from the data points to the ideal decision line, divides the data points into three clusters using the LA-Kmeans clustering algorithm, and finally selects the model with the shortest Euclidean distance as the optimal model. The output of the optimal model is determined to be the optimal error compensation value. The optimal model selection module includes an error matching state partitioning unit and a cluster analysis and optimal model determination unit. The error matching state partitioning unit uses the interpolated prediction error sequence as the vertical axis and the error prediction value sequence as the horizontal axis to form two-dimensional data points representing the error matching state. It calculates the Euclidean distance from all the two-dimensional data points to the ideal decision line, which represents the ideal state where the prediction error and the error prediction value are equal. The two-dimensional data points are divided into near-optimal and far-optimal classes to provide high-quality initial samples for subsequent clustering. The clustering analysis and optimal model selects initial centers from near-optimal and far-optimal clusters, and uses the LA-Kmeans algorithm for iterative clustering to obtain three stable clusters. Each cluster corresponds to an error prediction model. By comparing the average distance of the data points in each cluster to the decision line, the optimal model is selected, and the output value of the optimal model is determined as the optimal error compensation value at the current time.

[0027] The final prediction correction module uses the optimal error compensation value to correct the initial load prediction value, thereby obtaining the final load prediction value and completing a closed loop from initial prediction to error compensation.

[0028] Example: Taking the load data of region A at 12:00 on July 15, 2024 (peak agricultural irrigation period) as an example, the complete verification process and calculation procedure are as follows: Raw data and initial forecast: Actual load value p at the set time step actual The initial load forecast value p output by the Transformer model is 120kW. pred The power is 138.24 kW, and the initial prediction error is... ; Determining the optimal error compensation value: The optimal error compensation value c, selected through LA-Kmeans clustering, is set for the current time period. opt It is 9.14kW; Calculation of final load forecast: Substitute into the error compensation formula ,have to ; Calculation of error after compensation: The prediction error after compensation is

[0029] After compensation, the mean absolute error (MAE) of load forecasting decreased to 8.7%, and the mean square error (MSE) decreased to 0.008; among them, the forecast error during peak agricultural irrigation periods decreased from 15.2% to 9.1%, and the forecast error during residential load periods (e.g., 20:00 on July 15, 2024, with an actual load of 65kW and an initial forecast of 71.69kW) decreased. opt =4.19kW, final predicted p final =71.69-4.19=67.5kw.

[0030] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A rural mobile energy storage load forecasting error compensation optimization system and method, characterized in that: The method includes the following steps: Step S100: Collect feature data of typical rural scenes, divide them into training set and validation set according to time order, mark and remove abnormal data points; fill in missing data points to generate time series data, and normalize the time series data to construct a feature matrix. Step S200: Construct a Transformer-based time-series forecasting model, train the time-series forecasting model using the training set, input the validation set into the time-series forecasting model to obtain the corresponding initial load forecasting value sequence, compare the initial load forecasting value sequence with the historical actual load value point by point, and calculate the forecasting error sequence. Step S300: Construct a multi-type error prediction model for compensation. Use the training set to train the multi-type error prediction model. After training, input the error sequence corresponding to the validation set into the trained multi-type error prediction model to obtain multiple error prediction value sequences. Step S400: pair and interpolate the prediction error sequence loss with the output c of each error prediction model x pairing and interpolating by time series Step S500: constructing two-dimensional data points with loss value as the vertical axis and c x value as the horizontal axis, dividing into near-optimal class and far-optimal class based on the Euclidean distance of each two-dimensional data point to the optimal decision line, selecting initial points from the near-optimal class and the far-optimal class for LA-Kmeans clustering, and selecting the optimal model; Step S600: Correct the initial load forecast value of the time series forecast model based on the Transformer architecture to obtain the final load forecast value.

2. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: Step S100 includes the following steps: Step S101: Collect characteristic data of typical rural scenes. The characteristic data includes electricity load data, power generation data, and meteorological data. The electricity load data includes residential electricity load, agricultural irrigation electricity load, aquaculture electricity load, and electric vehicle charging load. The power generation data includes photovoltaic and wind power generation. The meteorological data includes wind speed, light intensity, temperature, and rainfall. Construct a multi-dimensional dataset with a time granularity of 15 minutes, covering a complete year. Step S102: Divide the collected data into a training set and a validation set according to time order, with the training set accounting for 80% and the validation set accounting for 20%. Use the DBSCAN algorithm to traverse all training and validation sets, identify noise points identified by the DBSCAN algorithm as abnormal data points, and remove the abnormal data points. Use Lagrange interpolation polynomials to fill in missing data points to generate smooth time-series data. Perform min-max normalization on the time-series data. Combine the time-series data with meteorological, seasonal, and scene feature labels to construct a feature matrix.

3. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: Step S200 includes the following steps: Step S201: Construct a temporal prediction model based on the Transformer architecture. The temporal prediction model receives the feature matrix as input, maps the feature matrix to a 256-dimensional vector space through a linear embedding layer to form an embedding vector matrix E, generates a position encoding matrix PE using sine and cosine functions, adds position encoding to the embedding vector matrix E to obtain an input sequence that integrates content and sequence information, and uses it as the input to the encoder layer of the temporal prediction model. The encoder layer contains 3 layers, each with an 8-head self-attention mechanism module and a feedforward neural network. Step S202: Train the time series prediction model using the training set. Specifically, input the feature matrix of the training set into the model, use the mean squared error as the loss function, and train using the Adam optimizer. After the time series prediction model is trained, input the feature matrix of the validation set into the model to obtain the corresponding initial load prediction sequence P. pred The initial load prediction value sequence P pred The historical true load value sequence P corresponding to the verification set actual Perform point-by-point comparisons to calculate the prediction error sequence, denoted as loss.

4. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: Step S300 includes the following steps: Step S301: Construct a multi-type error prediction model to compensate for the prediction error of the time series prediction model. The multi-type error prediction model includes a BiLSTM error model, a GRU error model, and an XGBoost error model. Train the multi-type error prediction model independently using a training set. Specifically, train the model with the prediction error sequence loss corresponding to the training set as input and the error value at the corresponding future time as output. Step S302: Input the prediction error sequence (loss sequence) corresponding to the validation set into the trained multi-type error prediction model, and perform forward computation to obtain multiple sets of error prediction value sequences corresponding to the time steps of the validation set. The error prediction value sequence value is denoted as c. x The c x Including c BiLSTM c GRU c XGBoos The c BiLSTM c GRU c XGBoos These are the predicted values ​​output by the BiLSTM error model, GRU error model, and XGBoost error model, respectively.

5. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: In step S400, the prediction error sequence loss is compared with the output c of each error prediction model. x Pairing by time series specifically involves using timestamps as the matching criteria, matching the prediction error sequence at the same time step with the prediction error value sequence c at the corresponding time step. x One-to-one binding, forming time step + loss value + c x The three-element data set is used to insert an intermediate value between every two adjacent three-element data sets using a Lagrange interpolation polynomial.

6. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: Step S500 includes the following steps: Step S501: Using the interpolated loss value as the ordinate, the corresponding three data sets c x The values ​​are used as the horizontal axis to form two-dimensional data points. The Euclidean distance of all two-dimensional data points to the optimal decision line is calculated. The optimal decision line is a straight line with loss=c, where c represents the ideal case where the prediction error and the predicted error value are equal. It is set by professionals. The Euclidean distances are sorted from smallest to largest. All two-dimensional data points are divided into near-optimal and far-optimal categories. The near-optimal category is the top 50% of the two-dimensional data points in terms of Euclidean distance, and the far-optimal category is the bottom 50% of the two-dimensional data points in terms of Euclidean distance. Step S502: Randomly select k / 2 data points from the near-optimal and far-optimal clusters as initial cluster centers for LA-Kmeans clustering, where k is 3. Calculate the Euclidean distance from each data point to each initial cluster center and assign it to the cluster to which the nearest cluster center belongs. For each cluster, calculate the distance between the data points on the loss ordinate and c. x The mean value on the horizontal axis is used as the new cluster center for the current cluster. This completes one iteration of LA-Kmeans clustering. This iteration is repeated to obtain k=3 final clusters, each corresponding to a multi-type error prediction model. The multi-type error prediction model with the shortest Euclidean distance is selected as the optimal model. The multi-type error prediction model corresponding to the optimal model outputs c at the current time. x The value was selected as the optimal error compensation value c. opt .

7. The rural mobile energy storage load forecasting error compensation optimization system and method according to claim 1, characterized in that: In step S600, according to formula P final =P pred -c opt The initial load forecast value P of the time-series forecast model based on the Transformer architecture. pred After correction, the final load forecast value P after error compensation is obtained. final .

8. A rural mobile energy storage load forecasting error compensation optimization system, characterized in that: The system includes a data acquisition and preprocessing module, a time series prediction model construction and training module, a multi-model error prediction module, an error data alignment and interpolation module, an optimal model selection module, and a final prediction correction module. The data acquisition and preprocessing module collects multi-dimensional feature data of typical rural scenarios throughout the year, including load, power generation and meteorological data. Through data cleaning, normalization and feature fusion, a time-aligned feature matrix is ​​constructed. The time series prediction model construction and training module constructs a time series prediction model based on the Transformer architecture, uses the training set to train the model, generates an initial load prediction value sequence on the validation set, and calculates the key prediction error sequence by comparing the predicted values ​​with the actual values. The multi-model error prediction module constructs and trains multiple types of error prediction models. By independently training each error model, it obtains multiple sets of error prediction value sequences for future errors. The error data alignment and interpolation module uses timestamps as a reference to pair the original prediction error sequence with the prediction value sequence of each error model to form a three-dimensional data set, and performs Lagrange interpolation between adjacent data sets. The optimal model selection module constructs a two-dimensional space based on the interpolated data, performs initial screening by calculating the distance from the data points to the ideal decision line, divides the data points into three clusters using the LA-Kmeans clustering algorithm, and finally selects the model with the shortest Euclidean distance as the optimal model. The output of the optimal model is determined to be the optimal error compensation value. The final prediction correction module uses the optimal error compensation value to correct the initial load prediction value to obtain the final load prediction value.

9. A rural mobile energy storage load forecasting error compensation optimization system according to claim 8, characterized in that: The time series prediction model construction and training module includes a model architecture construction unit and a model training and error sequence generation unit; The model architecture building unit is responsible for building the core structure of the Transformer prediction model. It maps the feature matrix into a high-dimensional vector through a linear embedding layer, adds sine and cosine position encoding to preserve temporal information, and the prediction model adopts a three-layer encoder, each layer containing a multi-head self-attention mechanism and a feedforward neural network. The model training and error sequence generation unit uses a training set, with mean squared error as the loss function and Adam as the optimizer to train the prediction model. After training, the validation set is input into the model to obtain the initial prediction value sequence, which is compared with the true value sequence point by point to calculate the prediction error sequence.

10. A rural mobile energy storage load forecasting error compensation optimization system according to claim 8, characterized in that: The optimal model selection module includes an error matching state partitioning unit and a cluster analysis and optimal model determination unit. The error matching state division unit forms two-dimensional data points with the interpolated prediction error sequence as the vertical axis and the error prediction value sequence as the horizontal axis. It calculates the Euclidean distance from all the two-dimensional data points to the ideal decision line. The ideal decision line represents the ideal state where the prediction error and the error prediction value are equal. The two-dimensional data points are divided into near-optimal and far-optimal classes. The clustering analysis and optimal model selects initial centers from near-optimal and far-optimal clusters, and uses the LA-Kmeans algorithm for iterative clustering to obtain three stable clusters. Each cluster corresponds to an error prediction model. By comparing the average distance of the data points in each cluster to the decision line, the optimal model is selected, and the output value of the optimal model is determined as the optimal error compensation value at the current time.