A photovoltaic power generation power prediction method fusing and integrating network performance constraints

By constructing a Transformer model with a self-attention mechanism and a hybrid loss function that embeds physical constraints in photovoltaic power generation prediction, and combining it with the improved NSGA-II algorithm, the problem of the difficulty in integrating grid constraints in photovoltaic power generation prediction is solved. This achieves a unified improvement in high accuracy, safety and economy, and enhances the interpretability and adaptability of the model.

CN122136816APending Publication Date: 2026-06-02HUAIYIN INSTITUTE OF TECHNOLOGY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAIYIN INSTITUTE OF TECHNOLOGY
Filing Date
2026-02-27
Publication Date
2026-06-02

Smart Images

  • Figure CN122136816A_ABST
    Figure CN122136816A_ABST
Patent Text Reader

Abstract

This invention provides a photovoltaic power generation prediction method that integrates grid-connected performance constraints, comprising: Step 1, data acquisition and fusion preprocessing; Step 2, designing a PI-Transformer self-attention mechanism model with embedded physical characteristics; Step 3, constructing a hybrid loss function adapted to the PI-Transformer self-attention mechanism model with embedded physical characteristics; Step 4, multi-objective collaborative optimization, automatically searching for a multi-objective Pareto optimal solution set; Step 5, determining the optimal model parameters and loss function weights based on the Pareto optimal solution set, training to obtain the final prediction model; and outputting the photovoltaic power generation prediction result. This invention, through deep constraint embedding and multi-objective collaborative optimization, significantly improves the friendliness, accuracy, and decision adaptability of the prediction results to grid dispatch and safe operation, providing reliable technical support for high-proportion renewable energy grid connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of new energy power generation prediction technology, and in particular relates to a photovoltaic power generation prediction method that integrates grid connection performance constraints. Background Technology

[0002] Photovoltaic (PV) power generation has seen its share in the power system continuously increase due to its advantages such as renewable resources and wide distribution. However, PV output is significantly affected by meteorological factors, exhibiting intermittency, fluctuation, and randomness, posing severe challenges to the safe and stable operation of the power grid, dispatch optimization, and the absorption of new energy sources. PV power prediction has become a key technology for solving this problem. Existing prediction methods have evolved from traditional statistical and physical models to machine learning and deep learning-driven models, continuously improving prediction accuracy. However, core pain points remain: First, they ignore grid-connected performance constraints such as peak and valley periods and ramp rates, pursuing only numerical accuracy, resulting in insufficient practical value of the prediction results; second, the integration of physical constraints with the model architecture is not deep, making it difficult for the model to perceive the physical meaning of grid constraints; third, there is a lack of multi-objective collaborative optimization mechanisms, failing to balance prediction accuracy, constraint adaptability, and dispatch economy. Therefore, there is an urgent need to develop a PV power prediction method that deeply embeds grid-connected performance constraints into the model and can achieve multi-objective collaborative optimization, meeting the dual requirements of "high accuracy + high adaptability" for the power grid. Summary of the Invention

[0003] Purpose of the Invention: This invention aims to address the problems of existing photovoltaic (PV) forecasting technologies, such as the disconnect between physical constraints, difficulty in balancing accuracy and safety, insufficient modeling of time-period characteristics, poor model interpretability, and lack of multi-objective optimization. By constructing a Transformer model with embedded physical constraints and a self-attention mechanism, grid connection constraints (time period, ramp rate) are deeply encoded into attention, location encoding, and feedforward networks. A hybrid loss function incorporating peak, valley, and ramp-specific penalties is designed to achieve coordinated optimization of accuracy and safety. An improved second-generation non-dominated sorting genetic NSGA-II multi-objective algorithm is employed to collaboratively optimize model parameters and loss weights, obtaining Pareto optimal solution sets suitable for different scenarios. Ultimately, this improves forecasting accuracy, enhances grid safety, improves dispatching economy, and enhances model decision interpretability, providing reliable forecasting support for high-proportion renewable energy grids. Specifically, this invention provides a PV power generation forecasting method integrating grid connection performance constraints, comprising the following steps:

[0004] Step 1, Data Acquisition and Fusion Preprocessing: Collect historical power generation data from the photovoltaic side, meteorological data, and grid connection characteristic data from the power grid side. The grid connection characteristic data from the power grid side includes peak time labels, valley time labels, and power ramping constraint parameters. Perform fusion preprocessing on the collected multi-source data to obtain a time-series prediction sample set.

[0005] Step 2: Design a self-attention mechanism model PI-Transformer (PhysicalInformed-Transformer) with embedded physical characteristics to enable the model to perceive power grid constraints.

[0006] Step 3: Construct a hybrid loss function adapted to the PI-Transformer self-attention mechanism model embedded with physical characteristics. The hybrid loss function introduces specific penalty terms for peak deviation, trough deviation, and power ramp-up deviation.

[0007] Step 4, Multi-objective Co-optimization: The improved second-generation nondominated sorting genetic algorithm NSGA-II is adopted to optimize prediction accuracy, peak error, climbing error and scheduling economy. The parameters of the PI-Transformer self-attention mechanism model with physical characteristics embedded and the weights of the hybrid loss function are co-optimized to automatically search for the multi-objective Pareto optimal solution set.

[0008] Step 5, Photovoltaic power generation prediction: Determine the optimal model parameters and loss function weights based on the Pareto optimal solution set, and train the final prediction model; collect real-time multi-source data for the period to be predicted, input the preprocessed data into the final prediction model, and output the photovoltaic power generation prediction results.

[0009] Step 1 includes:

[0010] Step 1.1: Collect data;

[0011] The following three types of core data from photovoltaic power plants were collected simultaneously to form the original dataset. :

[0012] Power data from photovoltaic power plants: at fixed sampling intervals The active power sequence is denoted as: ; in, This is the active power sequence of a photovoltaic power plant; Indicates the first Each sampling time The active power output of the photovoltaic power plant; H indicates transpose;

[0013] Meteorological data: A sequence of meteorological elements strictly aligned with the power data timestamps constitutes a meteorological feature matrix, denoted as:

[0014] ,

[0015] in, A meteorological feature matrix that is strictly aligned with the timestamps of photovoltaic power data; The solar irradiance was collected synchronously. For ambient temperature, For wind speed, Relative humidity, Cloud cover;

[0016] Grid connection characteristic data: Parameters reflecting the grid's operating status and hard constraints, including:

[0017] Time period tags: Peak time period tags Valley period tags ;

[0018] Safety constraint parameters: Maximum power ramp rate ; Grid connection point voltage safety limit ;

[0019] Step 1.2: Fusion Preprocessing;

[0020] Transforming multi-source heterogeneous data into structured model input samples:

[0021] Data cleaning: Missing data is filled using linear interpolation. Let the valid data points before and after the missing location be... and ,use The criterion is to remove outlier data for any data point in the sequence. If the following conditions are met:

[0022] ,

[0023] These are identified as outliers and removed. and These are the sequence mean and standard deviation, respectively.

[0024] Data normalization: using Standardization unifies all features to Interval:

[0025] ,

[0026] in, The first element in the original data matrix The first feature Each sample value For the first A vector consisting of all sample values ​​of each feature. These are the normalized eigenvalues. Photovoltaic power at any given time is denoted as Normalized The meteorological characteristics at that time are ;

[0027] Physical feature engineering: Extracting derived features with explicit power grid physical meaning from normalized data:

[0028] Power ramp rate: The first-order difference of power between adjacent moments is used as the instantaneous ramp rate characteristic. :

