Photovoltaic power prediction method and system based on seasonal weather classification and RLHF large model

By introducing seasonal weather classification and RLHF large models in photovoltaic power prediction, combining deep learning and reinforcement learning, and using human feedback optimization models, the problem of insufficient weather classification in the existing technology is solved, and the problem of insufficient fusion of professional knowledge and model is ignoring, achieving higher prediction accuracy and adaptability.

CN119623772BActive Publication Date: 2025-04-22BEIJING RETEC NEW ENERGY TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510152477.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-12
Publication Date
2025-04-22
Estimated Expiration
2045-02-12

AI Technical Summary

Technical Problem

The existing PV power prediction methods lack refined weather typing and neglecting insufficient human expertise and model integration, resulting in insufficient prediction accuracy and adaptability.

Method used

The photovoltaic power prediction method based on seasonal weather classification and RLHF large model is adopted to construct seasonal weather classification and photovoltaic output prediction models, and combine deep learning and reinforcement learning, and use human feedback optimization models to achieve the fusion of prediction results.

Benefits of technology

It significantly improves the accuracy, robustness and flexibility of photovoltaic power prediction, can more accurately reflect photovoltaic power generation under different seasons and weather conditions, reduce errors, and maintain high prediction performance through continuous optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119623772B_ABST
    Figure CN119623772B_ABST
Patent Text Reader

Abstract

The present invention discloses a photovoltaic power prediction method based on seasonal weather typing and RLHF large model, comprising the following steps: Step 1: Data acquisition: Acquire the power generation data and historical meteorological data of the photovoltaic power station to construct a data set; Step 2: Construct a prediction model: Construct a weather typing and photovoltaic output prediction model, divide a year into multiple seasons, subdivide the weather into several weather types, and construct a photovoltaic output prediction model for each weather type in each season; Construct an RLHF large model, use a method combining deep learning and reinforcement learning, and improve the prediction accuracy and interpretability of photovoltaic power generation through pre-training and human feedback; Step 3: Construct a fusion model: Fusion the weather typing and photovoltaic output prediction model and the prediction output of the RLHF large model to obtain the final prediction result of photovoltaic power generation. The present invention also discloses a photovoltaic power prediction system based on seasonal weather typing and RLHF large model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of photovoltaic power generation, and specifically relates to a photovoltaic power prediction method and system based on seasonal weather classification and RLHF large model. Background Art

[0002] A photovoltaic power prediction method with high accuracy is of great significance for improving energy efficiency, enhancing grid stability and reliability, promoting sustainable development, and supporting policy formulation and technological progress. Accurate prediction can not only optimize power dispatch, reduce operating costs, and reduce the phenomenon of abandoned light, but also effectively prevent grid failures, ensure power supply safety, and promote the construction of smart grids. Photovoltaic power prediction method is a key tool for achieving efficient management and utilization of clean energy, and is essential for building a clean, efficient, and intelligent power system.

[0003] Traditional photovoltaic power prediction methods usually rely on historical meteorological data (such as temperature, humidity, wind speed, etc.) and the output power records of photovoltaic power generation systems. These methods may include simple mathematical models such as statistical regression analysis and time series prediction. However, such methods often fail to fully consider the impact of different seasons and weather conditions on photovoltaic power generation, resulting in inaccurate prediction results in some cases.

[0004] With the development of machine learning technology, more and more studies have begun to use algorithms such as neural networks and support vector machines to predict photovoltaic power. For example, some studies use convolutional neural networks (CNN) or recurrent neural networks (RNN) in deep learning to process long time series data to capture more complex nonlinear relationships. Although these methods improve prediction performance, they still lack targeted modeling for specific weather types.

[0005] Reinforcement learning has been used to optimize the operation strategy of photovoltaic systems, such as maximizing energy collection efficiency or minimizing energy storage costs. However, there are relatively few studies that directly apply reinforcement learning to photovoltaic power prediction, and in most cases, human expert experience feedback is not combined to enhance the performance of the model.

[0006] In summary, the existing photovoltaic power prediction methods have the following shortcomings:

[0007] 1) Lack of refined weather classification: Existing technologies do not build specialized prediction models for different seasons and specific weather types, which limits their applicability and accuracy in complex and changing environments.

[0008] 2) Ignoring the role of human expertise: Although some works introduced expert rules, they did not fully utilize immediate human feedback as an additional learning signal during the training process, which affected the model's interpretability and adaptability.

[0009] 3) Insufficient model fusion: In the existing technology, even if there are multiple sub-models, the coordination mechanism between them is relatively simple, making it difficult to form a comprehensive prediction framework and effectively integrate the advantages of each sub-model. Summary of the invention

[0010] In view of this, the purpose of the present invention is to provide a photovoltaic power prediction method and system based on seasonal weather classification and RLHF large model, aiming to significantly improve the accuracy, robustness and flexibility of photovoltaic power prediction by introducing seasonality and human expert knowledge.

[0011] In order to achieve the above object, the present invention provides the following technical solutions:

[0012] The present invention first proposes a photovoltaic power prediction method based on seasonal weather classification and RLHF large model, which includes the following steps:

[0013] Step 1: Data Acquisition

[0014] Obtain the power generation data of the photovoltaic power station and the historical meteorological data of the area where the photovoltaic power station is located, and build a data set;

[0015] Step 2: Build a prediction model

[0016] Constructing a weather classification and photovoltaic output prediction model, wherein the weather classification and photovoltaic output prediction model divides a year into multiple seasons according to meteorological parameters, and subdivides the weather into several weather types, and constructs a photovoltaic output prediction model for each weather type in each season;

[0017] Constructing a RLHF large model, which uses a combination of deep learning and reinforcement learning to improve the accuracy and interpretability of photovoltaic power generation prediction through pre-training and human feedback;

[0018] Step 3: Build a fusion model

[0019] A fusion model is constructed, wherein the fusion model is used to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model, and obtain the final forecast result of photovoltaic power generation.

[0020] Furthermore, in step 2, the method steps for constructing a weather classification and photovoltaic output prediction model are as follows:

[0021] S11: Data collection and preprocessing

[0022] Collect historical meteorological data of the area where the photovoltaic power station is located from the data set, and ensure that the historical meteorological data covers all four seasons; clean and standardize the historical meteorological data, remove outliers and / or fill in missing values, and obtain a weather classification data set;

[0023] S12: Introducing seasonal factors

[0024] Based on the sky condition factor SCF, the seasonal factor SF is introduced to integrate seasonal changes into the weather classification process to form a new weather classification index:

[0025]

[0026] in: It is a weather classification indicator; is the sky condition factor; is the seasonal factor;

[0027] S13: Extended weather classification

[0028] According to weather classification indicators , re-evaluate the clear / cloudy boundary, add season labels to the weather classification dataset, and mark the season and weather type corresponding to each time point;

[0029] S14: Building a weather type classification model

[0030] A weather classification model is constructed based on a self-organizing map neural network. The weather classification model is trained using a weather classification dataset with season labels added. The season-weather type matrix of the photovoltaic power station area is obtained using the weather classification model.

[0031] S15: Building a photovoltaic output prediction model

[0032] According to the season-weather type matrix of the region where the photovoltaic power station is located, the weather classification data set is divided into several subsets, and several photovoltaic output data subsets are obtained by combining the photovoltaic power generation power corresponding to each time point; a photovoltaic output prediction model is constructed using a deep learning model, and each photovoltaic output data subset is used to train the photovoltaic output prediction model to obtain a photovoltaic output prediction model for each weather type in each season;

[0033] S16: Photovoltaic output forecast

[0034] According to the input real-time meteorological data, the weather type classification model is used to divide the seasons and weather types, and the corresponding photovoltaic output prediction model is used to obtain the photovoltaic output prediction result.

[0035] Further, in step S12, the sky condition factor SCF is:

[0036]

[0037] in: , , and They represent the weights of the meteorological variables of total cloud cover, temperature, humidity and wind speed respectively; , , and They represent the standardized or transformed functions of the meteorological variables of total cloud cover, temperature, humidity and wind speed, respectively;

[0038] The seasonal factor SF is:

