Energy storage flywheel rotating speed prediction method and device based on load prediction transfer learning
By constructing source domain and target domain datasets and using the load forecasting model for pre-training and adversarial training, knowledge transfer from load forecasting to flywheel speed prediction is achieved, which solves the problems of insufficient accuracy and reliability of flywheel speed prediction in the existing technology and improves the accuracy of flywheel speed prediction and the generalization ability of the model.
Patent Information
- Application Number
- CN202510786323.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-19
AI Technical Summary
Existing flywheel speed prediction methods mostly rely on physical modeling or traditional statistical analysis, which makes it difficult to handle complex nonlinear relationships and has poor adaptability to environmental changes. The operating data of flywheel energy storage systems is relatively small, making it difficult to support the stability and generalization capabilities of deep learning models. The knowledge in load forecasting tasks is not fully utilized, resulting in insufficient accuracy and reliability in flywheel speed prediction.
By constructing source domain and target domain datasets, using the load forecasting model for pre-training and adversarial training, extracting features and fine-tuning, knowledge transfer from load forecasting to flywheel speed prediction is achieved. The domain adversarial neural network model is used to narrow the feature distribution differences and improve the generalization performance of the model in the target domain.
The accuracy and reliability of flywheel speed prediction are improved, efficient and accurate flywheel speed prediction is achieved, and the optimized scheduling and control strategy of the flywheel energy storage system is supported.
Smart Images

