A photovoltaic power generation power short-term interval prediction method based on an LSTM network
By introducing grid acceptance capacity and quantile monotonicity penalty terms into the loss function of the LSTM network, the problems of grid constraints and quantile overlap in photovoltaic power generation forecasting are solved, realizing a reliable forecast interval that can be directly used for grid dispatch, thereby improving the accuracy of forecasting and the security of the power system.
Patent Information
- Application Number
- CN202611207754.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-11-24
AI Technical Summary
Existing photovoltaic power generation forecasting methods do not consider the physical constraints of grid acceptance capacity, resulting in forecasts that exceed the grid's allowed active power output. Furthermore, the quantile forecasts lack monotonicity and exhibit crossover phenomena, failing to provide a reliable basis for power system dispatching.
The first and second penalty terms are introduced into the loss function of the LSTM network to constrain the upper limit of the grid acceptance capacity and the monotonicity of the quantiles, respectively. The high quantile out-of-bounds is suppressed by using an asymmetric weight factor. The penalty coefficient search is optimized by combining the progressive training strategy of the penalty coefficient and the gradient magnitude analysis to ensure that the prediction interval meets the grid constraints.
It enables the prediction interval to automatically meet the grid acceptance capacity constraints without post-processing, improves the reliability of prediction results and the accuracy of scheduling decisions, and eliminates the boundary truncation and quantile crossover problems in traditional methods.
Smart Images