[0039]

[0040] in: represents the seasonal factor calculated in days; Indicates the seasonal factor calculated by month; Indicates time counted in days; Indicates the number of days in a year; Indicates a reference time point; and denote the amplitude and the translation respectively;

[0041] or,

[0042]

[0043] in: Indicates the seasonal factor calculated by month; Indicates the optimal value range for each season; the 'indicator' function returns 1 if the condition is met, otherwise it returns 0; The number of months in a year.

[0044] Furthermore, in step S15, the method steps for constructing a photovoltaic output prediction model are as follows:

[0045] S151: Data segmentation and annotation

[0046] Label the historical meteorological data to mark the season and weather type corresponding to each time point; use the weather type classification model to divide the weather classification data set into multiple subsets according to season and weather type;

[0047] S152: Feature selection and preprocessing

[0048] For each subset, obtain the meteorological variables that can affect the photovoltaic output under the corresponding season and weather type conditions, and perform corresponding feature selection; standardize or normalize the selected features;

[0049] S153: Model selection and configuration

[0050] For each subset, a deep learning model is selected and the hyperparameters are adjusted to suit the specific season and weather type of the corresponding subset;

[0051] S154: Training and Validation

[0052] Use the cross-validation method to train and validate the model on each subset to ensure that the model has good generalization ability; save the optimal model corresponding to each season-weather type;

[0053] S155: Integration and Fusion

[0054] Ability to automatically select the most suitable model for the current season and weather type conditions to make forecasts based on real-time meteorological data;

[0055] S156: Performance evaluation and feedback Regularly evaluate the performance of all models in actual operation and continuously improve the models.

[0056] Furthermore, in step 2, the method steps for constructing the RLHF large model are:

[0057] S21: Acquisition and construction of pre-training dataset

[0058] Construct a pre-training dataset based on the dataset:

[0059] pretrainDataset={feature,label}

[0060] Among them: feature is data including historical actual power, numerical weather forecast and satellite cloud map; label is the actual power value of the previous day;

[0061] Construct a sliding window dataset (x1, y):

[0062] x1[i]=concat(data['actual power','satellite cloud image'][i:i+t],data['numerical weather forecast data'][i+t:i+t+out_step_size] )

[0063] y[i]=data['actual power','satellite cloud image'][i+t :i+t+out_step_size] where: x1 represents the historical load univariate feature x1, which is the concatenation value of the historical actual power and the future numerical weather forecast data; i is the number of the currently generated data; y is the constructed output value; data contains all columns of the data set; data['actual power','satellite cloud image'] is the "actual power" and "satellite cloud image" in the data set; data['numerical weather forecast data'] is the "numerical weather forecast data" in the data set; concat represents the concatenation operation; t is the size of the sliding window, which is an adjustable parameter, that is, the historical data of the first t time steps are used to predict the data of the next out_step_size steps; out_step_size is the backward prediction step size, that is, it is necessary to predict out_step_size time steps backward;

[0064] S22: Building the basic model

[0065] The encoder part of Transformer is used as the main structure, and the basic model is built in combination with the neural network. The steps for building the basic model are as follows:

[0066] S221: Building the Transformer Encoder

[0067] The Transformer encoder receives an input matrix and outputs a matrix;

[0068] Multiple encoders are stacked to form a multi-encoder. The input of the first encoder is the feature vector matrix, and the input of the subsequent encoder is the output of the previous encoder.

[0069] S222: Construct the first linear mapping layer

[0070] The output of the Transformer encoder passes through the first linear mapping layer to obtain the output result of the first linear mapping layer :

[0071]

[0072] in: is the output of the Transformer encoder; is the weight coefficient; is the offset;

[0073] S223: Building graph data

[0074] For each sample of the output result of the first linear mapping layer, each feature is used to make a node of the graph, recorded as:

[0075]

[0076] in: is the node matrix, i.e., the output of the first linear mapping layer; Indicates Node, that is, samples;

[0077] The correlation coefficient between the two features is used as the edge, which is recorded as:

[0078]

[0079] in: is the edge matrix; For the strip edge;

[0080] The graph data is represented as:

[0081]

[0082] in: Represents the constructed graph data;

[0083] S224: Building a Pooling Aggregator

[0084] The Pooling aggregator is used to perform nonlinear transformation on the graph data. For each node, there are:

[0085]

[0086]

[0087] in: Indicates that through the aggregation function The result obtained by aggregating the feature vectors of the neighboring nodes of node v at the k-1 layer; Represents the feature vector of node v at the kth layer, which is obtained by concatenating the feature vector of node v itself at the k-1th layer and the aggregated feature vector of its neighboring nodes at the kth layer, and then passing through the weight matrix and nonlinear activation function get; Represents the feature vector of node u at the k-1 layer; Represents the feature vector of node v at the k-1th layer; is an aggregate function; is the concatenation function, which concatenates two vectors together; is the neighborhood function; express Neighbor nodes of is a nonlinear activation function; is the weight matrix; , Indicates the index of the current layer, from 1 to K;

[0088] The initial hidden layer vector is: , represents the initial feature vector of node v;

[0089] No. The hidden layer vector at depth is: ;

[0090] The output vector of each node represents ;

[0091] S225: Construct the second linear mapping layer

[0092] The output of the Pooling aggregator Expanded into a vector, after passing through the second linear mapping layer, the output result of the basic model is obtained;

[0093] S23: pre-training the basic model using the pre-training data set to obtain a pre-training model;

[0094] S24: Pre-trained model fine-tuning

[0095] S241: Constructing the Sprompt dataset

[0096] The Sprompt dataset is represented as:

[0097] promptDataset={prompt,feature,label}

[0098] Among them: prompt is a description statement; feature is historical data; label is the future data of actual power;

[0099] S242: Fine-tune the pre-trained model using the Sprompt dataset to obtain the SFT model;

[0100] S25: Collect human feedback data and train reward model

[0101] S251: Human Feedback Data

[0102] Sample from the prompt database and get answers from several models; annotators score or rank multiple outputs of the model to get comparative data;

[0103] S252: Reward Model

[0104] The reward model replaces the softmax in the last layer of the SFT model with a linear layer. The input of the reward model is the question and the answer, and the output is a scalar. The reward model is trained using comparative data, and the reward model can predict the preference scores of humans for different outputs.

[0105] S26: Optimizing the reward model using PPO reinforcement learning

[0106] S261: Building RL Models

[0107] The initial model of the RL model uses a large language pre-training model after fine-tuning the SFT model;

[0108] S262: Training RL Model

[0109] Another sample is taken from the prompt database, and the sampled question set is input into the RL model, and the answer text is generated by the RL model; the questions and answers are input into the reward model for scoring to evaluate the quality of the generated answer text, and the PPO algorithm is used to optimize the RL model.

[0110] Furthermore, in step S221, the encoder of the Transformer includes an input layer, an attention layer, a summation and normalization layer, and a feedforward neural network layer; the principle of the encoder of the Transformer is:

[0111] Input the historical load univariate feature x1 into the input layer and get:

[0112]

[0113]

[0114]

[0115]

[0116] in: represents the encoding of the input features, Represents the result obtained after passing through the input layer; Represents the position embedding layer; Indicates the position of the data in the time series; express Dimensions; represents an even-numbered dimension; represents an odd dimension; and: 2i≤d, 2i+1≤d;

[0117] In the attention layer, the query vector Q, key vector K, and value vector V are mapped from the features respectively:

[0118] ,K= , V=

[0119] in: is the weight matrix; attention calculation:

[0120]

[0121] in, is the number of columns of the Q and K matrices, i.e. the vector dimension;

[0122] Calculate the multi-head self-attention mechanism:

[0123]

[0124]

[0125] in: Represents the weight matrix, used for linear transformation; Indicates the number of attention heads;

[0126] The summation and normalization layer is divided into two parts: the summation layer and the normalization layer. The summation layer is a residual connection; the normalization layer refers to layer normalization, which converts the input of each layer of neurons into a form with the same mean variance; it is expressed as:

[0127]

[0128]

[0129] in: Represents the input of a multi-head attention or feedforward neural network; and Indicates output;