[0029] ,

[0030] Instantaneous slope rate characteristics Normalization is performed again to obtain the instantaneous gradient characteristic. ;

[0031] Voltage margin: Calculate the measured voltage With safety limit The ratio of these values ​​serves as a characteristic of voltage safety margin. :

[0032] ,

[0033] Time period labels: Directly use the collected peak time period binary labels. Binary labels for valley periods ;

[0034] Sample construction: Training samples are generated using the sliding window method, and the length of the historical window is defined. and prediction window length For any condition satisfying Time Index , construct the first Input feature sequence of samples :Depend on arrive The fused feature vectors at each time step are stacked together.

[0035] ,

[0036] Wherein, the fused feature vector at time t for:

[0037] ,

[0038] in, R represents the total dimension of the fused features; R denotes the real number space.

[0039] Output label sequence Corresponding to the future Normalized photovoltaic power at each moment:

[0040] ,

[0041] By traversing the entire time series using a sliding window, a complete time series prediction sample set D is finally generated:

[0042] ,

[0043] in, The total number of samples.

[0044] Step 2 includes:

[0045] Step 2.1: Vectorized encoding and condition injection of physical constraints;

[0046] For each time step t, from the fused feature vector Extract physical constraint-related features and construct a physical constraint feature vector. :

[0047] ;

[0048] Step 2.2: Spatiotemporal location encoding of physical perception;

[0049] Based on each position in the input sequence Corresponding peak period binary labels Binary labels for valley periods Physical modulation is applied to the standard sinusoidal position code to generate a physically sensed position code (PE). The physical sensed position code PE is then... peacekeeping The formulas for calculating dimensions are as follows:

[0050] ,

[0051] in, For the first Dimensional positional encoding value, For the first Dimensional positional encoding value, and These represent the corresponding peak and valley constraint strengths, respectively. For the hidden layer dimension of the model, These are learnable parameters;

[0052] Step 2.3: The four-fold physical constraint perceptual attention mechanism includes the following steps:

[0053] Step 2.3.1: Basic Physics Attention;

[0054] Calculate the attention weights driven by the original data and introduce a physical constraint correlation matrix. As a bias: , in, The output of the physically constrained attention mechanism; These are the query, key, and value matrices, respectively. These are the weighting coefficients for physical constraints; For physical constraints Correlation matrix; is the dimension of the key vector; Softmax is the activation function;

[0055] Step 2.3.2: Peak-Sensitive Attention:

[0056] Through a peak gate mask Implement an attention head that is strongly correlated with the peak label:

[0057] ,

[0058] in, The peak mask matrix is ​​the first Line number Column elements; For the first Weighting coefficients for peak characteristics; For the first Peak feature encoding at each location; For the first Peak feature encoding at each location; It is the Sigmoid activation function. These are learnable weight parameters; This is the output for peak attention;

[0059] Step 2.3.3: Valley-Sensitive Attention:

[0060] Through an attention-gated mask based on valley period labels Implementing valley-sensitive attention using matrices:

[0061] ,

[0062] in, The first valley value mask matrix Line number Column elements; For learnable parameters, For trough-sensitive attention output;

[0063] Step 2.3.4: Climbing Consistency Attention:

[0064] Establish a Gaussian kernel weight matrix based on ramping constraints : ,

[0065] in, The first Gaussian kernel weight matrix for hill climbing constraints Line number Column elements; This indicates whether the power is increasing, remaining constant, or decreasing. For time steps arrive The direction of power change, The adaptive bandwidth parameter is related to the time step; exp represents the natural exponential function. To constrain the output of attention during hill climbing;

[0066] Step 2.3.5: Hierarchical Gated Fusion Layer:

[0067] Finally, a learnable gating vector is used. The outputs of the four attention methods are dynamically fused to form the final context representation of the hierarchical gating fusion layer:

[0068] ,

[0069] ,

[0070] in, Physical constraints on attention; For peak-sensitive attention; For those with high sensitivity to low values; To restrict attention while climbing; The weight matrix is ​​a learnable matrix. For the first Each gating weight, The value ranges from 1 to 4. This is the final attention representation after fusion;

[0071] Step 2.4: Feedforward network for physical differential equations;

[0072] The standard feedforward network (FFN) is transformed into a numerical simulator of a continuous-time dynamic system, and the hidden states of the model are set. It follows a differential equation modulated by physical constraints:

[0073] ,

[0074] in, It is a function parameterized by a neural network; d represents the differential symbol.

[0075] In the discrete time step, the differentiable fourth-order Runge-Kutta method is used to solve the problem and update the hidden state: , , , , ; in, The initial rate of the hidden state evolution; For the first The hidden state at each time step; For the first Physical constraint-related characteristics at each time step; For the first The timestamp of each time step; For half-time step slope correction; For the first Physical constraint-related characteristics of one and a half time steps; For time step; For the second half-time step slope correction; For full-time step slope estimation;

[0076] Step 2.5: Internal physical consistency check and correction;

[0077] A lightweight internal physical consistency check module is introduced after the PI-Transformer layer of the self-attention mechanism model embedded in each physical feature. This module calculates a regularized loss to measure the current hidden state. Does the evolution violate known constraints?

[0078] ,

[0079] in, For the first Internal physical consistency loss of the layer , For hyperparameters, It is a rectifier linear unit. For the first Layer in time step The hidden state vector, For reference power, This represents the partial derivative.

[0080] Step 3 includes:

[0081] Step 3.1: Design a hybrid multi-objective loss function;

[0082] A hierarchical hybrid loss function is designed, introducing the following three targeted physical penalty terms:

[0083] Peak deviation penalty :

[0084] ,

[0085] in, For the peak sample set; These are the weighting coefficients; For time steps The true value; For time steps The predicted value; The standard deviation of the true value;

[0086] trough deviation penalty :

[0087] ,

[0088] in, For the trough sample set;

[0089] Power ramp penalty : , in, , , These are the weighting coefficients for the three penalty sub-items; For the first First-order difference prediction values ​​at each time step; Maximum permissible climbing rate; For the first Second-order difference predictions for each time step; Maximum permissible climbing acceleration; This is a scale parameter for the climbing rate;

[0090] Final total loss function for:

[0091] ;

[0092] in, The weighting coefficients for the basic loss; The weighting coefficients for peak loss; The weighting coefficient for the valley loss; This represents the weighting coefficient of the hill-climbing penalty term; For the first Each inner layer's loss or constraint term;

[0093] Step 3.2: Differentiable physical constraint output layer;

[0094] At the end of the decoder, a differentiable constrained projection layer is designed, which projects the original output of the model. As input, through a gradient-based optimization operation, Mapping to the feasible region that satisfies all hard physical constraints yields the final output. .

[0095] Step 4 includes:

[0096] Step 4.1: Optimize problem modeling;

[0097] Define decision variable vector ,in, For the model's optimizable parameters, Let the weight coefficient vector be the loss function. The optimization objective is to minimize the following four functions:

[0098] Overall prediction accuracy ;

[0099] in, This is the root mean square error;

[0100] Peak period prediction error ;

[0101] in, This represents the prediction error during the peak period.

[0102] Power ramp violation ;

[0103] in, The degree of violation of power ramping regulations;

[0104] Dispatch economic costs ;

[0105] in, To manage economic costs;

[0106] Step 4.2: Execute the improved second-generation non-dominated sorting genetic NSGA-II algorithm, including:

