Energy supply and demand prediction method based on LSTM, storage medium and electronic equipment
By introducing a multi-head attention mechanism and attention mechanism into the LSTM model, the energy supply and demand prediction accuracy of mobile energy storage systems is improved, the problem of low prediction accuracy in the existing technology is solved, and more accurate energy storage package scheduling is achieved.
Patent Information
- Application Number
- CN202411245413.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the accuracy of energy supply and demand prediction of mobile energy storage systems in different regions is low and cannot effectively guide the dispatch of energy storage packages.
Using the LSTM-based energy supply and demand prediction method, by obtaining the state data of multiple consecutive acquisition cycles of the energy storage package, using the multi-head attention mechanism and the LSTM model of the memory update unit, energy demand and supply information are generated to improve the prediction accuracy.
Through the introduction of multi-head attention mechanism and attention mechanism, the expression ability and robustness of the model are enhanced, the prediction accuracy is improved, the characteristics and long-term dependencies can be captured more accurately, and the scheduling decisions of energy storage packages are improved.
Smart Images

Figure CN119204097A_ABST
Abstract
Description
Background Art
[0002] Mobile Energy Storage Systems (MESS) are portable or removable devices that can store electrical energy and release it when needed. These systems are often used in a variety of scenarios, such as auxiliary services for power systems, emergency power supply, energy buffering for electric vehicle charging stations, and temporary power supply in remote areas. Mobile energy storage systems can use different energy storage technologies, such as lithium-ion batteries, lead-acid batteries, sodium-sulfur batteries, etc.
[0003] Usually, due to the different electricity usage habits and environmental conditions of people in different areas, there will be large differences in the energy supply and demand characteristics in different areas. Therefore, how to more accurately obtain the energy supply and demand rules in each area at different times is of great guiding significance for the advance scheduling of energy storage packages in mobile energy storage systems. In the prior art, the prediction results of energy supply and demand at different times in each area are of low accuracy and cannot guide the scheduling of energy storage packages more accurately. Summary of the invention
[0004] In view of the above technical problems, the technical solution adopted by the present invention is:
[0005] According to one aspect of the present invention, a method for energy supply and demand forecasting based on LSTM is provided, and the method comprises the following steps:
[0006] Obtain the target state data in the target area. The target state data includes a two-dimensional state data table corresponding to all energy storage packages in multiple continuous acquisition cycles. Each line in the two-dimensional state data table is a state data sequence corresponding to an energy storage package. The state data sequence includes multiple feature dimensions, including: acquisition time, current remaining power of the energy storage package, location, temperature of the environment, humidity of the environment, number of charges and discharges in the corresponding acquisition cycle, and usage time.
[0007] The target state data is input into the target LSTM model to generate the energy demand information and energy supply information corresponding to the target area.
[0008] The target LSTM model includes:
[0009] Multi-head attention extraction unit and the first LSTM model. The first LSTM model includes a memory update unit.
[0010] The multi-head attention extraction unit is used to capture different feature subspaces in the target state data by using multiple attention heads in parallel, generate the current input feature sequence, and input it into the first LSTM model.
[0011] The memory update unit is used to generate the memory unit state C at the current time stept . C t The following conditions must be met:
[0012]
[0013] Among them, f t The memory cell state C generated by the forget gate in the first LSTM model to control the previous time step t-1 The proportion to be retained. t Generated by the input gate in the first LSTM model to control the degree of influence of the input of the current time step on the state of the memory unit. is the candidate memory cell state of the current time step. t-1 , C t-1 , C t-1 ) is the hidden state h of the previous time step generated by using the attention mechanism algorithm t-1 and the memory cell state C t-1 Attention(h t-1 , C t-1 , C t-1 ) meets the following conditions:
[0014] Attention(h t-1 , C t-1 , C t-1 )=∑ j a j (W a ·[h t-1 , C t-1 ]).
[0015] Among them, a j is the attention weight corresponding to the time step, by t-1 and C t-1 The linear transformation of W a is a weight matrix used to transform hidden states and memory cell states into attention vectors. j a j (W a ·[h t-1 , C t-1 ]) represents a corresponding to all time steps j in the input sequence j (W a ·[h t-1 , C t-1 ]) to sum.
[0016] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the above-mentioned LSTM-based energy supply and demand forecasting method is implemented.
[0017] According to a third aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned LSTM-based energy supply and demand forecasting method when executing the computer program.
[0018] The present invention has at least the following beneficial effects:
[0019] In the present invention, a multi-head attention mechanism is introduced before the LSTM model (i.e., the first LSTM model). The multi-head attention mechanism uses multiple attention heads in parallel, each head performs attention operations independently, each head can focus on different features in the input sequence, and then splices the results together, so that the input information finally input into the LSTM model can capture more features, enhance the expression ability and robustness of the model, and improve the prediction accuracy of the model.
[0020] In addition, in the processing of the memory update unit of the first LSTM model, the attention mechanism for the previous memory is also added (i.e., Attention (h t-1 , C t-1 , C t-1 )), therefore, by introducing the attention mechanism at this position, the model’s memory capacity can be enhanced by paying attention to the hidden state and memory unit state of the previous time step, thereby improving the model’s ability to capture long-term dependencies and improving the model’s prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0022] Figure 1 A flow chart of a method for preprocessing energy storage package status data provided by an embodiment of the present invention;
[0023] Figure 2 A flowchart of an energy supply and demand forecasting method based on LSTM provided in an embodiment of the present invention;
[0024] Figure 3 A flow chart of an energy storage package scheduling method provided by an embodiment of the present invention;
[0025] Figure 4 A flowchart of a scheduling path planning method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] As a possible embodiment of the present invention, Figure 1 As shown, a method for preprocessing energy storage package state data is provided, and the method comprises the following steps:
[0028] S100: Acquire the state information sequence of the energy storage package in a preset collection cycle, and generate a state data set of the energy storage package in a preset period. The state information sequence includes multiple feature dimensions. Specifically, the feature dimensions include: the current remaining power of the energy storage package, the location, the temperature of the environment, the humidity of the environment, the number of charges and discharges in the preset collection cycle, and the usage time.
[0029] The specific explanations of the above feature dimensions are as follows: The current remaining power of the energy storage package. Location: The current geographical location of the energy storage package (longitude and latitude). Temperature: The current temperature of the energy storage package. Usage history: The historical usage record of the energy storage package, including the number of charge and discharge times and the usage time. Environmental factors: External environmental data that affects energy demand and supply (such as ambient temperature and humidity). Time characteristics: Capture periodic and trend changes in time series data. Energy demand and supply: Predicted energy demand and supply data, which can be used as labels for later training of the original model of the target LSTM model.
[0030] Specifically, the collection period corresponding to each piece of data can be determined according to the specific system design. In general, the collection period can be: Daily collection: collect data once every 24 hours. Scheduled collection: collect data at fixed time intervals (such as every hour or every minute).
[0031] In this embodiment, assuming that each piece of data corresponds to a collection period of one day, the specific form of the data set of each energy storage package can be a two-dimensional table, in which each row represents the data of one day and each column represents a feature dimension.
[0032] S200: Performing outlier detection processing on each state information sequence in the state data set to remove abnormal feature sequences.
[0033] The outlier detection process includes the following steps:
[0034] S201: Obtain the global outlier value and local outlier value corresponding to each state information sequence respectively. The global outlier value OD of the a-th state information sequence is a 1 and local outlier OD a 2 The following conditions are met:
[0035] OD a 1=(X a -μ) T wxya -1 (X a -μ).
[0036] Among them, X a is the vector corresponding to the ath state information sequence, and μ is the mean vector of the state data set. -1 It is the inverse of the covariance matrix. w is a diagonal weight matrix, and different feature dimensions have different corresponding weight values in w.
[0037] Since different feature dimensions have different global anomaly performances, some are mainly global anomalies, while others are local anomalies. Therefore, in order to better adapt to the complex situation of multiple factors, the weighted Mahalanobis distance can be introduced, that is, the diagonal weight matrix w is introduced to assign different weights to different features, so that it can consider the importance of different features, thereby enhancing the detection ability of important features.
[0038]
[0039] Where k is the preset neighborhood size. k is the weight at different k values, w k Negatively correlated with k. max and k min are the maximum and minimum values corresponding to k respectively. k (A a ) is X at different k values a The corresponding local anomaly factor. reach-dist k (X a , B) is point X a and the reachable distance between point B. k (X a ) is the point X at the corresponding k value a The local reachable density of N(X a ) is point X a 's neighborhood.
[0040] Specifically, w k Follow the steps below to generate:
[0041] Generate the initial weight corresponding to k according to k Satisfies the following relationship or
[0042] Normalize the initial weights corresponding to all k to generate W corresponding to each k k All w k The sum of is 1.
[0043] In this embodiment, in order to improve the detection accuracy of LOF (Local Outlier Factor), a multi-scale local outlier factor algorithm is introduced, that is, by calculating the LOF under different k values, a small k value can capture local outliers, while a large k value can identify anomalies in the overall trend, and then a weighted average of multiple LOFs is performed to improve the accuracy and robustness of detection.
[0044] at the same time, or Therefore, it is ensured that when the k value is large, the impact on the overall abnormality is small, thereby reducing the errors and noise that may be caused by the change of the k value.
[0045] In addition, the global outlier value OD of the a-th state information sequence can also be a 1 is replaced by the square of the Mahalanobis distance of the a-th state information sequence. And / or, the local outlier value 0D of the a-th state information sequence is replaced by a 2 is replaced by the value of the ath state information sequence calculated by the local anomaly factor algorithm.
[0046] S202: Generate a comprehensive abnormal value corresponding to each state information sequence according to the global abnormal value and the local abnormal value corresponding to each state information sequence. The comprehensive abnormal value COS (A) of the a-th state information sequence is a ) meets the following conditions:
[0047] COS(A a )=w1·OD a 1+w2·OD a 2.
[0048] Among them, w1 and w2 are the preset weight values corresponding to the global outlier and the local outlier, respectively.
[0049] In the present invention, the improved Mahalanobis distance is used as the global outlier and the local outlier factor (LOF) is used as the local outlier. The Mahalanobis distance takes into account the covariance matrix of the entire data set, and can identify those outliers that are inconsistent with the overall distribution of the data. It can effectively process multidimensional data, especially when there is correlation between variables. LOF detects outliers by local density differences, and can identify those points that are abnormal in the local area, even if these points appear normal in the global scope. In the case of local density changes in the data set, LOF can detect those outliers that appear isolated in the local area. The combination of Mahalanobis distance and LOF can make full use of the advantages of both and reduce false positives and false negatives. By comprehensively considering global and local information, outliers can be detected more comprehensively and accurately, avoiding the deviation that may occur in a single method. In addition, since the outliers in the data set may appear as global anomalies or local anomalies, by combining the two methods, different types of anomaly detection needs can be better adapted.
[0050] Specifically, w1 and w2 in this embodiment can be set according to domain knowledge and data characteristics. For example, if the global anomaly has a greater impact on the system, w1>w2 can be set; conversely, if the local anomaly is more important, w1<w2 can be set.
[0051] At the same time, it can be determined by other methods, such as:
[0052] Statistical analysis: By analyzing the distribution of global and local anomalies in the data set, two coefficients are determined. Statistical analysis can help understand which anomalies are more common in the data set and thus adjust the weights.
[0053] Cross-validation method: Use the cross-validation method to test different combinations of w1 and w2 on the training data set and select the combination that has the best anomaly detection effect. The steps are as follows:
[0054] 1. Divide the dataset into training set and validation set.
[0055] 2. Train the model on the training set and test different combinations of w1 and w2 on the validation set
[0056] 3. Select the weight combination that performs best on the validation set.
[0057] Automatic optimization method
[0058] Use optimization algorithms (such as grid search, random search, etc.) to automatically adjust w1 and w2 to maximize the performance indicators of anomaly detection (such as F1-score, accuracy, etc.).
[0059] Similarly, the weight coefficients involved in the present invention are all used to adjust the proportion of the corresponding data item in the overall calculation, which is the same as the role of w1 and w2 in this embodiment, so the above method can also be used in combination with the corresponding calculation scenario to determine the specific value. In addition, the thresholds or some conversion coefficients in the present invention are all determined according to the actual usage scenario and the corresponding prior art, and will not be repeated in the relevant description of the present invention.
[0060] S203: If the comprehensive abnormal value corresponding to the state information sequence is greater than the first abnormal threshold, the state information sequence is determined to be an abnormal feature sequence and is removed.
[0061] Furthermore, after removing the abnormal feature sequence, the method further includes:
[0062] S300: Obtaining a first compensation value and a second compensation value for each missing eigenvalue by using a linear interpolation method and a K-nearest neighbor interpolation method respectively.
[0063] S400: Interpolation standard deviation σ corresponding to the linear interpolation method corresponding to each feature dimension linear , the interpolation standard deviation σ corresponding to the K nearest neighbor interpolation method knn And the preset adjustment parameter λ is used to determine the comprehensive interpolation weight P corresponding to each feature dimension. λ is a positive number. Specifically, λ can be ∈(0,1). P satisfies the following conditions:
[0064]
[0065] S500: Generate a compensation interpolation value for each missing eigenvalue according to the first compensation value and the second compensation value of each missing eigenvalue and the corresponding comprehensive interpolation weight. i The following conditions must be met:
[0066]
[0067] in, and X i The corresponding first compensation value and second compensation value, P i is the comprehensive interpolation weight of the feature dimension corresponding to the i-th missing eigenvalue.
[0068] This method can automatically adjust the weights according to the data characteristics, so that the interpolation results are more consistent with the actual distribution of the data and improve the interpolation effect.
[0069] The following example illustrates this:
[0070] Suppose we need to fill in the power data of a time point. The power data before and after the data point are as follows:
[0071] X i-1 =70%
[0072] X i+1 =50%
[0073] Through linear interpolation, we can get the preliminary interpolation results:
[0074]
[0075] Through K nearest neighbor interpolation, consider historical data in similar situations:
[0076] - The power of similar data points are X1 = 65%, X2 = 55%, X3 = 60%
[0077] -Weights w1=0.4, w2=0.3, w3=0.3
[0078] The interpolation result is:
[0079]
[0080] According to the local changes of the data, the adaptive weight α is calculated:
[0081]
[0082] Assume σ linear =5%,σ knn =3%, λ=0.5:
[0083] The final interpolation result is:
[0084] X i =α·X linear +(1-α)·X knn =0.731·60%+(1-0.731)·60.5%≈60.1%
[0085] The interpolation method in this embodiment combines linear interpolation and K nearest neighbor interpolation to fill in missing values. Among them, linear interpolation: quickly fill in missing values to ensure data continuity. K nearest neighbor interpolation: use the information of similar data points to accurately reflect the local change characteristics of the data. Combining these two methods can more comprehensively restore the overall characteristics of the data and improve data integrity and consistency.
[0086] Specifically, linear interpolation: Applicable to situations where data changes smoothly, such as temperature and location data change little in a short period of time. For example, at consecutive time points, location data (longitude and latitude) and temperature data usually change smoothly, which can be quickly filled in by linear interpolation. K nearest neighbor interpolation: Applicable to situations where data has a local complex structure, such as power and usage history data may have large fluctuations. For example, power data may fluctuate violently during charging and discharging, and usage history data (such as charging times and usage time) may have complex patterns. K nearest neighbor interpolation can better capture such fluctuations. Therefore, through adaptive weighted comprehensive interpolation, the weights of linear interpolation and K nearest neighbor interpolation are adaptively adjusted according to the local changes in the data to improve the interpolation effect.
[0087] S600: Performing data correction processing on the data in the state data set using a multi-factor nonlinear correction model.
[0088] Specifically, the correction of data meets the following conditions:
[0089]
[0090] X corrected : Corrected data value. It is the sensor data processed by the multi-factor nonlinear correction model to improve the accuracy of the data.
[0091] α: constant term, which is the intercept of the model and represents the j and X j X k When both are zero, the output is X corrected The value of .
[0092] Sum of linear terms.
[0093] -m: The number of input variables.
[0094] -β j : The regression coefficient of the jth input variable, reflecting the linear influence of the variable on the corrected data.
[0095] -X j : The jth input variable, that is, the jth data collected by the sensor.
[0096] The sum of quadratic terms represents the interaction of the input variables.
[0097] -γ jk : Input variable X j and X k
[0098] The regression coefficient of the interaction between the two variables reflects the quadratic impact of these two variables on the adjusted data.
[0099] -X j X k : Input variable X j and X k The product of represents the interaction between the variables.
[0100] ∈: Error term. It represents the part that the model cannot explain, that is, the random error or noise of the model.
[0101] S700: Perform Z-score standardization on the corrected data to generate target data.
[0102] After the abnormal cleaning, correction and standardization of the data in the above embodiment, a higher quality state data set of the energy storage package can be obtained, so as to facilitate the use of the later model training.
[0103] As another possible embodiment of the present invention, Figure 2 As shown, a method for predicting energy supply and demand based on LSTM is also provided. Usually, due to the different electricity usage habits and environmental conditions of people in different areas, there will be large differences in the energy supply and demand characteristics in different areas. Therefore, how to more accurately obtain the energy supply and demand rules at different times in each area is of great guiding significance for the advance scheduling of energy storage packages in mobile energy storage systems. For example, the system plans the scheduling plan of the energy storage package in advance based on the demand forecast data to ensure that there is sufficient energy supply during peak demand periods. The charging and discharging plan of the energy storage package can also be optimized to improve energy utilization efficiency. In this embodiment, the prediction method can predict energy demand through the quality status data collected and preprocessed by the above embodiment.
[0104] The method comprises the following steps:
[0105] A100: Obtain target state data in the target area. The target state data includes a two-dimensional state data table corresponding to all energy storage packages in multiple continuous acquisition cycles. Each line in the two-dimensional state data table is a state data sequence corresponding to an energy storage package at a collection time. The state data sequence includes multiple feature dimensions, including: collection time, current remaining power of the energy storage package, location, temperature of the environment, humidity of the environment, number of charges and discharges in the corresponding collection cycle, and usage time.
[0106] Usually, the length of time that the target state data occupies is highly correlated with the corresponding prediction purpose:
[0107] 1. Short-term forecasting: Usually uses data from the past few hours to a few days. This method is suitable for scenarios with large demand changes in the short term, such as power load forecasting.
[0108] 2. Medium-term forecast: usually using data from the past few days to weeks. This method is suitable for scenarios where demand changes are relatively stable in the medium term, such as daily energy consumption forecasting.
[0109] 3. Long-term forecast: Usually uses data from the past few weeks to months. This method is suitable for long-term trend analysis, such as seasonal changes or annual demand forecasts.
[0110] In the specific implementation process, the number of collection time periods used can be determined by experimental verification. A common practice is to select the optimal number of time periods through methods such as cross-validation to achieve the best prediction effect. For example, data from the past 24 hours, the past 7 days, or the past 30 days may be used as input to the model. The specific selection depends on the characteristics of the data and the requirements of the prediction task. In this embodiment, the collection cycle can be one day, and multiple continuous collection cycles are collection cycles corresponding to 3-7 days or 1-4 weeks.
[0111] Specifically, A100 includes:
[0112] A101: Acquire the state information sequence of the energy storage package in a preset acquisition cycle to generate a state data set of the energy storage package in a preset period of time. The state information sequence includes multiple feature dimensions.
[0113] A102: Perform outlier detection processing on each state information sequence in the state data set to remove abnormal feature sequences.
[0114] A200: Input the target state data into the target LSTM model to generate energy demand information and energy supply information corresponding to the target area.
[0115] In this embodiment, the data preprocessing in A102 can be performed with reference to the embodiment corresponding to the above-mentioned energy storage package state data preprocessing method.
[0116] Specifically, a large amount of training samples formed by historical data can be used to train the target LSTM model to obtain the target LSTM model in this embodiment. In the process of training the target LSTM model, an L2 regularization term is added to the loss function.
[0117] Specifically, the loss function is as follows:
[0118] Among them, the regularization term L in the formula reg L2 regularization is used. L2 regularization prevents the model from overfitting by penalizing the sum of the squares of the weights, causing the weights to tend to smaller values. Specifically, L2 regularization adds a penalty term to the loss function of the model, which is the sum of the squares of all weight values.
[0119] The target LSTM model includes:
[0120] Multi-head attention extraction unit and the first LSTM model.
[0121] In fact, the model in this embodiment is obtained by combining the multi-head attention mechanism with the improved model of LSTM. The multi-head attention mechanism is the front-end input part of the improved LSTM model and is trained together with the entire model. In the improved LSTM model, the multi-head attention mechanism is introduced to enhance the model's ability to pay attention to different parts of the input data, so that the model can better capture the long-term dependencies in the input sequence. The output of the multi-head attention mechanism will be used as the input of the LSTM network, and the entire model is trained in an end-to-end manner to minimize the loss function.
[0122] The multi-head attention extraction unit is used to capture different feature subspaces in the target state data by using multiple attention heads in parallel, generate the current input feature sequence, and input it into the first LSTM model.
[0123] Specifically, the multi-head attention extraction unit runs as follows:
[0124] A201: Divide different feature dimensions in the target state data into multiple sub-feature dimension sequences. The multiple sub-feature dimension sequences include: a sub-feature dimension sequence corresponding to the acquisition time feature, a sub-feature dimension sequence corresponding to the location feature, a sub-feature dimension sequence corresponding to the environment feature, and a sub-feature dimension sequence corresponding to the user usage habit feature. The user usage habit feature includes the feature dimension corresponding to the usage duration of the number of charging and discharging times in the corresponding acquisition cycle.
[0125] A202: Use each attention head to extract the corresponding sub-feature dimension. Each sub-feature dimension sequence corresponds to one attention head.
[0126] A203: Combine the outputs of all attention heads and obtain the final attention output through linear transformation.
[0127] In this embodiment, a multi-head attention mechanism is introduced before the LSTM model (i.e., the first LSTM model). The multi-head attention mechanism uses multiple attention heads in parallel, each head performs attention operations independently, and each head can focus on different features in the input sequence, and then splices the results together, so that the input information finally input into the LSTM model can capture more features, such as statistical features of historical data, environmental factors, etc., to enhance the expressiveness and robustness of the model, so as to improve the prediction accuracy of the model.
[0128] The first LSTM model includes a memory update unit, an input gate, a forget gate and an output gate.
[0129] The memory update unit is used to generate the memory unit state C at the current time step t . C t The following conditions must be met:
[0130]
[0131] Among them, f t The memory cell state C generated by the forget gate in the first LSTM model to control the previous time step t-1 The proportion to be retained. t Generated by the input gate in the first LSTM model to control the degree of influence of the input of the current time step on the state of the memory unit. is the candidate memory cell state of the current time step. t-1 , C t-1 , C t-1 ) is the hidden state h of the previous time step generated by using the attention mechanism algorithm t-1 and the memory cell state C t-1 Attention(h t-1 , C t-1 , C t-1 ) meets the following conditions:
[0132] Attention(h t-1 , C t-1 , C t-1 )=∑ j a j (W a ·[h t-1 , C t-1 ]).
[0133] Among them, a j is the attention weight corresponding to the time step, by t-1 and C t-1 The linear transformation of W a is a weight matrix used to transform hidden states and memory cell states into attention vectors. j a j (W a ·[h t-1 , C t-1 ]) represents a corresponding to all time steps j in the input sequence j (W a ·[h t-1 , C t-1 ]) to sum.
[0134] In this embodiment, during the processing of the memory update unit of the first LSTM model, an attention mechanism for the previous memory is also added (i.e., Attention (h t-1 , C t-1 , C t-1 )), therefore, by introducing the attention mechanism at this position, the model’s memory capacity can be enhanced by paying attention to the hidden state and memory unit state of the previous time step, thereby improving the model’s ability to capture long-term dependencies and improving the model’s prediction accuracy.
[0135] In the formula Attention(h t-1 , C t-1 , C t-1 ), parameter C t-1 is used repeatedly, indicating that the current attention mechanism simultaneously focuses on different aspects of the memory cell state at the previous time step. Although the parameters are repeated, in actual implementation, the calculations can be processed separately for parallel calculation and optimization.
[0136] The forget gate is used to generate f t , f t The following conditions must be met:
[0137] f t =σ(W f ·[h t-1 , x t , context t ]+b f ).
[0138] Where σ(·) is the sigmoid activation function. f is the weight matrix of the forget gate. f is the bias vector of the forget gate. context t is context information. t is the current input.
[0139] The input gate is used to generate i t and i t and The following conditions are met respectively:
[0140] i t =σ(W i ·[h t-1 , x t , context t ]+b i ).
[0141]
[0142] Among them, Wi is the weight matrix of the input gate. i is the bias vector of the input gate. c is the weight matrix of the candidate memory. b c is the bias vector of the candidate memory. tanh(·) is the tanh activation function.
[0143] The output gate is used to generate o t , o t The following conditions must be met:
[0144] o t =σ(W o ·[h t-1 , x t , context t ]+b o ).
[0145] Among them, t W represents the output ratio, and σ(·) is the sigmoid activation function. o is the weight matrix of the output gate. o is the bias vector of the output gate. context t is the context information. t is the current input.
[0146] Different activation functions (sigmoid activation function and tanh activation function) are introduced in the input gate and forget gate to improve the nonlinear representation ability of the model.
[0147] As another possible embodiment of the present invention, Figure 3 As shown, a method for scheduling an energy storage package is also provided.
[0148] The steps include:
[0149] B100: Obtain the dispatch vectors corresponding to multiple energy storage package dispatch schemes that can meet the energy demand of the target node as the initial population. The dispatch vector includes the node IDs of each node on the path corresponding to the energy storage package dispatch scheme. The section between any two nodes is a component section in the entire dispatch scheme.
[0150] Specifically, the energy demand of the target node predicted by the energy supply and demand prediction method based on LSTM in the above embodiment can be used to randomly form multiple feasible scheduling schemes to obtain the corresponding initial population. The scheduling schemes in the initial population are not necessarily all feasible mobile schemes, but they are indeed multiple random scheduling schemes to reach the same target node. The purpose of generating the initial population is to create a variety of candidate solutions in the search space so that these solutions can be gradually improved through operations such as selection, crossover and mutation in the subsequent genetic algorithm optimization process.
[0151] Specifically, each scheduling scheme in the initial population represents a possible path and operation steps from the current state to the target node, which covers different path selection, energy consumption and other scheduling strategies. By generating multiple random schemes, the algorithm can search in different directions to find the optimal scheduling scheme.
[0152] B200: Use the target genetic algorithm to optimize the initial population and iterate the calculation to generate the target scheduling plan corresponding to the target node.
[0153] The iterative steps of the target genetic algorithm include:
[0154] B201: Calculate the fitness value corresponding to each individual in the current population. Among them, the fitness value F of the i-th individual i The following conditions are met:
[0155]
[0156] Among them, C i is the total operating consumption value of the scheduling scheme corresponding to the i-th individual.
[0157] Specifically, C. i It can be calculated in three ways:
[0158] First: C i The following conditions must be met:
[0159] C i =w1·d(i)+w2·e(i).
[0160] w1 and w2 are the distance weight and power weight respectively. d(i) is the Euclidean distance from the starting point of the energy storage package to the target node in the scheduling scheme corresponding to the i-th individual. e(i) is the power consumption value from the starting point of the energy storage package to the target node in the scheduling scheme corresponding to the i-th individual. Among them, k is the power consumption coefficient, and p(i) is the load power required by the energy storage package at the current node. max It is the maximum power that the energy storage pack can provide under normal operating conditions.
[0161] Second: C i The following conditions must be met:
[0162] C i =w1·d(i)+w2·e(i)+w3·t(i).
[0163] Among them, w3 is the environmental weight, and t(i) is the environmental consumption value from the starting position to the target node position of the energy storage package in the scheduling scheme corresponding to the i-th individual. in, and are the mean ambient temperature, mean ambient humidity and mean ambient wind speed of all nodes in the scheduling path of the scheduling scheme corresponding to the i-th individual. and They are and The corresponding weight coefficient.
[0164] Third: C i The following conditions must be met:
[0165] C i =w1·d(i)+w2·e(i)+w3·t(i)+w4·g(i).
[0166] Among them, w4 is the road condition weight, and g(i) is the road condition consumption value from the starting position to the target node position of the energy storage package in the scheduling plan corresponding to the i-th individual. in, and are the average congestion levels and road type identification values of all road sections in the scheduling path of the scheduling scheme corresponding to the i-th individual. The congestion level value of the road section can range from [0, 1]. The road type identification includes road type identification 1 corresponding to the high-speed section, road type identification 2 corresponding to the medium-speed section, and road type identification 3 corresponding to the low-speed section. and They are and The corresponding weight coefficient.
[0167] In this embodiment, a genetic algorithm is used to obtain the optimal energy storage package scheduling solution that can meet the energy demand of the target node. And the fitness value F i When calculating, it is set to the inverse of the total consumption value of the scheduling scheme during operation. Therefore, in the subsequent genetic iterations, the scheme with the highest fitness will have an advantage in the selection process of the genetic algorithm, that is, the scheme with smaller actual consumption will have an advantage in the scheduling scheme, and new and better solutions will be generated through crossover and mutation to determine one or more optimal scheduling schemes.
[0168] In addition, C i The calculation process takes into account the impact of distance, power, environment, road conditions and other subtle factors on the cost consumption during the dispatch process. By comprehensively considering multiple factors, the actual cost consumption and impact of the energy storage package in the actual operation process can be more accurately reflected. This method is suitable for more complex and dynamically changing dispatch environments, making the consumption value of the dispatch path lower and more cost-saving.
[0169] B202: Use the tournament selection method to select the corresponding individuals from the current population as parents.
[0170] B203: Perform cross processing on the gene sequences of two parent individuals to generate the corresponding gene sequences of two offspring individuals.
[0171] Specifically, cross processing meets the following conditions:
[0172] The gene sequences of the two parent individuals P1 and P2 are: P1 = {p 1,1 ,p 1,2 ,…,p 1,n} and P2={p 2,1 ,p 2,2 ,…,p 2,n}.
[0173] C1 and C2 are the starting gene loci and the ending gene loci of the crossover process, respectively. 1≤C1<C2≤n, where n is the number of gene loci in the parent individual.
[0174] The gene sequences of the two offspring individuals O1 and O2 generated after the crossover are:
[0175] and
[0176]
[0177] in, and are the genes at position C1 of parent individuals P1 and P2 respectively.
[0178] B204: Generate the mutation rate corresponding to each newly generated offspring individual according to the fitness value corresponding to the new population obtained after the crossover process, so as to perform mutation operation on each newly generated offspring individual. Among them, the mutation rate μ corresponding to the i-th newly generated offspring individual i The following conditions must be met:
[0179]
[0180] Among them, F max and F min are the maximum fitness value and the minimum fitness value of the new population obtained after crossover processing. i is the fitness value corresponding to the i-th newly generated offspring individual. max is the maximum preset mutation rate. μ max Can be ∈[0,1], such as μ max =0.5.
[0181] In the mutation operation of the genetic algorithm of this embodiment, the mutation rate is dynamically adjusted, that is, the mutation rate is dynamically adjusted according to the fitness of the current population and individuals. As a result, the mutation rate of individuals with high fitness in the population is low, and the mutation rate of individuals with low fitness is high, ensuring population diversity and optimization efficiency. At the same time, through the adaptive mutation strategy, the population strikes a balance between exploring new solutions and developing existing solutions, avoiding premature convergence and falling into local optimality. Moreover, the adaptive mutation strategy can adjust the mutation rate according to the population state, improving the optimization efficiency and convergence speed of the genetic algorithm.
[0182] B205: The individual with the highest fitness value in the current population is directly retained in the next generation population.
[0183] Through the improved genetic algorithm in this embodiment, a set of scheduling schemes will be generated, each of which contains the scheduling paths of multiple energy storage packages. Ultimately, the algorithm will select an overall optimal scheduling scheme, which not only determines which energy storage package should go to which target point, but also includes the specific path for each energy storage package to reach the target point.
[0184] Therefore, in the results of genetic algorithm optimization, the dispatching scheme comprehensively considers the overall dispatching path of multiple energy storage packages, rather than considering the path of a single energy storage package. The advantage of this scheme is that it can optimize the system's energy utilization, response speed and operating cost on a global scale.
[0185] As another embodiment of the present invention, Figure 4 A scheduling path planning method is also provided. The scheduling path determined by the genetic algorithm in the above embodiment can avoid local optimality, but in some cases it may still be impossible to find the global optimal solution. Therefore, it is necessary to continue to use the A* algorithm to further optimize the results obtained by the genetic algorithm to try to find a better solution.
[0186] The method comprises the following steps:
[0187] C100: Obtain the path search space corresponding to the target energy storage package in the preset area. The path search space includes the starting point, the end point and multiple feasible passing points of the energy storage package.
[0188] Specifically, the nodes in the path search space can be:
[0189] C101: All nodes in the preset area are used as nodes in the path search space.
[0190] The nodes in the path search space can also be:
[0191] C102: Obtaining an initial scheduling planning path. The initial scheduling planning path may be one or more scheduling paths preliminarily determined by the genetic algorithm in the above embodiment.
[0192] C103: All nodes on the initial scheduling path and nodes in the preset area whose distances to each node on the initial scheduling path are less than a preset distance threshold are used as nodes in the path search space.
[0193] Usually, when the initial path is further optimized, the corresponding optimized node position is usually near the initial path, so when determining the search space, the nodes far away from the initial path can be removed to reduce the amount of calculation.
[0194] For example, the center of a circle with a radius of R can be used to sweep along the initial path, and all nodes in the coverage area are used as nodes in the path search space. The size of R is inversely proportional to the area of the rectangle with the starting point and the end point of the path as the diagonal.
[0195] C200: Use the A* algorithm to search and calculate the path search space to generate a scheduling path for the target energy storage package from the starting point to the end point.
[0196] The A* algorithm evaluates the value of each node based on the actual cost g(n) from the starting point to the current node and the heuristic estimated cost h(n) from the current node to the end point, f(n) = g(n) + h(n). Based on this, the basic steps of the A* algorithm are as follows:
[0197] 1. Initialization
[0198] Add the starting point to the open list and initialize the g(n) of the starting point to 0 and the g(n) of other nodes to infinity.
[0199] Initialize h(n) of all nodes to the estimated cost.
[0200] Initialize f(n) of all nodes to g(n)+h(n).
[0201] 2. Node expansion
[0202] Pick the node n with the lowest f(n) value from the open list.
[0203] Move node n from the open list to the closed list.
[0204] 3. Neighbor node processing
[0205] For each neighbor node m of node n:
[0206] If m is already in the closed list, it is ignored;
[0207] Otherwise, calculate the actual cost of m g(m)=g(n)+cost(n,m).
[0208] If m is not in the open list, or the newly calculated g(m) is less than the previously recorded g(m), update the parent node of m to n; update g(m) and f(m) of m.
[0209] If m is not in the open list, add m to the open list.
[0210] 4. Iteration
[0211] Repeat steps 2 and 3 until the open list is empty, at which point no path is found, or the target node is found.
[0212] 5. Path reconstruction
[0213] Once the target node is found, start from the target node and follow the parent node chain back to the lake until you return to the starting point, so that you get the path from the starting point to the target node.
[0214] In the A* algorithm of this embodiment, the comprehensive consumption value of node n is f(m)=g(n)+h(n). g(n) is the actual consumption value from the starting point to node n, and h(n) is the estimated consumption value from node n to the end point.
[0215] The energy consumption value cost(n, i) corresponding to the energy storage package from one node n to another node i satisfies the following conditions:
[0216] cost(n,i)=w1·d(i)+w2·e(i).
[0217] w1 and w2 are the distance weight and power weight respectively. d(i) is the Euclidean distance from node n to another node i. e(i) is the power consumption from node n to another node i. Among them, k e is the power consumption coefficient, and p(i) is the load power required by the energy storage package at the current node. max It is the maximum power that the energy storage pack can provide under normal operating conditions.
[0218] Specifically, the calculation method (such as cost(n, i)) of the consumption value (including actual consumption value and estimated consumption value) generated in the scheduling process from one node to another node in this embodiment is the same as that of C in the above embodiment. i The calculation method is the same as that of , so it will not be described in detail in this embodiment, and the calculation method in the above embodiment can be directly referred to for calculation. In addition, the consumption value obtained by the above calculation can be multiplied by the cost conversion coefficient of the corresponding item to obtain the actual cost consumption corresponding to each item, which can be calculated specifically as follows:
[0219] C i=δ1·w1·d(i)+δ2·w2·e(i)+δ3·w3·t(i)+δ4·w4·g(i).
[0220] Among them, δ1, δ2, δ3 and δ4 are distance cost conversion coefficient, electric energy cost conversion coefficient, environmental cost conversion coefficient and road condition cost conversion coefficient respectively. These conversion coefficients can be obtained through existing technologies.
[0221] During the actual execution of the energy storage package, unexpected situations such as road congestion and environmental changes may occur, so the route needs to be replanned to ensure the effectiveness and efficiency of the dispatch. The improved route planning algorithm will take into account multiple factors such as distance, power consumption, environmental conditions, road conditions, etc. to further optimize the route, reduce energy consumption, and improve the overall efficiency of the system.
[0222] In addition, h(n) as a heuristic function can help the algorithm prioritize paths with lower estimated consumption values during the search process, thereby improving search efficiency. Through the combined effect of h(n) and g(n), the total consumption value function f(n) takes into account both the actual consumption from the starting point to the current node and the expected consumption from the current node to the target node. This balance allows the algorithm to quickly find a better path while avoiding falling into a local optimum.
[0223] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0224] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0225] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0226] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0227] The electronic device according to this embodiment of the present invention is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0228] The electronic device is presented in the form of a general-purpose computing device. The components of the electronic device may include, but are not limited to: the at least one processor mentioned above, the at least one storage device mentioned above, and a bus connecting different system components (including storage devices and processors).
[0229] The storage stores program codes, which can be executed by the processor, so that the processor executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.
[0230] The memory may include readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory, and may further include read only memory (ROM).
[0231] The storage may also include a program / utility having a set (at least one) of program modules, such program modules including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0232] The bus may represent one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures.
[0233] The electronic device may also communicate with one or more external devices (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may communicate with one or more devices that enable a user to interact with the electronic device, and / or may communicate with any device (e.g., routers, modems, etc.) that enables the electronic device to communicate with one or more other computing devices. Such communication may be performed through an input / output (I / O) interface. Furthermore, the electronic device may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter. The network adapter communicates with other modules of the electronic device through a bus. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0234] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0235] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.
[0236] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0237] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0238] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0239] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0240] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0241] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0242] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An energy supply and demand forecasting method based on LSTM, characterized in that: The method comprises the following steps: Obtain target state data in the target area; the target state data includes a two-dimensional state data table corresponding to all energy storage packages in multiple continuous acquisition cycles, each line in the two-dimensional state data table is a state data sequence corresponding to an energy storage package, and the state data sequence includes multiple feature dimensions, and the feature dimensions include: acquisition time, current remaining power of the energy storage package, location, temperature of the environment, humidity of the environment, number of charges and discharges in the corresponding acquisition cycle, and usage time; Inputting the target state data into the target LSTM model to generate energy demand information and energy supply information corresponding to the target area; The target LSTM model includes: A multi-head attention extraction unit and a first LSTM model; the first LSTM model includes a memory update unit; The multi-head attention extraction unit is used to capture different feature subspaces in the target state data by using multiple attention heads in parallel, generate a current input feature sequence, and input it into the first LSTM model; The memory update unit is used to generate the memory unit state C of the current time step t ; C t The following conditions must be met: Among them, f t The memory cell state C generated by the forget gate in the first LSTM model to control the previous time step t-1 The proportion of retained t The input gate in the first LSTM model generates the degree of influence of the input of the current time step on the state of the memory unit; is the candidate memory unit state of the current time step; Attention(h t-1 , C t-1 , C t-1 ) is the hidden state h of the previous time step generated by using the attention mechanism algorithm t-1 and the memory cell state C t-1 The attention value; Attenton t-1 , C t-1 , C t-1 ) meets the following conditions: Attention(h t-1 ,C t-1 ,C t-1 )=∑ j a j (W a ·[h t-1 ,C t-1 ]); Among them, a j is the attention weight corresponding to the time step, by t-1 and C t-1 The linear transformation of W a is a weight matrix used to transform hidden states and memory unit states into attention vectors; ∑ j a j (W a ·[h t-1 , C t-1 ]) represents a corresponding to all time steps j in the input sequence j (W a ·[h t-1 , C t-1 ]) to sum.
2. The method according to claim 1, characterized in that The multi-head attention extraction unit operates as follows: Divide different feature dimensions in the target state data into multiple sub-feature dimension sequences; the multiple sub-feature dimension sequences include: a sub-feature dimension sequence corresponding to the acquisition time feature, a sub-feature dimension sequence corresponding to the location feature, a sub-feature dimension sequence corresponding to the environment feature, and a sub-feature dimension sequence corresponding to the user usage habit feature; the user usage habit feature includes a feature dimension corresponding to the usage duration of the number of charging times and the number of discharging times in the corresponding acquisition cycle; Use each attention head to extract the corresponding sub-feature dimension; each sub-feature dimension sequence corresponds to one attention head; The outputs of all attention heads are combined and linearly transformed to obtain the final attention output.
3. The method according to claim 1, characterized in that The collection cycle is one day, and multiple consecutive collection cycles are collection cycles corresponding to 3-7 days or 1-4 weeks.
4. The method according to claim 1, characterized in that The target LSTM model also includes: an input gate and a forget gate; The forget gate is used to generate f t , f t The following conditions must be met: f t =σ(W f ·[h t-1 ,x t ,context t ]+b f ); Where σ(·) is the sigmoid activation function; W f is the weight matrix of the forget gate; b f is the bias vector of the forget gate; context t is context information; x t is the current input.
5. The method according to claim 4, characterized in that The input gate is used to generate i t and i t and The following conditions are met respectively: i t =σ(W i ·[h t-1 ,x t ,context t ]+b i ); Among them, W i is the weight matrix of the input gate; b i is the bias vector of the input gate; W c is the weight matrix of candidate memory; b c is the bias vector of the candidate memory; tanh(·) is the tanh activation function.
6. The method according to claim 1, characterized in that During the training of the target LSTM model, an L2 regularization term is added to the loss function.
7. The method according to claim 1, characterized in that Get the target status data in the target area, including: Acquire a state information sequence of an energy storage package in a preset acquisition cycle to generate a state data set of the energy storage package within a preset period; the state information sequence includes multiple feature dimensions; An outlier detection process is performed on each state information sequence in the state data set to remove abnormal feature sequences.
8. The method according to claim 7, characterized in that The outlier detection process comprises the following steps: Get the global outlier value and local outlier value corresponding to each state information sequence respectively; among them, the global outlier value OD of the a-th state information sequence is a 1 and local outlier OD a 2 The following conditions are met: OD a 1=(X a -m) T wS -1 (X a -m); Among them, X a is the vector corresponding to the ath state information sequence, μ is the mean vector of the state data set; S -1 is the inverse of the covariance matrix; w is the diagonal weight matrix, and different feature dimensions have different corresponding weight values in w; Among them, k is the preset neighborhood size; w k is the weight at different k values, w k Negatively correlated with k; k max and k min are the maximum and minimum values corresponding to k respectively; LOF k (A a ) is X at different k values a Corresponding local anomaly factor; reach-dist k (X a , B) is point X a and the reachable distance between point B; lrd k (X a ) is the point X at the corresponding k value a The local reachable density of N(X a ) is point X a Neighborhood of; According to the global outlier value and local outlier value corresponding to each state information sequence, the comprehensive outlier value corresponding to each state information sequence is generated; among which, the comprehensive outlier value COS (A a ) meets the following conditions: COS(A a )=w1·OD a 1+w2·OD a 2; Among them, w1 and w2 are the preset weight values corresponding to the global outlier and the local outlier respectively; If the comprehensive abnormal value corresponding to the state information sequence is greater than the first abnormal threshold, the state information sequence is determined to be an abnormal feature sequence and is removed.
9. A non-transitory computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, an LSTM-based energy supply and demand forecasting method as described in any one of claims 1 to 8 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, an LSTM-based energy supply and demand forecasting method as described in any one of claims 1 to 8 is implemented.
