Bayesian optimization-based time series data prediction method, device and equipment
Through Bayesian optimization algorithm, hyperparameter adjustment and multi-model fusion of time series data prediction models is solved, and the accuracy and adaptability of time series data prediction is improved. It is suitable for different Power adjustment of energy storage system.
Patent Information
- Application Number
- CN202411803863.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
传统时间序列数据预测方案在处理复杂和非线性数据时预测结果准确性有限,且不同模型对多样的数据类型表现不一,导致预测精度依赖于超参数的选择,难以提高整体预测准确性。
Using Bayesian optimization-based time series data prediction method, multiple preliminary prediction models are trained, hyperparameter optimization and performance evaluation by cleaning historical data, sampling sample data and dividing training sets, verification sets and test sets. Select the best model for prediction to improve prediction performance.
Through Bayesian optimization algorithm, hyperparameter adjustment of multiple time series data prediction models is improved, the accuracy, robustness and efficiency of prediction is improved, more reliable decision-making basis is provided, and it is adapted to different energy storage systems, which solves the problem of Issues that have not considered the health status in the power adjustment of energy storage system.
Smart Images

Figure CN119295140A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of time series data prediction, and specifically relates to a time series data prediction method, device and equipment based on Bayesian optimization. Background Art
[0002] Time series data prediction is an important part of data analysis and management. Accurate time series data prediction can help enterprises effectively manage operations, optimize resource allocation, and reduce costs. Therefore, it is of great significance to develop a more accurate and efficient time series data prediction solution. For example, time series data prediction is often used in areas such as user load, market electricity prices or stock prices. It is of great significance in adjusting the charging and discharging strategies of industrial and commercial users (generally, industrial and commercial users do not change much in short-term production demand, and the data does not fluctuate much overall. Therefore, it is possible to establish a time series prediction model to predict the user's load, providing support for further refining the charging and discharging strategy of energy storage), participating in grid demand response, and spot trading in the electricity market.
[0003] At present, traditional time series data prediction solutions such as statistical analysis and machine learning often face limitations when processing complex and nonlinear time series data, and different deep learning and machine learning models have their own advantages and disadvantages, making their prediction accuracy highly dependent on the selection of hyperparameters. Therefore, it is crucial to select appropriate hyperparameters. At the same time, since different models perform differently when facing various types of time series data, it is necessary to integrate the prediction results of multiple models through fusion algorithms in order to effectively improve the overall prediction accuracy, which can then help provide enterprises with more reliable decision-making basis through implementation. Summary of the invention
[0004] The purpose of the present invention is to provide a time series data prediction method, device, computer equipment, computer readable storage medium and computer program product based on Bayesian optimization, so as to solve the problem of limited prediction result accuracy of traditional time series data prediction schemes.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions: In a first aspect, a time series data prediction method based on Bayesian optimization is provided, comprising: Acquire time series historical data, wherein the time series historical data contains unit time period and in the The historical data value of each unit period in the unit period, represents a positive integer greater than or equal to 3; The time series historical data is cleaned to obtain cleaned time series historical data, wherein the cleaned time series historical data contains unit time periods and the cleaned historical data values in each unit time period; A plurality of sample data are extracted from the cleaned time series historical data in the following manner: extracting the sequentially continuous sample data from the cleaned time series historical data. The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer of ; Dividing the plurality of sample data into a training set, a validation set and a test set; Using the training set to perform model training on multiple preliminary time series data prediction models constructed based on the artificial intelligence algorithm, respectively, to obtain multiple trained time series data prediction models corresponding to the multiple preliminary time series data prediction models; Using the validation set to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models, respectively, to obtain multiple optimized time series data prediction models corresponding one-to-one to the multiple trained time series data prediction models; For each optimized time series data prediction model in the multiple optimized time series data prediction models, applying the test set to perform performance evaluation on the corresponding model to obtain a corresponding performance evaluation result; Extract the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
[0006] Based on the above invention content, a new solution for time series data prediction based on Bayesian optimization and multi-model fusion is provided, that is, after data cleaning processing is performed on the time series historical data to obtain the cleaned time series historical data, multiple sample data are first extracted from the data and divided into a training set, a validation set and a test set, and then the training set, the validation set and the test set are used to perform model training, hyperparameter Bayesian optimization and performance evaluation on multiple preliminary prediction models constructed based on the artificial intelligence algorithm respectively, and finally the optimized time series data prediction model with the best performance evaluation result is used to predict future time series data. In this way, by using the Bayesian optimization algorithm to adjust and optimize the model hyperparameters of multiple time series data prediction models, the prediction performance of each model can be improved, and by selecting the best model for prediction, the accuracy, robustness, efficiency and response speed of time series data prediction can be effectively improved, which is convenient for practical application and promotion.
[0007] In a possible design, the time series historical data is cleaned to obtain cleaned time series historical data, including: For the For each unit time period in the unit time period, determine whether the historical data value in the corresponding time period is an abnormal value, and if so, remove the abnormal value; For each unit time period, if there is a missing data value in the corresponding time period, the cleaned historical data value in the corresponding time period and used to fill the missing data value is calculated according to the following formula: :
[0008] In the formula, Indicates the historical data value of the most recent unit period before the corresponding period without missing data values. Indicates the historical data value of the nearest unit period after the corresponding period and without missing data values. Indicates the time of the corresponding period. Indicates the time of the most recent previous unit period, Indicates the time of the next most recent unit time period.
[0009] In one possible design, for the For each unit period in the unit period, determine whether the historical data value in the corresponding period is an abnormal value, including: For the For each unit period in the unit period, determine the corresponding statistical analysis value Whether the preset threshold is reached, if so, the historical data value in the corresponding period is determined to be an abnormal value, otherwise the historical data value in the corresponding period is determined not to be an abnormal value, wherein the statistical analysis value Calculated according to the following formula:
[0010] In the formula, Represents the historical data value in the corresponding period, represents the mean of the historical data values in the time series historical data, Represents the standard deviation of the historical data values in the time series historical data.
[0011] In a possible design, after obtaining the cleaned time series historical data and before extracting sample data, the method further includes: For the For each unit period in the unit period, the cleaned historical data value in the corresponding period is normalized according to the following formula:
[0012] In the formula, Indicates the normalized result of the historical data value after cleaning in the corresponding period, Indicates the historical data value after cleaning in the corresponding period, represents the minimum value of the cleaned historical data values in the cleaned time series historical data, Indicates the maximum value of the post-cleaning historical data values in the post-cleaning time series historical data.
[0013] In one possible design, the artificial intelligence algorithm adopts a machine learning algorithm based on support vector machine, stochastic gradient descent, multivariate linear regression, multilayer perceptron, decision tree, back propagation neural network, radial basis function network, ARIMA, LSTM, one-dimensional convolutional neural network or random forest.
[0014] In a possible design, the validation set is used to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models to obtain multiple optimized time series data prediction models corresponding to the multiple trained time series data prediction models, including the following steps S61 to S67: S61. For a certain trained time series data prediction model among the multiple trained time series data prediction models, define a corresponding hyperparameter space, and use the root mean square error of the corresponding model under a given hyperparameter belonging to the hyperparameter space as the corresponding objective function, and then execute step S62; S62. Perform Gaussian process modeling on the objective function of the trained time series data prediction model to obtain a Gaussian process model, and then execute step S63; S63. randomly select multiple points from the hyperparameter space of the trained time series data prediction model, and for each point in the multiple points, apply the validation set to perform model evaluation on the trained time series data prediction model using the hyperparameters of the corresponding point to obtain the corresponding root mean square error, and then execute step S64; S64. Using the evaluated points and the corresponding root mean square errors, update the Gaussian process model, and then execute step S65; S65. According to the Gaussian process model, select an acquisition function to determine the next point to be evaluated in the hyperparameter space of the trained time series data prediction model, and use the hyperparameter combination that maximizes the acquisition function as the next point to be evaluated, and then execute step S66; S66. Apply the validation set to perform model evaluation on the certain trained time series data prediction model using the hyperparameters of the next point to be evaluated, obtain the root mean square error of the next point to be evaluated, and then execute step S67; S67. Determine whether the preset optimization end condition is met. If so, end the Bayesian optimization, and use the trained time series data prediction model with the hyperparameters of the evaluated points corresponding to the minimum root mean square error as the optimized time series data prediction model corresponding to the trained time series data prediction model. Otherwise, repeat steps S64 to S67.
[0015] In one possible design, the method further includes: Applying the time series data prediction method as described in the first aspect or any of the previous possible designs, predicting the estimated value of the electricity price in at least one unit period in the future based on the historical electricity price time series data, and predicting the estimated value of the load of the user load system in at least one unit period in the future based on the historical load time series data of the user load system; According to the estimated value of the electricity price in at least one unit period in the future, a functional relationship between the charging and discharging cost of the energy storage system and the power of the energy storage system is established according to the following formula:
[0016] In the formula, represents the charging and discharging cost, represents the total number of time periods of at least one unit time period in the future, Indicates less than or equal to A positive integer, Indicates the first The estimated electricity price for a unit period, Indicated in the The energy storage system power per unit time period, wherein the energy storage system and the user load system exist in the same microgrid and are connected to the same transformer; According to the parameters of the energy storage system, a functional relationship between the battery capacity loss of the energy storage system and the power of the energy storage system is established according to the following formula:
[0017] In the formula, represents the battery capacity loss, represents the penalty weight coefficient used to control calendar aging, represents the penalty weight coefficient used to control cycle aging, Indicates that the energy storage system is The battery state of charge per unit time period, represents the differential operator, Indicates the energy storage system in the at least one future unit period The battery state of charge of each unit period and represents the battery charge state of the energy storage system in the most recent unit time period before the at least one future unit time period, Indicates the duration of a unit period. represents the energy storage system capacity of the energy storage system, Indicates that the energy storage system is The energy storage system power per unit time period and Indicates the energy storage system power of the energy storage system in the most recent unit time period; According to the functional relationship between the charging and discharging cost of the energy storage system and the battery capacity loss and the power of the energy storage system, the objective function is established according to the following formula: :
[0018] In the formula, Indicates the charging and discharging cost The normalized form of Indicates the battery capacity loss The normalized form of and Respectively represent the preset weight coefficients and have ; The objective function is established based on the load estimate of the user load system in at least one unit period in the future, the maximum allowable power of the transformer, and the upper and lower limits of the battery state of charge of the energy storage system and the upper and lower limits of the energy storage system power. The following constraints:
[0019] In the formula, Indicates that the user load system is in the The load estimate for each unit period is represents the maximum permissible power of the transformer, represents the lower limit of the battery charge state of the energy storage system, represents the upper limit of the battery state of charge of the energy storage system, represents the lower power limit of the energy storage system of the energy storage system, Indicates the energy storage system power upper limit of the energy storage system; According to the objective function and the constraint conditions, optimizing the energy storage system power of the energy storage system in at least one unit period in the future based on the optimization algorithm, obtaining the energy storage system power and using it to make the objective function Minimize the optimization of search results; According to the optimization search result, the energy storage system power of the energy storage system is dynamically adjusted in at least one unit time period in the future.
[0020] In a second aspect, a time series data prediction device based on Bayesian optimization is provided, including a time series data acquisition unit, a data cleaning processing unit, a sample data extraction unit, a sample data division unit, a prediction model training unit, a model parameter optimization unit, a model performance evaluation unit and a prediction model application unit; The time series data acquisition unit is used to acquire time series historical data, wherein the time series historical data contains unit time period and in the The historical data value of each unit period in the unit period, represents a positive integer greater than or equal to 3; The data cleaning processing unit is communicatively connected to the time series data acquisition unit and is used to perform data cleaning on the time series historical data to obtain cleaned time series historical data, wherein the cleaned time series historical data contains the unit time periods and the cleaned historical data values in each unit time period; The sample data extraction unit is communicatively connected to the data cleaning processing unit, and is used to extract a plurality of sample data from the cleaned time series historical data in the following manner: extracting sequentially continuous sample data in time sequence from the cleaned time series historical data; The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer of ; The sample data division unit is communicatively connected to the sample data extraction unit and is used to divide the plurality of sample data into a training set, a validation set and a test set; The prediction model training unit is communicatively connected to the sample data partitioning unit, and is used to apply the training set to perform model training on a plurality of preliminary time series data prediction models constructed based on the artificial intelligence algorithm, so as to obtain a plurality of trained time series data prediction models corresponding to the plurality of preliminary time series data prediction models one by one; The model parameter optimization unit is respectively connected to the sample data partitioning unit and the prediction model training unit for performing Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models using the validation set to obtain multiple optimized time series data prediction models corresponding to the multiple trained time series data prediction models. The model performance evaluation unit is respectively connected to the sample data partitioning unit and the model parameter optimization unit for communication, and is used to apply the test set to perform performance evaluation on the corresponding model for each optimized time series data prediction model in the multiple optimized time series data prediction models to obtain a corresponding performance evaluation result; The prediction model application unit is respectively connected to the data cleaning processing unit and the model performance evaluation unit for extracting the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
[0021] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the time series data prediction method as described in the first aspect or any possible design of the first aspect.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, executes the time series data prediction method as described in the first aspect or any possible design of the first aspect.
[0023] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implement the time series data prediction method as described in the first aspect or any possible design of the first aspect.
[0024] Beneficial effects of the above scheme: (1) The present invention creatively provides a new solution for time series data prediction based on Bayesian optimization for multi-model fusion, that is, after the time series historical data is cleaned to obtain the cleaned time series historical data, multiple sample data are first extracted from the data and divided into a training set, a validation set and a test set, and then the training set, the validation set and the test set are used to perform model training, hyperparameter Bayesian optimization and performance evaluation on multiple preliminary prediction models constructed based on the artificial intelligence algorithm respectively, and finally the optimized time series data prediction model with the best performance evaluation result is used to predict future time series data. In this way, by using the Bayesian optimization algorithm to adjust and optimize the model hyperparameters of multiple time series data prediction models, the prediction performance of each model can be improved, and by selecting the best model for prediction, the accuracy, robustness, efficiency and response speed of time series data prediction can be effectively improved; (2) It can also solve the problem of energy storage cells being prone to aging and capacity decay due to the failure of the optimization target to take into account the health status of the existing energy storage system power adjustment scheme; (3) Since the parameters in the aforementioned capacity loss function can be flexibly adjusted, it can also be adapted to different types of battery cells, ensuring that it can be adapted to different energy storage systems in a variety of situations, and has a high use value; (4) The constraints can also be updated and adjusted when there are power generation equipment in the microgrid to further ensure that different energy storage systems can be adapted in a variety of situations, facilitating practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] Figure 1 A schematic diagram of the process of predicting time series data based on Bayesian optimization provided in an embodiment of the present application.
[0027] Figure 2 A schematic diagram of the structure of a time series data prediction device based on Bayesian optimization provided in an embodiment of the present application.
[0028] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0030] It should be understood that although the terms first and second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are only used to distinguish one object from another object. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.
[0031] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.
[0032] Example like Figure 1 As shown, the time series data prediction method based on Bayesian optimization provided in the first aspect of this embodiment can be, but is not limited to, executed by a computer device with certain computing resources, such as a cloud server. Figure 1 As shown, the time series data prediction method may include but is not limited to the following steps S1 to S8.
[0033] S1. Obtaining time series historical data, wherein the time series historical data includes but is not limited to sequentially unit time period and in the The historical data values of each unit period in the unit period, etc. Represents a positive integer greater than or equal to 3.
[0034] In step S1, the time series historical data is specifically exemplified by, but not limited to, temperature time series historical data, humidity time series historical data, pressure time series historical data, electricity price time series historical data, load time series historical data, or power generation time series historical data, etc. (i.e., the historical data values are historical temperature values, historical humidity values, historical pressure values, historical electricity values, historical load values, or historical power generation values, etc.). The unit time period can be, but not limited to, 1 minute, 15 minutes, 1 hour, 4 hours, half a day, or 1 day, etc. Specifically, the time series historical data can first collect data values in real time at a frequency of seconds through deployed smart devices and high-precision sensors, and then upload the collected data values to a time series database in real time for preliminary storage, and finally obtain them by conventional reading. In order to reduce the amount of data and facilitate subsequent analysis, the time series historical data can be sampled at the 15-minute level through a time window (i.e., the unit time period is 15 minutes, specifically, all the recorded historical data values are divided into sub-intervals in the time dimension: starting from the early morning of each day, each day is divided into 96 time periods with a time period of 15 minutes, and the historical data average value, historical data median value, historical data maximum value and historical data value at the end of each time period are counted, and then the historical data statistics of multiple days are combined into the time series historical data) to ensure data integrity and representativeness. In addition, the collection conditions during data collection can specifically include equipment location, environmental conditions and sampling frequency, etc., to ensure the accuracy and reliability of the data.
[0035] S2. Perform data cleaning on the time series historical data to obtain cleaned time series historical data, wherein the cleaned time series historical data contains the unit time periods and the cleaned historical data values in the respective unit time periods.
[0036] In step S2, the purpose of the data cleaning process is to remove outliers and fill them in order to improve the quality of subsequent model input data. Specifically, the time series historical data is cleaned to obtain cleaned time series historical data, including but not limited to the following steps S21 to S23.
[0037] S21. For each unit time period in the unit time period, determine whether the historical data value in the corresponding time period is an abnormal value. If so, remove the abnormal value.
[0038] In the step S21, specifically, for the For each unit time period in the unit time period, determine whether the historical data value in the corresponding time period is an abnormal value, including but not limited to the following steps: For each unit period in the unit period, determine the corresponding statistical analysis value Whether the preset threshold is reached, if so, the historical data value in the corresponding period is determined to be an abnormal value, otherwise the historical data value in the corresponding period is determined not to be an abnormal value, wherein the statistical analysis value Calculated according to the following formula:
[0039] In the formula, Represents the historical data value in the corresponding period, represents the mean of the historical data values in the time series historical data, The above-mentioned preset threshold value can be preset according to specific cleaning requirements, for example, 3.
[0040] S22. For each unit time period, if there is a missing data value in the corresponding time period, the cleaned historical data value in the corresponding time period and used to fill the missing data value is calculated according to the following formula: :
[0041] In the formula, Indicates the historical data value of the most recent unit period before the corresponding period without missing data values. Indicates the historical data value of the nearest unit period after the corresponding period and without missing data values. Indicates the time of the corresponding period. Indicates the time of the most recent previous unit period, Indicates the time of the next most recent unit time period.
[0042] In step S22, for example, if the unit time period is 15 minutes, there will be 8 unit time periods from 10 o'clock to 12 o'clock; their data value missing conditions are assumed to be: not missing, not missing, not missing, missing, missing, missing, not missing and not missing, then for the 4th unit time period, due to the missing data value in the corresponding time period, the corresponding previous nearest unit time period is the 3rd unit time period, and the corresponding next nearest unit time period is the 7th unit time period; for the 5th unit time period, due to the missing data value in the corresponding time period, the corresponding previous nearest unit time period is the 3rd unit time period, and the corresponding next nearest unit time period is the 7th unit time period; for the 6th unit time period, due to the missing data value in the corresponding time period, the corresponding previous nearest unit time period is the 3rd unit time period, and the corresponding next nearest unit time period is the 7th unit time period. In addition, the aforementioned time can be but not limited to the initial time value, central time value or end time value of the corresponding time period.
[0043] S3. Extract multiple sample data from the cleaned time series historical data in the following manner: extract the sequentially continuous sample data from the cleaned time series historical data. The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer.
[0044] In step S3, when the unit time period is 15 minutes, An example is 96×5, An example is 96, so that the cleaned historical data values from 00:00 on August 1 to 24:00 on August 5 (i.e., a total of 96×5 unit time periods) can be extracted from the cleaned time series historical data as model input items, and the cleaned historical data values from 00:00 on August 6 to 24:00 on August 6 (i.e., a total of 96 unit time periods) can be used as model output items, thereby obtaining a sample data. In addition, in order to improve the convergence speed and stability of subsequent model training, it is necessary to normalize the cleaned historical data values (i.e., scale the cleaned historical data values between 0 and 1). Preferably, after obtaining the cleaned time series historical data and before extracting sample data, the method also includes but is not limited to the following steps: for the cleaned time series historical data, For each unit period in the unit period, the cleaned historical data value in the corresponding period is normalized according to the following formula:
[0045] In the formula, Indicates the normalized result of the historical data value after cleaning in the corresponding period, Indicates the historical data value after cleaning in the corresponding period, represents the minimum value of the cleaned historical data values in the cleaned time series historical data, Indicates the maximum value of the post-cleaning historical data values in the post-cleaning time series historical data.
[0046] S4. Divide the multiple sample data into a training set, a validation set and a test set.
[0047] In step S4, the training set is used to train the model, the validation set is used to adjust the model hyperparameters, and the test set is used to evaluate the model performance. Specifically, the training set, the validation set, and the test set can be divided in a ratio of 6:2:2.
[0048] S5. Use the training set to perform model training on multiple preliminary time series data prediction models constructed based on artificial intelligence algorithms, and obtain multiple trained time series data prediction models that correspond one to one to the multiple preliminary time series data prediction models.
[0049] In step S5, the artificial intelligence algorithm is a core artificial intelligence algorithm that specifically studies how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their own performance. It is the fundamental way to make computers intelligent; specifically, the artificial intelligence algorithm can be but is not limited to specific use based on support vector machines, stochastic gradient descent, multivariate linear regression, multilayer perceptron, decision tree, back propagation neural network, radial basis function network, ARIMA (Autoregressive Integrated Moving Average Model), LSTM (Long Short-Term The aforementioned support vector machine, stochastic gradient descent, multivariate linear regression, multilayer perceptron, decision tree, back propagation neural network, radial basis function network, ARIMA, LSTM, one-dimensional convolutional neural network or random forest are all existing technologies. LSTM, one-dimensional convolutional neural network and random forest are used as examples to introduce them as follows: (1) LSTM is specially used to process and predict time series data. It can capture long-term dependencies and is suitable for time series data. However, it has high computational cost, long training time and is sensitive to hyperparameter selection. Model parameters include the number of LSTM units, time step, learning rate and number of fully connected layers. Tanh and sigmoid activation functions are often used, and the root mean square error (RMSE) is used to predict the time series data. (2) One-dimensional convolutional neural network can extract local features, has good parallel computing capabilities, and can effectively capture local patterns and changing trends in time series data; it is weak in capturing long-term dependencies, and may need to be used in combination with other models to improve the understanding of long time series; model parameters include the number of convolutional layers, convolution kernel size, pooling layer number, learning rate, and fully connected layer number; ReLU activation function is usually used to increase nonlinearity, and the root mean square error (RMSE) is used to evaluate regression prediction models; it is adapted to changes in time series data by adjusting the number of convolutional layers and the size of the convolution kernel; (3) Random forest is easy to implement and not prone to overfitting, can handle nonlinear relationships, and has a strong ability to evaluate feature importance; its sequential processing of time series data is not as good as that of deep learning models; model parameters include the number of trees and the maximum depth of a single tree, and the root mean square error (RMSE) is used for regression prediction models; it is adapted to changes in time series data by adjusting parameters such as the number of trees and the maximum depth.It can be seen that the multiple preliminary time series data prediction models are in a parallel relationship. For different time series data, their prediction performance is different. Therefore, it is necessary to train them and evaluate the performance of the training model through RMSE so as to select the lowest RMSE to predict the time series data.
[0050] In step S5, the specific construction and training process of the multiple preliminary time series data prediction models is the existing technology, and LSTM, one-dimensional convolutional neural network and random forest are still taken as examples: (1) The specific process of constructing the preliminary time series data prediction model based on LSTM is as follows: first define the model structure, including: using the deep learning framework Tensorflow; adding an input layer and specifying the input shape; adding one or more LSTM layers, setting the number of units and time steps; adding a Dropout layer to prevent overfitting; adding a fully connected layer to output the prediction results; and then selecting an activation function: tanh activation function and sigmoid activation function ; Then compile the model, select the loss function RMSE and optimizer Adam; finally train the model, use the training set for model training, and adjust the batch size and training rounds. (2) The specific process of building a preliminary time series data prediction model based on a one-dimensional convolutional neural network is as follows: first define the model structure, including: using the deep learning framework Tensorflow; adding an input layer and specifying the input shape; adding multiple convolutional layers and selecting the appropriate convolution kernel size and number; inserting a pooling layer to reduce the dimension; adding a fully connected layer to output the prediction result; and then selecting the activation function - ReLU activation function ; Then compile the model, select the loss function RMSE and optimizer Adam; finally train the model, use the training set to train the model, adjust the batch size and training rounds. (3) The specific process of building a preliminary time series data prediction model based on random forest is as follows: first define the model structure, including: using scikit-learn to build a random forest model; set the number of trees and the maximum depth; then compile and train the model, and use the training set to train the model.
[0051] S6. Use the validation set to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models, and obtain multiple optimized time series data prediction models that correspond one-to-one to the multiple trained time series data prediction models.
[0052] In step S6, the Bayesian Optimization is a strategy for global optimization of functions, which is particularly suitable for those black box functions with expensive calculations (such as hyperparameter tuning of machine learning models). The core idea is to construct a proxy model (usually a Gaussian process or a random forest) and gradually select the optimal parameters to effectively find the global optimal solution. The specific process of the Bayesian optimization is: after defining the hyperparameter space of the time series prediction model, the hyperparameters of the prediction model are optimized using the Gaussian process model, and then the hyperparameters are automatically adjusted to improve the prediction accuracy. In order to adapt to different time series data characteristics and dynamically adjust the model hyperparameters according to real-time data, thereby enhancing its flexibility and intelligence level, preferably, the validation set is used to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models, and multiple optimized time series data prediction models corresponding to the multiple trained time series data prediction models are obtained, including but not limited to the following steps S61 to S67.
[0053] S61. For a certain post-trained time series data prediction model among the multiple post-trained time series data prediction models, define a corresponding hyperparameter space, and use the root mean square error of the corresponding model under given hyperparameters belonging to the hyperparameter space as the corresponding objective function, and then execute step S62.
[0054] In step S61, if the trained time series data prediction model is a preliminary time series data prediction model based on a one-dimensional convolutional neural network, then since the hyperparameters of the one-dimensional convolutional neural network include the number of convolutional layers (integer), convolution kernel size (integer, usually odd), learning rate (Continuous value, range is ) and the number of fully connected layers (integer), etc., so that the hyperparameter space of the trained time series data prediction model can be expressed as follows:
[0055] In the formula, Represents the hyperparameter space. At the same time, since the hyperparameters of the LSTM include the number of LSTM units (integer), time step (integer) and the learning rate (Continuous value, range is ), etc., and the hyperparameters of the random forest include the number of trees (integer), depth of the tree (integer) and the minimum number of samples (integer), etc., the hyperparameter space of the time series data prediction model after training based on them can be derived in the same way. In addition, the objective function can be specifically expressed as: , the optimization goal is to find the hyperparameter combination To minimize RMSE, that is: .
[0056] S62. Perform Gaussian process modeling on the objective function of the trained time series data prediction model to obtain a Gaussian process model, and then execute step S63.
[0057] In step S62, if is a known set of hyperparameter sample points, is the corresponding RMSE value, then the Gaussian process can be expressed as follows:
[0058] In the formula, represents the mean function, which is usually taken as 0. Represents the functional form of the Gaussian process, Represents the covariance function, such as using the following square exponential kernel:
[0059] In the formula, represents the signal variance, Indicates the length scale.
[0060] S63. Randomly select multiple points from the hyperparameter space of the trained time series data prediction model, and for each point among the multiple points, apply the validation set to perform model evaluation on the trained time series data prediction model using the hyperparameters of the corresponding point to obtain the corresponding root mean square error, and then execute step S64.
[0061] In step S63, the coordinates of each point are a set of hyperparameter values, so different root mean square errors can be obtained by applying the validation set to perform model evaluation on a certain trained time series data prediction model using hyperparameters at different points.
[0062] S64. Using the evaluated points and the corresponding root mean square errors, update the Gaussian process model, and then execute step S65.
[0063] In step S64, the evaluated points refer to the points whose root mean square errors have been evaluated, and may be but are not limited to the individual points.
[0064] S65. According to the Gaussian process model, select an acquisition function to determine the next point to be evaluated in the hyperparameter space of the trained time series data prediction model, and use the hyperparameter combination that maximizes the acquisition function as the next point to be evaluated, and then execute step S66.
[0065] In the step S65, the selection of the acquisition function to determine the next point to be evaluated in the hyperparameter space of the trained time series data prediction model can be expressed by the following formula: ,in, represents the evaluated point corresponding to the minimum root mean square error, and there is , represents the maximum value function, represents the acquisition function, such that the hyperparameter combination that maximizes the acquisition function It can be expressed as .
[0066] S66. Apply the validation set to perform model evaluation on the trained time series data prediction model using the hyperparameters of the next point to be evaluated, obtain the root mean square error of the next point to be evaluated, and then execute step S67.
[0067] S67. Determine whether the preset optimization end condition is met. If so, end the Bayesian optimization, and use the trained time series data prediction model with the hyperparameters of the evaluated points corresponding to the minimum root mean square error as the optimized time series data prediction model corresponding to the trained time series data prediction model. Otherwise, repeat steps S64 to S67.
[0068] In step S67, the optimization end condition is exemplified by but not limited to reaching the maximum number of evaluations or reaching convergence. In addition, the evaluated point corresponding to the minimum root mean square error is the current .
[0069] S7. For each optimized time series data prediction model in the multiple optimized time series data prediction models, use the test set to perform performance evaluation on the corresponding model to obtain a corresponding performance evaluation result.
[0070] In step S7, the performance evaluation result may be, but is not limited to, using the root mean square error as an indicator to evaluate the model performance, that is, the smaller the root mean square error, the better the model performance.
[0071] S8. Extract the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
[0072] In step S8, continuing to refer to the example in the aforementioned step S3, if the current time is 00:00 on November 6, the cleaned historical data values from 00:00 on November 1 to 24:00 on November 5 (i.e., a total of 96×5 unit time periods) can be extracted from the cleaned time series historical data, and imported into an optimized time series data prediction model with the lowest root mean square error among the multiple optimized time series data prediction models, so as to output the predicted data values from 00:00 on November 6 to 24:00 on November 6 (i.e., a total of 96 unit time periods).
[0073] The application example of the time series data prediction method described in the above steps S1 to S8 is explained as follows: Time series data prediction is widely used in the field of industrial and commercial energy storage, among which load forecasting is an important part of power system operation and planning. Load forecasting aims to predict the changing trend and specific value of power load in the future period based on historical load time series data (that is, load time series historical data). The optimized load time series data prediction model obtained based on the time series data prediction method of this embodiment can focus on short-term load forecasting of industrial and commercial electricity. For example, the optimized load time series data prediction model can be established using the historical load time series data of the past three months to accurately predict the load situation in the next day. Compared with the traditional load time series data prediction model, the optimized load time series data prediction model constructed by steps S1 to S7 of this embodiment can achieve significant improvement in accuracy. Specifically, through comparative tests, it was found that the mean absolute percentage error (MAPE) of the optimized load time series data prediction model can be reduced from 8.31% to 7.46%; the root mean square error (RMSE) can be reduced from 88.04 to 81.83; and the mean absolute error (MAE) can be reduced from 66.37 to 60.57. The improvement of this series of indicators shows that the optimized load time series data prediction model can more accurately capture the trend of load changes, which helps to further improve the charging and discharging strategy of the energy storage cabinet and realize refined operation (that is, improving the accuracy of load prediction not only optimizes the configuration of power resources, but also effectively reduces operating costs and improves the stability and reliability of the power system).
[0074] Therefore, based on the time series data prediction method described in the aforementioned steps S1 to S8, a new scheme for time series data prediction based on Bayesian optimization for multi-model fusion is provided, that is, after the time series historical data is cleaned to obtain the cleaned time series historical data, multiple sample data are first extracted from the data and divided into a training set, a validation set and a test set, and then the training set, the validation set and the test set are used to perform model training, hyperparameter Bayesian optimization and performance evaluation on multiple preliminary prediction models constructed based on the artificial intelligence algorithm respectively, and finally the optimized time series data prediction model with the best performance evaluation result is used to predict future time series data. In this way, by using the Bayesian optimization algorithm to adjust and optimize the model hyperparameters of multiple time series data prediction models, the prediction performance of each model can be improved, and by selecting the best model for prediction, the accuracy, robustness, efficiency and response speed of time series data prediction can be effectively improved, which is convenient for practical application and promotion.
[0075] Based on the technical solution of the first aspect mentioned above, this embodiment further provides a possible design 1 for optimizing the power adjustment of an energy storage system by using a time series data prediction method, that is, in view of the problem that the existing power adjustment scheme of the energy storage system has the problem that the energy storage cell is prone to aging and loss and the capacity is prone to decay because the optimization target does not take the health status into consideration, and the problem that the energy storage cell cannot be adapted to different energy storage systems in various situations, the method further includes but is not limited to the following steps S91 to S97.
[0076] S91. Apply the time series data prediction method described in the first aspect, predict the estimated electricity price in at least one unit time period in the future based on the historical electricity price time series data, and predict the estimated load value of the user load system in at least one unit time period in the future based on the historical load time series data of the user load system.
[0077] In the step S91, the historical electricity price time series data, that is, the electricity price time series historical data, specifically includes but is not limited to multiple historical unit time periods that are sequentially continuous in time series and the electricity value of each historical unit time period in the multiple historical unit time periods; the historical load time series data, that is, the load time series historical data, specifically includes but is not limited to multiple historical unit time periods that are sequentially continuous in time series and the load value of each historical unit time period of the user load system in the multiple historical unit time periods; they can all be recorded and obtained conventionally. The specific prediction process of the aforementioned electricity price and load time series data can be conventionally derived with reference to the aforementioned steps S1 to S8, and will not be repeated here. In addition, the at least one unit time period in the future needs to be sequentially continuous in time series so as to serve as the future time zone for dynamic power adjustment of the energy storage system.
[0078] S92. According to the estimated value of the electricity price in at least one unit period in the future, a functional relationship between the charging and discharging cost of the energy storage system and the power of the energy storage system is established according to the following formula:
[0079] In the formula, represents the charging and discharging cost, represents the total number of time periods of at least one unit time period in the future, Indicates less than or equal to A positive integer, Indicates the first The estimated electricity price for each unit period, Indicated in the The energy storage system power per unit time period, the energy storage system and the user load system exist in the same microgrid and are connected to the same transformer.
[0080] In step S92, the energy storage system power These are the parameters to be optimized later (there will be The microgrid refers to a small power generation and distribution system composed of distributed power sources, energy storage devices, energy conversion devices, loads, monitoring and protection devices, etc., wherein the distributed power sources include but are not limited to the mains power grid and power generation equipment, etc.
[0081] S93. According to the parameters of the energy storage system, a functional relationship between the battery capacity loss of the energy storage system and the power of the energy storage system is established according to the following formula:
[0082] In the formula, represents the battery capacity loss, represents the penalty weight coefficient used to control calendar aging, represents the penalty weight coefficient used to control cycle aging, Indicates that the energy storage system is The battery state of charge per unit time period, represents the differential operator, Indicates the energy storage system in the at least one future unit period The battery state of charge of each unit period and represents the battery charge state of the energy storage system in the most recent unit time period before the at least one future unit time period, Indicates the duration of a unit period. represents the energy storage system capacity of the energy storage system, Indicates that the energy storage system is The energy storage system power per unit time period and Represents the energy storage system power of the energy storage system in the most recent unit time period.
[0083] In step S93, the energy storage system capacity It is the parameter of the energy storage system. Considering that the capacity loss of the battery is mainly caused by the following two aspects: (1) calendar aging caused by the battery staying in a high charge state; (2) cycle aging caused by the battery charge and discharge cycle. Therefore, this embodiment uses Indicates the loss due to calendar aging and is expressed as Represents the capacity loss caused by charge and discharge cycles, where the penalty weight coefficient and It can be pre-set specifically according to the business situation. In addition, for example, if the at least one future unit time period is at least one current future unit time period, the most recent unit time period is the current unit time period.
[0084] S94. According to the functional relationship between the charging and discharging cost of the energy storage system and the battery capacity loss and the power of the energy storage system, establish the objective function according to the following formula: :
[0085] In the formula, Indicates the charging and discharging cost The normalized form of Indicates the battery capacity loss The normalized form of and Respectively represent the preset weight coefficients and have .
[0086] In step S94, the objective function is the function that needs to be minimized (that is, ) in order to achieve the optimal goals of economic benefits and health status. S95. Establish the objective function according to the load estimate of the user load system in at least one unit period in the future, the maximum allowable power of the transformer, and the upper and lower limits of the battery state of charge of the energy storage system and the upper and lower limits of the energy storage system power. The following constraints:
[0087] In the formula, Indicates that the user load system is in the The load estimate for each unit period is represents the maximum permissible power of the transformer, represents the lower limit of the battery charge state of the energy storage system, represents the upper limit of the battery state of charge of the energy storage system, represents the lower power limit of the energy storage system of the energy storage system, Indicates the energy storage system power upper limit of the energy storage system.
[0088] S96. According to the objective function and the constraint conditions, optimizing the energy storage system power of the energy storage system in at least one unit period in the future based on the optimization algorithm, obtaining the energy storage system power and using it to make the objective function Minimize the search results.
[0089] In step S96, specifically, the optimization algorithm may be, but is not limited to, a particle swarm optimization algorithm, a Newton optimization algorithm, a genetic optimization algorithm, a gray wolf optimization algorithm, or a tuna swarm optimization algorithm. The aforementioned optimization algorithms are all optimization algorithms that can conventionally search for the objective function under the constraints. Minimize the energy storage system power of the energy storage system in at least one unit time period in the future (i.e., constitute the optimization search result), wherein, taking the particle swarm optimization algorithm as an example, the specific optimization process includes the following steps (A) to (F).
[0090] (A) Initialize the particle swarm: randomly generate a certain number of particles, each particle represents a potential solution; initialize the position and velocity of each particle.
[0091] (B) Evaluate fitness: Calculate the fitness value of each particle, usually through an objective function.
[0092] (C) Update individual and global optimality: Each particle updates its speed and position based on its own historical best position (individual optimality) and the best position of the entire group (global optimality).
[0093] (D) Update velocity and position: Use the following formula to update the velocity and position of the particle: Speed update formula:
[0094] Position update formula:
[0095] in, is the inertia weight, and is the learning factor, and is a random number, is the optimal position of the particle, is the global best position.
[0096] (E) Check termination conditions: Determine whether to terminate the algorithm based on the set conditions (such as reaching the maximum number of iterations or the fitness reaching a threshold).
[0097] (F) Output result: If the termination condition is met, output the global optimal solution; otherwise return to step (C).
[0098] S97. Dynamically adjust the energy storage system power of the energy storage system in at least one unit time period in the future according to the optimization search result.
[0099] Compared with the existing energy storage system power adjustment scheme, the technical scheme described in the above steps S91 to S97 introduces a capacity loss function (i.e., ), and in the optimization process, the negative impact of high SOC (State of charge, the percentage of the remaining battery power to the rated capacity of the battery) and frequent charge and discharge cycles on the capacity of the energy storage cabinet are taken into account, so that the optimization results can maximize the charge and discharge benefits while making the energy storage system charge and discharge at a lower power as much as possible (i.e., slow charge and slow discharge), and reduce the duration of the energy storage cabinet at high SOC. This can solve the problem of energy storage cells being prone to aging and capacity attenuation due to the fact that the optimization target does not take into account the health status of the energy storage system power adjustment scheme. In addition, since the parameters in the aforementioned capacity loss function can be flexibly adjusted, different types of cells can also be adapted to ensure that different energy storage systems are adapted in a variety of situations.
[0100] Therefore, based on the aforementioned possible design one, it is also possible to solve the problem of energy storage cells being prone to aging and capacity decay due to the optimization target not taking the health status into account in the existing power adjustment scheme of the energy storage system. In addition, since the parameters in the aforementioned capacity loss function can be flexibly adjusted, it can also be adapted to different types of cells, ensuring that different energy storage systems can be adapted in a variety of situations, which has a high use value.
[0101] Based on the technical solution of the aforementioned possible design one, this embodiment also provides a possible design one for adjusting the constraint conditions when there is a power generation device in the microgrid, that is, when there is still a power generation device in the microgrid, the method also includes but is not limited to the following steps S951~S952.
[0102] S951. Apply the time series data prediction method described in the first aspect to predict the estimated value of the power generation of the power generation equipment in at least one unit time period in the future based on the historical power generation time series data of the power generation equipment.
[0103] In step S951, the power generation equipment specifically includes but is not limited to photovoltaic panels and / or wind turbines and other new energy power generation equipment. The historical power generation time series data, i.e., the power generation time series historical data, specifically includes but is not limited to a plurality of historical unit time periods that are sequentially continuous in time series and the power generation value of each historical unit time period of the power generation equipment in the plurality of historical unit time periods; it can also be obtained by conventional recording. The specific prediction process of the aforementioned power generation time series data can be conventionally derived with reference to the aforementioned steps S1 to S8, which will not be described in detail here.
[0104] S952. Add the constraints Replace it with the following formula:
[0105] In the formula, Indicates that the power generation equipment is in the Estimated value of generated power per unit time period.
[0106] Therefore, based on the aforementioned possible design 2, the constraints can also be updated and adjusted when there are power generation equipment in the microgrid, so as to further ensure the adaptation of different energy storage systems in various situations.
[0107] like Figure 2 As shown, the second aspect of this embodiment provides a virtual device for implementing the time series data prediction method described in the first aspect or any possible design in the first aspect, including a time series data acquisition unit, a data cleaning processing unit, a sample data extraction unit, a sample data division unit, a prediction model training unit, a model parameter optimization unit, a model performance evaluation unit and a prediction model application unit; The time series data acquisition unit is used to acquire time series historical data, wherein the time series historical data contains unit time period and in the The historical data value of each unit period in the unit period, represents a positive integer greater than or equal to 3; The data cleaning processing unit is communicatively connected to the time series data acquisition unit and is used to perform data cleaning on the time series historical data to obtain cleaned time series historical data, wherein the cleaned time series historical data contains the unit time periods and the cleaned historical data values in each unit time period; The sample data extraction unit is communicatively connected to the data cleaning processing unit, and is used to extract a plurality of sample data from the cleaned time series historical data in the following manner: extracting sequentially continuous sample data in time sequence from the cleaned time series historical data; The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer of ; The sample data division unit is communicatively connected to the sample data extraction unit and is used to divide the plurality of sample data into a training set, a validation set and a test set; The prediction model training unit is communicatively connected to the sample data partitioning unit, and is used to apply the training set to perform model training on a plurality of preliminary time series data prediction models constructed based on the artificial intelligence algorithm, so as to obtain a plurality of trained time series data prediction models corresponding to the plurality of preliminary time series data prediction models one by one; The model parameter optimization unit is respectively connected to the sample data partitioning unit and the prediction model training unit for performing Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models using the validation set to obtain multiple optimized time series data prediction models corresponding to the multiple trained time series data prediction models. The model performance evaluation unit is respectively connected to the sample data partitioning unit and the model parameter optimization unit for communication, and is used to apply the test set to perform performance evaluation on the corresponding model for each optimized time series data prediction model in the multiple optimized time series data prediction models to obtain a corresponding performance evaluation result; The prediction model application unit is respectively connected to the data cleaning processing unit and the model performance evaluation unit for extracting the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
[0108] In a possible design, it also includes an electricity price load prediction unit, a first function establishment unit, a second function establishment unit, an objective function establishment unit, a constraint condition establishment unit, a system power optimization unit and a power dynamic adjustment unit; The electricity price load prediction unit is used to apply the time series data prediction method as described in the first aspect to predict the electricity price estimate in at least one unit period in the future according to the historical electricity price time series data, and to predict the load estimate of the user load system in at least one unit period in the future according to the historical load time series data of the user load system; The first function establishing unit is communicatively connected to the electricity price load prediction unit, and is used to establish a functional relationship between the charging and discharging cost of the energy storage system and the power of the energy storage system according to the following formula based on the estimated value of the electricity price in at least one unit time period in the future:
[0109] In the formula, represents the charging and discharging cost, represents the total number of time periods of at least one unit time period in the future, Indicates less than or equal to A positive integer, Indicates the first The estimated electricity price for each unit period, Indicated in the The energy storage system power per unit time period, wherein the energy storage system and the user load system exist in the same microgrid and are connected to the same transformer; The second function establishing unit is used to establish a functional relationship between the battery capacity loss of the energy storage system and the power of the energy storage system according to the following formula based on the parameters of the energy storage system:
[0110] In the formula, represents the battery capacity loss, represents the penalty weight coefficient used to control calendar aging, represents the penalty weight coefficient used to control cycle aging, Indicates that the energy storage system is The battery state of charge per unit time period, represents the differential operator, Indicates the energy storage system in the at least one future unit period The battery state of charge of each unit period and represents the battery charge state of the energy storage system in the most recent unit time period before the at least one future unit time period, Indicates the duration of a unit period. represents the energy storage system capacity of the energy storage system, Indicates that the energy storage system is The energy storage system power per unit time period and Indicates the energy storage system power of the energy storage system in the most recent unit time period; The objective function establishing unit is respectively connected to the first function establishing unit and the second function establishing unit in communication, and is used to establish the objective function according to the following formula based on the functional relationship between the charging and discharging cost of the energy storage system and the battery capacity loss and the power of the energy storage system :
[0111] In the formula, Indicates the charging and discharging cost The normalized form of Indicates the battery capacity loss The normalized form of and Respectively represent the preset weight coefficients and have ; The constraint condition establishment unit is communicatively connected to the electricity price load prediction unit, and is used to establish the objective function according to the load estimation value of the user load system in at least one unit period in the future, the maximum allowable power of the transformer, and the upper and lower limits of the battery state of charge of the energy storage system and the upper and lower limits of the energy storage system power. The following constraints:
[0112] In the formula, Indicates that the user load system is in the The load estimate for each unit period is represents the maximum permissible power of the transformer, represents the lower limit of the battery charge state of the energy storage system, represents the upper limit of the battery state of charge of the energy storage system, represents the lower power limit of the energy storage system of the energy storage system, Indicates the energy storage system power upper limit of the energy storage system; The system power optimization unit is respectively connected to the objective function establishment unit and the constraint condition establishment unit for establishing a system power according to the objective function. and the constraint conditions, optimizing the energy storage system power of the energy storage system in at least one unit period in the future based on the optimization algorithm, obtaining the energy storage system power and using it to make the objective function Minimize the optimization of search results; The power dynamic adjustment unit is communicatively connected to the system power optimization unit, and is used to dynamically adjust the energy storage system power of the energy storage system in at least one unit time period in the future according to the optimization search result.
[0113] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be referred to the time series data prediction method described in the first aspect or any possible design of the first aspect, and will not be described in detail here.
[0114] like Figure 3As shown, the third aspect of this embodiment provides a computer device for executing the time series data prediction method as described in the first aspect or any possible design in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the time series data prediction method as described in the first aspect or any possible design in the first aspect. For example, the memory may include, but is not limited to, a random access memory (Random-Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), a flash memory (Flash Memory), a first-in-first-out memory (First Input First Output, FIFO) and / or a first-in-last-out memory (First Input Last Output, FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.
[0115] The working process, working details and technical effects of the aforementioned computer device provided in the third aspect of this embodiment can be referred to the time series data prediction method described in the first aspect or any possible design of the first aspect, and will not be described in detail here.
[0116] In a fourth aspect of this embodiment, there is provided a computer-readable storage medium storing instructions for a time series data prediction method as described in the first aspect or any possible design in the first aspect, that is, the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the time series data prediction method as described in the first aspect or any possible design in the first aspect is executed. Wherein, the computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to computer-readable storage media such as floppy disks, optical disks, hard disks, flash memories, USB flash drives and / or memory sticks, and the computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices.
[0117] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fourth aspect of this embodiment can be referred to the time series data prediction method described in the first aspect or any possible design in the first aspect, and will not be repeated here.
[0118] A fifth aspect of the present embodiment provides a computer program product, including a computer program or instructions, wherein the computer program or instructions, when executed by a computer, implements the time series data prediction method as described in the first aspect or any possible design of the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0119] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A time series data prediction method based on Bayesian optimization, characterized in that: include: Acquire time series historical data, wherein the time series historical data contains unit time period and in the The historical data value of each unit period in the unit period, represents a positive integer greater than or equal to 3; The time series historical data is cleaned to obtain cleaned time series historical data, wherein the cleaned time series historical data contains unit time periods and the cleaned historical data values in each unit time period; A plurality of sample data are extracted from the cleaned time series historical data in the following manner: extracting the sequentially continuous sample data from the cleaned time series historical data. The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer of ; Dividing the plurality of sample data into a training set, a validation set and a test set; Using the training set to perform model training on multiple preliminary time series data prediction models constructed based on the artificial intelligence algorithm, respectively, to obtain multiple trained time series data prediction models corresponding to the multiple preliminary time series data prediction models; Using the validation set to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models, respectively, to obtain multiple optimized time series data prediction models corresponding one-to-one to the multiple trained time series data prediction models; For each optimized time series data prediction model in the multiple optimized time series data prediction models, applying the test set to perform performance evaluation on the corresponding model to obtain a corresponding performance evaluation result; Extract the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
2. The time series data prediction method according to claim 1, characterized in that: The time series historical data is cleaned to obtain cleaned time series historical data, including: For the For each unit time period in the unit time period, determine whether the historical data value in the corresponding time period is an abnormal value, and if so, remove the abnormal value; For each unit time period, if there is a missing data value in the corresponding time period, the cleaned historical data value in the corresponding time period and used to fill the missing data value is calculated according to the following formula: : In the formula, Indicates the historical data value of the most recent unit period before the corresponding period without missing data values. Indicates the historical data value of the nearest unit period after the corresponding period and without missing data values. Indicates the time of the corresponding period. Indicates the time of the most recent previous unit period, Indicates the time of the next most recent unit time period.
3. The time series data prediction method according to claim 2, characterized in that: For the For each unit period in the unit period, determine whether the historical data value in the corresponding period is an abnormal value, including: For the For each unit period in the unit period, determine the corresponding statistical analysis value Whether the preset threshold is reached, if so, the historical data value in the corresponding period is determined to be an abnormal value, otherwise the historical data value in the corresponding period is determined not to be an abnormal value, wherein the statistical analysis value Calculated according to the following formula: In the formula, Represents the historical data value in the corresponding period, represents the mean of the historical data values in the time series historical data, Represents the standard deviation of the historical data values in the time series historical data.
4. The time series data prediction method according to claim 1, characterized in that: After obtaining the cleaned time series historical data and before extracting sample data, the method further includes: For the For each unit period in the unit period, the cleaned historical data value in the corresponding period is normalized according to the following formula: In the formula, Indicates the normalized result of the historical data value after cleaning in the corresponding period, Indicates the historical data value after cleaning in the corresponding period, represents the minimum value of the cleaned historical data values in the cleaned time series historical data, Indicates the maximum value of the post-cleaning historical data values in the post-cleaning time series historical data.
5. The time series data prediction method according to claim 1, characterized in that: The artificial intelligence algorithm adopts a machine learning algorithm based on support vector machine, stochastic gradient descent, multivariate linear regression, multilayer perceptron, decision tree, back propagation neural network, radial basis function network, ARIMA, LSTM, one-dimensional convolutional neural network or random forest.
6. The time series data prediction method according to claim 1, characterized in that: Using the validation set to perform Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models respectively, to obtain multiple optimized time series data prediction models corresponding one-to-one to the multiple trained time series data prediction models, includes the following steps S61-S67: S61. For a certain trained time series data prediction model among the multiple trained time series data prediction models, define a corresponding hyperparameter space, and use the root mean square error of the corresponding model under a given hyperparameter belonging to the hyperparameter space as the corresponding objective function, and then execute step S62; S62. Perform Gaussian process modeling on the objective function of the trained time series data prediction model to obtain a Gaussian process model, and then execute step S63; S63. randomly select multiple points from the hyperparameter space of the trained time series data prediction model, and for each point in the multiple points, apply the validation set to perform model evaluation on the trained time series data prediction model using the hyperparameters of the corresponding point to obtain the corresponding root mean square error, and then execute step S64; S64. Using the evaluated points and the corresponding root mean square errors, update the Gaussian process model, and then execute step S65; S65. According to the Gaussian process model, select an acquisition function to determine the next point to be evaluated in the hyperparameter space of the trained time series data prediction model, and use the hyperparameter combination that maximizes the acquisition function as the next point to be evaluated, and then execute step S66; S66. Apply the validation set to perform model evaluation on the certain trained time series data prediction model using the hyperparameters of the next point to be evaluated, obtain the root mean square error of the next point to be evaluated, and then execute step S67; S67. Determine whether the preset optimization end condition is met. If so, end the Bayesian optimization, and use the trained time series data prediction model with the hyperparameters of the evaluated points corresponding to the minimum root mean square error as the optimized time series data prediction model corresponding to the trained time series data prediction model. Otherwise, repeat steps S64 to S67.
7. The time series data prediction method according to claim 1, characterized in that: The method further comprises: Applying the time series data prediction method as described in any one of claims 1 to 6, predicting an estimated electricity price in at least one unit period in the future based on historical electricity price time series data, and predicting an estimated load value of the user load system in at least one unit period in the future based on historical load time series data of the user load system; According to the estimated value of the electricity price in at least one unit period in the future, a functional relationship between the charging and discharging cost of the energy storage system and the power of the energy storage system is established according to the following formula: In the formula, represents the charging and discharging cost, represents the total number of time periods of at least one unit time period in the future, Indicates less than or equal to A positive integer, Indicates the first The estimated electricity price for a unit period, Indicated in the The energy storage system power per unit time period, wherein the energy storage system and the user load system exist in the same microgrid and are connected to the same transformer; According to the parameters of the energy storage system, a functional relationship between the battery capacity loss of the energy storage system and the power of the energy storage system is established according to the following formula: In the formula, represents the battery capacity loss, represents the penalty weight coefficient used to control calendar aging, represents the penalty weight coefficient used to control cycle aging, Indicates that the energy storage system is The battery state of charge per unit time period, represents the differential operator, Indicates the energy storage system in the at least one future unit period The battery state of charge of each unit period and represents the battery charge state of the energy storage system in the most recent unit time period before the at least one future unit time period, Indicates the duration of a unit period. represents the energy storage system capacity of the energy storage system, Indicates that the energy storage system is The energy storage system power per unit time period and Indicates the energy storage system power of the energy storage system in the most recent unit time period; According to the functional relationship between the charging and discharging cost of the energy storage system and the battery capacity loss and the power of the energy storage system, the objective function is established according to the following formula: : In the formula, Indicates the charging and discharging cost The normalized form of Indicates the battery capacity loss The normalized form of and Respectively represent the preset weight coefficients and have ; The objective function is established based on the load estimate of the user load system in at least one unit period in the future, the maximum allowable power of the transformer, and the upper and lower limits of the battery state of charge of the energy storage system and the upper and lower limits of the energy storage system power. The following constraints: In the formula, Indicates that the user load system is in the The load estimate for each unit period is represents the maximum permissible power of the transformer, represents the lower limit of the battery charge state of the energy storage system, represents the upper limit of the battery state of charge of the energy storage system, represents the lower power limit of the energy storage system of the energy storage system, Indicates the energy storage system power upper limit of the energy storage system; According to the objective function and the constraint conditions, optimizing the energy storage system power of the energy storage system in at least one unit period in the future based on the optimization algorithm, obtaining the energy storage system power and using it to make the objective function Minimize the optimization of search results; According to the optimization search result, the energy storage system power of the energy storage system is dynamically adjusted in at least one unit time period in the future.
8. The time series data prediction method according to claim 7, characterized in that: When there is a power generation device in the microgrid, the method further includes: Applying the time series data prediction method as described in any one of claims 1 to 6, predicting the estimated value of the power generation of the power generation equipment in at least one unit time period in the future based on the historical power generation time series data of the power generation equipment; The constraints Replace it with the following formula: In the formula, Indicates that the power generation equipment is in the Estimated value of generated power per unit time period.
9. A time series data prediction device based on Bayesian optimization, characterized in that: It includes a time series data acquisition unit, a data cleaning and processing unit, a sample data extraction unit, a sample data division unit, a prediction model training unit, a model parameter optimization unit, a model performance evaluation unit and a prediction model application unit; The time series data acquisition unit is used to acquire time series historical data, wherein the time series historical data contains unit time period and in the The historical data value of each unit period in the unit period, represents a positive integer greater than or equal to 3; The data cleaning processing unit is communicatively connected to the time series data acquisition unit and is used to perform data cleaning on the time series historical data to obtain cleaned time series historical data, wherein the cleaned time series historical data contains the unit time periods and the cleaned historical data values in each unit time period; The sample data extraction unit is communicatively connected to the data cleaning processing unit, and is used to extract a plurality of sample data from the cleaned time series historical data in the following manner: extracting the sample data that are sequentially continuous in time sequence from the cleaned time series historical data; The cleaned historical data values of the unit time period are used as the model input items, and the cleaned time series historical data are extracted from the cleaned time series historical data. After unit periods and sequentially in time The cleaned historical data values of the unit time period are used as the model output items, and then the model input items and the model output items are used as a sample data, wherein, Indicates greater than or equal to 2 and less than A positive integer, Indicates less than or equal to A positive integer of ; The sample data division unit is communicatively connected to the sample data extraction unit and is used to divide the plurality of sample data into a training set, a validation set and a test set; The prediction model training unit is communicatively connected to the sample data partitioning unit, and is used to apply the training set to perform model training on a plurality of preliminary time series data prediction models constructed based on the artificial intelligence algorithm, so as to obtain a plurality of trained time series data prediction models corresponding to the plurality of preliminary time series data prediction models one by one; The model parameter optimization unit is respectively connected to the sample data partitioning unit and the prediction model training unit for performing Bayesian optimization on the hyperparameters of the multiple trained time series data prediction models using the validation set to obtain multiple optimized time series data prediction models corresponding to the multiple trained time series data prediction models. The model performance evaluation unit is respectively connected to the sample data partitioning unit and the model parameter optimization unit for communication, and is used to apply the test set to perform performance evaluation on the corresponding model for each optimized time series data prediction model in the multiple optimized time series data prediction models to obtain a corresponding performance evaluation result; The prediction model application unit is respectively connected to the data cleaning processing unit and the model performance evaluation unit for extracting the most recent consecutive data in time sequence from the cleaned time series historical data. The cleaned historical data values of the unit time period are imported into a certain optimized time series data prediction model with the best performance evaluation result among the multiple optimized time series data prediction models, and the output is obtained in the most recent The future that is consecutive in time after unit periods The predicted data value for each unit period.
10. A computer device, characterized in that: It includes a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the time series data prediction method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Micro-grid multi-objective optimal scheduling method and system based on model predictive control
CN110417015A
Automatic modeling method and system based on data analyzing processing system
CN110717535A
Multi-point distributed energy storage system aggregation control intelligent decision-making method and device
CN115459320A
Charging and discharging strategy determination method and system of energy storage system
CN116663933A
Photovoltaic power generation prediction method based on time sequence model and related equipment
CN116722548A