Figure CN120671540A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of deep learning and energy storage system prediction, and in particular to a method, device, computer equipment, computer-readable storage medium, and computer program product for predicting the speed of an energy storage flywheel based on load prediction transfer learning. Background Art
[0002] With the rapid development of smart grids and renewable energy, energy storage systems play a key role in grid dispatching, frequency stabilization, and energy optimization. Flywheel energy storage, in particular, has attracted widespread attention as a highly efficient and responsive energy storage method. The core of a flywheel energy storage system is its flywheel speed, whose variations directly affect the efficiency of energy storage and release. Accurately predicting flywheel speed is crucial for optimizing energy storage system control strategies.
[0003] At present, the research on flywheel speed prediction is still in its early stages. Existing prediction methods mostly rely on physical modeling or traditional statistical analysis methods (such as autoregressive integrated moving average model ARIMA, support vector machine SVM, etc.). These methods have difficulty in handling complex nonlinear relationships and have poor adaptability to environmental changes. The operating data of flywheel energy storage systems is relatively small, which makes it difficult to support the training of deep learning models from scratch, affecting the stability and generalization ability of the model. However, in the field of power load forecasting, there are a large number of deep learning-based methods, such as long short-term memory networks (LSTM), convolutional neural networks (CNN), and Transformer models. These methods can use historical load data for high-precision prediction. At the same time, the research on load forecasting tasks is relatively in-depth, the existing public data sets are large, and the trained models have strong generalization capabilities.
[0004] In related technologies, load forecasting and flywheel speed prediction are often treated as independent tasks, without fully considering their similarities and transferability. Therefore, how to improve the accuracy and reliability of flywheel speed prediction using existing load forecasting models has become a key issue that needs to be addressed. Summary of the Invention
[0005] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for energy storage flywheel speed prediction based on load prediction transfer learning, which can improve the accuracy of flywheel speed prediction in order to address the above technical problems.
[0006] In a first aspect, the present application provides a method for predicting the speed of an energy storage flywheel based on load forecast transfer learning, comprising:
[0007] Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data;
[0008] After pre-training the load forecasting model using the source domain dataset, removing the output layer of the load forecasting model to obtain a first intermediate model;
[0009] Using the first intermediate model as a feature extractor in a domain adversarial neural network model, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extracting the feature extractor to obtain a second intermediate model;
[0010] Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0011] The flywheel speed data before the prediction moment and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
[0012] In one embodiment, the historical load-related data includes weather temperature, humidity, date nature and real-time electricity price; the historical flywheel speed-related data includes main system output, flywheel motor temperature, grid frequency and user load.
[0013] In one embodiment, constructing the source domain dataset and the target domain dataset includes:
[0014] A sliding window method is adopted to set a time step, extract historical load-related data and historical load data of multiple time steps from historical data as input data of a source domain dataset, extract historical load data from the historical data as a label of the source domain dataset, and the input data of the source domain dataset and the label of the source domain dataset constitute the source domain dataset;
[0015] A sliding window method is adopted to set a time step, and historical flywheel speed related data and historical flywheel speed data of multiple time steps are extracted from the historical data as input data of the target domain dataset. The historical flywheel speed data is extracted from the historical data as the label of the target domain dataset. The input data of the target domain dataset and the label of the target domain dataset constitute the target domain dataset.
[0016] In one embodiment, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset includes:
[0017] When performing adversarial training, the predictor loss and domain adversarial loss are calculated to obtain the total loss function;
[0018] Calculating the gradient of the predictor loss, and calculating the reverse gradient of the domain adversarial loss using a gradient reversal layer, and updating the parameters of the feature extractor using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss;
[0019] When the total loss function converges, the adversarial training is completed.
[0020] In one embodiment, the load forecasting model adopts a one-dimensional residual network, which includes an input layer, an intermediate layer and an output layer, and the intermediate layer includes multiple residual blocks.
[0021] In one embodiment, after obtaining the target flywheel speed prediction model, the method further includes:
[0022] At least one evaluation index is used to perform performance evaluation on the target flywheel speed prediction model, and the evaluation index is selected from mean square error and mean absolute error.
[0023] In a second aspect, the present application further provides a device for predicting the speed of an energy storage flywheel based on load prediction transfer learning, comprising:
[0024] a data set construction module, configured to construct a source domain data set and a target domain data set, wherein the source domain data set includes historical load data and historical load-related data, and the target domain data set includes historical flywheel speed data and historical flywheel speed-related data;
[0025] a pre-training module, configured to pre-train a load forecasting model using the source domain dataset, and then remove an output layer of the load forecasting model to obtain a first intermediate model;
[0026] an adversarial training module, configured to use the first intermediate model as a feature extractor in a domain adversarial neural network model, perform adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extract the feature extractor to obtain a second intermediate model;
[0027] a fine-tuning module, configured to connect the output end of the second intermediate model to a fully connected output layer to obtain a flywheel speed prediction model, and fine-tune the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0028] The prediction module is used to input the flywheel speed data before the prediction time and the corresponding flywheel speed related data into the target flywheel speed prediction model, and output the flywheel speed prediction data at the prediction time.
[0029] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0030] Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data;
[0031] After pre-training the load forecasting model using the source domain dataset, removing the output layer of the load forecasting model to obtain a first intermediate model;
[0032] Using the first intermediate model as a feature extractor in a domain adversarial neural network model, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extracting the feature extractor to obtain a second intermediate model;
[0033] Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0034] The flywheel speed data before the prediction moment and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0036] Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data;
[0037] After pre-training the load forecasting model using the source domain dataset, removing the output layer of the load forecasting model to obtain a first intermediate model;
[0038] Using the first intermediate model as a feature extractor in a domain adversarial neural network model, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extracting the feature extractor to obtain a second intermediate model;
[0039] Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0040] The flywheel speed data before the prediction moment and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
[0041] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:
[0042] Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data;
[0043] After pre-training the load forecasting model using the source domain dataset, removing the output layer of the load forecasting model to obtain a first intermediate model;
[0044] Using the first intermediate model as a feature extractor in a domain adversarial neural network model, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extracting the feature extractor to obtain a second intermediate model;
[0045] Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0046] The flywheel speed data before the prediction moment and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
[0047] The above-mentioned energy storage flywheel speed prediction method, device, computer equipment, computer-readable storage medium and computer program product based on load forecast transfer learning use historical load data and historical load-related data to construct a source domain data set, and use historical flywheel speed data and historical flywheel speed-related data to construct a target domain data set. Considering that load forecasting and flywheel speed prediction are both time series prediction problems, the two have similarities in data characteristics and modeling methods. The present invention first uses the source domain data set for pre-training so that the model obtains a time series feature representation with good generalization ability. Then, the first intermediate model is used as a feature extractor in the domain adversarial neural network model. Through adversarial training, the feature distribution difference between the source domain data set and the target domain data set is narrowed, so that the two have more consistent representations in the same feature space. Finally, through fine-tuning, the flywheel speed prediction model achieves optimal performance on limited data. The present invention realizes knowledge transfer from load forecasting to flywheel speed prediction, so that the performance of the target flywheel speed prediction model is optimized, thereby better improving the accuracy of flywheel speed prediction. Therefore, after the flywheel speed data before the prediction time and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, the accuracy of the obtained flywheel speed prediction data at the prediction time is more accurate than that of the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 Schematic diagram of a flow chart of a method for predicting the speed of an energy storage flywheel based on load prediction transfer learning in one embodiment;
[0050] Figure 2 Schematic diagram of the structure of a one-dimensional residual network model in one embodiment;
[0051] Figure 3 A diagram of a domain adversarial neural network model in one embodiment;
[0052] Figure 4 Schematic diagram of the training process of a domain adversarial neural network model in one embodiment;
[0053] Figure 5 1 is a flow chart of a transfer learning process in one embodiment;
[0054] Figure 61. It is a structural block diagram of an energy storage flywheel speed prediction device based on load prediction transfer learning in one embodiment;
[0055] Figure 7 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0057] With the rapid development of smart grids and renewable energy, energy storage systems play a key role in grid dispatching, frequency stabilization, and energy optimization. Flywheel energy storage, in particular, has attracted widespread attention as a highly efficient and responsive energy storage method. The core of a flywheel energy storage system is its flywheel speed, whose variations directly affect the efficiency of energy storage and release. Accurately predicting flywheel speed is crucial for optimizing energy storage system control strategies.
[0058] At present, the research on flywheel speed prediction is still in its early stages. The relevant prediction methods mostly rely on physical modeling or traditional statistical analysis methods (such as ARIMA, support vector machine SVM, etc.). These methods have difficulty in handling complex nonlinear relationships, have poor adaptability to environmental changes, and have limited prediction accuracy. The operating data of the flywheel energy storage system is relatively small, which makes it difficult to support the training of deep learning models from scratch, affecting the stability and generalization ability of the model. In addition, although deep learning is gradually being applied in the field of industrial forecasting, due to the scarcity of flywheel speed data, directly training deep learning models often has poor results. Most existing studies use independently trained neural networks for prediction, but fail to fully utilize the knowledge in the load forecasting task, resulting in low model training efficiency, large data requirements, and insufficient generalization ability.
[0059] In contrast, load forecasting has been studied more maturely in the field of deep learning. Currently, a large number of deep learning-based methods have been developed in the field of power load forecasting, such as long short-term memory networks (LSTMs), convolutional neural networks (CNNs), and Transformer models. These methods can utilize historical load data for high-precision forecasting. Furthermore, research on load forecasting tasks is relatively in-depth, with large public datasets available, and multiple public datasets can be used to train deep learning models. Load forecasting tasks utilize time series modeling methods, with input features including historical load, weather temperature, humidity, and date attributes. The model achieves high-precision forecasting by learning time series patterns. Load forecasting data volumes are large, and deep learning models generally have good generalization capabilities, adapting to load variations in different regions and environments.
[0060] In related technologies, load forecasting and flywheel speed forecasting are usually regarded as independent tasks, without fully considering their similarities and transferability. This independent modeling approach has many problems in practical applications. First, the small scale of flywheel speed data makes it difficult to effectively train deep learning models, which is prone to overfitting. The lack of high-quality data makes it difficult for the model to learn the complex pattern of flywheel speed changes over time. Secondly, traditional statistical analysis and physical modeling methods have poor adaptability to complex working conditions. Physical modeling methods rely on precise system parameters and have low adaptability. While statistical methods such as ARIMA and SVM have certain predictive capabilities, they cannot capture nonlinear dynamic characteristics and have limited prediction accuracy. In addition, the direct training of deep learning models is computationally expensive. When data is insufficient, a large amount of computing resources is required and the training process is long, making it difficult to meet real-time prediction and control requirements.
[0061] Therefore, how to use the existing load forecasting model to transfer knowledge and improve the accuracy and reliability of flywheel speed prediction has become a key issue that needs to be solved urgently.
[0062] In recent years, transfer learning technology has been widely studied in the field of deep learning, demonstrating superior performance in small-sample learning and cross-task knowledge transfer. The basic idea of transfer learning is to train a model on a source task, transfer the learned features to the target task, and adapt the model parameters to the new task. Load forecasting and flywheel speed forecasting share similarities in time series modeling. Therefore, transfer learning can be used to apply knowledge from load forecasting models to flywheel speed forecasting, thereby improving forecast accuracy, reducing reliance on large amounts of data, and increasing training efficiency.
[0063] Based on this, the present invention proposes a method for predicting the speed of a flywheel energy storage system based on load forecast transfer learning, aiming to achieve efficient and accurate flywheel speed prediction by making full use of the deep learning model of the load forecasting task, and provide technical support for the optimized scheduling and control strategy of the flywheel energy storage system.
[0064] In an exemplary embodiment, Figure 1 As shown, a method for predicting the speed of an energy storage flywheel based on load prediction transfer learning is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0065] Step 202 : constructing a source domain dataset and a target domain dataset. The source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data.
[0066] In step 202, the source domain dataset is the dataset used for source domain training. The source domain refers to a task domain with a relatively large amount of data. The target domain dataset is the dataset used for target domain training. The target domain refers to a task domain with a relatively small amount of data and a different distribution from the source domain.
[0067] In step 202, historical load data refers to the load on the power transmission network during the historical period. A flywheel is a physical energy storage technology that converts electrical energy into mechanical energy for storage by rotating the flywheel at high speed through an electric motor. Historical load-related data refers to other types of data that affect the load on the power transmission network during the historical period. Historical flywheel speed data refers to the rate at which the flywheel rotates around its central axis during the historical period. Historical flywheel speed-related data refers to other types of data that affect the flywheel speed data during the historical period.
[0068] Exemplarily, historical load data and historical load-related data are obtained to construct a source domain dataset; historical flywheel speed data and historical flywheel speed-related data are obtained to construct a target domain dataset.
[0069] Step 204 : After pre-training the load forecasting model using the source domain dataset, the output layer of the load forecasting model is removed to obtain a first intermediate model.
[0070] In step 204, the load forecasting model is a deep learning model used to forecast load.
[0071] Exemplarily, a source domain dataset is selected as a training dataset of the source domain, and the load forecasting model is pre-trained. After the pre-training is completed, the output layer of the pre-trained load forecasting model is removed, and the remaining part of the pre-trained load forecasting model is used as the first intermediate model.
[0072] In step 206, the first intermediate model is used as a feature extractor in the domain adversarial neural network model. After adversarial training is performed on the domain adversarial neural network model using the source domain dataset and the target domain dataset, the feature extractor is extracted to obtain a second intermediate model.
[0073] In step 206, the Domain-Adversarial Neural Network (DANN) model is a deep learning framework for domain adaptation. It is primarily used to eliminate feature distribution differences between the source and target domains to improve the model's generalization performance in the target domain. The feature extractor is a component of the DANN model.
[0074] Exemplarily, the first intermediate model is directly used as a feature extractor in the domain adversarial neural network model, and then the source domain dataset and the target domain dataset are used to form a training set of the domain adversarial neural network model. The training set is used to perform adversarial training on the domain adversarial neural network model. After the adversarial training is completed, the feature extractor in the trained domain adversarial neural network model is extracted as the second intermediate model.
[0075] Exemplarily, the structure of the feature extractor in the domain adversarial neural network model is selected to be the same as that of the first intermediate model, and the model parameters of the first intermediate model are used as the initial values of the model parameters of the feature extractor. Then, the source domain dataset and the target domain dataset are used to form a training set of the domain adversarial neural network model. The training set is used to perform adversarial training on the domain adversarial neural network model. After the adversarial training is completed, the feature extractor in the trained domain adversarial neural network model is extracted as the second intermediate model.
[0076] In step 208 , the output end of the second intermediate model is connected to the fully connected output layer to obtain a flywheel speed prediction model, and the flywheel speed prediction model is fine-tuned using the target domain dataset to obtain a target flywheel speed prediction model.
[0077] In step 208, the flywheel speed prediction model is used to predict the flywheel speed.
[0078] Exemplarily, a fully connected output layer is connected to the output end of the second intermediate model, and the second intermediate model connected to the fully connected output layer is used as a flywheel speed prediction model. The target domain dataset is used as a training dataset of the target domain to fine-tune the flywheel speed prediction model. The fine-tuned flywheel speed prediction model is the target flywheel speed prediction model.
[0079] In step 210, the flywheel speed data before the prediction time and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction time is output.
[0080] In step 210, the prediction time refers to the time when the flywheel speed needs to be predicted, which is selected based on demand.
[0081] Exemplarily, the flywheel speed data before the prediction moment and the corresponding flywheel speed related data are used as input data of the target flywheel speed prediction model, input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
[0082] In the above-mentioned energy storage flywheel speed prediction method based on load forecast transfer learning, a source domain dataset is constructed using historical load data and historical load-related data, and a target domain dataset is constructed using historical flywheel speed data and historical flywheel speed-related data. Considering that both load forecasting and flywheel speed prediction are time series prediction problems, and the two have similarities in data features and modeling methods, the present invention first uses the source domain dataset for pre-training to enable the model to obtain a time series feature representation with good generalization ability. Then, the first intermediate model is used as a feature extractor in the domain adversarial neural network model. Through adversarial training, the feature distribution difference between the source domain dataset and the target domain dataset is reduced, so that the two have more consistent representations in the same feature space. Finally, through fine-tuning, the flywheel speed prediction model achieves optimal performance on limited data. The present invention realizes knowledge transfer from load forecasting to flywheel speed prediction, optimizes the performance of the target flywheel speed prediction model, and thus better improves the accuracy of flywheel speed prediction. As a result, the accuracy of the flywheel speed prediction data at the prediction time obtained by inputting the flywheel speed data before the prediction time and the corresponding flywheel speed-related data into the target flywheel speed prediction model is more accurate than that of the related art.
[0083] In an exemplary embodiment, in step 202, the historical load-related data includes weather temperature, humidity, date properties, and real-time electricity prices. The historical flywheel speed-related data includes main system output, flywheel motor temperature, grid frequency, and user load.
[0084] Among them, weather temperature refers to the weather temperature data corresponding to the collection of transmission network load. Humidity refers to the weather humidity data corresponding to the collection of transmission network load. Date property refers to whether the corresponding day is a holiday or a weekday when the transmission network load is collected. Real-time electricity price refers to the real-time electricity price data corresponding to the collection of transmission network load. Main system output refers to the energy storage flywheel main system output data corresponding to the collection of flywheel speed data. Flywheel motor temperature refers to the energy storage flywheel motor temperature data corresponding to the collection of flywheel speed data. Grid frequency refers to the transmission network grid frequency corresponding to the collection of flywheel speed data. User load refers to the user load data corresponding to the collection of flywheel speed data.
[0085] This embodiment considers multiple data types, including weather temperature, humidity, date properties, and real-time electricity prices, which influence transmission network load, and main system output, flywheel motor temperature, grid frequency, and user load, which influence flywheel speed. Compared to related techniques that consider a single factor affecting transmission network load or flywheel speed, this approach integrates the characteristics of multiple data types to achieve a more comprehensive data representation, reducing the one-sidedness of considering a single factor. Furthermore, data types such as weather temperature, humidity, date properties, and real-time electricity prices have a strong correlation with transmission network load, while data types such as main system output, flywheel motor temperature, grid frequency, and user load have a strong correlation with flywheel speed. Using these highly correlated data in training allows the model to more accurately capture the characteristic patterns that influence output, thereby improving the model's prediction accuracy.
[0086] In an exemplary embodiment, in step 202, constructing a source domain dataset and a target domain dataset includes: using a sliding window method to set a time step, extracting historical load-related data and historical load data for multiple time steps from historical data as input data of the source domain dataset, extracting historical load data from the historical data as a label of the source domain dataset, and the input data of the source domain dataset and the label of the source domain dataset constitute the source domain dataset; using a sliding window method to set a time step, extracting historical flywheel speed-related data and historical flywheel speed data for multiple time steps from historical data as input data of the target domain dataset, extracting historical flywheel speed data from the historical data as a label of the target domain dataset, and the input data of the target domain dataset and the label of the target domain dataset constitute the target domain dataset.
[0087] The sliding window method refers to the process of sliding the window forward by a set time step each time for the same type of data at consecutive moments in the historical data to obtain data for multiple time steps of the corresponding length within the window. The set time step refers to the pre-set sequence length. The sequence length refers to the number of identical data in a set of input data. The time step refers to a moment. Historical data refers to data on the energy storage flywheel system acquired during a historical period, including historical load data, historical load-related data, historical flywheel speed data, and historical flywheel speed-related data. Input data refers to the input to the model during training. Labels are the true values used in calculating the loss during training.
[0088] In this embodiment, considering that the load data and flywheel speed data are both time series data, the data points at a single moment cannot fully reflect the dynamic changes of the system. Therefore, the sliding window method is used to process the input data into a sequence form. Compared with the related technology that uses input at a single moment, the model can better capture the changing trends of various types of input data over time, reduce the interference of random numerical values, and improve the prediction stability of the model.
[0089] In an exemplary embodiment, in step 206, adversarial training is performed on the domain adversarial neural network model using the source domain dataset and the target domain dataset, including: during the adversarial training, calculating the predictor loss and the domain adversarial loss to obtain a total loss function; calculating the gradient of the predictor loss, and using a gradient reversal layer to calculate the reverse gradient of the domain adversarial loss, and using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss to update the parameters of the feature extractor; when the total loss function converges, the adversarial training is completed.
[0090] The predictor loss describes the load forecast error. The domain adversarial loss is used to reduce the difference in feature distribution between the source and target domains. The total loss function includes the predictor loss and the domain adversarial loss. The gradient reversal layer is a neural network module that implements adversarial optimization by reversing the gradient direction. Convergence of the total loss function means that the fluctuation range of the total loss function value is less than a preset threshold or the gradient vector approaches zero.
[0091] In this embodiment, a total loss function is derived by integrating multiple losses, including the predictor loss and the domain adversarial loss. Adversarial training is completed when the total loss function converges. This enables more comprehensive model learning and avoids the one-sided model optimization that can occur when using a single loss as the basis for training. Furthermore, by calculating the reverse gradient of the domain adversarial loss and using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss to update the parameters of the feature extractor, the optimization direction of the feature extractor can be opposite to that of the domain classifier, thereby reducing the distribution deviation between the source and target domain data.
[0092] In an exemplary embodiment, the load forecasting model adopts a one-dimensional residual network, which includes an input layer, an intermediate layer and an output layer, and the intermediate layer includes multiple residual blocks.
[0093] The one-dimensional residual network is a deep learning architecture designed for sequential data. The input layer is the layer that receives data in the load forecasting model. The intermediate layers are the remaining layers, excluding the input and output layers. The output layer is the layer that outputs the forecast results. The residual block consists of a one-dimensional convolutional layer, batch normalization, and an activation function, with skip connections used to directly transfer the input to the output.
[0094] In this embodiment, a one-dimensional residual network is used as the load forecasting model. The one-dimensional residual network can perform residual extraction and noise reduction on the input data, which can better achieve noise suppression. In addition, the existence of the residual block can reduce the impact of random factors on the prediction accuracy, thereby better improving the reliability of the model.
[0095] In an exemplary embodiment, after obtaining the target flywheel speed prediction model, the method further includes: using at least one evaluation index to perform performance evaluation on the target flywheel speed prediction model, where the evaluation index is selected from mean square error and mean absolute error.
[0096] Evaluation metrics are indicators that quantify model performance. Mean squared error (MSE) is the average of the squares of the differences between the predicted and true values and is used to measure the difference between the model's predictions and the true values. Mean absolute error (MAE) is the average absolute deviation between the predicted and true values and is used to measure the accuracy of the prediction model.
[0097] In this embodiment, the performance of the target flywheel speed prediction model is evaluated by using at least one of the mean square error and the mean absolute error, which can quantify the performance of the target flywheel speed prediction model and thus more intuitively judge the quality of the trained model.
[0098] For example, the energy storage flywheel speed prediction method based on load forecast transfer learning specifically includes:
[0099] Step 302 : constructing a source domain dataset and a target domain dataset. The source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data.
[0100] Specifically, for the subsequent load forecasting task and flywheel speed forecasting task, step 302 first needs to obtain two types of data: historical load forecasting dataset and historical flywheel speed forecasting dataset. s It can be expressed as in is the historical load data at the i-th moment. s The total number of moments in the historical load forecast dataset. The historical load data at the i-th moment is input data, including: Weather temperature at the i-th moment Humidity at the i-th moment Date properties of the i-th moment Real-time electricity price at the i-th moment Various parameters, namely The (i) in each symbol represents the i-th moment. The nature of the date refers to whether it is a weekday or a holiday.
[0101] Historical flywheel speed prediction dataset D t It can be expressed as in is the historical flywheel speed data at the jth moment. t The total number of moments in the historical flywheel speed prediction dataset. The input data related to the historical flywheel speed at the jth moment, specifically including: the historical flywheel speed data at the jth moment The main system output at the jth moment Flywheel motor temperature at the jth moment Grid frequency at the jth moment User load at the jth moment Various parameters, namely (j) in each symbol represents the j-th moment.
[0102] In some embodiments, in order to make the parameters in the data set more normalized, step 302 also requires performing standard deviation (Z-score) normalization on the historical load prediction data set and the historical flywheel speed prediction data set respectively.
[0103] Specifically, the formula for Z-score standardization satisfies:
[0104]
[0105] Where, is the value after x is standardized. x is the parameter to be standardized, and x is taken from the historical load related input data X s Input data X related to historical flywheel speed t Any parameter in μ. x and σ x are the mean and standard deviation respectively. For example, if x is taken from the historical load-related input data X s The temperature at a certain moment in time, then μ x and σ x Take the historical load related input data X s The mean and standard deviation of all temperatures are calculated in . If x is taken from the historical flywheel speed related input data X t The grid frequency is μ x and σ x Take the historical flywheel speed related input data X t The mean and standard deviation are calculated using all grid frequencies.
[0106] Because load data and flywheel speed data are both time series data, a single data point at a specific moment cannot fully reflect system dynamics. Therefore, after normalization, in step 302, a sliding window approach is used to extract information from multiple time steps of historical data to construct source and target domain datasets. The historical data includes a historical load prediction dataset and a historical flywheel speed prediction dataset.
[0107] A sliding window method is used to extract historical load-related data and historical load data at multiple time steps from historical data with a set time step as the input data of the source domain dataset. The historical load data is extracted from the historical data as the label of the source domain dataset. The input data and the label of the source domain dataset constitute the source domain dataset. A sliding window method is used to extract historical flywheel speed-related data and historical flywheel speed data at multiple time steps from historical data with a set time step as the input data of the target domain dataset. The historical flywheel speed data is extracted from the historical data as the label of the target domain dataset. The input data and the label of the target domain dataset constitute the target domain dataset. Both the source domain dataset and the target domain dataset can be divided into multiple samples, each of which includes a set of input data and a label. The various parameters included in each set of input data are a set of sequences, and the sequence length is equal to the time step.
[0108] For example, after the historical load-related input data passes through the sliding window and slides to the i-1th moment, the corresponding set of input data of the source domain dataset is It can be expressed as:
[0109]
[0110] Where m is the time step, The number of rows is equal to the time step, that is, Each column includes the values of the corresponding parameters at m moments (i.e., m time steps). For example, the last column includes the real-time electricity prices at m moments, specifically the real-time electricity price at the im-th moment. Real-time electricity price at time i-m+1 ..., the real-time electricity price at time i-1 The meanings of other symbols can refer to the meanings of real-time electricity prices. The corresponding label is the historical load data at the i-th moment The input data of all groups of source domain datasets and the corresponding labels constitute the source domain dataset.
[0111] After the historical flywheel speed related input data passes through the sliding window, when it slides to the j-1th moment, the corresponding set of input data of the target domain dataset is It can be expressed as:
[0112]
[0113] in, The number of rows is equal to the time step, that is, Each column includes the values of the corresponding parameters at m time steps. For example, the last column includes the user load at m moments, specifically the user load at the jmth moment User load at the j-m+1th moment ..., user load at time j-1 The meanings of other symbols can refer to the meaning of user load. The corresponding label is the historical flywheel speed data at the jth moment The input data of all groups of target domain datasets and the corresponding labels constitute the target domain dataset.
[0114] Step 304 : After pre-training the load forecasting model using the source domain dataset, the output layer of the load forecasting model is removed to obtain a first intermediate model.
[0115] Specifically, the load forecasting model adopts a one-dimensional residual network, which includes an input layer, an intermediate layer, and an output layer, wherein the intermediate layer includes multiple residual blocks. Figure 2 FIG. 1 is a schematic diagram of the structure of a one-dimensional residual network model in an embodiment. Figure 2 As shown in the figure, the one-dimensional residual network (1D-ResNet) consists of an input layer, layer 1, multiple residual blocks (Residual Block), and a fully connected output layer. Layer 1 is a convolutional layer. Layers 2 and 3 in each residual block are convolutional layers. Layer 1 and multiple residual blocks constitute the intermediate layer. The fully connected output layer is the output layer of the 1D-ResNet model. The core of the 1D-ResNet model is residual learning. The calculation formula of the residual block is as follows:
[0116] h (l) =f(h (l-1) +F(h (l-1) ));
[0117] Where h (l) represents the feature map of layer l; h (l-1) represents the feature map of the l-1 layer, F(h (l-1) ) represents the convolution operation of this layer; f(·) represents the activation function (ReLU), which is used to introduce nonlinear characteristics. The 1D-ResNet model is optimized using mean square error loss, and the loss function L load satisfy:
[0118]
[0119] Where, Represents the predicted value, which in this invention refers to the load data predicted by the load forecasting model. i Represents the true value, which in this invention refers to the historical load data in the source domain dataset. s Indicates the number of samples in the source domain dataset.
[0120] In step 304, the 1D-ResNet model effectively captures patterns in time series data and improves gradient propagation efficiency. The 1D-ResNet model is trained on the source domain to extract multi-scale time series features from the load data, thereby completing the load forecasting task. After pre-training the load forecasting model using the source domain dataset, the final fully connected output layer of the 1D-ResNet is deleted, and the remaining portion is retained as the feature extraction component. This retained portion constitutes the first intermediate model.
[0121] In step 306, the first intermediate model is used as a feature extractor in the domain adversarial neural network model. After adversarial training is performed on the domain adversarial neural network model using the source domain dataset and the target domain dataset, the feature extractor is extracted to obtain a second intermediate model.
[0122] Specifically, considering that in transfer learning, there may be distribution deviation between the source domain dataset and the target domain dataset, namely:
[0123]
[0124] Where y s is the historical load data in the source domain dataset. t is the historical flywheel speed data in the target domain dataset. s Input data related to historical load. t is the historical flywheel speed related input data. P(·) is the probability distribution.
[0125] Due to the different feature spaces, directly using a load forecasting model trained on the source domain (such as the 1D-ResNet model) to predict data in the target domain will result in large errors. Therefore, embodiments of the present invention introduce a Domain-Adversarial Neural Network (DANN) model to narrow the feature distribution differences between the source and target domains, allowing the data in the source and target domains to have a more consistent representation in the same feature space.
[0126] In an embodiment of the present invention, the DANN model introduces an adversarial training strategy to learn a feature extractor so that the extracted features cannot be distinguished between the source domain and the target domain, thereby achieving the effect of consistent distribution of extracted features. Specifically, the DANN model structure can be expressed as Figure 3 , mainly consists of three modules: feature extractor, target predictor and domain classifier:
[0127] During forward propagation, the feature extractor is used to map the input features to the shared feature space h, that is:
[0128] h=f θ (X);
[0129] Among them, f θ is a feature extractor, θ is a parameter of the feature extractor, and in one embodiment of the present invention, f θ is the part without the output layer in the 1D-ResNet model. X is the input feature. Specifically, a set of input data is randomly obtained from the input data of all source domain datasets and all target domain datasets as the input feature. The input feature of the i-th time can be expressed as x i .
[0130] The target predictor is used to predict the label y based on the shared features h, namely:
[0131]
[0132] Among them, C φ is the target predictor and φ is the parameter of the target predictor. is the predicted value, which in this embodiment of the present invention refers to the load data predicted by the target predictor. Label y refers to the historical load data.
[0133] The domain classifier is used to determine whether the input feature belongs to the source domain S or the target domain T. The domain classifier outputs the domain label d∈{S,T}, that is:
[0134]
[0135] Among them, D ψ is the domain classifier, and ψ is the parameter of the domain classifier. is the discriminant result output by the domain classifier. d is the pre-labeled discriminant result.
[0136] The goal of the DANN model is to minimize the distribution difference between the source domain and the target domain. To this end, DANN performs adversarial training by maximizing the similarity of the feature representations of the source domain and the target domain. Specifically, the DANN model has two training objectives, namely the predictor loss (Task Loss) and the domain adversarial loss (Domain Loss):
[0137] The target predictor loss is used to describe the error of load forecasting, namely:
[0138]
[0139] Among them, L task is the predictor loss, n is the number of samples in the source domain dataset, is the load data predicted by the target predictor, y Ci It is the historical load data in the source domain dataset.
[0140] Domain adversarial loss is used to narrow the feature distribution difference between the source domain and the target domain, namely:
[0141]
[0142] Among them, L domain is the domain adversarial loss, is the source domain feature output by the feature extractor, is the target domain feature output by the feature extractor, D ψ is the domain classifier, y i and are the actual value and the predicted value, n s and n t are the number of samples in the source domain dataset and the number of samples in the target domain dataset, respectively. and are data samples from the source domain and the target domain respectively.
[0143] The total loss function of DANN is:
[0144] L=L task +λL domain ;
[0145] Where L is the total loss and λ is a hyperparameter that balances task loss and domain loss.
[0146] To achieve domain adaptation, Figure 3 As shown in Figure 1, the DANN model uses a gradient reversal layer (GRL) for adversarial training, making the distribution of data in the source domain and target domain more similar in the shared feature space.
[0147] Figure 4 FIG. 1 is a diagram showing the training process of a domain adversarial neural network model in one embodiment. Figure 4 As shown in Figure 2, the training process of the DANN model includes:
[0148] Each time, any set of input data from the source domain dataset and the target domain dataset is randomly selected as the input data of the DANN model; the corresponding source domain sample feature F(x s ) and target domain sample features F(x t ); through source domain data samples Train the target predictor C φ , and calculate the predictor loss L task and update the target predictor C φ Parameter φ; Use the source domain sample feature F(x s ) and target domain sample features F(x t )Training domain classifier D ψ , and calculate the domain adversarial loss L domain and update the classifier D ψThe parameter ψ, which is not passed through the GRL layer, D ψ It has the ability to distinguish between source domain and target domain data; using GRL, calculate the domain adversarial loss L domain Reverse gradient, and then use the update formula to back propagate and update the parameters of each module, so that the generated domain features F (including the source domain sample features F (x s ) and target domain sample features F(x t )) has more domain-invariant features, where the update formula of the feature extractor satisfies:
[0149]
[0150] Where θ F is the parameter of the feature extractor, and α is the step size control factor.
[0151] Repeat the above steps and gradually increase the value of λ until the total loss L converges and the final model has good domain adaptability. Remove the feature extractor from the final DANN model to obtain the second intermediate model.
[0152] In step 308 , the output end of the second intermediate model is connected to the fully connected output layer to obtain a flywheel speed prediction model. The flywheel speed prediction model is fine-tuned using the target domain dataset to obtain a target flywheel speed prediction model.
[0153] Figure 5 FIG. 1 is a flow chart of the transfer learning process in an embodiment. Taking the load forecasting model using the 1D-ResNet model as an example, Figure 5 As shown in Figure 2, the process of obtaining the target flywheel speed prediction model through transfer learning includes:
[0154] First, in the source domain, the source domain dataset is input into the 1D-ResNet model for prediction loss and backpropagation processing to train the 1D-ResNet model. The trained 1D-ResNet model can extract multi-scale time series features of the load data. After completing the training in the source domain, the last output layer of the 1D-ResNet is deleted, and the remaining feature extraction part is retained. The retained feature extraction part is used as the feature extractor of the DANN model. The feature extractor is connected to the target predictor and the domain classifier respectively to construct the DANN model. The constructed DANN model is subjected to adversarial training to adjust the feature space of the source domain dataset and the target domain dataset to obtain a shared feature space of the source domain and the target domain. The adjusted feature extractor is taken out and its weight is retained. At the end, a randomly initialized fully connected output layer is added to obtain the flywheel speed prediction model, which is adapted to the target task through the following formula:
[0155]
[0156] Where, is the flywheel speed prediction model predicted by the flywheel, W fc and b are the fully connected layer parameters to be trained; h feat It is the feature vector after 1D-ResNet processing.
[0157] Finally, the target domain dataset is fed into the flywheel speed prediction model, which undergoes prediction loss and backpropagation to fine-tune the model. The trained flywheel speed prediction model becomes the target flywheel speed prediction model. Using the target flywheel speed prediction model for flywheel speed prediction improves the accuracy of flywheel speed prediction.
[0158] Among them, the target flywheel speed prediction model can also be obtained by using indicators such as mean square error (MSE) and mean absolute error (MAE) to evaluate the performance of the trained flywheel speed prediction model.
[0159]
[0160] Where y t,i is the historical flywheel speed data in the target domain dataset, is the flywheel speed predicted by the flywheel speed prediction model. n t is the number of samples in the domain dataset.
[0161] Step 310: Input the flywheel speed data before the prediction time and the corresponding flywheel speed related data into the target flywheel speed prediction model, and output the flywheel speed prediction data at the prediction time.
[0162] In step 310, the prediction time may be the current time. When the flywheel speed at the current time needs to be predicted, the flywheel speed data for the time step before the current time and the corresponding flywheel speed-related data are collected, input into the target flywheel speed prediction model, and the flywheel speed prediction data for the current time is output.
[0163] In this embodiment, the accuracy and stability of flywheel speed prediction are improved by migrating deep learning models from the load forecasting task. The core of this method lies in utilizing a transfer learning strategy to transfer knowledge from load forecasting to the flywheel speed prediction task. Since both load forecasting and flywheel speed prediction are time series prediction problems, they share similarities in data characteristics and modeling approaches. This method first trains a deep learning model using a public load forecasting dataset to extract features such as historical load, temperature and humidity, and time. A 1D ResNet18 network is used as the time series feature extraction network, pre-trained on a large-scale dataset to obtain a time series feature representation with good generalization capabilities. After training, all parameters except the input and output layers are frozen, and only the input and output layers are adjusted to suit the flywheel speed prediction task. Input features include historical speed, motor temperature, date attributes, and time information. By adapting the input layer, the model is adapted to accept flywheel speed data. The output layer is adjusted to the predicted flywheel speed value, and the model is fine-tuned to achieve optimal performance with limited flywheel speed data. This method effectively addresses the problem of scarce flywheel speed data and improves prediction accuracy.
[0164] The method of the present invention performs feature extraction, domain adaptive adjustment, transfer learning and other processing on the load forecasting and flywheel speed prediction tasks, and finally realizes the accurate prediction of the flywheel speed. The advantage of the present invention is that it effectively utilizes the existing load forecasting model to improve the accuracy of the flywheel speed prediction, while reducing the dependence on a large amount of flywheel speed data. Through transfer learning, this method can achieve efficient training in the case of small samples, avoiding the high computational cost of training deep learning models from scratch. In addition, this method greatly improves the generalization ability of the model, so that it can adapt to the flywheel speed prediction needs under different working conditions, and provide reliable technical support for the optimal scheduling of flywheel energy storage systems.
[0165] By combining the load forecasting model with the flywheel speed prediction task, the present invention constructs an efficient, low-cost flywheel speed prediction method with good generalization ability. While improving the prediction accuracy, it reduces the consumption of computing resources and provides a new solution for the intelligent control of energy storage systems.
[0166] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0167] Based on the same inventive concept, the embodiments of the present application also provide a device for predicting the speed of an energy storage flywheel based on load prediction transfer learning, which is used to implement the above-mentioned method for predicting the speed of an energy storage flywheel based on load prediction transfer learning. The implementation solution provided by the device is similar to the implementation solution described in the above-mentioned method. Therefore, the specific limitations of one or more embodiments of the device for predicting the speed of an energy storage flywheel based on load prediction transfer learning provided below can be found in the above-mentioned limitations on the method for predicting the speed of an energy storage flywheel based on load prediction transfer learning, and will not be repeated here.
[0168] In an exemplary embodiment, Figure 6 As shown, a device for predicting the speed of an energy storage flywheel based on load forecast transfer learning is provided, comprising: a data set construction module, a pre-training module, an adversarial training module, a fine-tuning module and a prediction module, wherein:
[0169] A data set construction module is used to construct a source domain data set and a target domain data set, the source domain data set includes historical load data and historical load-related data, and the target domain data set includes historical flywheel speed data and historical flywheel speed-related data;
[0170] a pre-training module, configured to pre-train the load forecasting model using a source domain dataset, and then remove an output layer of the load forecasting model to obtain a first intermediate model;
[0171] An adversarial training module is configured to use the first intermediate model as a feature extractor in a domain adversarial neural network model, perform adversarial training on the domain adversarial neural network model using a source domain dataset and a target domain dataset, and extract the feature extractor to obtain a second intermediate model;
[0172] a fine-tuning module, configured to connect the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tune the flywheel speed prediction model using a target domain dataset to obtain a target flywheel speed prediction model;
[0173] The prediction module is used to input the flywheel speed data before the prediction time and the corresponding flywheel speed related data into the target flywheel speed prediction model, and output the flywheel speed prediction data at the prediction time.
[0174] In some embodiments, in the data set construction module, historical load-related data include weather temperature, humidity, date properties and real-time electricity prices; historical flywheel speed-related data include main system output, flywheel motor temperature, grid frequency and user load.
[0175] In some embodiments, the dataset construction module is specifically used to: adopt a sliding window method to set a time step, extract historical load-related data and historical load data of multiple time steps from historical data as input data of a source domain dataset, extract historical load data from historical data as a label of the source domain dataset, and the input data of the source domain dataset and the label of the source domain dataset constitute the source domain dataset; adopt a sliding window method to set a time step, extract historical flywheel speed-related data and historical flywheel speed data of multiple time steps from historical data as input data of a target domain dataset, extract historical flywheel speed data from historical data as a label of the target domain dataset, and the input data of the target domain dataset and the label of the target domain dataset constitute the target domain dataset.
[0176] In some embodiments, in the pre-training module, the load forecasting model adopts a one-dimensional residual network, which includes an input layer, an intermediate layer and an output layer, and the intermediate layer includes multiple residual blocks.
[0177] In some embodiments, in the adversarial training module, the domain adversarial neural network model is subjected to adversarial training using the source domain dataset and the target domain dataset, including: during the adversarial training, calculating the predictor loss and the domain adversarial loss to obtain a total loss function; calculating the gradient of the predictor loss, and using the gradient reversal layer to calculate the reverse gradient of the domain adversarial loss, and using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss to update the parameters of the feature extractor; when the total loss function converges, the adversarial training is completed.
[0178] In some embodiments, the fine-tuning module is further configured to, after obtaining the target flywheel speed prediction model, further include: using at least one evaluation indicator to perform performance evaluation on the target flywheel speed prediction model, the evaluation indicator being selected from mean square error and mean absolute error.
[0179] Each module in the aforementioned energy storage flywheel speed prediction device based on load forecast transfer learning can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a computer device memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0180] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for predicting the speed of an energy storage flywheel based on load prediction transfer learning is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0181] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0182] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0183] Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data;
[0184] After pre-training the load forecasting model using the source domain dataset, the output layer of the load forecasting model is removed to obtain a first intermediate model;
[0185] The first intermediate model is used as a feature extractor in the domain adversarial neural network model. After adversarial training of the domain adversarial neural network model using the source domain dataset and the target domain dataset, the feature extractor is extracted to obtain the second intermediate model.
[0186] Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model;
[0187] The flywheel speed data before the prediction time and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction time is output.
[0188] In one embodiment, when the processor executes the computer program, the following steps are further implemented: historical load-related data includes weather temperature, humidity, date properties and real-time electricity price; historical flywheel speed-related data includes main system output, flywheel motor temperature, grid frequency and user load.
[0189] In one embodiment, when the processor executes the computer program, the following steps are further implemented: using a sliding window method to set a time step, extracting historical load-related data and historical load data for multiple time steps from the historical data as input data of a source domain dataset, extracting historical load data from the historical data as a label of the source domain dataset, and the input data of the source domain dataset and the label of the source domain dataset constitute the source domain dataset; using a sliding window method to set a time step, extracting historical flywheel speed-related data and historical flywheel speed data for multiple time steps from the historical data as input data of a target domain dataset, extracting historical flywheel speed data from the historical data as a label of the target domain dataset, and the input data of the target domain dataset and the label of the target domain dataset constitute the target domain dataset.
[0190] In one embodiment, when executing the computer program, the processor further implements the following steps: when performing adversarial training, calculating the predictor loss and the domain adversarial loss to obtain a total loss function; calculating the gradient of the predictor loss, and using a gradient reversal layer to calculate the reverse gradient of the domain adversarial loss, and using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss to update the parameters of the feature extractor; when the total loss function converges, the adversarial training is completed.
[0191] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the load forecasting model adopts a one-dimensional residual network, the one-dimensional residual network includes an input layer, an intermediate layer and an output layer, and the intermediate layer includes multiple residual blocks.
[0192] In one embodiment, when the processor executes the computer program, the following steps are further implemented: after obtaining the target flywheel speed prediction model, the following steps are also included: using at least one evaluation indicator to perform performance evaluation on the target flywheel speed prediction model, and the evaluation indicator is selected from mean square error and mean absolute error.
[0193] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0194] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0195] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0196] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processor (DSP), a programmable logic unit (PLC), a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, and the like.
[0197] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0198] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for predicting the speed of an energy storage flywheel based on load forecast transfer learning, characterized in that: The method comprises: Constructing a source domain dataset and a target domain dataset, wherein the source domain dataset includes historical load data and historical load-related data, and the target domain dataset includes historical flywheel speed data and historical flywheel speed-related data; After pre-training the load forecasting model using the source domain dataset, removing the output layer of the load forecasting model to obtain a first intermediate model; Using the first intermediate model as a feature extractor in a domain adversarial neural network model, performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extracting the feature extractor to obtain a second intermediate model; Connecting the output end of the second intermediate model to the fully connected output layer to obtain a flywheel speed prediction model, and fine-tuning the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model; The flywheel speed data before the prediction moment and the corresponding flywheel speed related data are input into the target flywheel speed prediction model, and the flywheel speed prediction data at the prediction moment is output.
2. The method according to claim 1, characterized in that The historical load-related data include weather temperature, humidity, date nature and real-time electricity price; the historical flywheel speed-related data include main system output, flywheel motor temperature, grid frequency and user load.
3. The method according to claim 1 or 2, characterized in that The constructing of the source domain dataset and the target domain dataset includes: A sliding window method is adopted to set a time step, extract historical load-related data and historical load data of multiple time steps from historical data as input data of a source domain dataset, extract historical load data from the historical data as a label of the source domain dataset, and the input data of the source domain dataset and the label of the source domain dataset constitute the source domain dataset; A sliding window method is adopted to set a time step, and historical flywheel speed related data and historical flywheel speed data of multiple time steps are extracted from the historical data as input data of the target domain dataset. The historical flywheel speed data is extracted from the historical data as the label of the target domain dataset. The input data of the target domain dataset and the label of the target domain dataset constitute the target domain dataset.
4. The method according to claim 1, wherein The performing adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset includes: When performing adversarial training, the predictor loss and domain adversarial loss are calculated to obtain the total loss function; Calculating the gradient of the predictor loss, and calculating the reverse gradient of the domain adversarial loss using a gradient reversal layer, and updating the parameters of the feature extractor using the gradient of the predictor loss and the reverse gradient of the domain adversarial loss; When the total loss function converges, the adversarial training is completed.
5. The method according to claim 1, wherein The load forecasting model adopts a one-dimensional residual network, which includes an input layer, an intermediate layer and an output layer, and the intermediate layer includes multiple residual blocks.
6. The method according to claim 1, characterized in that After obtaining the target flywheel speed prediction model, it also includes: At least one evaluation index is used to perform performance evaluation on the target flywheel speed prediction model, and the evaluation index is selected from mean square error and mean absolute error.
7. A device for predicting the speed of an energy storage flywheel based on load prediction transfer learning, characterized in that: The device comprises: a data set construction module, configured to construct a source domain data set and a target domain data set, wherein the source domain data set includes historical load data and historical load-related data, and the target domain data set includes historical flywheel speed data and historical flywheel speed-related data; a pre-training module, configured to pre-train a load forecasting model using the source domain dataset, and then remove an output layer of the load forecasting model to obtain a first intermediate model; an adversarial training module, configured to use the first intermediate model as a feature extractor in a domain adversarial neural network model, perform adversarial training on the domain adversarial neural network model using the source domain dataset and the target domain dataset, and extract the feature extractor to obtain a second intermediate model; a fine-tuning module, configured to connect the output end of the second intermediate model to a fully connected output layer to obtain a flywheel speed prediction model, and fine-tune the flywheel speed prediction model using the target domain dataset to obtain a target flywheel speed prediction model; The prediction module is used to input the flywheel speed data before the prediction time and the corresponding flywheel speed related data into the target flywheel speed prediction model, and output the flywheel speed prediction data at the prediction time.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.