[0130] The feedforward neural network layer includes two fully connected layers. The activation function of the first fully connected layer is the linear rectifier function Relu; the second fully connected layer does not use an activation function, which is expressed as:

[0131]

[0132] in: is the input of the feedforward neural network layer; the dimension of the output matrix finally obtained by the feedforward neural network is the same as Consistent.

[0133] Furthermore, in step S252, the loss function of the reward model is:

[0134]

[0135] in: A dataset for manually ranking answers; is the problem in dataset D; The number of answers corresponding to each question; and Separate issues Corresponding Two of the answers, and The sort ratio high; Represents the reward model for a pair of inputs and The resulting scalar score; The parameters that need to be optimized for the reward model.

[0136] Furthermore, in step S262, the loss function of the RL model training is:

[0137]

[0138] in: represents the SFT model; Indicates the model that needs to be adjusted; is a problem in the RL dataset; yes pass The answer obtained by the model; Represents the reward model for a pair of inputs and The resulting scalar score; Representation problem pass Get the answer The probability of Representation problem pass Get the answer The probability of express It is the data from the pre-training stage of the large language model; and These are adjustment factors.

[0139] Furthermore, in step three, the fusion model adopts dynamic selection, weighted average or adaptive adjustment strategy to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model to obtain the final forecast result.

[0140] The present invention also proposes a photovoltaic power prediction system based on seasonal weather classification and RLHF large model, comprising:

[0141] The weather classification and photovoltaic output prediction module divides a year into multiple seasons based on meteorological parameters, and subdivides the weather into several weather types, and builds a photovoltaic output prediction model for each weather type in each season;

[0142] The RLHF large model module uses a method that combines deep learning and reinforcement learning to improve the accuracy and interpretability of photovoltaic power generation prediction through pre-training and human feedback; the fusion module is used to fuse the prediction output of the weather classification and photovoltaic output prediction model with the RLHF large model to obtain the final prediction result of photovoltaic power generation.

[0143] The beneficial effects of the present invention are:

[0144] The present invention is a photovoltaic power prediction method based on seasonal weather classification and RLHF large model, by respectively constructing weather classification and photovoltaic output prediction model and RLHF large model. Using weather classification and photovoltaic output prediction model, a year is divided into multiple seasons according to meteorological parameters, and the weather is subdivided into several weather types. A photovoltaic output prediction model is constructed for each weather type in each season, which can capture the unique behavior pattern of photovoltaic power generation system under different conditions, greatly improving the prediction accuracy. Compared with the traditional prediction model that does not distinguish between weather types, this method can more accurately reflect the actual power generation situation and reduce the error caused by weather changes. The RLHF large model uses a method that combines deep learning and reinforcement learning to improve the prediction accuracy and interpretability of photovoltaic power generation through pre-training and human feedback; specifically, the RLHF large model allows the output to be adjusted according to the preferences provided by the user, so that the prediction results are closer to the actual situation, thereby improving the application value of the model. In addition, by continuously receiving new human feedback, the model can continuously optimize itself and maintain the latest prediction performance. Finally, the fusion model is used to coordinate the collaboration between the weather classification and photovoltaic output prediction model and the RLHF large model, integrating the advantages of the weather classification and photovoltaic output prediction model and the RLHF large model to form a prediction framework with strong versatility and wide adaptability. In summary, the photovoltaic power prediction method based on seasonal weather classification and the RLHF large model of the present invention can quickly adjust the weights assigned to the most appropriate sub-model to obtain the best prediction effect when facing extreme weather or special circumstances by introducing seasonality and human expert knowledge. This flexibility not only improves the robustness of the overall system, but also provides the possibility for future expansion.

[0145] The present invention also has the following technical advantages:

[0146] 1) Significantly improve forecast accuracy: Through the seasonal weather type classification model, it is able to identify and respond to a variety of different weather type combinations, and establish a dedicated forecast model for each combination, which greatly improves the accuracy of the forecast, especially when dealing with extreme or sudden weather events.

[0147] 2) Enhanced model robustness and flexibility: The RLHF large model not only uses advanced deep learning architecture, but also incorporates instant feedback from human experts, so that the model can better understand and adapt to the best behavior patterns in complex scenarios, maintain stable and reliable performance in complex and changing real-world environments, and quickly adapt to new market environments and technological advances. 3) Intelligent model fusion: The fusion model adopts multiple strategies such as dynamic selection, weighted averaging, and adaptive adjustment to ensure the flexibility and robustness of the forecasting system, and can provide stable and reliable forecasting services under various meteorological conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0148] In order to make the purpose, technical solution and beneficial effects of the present invention clearer, the present invention provides the following drawings for illustration:

[0149] Figure 1 It is a flow chart of the photovoltaic power prediction method based on seasonal weather classification and RLHF large model of the present invention;

[0150] Figure 2 The schematic diagram of the photovoltaic power prediction system based on seasonal weather classification and RLHF large model of the present invention;

[0151] Figure 3 This is a comparison chart between the predicted value and the actual value;

[0152] Figure 4 A comparison chart of different models. DETAILED DESCRIPTION

[0153] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0154] like Figure 1 As shown, the photovoltaic power prediction method based on seasonal weather classification and RLHF large model in this embodiment includes the following steps.

[0155] Step 1: Data acquisition.

[0156] The historical meteorological data of the photovoltaic power station and the area where the photovoltaic power station is located are obtained, and a data set is constructed. Specifically, in order to verify the effectiveness of the proposed model, experiments are conducted on a real data set to verify the effectiveness of the method. The data set constructed in this embodiment is the real data of the photovoltaic power station and historical meteorology, and the data is in 15-minute time intervals.

[0157] Step 2: Build a prediction model.

[0158] (1) Weather classification and photovoltaic output prediction model.

[0159] Construct a weather classification and photovoltaic output prediction model. Specifically, the weather classification and photovoltaic output prediction model divides a year into multiple seasons based on meteorological parameters, and subdivides the weather into several weather types, and constructs a photovoltaic output prediction model for each weather type in each season.

[0160] In this embodiment, the method steps for constructing a weather classification and photovoltaic output prediction model are as follows.

[0161] S11: Data collection and preprocessing.

[0162] Collect historical meteorological data of the area where the photovoltaic power station is located from the dataset, including but not limited to total cloud cover, temperature, humidity, wind speed, etc., and ensure that the historical meteorological data covers all four seasons and has sufficient resolution; clean and standardize the historical meteorological data, remove outliers and / or fill in missing values, and obtain a weather classification dataset.

[0163] S12: Introduce seasonal factors.

[0164] On the basis of the sky condition factor SCF, the seasonal factor SF is introduced, and the calculation formula is updated so that SCF not only reflects the sky conditions, but also takes into account the impact of seasonal changes. Seasonal changes are effectively incorporated into the weather classification process, thereby improving the ability to predict the output power of photovoltaic systems. Such improvements can not only help power companies better plan production and scheduling, but also provide users with a more stable supply of clean energy. In order to incorporate seasonal changes into the weather classification process and improve the ability to predict the output power of photovoltaic systems, it is necessary to calculate the Sky Condition Factor (SCF) and Seasonal Factor (SF), incorporate seasonal changes into the weather classification process, and form new weather classification indicators:

[0165]

[0166] in: It is a weather classification indicator; is the sky condition factor; is the seasonal factor.

[0167] 1) Sky condition factor SCF.

[0168] Sky Condition Factor (SCF) is a comprehensive indicator used to quantify the impact of sky conditions on PV output. It is based on multiple meteorological variables such as total cloud cover, temperature, humidity, wind speed, etc., and is obtained after weighting and standardization. Specifically, the sky condition factor SCF is:

[0169]

[0170] in: , , and They represent the weights of meteorological variables of total cloud cover, temperature, humidity and wind speed, respectively, reflecting the importance of specific variables to PV output; , , and They represent the functions after standardization or transformation of the meteorological variables of total cloud cover, temperature, humidity and wind speed, respectively, to ensure that different variables can be compared and combined.

[0171] Specifically, the method for standardizing the meteorological variables of total cloud cover, temperature, humidity and wind speed is as follows.

