LSTM-based distributed power supply power prediction method, system and device
By adopting an LSTM-based distributed power supply power prediction method, combined with DBSCAN clustering and physical constraint optimization of the loss function, the problems of data processing and spatiotemporal correlation analysis in distributed power supply power prediction are solved, and efficient and stable power supply power prediction is achieved.
Patent Information
- Application Number
- CN202411889313.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Existing technologies lack efficient and stable methods for predicting the power output of distributed power sources, especially in terms of data processing and spatiotemporal correlation analysis, which leads to unstable data classification results.
A distributed power supply prediction method based on LSTM is adopted. The theoretical power data is calculated by acquiring historical and future meteorological data, the dataset is divided using the DBSCAN clustering algorithm, and the loss function of the LSTM prediction network is optimized by combining physical constraints and theoretical power. The DBSCAN algorithm parameters are adaptively adjusted to achieve the prediction of normal and outlier values.
It improves the stability and efficiency of power prediction for distributed power sources, enhances the model's ability to model complex time dependencies, and avoids the data limitations of only predicting normal values.
Smart Images

Figure CN120033663B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to power prediction methods, belonging to the field of power technology, and particularly to a method, system, and device for predicting power supply from distributed power sources based on LSTM. Background Technology
[0002] Distributed energy resources are characterized by randomness, intermittency, and uneven distribution. These characteristics limit the grid's ability to stably absorb them and lead to a series of steady-state and transient power quality issues. Therefore, achieving intelligent prediction of distributed power supply is a necessary measure to accelerate the intelligent transformation and sustainable development of the power grid.
[0003] However, current technologies lack a unified dataset of output sequences for distributed power sources and are insufficient to design and construct network prediction models suitable for distributed power sources based on different power service characteristics. On one hand, in data processing, power data is characterized by its large volume, diverse types, and numerous outliers, making it unusable directly and requiring pre-processing cleaning. The efficiency of this cleaning directly impacts subsequent work, and designing efficient data cleaning methods remains a challenge. On the other hand, since both output data and environmental information are time-series data with spatial correlations, traditional statistical learning correlation analysis methods, such as the Pearson correlation coefficient, struggle to analyze the spatiotemporal correlations, leading to unstable data classification results. Therefore, an efficient and stable method is urgently needed for effective prediction of the vast amount of power data. Summary of the Invention
[0004] The purpose of this invention is to overcome the above-mentioned defects and problems in the prior art and to provide an efficient and stable LSTM-based distributed power supply prediction method, system and device.
[0005] To achieve the above objectives, the technical solution of this invention is: a distributed power supply prediction method based on LSTM, comprising:
[0006] S1. Obtain historical meteorological data and future forecast meteorological data of the target area of distributed power generation, and calculate the theoretical power data of the target area of distributed power generation.
[0007] S2. Based on the DBSCAN clustering algorithm, perform cluster analysis on theoretical power data and add theoretical power to expand the data dimension to obtain normal value datasets and outlier datasets of distributed power supply power.
[0008] S3. The loss function of the LSTM prediction network is optimized by combining the physical constraints and theoretical power of the distributed power source. Based on the normal value dataset and the outlier dataset, the normal value prediction result and the outlier prediction result of the future power generation of the distributed power source are obtained by the LSTM prediction network. The LSTM prediction network includes a first prediction network and a second prediction network connected in parallel.
[0009] S4. Based on the prediction results of normal values and outliers, set the parameter adjustment conditions, adaptively adjust the parameter settings of the DBSCAN clustering algorithm, and repeat steps S1-S4 until the prediction is completed.
[0010] Step S1 specifically includes:
[0011] S11. Obtain historical meteorological data and future forecast meteorological data for the target area of the distributed power source; the meteorological data includes water runoff, upstream and downstream water level, wind speed, atmospheric pressure, air temperature, air humidity, and solar radiation intensity.
[0012] S12. Obtain the generation type of the distributed power source, select the historical meteorological data and future forecast meteorological data corresponding to the generation type, and calculate the corresponding theoretical power generation.
[0013] The power generation type includes any one of hydropower, wind power, and photovoltaic power; the theoretical power generation corresponding to the power generation type includes any one or any combination of the following:
[0014] For hydropower generation, factors affecting the power output of a turbine generator include the water flow rate *l* through the generator, the operating head *h*, and the generator efficiency *λ*. Therefore, the theoretical power output *P* of hydropower generation is... w The expression is as follows:
[0015] P w =lhλ;
[0016] h = h a -h b -h δ ;
[0017] Where: h a h represents the upstream water level height. b The downstream water level is h. δ For head loss at power plants;
[0018] For wind power generation, the main factors affecting the power output of a wind turbine include the turbine power coefficient C, air density ρ, rotor swept area A, and wind speed v; therefore, the theoretical power output P of wind power generation is... f The expression is as follows:
[0019]
[0020] Where: p is atmospheric pressure, t is air temperature, p w Air humidity;
[0021] For photovoltaic (PV) power generation, the main factors affecting its output power include photoelectric conversion efficiency η, PV array area S, radiation intensity I, and air temperature t0; therefore, the theoretical output power P of PV power generation is... s The expression is as follows:
[0022] P s =ηSI[100.005(t0+25)].
[0023] Step S2 specifically includes:
[0024] S21. Use theoretical power data as a dataset D = (p1, p2, ..., p...). n Cluster analysis was performed on the measured power x of the theoretical power generation. i Based on this, increase theoretical power To expand the data dimensions, when performing cluster analysis based on the DBSCAN clustering algorithm, any two sample points p i and p j The distance expression between them is as follows:
[0025]
[0026] ω1+ω2=1; ω1, ω2>0; ω1>ω2;
[0027] Where: ω1 and ω2 are both distance weight parameters, x j For p j Point measurement power, For p j Theoretical power of a point;
[0028] S22, if p i The ε domain contains at least MinPts t For each sample, then p i The dataset consists of the core objects. The clustered sub-data of all core objects in the dataset is collected to obtain the final normal value dataset A, and the other data is the outlier dataset B.
[0029] Step S3 specifically includes:
[0030] S31. Based on the first prediction network and the normal value dataset A, predict the time and corresponding value of normal power occurrence in the future period of the distributed power source, and obtain the normal value prediction result a; combine the normal value prediction result a with the theoretical power data corresponding to the normal value dataset A to obtain the normal value data set A′.
[0031] S32. Based on the second prediction network and the outlier dataset B, predict the time and corresponding value of abnormal power occurrence in the future period of the distributed power source, and obtain the outlier prediction result b.
[0032] S33. Compare the prediction results of normal values (a) with the prediction results of outliers (b);
[0033] If at the same time t, a t =b t Then the outlier prediction result b t Add noise σ to correct for outlier predictions and obtain the corrected outlier prediction result b′. t The outlier prediction result b′ will be corrected. t The outlier dataset B' is obtained by combining the theoretical power data corresponding to the outlier dataset B.
[0034] Step S4 specifically includes:
[0035] S41. Combine the set of normal values A′ and the set of outliers B′ to form a dataset D′={A′,B′};
[0036] S42. Perform cluster analysis on dataset D′ based on the DBSCAN clustering algorithm to obtain a new set of normal values A″ and a set of outliers B″.
[0037] S43. Set the first and second conditions for adaptive parameter adjustment of the clustering algorithm, and determine whether they are satisfied; if either the first or second condition is satisfied, update the sample number threshold MinPts of the clustering algorithm at the next time step according to the satisfied condition. t ;
[0038] The first condition is: if the number of data in the intersection of B″ and A′ exceeds the threshold N0, that is, |A′∩B″|>N0;
[0039] The second condition is: if the number of data in the intersection of A″ and B′ exceeds the threshold N0, that is, |A″∩B′|>N0;
[0040] If the first condition is met, then increase the threshold MinPts for the number of samples in the clustering algorithm at the next time step. t Its expression is as follows:
[0041]
[0042] If the second condition is met, then decrease the sample number threshold MinPts for the clustering algorithm in the next time step. t Its expression is as follows:
[0043]
[0044] in: To round down;
[0045] S44, MinPts based on the updated sample count threshold t Return to step S1.
[0046] In step S3, optimizing the loss function means:
[0047] By adding a physical constraint penalty term to the loss function of the first prediction network for correction, its loss function becomes... as follows:
[0048]
[0049] Where: N1 is the output dimension of the first prediction network, x i This is the actual power. To predict power, λ1 is the weighting coefficient of the physical constraints. P is a physical constraint penalty term. min For minimum power, P max This is the maximum power.
[0050] In step S3, optimizing the loss function means:
[0051] In the loss function of the second prediction network, theoretical power is added for correction, and its loss function is then... as follows:
[0052]
[0053] Where: N2 is the output dimension of the second prediction network, and λ2 is the weighting coefficient for the difference between the theoretical power and the actual power. Theoretical power, N is the prediction power of the second prediction network, N3 is the number of outlier datasets, and x is the prediction power of the second prediction network. B,i The actual power in the outlier dataset. This represents the predicted power at the time corresponding to the actual power.
[0054] The first prediction network includes several input channels, an initial LSTM layer, a feature fusion layer, a final LSTM layer, and an output layer;
[0055] The second prediction network includes several input channels, an initial LSTM layer, a feature fusion layer, and an output layer;
[0056] The first and second prediction networks each have several input channels including power data input, meteorological data input, and equipment status data input;
[0057] The initial LSTM layers of both the first and second prediction networks include a power data LSTM layer, a meteorological data LSTM layer, and an equipment status data LSTM layer.
[0058] A distributed power supply prediction system based on LSTM, which applies the above-mentioned method, the system comprising:
[0059] The theoretical power data calculation module is used to acquire historical meteorological data and future forecast meteorological data of the target area of distributed power generation, and to calculate the theoretical power data of the target area of distributed power generation.
[0060] The clustering analysis module is used to perform clustering analysis on theoretical power data based on the DBSCAN clustering algorithm, and to add theoretical power to expand the data dimension to obtain normal value datasets and outlier datasets of distributed power supply power.
[0061] The prediction network module is used to optimize the loss function of the LSTM prediction network by combining the physical constraints and theoretical power of the distributed power source, and to predict the normal value prediction results and the outlier prediction results of the future power generation of the distributed power source based on the normal value dataset and the outlier dataset, respectively; the LSTM prediction network includes a first prediction network and a second prediction network connected in parallel.
[0062] The adaptive clustering module is used to set parameter adjustment conditions based on the prediction results of normal values and outliers, adaptively adjust the parameter settings of the DBSCAN clustering algorithm, and repeat the steps of the above modules until the prediction is completed.
[0063] A distributed power supply prediction device based on LSTM, the device including a processor and a memory;
[0064] The memory is used to store computer program code and to transmit the computer program code to the processor;
[0065] The processor is used to execute the above-described LSTM-based distributed power supply prediction method according to the instructions in the computer program code.
[0066] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0067] This invention discloses a method, system, and device for predicting the power supply of a distributed power source based on LSTM. The method first acquires meteorological data for the target area of the distributed power source and calculates theoretical power data. Then, it performs cluster analysis based on the DBSCAN clustering algorithm and expands the data dimensions to obtain normal value datasets and outlier datasets. Next, it optimizes the loss function of the LSTM prediction network by combining physical constraints and theoretical power, and predicts the normal and outlier values of future power generation. Finally, it sets parameter adjustment conditions and repeats the above steps to obtain the predicted power supply value. In application, this design addresses the problem of numerous historical power data types and many outliers by improving the distance definition of the DBSCAN clustering algorithm and combining the distance between data points and theoretical output power, thereby improving the stability of normal value extraction. Furthermore, it introduces an LSTM prediction network to avoid the data limitations of only predicting normal values. Simultaneously, it improves the loss function by combining physical constraints and theoretical power, optimizes adaptive adjustment parameters, and enhances the model's ability to model complex time dependencies, making the algorithm more efficient. Attached Figure Description
[0068] Figure 1 This is a flowchart of the method of the present invention.
[0069] Figure 2 This is a flowchart of the theoretical power data calculation in Embodiment 1 of the present invention.
[0070] Figure 3 This is a flowchart of the DBSCAN clustering algorithm clustering analysis in Embodiment 1 of the present invention.
[0071] Figure 4 This is a flowchart of the prediction process of the LSTM prediction network in Embodiment 1 of the present invention.
[0072] Figure 5 This is a flowchart of the adaptive parameter adjustment process in Embodiment 1 of the present invention.
[0073] Figure 6 This is a system structure diagram of the present invention.
[0074] Figure 7 The device structure diagram of the present invention.
[0075] In the diagram: 1. Theoretical power data calculation module; 2. Cluster analysis module; 3. Prediction network module; 4. Adaptive adjustment clustering module; 5. Processor; 6. Memory; 7. Computer program code. Detailed Implementation
[0076] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0077] Example 1:
[0078] See Figure 1 A distributed power supply power prediction method based on LSTM includes:
[0079] S1. Obtain historical meteorological data and future forecast meteorological data of the target area of distributed power generation, and calculate the theoretical power data of the target area of distributed power generation.
[0080] Furthermore, step S1 specifically includes:
[0081] S11. Obtain historical meteorological data and future forecast meteorological data for the target area of the distributed power source; the meteorological data includes water runoff, upstream and downstream water level, wind speed, atmospheric pressure, air temperature, air humidity, and solar radiation intensity.
[0082] S12. Obtain the power generation type of the distributed power source, and select the historical meteorological data and future forecast meteorological data corresponding to the power generation type to calculate the corresponding theoretical power generation; the calculation process is described in [reference needed]. Figure 2 ;
[0083] The power generation type includes any one of hydropower, wind power, and photovoltaic power; the theoretical power generation corresponding to the power generation type includes any one or any combination of the following:
[0084] For hydropower generation, factors affecting the power output of a turbine generator include the water flow rate *l* through the generator, the operating head *h*, and the generator efficiency *λ*. Therefore, the theoretical power output *P* of hydropower generation is... w The expression is as follows:
[0085] P w =lhλ;
[0086] h = h a -h b -h δ ;
[0087] Where: h a h represents the upstream water level height. b The downstream water level is h. δ For head loss at power plants;
[0088] S12. For wind power generation, the main factors affecting the power output of a wind turbine include the turbine power coefficient C, air density ρ, rotor swept area A, and wind speed v; therefore, the theoretical power output P of wind power generation is... f The expression is as follows:
[0089]
[0090] Where: p is atmospheric pressure, t is air temperature, p w Air humidity;
[0091] In this embodiment, for wind power generation, when the wind speed does not reach the cut-in wind speed, i.e., v < V in The fan output power is P f =0; when the wind speed is between the cut-in wind speed and the rated wind speed, i.e., V in ≤v≤V rate Then calculate according to the above formula; when the wind speed is between the rated wind speed and the cut-out wind speed, i.e., V rate <v<V out The fan output power is maintained at the rated power P. f =P rate When the wind speed is greater than the cut-out wind speed, i.e., v > V out To protect the wind turbine, it needs to be shut down. At this time, P f =0.
[0092] S13. For photovoltaic power generation, the main factors affecting the power output of photovoltaic power generation include photoelectric conversion efficiency η, photovoltaic array area S, radiation intensity I, and air temperature t0; then the theoretical power output P of photovoltaic power generation... s The expression is as follows:
[0093] P s =ηSI[100.005(t0+25)];
[0094] Where 1, 00.005, and 25 are constants.
[0095] S2. Based on the DBSCAN clustering algorithm, perform cluster analysis on theoretical power data and add theoretical power to expand the data dimension to obtain normal value datasets and outlier datasets of distributed power supply power.
[0096] In this embodiment, the DBSCAN clustering algorithm is used to cluster normal values, while the remaining data are classified as outliers. The sample point set is denoted as D = (p1, p2, ..., p...). n ), and through (ε, MinPts t The sample distribution density is described by p; ε is the neighborhood distance threshold for a given sample, and the ε neighborhood is defined for p. i ∈D, to p i The set of points whose distance from each other does not exceed ε; MinPts t The threshold for the number of samples within this distance threshold is set at the current time t. This threshold will be adaptively adjusted in step S4 with a period of T.
[0097] In this solution, addressing the issue of the diverse types of historical power data and to better adapt to different power generation modes, compared to traditional algorithms where the distance between two points is solely determined by measured power, this invention adds a data dimension for sample point p.i In its measured power x i Based on this, the corresponding theoretical power was added. When the distributed power source is any one of hydropower, wind power, or photovoltaic power generation The value is calculated based on its corresponding historical theoretical power generation.
[0098] Furthermore, step S2 specifically includes:
[0099] S21. Use theoretical power data as a dataset D = (p1, p2, ..., p...). n Cluster analysis was performed on the measured power x of the historical theoretical power generation. i Based on this, increase theoretical power To expand the data dimensions, when performing cluster analysis based on the DBSCAN clustering algorithm, any two sample points p i and p j The distance expression between them is as follows:
[0100]
[0101] ω1+ω2=1; ω1, ω2>0; ω1>ω2;
[0102] Where: ω1 and ω2 are both distance weight parameters, x j For p j Point measurement power, For p j Theoretical power of a point;
[0103] S22, if p i The ε domain contains at least MinPts t For each sample, then p i The core object is defined as a set of all density-reachable points. The density connections of all points in the set form a clustered sub-dataset. The clustered sub-datasets corresponding to all core objects in the dataset are combined to obtain the final normal value dataset A. The other data are the outlier dataset B.
[0104] See Figure 3 In this embodiment, the DBSCAN clustering algorithm performs clustering analysis as follows:
[0105] S221: Process begins;
[0106] S222: Input dataset D (or dataset D′) and set the parameter MinPts for DBSCAN clustering (assuming the current time t, the value of MinPts is MinPts). t), the domain size parameter ε, the distance weight parameters ω1 and ω2, and create an empty set A (or an empty set A″) and an empty set B (or an empty set B″);
[0107] S223: Select any unvisited point p from dataset D (or dataset D′);
[0108] S224: Check if the number of points in the ε-neighborhood of point p is greater than or equal to MinPts (or MinPts) t If yes, proceed to step S226; otherwise, proceed to step S225.
[0109] S225: Mark point p as an outlier and add it to set B (or B″);
[0110] S226: Mark point p as the core point, establish a new cluster C, and add all points in the neighborhood of point p to the new cluster C;
[0111] S227: Check all unmarked points in cluster C, and denote them as point q;
[0112] S228: Check if the number of points in the ε neighborhood of point q is less than MinPts; if yes, mark the point as a boundary point and return to step S227; otherwise, proceed to step S229.
[0113] S229: Add all points in the neighborhood of a point to cluster C, and add all points in C to set A (or A″);
[0114] S2210: Check if there are any unlabeled points in dataset D (or dataset D′); if yes, return to step S223; otherwise, the process ends and the cluster analysis results are output.
[0115] S3. The loss function of the LSTM prediction network is optimized by combining the physical constraints and theoretical power of the distributed power source. Based on the normal value dataset and the outlier dataset, the normal value prediction result and the outlier prediction result of the future power generation of the distributed power source are obtained by the LSTM prediction network. The LSTM prediction network includes a first prediction network and a second prediction network connected in parallel.
[0116] Furthermore, in this scheme, the first prediction network includes several input channels, an initial LSTM layer, a feature fusion layer, a final LSTM layer, and an output layer;
[0117] The second prediction network includes several input channels, an initial LSTM layer, a feature fusion layer, and an output layer;
[0118] The first and second prediction networks each have several input channels including power data input, meteorological data input, and equipment status data input;
[0119] The initial LSTM layers of both the first and second prediction networks include a power data LSTM layer, a meteorological data LSTM layer, and an equipment status data LSTM layer.
[0120] See Figure 4 In this embodiment, the first prediction network is used to predict the normal value of electricity, and it includes three input channels, an initial LSTM layer, a feature fusion layer, a final LSTM layer, and an output layer.
[0121] The three input channels are for power data input, including the current time T before the current time. a Historical normal power data and corresponding theoretical power data for the time period are from set A; meteorological data input includes historical meteorological data for the corresponding time in set A and future meteorological data from the current time to the next T. b Weather forecast data for the time period; equipment status data input, which includes the operating status of power equipment at the corresponding time in set A.
[0122] Each input passes through its own initial LSTM layer: a power data LSTM layer, a meteorological data LSTM layer, and a device status data LSTM layer. Then, the feature fusion layer merges the outputs of each LSTM layer into a single data set via data connections. This merged data is then input into the final LSTM layer for further extraction of advanced time-series features. The output layer is a fully connected layer using the sigmoid function as the activation function. Finally, the output layer outputs a set of predicted power values, providing a prediction of the occurrence time and corresponding value of normal power for the distributed power source over a future period. This predicted normal power value is combined with its corresponding theoretical power data to form set A′.
[0123] The second prediction network is used to predict power anomalies. It consists of three input channels, an initial LSTM layer, a feature fusion layer, and an output layer.
[0124] The three input channels are for power data input, including the current time T before the current time. a Historical power anomaly data and corresponding theoretical power data for the time period are from set B; meteorological data input includes historical meteorological data for the corresponding time in set B and future meteorological data from the current time to the next T. b Weather forecast data for the time period; equipment status data input, which includes the power equipment operating status at the corresponding time in set B.
[0125] Each input passes through its own initial LSTM layer, namely the power data LSTM layer, the meteorological data LSTM layer, and the equipment status data LSTM layer. Then, the feature fusion layer merges the outputs of each LSTM layer into a whole through data connections. The merged data is then input into the output layer, which is a fully connected layer that uses the sigmoid function as the activation function to output the prediction results of the occurrence time and corresponding value of abnormal power of the distributed power source in the future.
[0126] For the LSTM layers in the first and second prediction networks, each LSTM layer contains an input gate, a forget gate, an output gate, and a cell state. The processing steps are as follows:
[0127] The memory information at time t is stored in cell state C. t In this process, the input gate processes the input at the current sequence position, and includes a sigmoid function layer and a tanh function layer. The sigmoid function determines which new information is added to the cell state, and its expression is as follows:
[0128] i t =σ(W i [h t-1 x t ]+b i );
[0129] Where: σ(*) is the sigmoid function, x t h is the input for the current sequence position. t-1 To be in a hidden state, W i b i For network parameters;
[0130] The candidate vectors generated by the tanh function layer transform information into a form that can be incorporated into the cell state, as shown in the following expression:
[0131]
[0132] Where: tanh(*) is the tanh function, W c b j For network parameters;
[0133] The forget gate uses the sigmoid function to determine which states of the previous cell layer need to be forgotten and which need to be retained. Its expression is as follows:
[0134] f t =σ(W f [h t-1 x t ]+b f );
[0135] Among them: W f bf For network parameters;
[0136] Thus, the cell state is updated to
[0137] Furthermore, regarding the loss function of the first prediction network, since the output power of distributed power sources has physical constraints, such as wind power generation being limited by wind speed and solar power output not being negative, this invention adds a physical constraint penalty term to the loss function for correction. Therefore, its loss function... as follows:
[0138]
[0139] Where: N1 is the output dimension of the first prediction network, x i This is the actual power. To predict power, λ1 is the weighting coefficient of the physical constraints. P is a physical constraint penalty term. min For minimum power, P max This is the maximum power.
[0140] The above constraints limit the power prediction to be no less than the minimum power P. min It also does not exceed the maximum power P max For hydropower and photovoltaic power generation, P min and P max The value of P can be calculated using the corresponding formula in step S1, based on the actual power generation method, equipment parameters, and upper and lower limits of meteorological fluctuations; for wind power generation, P min That is, P is 0. max That is, P rate .
[0141] For the loss function of the second prediction network, to reflect the prediction of outliers, theoretical power is introduced. The loss function reflects the difference between outliers and theoretical power as follows:
[0142]
[0143] Where: N2 is the output dimension of the second prediction network, and λ2 is the weighting coefficient for the difference between the theoretical power and the actual power. Theoretical power, Here, x represents the prediction power of the two-prediction network, N3 is the number of outlier datasets, and x is the prediction power. B,i The actual power in the outlier dataset. This represents the predicted power at the time corresponding to the actual power.
[0144] Furthermore, step S3 specifically includes:
[0145] S31. Based on the first prediction network and the normal value dataset A, predict the time and corresponding value of normal power occurrence in the future period of the distributed power source, and obtain the normal value prediction result a; combine the normal value prediction result a with the theoretical power data corresponding to the normal value dataset A to obtain the normal value data set A′.
[0146] S32. Based on the second prediction network and the outlier dataset B, predict the time and corresponding value of abnormal power occurrence in the future period of the distributed power source, and obtain the outlier prediction result b.
[0147] S33. Compare the prediction results of normal values (a) with the prediction results of outliers (b);
[0148] If at the same time t, a t =b t Then the outlier prediction result b t Add noise σ to correct for outlier predictions and obtain the corrected outlier prediction result b′. t The outlier prediction result b′ will be corrected. t The outlier dataset B' is obtained by combining the theoretical power data corresponding to the outlier dataset B.
[0149] If at the same time t, a t ≠b t Then the outlier prediction result b t The outlier dataset B' is obtained by combining the theoretical power data corresponding to the outlier dataset B.
[0150] S4. Based on the prediction results of normal values and outliers, set the parameter adjustment conditions, adaptively adjust the parameter settings of the DBSCAN clustering algorithm, and repeat steps S1-S4 until the prediction is completed.
[0151] In this embodiment, steps S1-S4 are called one round of prediction. The DBSCAN clustering algorithm parameters adjusted in each round of prediction are used for prediction in the next round. Then, steps S1-S4 are repeated until the stopping condition is met and the prediction is completed.
[0152] See Figure 5 Furthermore, step S4 specifically includes:
[0153] S41. Combine the set of normal values A′ and the set of outliers B′ to form a dataset D′={A′,B′};
[0154] S42. Perform cluster analysis on dataset D′ based on the DBSCAN clustering algorithm to obtain a new set of normal values A″ and a set of outliers B″.
[0155] S43. Set the first and second conditions for adaptive parameter adjustment of the clustering algorithm, and determine whether they are satisfied; if either the first or second condition is satisfied, update the sample number threshold MinPts of the clustering algorithm at the next time step according to the satisfied condition. t ;
[0156] The first condition is: if the number of data in the intersection of B″ and A′ exceeds the threshold N0, that is, |A′∩B″|>N0, where |*| is the number of elements in the set; the first condition means that the clustering algorithm assigns more of the normal values predicted by the network to the outliers.
[0157] The second condition is: if the number of data in the intersection of A″ and B′ exceeds the threshold N0, that is, |A″∩B′|>N0; the second condition means that the clustering algorithm assigns more outliers predicted by the network to normal values.
[0158] If the first condition is met, then increase the threshold MinPts for the number of samples in the clustering algorithm at the next time step. t Its expression is as follows:
[0159]
[0160] If the second condition is met, then decrease the sample number threshold MinPts for the clustering algorithm in the next time step. t Its expression is as follows:
[0161]
[0162] in: To round down;
[0163] S44, MinPts based on the updated sample count threshold t Return to step S1.
[0164] Example 2:
[0165] See Figure 6 A distributed power supply prediction system based on LSTM, which is applied to the method described in Example 1, the system comprising:
[0166] Theoretical power data calculation module 1 is used to acquire historical meteorological data and future forecast meteorological data of the target area of distributed power generation, and to calculate the theoretical power data of the target area of distributed power generation.
[0167] Furthermore, the theoretical power data calculation module 1 is used to calculate theoretical power data according to the following steps:
[0168] S11. Obtain historical meteorological data and future forecast meteorological data for the target area of the distributed power source; the meteorological data includes water runoff, upstream and downstream water level, wind speed, atmospheric pressure, air temperature, air humidity, and solar radiation intensity.
[0169] S12. Obtain the generation type of the distributed power source, select the historical meteorological data and future forecast meteorological data corresponding to the generation type, and calculate the corresponding theoretical power generation.
[0170] The power generation type includes any one of hydropower, wind power, and photovoltaic power; the theoretical power generation corresponding to the power generation type includes any one or any combination of the following:
[0171] For hydropower generation, factors affecting the power output of a turbine generator include the water flow rate *l* through the generator, the operating head *h*, and the generator efficiency *λ*. Therefore, the theoretical power output *P* of hydropower generation is... w The expression is as follows:
[0172] P w =lhλ;
[0173] h = h a -h b -h δ ;
[0174] Where: h a h represents the upstream water level height. b The downstream water level is h. δ For head loss at power plants;
[0175] For wind power generation, the main factors affecting the power output of a wind turbine include the turbine power coefficient C, air density ρ, rotor swept area A, and wind speed v; therefore, the theoretical power output P of wind power generation is... f The expression is as follows:
[0176]
[0177] Where: p is atmospheric pressure, t is air temperature, p w Air humidity;
[0178] For photovoltaic (PV) power generation, the main factors affecting its output power include photoelectric conversion efficiency η, PV array area S, radiation intensity I, and air temperature t0; therefore, the theoretical output power P of PV power generation is... s The expression is as follows:
[0179] P s =ηSI[100.005(t0+25)];
[0180] Where 100.005 and 25 are constants.
[0181] Clustering analysis module 2 is used to perform clustering analysis on theoretical power data based on the DBSCAN clustering algorithm, and to expand the data dimension by adding theoretical power to obtain normal value datasets and outlier datasets of distributed power supply power.
[0182] Furthermore, the clustering analysis module 2 is used to perform clustering analysis according to the following steps:
[0183] S21. Use theoretical power data as a dataset D = (p1, p2, ..., p...). n Cluster analysis was performed on the measured power x of the historical theoretical power generation. i Based on this, increase theoretical power To expand the data dimensions, when performing cluster analysis based on the DBSCAN clustering algorithm, any two sample points p i and p j The distance expression between them is as follows:
[0184]
[0185] ω1+ω2=1; ω1, ω2>0; ω1>ω2;
[0186] Where: ω1 and ω2 are both distance weight parameters, x j For p j Point measurement power, For p j Theoretical power of a point;
[0187] S22, if p i The ε domain contains at least MinPts t For each sample, then p i The dataset consists of the core objects. The clustered sub-data of all core objects in the dataset is collected to obtain the final normal value dataset A, and the other data is the outlier dataset B.
[0188] Prediction network module 3 is used to optimize the loss function of the LSTM prediction network by combining the physical constraints and theoretical power of the distributed power source, and to predict the normal value prediction results and the outlier prediction results of the future power generation of the distributed power source based on the normal value dataset and the outlier dataset, respectively; the LSTM prediction network includes a first prediction network and a second prediction network connected in parallel.
[0189] Furthermore, the prediction network module 3 is used to make predictions according to the following steps:
[0190] S31. Based on the first prediction network and the normal value dataset A, predict the time and corresponding value of normal power occurrence in the future period of the distributed power source, and obtain the normal value prediction result a; combine the normal value prediction result a with the theoretical power data corresponding to the normal value dataset A to obtain the normal value data set A′.
[0191] S32. Based on the second prediction network and the outlier dataset B, predict the time and corresponding value of abnormal power occurrence in the future period of the distributed power source, and obtain the outlier prediction result b.
[0192] S33. Compare the prediction results of normal values (a) with the prediction results of outliers (b);
[0193] If at the same time t, a t =b t Then the outlier prediction result b t Add noise σ to correct for outlier predictions and obtain the corrected outlier prediction result b′. t The outlier prediction result b′ will be corrected. t The outlier dataset B′ is obtained by combining the theoretical power data corresponding to the outlier dataset B.
[0194] The loss function optimized by the prediction network module 3 is as follows:
[0195] By adding a physical constraint penalty term to the loss function of the first prediction network for correction, its loss function becomes... as follows:
[0196]
[0197]
[0198] Where: N1 is the output dimension of the first prediction network, x i This is the actual power. To predict power, λ1 is the weighting coefficient of the physical constraints. P is a physical constraint penalty term. min For minimum power, P max This is the maximum power.
[0199] In the loss function of the second prediction network, theoretical power is added for correction, and its loss function is then... as follows:
[0200]
[0201] Where: N2 is the output dimension of the second prediction network, and λ2 is the weighting coefficient for the difference between the theoretical power and the actual power. Theoretical power, N is the prediction power of the second prediction network, N3 is the number of outlier datasets, and x is the prediction power of the second prediction network. B,i The actual power in the outlier dataset. This represents the predicted power at the time corresponding to the actual power.
[0202] The adaptive adjustment clustering module 4 is used to set parameter adjustment conditions based on the prediction results of normal values and outliers, adaptively adjust the parameter settings of the DBSCAN clustering algorithm, and repeat the steps of the above modules until the prediction is completed.
[0203] Furthermore, the adaptive clustering module 4 is used to set parameter adjustment conditions according to the following steps:
[0204] S41. Combine the set of normal values A′ and the set of outliers B′ to form a dataset D′={A′,B′};
[0205] S42. Perform cluster analysis on dataset D′ based on the DBSCAN clustering algorithm to obtain a new set of normal values A″ and a set of outliers B″.
[0206] S43. Set the first and second conditions for adaptive parameter adjustment of the clustering algorithm, and determine whether they are satisfied; if either the first or second condition is satisfied, update the sample number threshold MinPts of the clustering algorithm at the next time step according to the satisfied condition. t ;
[0207] The first condition is: if the number of data in the intersection of B″ and A′ exceeds the threshold N0, that is, |A′∩B″|>N0;
[0208] The second condition is: if the number of data in the intersection of A″ and B′ exceeds the threshold N0, that is, |A″∩B′|>N0;
[0209] If the first condition is met, then increase the threshold MinPts for the number of samples in the clustering algorithm at the next time step. t Its expression is as follows:
[0210]
[0211] If the second condition is met, then decrease the sample number threshold MinPts for the clustering algorithm in the next time step. t Its expression is as follows:
[0212]
[0213] in: To round down;
[0214] S44, MinPts based on the updated sample count thresholdt Return to step S1.
[0215] Example 3:
[0216] See Figure 7 A distributed power supply prediction device based on LSTM, the device including a processor 5 and a memory 6;
[0217] The memory 6 is used to store computer program code 61 and transmit the computer program code 61 to the processor 5;
[0218] The processor 5 is used to execute the LSTM-based distributed power supply prediction method described in Embodiment 1 according to the instructions in the computer program code 61.
[0219] This embodiment also includes a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed on a computer, the LSTM-based distributed power supply prediction method described in Embodiment 1 is implemented.
[0220] Generally, the computer instructions for implementing the method of the present invention can be carried on any combination of one or more computer-readable storage media. Non-transitory computer-readable storage media can include any computer-readable medium except for the signal itself, which is temporarily propagating.
[0221] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EKROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0222] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. These programming languages include object-oriented programming languages—such as Java, Smarttalk, and C++—as well as conventional procedural programming languages—such as the "C" language or similar programming languages. In particular, Python, suitable for neural network computation, and platform frameworks based on TensorFlow, PyTorch, etc., can be used. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer or to an external computer (e.g., via the Internet using an Internet service provider) through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0223] For details regarding the aforementioned devices and non-transitory computer-readable storage media, please refer to the specific description of an LSTM-based distributed power supply prediction method and its beneficial effects, which will not be repeated here.
[0224] Although embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for predicting power supply of distributed power sources based on LSTM, characterized in that, The method comprises the steps of: S1, acquiring historical meteorological data and future forecast meteorological data of a distributed power supply target area, and calculating theoretical power data of the distributed power supply target area; S2, performing clustering analysis on the theoretical power data based on a DBSCAN clustering algorithm, and increasing a theoretical power expansion data dimension to obtain a normal value data set and an abnormal value data set of distributed power supply power; The step S2 specifically comprises: S21, the theoretical power data as a dataset Cluster analysis is performed, and the measured power of the theoretical power generation is increased To expand the data dimension, when cluster analysis is performed based on the DBSCAN clustering algorithm, the distance expression between any two sample points and is as follows: ; ; ; ; in: , All are distance weight parameters. for Point measurement power, for The theoretical power of the point; the theoretical power Calculations are performed based on the historical theoretical power generation capacity corresponding to distributed power sources; S22, if of at least contains samples, then is the core object, all the core object corresponding clustering sub-data in the data set is collected to obtain the final normal value data set , then the other data is the abnormal value data set ; S3, optimizing a loss function of an LSTM prediction network in combination with physical constraints of the distributed power supply and the theoretical power, and predicting normal value prediction results and abnormal value prediction results of future distributed power supply power based on the normal value data set and the abnormal value data set through the LSTM prediction network; the LSTM prediction network comprises a first prediction network and a second prediction network connected in parallel; S4, setting a parameter adjustment condition based on the normal value prediction results and the abnormal value prediction results, adaptively adjusting parameter settings of the DBSCAN clustering algorithm, and repeating steps S1-S4 until the prediction is completed.
2. The distributed power supply power prediction method based on LSTM according to claim 1, wherein: The step S1 specifically comprises: S11, acquiring historical meteorological data and future forecast meteorological data of a distributed power supply target area; the meteorological data comprises water flow rate, upstream and downstream water level height, wind speed, atmospheric pressure, air temperature, air humidity, and light radiation intensity; S12, acquiring a power generation type of the distributed power supply, and selecting historical meteorological data and future forecast meteorological data corresponding to the power generation type to calculate corresponding theoretical power generation; The power generation type comprises any one of hydroelectric power generation, wind power generation, and photovoltaic power generation; the theoretical power generation corresponding to the power generation type comprises any one or any combination of the following: For hydroelectric power generation, factors affecting the power generation of a hydroelectric generator include the water flow rate through the generator , the working water head height , the working efficiency of the generator ; the expression of the theoretical power generation of hydroelectric power generation is as follows: ; ; wherein: is the upstream water level height, is the downstream water level height, is the power plant head loss; For wind power generation, the main factors affecting the power output of wind turbines include the wind turbine power factor. air density Wind turbine sweep area Wind speed The theoretical power generation capacity of wind power is... The expression is as follows: ; ; wherein: is the atmospheric pressure, is the air temperature, is the air humidity; For photovoltaic power generation, factors affecting the power generation of photovoltaic power generation mainly include the photoelectric conversion efficiency , the photovoltaic array area , the radiation intensity , the air temperature ; the expression of the theoretical power generation of photovoltaic power generation is as follows: 。 3. The distributed power supply power prediction method based on LSTM according to claim 2, wherein: The step S3 specifically comprises: S31, based on the first prediction network and the normal value dataset , predict the normal power occurrence time and corresponding value of the distributed power source in the future period, and obtain a normal value prediction result ; combine the normal value prediction result with the corresponding theoretical power data set of the normal value data set to obtain a normal value data set ; S32, predicting the abnormal power occurrence time and corresponding value of the distributed power in the future time period based on the second prediction network and the abnormal value data set , and obtaining an abnormal value prediction result ; S33, compare normal value prediction result with abnormal value prediction result ; If at the same time , ; the abnormal value prediction result is increased by noise , the modified abnormal value prediction result is obtained; the modified abnormal value prediction result is combined with the corresponding theoretical power data set of the abnormal value data set to obtain the abnormal value data set .
4. The distributed power supply power prediction method based on LSTM according to claim 3, wherein: The step S4 specifically comprises: S41, forming a normal value data set with an abnormal value data set comprising forming a data set ; S42, clustering analysis is performed on the dataset based on the DBSCAN clustering algorithm to obtain a new normal value data set and an outlier data set ; S43, set the first condition and the second condition of adaptive parameter adjustment of the clustering algorithm, and determine whether the conditions are met; if any one of the first condition or the second condition is met, update the sample number threshold of the clustering algorithm at the next time according to the met condition ; The first condition is that the number of data in the intersection of and exceeds a threshold , i.e. ; The second condition is that the number of data in the intersection of and exceeds a threshold , i.e. ; If the first condition is satisfied, then the sample size threshold of the clustering algorithm at the next time is increased The expression is as follows: ; If the second condition is satisfied, then the sample size threshold of the clustering algorithm at the next time is reduced The expression is as follows: ; wherein: is rounded down; S44, based on the updated sample quantity threshold , return to step S1.
5. The distributed power supply power prediction method based on LSTM according to claim 1, wherein: In the step S3, the optimization of the loss function means: In the loss function of the first prediction network, a physical constraint penalty term is added for correction, and the loss function thereof is As follows: ; ; wherein: is an output dimension of the first prediction network, is a measured power, is a predicted power, is a weight coefficient of a physical constraint, is a physical constraint penalty term, is a minimum power, is a maximum power.
6. The distributed power supply power prediction method based on LSTM according to claim 1, wherein: In the step S3, the optimization of the loss function means: In the loss function of the second prediction network, the theoretical power is added for correction, and the loss function thereof is As follows: ; wherein: is an output dimension of the second prediction network, is a weight coefficient of the theoretical power difference, is a theoretical power, is a predicted power, is a number of outlier data sets, is an actual power in the outlier data set, is a predicted power corresponding to the actual power.
7. The distributed power supply power prediction method based on LSTM according to claim 1, wherein: The first prediction network comprises a plurality of input channels, an initial LSTM layer, a feature fusion layer, a final LSTM layer, and an output layer; The second prediction network comprises a plurality of input channels, an initial LSTM layer, a feature fusion layer, and an output layer; The plurality of input channels of the first and second prediction networks each comprises power data input, meteorological data input, and device state data input. The initial LSTM layers of the first and second prediction networks each include a power data LSTM layer, a meteorological data LSTM layer, and a device state data LSTM layer.
8. An LSTM-based distributed power supply power prediction system, characterized by, The system is applied to the method of any one of claims 1-7, and the system comprises: a theoretical power data calculation module (1) configured to obtain historical meteorological data and future forecast meteorological data of a target area of a distributed power source, and calculate theoretical power data of the target area of the distributed power source; a clustering analysis module (2) configured to perform clustering analysis on the theoretical power data based on a DBSCAN clustering algorithm, and increase a dimension of theoretical power expansion data to obtain a normal value data set and an abnormal value data set of power supply of the distributed power source; a prediction network module (3) configured to optimize a loss function of an LSTM prediction network in combination with physical constraints of the distributed power source and theoretical power, and based on the normal value data set and the abnormal value data set, predict normal value prediction results and abnormal value prediction results of future power generation of the distributed power source through the LSTM prediction network; the LSTM prediction network comprises a first prediction network and a second prediction network connected in parallel; an adaptive adjustment clustering module (4) configured to set a parameter adjustment condition based on the normal value prediction results and the abnormal value prediction results, adaptively adjust parameter settings of the DBSCAN clustering algorithm, and repeat steps of the above modules until prediction is completed.
9. An LSTM-based distributed power source power supply power prediction device, characterized in that: the device comprises a processor (5) and a memory (6); the memory (6) is configured to store computer program code (61) and transmit the computer program code (61) to the processor (5); the processor (5) is configured to execute the LSTM-based distributed power source power supply power prediction method of any one of claims 1-7 according to instructions in the computer program code (61).
Citation Information
Patent Citations
Photovoltaic generating capacity prediction model training method and photovoltaic generating capacity prediction method
CN119046685A
Distance to obstacle detection in autonomous machine applications
US20200210726A1