Figure CN123162771A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of photovoltaic power generation prediction, specifically a short-term interval prediction method for photovoltaic power generation based on LSTM networks. Background Technology
[0002] With the rapid development of renewable energy power generation technology, the installed capacity and power generation of photovoltaic power generation in the power system are constantly increasing. However, since photovoltaic power generation is affected by meteorological factors such as solar irradiance, cloud cover, and ambient temperature, it has obvious randomness, fluctuation and intermittency. Large-scale photovoltaic power generation grid connection will have an adverse impact on the active power balance, frequency stability and voltage quality of the power system.
[0003] Long Short-Term Memory (LSTM) networks, as an improved recurrent neural network, can effectively capture long-distance dependencies in time-series data and have been widely used in photovoltaic power generation range prediction. In existing technologies, quantile regression loss functions are usually used to train LSTM networks, and the prediction range of photovoltaic power generation is constructed by outputting prediction values of different quantiles.
[0004] However, the aforementioned existing technologies do not consider the physical constraints related to grid connection, which may cause the predicted power value to exceed the maximum allowable active power output of the photovoltaic power plant's grid connection point. This results in physical loopholes in the prediction results, making them inefficient for use in power system dispatch. Furthermore, the predicted values of different quantiles are obtained through independent training, lacking constraints on the monotonicity between quantiles. This can easily lead to crossovers where the predicted values of higher quantiles are lower than those of lower quantiles, causing the prediction interval to lose statistical significance and failing to provide a reliable risk assessment basis for power system dispatch. Summary of the Invention
[0005] The purpose of this invention is to simultaneously introduce a first penalty term and a second penalty term into the loss function, enabling the LSTM network to internalize the time-varying grid acceptance capacity upper limit constraint and quantile monotonicity constraint into the network weights during the training phase. This allows the prediction interval to be directly used for grid dispatch without post-processing, solving the technical problem of traditional prediction methods' output results violating grid physical boundaries and quantile overlap. Another purpose of this invention is to prioritize suppressing high quantile out-of-bounds errors and reduce the risk of dispatch false alarms by multiplying high quantile out-of-bounds errors and low quantile out-of-bounds errors by different weight factors in the first penalty term, with the high quantile weight factor being greater than the low quantile weight factor. Another objective of this invention is to determine the search range of the penalty coefficient based on gradient magnitude analysis and automatically select the optimal penalty coefficient on the validation set with the goal of minimizing the comprehensive evaluation index. This solves the technical problem of relying on manual experience to tune parameters in traditional methods and achieves objective quantification of the penalty coefficient. Another objective of this invention is to adopt a progressive strategy during the training process of the first penalty coefficient, which is initially set to zero or a minimum value and then gradually increased to the target value at an exponential rate after the basic loss converges. This avoids the network from prematurely converging to a conservative solution due to the imposition of strong constraints in the early stages of training, and allows the richness of the prediction distribution to be preserved to the maximum extent while satisfying the boundary constraints. Based on the above problems, this invention proposes a short-term interval prediction method for photovoltaic power generation based on LSTM networks, comprising the following steps: S1. Obtain historical power data, meteorological data, and real-time operating status characteristics of the power grid from the photovoltaic power station, and construct a training sample set; each sample in the training sample set includes: a meteorological data sequence within a preset time window, real-time operating status characteristics of the power grid at the corresponding moment of the time window, and the actual power value; S2. Construct an LSTM network, wherein the output layer of the LSTM network is configured to output high quantile prediction values and low quantile prediction values. S3. The meteorological data sequence and real-time power grid operation status features in the training sample set are used as network inputs, and the LSTM network is trained using a loss function; wherein, the loss function includes a first penalty term and a second penalty term; The first penalty term is used to: increase the total loss based on the difference between the predicted value and the upper limit value when either the high quantile predicted value or the low quantile predicted value exceeds the upper limit of the grid acceptance capacity at the corresponding time. The second penalty term is used to increase the total loss based on the difference between the high quantile predicted value and the low quantile predicted value. S4. Input the meteorological data and real-time operating status characteristics of the power grid at the time to be predicted into the trained LSTM network, and output the short-term prediction range of photovoltaic power generation. Preferably, the first penalty term is calculated as follows: the high quantile predicted value is subtracted from the upper limit of the grid acceptance capacity to obtain the first high quantile difference value, and the low quantile predicted value is subtracted from the upper limit of the grid acceptance capacity to obtain the first low quantile difference value; a positive operation is applied to the first high quantile difference value and the first low quantile difference value respectively, retaining the part greater than zero and setting the part less than or equal to zero to zero; the sum of the positive first high quantile difference value and the positive first low quantile difference value is used as the base value of the first penalty term. Preferably, the second penalty term is calculated as follows: the cross difference is obtained by subtracting the high quantile prediction value from the low quantile prediction value; a positive operation is applied to the cross difference value. When the high quantile prediction value is lower than the low quantile prediction value, the positive value of the cross difference value is retained as the effective cross amount. When the high quantile prediction value is not lower than the low quantile prediction value, the cross difference value is zero after being positively applied; the sum of the effective cross amounts at each time step is used as the base value of the second penalty term. Preferably, the first penalty term further includes multiplying the positive first high score difference by a first weighting factor, multiplying the positive first low score difference by a second weighting factor, and the first weighting factor being greater than the second weighting factor, and using the weighted sum of the two as the first penalty term. Preferably, the total loss function includes a basic quantile regression loss term: for high quantile predicted values, the quantile loss is calculated using the high quantile weighting coefficient; for low quantile predicted values, the quantile loss is calculated using the low quantile weighting coefficient. The quantile loss is calculated as follows: when the actual power value is greater than the predicted value, the difference between the actual power value and the predicted value is multiplied by the quantile weighting coefficient as the loss; when the predicted value is greater than the actual power value, the difference between the predicted value and the actual power value is multiplied by one minus the quantile weighting coefficient as the loss. Preferably, the total loss function further includes a weighted sum of the first penalty term and the second penalty term. The values of the first penalty coefficient and the second penalty coefficient are determined through the following steps: constructing a candidate coefficient grid, wherein the search range of the first penalty coefficient is a logarithmically uniform distribution interval from 10 to the power of -4 to 10 to the power of 0, and the search range of the second penalty coefficient is a logarithmically uniform distribution interval from 10 to the power of -3 to 10 to the power of 1, and the upper limit of the first penalty coefficient is less than the upper limit of the second penalty coefficient; for each set of coefficients in the grid, calculating a comprehensive evaluation index on the validation set, wherein the comprehensive evaluation index is obtained by a weighted sum of three sub-indicators: interval coverage deviation, interval average width, and out-of-bounds frequency, wherein the out-of-bounds frequency refers to the proportion of time steps in which the predicted value exceeds the upper limit of the grid acceptance capacity to the total number of time steps; selecting the set of coefficients that minimizes the comprehensive evaluation index as the final configuration. Preferably, the first penalty coefficient also includes a training strategy: in the initial training phase, the first penalty coefficient is set to zero or a preset initial positive number, and after the basic quantile regression loss term converges to a stable value, the first penalty coefficient is gradually increased to a preset target value at an exponential growth rate. As a preferred option, step S4 specifically includes: inputting the meteorological data and real-time operating status characteristics of the power grid at the time to be predicted into the trained LSTM network, and directly outputting the high quantile prediction value and the low quantile prediction value after forward propagation calculation. Preferably, the hidden layer of the LSTM network adopts a two-layer structure, with the first layer containing 64 LSTM units and the second layer containing 32 LSTM units. A residual connection is introduced between the first layer and the second layer, and the hidden state vector output by the first hidden layer and the hidden state vector input by the second hidden layer are added element by element before entering the gating calculation of the second layer. Preferably, the quantile corresponding to the high quantile prediction value is 95%, and the quantile corresponding to the low quantile prediction value is 5%, together forming a prediction interval with a nominal confidence level of 90%.
[0006] The present invention has the following beneficial effects: This invention introduces both a first penalty term and a second penalty term into the loss function, constructing a dual constraint mechanism. The first penalty term internalizes the time-varying upper limit of grid acceptance capacity as a physical boundary into the LSTM network weights, while the second penalty term enforces a monotonicity constraint between high-quantile and low-quantile predicted values during the training phase. The synergistic effect of the two penalty terms results in the LSTM network's direct output prediction interval during the inference phase automatically satisfying the upper limit constraint of grid acceptance capacity, with high-quantile values not lower than low-quantile values, requiring no post-processing correction operations. This eliminates the information loss and additional errors caused by boundary truncation and quantile sorting in traditional methods.
[0007] In this invention, the first high-quantile difference value after positive calculation is multiplied by a first weighting factor, and the first low-quantile difference value after positive calculation is multiplied by a second weighting factor, with the first weighting factor being greater than the second weighting factor. Since a high-quantile predicted value exceeding the limit indicates that the prediction is based on a high probability of a power value exceeding the grid's capacity, its scheduling false alarm hazard is higher than that of a low-quantile exceeding the limit. The asymmetric design allows the network to prioritize suppressing the out-of-limit behavior of high-quantile outputs during training, thereby improving the reliability of the prediction results in scheduling decisions.
[0008] In this invention, the search range of the penalty coefficient is determined based on the gradient magnitude analysis of the basic quantile regression loss term in the preliminary experiment. The lower limit is the minimum coefficient value that makes the gradient magnitude of the penalty term less than 1% of the gradient magnitude of the basic loss term, and the upper limit is the maximum coefficient value that makes the gradient magnitude of the penalty term equal to the gradient magnitude of the basic loss term. The comprehensive evaluation index is composed of three weighted factors: interval coverage deviation, interval average width, and out-of-bounds frequency. This ensures that the optimal coefficient combination achieves an objective balance between prediction accuracy and physical feasibility, and possesses good generalization and engineering transferability.
[0009] This invention employs a training strategy that progressively increases the first penalty coefficient: in the initial stage, the first penalty coefficient is set to zero or a minimum value, allowing the network to prioritize learning the basic statistical regularities of the power data; after the basic quantile regression loss term converges, the first penalty coefficient is gradually increased at an exponential rate to a preset target value. This strategy avoids the problem of the network becoming overly conservative due to applying full boundary constraints in the early stages of training, and maximizes the richness of the predicted distribution while satisfying physical constraints.
[0010] This invention incorporates the cloud cover index as an independent input feature into meteorological data. This index is extracted from cloud images captured by an all-sky imager after image segmentation and optical flow analysis. It reflects the cloud cover ratio and its movement trend, enabling the network to respond in advance to power fluctuations caused by cloud cover. Simultaneously, the residual connections between the two-layer LSTM provide a direct propagation path for gradients, effectively mitigating the gradient decay problem in the temporal and spatial dimensions of deep recurrent networks and improving the network's ability to capture long-term meteorological changes. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of the method described in this invention; Figure 2 This is a diagram of the LSTM network structure framework of the present invention. Detailed Implementation
[0012] The technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] refer to Figure 1 and Figure 2This embodiment uses a 10 MW photovoltaic power plant in actual operation as the application object. The power plant is located in an inland area and is connected to the regional power grid via a 10 kV transmission line. The power plant has deployed a data acquisition and monitoring control system and an all-sky imager, possessing complete records of historical power data, meteorological data, and grid dispatch information. The purpose of this embodiment is to provide a short-term interval prediction method for photovoltaic power generation based on an LSTM network. By introducing grid acceptance capacity constraint penalty terms and quantile crossover penalty terms into the loss function, the problem of prediction interval violations of physical boundaries and quantile crossovers is solved from the root of model training. This allows the trained network to directly output prediction intervals that meet grid acceptance capacity and are free of crossovers, without any post-processing corrections.
[0014] A training sample set was constructed by extracting 90 consecutive days of data from the power plant's historical database, with a time resolution of 15 minutes, totaling 8640 time points. For each time point, the following three types of information were obtained: The first type is meteorological data, including total horizontal irradiance, direct normal irradiance, diffuse irradiance, component temperature, ambient temperature, relative humidity, wind speed, wind direction, and cloud cover index. The cloud cover index was extracted from cloud images acquired by the all-sky imager after image segmentation and optical flow analysis. Specifically, the cloud image was thresholded using the Otsu's method, dividing pixels into cloud areas and clear sky areas. The proportion of cloud pixels to total pixels was used as the original cloud cover index. Then, the cloud movement velocity vector was calculated using the optical flow method, and the original cloud cover index was time-series smoothed to obtain the final cloud cover index, which ranges from 0 to 1, where 0 represents completely cloudless and 1 represents complete cloud cover. The second type is the actual power value, directly measured by the electricity meter at the power plant's grid connection point, in megawatts (MW). The third category is the upper limit of grid acceptance capacity. This value is obtained from the energy management system deployed in the grid dispatch center and is strictly aligned with the timestamp of each historical moment. The energy management system calculates this upper limit based on real-time power flow. The calculation inputs include: the long-term allowable current carrying capacity of the grid-connected line (the grid-connected line of this power station is a 10 kV cross-linked polyethylene cable with a long-term allowable current carrying capacity of 400 Amperes); the real-time load rate of the main transformer (the rated capacity of the main transformer of this power station is 12.5 MVA, and the real-time load rate fluctuates between 70% and 95%); the acceptable voltage range of the grid connection point (the voltage deviation is required to not exceed ±7% of the rated voltage); and the cross-sectional exchange power limit of the upstream grid (according to the regional grid dispatch instructions, the maximum allowable exchange power of the feeder where the grid connection point of this power station is located is 9 MW). The energy management system integrates the above constraints to solve for the maximum allowable active power output of the photovoltaic power station that satisfies all safety constraints; for example, the maximum allowable active power output = min(inverter rated capacity, dispatch limit, and power generation under real-time weather conditions). For example, at a typical noon moment, the calculated upper limit of grid acceptance capacity at that moment is 8.2 MW. For a few periods in historical data where the energy management system did not directly issue upper limits, the fixed switching power limit of 7.5 MW stipulated in the power plant grid connection agreement is used as the default value; alternatively, the equivalent upper limit of the grid connection point, derived by combining the maximum measured inverter output power during that period with line impedance parameters, is used as a supplementary label. For example, if the maximum measured inverter output power during a certain period is 6.8 MW, the line impedance is 0.15 ohms, and the grid connection point voltage is 10.2 kV, the equivalent upper limit is approximately 7.0 MW. After data extraction, an input feature sequence and two types of labels are constructed. A sliding window method is used, with a window width of 24 time steps. That is, the meteorological data sequence of the past 6 hours is used as the input feature of a sample, and the feature vector dimension of each time step is 9, so the input tensor shape is 24×9. Correspondingly, the actual power value of the next time step after this window and the upper limit of the grid acceptance capacity constitute the two labels.A total of 8616 samples were obtained, which were divided into training set, validation set and test set in a ratio of 7:2:1.
[0015] Next, an LSTM network is constructed. This embodiment employs a two-layer Long Short-Term Memory (LSTM) network structure, where the first layer contains 64 LSTM units and the second layer contains 32 LSTM units. A residual connection is introduced between the two layers. Specifically, the hidden state vector output by the first-layer LSTM unit at each time step has a dimension of 64. This vector is element-wise added to the original input vector of the second-layer LSTM unit before entering the gating computation of the second layer. Through this residual connection, the output information of the first layer can be directly passed to the second layer, providing a direct propagation path for the gradient that bypasses the nonlinear transformation of the second layer. This effectively alleviates gradient decay in the temporal and spatial dimensions of deep recurrent networks, accelerates training convergence, and improves the ability to capture long-term temporal dependencies. The output layer of the LSTM network is a fully connected layer containing two output nodes, corresponding to the high-quantile prediction value and the low-quantile prediction value, respectively. In this embodiment, the quantile corresponding to the high-quantile prediction value is set to 95%, and the quantile corresponding to the low-quantile prediction value is set to 5%, together forming a prediction interval with a nominal confidence level of 90%. The output layer uses a linear activation function f(x)=x, where x is the net input after the fully connected transformation of the output layer, without any truncation or sorting operations.
[0016] The total loss function is constructed by weighted summation of the basic quantile regression loss term, the first penalty term, and the second penalty term, and is expressed as follows: .in, The basic quantile regression loss term is calculated using the following formula: Where N is the number of training samples, and in this embodiment, the batch size is 32 in one training iteration, so N=32; This represents the true power value of the i-th sample. τ is the predicted value; τ is the quantile weighting coefficient, for example, τ=0.95 for the high quantile predicted value and τ=0.05 for the low quantile predicted value. This represents the positive operation, i.e., max(x,0). This loss term calculates the losses for the high and low quantiles independently and then sums them. First penalty term. This is used to internalize the upper limit constraint of grid acceptance capacity into the network weights. The calculation process is as follows: During the forward propagation phase of each training iteration, the LSTM network outputs high-quantile predicted values. and lower quantile predicted values Then, read the upper limit value U of the grid acceptance capacity at the corresponding time from the tag. Calculate the first high score difference value. The first lowest score difference .right and Apply the positive operation separately to obtain and When the predicted value does not exceed the upper limit, the positive result is zero, and no penalty is generated. This method further adopts an asymmetric penalty strategy to distinguish the severity of high-quantile and low-quantile boundary violations. The first high-quantile difference after positive calculation is multiplied by the first weighting factor α, and the first low-quantile difference after positive calculation is multiplied by the second weighting factor β, where α is greater than β. The first weighting factor is set to α=2, and the second weighting factor is set to β=1. The basis for this value is as follows: In power dispatching operation, the high-quantile predicted value represents the upper limit of photovoltaic power. If it exceeds the upper limit of the grid's capacity, it means that the prediction is that there is a high probability of power exceeding the grid's safety boundary, and measures such as power curtailment or adjustment of unit output must be taken in advance. Its false alarm harm is significantly higher than that of low-quantile boundary violations. According to the experience of the assessment weight of exceeding the upper limit and lower limit in the technical specifications for dispatching and operating photovoltaic power plants in the power industry, the penalty coefficient for exceeding the upper limit is set to twice that for exceeding the lower limit. Therefore, in this embodiment, α / β=2. The calculation formula for the first penalty term is as follows: This value is then multiplied by the first penalty coefficient λ1 and added to the total loss. Second penalty term. This is used to enforce a monotonicity constraint between the high-quantile and low-quantile predicted values. The calculation process is as follows: at each time step, calculate the cross difference. And apply a positive operation to c to obtain When the higher quantile is greater than or equal to the lower quantile, c ≤ 0, is positively rounded to zero, and no penalty is applied. When the higher quantile is lower than the lower quantile, c > 0, is positively rounded, and the positive value is retained as the effective crossover. The effective crossover values of all time steps are summed and then multiplied by the second penalty coefficient λ2, i.e. In this embodiment, since the batch size is 32 and each sample contains a prediction for one time step (i.e., single-step prediction), the summation is directly applied to all 32 samples. For multi-step prediction, the summation would need to be applied to multiple time steps for each sample.
[0017] The values of the first penalty coefficient λ1 and the second penalty coefficient λ2 are determined through an automatic grid search on the validation set. A candidate coefficient grid is constructed, with λ1 searching within a logarithmic uniform distribution from 10⁻⁴ to 100, and λ2 searching within a logarithmic uniform distribution from 10⁻³ to 101. The selection of these ranges is based on the following: the gradient magnitude of the fundamental quantile regression loss term is calculated through pre-experiments; in the training batch, the absolute value of the gradient of Lquantile with respect to the output layer nodes is approximately 0.01 to 0.1. The gradient of the first penalty term is equal to λ1×α (for high quantiles) or λ1×β (for low quantiles) when it exceeds the bounds, and the gradient of the second penalty term is equal to λ2 when it crosses boundaries. For the penalty terms to interact effectively with the fundamental loss term, the magnitude of the gradient of the penalty term needs to be comparable to the gradient of the fundamental loss term. When λ1 = 10⁻⁴, λ1 × α = 2 × 10⁻⁴, which is much smaller than the base gradient, and the penalty term is almost negligible. When λ1 = 100, λ1 × α = 2, which is significantly larger than the base gradient, and the penalty term plays a dominant role. Therefore, the search range of λ1 is determined to be 10⁻⁴ to 100. Similarly, for λ2, when λ2 = 10⁻³, the gradient is 0.001, which is smaller than the base gradient; when λ2 = 101, the gradient is 10, which is much larger than the base gradient. Therefore, the search range of λ2 is taken as 10⁻³ to 101. In addition, the grid acceptance capacity constraint is physically stricter than the fractional crossover constraint, and an excessively large λ1 will over-compress the prediction interval. Therefore, the upper limit of λ1, 100, is set to be less than the upper limit of λ2, 101. Within the aforementioned range, λ1 specifically takes nine values: 10⁻⁴, 10⁻³.5, 10⁻³, 10⁻².5, 10⁻², 10⁻¹.5, 10⁻¹, 10⁻⁵, and 100; λ2 specifically takes nine values: 10⁻³, 10⁻².5, 10⁻², 10⁻¹.5, 10⁻¹, 10⁻⁵, 100, 100.5, and 101, for a total of 81 coefficient combinations. For each coefficient combination, a complete training run is performed on the validation set, using the standard configuration described below. A comprehensive evaluation metric is calculated after training. The comprehensive evaluation metric is obtained by weighted summation of three sub-metrics: interval coverage bias, average interval width, and out-of-bounds frequency. Interval coverage bias is defined as the absolute value of the difference between the actual coverage of the predicted interval on the validation set and the nominal confidence level of 90%. For example, if the actual coverage on the validation set is 87%, the bias is 3%. The average width of the prediction interval is defined as the mean of the difference between the upper and lower bounds of the prediction interval over all validation samples, in megawatts. The out-of-bounds frequency is defined as the proportion of time steps in which the high-quantile or low-quantile prediction value exceeds the grid's capacity limit. The weights of the three sub-indicators are set to 0.4, 0.3, and 0.3 respectively, i.e., the comprehensive evaluation index = 0.4 × absolute value of coverage deviation + 0.3 × average width of the interval + 0.3 × out-of-bounds frequency.The weighting is based on the importance that the scheduling service places on the three attributes of the prediction interval: coverage deviation directly determines the reliability of probabilistic prediction and has the highest priority; interval width and out-of-bounds frequency both affect the conservatism of scheduling decisions, and their importance is equal. After traversing all 81 sets of coefficients, the set of coefficients that minimizes the comprehensive evaluation index is selected as the final configuration. For example, in this embodiment, the optimal value of λ1 on the validation set is 10⁻¹⁵, which is approximately 0.0316, and the optimal value of λ2 is 10⁰.⁵, which is approximately 3.162.
[0018] The training strategy employs a progressively increasing approach for the first penalty coefficient λ1. Initially, λ1 is set to zero, allowing the LSTM network to prioritize learning the basic statistical patterns of the power data. Pre-training is performed using a basic quantile regression loss term until this loss value no longer decreases for five consecutive epochs on the validation set, at which point the basic distribution is considered convergent. Pre-training reaches stability after approximately 50 epochs, at which point the basic quantile regression loss term stabilizes at around 0.032. Subsequently, the first penalty coefficient is progressively increased using an exponential growth rate: each epoch multiplies the first penalty coefficient by a growth factor γ. In this embodiment, the initial value of the first penalty coefficient is set to 10⁻⁶, with a target value of 0.0316, expected to be reached after approximately 30 epochs. The growth factor is calculated as: 0.0316 / 10⁻⁶ = 31600, γ = 31600, taking the natural logarithm gives lnγ ≈ 0.3453, γ = e₀₀.3453 ≈ 1.412. Therefore, γ is set to 1.412. After 30 epochs, the first penalty coefficient increases to 10⁻⁶ × 1.412³⁰ = 10⁻⁶ × 31600 = 0.0316. The mathematical expression for the growth process is λ₁(t) = λ₁(t-1) × 1.412, and the upper limit is set to the optimal value obtained from the search, 0.0316. The incremental strategy avoids the network becoming overly conservative due to the application of full boundary constraints in the early stages of training. It allows the LSTM network to be adjusted in a controlled manner based on its existing predictive capabilities, and the final converged prediction function retains as rich a distribution as possible below the boundary.
[0019] The network training uses the Adam optimizer with an initial learning rate of 0.001 and a batch size of 32. The maximum number of iterations is 200 epochs, and an early stopping mechanism is implemented: training stops early when the total loss on the validation set no longer decreases for 10 consecutive epochs. During training, the total loss and the losses of each component are recorded. In the forward propagation phase, the calculation of both the first and second penalty terms relies on the positive operation, which is differentiable; its derivative is 1 when the independent variable is greater than 0 and 0 when it is less than or equal to 0. Therefore, the gradient can be correctly propagated back during backpropagation. For high-quantile output nodes, the gradient generated by the first penalty term when exceeding the upper limit points towards a decreasing output value, with a gradient magnitude of λ1×α; the gradient generated by the second penalty term when a crossover occurs points towards an increasing output value, with a gradient magnitude of λ2. For low-quantile output nodes, the first penalty term when exceeding the upper limit generates a gradient towards a decreasing output value, and the second penalty term when a crossover occurs also generates a gradient towards a decreasing output value. These gradients are propagated back through the network structure to the hidden and input layers of the LSTM network, driving the network weights to update in the direction that satisfies the constraints.
[0020] After training, the inference phase begins. Meteorological data for the time to be predicted and the real-time operating status features of the power grid at the current time are input into the trained LSTM network. First, the same normalization preprocessing as in the training phase is performed; in this embodiment, min-max normalization is used to linearly map each meteorological feature to the [0,1] interval. The normalization parameters are obtained statistically from the training set. The processed feature vector sequence, i.e., the window width of 24, is fed into the network input layer. The LSTM network performs forward propagation: after calculation by 64 units in the first layer of long short-term memory, a 64-dimensional hidden state sequence is output; this hidden state sequence is added element-wise to the input of the second layer and then fed into the second layer of 32 units to obtain a 32-dimensional hidden state; finally, after mapping through the fully connected output layer, two scalar values are obtained: the high quantile prediction value and the low quantile prediction value. The first penalty term during the training phase encodes the grid's capacity ceiling information into the network weights. Since this first penalty term encodes the mapping relationship between the grid capacity ceiling and input features (meteorological data and real-time grid operating status features) into the network weights, the LSTM network automatically generates predicted values that satisfy the grid capacity ceiling constraint at that moment during the inference phase, based on the current input meteorological data and real-time grid operating status features. For example, for a given moment in time where the input meteorological features show high irradiance and a cloud cover index close to 0, the LSTM network outputs a high quantile predicted value of 7.9 MW and a low quantile predicted value of 5.2 MW. The actual grid capacity ceiling at that moment is 8.2 MW, meaning the high quantile predicted value does not exceed the ceiling. Simultaneously, because the constraint effect of the second penalty term is embedded in the network weights, the output high quantile predicted value of 7.9 MW is always no lower than the low quantile predicted value of 5.2 MW, requiring no post-processing sorting or truncation. After receiving this prediction interval, dispatchers can directly use it as decision input to assess the potential output range of photovoltaic power generation and the grid's reserve capacity requirements.
[0021] Evaluation was conducted on a test set containing 1723 samples over an independent 10-day time span. The calculated actual coverage of the prediction interval was 89.2%, with a deviation of only 0.8% from the nominal confidence level of 90%. The average interval width was 2.3 MW, representing approximately 51% of the predicted power at a given point, which was approximately 4.5 MW. The out-of-bounds frequency was 1.2%, meaning that approximately 1.2% of the samples in the test set showed predicted values exceeding the grid's capacity limit. According to Table 1, if the same network were trained using a traditional quantile regression loss function, the actual coverage of the prediction interval on the test set would be 88.5%, but the out-of-bounds frequency would reach 12.6%, and approximately 3.2% of the time steps would show quantile crossovers. Therefore, this embodiment significantly eliminates physical infeasibility and quantile crossover problems while maintaining the reliability and sharpness of the prediction interval.
Claims
1. A method for short-term interval prediction of photovoltaic power generation based on LSTM networks, characterized in that, Includes the following steps: S1. Obtain historical power data, meteorological data, and real-time operating status characteristics of the power grid from photovoltaic power plants to construct a training sample set; Each sample in the training sample set includes: a meteorological data sequence within a preset time window, the real-time operating status characteristics of the power grid at the corresponding moment of the time window, and the actual power value; S2. Construct an LSTM network, wherein the output layer of the LSTM network is configured to output high quantile prediction values and low quantile prediction values; S3. The meteorological data sequence and real-time power grid operation status features in the training sample set are used as network inputs, and the LSTM network is trained using a loss function; wherein, the loss function includes a first penalty term and a second penalty term; The first penalty term is used to: increase the total loss based on the difference between the predicted value and the upper limit value when either the high quantile predicted value or the low quantile predicted value exceeds the upper limit of the grid acceptance capacity at the corresponding time. The second penalty term is used to increase the total loss based on the difference between the high quantile predicted value and the low quantile predicted value. S4. Input the meteorological data and real-time operating status characteristics of the power grid at the time to be predicted into the trained LSTM network, and output the short-term prediction range of photovoltaic power generation.
2. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, The first penalty term is calculated as follows: the high quantile predicted value is subtracted from the upper limit of the grid acceptance capacity to obtain the first high quantile difference value, and the low quantile predicted value is subtracted from the upper limit of the grid acceptance capacity to obtain the first low quantile difference value; a positive operation is applied to the first high quantile difference value and the first low quantile difference value respectively, retaining the part greater than zero, and setting the part less than or equal to zero to zero; The sum of the first high score difference after positive adjustment and the first low score difference after positive adjustment is used as the base value of the first penalty term.
3. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, The second penalty term is calculated as follows: the cross difference is obtained by subtracting the high quantile prediction value from the low quantile prediction value; a positive operation is applied to the cross difference value. When the high quantile prediction value is lower than the low quantile prediction value, the positive value of the cross difference value is retained as the effective cross amount. When the high quantile prediction value is not lower than the low quantile prediction value, the cross difference value is zero after being positively applied; the sum of the effective cross amounts at each time step is used as the base value of the second penalty term.
4. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 2, characterized in that, The first penalty item further includes multiplying the first high score difference value after positive calculation by a first weighting factor, multiplying the first low score difference value after positive calculation by a second weighting factor, and the first weighting factor being greater than the second weighting factor, and using the weighted sum of the two as the first penalty item.
5. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, The total loss function includes a basic quantile regression loss term: for high quantile predicted values, the quantile loss is calculated using the high quantile weighting coefficient; for low quantile predicted values, the quantile loss is calculated using the low quantile weighting coefficient. The quantile loss is calculated as follows: when the actual power value is greater than the predicted value, the difference between the actual power value and the predicted value is multiplied by the quantile weighting coefficient as the loss; when the predicted value is greater than the actual power value, the difference between the predicted value and the actual power value is multiplied by one minus the quantile weighting coefficient as the loss.
6. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 5, characterized in that, The total loss function also includes a weighted sum of the first penalty term and the second penalty term: the values of the first penalty coefficient and the second penalty coefficient are determined by the following steps: constructing a candidate coefficient grid, wherein the search range of the first penalty coefficient is a logarithmic uniform distribution interval from 10 to the power of -4 to 10 to the power of 0, the search range of the second penalty coefficient is a logarithmic uniform distribution interval from 10 to the power of -3 to 10 to the power of 1, and the upper limit of the first penalty coefficient is less than the upper limit of the second penalty coefficient; For each set of coefficients in the grid, a comprehensive evaluation index is calculated on the validation set. The comprehensive evaluation index is obtained by weighted summation of three sub-indicators: interval coverage deviation, interval average width, and boundary crossing frequency. The boundary crossing frequency refers to the proportion of time steps in which the predicted value exceeds the upper limit of the grid acceptance capacity to the total number of time steps. The set of coefficients that minimizes the comprehensive evaluation index is selected as the final configuration.
7. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 6, characterized in that, The first penalty coefficient also includes a training strategy: in the initial training phase, the first penalty coefficient is set to zero or a preset initial positive number. After the basic quantile regression loss term converges to a stable value, the first penalty coefficient is gradually increased to a preset target value at an exponential growth rate.
8. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, Step S4 specifically includes: inputting the meteorological data and real-time operating status characteristics of the power grid at the time to be predicted into the trained LSTM network, and directly outputting the high quantile prediction value and the low quantile prediction value after forward propagation calculation.
9. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, The hidden layer of the LSTM network adopts a two-layer structure. The first layer contains 64 LSTM units and the second layer contains 32 LSTM units. A residual connection is introduced between the first layer and the second layer. The hidden state vector output by the first hidden layer and the hidden state vector input by the second hidden layer are added element by element before entering the gating calculation of the second layer.
10. The method for short-term interval prediction of photovoltaic power generation based on LSTM network according to claim 1, characterized in that, The quantile corresponding to the high quantile prediction value is 95%, and the quantile corresponding to the low quantile prediction value is 5%, together forming a prediction interval with a nominal confidence level of 90%.