[0172] ① Data standardization: For each meteorological variable, its value is first mapped to the interval [0, 1] to eliminate dimensional differences.

[0173] ② Weighted summation: Determine the weight of each variable based on historical data analysis, and then perform weighted summation to obtain the final SCF value.

[0174] 2) Seasonal factor SF.

[0175] The seasonal factor SF is defined as an adjustment factor that reflects seasonal changes, aiming to capture the changing patterns of meteorological conditions at different times of the year. It can be periodic (such as a sine wave) or based on the results of statistical analysis. Specifically, the seasonal factor SF is:

[0176]

[0177] in: represents the seasonal factor calculated in days; Indicates the seasonal factor calculated by month; Represents a time in days (such as a calendar date); Indicates the number of days in a year (such as 365 days); It represents a reference point in time, usually chosen as a specific date of the year (such as the spring equinox or winter solstice); and Represent the amplitude and translation respectively. Specifically, if a sine wave is used, the parameters need to be fitted through historical data and .

[0178] Or, the seasonal factor SF is:

[0179]

[0180] in: Indicates the seasonal factor calculated by month; Indicates the optimal value range for each season; the 'indicator' function returns 1 if the condition is met, otherwise it returns 0; is the number of months in a year. If discrete values ​​based on months are used, different mathematical formulas are set according to the characteristics of each season: For example, a high positive value may be set in summer, and a low or even negative value may be set in winter.

[0181] S13: Expand the classification of weather types.

[0182] According to weather classification indicators , re-evaluate the sunny / cloudy boundary, add season labels to the weather classification data set, mark the season and weather type corresponding to each time point, and ensure that the newly added seasonal factors can correctly affect the final clustering results.

[0183] S14: Construct a weather type classification model.

[0184] A weather type classification model is constructed based on the self-organizing map neural network (SOM). The weather type classification model is trained using the weather classification dataset with season labels added. The season-weather type matrix of the photovoltaic power station area is obtained using the weather type classification model.

[0185] Specifically, in the process of building the weather type classification model, the SOM training algorithm is optimized to enable it to distinguish data points from different seasons. This can be achieved by setting different initial weights or learning rates. Using a training set with season labels to supervise the learning process of the SOM helps the network better understand seasonal patterns.

[0186] After the weather type classification model is built, it is necessary to regularly test the performance of the model in different seasons, adjust the parameters according to the actual photovoltaic output, and continuously improve the model to ensure its long-term effectiveness. Create a detailed season-weather type matrix for specific regions or power stations to effectively incorporate seasonal changes into the weather classification process, thereby improving the ability to predict the output power of photovoltaic systems. Such improvements can not only help power companies better plan production and scheduling, but also provide users with a more stable supply of clean energy.

[0187] In this embodiment, a year is divided into four seasons (spring, summer, autumn, and winter), and each season is further divided into three conditions (sunny, cloudy, and rainy) according to the weather type. In this way, a total of 12 season-weather types are obtained.

[0188] S15: Construct a photovoltaic output prediction model.

[0189] According to the season-weather type matrix of the area where the photovoltaic power station is located, the weather classification data set is divided into several subsets. Combined with the photovoltaic power generation power corresponding to each time point, several photovoltaic output data subsets are obtained. A deep learning model is used to construct a photovoltaic output prediction model, and each photovoltaic output data subset is used to train the photovoltaic output prediction model separately to obtain a photovoltaic output prediction model for each weather type in each season.

[0190] In this embodiment, 12 models are trained based on seasonal weather classification and historical photovoltaic power generation data. In order to more accurately predict the output power of the photovoltaic system under different seasons and weather conditions, the model training process can be further refined. Specifically, the year is divided into four seasons (spring, summer, autumn, and winter), and each season is subdivided into three conditions (sunny, cloudy, and rainy) according to the weather type, and a total of 12 different prediction models are constructed. Not only the impact of seasonal changes is taken into account, but also optimization is performed for specific weather conditions, thereby improving the accuracy of the prediction.

[0191] Specifically, in this embodiment, the method steps for constructing a photovoltaic output prediction model are as follows.

[0192] S151: Data segmentation and labeling.

[0193] The historical meteorological data is annotated to mark the season and weather type corresponding to each time point; the weather classification data set is divided into multiple subsets according to the season and weather type using the weather type classification model. In this embodiment, 12 subsets are divided according to the season and weather type to ensure that each subset contains enough data points to support effective training.

[0194] S152: Feature selection and preprocessing.

[0195] For each subset, the meteorological variables that can affect the photovoltaic output under the corresponding season and weather type conditions are obtained, and corresponding feature selection is performed; the selected features are standardized or normalized to ensure that the input features are on the same scale to avoid certain features dominating the model learning process.

[0196] S153: Model selection and configuration.

[0197] For each subset, select a deep learning model and adjust the hyperparameters to adapt to the specific season and weather type of the corresponding subset. Specifically, the deep learning model can be linear regression, random forest, LSTM, etc. Considering the characteristics of the photovoltaic output prediction task, you can give priority to trying sequence models (such as RNN / LSTM) to capture the dynamic changes in the time series.

[0198] S154: Training and validation.

[0199] Use the cross-validation method to train and verify the model on each subset to ensure that the model has good generalization ability; save the optimal model corresponding to each season-weather type; monitor key indicators (such as mean square error (MSE), mean absolute error (MAE), etc.) during the training process, and adjust the model structure or parameters in time to prevent overfitting or underfitting.

[0200] S155: Integration and fusion.

[0201] It is capable of automatically selecting the model that best suits the current season and weather type conditions for prediction based on real-time meteorological data; in some embodiments, model fusion technology can also be explored, such as combining the outputs of multiple models through weighted averaging or other methods to predict the same season-weather type, thereby further improving prediction accuracy.

[0202] S156: Performance evaluation and feedback.

[0203] Regularly evaluate the performance of all models in actual operation, collect user feedback, and continuously improve the models. Analyze the sources of prediction errors, identify potential problem areas, and optimize related models in a targeted manner.

[0204] Through the above steps, we can not only achieve accurate prediction of photovoltaic output under different seasons and weather conditions, but also provide more reliable clean energy management tools for power companies and other stakeholders. Such refined modeling helps improve energy efficiency, reduce unnecessary waste, and promote sustainable development.

[0205] Example: Spring-Sunny Day Model.

[0206] Model training for the specific condition of spring-sunny day:

[0207] ① Data preparation: Filter out the time periods belonging to spring and with total cloud cover ≤ 20% from the historical data to form a subset specifically used to train the “Spring-Sunny” model.

[0208] ② Feature engineering: focus on factors such as temperature, sunshine duration, and solar radiation intensity, because these variables have a significant impact on photovoltaic output in clear weather.

[0209] ③Model training: The LSTM network suitable for processing time series data is selected as the basic architecture, and the attention mechanism is introduced to enhance the model's attention to important moments.

[0210] ④Performance optimization: Use grid search or Bayesian optimization to find the best hyperparameter combination to ensure that the model can achieve excellent results on the test set.

[0211] ⑤ Practical application: When the system detects that it is spring and the weather is clear, it automatically calls this model to make short-term power generation forecasts to assist in grid dispatching.

[0212] The same process is applied to the other 11 season-weather combinations, ultimately forming a set of intelligent prediction modules that comprehensively cover various meteorological conditions throughout the year.

[0213] S16: Photovoltaic output forecast.

[0214] According to the input real-time meteorological data, the weather type classification model is used to divide the seasons and weather types, and the corresponding photovoltaic output prediction model is used to obtain the photovoltaic output prediction result.

[0215] (2) RLHF large model.

[0216] A large RLHF model is constructed, which uses a method that combines deep learning and reinforcement learning to improve the accuracy and interpretability of photovoltaic power generation prediction through pre-training and human feedback.

[0217] The use of a large model technology module based on RLHF (Reinforcement Learning from Human Feedback) for photovoltaic power forecasting is an innovative approach that combines the powerful forecasting capabilities of machine learning with the knowledge and experience of human experts. The RLHF method can not only improve the accuracy of the forecast, but also ensure that the forecast results are more in line with the needs of actual application scenarios. Forecasts are made using data sets such as historical actual power, numerical weather forecast data, and satellite cloud image data.