[0107] Step 4.2.1, Initialization: Set the population size Parameters such as maximum number of iterations Latin hypercube sampling is used to generate an initial population that satisfies the variable constraints. ;

[0108] Step 4.2.2, Fitness Assessment: For each individual The model is trained using parameter configuration and four function values ​​are calculated.

[0109] Step 4.2.3, Non-dominated sorting and crowding calculation: Perform fast non-dominated sorting on the population and divide it into multiple frontier levels. , ,…, ;in, Assuming the first frontier level (Pareto optimal frontier); calculate the improved congestion distance:

[0110] ;

[0111] in, For individuals Crowded distance; In the first A target function, and an individual The objective function value of adjacent individuals with larger objective values; In the first On each objective function, and with the individual The objective function values ​​of adjacent individuals with smaller objective values; For the first The maximum objective value of each objective function within the current frontier level; For the first The minimum objective value of each objective function within the current frontier level; For diversity reward coefficient; For individuals Diverse rewards;

[0112] Step 4.2.4, Selection, Crossover and Mutation: Select parent individuals based on tournament selection, perform simulated binary crossover and polynomial mutation operations to generate offspring population;

[0113] Step 4.2.5, Environmental Selection: Merge parent and offspring populations, and select based on non-dominance level and crowding distance. A new generation of population is formed by elite individuals;

[0114] Step 4.2.6, Iteration and Termination: Repeat steps 4.2.2 to 4.2.5 until the maximum number of iterations is reached. Alternatively, if the convergence criterion is met, the final population can be output.

[0115] Step 4.3: Obtain the Pareto optimal solution set;

[0116] Extract all non-dominated solutions from the final population to form the Pareto optimal solution set. .

[0117] Step 5 includes:

[0118] Step 5.1: Select the optimal configuration;

[0119] The final configuration scheme is selected from the Pareto optimal solution set based on the actual operational needs of the power grid.

[0120] Peak-hour prediction reliability priority strategy: Selecting The smallest solution;

[0121] Climbing safety constraint priority strategy: Select the strategy that prioritizes safety constraints The smallest solution;

[0122] Economic priority strategy: Choose to make The smallest solution;

[0123] Comprehensive balancing strategy: Select the solution with the minimum distance to the ideal point.

[0124] ;

[0125] in, These are the optimal decision variables; For the first One objective function value; For the first The ideal value for each target;

[0126] Step 5.2: Train the final model;

[0127] Step 5.3: Real-time predictive execution.

[0128] Step 5.2 includes: using the selected optimal configuration ,in, These are the optimal trainable parameters; The optimal weight coefficient vector is obtained; the PI-Transformer self-attention mechanism model with physical property embedding is retrained to obtain the final prediction model. .

[0129] Step 5.3 includes:

[0130] Real-time multi-source data for the period to be predicted are collected, including photovoltaic power, meteorological data, and grid connection characteristic data. The same fusion preprocessing is performed as in step 1.2 to obtain the input feature sequence. ;Will Input the final prediction model Output the future Photovoltaic power generation forecast at a given time The predicted values ​​are inversely normalized to obtain the actual power values. This is output as the prediction result of photovoltaic power generation.

[0131] The present invention also provides an electronic device, including a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method.

[0132] The present invention also provides a storage medium storing a computer program or instructions that, when the computer program or instructions are run on a computer, execute the steps of the method described.

[0133] Beneficial effects: This invention addresses the core challenge of effectively integrating grid security constraints (ramp rate, peak-valley time) with data-driven models in photovoltaic power prediction. Through deep embedding of physical constraints and multi-objective collaborative optimization, it achieves a unified improvement in prediction accuracy, grid security, and dispatch economy. Specific effects are as follows:

[0134] This invention innovatively designs a Transformer architecture with embedded physical characteristics. Through physical constraint vectorization encoding, physical-aware location encoding, a four-fold physical constraint-aware attention mechanism (base, peak, valley, and ramp consistency), and a physical differential equation feedforward network, it deeply encodes and modulates the entire process of the power grid's rigid operating rules (such as power ramp rate limits and peak-valley time period labels) from data input and feature interaction to state evolution. This completely solves the fundamental defect of traditional pure data-driven models where "prediction results may violate the safe operation rules of the power grid." It makes the model's "thinking" process isomorphic to the physical laws of the power grid, ensuring that the generated power prediction curve inherently meets key safety constraints such as ramp smoothness and time period matching, significantly reducing the scheduling risk caused by inappropriate predictions from the source.

[0135] This invention constructs a two-layer optimization framework of "hybrid loss function design + improved multi-objective optimization algorithm". At the model training level, a specific physical penalty term is designed, including peak bias (exponential penalty), trough bias (asymmetric penalty), and power ramp bias (first / second-order joint constraint), which works in conjunction with the internal consistency check loss to guide the model to learn both data patterns and physical rules simultaneously. At the system configuration level, an improved NSGA-II algorithm is adopted, with overall accuracy, peak error, ramp violation degree, and economic cost as optimization objectives. It automatically and collaboratively optimizes model hyperparameters and loss weights to generate a Pareto optimal solution set covering different scenario requirements. This mechanism allows the system to flexibly select the optimal configuration according to actual operational needs (such as prioritizing peak supply, prioritizing trough consumption, or prioritizing economy), achieving a scientific trade-off and global optimum among multiple objectives, significantly improving the overall utility and scenario adaptability of the prediction system.

[0136] This invention significantly enhances the interpretability of the model through explicit encoding of physical constraints, visual interpretation of attention weights, and a design that allows for traceability of contributions. The weight distribution of physical-aware attention mechanisms (such as peak / valley sensitive attention) directly reflects the model's reference to historical patterns across different time periods, while the internal consistency check loss monitors whether hidden states conform to physical evolutionary laws. This gives the model's predictive decisions clear physical meaning, enabling dispatchers to understand "why the model made this prediction," thereby significantly increasing their trust in and willingness to adopt AI predictions and promoting the practical application of intelligent prediction tools in critical power dispatching operations.

[0137] This invention significantly improves computational efficiency while ensuring model performance through adaptive feature selection in a hierarchical gated fusion layer, adaptive step-size solving of the physical differential equation network, and collaborative optimization of features and parameters. The gating mechanism dynamically ignores redundant information and focuses on key features; adaptive numerical solving avoids computational waste associated with fixed step sizes. These optimizations increase model training convergence speed by approximately 15% and reduce single inference time by approximately 20%, fully meeting the real-time requirements of power systems for day-ahead and ultra-short-term power forecasting. This provides efficient and stable technical support for online continuous forecasting and rapid rolling optimization under complex operating conditions. Attached Figure Description

[0138] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention in the above and / or other aspects will become clearer.

[0139] Figure 1 The overall system flowchart of the photovoltaic power generation prediction method with integrated grid-connected performance constraints provided by the present invention is shown.

[0140] Figure 2 This is the core architecture diagram of the Transformer (PI-Transformer) model, which embeds physical characteristics in this invention.

[0141] Figure 3 This is a schematic diagram illustrating the principle of the hybrid multi-objective loss function and the improved NSGA-II multi-objective collaborative optimization in this invention. Detailed Implementation

[0142] This invention provides a photovoltaic power generation prediction method that incorporates grid-connection performance constraints, such as... Figure 1 , Figure 2 and Figure 3 As shown, it includes:

[0143] Step 1, Data Acquisition and Fusion Preprocessing: Collect historical power generation data from the photovoltaic side, meteorological data, and grid connection characteristic data from the power grid side. The grid connection characteristic data from the power grid side includes peak time labels, valley time labels, and power ramping constraint parameters. Perform fusion preprocessing on the collected multi-source data to obtain a time-series prediction sample set.

