A photovoltaic power generation prediction method and system based on large language model
By constructing a photovoltaic power generation prediction model based on a large language model, the problem that traditional methods are difficult to deal with complex nonlinear relationships is solved, higher data quality and prediction accuracy are achieved, and the operation efficiency and economic benefits of the photovoltaic power generation system are improved.
Patent Information
- Application Number
- CN202411740296.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-04
AI Technical Summary
Traditional photovoltaic power generation prediction methods are difficult to deal with complex nonlinear relationships, resulting in insufficient data quality requirements, model training time and generalization capabilities, which cannot meet the actual application needs.
Using a large language model-based approach, a photovoltaic power generation prediction model was constructed using the GPT-4 model and the recurrent neural network RNN, and the model parameters were optimized through training, verification and test sets.
It improves the accuracy and stability of data quality and model prediction, saves time and energy in manual code writing, and is conducive to the operation management and economic benefit evaluation of photovoltaic power generation systems.
Smart Images

Figure CN119765272A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of photovoltaic power generation technology, and in particular to a photovoltaic power generation prediction method and system based on a large language model. Background Art
[0002] With the support of the state for the development of new energy industry, photovoltaic power generation has been widely used as an important form of renewable energy utilization. However, photovoltaic power generation is affected by many complex factors such as light intensity, temperature, weather conditions, etc., and its power generation has significant intermittent and volatile characteristics. This not only brings challenges to the stable operation of the power system, but also causes many inconveniences in energy planning and scheduling. Accurate photovoltaic power generation prediction has become a current research hotspot. Photovoltaic power generation prediction is an estimate of power generation in the future. It is an important part of the energy management system. Accurate prediction of power generation in the future is of great significance for the reasonable arrangement of power generation plans, saving electricity costs and power generation costs. Although traditional prediction methods can process some linear data, they are difficult to deal with complex nonlinear relationships. There is still room for optimization and improvement in data quality requirements, model training time and generalization ability to better meet the needs of actual applications. Summary of the invention
[0003] One or more embodiments of this specification provide a photovoltaic power generation prediction method based on a large language model, including:
[0004] include:
[0005] Collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into training set, verification set and test set;
[0006] Select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model;
[0007] Using the training set to train the photovoltaic power generation prediction model, and using the verification set to verify the photovoltaic power generation prediction model, and updating the parameters of the photovoltaic power generation prediction model according to the verification results;
[0008] The verified photovoltaic power generation prediction model is tested using the test set, the prediction performance of the photovoltaic power generation prediction model is evaluated, and the photovoltaic power generation prediction model after the test is applied to predict the photovoltaic power generation.
[0009] Furthermore, the historical meteorological data includes historical solar irradiance, sunshine duration, temperature, humidity, wind speed, wind direction and air pressure data of the location of the photovoltaic power station;
[0010] The historical power generation data includes the actual power generation and power generation of the photovoltaic power station in different time periods.
[0011] Furthermore, preprocessing the collected data specifically includes:
[0012] Aligning the historical meteorological data and the historical power generation data according to timestamps;
[0013] Clean the aligned meteorological data and photovoltaic power generation data to remove outliers and missing values;
[0014] The data is normalized to convert data of different magnitudes to the same magnitude range.
[0015] Furthermore, the GPT-4 model is selected, and the recurrent neural network RNN is introduced to construct a photovoltaic power generation prediction model. The specific method is as follows:
[0016] Call the GPT-4 large language model and establish a dialogue function to interact with it;
[0017] Through the dialogue function, the photovoltaic power generation prediction model related information is input into the large language model in the form of prompt text, including the name of the photovoltaic power generation prediction model, the neural network structure, the names of the input data and the output data, and the amount of training data;
[0018] The large language model automatically converts the relevant information of the photovoltaic power generation prediction model into corresponding codes, identifies the start and end symbols of the codes, intercepts the complete code segment, and obtains the photovoltaic power generation prediction model.
[0019] Furthermore, the specific method of using the training set to train the photovoltaic power generation prediction model is as follows:
[0020] Using the training set to train the photovoltaic power generation prediction model according to the set training parameters and loss function, the training parameters include the number of training epochs, learning rate, training batch size, and optimizer;
[0021] Set the number of training epochs to 50, the learning rate to 0.1, and the training batch size to 64;
[0022] The Adam optimizer was selected to minimize the loss function, and the mean square error loss function and optimization algorithm were used to adjust the parameters of the photovoltaic power generation prediction model to complete the model training.
[0023] Furthermore, the verified photovoltaic power generation prediction model is tested using the test set, and the prediction performance of the photovoltaic power generation prediction model is evaluated. The specific method is as follows:
[0024] The degree of deviation between the model prediction result and the actual value is calculated by evaluation indicators, and the evaluation indicators include root mean square error RMSE, mean absolute error MAE and mean absolute percentage error MAPE.
[0025] Furthermore, the optimization algorithm is a stochastic gradient descent algorithm.
[0026] One or more embodiments of this specification provide a photovoltaic power generation prediction system based on a large language model, including:
[0027] Data acquisition module: used to collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into training set, verification set and test set;
[0028] Model building module: used to select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model;
[0029] Model training module: used to train the photovoltaic power generation prediction model using the training set, verify the photovoltaic power generation prediction model using the verification set, and update the parameters of the photovoltaic power generation prediction model according to the verification results;
[0030] Model prediction module: used to test the verified photovoltaic power generation prediction model using the test set, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict photovoltaic power generation.
[0031] One or more embodiments of the present specification provide an electronic device, including:
[0032] processor; and,
[0033] A memory arranged to store computer executable instructions, which, when executed, cause the processor to implement the steps of the photovoltaic power generation prediction method based on a large language model.
[0034] One or more embodiments of the present specification provide a storage medium for storing computer executable instructions, which, when executed, implement the steps of the photovoltaic power generation prediction method based on a large language model.
[0035] By adopting the embodiment of the present invention, the data quality is improved by preprocessing the collected historical meteorological data and historical photovoltaic power generation data; based on the good text comprehension and code output capabilities of the large language generation model, the GPT-4 model is selected to assist in building a photovoltaic power generation prediction model that introduces the convolutional neural network RNN, which can quickly generate a more reasonable model framework code according to demand, saving the time and energy of manual code writing; by using the test set to test the verified model, the prediction performance of the model can be objectively and accurately evaluated, and the accuracy and stability of the model prediction can be improved; it is beneficial to the operation management, power dispatching and economic benefit evaluation of the photovoltaic power generation system, and the power output can be planned in advance, the equipment maintenance can be reasonably arranged, and the overall operation efficiency and economy of the photovoltaic power generation system can be improved.
[0036] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0038] Figure 1 A flowchart of a photovoltaic power generation prediction method based on a large language model provided for one or more embodiments of this specification;
[0039] Figure 2 A schematic diagram of the composition of a photovoltaic power generation prediction system based on a large language model provided for one or more embodiments of this specification;
[0040] Figure 3 A schematic diagram of the structure of an electronic device provided for one or more embodiments of this specification. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0042] Method Embodiment
[0043] According to an embodiment of the present invention, a photovoltaic power generation prediction method based on a large language model is provided. Figure 1 A flowchart of a photovoltaic power generation prediction method based on a large language model is provided for one or more embodiments of this specification, such as Figure 1 As shown, the photovoltaic power generation prediction method based on the large language model according to an embodiment of the present invention specifically includes:
[0044] S1. Collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into a training set, a validation set, and a test set.
[0045] Obtain historical meteorological data of the location of the photovoltaic power station from professional meteorological agencies or meteorological monitoring stations. The historical meteorological data includes historical solar irradiance, sunshine duration, temperature, humidity, wind speed, wind direction and air pressure data of the location of the photovoltaic power station. The time resolution of these data can be determined according to actual needs, such as hourly, daily or monthly data. Use meteorological sensors to collect real-time meteorological data in the photovoltaic power station to ensure the timeliness and accuracy of the data.
[0046] The historical power generation data is obtained from the monitoring system of the photovoltaic power station, wherein the historical power generation data includes the actual power generation and power generation of the photovoltaic power station in different time periods.
[0047] Preprocess the collected data, including:
[0048] Aligning the historical meteorological data and the historical power generation data according to timestamps;
[0049] Clean the aligned meteorological data and photovoltaic power generation data to remove outliers and missing values. Outliers may be erroneous data caused by sensor failure or extreme weather, and can be identified and corrected through data statistical analysis methods, such as setting data thresholds or machine learning-based anomaly detection algorithms. Missing values can be processed by mean filling or interpolation methods, such as linear interpolation or spline interpolation.
[0050] The cleaned data is normalized to convert data of different magnitudes to the same magnitude range. For example, the solar irradiance data is normalized to between 0 and 1 to improve the training efficiency and prediction accuracy of the model.
[0051] S2. Select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model.
[0052] The recurrent neural network (RNN) is introduced to enable the model to better learn the laws of changes in meteorological data and photovoltaic power generation data over time, call the GPT-4 large language model, and establish a dialogue function for interacting with it;
[0053] Through the dialogue function, the photovoltaic power generation prediction model related information is input into the large language model in the form of prompt text, including the name of the photovoltaic power generation prediction model, the neural network structure, the name of the input data and the output data, and the amount of training data, such as "Please use Python language combined with the recurrent neural network RNN to build a photovoltaic power generation prediction model framework code. The input data includes historical solar irradiance, sunshine duration, temperature, humidity, wind speed, wind direction, air pressure data, actual power generation, power generation and time series information. The output is the predicted value of photovoltaic power generation in the future. The data has been preprocessed into a standardized format, and the data dimension and format are...";
[0054] The large language model automatically converts the relevant information of the photovoltaic power generation prediction model into corresponding codes, identifies the start and end symbols of the codes, intercepts the complete code segment, and obtains the photovoltaic power generation prediction model.
[0055] S3. Use the training set to train the photovoltaic power generation prediction model, and use the verification set to verify the photovoltaic power generation prediction model, and update the parameters of the photovoltaic power generation prediction model according to the verification results.
[0056] The preprocessed meteorological data and photovoltaic power generation data are divided into a training set, a validation set and a test set according to a certain ratio. In this embodiment, 70% of the data is used as a training set, 20% of the data is used as a validation set, and 10% of the data is used as a test set.
[0057] Feature engineering is performed on the data in the training set to extract features closely related to photovoltaic power generation. In addition to the original meteorological data and historical power generation data, some derived features can also be calculated, such as the rate of change of solar irradiance, the daily temperature difference, and the average power generation in the previous few days, to help the model better capture the potential patterns in the data and improve the accuracy of predictions.
[0058] The photovoltaic power generation prediction model is trained using the training set according to the set training parameters and loss function, and the training parameters of the model are adjusted using a suitable loss function (such as mean square error loss function) and optimization algorithm (such as stochastic gradient descent algorithm).
[0059] The training parameters include the number of training rounds epochs, learning rate, training batch size Batch Size and optimizer; the number of training rounds epochs is set to 50, the learning rate is set to 0.1, and the training batch size Batch Size is set to 64; the Adam optimizer is selected to minimize the loss function, and the mean square error loss function and optimization algorithm are used to adjust the parameters of the photovoltaic power generation prediction model to complete the model training.
[0060] The photovoltaic power generation prediction model is verified by the verification set, and the parameters of the photovoltaic power generation prediction model are updated according to the verification results. The early stopping method is used to prevent the model from overfitting. When the performance indicators of the verification set no longer improve within several consecutive training cycles, the training is stopped and the model parameters with the best current performance are saved.
[0061] In order to improve the accuracy of the prediction results, in an instance, multiple large language models with different structures or parameters can be trained, and their prediction results can be weighted averaged or voted to obtain the final prediction result.
[0062] S4. Use the test set to test the verified photovoltaic power generation prediction model, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict photovoltaic power generation.
[0063] The degree of deviation between the model prediction result and the actual value is calculated by calculating the evaluation indicators, which include the root mean square error RMSE, the mean absolute error MAE and the mean absolute percentage error MAPE. The accuracy and reliability of the current model prediction are evaluated. When the calculated evaluation index is less than the preset threshold, it means that the performance of the current photovoltaic power generation prediction model meets the standard.
[0064] The real-time meteorological data collected at the current moment and the historical power generation data of the recent period are input into the photovoltaic power generation prediction model with performance standards, and the photovoltaic power generation or power generation in one or more future time periods is predicted based on these data.
[0065] The beneficial effects of the present invention are as follows:
[0066] The present invention improves the data quality by preprocessing the collected historical meteorological data and historical photovoltaic power generation data; based on the good text comprehension and code output capabilities of the large language generation model, the GPT-4 model is selected to assist in building a photovoltaic power generation prediction model that introduces a convolutional neural network RNN, which can quickly generate a more reasonable model framework code according to demand, saving the time and energy of manual code writing; by using a test set to test the verified model, the prediction performance of the model can be objectively and accurately evaluated, and the accuracy and stability of the model prediction can be improved; it is beneficial to the operation management, power dispatching and economic benefit evaluation of the photovoltaic power generation system, and can plan power output in advance, arrange equipment maintenance reasonably, and improve the overall operation efficiency and economic benefits of the photovoltaic power generation system.
[0067] System Example
[0068] According to an embodiment of the present invention, a photovoltaic power generation prediction system based on a large language model is provided. Figure 2 A schematic diagram of a photovoltaic power generation prediction system based on a large language model provided in one or more embodiments of this specification, such as Figure 2 As shown, the photovoltaic power generation prediction system based on the large language model according to an embodiment of the present invention specifically includes:
[0069] Data collection module 20: used to collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into a training set, a verification set, and a test set;
[0070] Model building module 22: used to select the GPT-4 model, introduce the recurrent neural network RNN, and build a photovoltaic power generation prediction model;
[0071] Model training module 24: used to train the photovoltaic power generation prediction model using the training set, verify the photovoltaic power generation prediction model using the verification set, and update the parameters of the photovoltaic power generation prediction model according to the verification results;
[0072] Model prediction module 26: used to test the verified photovoltaic power generation prediction model using the test set, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict the photovoltaic power generation.
[0073] The embodiment of the present invention is a system embodiment corresponding to the above-mentioned method embodiment. The specific operations of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0074] Device Example 1
[0075] An embodiment of the present invention provides an electronic device, such as Figure 3As shown, it includes: a memory 30, a processor 32, and a computer program stored in the memory 30 and executable on the processor 32. When the computer program is executed by the processor 32, the following method steps are implemented:
[0076] S1. Collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into a training set, a validation set, and a test set;
[0077] S2. Select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model;
[0078] S3. Using the training set to train the photovoltaic power generation prediction model, and verifying the photovoltaic power generation prediction model through the verification set, and updating the parameters of the photovoltaic power generation prediction model according to the verification results;
[0079] S4. Use the test set to test the verified photovoltaic power generation prediction model, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict photovoltaic power generation.
[0080] Device Example 2
[0081] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by the processor 32, the following method steps are implemented:
[0082] S1. Collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into a training set, a validation set, and a test set;
[0083] S2. Select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model;
[0084] S3. Using the training set to train the photovoltaic power generation prediction model, and verifying the photovoltaic power generation prediction model through the verification set, and updating the parameters of the photovoltaic power generation prediction model according to the verification results;
[0085] S4. Use the test set to test the verified photovoltaic power generation prediction model, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict photovoltaic power generation.
[0086] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A photovoltaic power generation prediction method based on a large language model, characterized in that: include: Collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into training set, verification set and test set; Select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model; Using the training set to train the photovoltaic power generation prediction model, and using the verification set to verify the photovoltaic power generation prediction model, and updating the parameters of the photovoltaic power generation prediction model according to the verification results; The verified photovoltaic power generation prediction model is tested using the test set, the prediction performance of the photovoltaic power generation prediction model is evaluated, and the photovoltaic power generation prediction model after the test is applied to predict the photovoltaic power generation.
2. The method according to claim 1, characterized in that The historical meteorological data include historical solar irradiance, sunshine duration, temperature, humidity, wind speed, wind direction and air pressure data of the location of the photovoltaic power station; The historical power generation data includes the actual power generation and power generation of the photovoltaic power station in different time periods.
3. The method according to claim 2, characterized in that The preprocessing of the collected data specifically includes: Aligning the historical meteorological data and the historical power generation data according to timestamps; Clean the aligned meteorological data and photovoltaic power generation data to remove outliers and missing values; The data is normalized to convert data of different magnitudes to the same magnitude range.
4. The method according to claim 1, characterized in that: Select the GPT-4 model, introduce the recurrent neural network RNN, and build a photovoltaic power generation prediction model. The specific method is: Call the GPT-4 large language model and establish a dialogue function to interact with it; Through the dialogue function, the photovoltaic power generation prediction model related information is input into the large language model in the form of prompt text, including the name of the photovoltaic power generation prediction model, the neural network structure, the names of the input data and the output data, and the amount of training data; The large language model automatically converts the relevant information of the photovoltaic power generation prediction model into corresponding codes, identifies the start and end symbols of the codes, intercepts the complete code segment, and obtains the photovoltaic power generation prediction model.
5. The method according to claim 1, characterized in that The specific method for training the photovoltaic power generation prediction model using the training set is as follows: Using the training set to train the photovoltaic power generation prediction model according to the set training parameters and loss function, the training parameters include the number of training epochs, learning rate, training batch size, and optimizer; Set the number of training epochs to 50, the learning rate to 0.1, and the training batch size to 64; The Adam optimizer was selected to minimize the loss function, and the mean square error loss function and optimization algorithm were used to adjust the parameters of the photovoltaic power generation prediction model to complete the model training.
6. The method according to claim 1, characterized in that The verified photovoltaic power generation prediction model is tested using the test set, and the prediction performance of the photovoltaic power generation prediction model is evaluated by the following specific methods: The degree of deviation between the model prediction result and the actual value is calculated by evaluation indicators, and the evaluation indicators include root mean square error RMSE, mean absolute error MAE and mean absolute percentage error MAPE.
7. The method according to claim 5, characterized in that The optimization algorithm is a stochastic gradient descent algorithm.
8. A photovoltaic power generation prediction system based on a large language model, characterized in that: include: Data acquisition module: used to collect historical meteorological data and historical photovoltaic power generation data, pre-process the collected data, and divide the obtained data set into training set, verification set and test set; Model building module: used to select the GPT-4 model, introduce the recurrent neural network (RNN), and build a photovoltaic power generation prediction model; Model training module: used to train the photovoltaic power generation prediction model using the training set, verify the photovoltaic power generation prediction model using the verification set, and update the parameters of the photovoltaic power generation prediction model according to the verification results; Model prediction module: used to test the verified photovoltaic power generation prediction model using the test set, evaluate the prediction performance of the photovoltaic power generation prediction model, and use the tested photovoltaic power generation prediction model to predict photovoltaic power generation.
9. An electronic device, characterized in that: include: processor; as well as, A memory arranged to store computer executable instructions, wherein when the computer executable instructions are executed, the processor implements the steps of the photovoltaic power generation prediction method based on a large language model as claimed in any one of claims 1 to 7.
10. A storage medium, characterized in that: Used to store computer executable instructions, which, when executed, implement the steps of the photovoltaic power generation prediction method based on a large language model as described in any one of claims 1 to 7.
Citation Information
Cited By
Power consumption prediction method based on Time-LLM
CN120448714A
Photovoltaic intelligent spraying method and system based on Internet of Things
CN121349162A