[0218] Specifically, the method steps for constructing the RLHF large model are as follows.

[0219] S21: Acquisition and construction of pre-training dataset.

[0220] The prediction is performed using data sets such as historical actual power, numerical weather forecast data, and satellite cloud image data. In order to verify the effectiveness of the RLHF large model proposed in this embodiment, experiments are conducted on real data sets to verify the effectiveness. The data set used in this embodiment is the real data of a photovoltaic power station, and the data is in 15-minute time intervals. Specifically, the pre-training data set constructed based on the data set is:

[0221] pretrainDataset={feature,label}

[0222] Among them: feature is the data including historical actual power, numerical weather forecast and satellite cloud map, corresponding to x1 in the formula; label is the actual power value on the previous day, corresponding to y in the formula.

[0223] Construct a sliding window dataset (x1, y):

[0224] x1[i]=concat(data['actual power','satellite cloud image'][i:i+t],data['numerical weather forecast data'][i+t:i+t+out_step_size] )

[0225] y[i]=data['actual power','satellite cloud image'][i+t :i+t+out_step_size]

[0226] Among them: x1 represents the historical load single variable feature x1, which is the concatenation value of the historical actual power and the future numerical weather forecast data; i is the number of the currently generated data; y is the constructed output value; data contains all columns of the data set; data['actual power', 'satellite cloud image'] is the "actual power" and "satellite cloud image" in the data set; data['numerical weather forecast data'] is the "numerical weather forecast data" in the data set; concat represents the concatenation operation; t is the size of the sliding window, which is an adjustable parameter, that is, the historical data of the first t time steps are used to predict the data of the next out_step_size steps; out_step_size is the backward prediction step size, that is, it is necessary to predict out_step_size time steps backward. out_step_size is an adjustable parameter. In short-term prediction, out_step_size is generally taken as 96.

[0227] S22: Build the basic model.

[0228] The encoder part of Transformer is used as the main structure, and a basic model is constructed in combination with a neural network. Specifically, in this embodiment, the steps of the method for constructing the basic model are as follows.

[0229] S221: Build the Transformer encoder.

[0230] The Transformer encoder takes in an input matrix and outputs a matrix.

[0231] Multiple encoders are superimposed to form a multi-encoder. The input of the first encoder is the feature vector matrix, and the input of the subsequent encoder is the output of the previous encoder.

[0232] In this embodiment, the encoder of the Transformer includes an input layer, an attention layer, a summation and normalization layer, and a feedforward neural network layer; the principle of the encoder of the Transformer is as follows.

[0233] Since the original Transformer contains a word embedding layer, in this embodiment, a fully connected network is used instead of the word embedding layer. In addition, a position embedding layer is also required. The position embedding layer is represented by PE. The historical load univariate feature x1 is input into the input layer, and the result is:

[0234]

[0235]

[0236]

[0237]

[0238] in: represents the encoding of the input features, Represents the result obtained after passing through the input layer; Represents the position embedding layer; Indicates the position of the data in the time series; express Dimensions; represents an even-numbered dimension; represents an odd dimension; and: 2i≤d, 2i+1≤d.

[0239] In the attention layer, the query vector Q, key vector K, and value vector V are mapped from the features respectively:

[0240] ,K= , V=

[0241] in: is the weight matrix; attention calculation:

[0242]

[0243] in, is the number of columns of the Q and K matrices, i.e. the vector dimension.

[0244] Calculate the multi-head self-attention mechanism:

[0245]

[0246]

[0247] in: Represents the weight matrix, used for linear transformation; Represents the number of attention heads.

[0248] The summation and normalization layer is divided into two parts: the summation layer and the normalization layer. The summation layer is a residual connection; the normalization layer refers to layer normalization, which converts the input of each layer of neurons into a form with the same mean variance; it is expressed as:

[0249]

[0250]

[0251] in: Represents the input of a multi-head attention or feedforward neural network; and Represents the output. The output has the same dimension as the input X, so they can be added.

[0252] The summation layer refers to X+MultiHeadAttention(X), which is a residual connection, usually used to solve the problem of multi-layer network training, allowing the network to focus on the current difference. The normalization layer refers to layer standardization, which is usually used in recurrent neural network structures. Layer standardization converts the input of each layer of neurons into a form with the same mean and variance to speed up convergence.

[0253] The feedforward neural network layer includes two fully connected layers. The activation function of the first fully connected layer is the linear rectifier function Relu; the second fully connected layer does not use an activation function, which is expressed as:

[0254]

[0255] in: is the input of the feedforward neural network layer. The dimension of the output matrix finally obtained by the feedforward neural network is the same as Consistent.

[0256] Through the above-mentioned multi-head attention mechanism, feedforward neural network, and summation and normalization layer, a Transformer encoder can be constructed. The encoder receives an input matrix and outputs a matrix. A multi-encoder can be formed by superimposing multiple encoders. The input of the first encoder is a vector matrix of features, and the input of the subsequent encoder is the output of the previous encoder. In this embodiment, the number of encoders N is an adjustable hyperparameter, and N=8 is taken in the specific implementation of this embodiment.

[0257] S222: Construct a first linear mapping layer.

[0258] The output of the Transformer encoder passes through the first linear mapping layer to obtain the output result of the first linear mapping layer :

[0259]

[0260] in: is the output of the Transformer encoder; is the weight coefficient; is the offset.

[0261] S223: Construct graph data.

[0262] Use the output of linear mapping layer 1 to construct the graph data Graph_x1. For each sample of the output of the first linear mapping layer, use each feature to make a node of the graph, recorded as:

[0263]

[0264] in: is the node matrix, i.e., the output of the first linear mapping layer; Indicates Node, that is, samples.

[0265] The correlation coefficient between the two features is used as the edge, which is recorded as:

[0266]

[0267] in: is the edge matrix; For the Strip edge.

[0268] The graph data is represented as:

[0269]

[0270] in: Represents the constructed graph data.

[0271] The correlation coefficient is calculated as follows: The correlation coefficient of the sample is represented by the letter r, which is used to measure the linear relationship between two variables X and Y. The calculation formula is:

[0272]

[0273] in: represents the covariance, and represents variance, and the square root represents standard deviation. That is:

[0274]

[0275] By analogy, the constructed graph data Graph_x1 is . Input the constructed graph data Graph_x1 into GraphSAGE layer 1 and obtain the output result graphSage_output_1.

[0276] In this step, GraphSAGE layer 1 is as follows: Given graph data Graph_x1= , is the input feature; For depth, is an adjustable parameter, is the weight matrix, is a nonlinear activation function, The aggregation function used in this embodiment is the Pooling aggregator, which is both symmetric and trainable. The Pooling aggregator first performs a nonlinear transformation on the embedding vectors of the neighboring vertices of the target vertex, then performs a pooling operation, concatenates the result with the representation vector of the target vertex, and finally performs another nonlinear transformation to obtain the next layer representation vector of the target vertex. is the neighborhood function, that is express neighbor nodes. is the output vector representation of the node.

[0277] S224: Build a Pooling aggregator.

[0278] The Pooling aggregator is used to perform nonlinear transformation on the graph data. For each node, there are:

[0279]

[0280]

[0281] in: Indicates that through the aggregation function The result obtained by aggregating the feature vectors of the neighboring nodes of node v at the k-1 layer; Represents the feature vector of node v at the kth layer, which is obtained by concatenating the feature vector of node v itself at the k-1th layer and the aggregated feature vector of its neighboring nodes at the kth layer, and then passing through the weight matrix and nonlinear activation function get; Represents the feature vector of node u at the k-1 layer; Represents the feature vector of node v at the k-1th layer; is an aggregate function; is the concatenation function, which concatenates two vectors together; is the neighborhood function; express Neighbor nodes of is a nonlinear activation function; is the weight matrix; , Indicates the index of the current layer, from 1 to K.

[0282] The initial hidden layer vector is: , Represents the initial feature vector of node v.

[0283] No. The hidden layer vector at depth is: .