[0144] Step 2: Design a PI-Transformer (Physical-InformedTransformer) model with embedded physical characteristics to enable the model to sense power grid constraints.

[0145] Step 3: Construct a hybrid loss function that is adapted to the model. The hybrid loss function introduces specific penalty terms for peak deviation, trough deviation, and power ramp-up deviation.

[0146] Step 4, Multi-objective Co-optimization: The improved second-generation non-dominated sorting genetic algorithm NSGA-II (Non-dominated Sorting Genetic Algorithm II) is adopted to optimize the parameters of the PI-Transformer model with self-attention mechanism embedded in the physical characteristics and the weights of the hybrid loss function. The multi-objective Pareto optimal solution set is automatically searched to obtain the optimization objectives of prediction accuracy, peak error, climbing error and scheduling economy.

[0147] Step 5, Photovoltaic power generation prediction: Based on the Pareto optimal solution set, determine the optimal model parameters and loss function weights, and train to obtain the final prediction model; collect real-time multi-source data for the period to be predicted, input the preprocessed data into the final prediction model, and output the photovoltaic power generation prediction results.

[0148] Step 1 includes:

[0149] Step 1.1: Collect data;

[0150] The following three types of core data from photovoltaic power plants were collected simultaneously to form the original dataset. :

[0151] Power data from photovoltaic power plants: at fixed sampling intervals The active power sequence is denoted as: ; in, This represents the total number of sampling points.

[0152] Meteorological data: A sequence of meteorological elements strictly aligned with the power data timestamps constitutes a meteorological feature matrix, denoted as: , in, The solar irradiance was collected synchronously. For ambient temperature, For wind speed, Relative humidity, Cloud cover; Grid connection characteristic data: Parameters reflecting the grid's operating status and hard constraints, including:

[0153] Time period tags: Peak time period tags Valley period tags .

[0154] Safety constraint parameters: Maximum power ramp rate ; Grid connection point voltage safety limit .

[0155] Step 1.2: Fusion Preprocessing;

[0156] Transforming multi-source heterogeneous data into structured model input samples:

[0157] (1) Data cleaning: Linear interpolation is used to fill missing data. Let the effective data points before and after the missing position be . and ,use The criterion is to remove outlier data for any data point in the sequence. If the following conditions are met:

[0158] ,

[0159] These are identified as outliers and removed. and These are the sequence mean and standard deviation, respectively.

[0160] (2) Data normalization: adopts Standardization unifies all features to Interval: ,

[0161] in, The first element in the original data matrix The first feature Each sample value For the first A vector consisting of all sample values ​​of each feature. The normalized eigenvalues ​​are denoted as and the normalized photovoltaic power is denoted as . The normalized meteorological characteristics are ;

[0162] (3) Physical feature engineering: Extracting derived features with clear power grid physical meaning from normalized data:

[0163] Power ramp rate: The first-order difference of power between adjacent moments is used as the instantaneous ramp rate characteristic. :

[0164] ,

[0165] The instantaneous slope rate feature is then obtained by normalizing it again. .

[0166] Voltage margin: Calculate the measured voltage Its safety limit The ratio of these values ​​serves as a characteristic of voltage safety margin:

[0167] ,

[0168] in, This is the measured voltage value.

[0169] Time period labels: Directly use the collected peak and trough time period binary labels. and .

[0170] (4) Sample Construction: Training samples are generated using the sliding window method. Define the historical window length. and prediction window length For any condition satisfying Time Index , construct the first Input feature sequence of samples :Depend on arrive The fused feature vectors at each time step are stacked together.

[0171] ,

[0172] Among them, the fused feature vector at each time step for:

[0173] ,

[0174] in The total dimension of the fused features.

[0175] Output label sequence Corresponding to the future Normalized photovoltaic power at each moment: ,

[0176] By iterating through the entire time series using a sliding window (with a step size of 1), a complete time series prediction sample set is finally generated.

[0177] ,

[0178] in, This represents the total number of samples. This sample set provides structured, high-quality input for the Transformer model with a self-attention mechanism that embeds physical properties.

[0179] Step 2 includes:

[0180] Step 2.1: Vectorized encoding and condition injection of physical constraints;

[0181] For each time step t, from the fused feature vector Extract physical constraint-related features and construct a physical constraint feature vector. : ,

[0182] in, This represents the normalized instantaneous characteristic ramp rate. Physical constraint feature vector. This will serve as a "physical condition" throughout the model. This constraint vector... As a modulated signal, it deeply intervenes in the attention allocation, state evolution, and final output generation within the model.

[0183] Step 2.2: Spatiotemporal location encoding of physical perception;

[0184] Based on each position in the input sequence Corresponding peak period binary labels Binary labels for valley periods The standard sinusoidal position code is physically modulated to generate a physically-modulated position code (PE), enabling the PI-Transformer model with a self-attention mechanism that embeds physical characteristics to perceive the "physical meaning" of time during the encoding stage. peacekeeping The formulas for calculating dimensions are as follows: ,

[0185] in, For the first Dimensional positional encoding value, For the first Dimensional positional encoding value, and It represents the peak and valley constraint strength corresponding to that location. For the hidden layer dimension of the model, These are learnable parameters that control the modulation intensity of different frequency components by physical constraints.

[0186] Step 2.3: The four-fold physical constraint perceptual attention mechanism includes the following steps:

[0187] Step 2.3.1: Basic Physics Attention;

[0188] As a baseline, attention weights driven by the original data are calculated, and a physical constraint correlation matrix is ​​introduced. As a bias: , in, These are the query, key, and value matrices, respectively. These are the weighting coefficients for physical constraints; The dimension of the key vector; Quantified time steps and The degree of correlation between them at the level of physical constraints.

[0189] Step 2.3.2: Peak-Sensitive Attention:

[0190] Design an attention head that is strongly correlated with peak labels to specifically enhance information extraction and interaction during peak periods. This can be achieved using a peak-gating mask. accomplish: ,

[0191] in, It is the Sigmoid activation function. As learnable weight parameters, this mechanism ensures that when predicting peak output, the PI-Transformer model with its self-attention mechanism embedded in physical characteristics will preferentially refer to patterns from other historical peak periods.

[0192] Step 2.3.3: Valley-sensitive attention;

[0193] The valley-sensitive attention mechanism uses an attention head strongly correlated with valley period labels to guide the PI-Transformer model, a self-attention mechanism embedded with physical characteristics, to prioritize referencing patterns from other historical valley periods when predicting power output during valley periods, while avoiding interference from peak period patterns. This optimizes prediction accuracy during valley periods and supports grid decisions on renewable energy consumption and dispatch during these times. An attention gating mask based on valley period labels is defined. Matrix implementation: ,

[0194] in, As a learnable parameter, it controls the modulation intensity of the mask based on the valley period characteristics. This is for outputting attention that is sensitive to trough values.

[0195] Step 2.3.4: Climbing Consistency Attention:

[0196] To ensure the predicted power curve is smooth and meets the ramp rate limit, this attention mechanism penalizes those factors that might lead to... The remote dependency relationship with drastic changes in output. Its core is a Gaussian kernel weight matrix based on ramp constraints: ,

[0197] in, This indicates whether the power is increasing, remaining constant, or decreasing. For time steps arrive The direction of power change, The bandwidth parameter is adaptive and depends on the time step. This design encourages the PI-Transformer model, which uses a self-attention mechanism embedded in physical properties, to learn a power sequence pattern that changes gradually within the allowed ramp rate.