[0284] The output vector of each node represents .

[0285] S225: Construct a second linear mapping layer.

[0286] The output of the Pooling aggregator It is expanded into a vector and after passing through the second linear mapping layer, the output result of the basic model is obtained.

[0287] S23: Pre-train the basic model using the pre-training dataset to obtain a pre-training model.

[0288] Specifically, in this embodiment, the pre-training data set is put into the basic model for training after the data volume is expanded through data enhancement, and the training is accelerated using a graphics card to obtain a trained basic model, which can also be called a pre-training model.

[0289] S24: Pre-trained model fine-tuning.

[0290] S241: Construct the Sprompt dataset.

[0291] The Sprompt dataset is represented as:

[0292] promptDataset={prompt,feature,label}

[0293] Among them: prompt is a description statement, specifically, it can be prompt = "Predict the short-term power of the photovoltaic field based on the provided data set, where the installed capacity is 60, and the accuracy needs to be determined according to the North China regulations" and other description statements; feature is historical data; label is the future data of actual power.

[0294] S242: Use the Sprompt dataset to fine-tune the pre-trained model, train a supervised learning model, and obtain the SFT model.

[0295] S25: Collect human feedback data and train reward model.

[0296] S251: Human feedback data.

[0297] Sample from the prompt database and get answers from several models; annotators score or rank multiple outputs of the model, which are generated based on the same prompt, to obtain comparative data.

[0298] Comparison data consists of the scores or rankings given by annotators to the model outputs. These scores or rankings are used to train a reward model (RM), which can predict the human preference scores for different outputs.

[0299] S252: Reward model.

[0300] The reward model is derived from the reward function in reinforcement learning. It can describe the current state with a score to show how much value this state generates. The reward model in the fine-tuning of the large language model calculates a score for the input question and answer. The higher the match between the input answer and the question, the higher the score output by the reward model.

[0301] The reward model replaces the softmax in the last layer of the SFT model with a linear layer. The input of the reward model is the question and the answer, and the output is a scalar. The reward model is trained using comparative data, and can predict human preference scores for different outputs.

[0302] The training data of the reward model is the manual ranking of each answer to the question. For each question, several answers are given, and then the workers rank them. The reward model uses the ranking results for back propagation training. The loss function of the reward model uses Pairwise Ranking Loss. In this embodiment, the loss function of the reward model is:

[0303]

[0304] in: A dataset for manually ranking answers; is the problem in dataset D; The number of answers corresponding to each question; and Separate issues Corresponding Two of the answers, and The sort ratio high; Represents the reward model for a pair of inputs and The resulting scalar score; The parameters that need to be optimized for the reward model.

[0305] S26: Optimize the reward model using PPO reinforcement learning.

[0306] After the large language model completes the training of the reward model, the next stage is to train the reinforcement learning model (RL model).

[0307] S261: Build RL model.

[0308] The initial model of the RL model uses a large language pre-training model after fine-tuning the SFT model.

[0309] S262: Train the RL model.

[0310] Another sample is taken from the prompt database, and the sampled question set is input into the RL model, and the answer text is generated by the RL model; the questions and answers are input into the reward model for scoring to evaluate the quality of the generated answer text, and the PPO algorithm is used to optimize the RL model.

[0311] Proximal Policy Optimization (PPO): Proximal Policy Optimization algorithm, a policy optimization method for reinforcement learning. PPO (Proximal Policy Optimization) algorithm optimizes the set objective function through stochastic gradient descent. Proximal Policy Optimization is a deep reinforcement learning algorithm used to train intelligent agents to learn and perform tasks in complex environments. Through the training of intelligent agents, they can maximize the cumulative rewards in their interactions with the environment, thereby achieving the specified task objectives. The intelligent agent here refers to the RL model in the large language model.

[0312] The dataset for training the RL model only needs to collect the question set (prompt set), and there is no need to annotate the questions. The question set generates the answer text through the RL model, and then the questions and answers are input into the RM model trained in the previous step for scoring to evaluate the quality of the generated text. The goal of training the RL model is to make the generated text get the highest possible score on the RM model.

[0313] Modeling the fine-tuning task of the initial language model as a reinforcement learning (RL) problem requires defining basic elements such as policy, action space, and reward function. Specifically, the policy is based on the language model, receives prompt as input, and then outputs a series of texts (or the probability distribution of texts); the action space is the permutation and combination of all tokens in the vocabulary at all output positions; the observation space is the possible input token sequence (i.e. prompt), which is the permutation and combination of all tokens in the vocabulary at all input positions; and the reward function is the reward calculation performed by the trained RM model in conjunction with some policy-level constraints.

[0314] In this embodiment, the loss function of RL model training is:

[0315]

[0316] in: represents the SFT model; Indicates the model that needs to be adjusted. In reinforcement learning, the model is called Policy, which is the final model. The initial model is ; is a problem in the RL dataset; yes pass The answer obtained by the model; Represents the reward model for a pair of inputs and The resulting scalar score; Representation problem pass Get the answer The probability that for each The prediction and its Multiply the output of Representation problem pass Get the answer The probability of express It is the data from the pre-training stage of the large language model; and These are adjustment factors.

[0317] The optimization goal of the RL model is to make the loss function as large as possible. The loss function can be divided into three parts: the scoring part, the KL divergence part, and the pre-training part.

[0318] Scoring part: The problem dataset x of the RL model is The model gets the answer y, and then substitutes the pair (x, y) into the RW model for scoring, that is, The higher the score, the better the answer generated by the model.

[0319] KL divergence part: After each parameter update, will change, x through The generated y will also change, and The reward model is based on The model is trained with data. and Too much difference will lead to The score estimate is not accurate. Therefore, it is necessary to calculate it through KL divergence. The generated answer distribution and The distance between the generated answer distributions makes the two models not too far apart. This is to calculate the KL divergence. Since the smaller the KL divergence, the better, and the training goal is to make the loss function as large as possible, a minus sign is needed in front of it.

[0320] Pre-training part: The pre-training part corresponds to the loss function Without this item, the model may only be able to perform well on this one task, and performance may degrade on other tasks. Therefore, the objective function of the pre-training phase needs to be added so that the previous two parts can be fitted on the new data set while ensuring that the original data is not discarded.

[0321] The final optimized The model is the final model of the large language model.

[0322] Step S24 and step S25 can be performed iteratively to continuously improve the performance and alignment of the model, and obtain the best model for prediction.

[0323] Step 3: Build a fusion model.

[0324] Construct a fusion model, which is used to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model, and obtain the final forecast result of photovoltaic power generation. Specifically, the fusion model adopts dynamic selection, weighted average or adaptive adjustment strategy to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model to obtain the final forecast result. The principle of the fusion model is:

[0325] y prediction = f (y based on seasonal weather classification module, y based on RLHF large model module)

[0326] Where: f is a selectable method, such as weighted average, adaptive adjustment, etc. y prediction is the final photovoltaic power prediction result.

[0327] like Figure 2 As shown, this embodiment also proposes a photovoltaic power prediction system based on seasonal weather classification and RLHF large model, including:

[0328] The weather classification and photovoltaic output prediction module divides a year into multiple seasons according to meteorological parameters, and subdivides the weather into several weather types, and constructs a photovoltaic output prediction model for each weather type in each season. Specifically, the weather classification and photovoltaic output prediction module is provided with a weather classification and photovoltaic output prediction model, which is constructed by the method of the aforementioned steps S11-S16 of this embodiment.

[0329] The RLHF large model module uses a method combining deep learning and reinforcement learning to improve the prediction accuracy and interpretability of photovoltaic power generation through pre-training and human feedback. In this embodiment, the RLHF large model module is provided with a RLHF large model, and the RLHF large model is constructed using the aforementioned steps S21-S26 of this embodiment.

[0330] The fusion module is used to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model, and obtain the final forecast result of photovoltaic power generation. Specifically, the fusion model adopts dynamic selection, weighted average or adaptive adjustment strategy to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model to obtain the final forecast result. The principle of the fusion model is:

[0331] y prediction = f (y based on seasonal weather classification module, y based on RLHF large model module)

[0332] Where: f is a selectable method, such as weighted average, adaptive adjustment, etc. y prediction is the final photovoltaic power prediction result.

[0333] In summary, this embodiment, by combining seasonal weather classification with the RLHF large model technology, not only improves the accuracy of photovoltaic power prediction, but also demonstrates greater robustness and flexibility when facing complex and changeable actual scenarios.

[0334] Finally, the predicted value is compared with the actual value to obtain the prediction effect evaluation, such as Figure 3 The figure shows the comparison between the predicted data and the actual data.

[0335] The results of the ablation experiment are shown in Table 1, which compares the prediction effects of different models with the method of this embodiment. The evaluation indicators are mean square error (MSE), absolute percentage error (MAPE), mean absolute error (MAE), root mean square error (RMSE), and R2score value.

[0336] Table 1 Comparison of ablation experiment results

[0337] Prediction Model MSE RMSE MAE MAPE R2score Use only the weather classification module 5.0729 2.2523 3.9077 3.6767 0.8890 Use only seasonal weather patterns 6.1341 2.4767 3.8899 3.9589 0.9123 Using only the base model 6.6337 2.5756 3.6587 3.1344 0.9255 Only use large RLHF-based models 4.9040 2.2145 3.1357 3.7080 0.9377 Only the seasonal weather classification module and the RLHF-based large model prediction value are used to average (without using the model fusion module) 5.4989 2.3456 2.6788 2.9923 0.9489 This embodiment model 3.8632 1.9655 1.6789 2.9027 0.9587

[0338] From the ablation experiment comparison table, it can be seen that the R2score of using only the weather classification module is 0.8890, the R2score of using only the seasonal weather classification module is 0.9123, the R2score of using only the basic model is 0.9255, the R2score of using only the large model based on RLHF is 0.9377, and the R2score of using only the seasonal weather classification module and the large model based on RLHF to average the predicted value (without using the model fusion module) is 0.9489. The R2score value of this embodiment is 0.9587. The smaller the value of other evaluation indicators, the better the model. The effect of using only the weather classification module is the worst. After introducing seasonality and combining the two into using only the seasonal weather classification module, the prediction effect is improved. The effect of only the basic module is not as good as using only the large model based on RLHF. Combining the two modules, only using the seasonal weather classification module and the large model prediction value based on RLHF to average (without using the model fusion module) is better, but still lower than using the composite structure of the three. The biggest feature of this embodiment is that the three modules are combined, integrating the advantages of deep learning (DL), large models, reinforcement learning (RL), human feedback (HF), and meteorological factors. By introducing seasonal weather classification and large model technology based on RLHF, a prediction system that can be adaptively adjusted and continuously optimized is constructed. At the same time, it is also a correction of the results of two different ideas, which is equivalent to a more advanced integrated model idea, thereby improving the prediction effect.

[0339] This example also compares the mean square error (MSE), absolute percentage error (MAPE), mean absolute error (MAE), root mean square error (RMSE), and R2score values ​​of Informer, AutoEncoders, and this example. Figure 4 And as shown in Table 2.

[0340] Table 2 Model comparison experiment

[0341] Prediction Model MSE RMSE MAE MAPE R2score Informer 4.4564 2.7686 3.5686 4.0807 0.9108 AutoEncoders 5.8687 2.6876 3.1234 3.5474 0.9143 This embodiment model 3.8632 1.9655 1.6789 2.9027 0.9587

[0342] It can be seen from the comparative experiment that the R2score of the Informer model is 0.9108, the R2score of the AutoEncoders model is 0.9143, and the R2score of this embodiment is 0.9587. The smaller the value of other evaluation indicators, the better the model. Among them, the prediction effect of the AutoEncoders model is the worst, which may be because only historical power data is used without learning information about other features. The prediction effect of the Informer model is better. Compared with LSTM, Informer adopts an attention mechanism and can better learn sequence information. The prediction effect of the present invention is the best. The present invention designs a new prediction model structure, combines the advantages of the three modules, and incorporates more useful information from the perspective of representation learning, thereby further improving the accuracy of the prediction.

[0343] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.

Claims

1. A photovoltaic power prediction method based on seasonal weather classification and RLHF large model, characterized by: The steps include: Step 1: Data Acquisition Obtain the power generation data of the photovoltaic power station and the historical meteorological data of the area where the photovoltaic power station is located, and build a data set; Step 2: Build a prediction model Constructing a weather classification and photovoltaic output prediction model, wherein the weather classification and photovoltaic output prediction model divides a year into multiple seasons according to meteorological parameters, and subdivides the weather into several weather types, and constructs a photovoltaic output prediction model for each weather type in each season; Constructing a RLHF large model, which uses a combination of deep learning and reinforcement learning to improve the accuracy and interpretability of photovoltaic power generation prediction through pre-training and human feedback; Step 3: Build a fusion model Constructing a fusion model, wherein the fusion model is used to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model, and obtain the final forecast result of photovoltaic power generation; In step 2, the method steps for constructing a weather classification and photovoltaic output prediction model are as follows: S11: Data collection and preprocessing Collect historical meteorological data of the area where the photovoltaic power station is located from the data set, and ensure that the historical meteorological data covers all four seasons; clean and standardize the historical meteorological data, remove outliers and / or fill in missing values, and obtain a weather classification data set; S12: Introducing seasonal factors Based on the sky condition factor SCF, the seasonal factor SF is introduced to integrate seasonal changes into the weather classification process to form a new weather classification index: in: It is a weather classification indicator; is the sky condition factor; is the seasonal factor; S13: Extended weather classification According to weather classification indicators , re-evaluate the clear / cloudy boundary, add season labels to the weather classification dataset, and mark the season and weather type corresponding to each time point; S14: Building a weather type classification model A weather classification model is constructed based on a self-organizing map neural network. The weather classification model is trained using a weather classification dataset with season labels added. The season-weather type matrix of the photovoltaic power station area is obtained using the weather classification model. S15: Building a photovoltaic output prediction model According to the season-weather type matrix of the region where the photovoltaic power station is located, the weather classification data set is divided into several subsets, and several photovoltaic output data subsets are obtained by combining the photovoltaic power generation power corresponding to each time point; a photovoltaic output prediction model is constructed using a deep learning model, and each photovoltaic output data subset is used to train the photovoltaic output prediction model to obtain a photovoltaic output prediction model for each weather type in each season; S16: Photovoltaic output forecast According to the input real-time meteorological data, the weather type classification model is used to divide the seasons and weather types, and the corresponding photovoltaic output prediction model is used to obtain the photovoltaic output prediction result.

2. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 1 is characterized by: In step S12, the sky condition factor SCF is: in: , , and They represent the weights of the meteorological variables of total cloud cover, temperature, humidity and wind speed respectively; , , and They represent the standardized or transformed functions of the meteorological variables of total cloud cover, temperature, humidity and wind speed, respectively; The seasonal factor SF is: in: represents the seasonal factor calculated in days; Indicates the seasonal factor calculated by month; Indicates time counted in days; Indicates the number of days in a year; Indicates a reference time point; and represent the amplitude and translation respectively; or, in: Indicates the seasonal factor calculated by month; Indicates the optimal value range for each season; the 'indicator' function returns 1 if the condition is met, otherwise it returns 0; The number of months in a year.

3. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 1 is characterized in that: In step S15, the method steps for constructing a photovoltaic output prediction model are as follows: S151: Data segmentation and annotation Label the historical meteorological data to mark the season and weather type corresponding to each time point; use the weather type classification model to divide the weather classification data set into multiple subsets according to season and weather type; S152: Feature selection and preprocessing For each subset, obtain the meteorological variables that can affect the photovoltaic output under the corresponding season and weather type conditions, and perform corresponding feature selection; standardize or normalize the selected features; S153: Model selection and configuration For each subset, a deep learning model is selected and the hyperparameters are adjusted to suit the specific season and weather type of the corresponding subset; S154: Training and Validation Use the cross-validation method to train and validate the model on each subset to ensure that the model has good generalization ability; save the optimal model corresponding to each season-weather type; S155: Integration and Fusion Ability to automatically select the most suitable model for the current season and weather type conditions to make forecasts based on real-time meteorological data; S156: Performance Evaluation and Feedback Regularly evaluate the performance of all models in actual operation and continuously improve the models.