[0198] Step 2.3.5: Hierarchical Gated Fusion Layer:

[0199] Finally, the outputs of the four attention methods are dynamically fused using a learnable gating vector to form the final context representation of this layer:

[0200] ,

[0201] ,

[0202] in, The weight matrix is ​​a learnable matrix. For gating weights, This represents the final attention representation after fusion.

[0203] Step 2.4: Feedforward network for physical differential equations;

[0204] The standard feed-forward network (FFN) is transformed into a numerical simulator of a continuous-time dynamic system. The hidden states of the model are assumed to be... It follows a differential equation modulated by physical constraints:

[0205] ,

[0206] in, It is a function parameterized by a neural network.

[0207] In discrete time steps, this equation is solved using the differentiable fourth-order Runge-Kutta method (RK4) to update the hidden state:

[0208] ,

[0209] ,

[0210] ,

[0211] ,

[0212] ,

[0213] This ensures that the forward propagation of each layer of the model simulates the evolution of a physical system, and forces the trajectory of the hidden state to conform to basic dynamic laws.

[0214] Step 2.5: Internal physical consistency check and correction;

[0215] To prevent the hidden states of intermediate layers from deviating from physical reality, a lightweight internal physical consistency check module is introduced after each PI-Transformer layer of the self-attention mechanism. This module computes a regularized loss that measures the current hidden state. Does the evolution violate known constraints?

[0216] ,

[0217] in, For the first Internal physical consistency loss of the layer , For hyperparameters, the weights of the two losses are balanced. It is a rectifier linear unit. For the first Layer in time step The hidden state vector, Using this loss as a reference power, it participates in backpropagation during training, "fine-tuning" the model's internal representation in real time. During inference, a tiny correction vector can be generated based on this loss to make on-the-fly corrections to the hidden states.

[0218] Step 3 includes:

[0219] Step 3.1: Design a hybrid multi-objective loss function;

[0220] To guide the model in learning the aforementioned complex physical constraints, a hierarchical hybrid loss function was designed. In addition to the basic accuracy loss such as mean squared error (MSE), three targeted physical penalty terms were specifically introduced:

[0221] Peak deviation penalty: With extremely low tolerance for prediction errors during peak electricity consumption periods, an exponentially increasing penalty is used to ensure absolutely reliable peak predictions.

[0222] ,

[0223] Valley bias penalty term: Focuses on penalizing situations where predicted values ​​are artificially high compared to actual values ​​(which may lead to unnecessary light curtailment or insufficient reserves), and uses an asymmetric penalty function:

[0224] ,

[0225] Power ramp penalty term: Fully constrains the first-order rate of change (ramp) and second-order rate of change (acceleration) of the predicted power curve, and uses a shape matching term to ensure the accuracy of the change trend:

[0226] ,

[0227] The final total loss function is the weighted sum of the above terms and the internal consistency loss:

[0228] ;

[0229] Step 3.1: Differentiable physical constraint output layer;

[0230] At the end of the decoder, a differentiable constrained projection layer is designed. This layer converts the original output of the model... As input, it is mapped to a feasible region that satisfies all hard physical constraints (such as upper and lower limits, maximum ramp rate) through a gradient-based optimization operation, yielding the final output. Since the entire process is differentiable, the gradient can be successfully backpropagated, enabling end-to-end "prediction-feasibility" joint training.

[0231] Step 4 includes:

[0232] Step 4.1: Optimize problem modeling;

[0233] Define decision variable vector ,in, These are the parameters that can be optimized for the model (such as the number of layers, hidden dimensions, number of attention heads, etc.). Let be the weight coefficient vector of the loss function. The optimization objective is to minimize the following four functions:

[0234] Overall prediction accuracy ;

[0235] Peak period prediction error ;

[0236] Power ramp violation ;

[0237] Dispatch economic costs ;

[0238] Step 4.2: Execute the improved second-generation non-dominated sorting genetic NSGA-II algorithm, including:

[0239] Step 4.2.1, Initialization: Set the population size Parameters such as maximum number of iterations Latin hypercube sampling is used to generate an initial population that satisfies the variable constraints. ;

[0240] Step 4.2.2, Fitness Assessment: For each individual The model is trained using its parameters and four objective function values ​​are computed.

[0241] Step 4.2.3, Non-dominated sorting and crowding calculation: Perform fast non-dominated sorting on the population and divide it into multiple frontier levels. , ,… ;in, It is the first level of frontier (Pareto optimal frontier); It is the second frontier level; ,… This is for subsequent frontier levels. To maintain population diversity, the improved crowding distance is calculated:

[0242] ;

[0243] Step 4.2.4, Selection, Crossover and Mutation: Select parent individuals based on tournament selection, perform simulated binary crossover (SBX) and polynomial mutation operations to generate offspring population.

[0244] Step 4.2.5, Environmental Selection: Merge parent and offspring populations, and select based on non-dominance level and crowding distance. Elite individuals form a new generation of population.

[0245] Step 4.2.6, Iteration and Termination: Repeat steps 4.2.2 to 4.2.5 until the maximum number of iterations is reached. Alternatively, if the convergence criterion is met, the final population can be output.

[0246] Step 4.3: Obtain the Pareto optimal solution set;

[0247] Extract all non-dominated solutions from the final population to form the Pareto optimal solution set. The solution set contains the optimal model parameters and loss weight configurations that achieve different trade-offs among the four optimization objectives.

[0248] Step 5 includes: Step 5.1: Select the optimal configuration;

[0249] The final configuration scheme is selected from the Pareto optimal solution set based on the actual operational needs of the power grid.

[0250] Peak-hour prediction reliability priority strategy: Selecting The smallest solution;

[0251] Climbing safety constraint priority strategy: Select the strategy that prioritizes safety constraints The smallest solution;

[0252] Economic priority strategy: Choose to make The smallest solution;

[0253] Comprehensive balancing strategy: Select the solution with the minimum distance to the ideal point.

[0254] ;

[0255] Step 5.2: Train the final model;

[0256] Use the selected optimal configuration The PI-Transformer model with a self-attention mechanism embedded in physical properties is retrained to obtain the final prediction model. ;

[0257] Step 5.3: Real-time predictive execution;

[0258] Real-time multi-source data for the period to be predicted are collected, including photovoltaic power, meteorological data, and grid connection characteristic data. The same fusion preprocessing is performed as in step 1.2 to obtain the input feature sequence. ;Will Input the final prediction model Output the future Photovoltaic power generation forecast at a given time The predicted values ​​are inversely normalized to obtain the actual power values. This is output as the prediction result of photovoltaic power generation.

[0259] Previous photovoltaic (PV) power prediction methods mostly adopted the conventional approach of "pure data-driven + single loss function," such as ARIMA time series models, pure EMD+SVM combination methods, ordinary LSTM, and conventional Transformer (single MSE loss). The proposed method in this invention, "physical characteristic embedded Transformer (PI-Transformer) + hybrid multi-objective loss function + improved NSGA-II collaborative optimization," explores PV power prediction from three new technical levels: model architecture, constraint fusion, and multi-objective optimization, opening up a superior "grid-friendly" prediction model. Comparative data from these four methods shows that this method achieves significant improvements in prediction accuracy, grid connection constraint adaptability, generalization ability, result stability, and dispatch economy. Simulation data shows a significant difference in performance among different methods in terms of peak prediction accuracy: the peak prediction accuracy (MAPE) of pure EMD+SVM is 83.5%, the ARIMA time series model is 85.2%, the ordinary LSTM reaches 92.3%, the conventional Transformer is 93.8%, while the method of this invention achieves a peak prediction accuracy of 99.05%, an improvement of 6.75 percentage points compared to the ordinary LSTM, far exceeding conventional methods in core prediction accuracy. Regarding mean prediction accuracy (RMSE), pure EMD+SVM is 6.8MW, the ARIMA time series model is 6.2MW, the ordinary LSTM is 4.5MW, the conventional Transformer is 3.2MW, while the method of this invention is only 0.85MW. This means that the method performs better overall in long-term predictions, with a significant reduction in numerical error. Grid-connection constraint adaptability is a key indicator for measuring the practical value of prediction. The pure EMD+SVM has a ramp constraint satisfaction rate of 62.5% and a voltage fluctuation compliance rate of 73.2%, the ARIMA time series model has a ramp constraint satisfaction rate of 65.8% and a voltage fluctuation compliance rate of 75.1%, the ordinary LSTM has a ramp constraint satisfaction rate of 68.2% and a voltage fluctuation compliance rate of 78.3%, and the conventional Transformer has a ramp constraint satisfaction rate of 75.3% and a voltage fluctuation compliance rate of 82.5%. However, the method of this invention has a ramp constraint satisfaction rate as high as 98.7% and a voltage fluctuation compliance rate of 99.2%, indicating that its prediction results can deeply adapt to the grid operation rules and its practical value is significantly better than that of traditional methods. In terms of generalization ability under extreme weather conditions, the MAPE of pure EMD+SVM is 12.8%, that of ARIMA time series model is 11.5%, that of ordinary LSTM is 8.5%, that of conventional Transformer is 6.8%, while that of the method of this invention is only 2.3%. This shows that the method of this invention is more adaptable to complex conditions such as rainstorms and extreme temperature differences that were not trained, and has more outstanding robustness.The standard deviation reflects the volatility of the prediction results. The standard deviation is 4.2 for pure EMD+SVM, 3.8 for the ARIMA time series model, 2.9 for ordinary LSTM, and 2.5 for the conventional Transformer. The standard deviation of the method in this invention is only 1.0, far lower than other methods, indicating that its prediction results are more stable and can maintain consistently high performance under different scenarios. In terms of scheduling economics, the annual cost of grid reserve capacity corresponding to pure EMD+SVM is 2.48 million yuan, ARIMA time series model is 2.32 million yuan, ordinary LSTM is 2.15 million yuan, and conventional Transformer is 1.86 million yuan, while the method in this invention costs only 920,000 yuan, saving 57.2% compared to ordinary LSTM, while reducing curtailed solar power by 1.2 GWh, significantly improving economic value.

[0260] This embodiment is applied to a 100MW centralized photovoltaic power plant, and the specific implementation is as follows:

[0261] I. Site Layout Design

[0262] Taking into account the multi-source data acquisition requirements of this invention (photovoltaic side, meteorological side, and grid side), a detailed deployment design was developed to achieve comprehensive acquisition of grid-connected constraint characteristics and prediction-related data:

[0263] 1. Photovoltaic Power Generation Data Acquisition: Collect time-series active power data from grid-connected points or representative photovoltaic strings / arrays of photovoltaic power plants. It is recommended that the sampling interval be no less than 15 minutes to capture typical patterns of photovoltaic power output variation. The data should include typical scenarios such as normal power generation and sudden weather changes.

[0264] 2. Meteorological and Environmental Data Acquisition: Simultaneously collect meteorological observation data for the power plant area. Core parameters should include at least total solar irradiance and ambient temperature. Supplementing with optional parameters such as wind speed and relative humidity is encouraged. The timestamps of the meteorological data should be strictly aligned with the power data, and the sampling interval should ideally be consistent with or synchronized with the power data.

[0265] 3. Grid Connection Characteristics Data Acquisition: Obtain grid-side constraint data corresponding to the prediction period from the grid dispatching system, simulation platform, or based on publicly available grid operation rules. Core data should include: peak-valley time period labels dividing peak and off-peak electricity consumption periods, and the upper limit of the grid's allowed power ramp-up rate. These data serve as key inputs for the model to perceive the grid's operational boundaries.

[0266] II. System Deployment and Operation Process

[0267] (a) Hardware deployment

[0268] 1. Computing Unit: Deploy computing devices (such as workstations or servers) with sufficient computing power to run the PI-Transformer model training, multi-objective optimization algorithms, and real-time inference tasks. This unit should support mainstream deep learning frameworks and meet the computational performance requirements for model iterative development.

[0269] 2. Data Transfer Support: It possesses the capability to reliably aggregate multi-source data (photovoltaic power, meteorological data, grid constraint parameters) to the computing unit. The key is ensuring that data from different sources can be aligned and fused based on a unified time reference to meet the requirements for constructing high-quality time-series sample sets.

[0270] 3. Storage and Output Interface: Configure a storage system with sufficient historical data storage capacity for model training, and provide a standard data interface to output the final power prediction results and related constraint satisfaction analysis reports, supporting subsequent analysis and applications.

[0271] (ii) Software Deployment

[0272] 1. Data preprocessing algorithm deployment: Data cleaning, normalization and feature engineering algorithms are embedded in the edge computing nodes, with the following parameter configurations: missing data are filled using linear interpolation, and outliers are removed using the 3σ criterion (mean μ, standard deviation σ); the data is standardized to the [-1,1] interval using Z-score standardization; the sliding window parameters are set to historical window length T=24 (6 hours), prediction window length S=4 (1 hour), and step size is 1, automatically generating a time series prediction sample set.

[0273] 2. Core Model Deployment: Load the Transformer (PI-Transformer) model with embedded physical characteristics and initialize the following parameters: hidden layer dimension d_model=512, encoder 6 layers, each layer contains 4 attention heads (basic physical attention, peak-sensitive attention, valley-sensitive attention, ramp consistency attention); physical perception position encoding learnable parameter λ=0.1, physical regularization penalty coefficient λ=0.05; deploy a differentiable physical constraint output layer at the decoder end, with a preset power ramp rate upper limit of 10MW / 15min and voltage safety limit of 198-242kV.

[0274] 3. Loss Function and Optimization Algorithm Deployment: Configure a hybrid multi-objective loss function with initial weight coefficients α=0.4 (prediction error term), β=0.25 (peak deviation penalty term), γ=0.2 (trough deviation penalty term), and δ=0.15 (climbing deviation penalty term); deploy the improved NSGA-II multi-objective optimization algorithm with parameters set as population size=100, maximum number of iterations=200, crossover probability=0.8, mutation probability=0.1, and optimization objectives being prediction accuracy (RMSE), peak error (MAPE), climbing violation degree, and scheduling economic cost.

[0275] 4. Online configuration update: Enables an adaptive update mechanism every 8 hours, incrementally updating model parameters and loss function weights based on the latest collected data, without requiring downtime for retraining, ensuring the model adapts to changes in operating conditions.

[0276] (III) Operation and Forecasting Process

[0277] 1. Data acquisition stage: Photovoltaic modules, meteorological sensors, and grid interfaces simultaneously collect multi-source data. After millisecond-level timestamp alignment, the data is transmitted to edge computing nodes through dual links to form a raw dataset (containing four types of data: power, meteorology, grid constraints, and physical characteristics).