4. The photovoltaic power prediction method based on seasonal weather typing and RLHF large model according to claim 1 is characterized in that: In step 2, the method steps for constructing the RLHF large model are: S21: Acquisition and construction of pre-training dataset Construct a pre-training dataset based on the dataset: pretrainDataset={feature,label} Among them: feature is data including historical actual power, numerical weather forecast and satellite cloud map; label is the actual power value of the previous day; Construct a sliding window data set (x1, y): x1[i]=concat(data['actual power','satellite cloud image'][i:i+t],data['numerical weather forecast data'][i+t:i+t+out_step_size] ) y[i]=data['actual power','satellite cloud image'][i+t :i+t+out_step_size] Among them: x1 represents the single variable characteristic of historical load, which is the concatenation value of historical actual power and future numerical weather forecast data; i is the number of currently generated data; y is the constructed output value; data contains all columns of the data set; data['actual power', 'satellite cloud image'] is the "actual power" and "satellite cloud image" in the data set; data['numerical weather forecast data'] is the "numerical weather forecast data" in the data set; concat represents the concatenation operation; t is the size of the sliding window, which is an adjustable parameter, that is, the historical data of the first t time steps are used to predict the data of the next out_step_size steps; out_step_size is the backward prediction step size, that is, it is necessary to predict out_step_size time steps backward; S22: Building the basic model The encoder part of Transformer is used as the main structure, and the basic model is built in combination with the neural network. The steps for building the basic model are as follows: S221: Building the Transformer Encoder The Transformer encoder receives an input matrix and outputs a matrix. Multiple encoders are stacked to form a multi-encoder. The input of the first encoder is a feature vector matrix, and the input of the subsequent encoder is the output of the previous encoder. S222: Construct the first linear mapping layer The output of the Transformer encoder passes through the first linear mapping layer to obtain the output result of the first linear mapping layer : in: is the output of the Transformer encoder; is the weight coefficient; is the offset; S223: Building graph data For each sample of the output result of the first linear mapping layer, each feature is used to make a node of the graph, recorded as: in: is the node matrix, i.e., the output of the first linear mapping layer; Indicates Node, that is, samples; The correlation coefficient between the two features is used as the edge, which is recorded as: in: is the edge matrix; For the strip edge; The graph data is represented as: in: Represents the constructed graph data; S224: Constructing Pooling Aggregator Use Pooling Aggregator to perform nonlinear transformation on graph data. For each node, there is: in: Indicates that through the aggregation function The result obtained by aggregating the feature vectors of node v’s neighbor nodes at the k-1 layer; Represents the feature vector of node v at the kth layer, which is obtained by concatenating the feature vector of node v itself at the k-1th layer and the aggregated feature vector of its neighboring nodes at the kth layer, and then passing through the weight matrix and nonlinear activation function get; Represents the feature vector of node u at the k-1 layer; Represents the feature vector of node v at the k-1th layer; is an aggregate function; is the concatenation function, which concatenates two vectors together; is the neighborhood function; express Neighbor nodes of is a nonlinear activation function; is the weight matrix; , Indicates the index of the current layer, from 1 to K; The initial hidden layer vector is: , represents the initial feature vector of node v; No. The hidden layer vector at depth is: ; The output vector of each node is represented ; S225: Construct the second linear mapping layer The output of the Pooling aggregator Expanded into a vector, after passing through the second linear mapping layer, the output result of the basic model is obtained; S23: pre-training the basic model using the pre-training data set to obtain a pre-training model; S24: Pre-trained model fine-tuning S241: Constructing the Sprompt dataset The Sprompt dataset is represented as: promptDataset={prompt,feature,label} Among them: prompt is a description statement; feature is historical data; label is the future data of actual power; S242: Fine-tune the pre-trained model using the Sprompt dataset to obtain the SFT model; S25: Collect human feedback data and train reward model S251: Human Feedback Data Sample from the prompt database and get answers from several models; annotators score or rank multiple outputs of the model to get comparative data; S252: Reward Model The reward model replaces the softmax in the last layer of the SFT model with a linear layer. The input of the reward model is the question and the answer, and the output is a scalar. The reward model is trained using comparative data, and the reward model can predict the preference scores of humans for different outputs. S26: Optimizing the reward model using PPO reinforcement learning S261: Building RL Models The initial model of the RL model uses a large language pre-training model after fine-tuning the SFT model; S262: Train the RL model to sample additional questions from the prompt database, input the sampled question set into the RL model, and generate answer text by the RL model; input the questions and answers into the reward model for scoring to evaluate the quality of the generated answer text, and use the PPO algorithm to optimize the RL model.

5. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 4 is characterized in that: In step S221, the encoder of the Transformer includes an input layer, an attention layer, a summation and normalization layer, and a feedforward neural network layer; the principle of the encoder of the Transformer is: Input the historical load univariate feature x1 into the input layer and get: in: represents the encoding of the input features, Represents the result obtained after passing through the input layer; Represents the position embedding layer; Indicates the position of the data in the time series; express Dimensions; represents an even number of dimensions; represents an odd dimension; and: 2i≤d, 2i+1≤d; In the attention layer, the query vector Q, key vector K, and value vector V are mapped from the features respectively: ,K= , V= in: is the weight matrix; attention calculation: in, is the number of columns of the Q and K matrices, i.e. the vector dimension; Calculate the multi-head self-attention mechanism: in: Represents the weight matrix, used for linear transformation; Indicates the number of attention heads; The summation and normalization layer is divided into two parts: the summation layer and the normalization layer. The summation layer is a residual connection; the normalization layer refers to layer normalization, which converts the input of each layer of neurons into a form with the same mean variance; it is expressed as: in: Represents the input of a multi-head attention or feedforward neural network; and Indicates output; The feedforward neural network layer includes two fully connected layers. The activation function of the first fully connected layer is the linear rectifier function Relu; the second fully connected layer does not use an activation function, which is expressed as: in: is the input of the feedforward neural network layer; the dimension of the output matrix finally obtained by the feedforward neural network is the same as Consistent.

6. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 4 is characterized by: In step S252, the loss function of the reward model is: in: A dataset for manually ranking answers; is the problem in dataset D; The number of answers corresponding to each question; and Separate issues Corresponding Two of the answers, and The sort ratio high; Represents the reward model for a pair of inputs and The resulting scalar score; The parameters that need to be optimized for the reward model.

7. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 4 is characterized by: In step S262, the loss function of RL model training is: in: represents the SFT model; Indicates the model that needs to be adjusted; is a problem in the RL dataset; yes pass The answer obtained by the model; Represents the reward model for a pair of inputs and The resulting scalar score; Representation problem pass Get the answer probability; Representation problem pass Get the answer probability; express It is the data from the pre-training stage of the large language model; and Both are adjustment factors.

8. The photovoltaic power prediction method based on seasonal weather classification and RLHF large model according to claim 1 is characterized by: In the step three, the fusion model adopts dynamic selection, weighted average or adaptive adjustment strategy to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model to obtain the final forecast result.

9. A photovoltaic power prediction system based on seasonal weather classification and RLHF large model, characterized by: The photovoltaic power prediction system is used to execute the photovoltaic power prediction method according to any one of claims 1 to 8; the photovoltaic power prediction system comprises: The weather classification and photovoltaic output prediction module divides a year into multiple seasons based on meteorological parameters, and subdivides the weather into several weather types, and builds a photovoltaic output prediction model for each weather type in each season; The RLHF large model module uses a combination of deep learning and reinforcement learning to improve the accuracy and interpretability of photovoltaic power prediction through pre-training and human feedback; The fusion module is used to fuse the forecast outputs of the weather classification and photovoltaic output forecast model and the RLHF large model, and obtain the final forecast result of photovoltaic power generation.

Citation Information

Patent Citations

  • Photovoltaic power generation energy storage control method and system based on AI group control technology

    CN118889694A

  • Short-term photovoltaic power generation power prediction method adapting to weather change

    CN119401402A