[0278] 2. Data preprocessing stage: Edge computing nodes automatically perform data cleaning, normalization and feature engineering, extract derived features such as power ramp-up rate, voltage margin, peak and valley time labels, and construct input feature sequence (dimension 24×10) and output label sequence (dimension 4×1) through sliding window method.

[0279] 3. Model inference and optimization: The PI-Transformer model learns data patterns and power grid physical constraints through physical perception location encoding, a four-fold attention mechanism, and a feedforward network of physical differential equations. The improved NSGA-II algorithm performs collaborative optimization of model parameters (hidden layer dimension, number of attention heads) and loss function weights to generate a Pareto optimal solution set. Based on the power grid's "peak supply priority" strategy, the optimal configuration (the solution with the minimum peak error) is selected.

[0280] 4. Prediction and Output: The model outputs the photovoltaic power generation forecast for the next hour (four 15-minute intervals), which is then transmitted to the grid dispatch system after inverse normalization. Simultaneously, a grid connection performance evaluation report is output, including indicators such as ramp constraint satisfaction rate and voltage fluctuation compliance rate. If the predicted value has a risk of exceeding the limit, an early warning is automatically triggered and an adjustment plan is recommended.

[0281] 5. Verification and Iteration: During operation, the predicted values ​​and actual power values ​​are compared in real time to calculate the prediction error. The model parameters are optimized every 8 hours through an online update mechanism to ensure the prediction accuracy (MAPE≤2.3%) and grid connection adaptability (ramp constraint satisfaction rate≥98%) under extreme weather (rainstorms, high temperatures) and sudden changes in grid constraints.

[0282] The photovoltaic power generation prediction method and system proposed in this invention, which integrates grid-connected performance constraints, achieves a unified improvement in prediction accuracy, grid security, and dispatch economy through refined site selection and standardized deployment. Parts not described in detail in this embodiment can be replaced by existing mature technologies without affecting the technical effects of this invention. Adjustments or modifications to site selection, model parameters, deployment schemes, etc., without departing from the principles of this invention, are all within the scope of protection of this invention.

[0283] This invention provides a photovoltaic power generation prediction method that integrates grid-connected performance constraints. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A photovoltaic power generation prediction method incorporating grid-connected performance constraints, characterized in that, Includes the following steps: Step 1, Data Acquisition and Fusion Preprocessing: Collect historical power generation data from the photovoltaic side, meteorological data, and grid connection characteristic data from the power grid side. The grid connection characteristic data from the power grid side includes peak time labels, valley time labels, and power ramping constraint parameters. Perform fusion preprocessing on the collected multi-source data to obtain a time-series prediction sample set. Step 2: Design a self-attention mechanism model PI-Transformer that embeds physical properties; Step 3: Construct a hybrid loss function adapted to the PI-Transformer self-attention mechanism model embedded with physical characteristics. The hybrid loss function introduces specific penalty terms for peak deviation, trough deviation, and power ramp-up deviation. Step 4, Multi-objective collaborative optimization: The improved second-generation non-dominated sorting genetic NSGA-II multi-objective optimization algorithm is adopted. With prediction accuracy, peak error, climbing error and scheduling economy as optimization objectives, the parameters of the PI-Transformer self-attention mechanism model with embedded physical characteristics and the weights of the hybrid loss function are collaboratively optimized, and the multi-objective Pareto optimal solution set is automatically searched. Step 5, Photovoltaic power generation prediction: Determine the optimal model parameters and loss function weights based on the Pareto optimal solution set, and train the final prediction model; collect real-time multi-source data for the period to be predicted, input the preprocessed data into the final prediction model, and output the photovoltaic power generation prediction results.

2. The method according to claim 1, characterized in that, Step 1 includes: Step 1.1: Collect data; The following three types of core data from photovoltaic power plants were collected simultaneously to form the original dataset. : Power data from photovoltaic power plants: at fixed sampling intervals The active power sequence is denoted as: ; in, This is the active power sequence of a photovoltaic power plant; Indicates the first Each sampling time The active power output of the photovoltaic power plant; H indicates transpose; Meteorological data: A sequence of meteorological elements strictly aligned with the power data timestamps constitutes a meteorological feature matrix, denoted as: , in, A meteorological feature matrix that is strictly aligned with the timestamps of photovoltaic power data; The solar irradiance was collected synchronously. For ambient temperature, For wind speed, Relative humidity, Cloud cover; Grid connection characteristic data: Parameters reflecting the grid's operating status and hard constraints, including: Time period tags: Peak time period tags Valley period tags ; Safety constraint parameters: Maximum power ramp rate ; Grid connection point voltage safety limit ; Step 1.2: Fusion Preprocessing; Transforming multi-source heterogeneous data into structured model input samples: Data cleaning: Missing data is filled using linear interpolation. Let the valid data points before and after the missing location be... and ,use The criterion is to remove outlier data for any data point in the sequence. If the following conditions are met: , These are identified as outliers and removed. and These are the sequence mean and standard deviation, respectively. Data normalization: using Standardization unifies all features to Interval: , in, The first element in the original data matrix The first feature Each sample value For the first A vector consisting of all sample values ​​of each feature. These are the normalized eigenvalues. Photovoltaic power at any given time is denoted as Normalized The meteorological characteristics at that time are ; Physical feature engineering: Extracting derived features with explicit power grid physical meaning from normalized data: Power ramp rate: The first-order difference of power between adjacent moments is used as the instantaneous ramp rate characteristic. : , Instantaneous slope rate characteristics Normalization is performed again to obtain the instantaneous gradient characteristic. ; Voltage margin: Calculate the measured voltage With safety limit The ratio of these values ​​serves as a characteristic of voltage safety margin. : , Time period labels: Directly use the collected peak time period binary labels. Binary labels for valley periods ; Sample construction: Training samples are generated using the sliding window method, and the length of the historical window is defined. and prediction window length For any condition satisfying Time Index , construct the first Input feature sequence for each sample :Depend on arrive The fused feature vectors at each time step are stacked together. , Wherein, the fused feature vector at time t for: , in, R represents the total dimension of the fused features; R denotes the real number space. Output label sequence Corresponding to the future Normalized photovoltaic power at each moment: , By traversing the entire time series using a sliding window, a complete time series prediction sample set D is finally generated: , in, The total number of samples.

3. The method according to claim 2, characterized in that, Step 2 includes: Step 2.1: Vectorized encoding and condition injection of physical constraints; For each time step t, from the fused feature vector Extract physical constraint-related features and construct a physical constraint feature vector. : ; Step 2.2: Spatiotemporal location encoding of physical perception; Based on each position in the input sequence Corresponding peak period binary labels Binary labels for valley periods Physical modulation is applied to the standard sinusoidal position code to generate a physically sensed position code (PE). The physical sensed position code PE is then... peacekeeping The formulas for calculating dimensions are as follows: , in, For the first Dimensional positional encoding value, For the first Dimensional positional encoding value, and These represent the corresponding peak and valley constraint strengths, respectively. For the hidden layer dimension of the model, These are learnable parameters; Step 2.3: The four-fold physical constraint perceptual attention mechanism includes the following steps: Step 2.3.1: Basic Physics Attention; Calculate the attention weights driven by the original data and introduce a physical constraint correlation matrix. As a bias: , in, The output of the physically constrained attention mechanism; These are the query, key, and value matrices, respectively. These are the weighting coefficients for physical constraints; For physical constraints Correlation matrix; is the dimension of the key vector; Softmax is the activation function; Step 2.3.2: Peak-Sensitive Attention: Through a peak gate mask Implement an attention head that is strongly correlated with the peak label: , in, The peak mask matrix is ​​the first Line 1 Column elements; For the first Weighting coefficients for peak characteristics; For the first Peak feature encoding at each location; For the first Peak feature encoding at each location; It is the Sigmoid activation function. These are learnable weight parameters; This is the output for peak attention; Step 2.3.3: Valley-Sensitive Attention: Through an attention-gated mask based on valley period labels Implementing valley-sensitive attention using matrices: , in, The first valley value mask matrix Line 1 Column elements; For learnable parameters, For trough-sensitive attention output; Step 2.3.4: Climbing Consistency Attention: Establish a Gaussian kernel weight matrix based on ramping constraints : , in, The first Gaussian kernel weight matrix for hill climbing constraints Line 1 Column elements; This indicates whether the power is increasing, remaining constant, or decreasing. For time steps arrive The direction of power change, The adaptive bandwidth parameter is related to the time step; exp represents the natural exponential function. To constrain the output of attention during hill climbing; Step 2.3.5: Hierarchical Gated Fusion Layer: Finally, a learnable gating vector is used. The outputs of the four attention methods are dynamically fused to form the final context representation of the hierarchical gating fusion layer: , , in, Physical constraints on attention; For peak-sensitive attention; For those with high sensitivity to low values; To restrict attention while climbing; The weight matrix is ​​a learnable matrix. For the first Each gating weight, The value ranges from 1 to 4. This is the final attention representation after fusion; Step 2.4: Feedforward network for physical differential equations; The standard feedforward network (FFN) is transformed into a numerical simulator of a continuous-time dynamic system, and the hidden states of the model are set. It follows a differential equation modulated by physical constraints: , in, It is a function parameterized by a neural network; d represents the differential symbol. In the discrete time step, the differentiable fourth-order Runge-Kutta method is used to solve the problem and update the hidden state: , , , , ; in, The initial rate of the hidden state evolution; For the first The hidden state at each time step; For the first Physical constraint-related characteristics at each time step; For the first The timestamp of each time step; For half-time step slope correction; For the first Physical constraint-related characteristics of one and a half time steps; For time step; For the second half-time step slope correction; For full-time step slope estimation; Step 2.5: Internal physical consistency check and correction; A lightweight internal physical consistency check module is introduced after the PI-Transformer layer of the self-attention mechanism model embedded in each physical feature. This module computes a regularized loss to measure the current hidden state. Does the evolution violate known constraints? , in, For the first Loss of internal physical consistency of the layer , For hyperparameters, It is a rectifier linear unit. For the first Layer in time step The hidden state vector, For reference power, This represents the partial derivative.

4. The method according to claim 3, characterized in that, Step 3 includes: Step 3.1: Design a hybrid multi-objective loss function; A hierarchical hybrid loss function is designed, introducing the following three targeted physical penalty terms: Peak deviation penalty : , in, For the peak sample set; These are the weighting coefficients; For time steps The true value; For time steps The predicted value; The standard deviation of the true value; trough deviation penalty : , in, For the trough sample set; Power ramp penalty : , in, , , These are the weighting coefficients for the three penalty sub-items; For the first First-order difference predictions at each time step; Maximum permissible climbing rate; For the first Second-order difference predictions for each time step; Maximum permissible climbing acceleration; This is a scale parameter for the climbing rate; Final total loss function for: ; in, The weighting coefficients for the basic loss; The weighting coefficients for peak loss; The weighting coefficient for the valley loss; This represents the weighting coefficient of the hill-climbing penalty term; For the first Each inner layer's loss or constraint term; Step 3.2: Differentiable physical constraint output layer; At the end of the decoder, a differentiable constrained projection layer is designed, which projects the original output of the model. As input, through a gradient-based optimization operation, Mapping to the feasible region that satisfies all hard physical constraints yields the final output. .

5. The method according to claim 4, characterized in that, Step 4 includes: Step 4.1: Optimize problem modeling; Define decision variable vector ,in, For the model's optimizable parameters, Let the loss function be a weight coefficient vector. The optimization objective is to minimize the following four functions: Overall prediction accuracy ; in, This is the root mean square error; Peak period prediction error ; in, This represents the prediction error during the peak period. Power ramp violation ; in, The degree of violation of power ramping regulations; Dispatch economic costs ; in, To manage economic costs; Step 4.2: Execute the improved second-generation non-dominated sorting genetic NSGA-II algorithm, including: Step 4.2.1, Initialization: Set the population size Parameters such as maximum number of iterations Latin hypercube sampling is used to generate an initial population that satisfies the variable constraints. ; Step 4.2.2, Fitness Assessment: For each individual The model is trained using parameter configuration and four function values ​​are calculated. Step 4.2.3, Non-dominated sorting and crowding calculation: Perform fast non-dominated sorting on the population and divide it into multiple frontier levels. , ,…, ;in, First frontier level; calculate improved congestion distance: ; in, For individuals Crowded distance; In the first A target function, and an individual The objective function value of adjacent individuals with larger objective values; In the first On each objective function, and with the individual The objective function values ​​of adjacent individuals with smaller objective values; For the first The maximum objective value of each objective function within the current frontier level; For the first The minimum objective value of each objective function within the current frontier level; For diversity reward coefficient; For individuals Diverse rewards; Step 4.2.4, Selection, Crossover and Mutation: Select parent individuals based on tournament selection, perform simulated binary crossover and polynomial mutation operations to generate offspring population; Step 4.2.5, Environmental Selection: Merge parent and offspring populations, and select based on non-dominance level and crowding distance. A new generation of population is formed by elite individuals; Step 4.2.6, Iteration and Termination: Repeat steps 4.2.2 to 4.2.5 until the maximum number of iterations is reached. Alternatively, if the convergence criterion is met, the final population will be output. Step 4.3: Obtain the Pareto optimal solution set; Extract all non-dominated solutions from the final population to form the Pareto optimal solution set. .

6. The method according to claim 5, characterized in that, Step 5 includes: Step 5.1: Select the optimal configuration; The final configuration scheme is selected from the Pareto optimal solution set based on the actual operational needs of the power grid. Peak-hour prediction reliability priority strategy: Selecting The smallest solution; Climbing safety constraint priority strategy: Select the strategy that prioritizes safety constraints The smallest solution; Economic priority strategy: Choose to make The smallest solution; Comprehensive balancing strategy: Select the solution with the minimum distance to the ideal point. ; in, These are the optimal decision variables; For the first One objective function value; For the first The ideal value for each target; Step 5.2: Train the final model; Step 5.3: Real-time predictive execution.

7. The method according to claim 6, characterized in that, Step 5.2 includes: using the selected optimal configuration ,in, These are the optimal trainable parameters; The optimal weight coefficient vector is obtained; the PI-Transformer self-attention mechanism model with physical property embedding is retrained to obtain the final prediction model. .

8. The method according to claim 7, characterized in that, Step 5.3 includes: Real-time multi-source data for the period to be predicted are collected, including photovoltaic power, meteorological data, and grid connection characteristic data. The same fusion preprocessing is performed as in step 1.2 to obtain the input feature sequence. ;Will Input the final prediction model Output the future Photovoltaic power generation forecast at a given time The predicted values ​​are inversely normalized to obtain the actual power values. This is output as the prediction result of photovoltaic power generation.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing program code that, when executed by the processor, causes the processor to perform the steps of the method as described in any one of claims 1 to 8.

10. A storage medium, characterized in that, It stores a computer program or instructions that, when run on a computer, perform the steps of the method as described in any one of claims 1 to 8.