A photovoltaic power prediction method based on K-nearest neighbor classification
Through K nearest neighbor classification method, photovoltaic panel sensors and cloud servers are used to analyze photovoltaic panel environmental data, the scalability and compatibility problems of existing photovoltaic power prediction methods are solved, and efficient and accurate photovoltaic panel power prediction and health monitoring are achieved, reducing costs.
Patent Information
- Application Number
- CN202210214610.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-03-07
AI Technical Summary
The existing photovoltaic power prediction methods have problems such as poor scalability and compatibility, large sample demand, and long training time. The physical methods are prone to failure under unstable conditions, and the artificial intelligence methods are complex and costly.
Using a K nearest neighbor classification method, environmental data is collected through photovoltaic panel sensors, prediction models are established, data analysis and learning are used for cloud servers, and the output power interval of photovoltaic panels is judged in real time, and abnormal data is filtered in combination with a small weather forecasting system to achieve lightweight power prediction.
It realizes efficient and accurate power prediction of photovoltaic panels under stable and unstable conditions, reduces labor monitoring costs, improves the expansion and prediction accuracy of the system, can reflect the healthy status of photovoltaic panels and guides maintenance.
Smart Images

Figure CN114648157B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis, and in particular to a method for predicting power by utilizing relevant environmental data of a photovoltaic power generation site. Background Art
[0002] Solar energy has become an ideal renewable resource for the next generation. Using photovoltaic panels to generate electricity aligns with my country's sustainable development strategy. The efficiency of photovoltaic power stations is affected by many factors, one of which is the radiation itself. The intensity of radiation varies in different weather conditions, making it a crucial factor that cannot be determined. Other factors that can be improved include dust levels, the tilt angle of the photovoltaic panels, and the orientation of the panels.
[0003] Dust levels are a significant factor affecting photovoltaic panel power generation, determining their ability to generate electricity. Once dust accumulates to a certain thickness, sunlight is blocked from that area, resulting in a decrease in panel power generation. With the development of IoT technology and the emergence of precision sensor components, the use of sensors to monitor the photovoltaic panel environment and obtain relevant operating parameters is becoming increasingly common. IoT technology can capture these parameters in real time and transmit this data to the cloud, which can then perform further analysis, processing, and display the data, thereby improving the operation and maintenance of the entire photovoltaic system and its operating environment.
[0004] Common photovoltaic power prediction methods are categorized into machine learning and physical methods. Existing physical methods primarily rely on physical model observations, combined with numerical weather forecasts and direct calculations using relevant formulas. However, existing physical methods suffer from significant uncertainty, requiring stable physical conditions to calculate the appropriate output power. Otherwise, damage to the photovoltaic panels and dust obstruction can render the methods ineffective.
[0005] Artificial intelligence-based photovoltaic power forecasting has become the mainstream solution. Existing AI methods include prediction algorithms based on neural networks, gray models, and hybrid models. These algorithms suffer from common shortcomings: poor scalability and compatibility, large sample requirements, long training times, and complex structures. These issues can lead to extremely complex system structures and poor scalability.
[0006] It is precisely because of the shortcomings of the existing technology that the technical solution of the present invention is introduced, which is used to solve the lightweight power prediction solution and has strong scalability. The output power depends on the distribution of historical data. Summary of the Invention
[0007] The purpose of the present invention is to provide a method for uploading data obtained by sensors in the environment where photovoltaic panels are located to a cloud server, processing, handling and analyzing the data to obtain an original data set, learning the data in the original data set, and establishing a prediction model, so that in subsequent working conditions, the output power range of the photovoltaic panels in the current environment can be judged according to the real-time environment.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] A photovoltaic power prediction method based on K-nearest neighbor classification includes the following steps:
[0010] A. Dataset acquisition steps:
[0011] A-1. The photovoltaic panel area is equipped with an intelligent control robot that integrates monitoring, measurement, and control capabilities. The robot is equipped with environmental temperature and humidity sensors. The photovoltaic power generation area is equipped with a solar radiation detector, a tilt angle sensor (gyroscope), an environmental pollution sensor, and a camera for dust detection. The data collected by these sensors every second is combined into an environmental data unit.
[0012] A-2. The sensor group acquires data in real time and transmits the data to the IoT gateway device through relevant protocols.
[0013] A-3. The gateway device combines the environmental data units collected every second in A-1 into a package and sends it to the third-party cloud server every minute.
[0014] A-4. The cloud server obtains cloud data and sends it to the data analysis microservice to form a basic data set. The basic data set is filtered out by the server to obtain the input data set.
[0015] B. Data analysis steps:
[0016] B-1. Model the input data set in A-4: Use the basic data set at the corresponding time point as input and the actual output power at the corresponding time point as output value to establish a prediction model.
[0017] B-2. The categories of prediction models will increase as the amount of data increases. The input parameters of the prediction model correspond to those collected in A-1: temperature, humidity, radiation intensity, photovoltaic panel tilt angle, pollution parameters, and dust parameters.
[0018] B-3. Divide the data collected in B-2 into output intervals according to certain rules. The divided output intervals will include the output intervals of the final prediction results. The final output power will be calculated within the interval according to certain rules. The calculated value is the final power prediction result of the model under the input parameters.
[0019] B-4. For the division of the output interval in B-3, different division intervals are selected according to different step sizes, and finally the optimal division interval is calculated through certain rules.
[0020] C. Result processing:
[0021] C-1. Calculate the distance between the data to be judged by the current system and all the data in B-4 in turn, and obtain the top K values of each area after the area is divided according to B-3.
[0022] C-2. Based on C-1, calculate the average of the first K smallest distance values in each region. The average value here is calculated according to a certain algorithm.
[0023] The weighted average value calculated in C-3 and C-2 is the predicted output power of the input data set in this interval under the current environment.
[0024] In the present invention, environmental sensors collect real-time environmental data. The collected data is read by embedded devices and the data of each time period is packaged and sent to the gateway device. The gateway device transmits data at intervals and transmits the data to the third-party cloud service platform provided by the operator via 4G. The photovoltaic operation and maintenance management system backend calls the third-party cloud service for data and stores the environmental data in the database. The entire photovoltaic operation and maintenance management system is a distributed microservice system, in which the data analysis service is always learning and analyzing data in the background. Once there is new data in the database, the data analysis service starts learning or power judgment.
[0025] In this invention, data is cleaned for abnormalities before entering the database. The photovoltaic operation and maintenance management system integrates a small real-time weather forecast system. Collected data is then evaluated against data provided by the weather forecast system to filter out data contamination caused by factors such as sensor and network delays. Each piece of data is timestamped when uploaded to the cloud platform. The data at the corresponding time point is retrieved from the backend small weather service database. If the error in the corresponding parameter is within an acceptable range, the data is considered valid. If the error is too large, the data at that moment is considered invalid.
[0026] By adopting the present invention, the power generation power of the photovoltaic system at a certain moment can be roughly obtained. The power generation power can also indirectly reflect the health of the photovoltaic panels. Under large-scale data samples and good environmental conditions, if the predicted power generation power is very different from the theoretical power generation power, it can be considered that there is too much dust accumulation on the photovoltaic panels, or the photovoltaic components on the photovoltaic panels have some damage. This plays a good role in the maintenance and health monitoring of the photovoltaic system, and avoids the cost of manual monitoring. At the same time, the power of the entire system can be used to estimate other photovoltaic systems without power output feedback. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a system flow chart of the present invention;
[0028] Figure 2 It is a flowchart of abnormal data filtering;
[0029] Figure 3 It is a power interval division flow chart;
[0030] Figure 4 It is a data analysis flow chart. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, a further detailed description is given below with reference to the accompanying drawings and examples. The unit of description of power size in the following text is watt (W).
[0032] The implementation of the present invention is based on the large amount of environmental data collected by the photovoltaic remote operation and maintenance system. Due to the influence of the environment and the working status of the sensor, the collected data needs to be processed. Figure 1 As shown, the specific process is as follows:
[0033] A. Dataset acquisition steps:
[0034] A-1. Obtaining raw environmental data through sensors. PV panels are equipped with ambient temperature and humidity sensors, and the photovoltaic power generation area is equipped with solar radiation detectors, tilt angle sensors (gyroscopes), environmental pollution sensors, and cameras for dust detection. The data collected by these sensors every second is combined into an environmental data unit.
[0035] A-2. In step A-1, environmental data is acquired while maintaining the geographic location and the PV panel's operating area. The data output ensures the power output within the PV panel's operating range remains unchanged, serving as the basis for decision making. The sensor group acquires data in real time and transmits it to the IoT gateway device via relevant protocols.
[0036] Every minute, the gateway devices A-3 and A-2 combine the environmental data units collected by A-1 into a single packet and send it to a third-party cloud server. Due to network issues, data uploads may experience packet loss, timeouts, or network disconnections. The gateways will save failed uploads and retransmit them if a timeout occurs. If the network is disconnected, the data will be stored and retransmitted when a connection is restored.
[0037] A-4. In step A-3, the data sent to the server will be filtered for erroneous data. The filtering process is as follows: Figure 2 Finally, we obtain the photovoltaic panel environmental dataset. This dataset can be modeled based on different photovoltaic panel regions or the entire photovoltaic area as input. The corresponding output is the output of the photovoltaic modules in the current region or the power of the entire photovoltaic power generation area. This environmental dataset is used for data prediction in step B.
[0038] According to the environmental data set provided in A, after being sent through the A-3 gateway device and filtered, the data will be sent to the microservice platform for data analysis. The resulting environmental data set is as follows:
[0039] S in ={{e 11 ,e 21 ,e 31 ,…,e i1},{e 12 ,e 22 ,e 32 ,…,e i2},{e 13 ,e 23 ,e 33 ,…,e i3},…,{e 1j ,e 2j ,e 3j ,…,e ij}}.
[0040] There are i input environment variables in total. Each set of data in the input set consists of i environment variable values. There are j sets of input data in total. Therefore, the input quantity set can be represented by S. The current output actual power under the above input is recorded as: S out ={r1,r2,r3,…,r i}.
[0041] B. Data analysis mainly includes the following four steps:
[0042] B-1. Model the basic data set.
[0043] B-2. Determine the input parameters of the model.
[0044] B-3. Division of power output interval steps.
[0045] B-4. Steps for dividing the power output range and selecting the optimal one.
[0046] Step B-1 determines the model's output as the predicted output power under the current environment. Using the factors influencing the system's output power as parameters of the environmental dataset, the number of system input parameters is determined. When new factors influencing the system emerge, simply add the new factors to the environment. This determines the model's input and output.
[0047] The input parameters of step B-2 correspond to those collected in step A-4: temperature, humidity, radiation intensity, photovoltaic panel tilt angle, pollution parameters, and dust parameters.
[0048] The main contents of step B-3 are as follows Figure 3 In the algorithm of this embodiment, the power output interval is set to a continuous interval with equal intervals. Since the output power will be very dense in a large number of data sets, the interval length of each interval is very important. For the interval [a, b], the value of ba is set to the interval length of the interval [a, b], which is also called the step size.
[0049] For the output set {r1,r2,r3,…,r i},r min Recorded as the minimum value of the data, r max Let step be the maximum value of the data. max =r max -r min , which represents the difference between the maximum power and the minimum power. The step size must be smaller than step max Otherwise, one interval will contain all the data. The minimum value of the step is the non-zero minimum value of the difference between the two powers in the power output set, which is recorded as step min The step size is selected from step min Start, to step max End, the offset of the step size selection is pos=step min , the set of interval step selections is: [Step min ,Step min +pos,…,Step max ].
[0050] At this point, the step length calculation of B-3 has been completed. The B-4 algorithm obtains the most suitable output interval and needs to perform output interval hit statistics. For a step length interval consisting of M steps, for each step length step m Count the number of interval hits under this step size. The specific statistical method is as follows:
[0051] If there is no data hit in the interval, that is, for the interval [a, b] if Then it means that the number of intervals is 0. Then the number of intervals is increased by 1, and the final statistics are in step size step m The number of intervals under the set data m ={d1,d2,d3,…,d u}, for the data set data m Calculate the standard deviation to get the degree of deviation from the average data:
[0052]
[0053] in: For data m Average value
[0054] The smaller the standard deviation, the better, because the smaller the standard deviation, the more the number of intervals in each divided interval is the same, which will be beneficial to the subsequent output.
[0055] The main contents of step B-4 are as follows Figure 4 The power range is selected by calculating the solution in step B-3: T = {[data1,σ1],[data2,σ2],…,[data m ,σ m ]} Each pair of data [data i ,σ i ](1≤i≤m) means in the data set data i The standard deviation calculated below, for m standard deviations, select the group with the smallest standard deviation as the interval division basis of the system, that is: the standard deviation corresponding to step, σ satisfies:
[0056]
[0057] The final step B is to divide the input data set into T intervals with a step length of step, and divide the output set into several intervals recorded as:
[0058] Out={[t0,t1],[t2,t3],[t4,t5],…[t i ,t i+1 ],…[t T-1 ,t T ]}, 0≤i≤T
[0059] Used for the result calculation of the final step C.
[0060] C. Result processing, such as Figure 4As shown, it mainly includes the following three steps:
[0061] C-1. Distance calculation algorithm for input data
[0062] C-2. Average normalization algorithm for output data
[0063] C-3. Determine the final predicted output power
[0064] In step C-1, the power partition interval set is obtained from step B-4:
[0065] Out={[t0,t1],[t2,t3],[t4,t5],…[t i ,t i+1 ],…[t T-1 ,t T ]}, 0≤i≤T
[0066] Assume that the input data to be judged in the current environment is {in1, in2,…, in i}, for T intervals, step C-1 calculates the distances of all point pairs to the input data in sequence, using Euclidean distance, then S in ={{e 11 ,e 21 ,e 31 ,…,e i1},{e 12 ,e 22 ,e 32 ,…,e i2},{e 13 ,e 23 ,e 33 ,…,e i3},…,{e 1j ,e 2j ,e 3j ,…,e ij The distance between the j points in}} is:
[0067]
[0068] In the corresponding T intervals, K points with the smallest distance are selected from each interval. If there are less than K points, the current interval will not be considered as the output. If the final result hits the interval, the system will throw an exception to inform the user that the current estimated value has insufficient data and is not convincing. If the number of intervals is greater than or equal to K, the K points with the smallest distance value will be selected. For the interval [t i ,t i+1 ], 0≤i≤N on T i points, and select the nearest K points according to the distance obtained by the above algorithm:
[0069] N i1 ,N i2 ,…,N ik , the average distance from the final input data to the interval uses the arithmetic mean as the output:
[0070] Compare the distances of all T intervals and find the interval with the smallest average distance. This interval is the output interval of step C-1.
[0071] In step C-2, the result is provided by the output interval of step C-1, and N in the output interval i points, indicating that the current environmental input parameters are closest to the characteristics of this interval. It can be considered that the current output power must belong to this interval. As the amount of data increases, the accuracy of the algorithm will increase. The output used in the final step C-2 is the arithmetic mean of the corresponding output powers of the first K points with the smallest distance in the current interval.
[0072] The output power finally predicted in step C-3 is the calculation result in step C-2.
[0073] Thus, this embodiment has implemented a photovoltaic power prediction method based on the KNN algorithm. This method collects environmental parameters and the output power of the current environmental parameters as an environmental data set during the operation of the photovoltaic panel. With a certain amount of data accumulation, the prediction accuracy is greatly improved. The method can also be applied to photovoltaic systems without feedback to determine the approximate photovoltaic output power. As the input parameters increase, the system's judgment results become more accurate. When the data volume is dense, the system's output is accurately output within a small range, thus achieving a very small error range.
Claims
1. A photovoltaic power prediction method based on K-nearest neighbor classification, characterized in that: The method comprises the following steps: A. Dataset acquisition steps: A-1. The area where the photovoltaic panels are located is equipped with environmental temperature and humidity sensors, a solar radiation detector, a tilt angle sensor gyroscope, an environmental pollution sensor, and a camera for dust detection. The data collected by the sensors every second is combined into an environmental data unit. A-2. The sensor group acquires data in real time and transmits the data to the IoT gateway device; A-3, the gateway device assembles the environmental data units collected every second in A-1 into a package and sends it to the third-party cloud server every 1 minute; A-4. The cloud server obtains data from the cloud and sends the data to the data analysis microservice to form a basic data set; The basic data set is filtered to obtain the input data set; B. Data analysis steps: B-1. Model the input data set in A-4: Use the basic data set at the corresponding time point as input and the actual output power at the corresponding time point as the output value to establish a prediction model. The input of the prediction model includes six indicators: ambient temperature, humidity, light radiation, photovoltaic tilt angle, pollution index, and dust index. The prediction model is constructed by referring to the actual data in the corresponding environment. B-2. The categories of prediction models increase as the amount of data increases. The input parameters of the prediction model correspond to those collected in A-1: temperature, humidity, radiation intensity, photovoltaic panel tilt angle, pollution parameters, and dust parameters; B-3. Divide the data collected in B-2 into output intervals according to a certain rule. The divided output intervals include the output intervals of the final prediction result. The final output power is calculated within the intervals according to the certain rule. The calculated value is the final power prediction result of the prediction model under the input parameters. The output intervals are divided according to power intervals, and the output after category assignment is calculated according to the average power in the category. B-4. For the division of the output interval in B-3, different division intervals are selected according to different step sizes, and finally the optimal division interval is calculated through certain rules; The partitioning interval is to automatically obtain the interval step size according to different input data sets, and obtain the data distribution set under different step sizes according to different step sizes. The standard deviation of the number of elements hitting the interval is used as the judgment basis to calculate the optimal partitioning interval; C. Result processing: C-1. Calculate the distance between the data to be judged by the current system and all the data in B-4 in turn, and obtain the top K values of each area after the area is divided according to B-3; C-2. Based on C-1, calculate the average of the first K smallest distance values in each region; The weighted average value calculated in C-3 and C-2 is the predicted output power of the input data set in this interval under the current environment.
2. The photovoltaic power prediction method according to claim 1, characterized in that: In step A-4, the basic data set is the result of removing abnormal points from the original data set and the real data set collected within the normal working range of the sensor.
3. The photovoltaic power prediction method according to claim 1, wherein: In step A-3, the environmental data is sent to the gateway at a frequency of once per second. The gateway stores 60 pieces of data within one minute and sends the stored data to the cloud server at a frequency of once per minute.
4. The photovoltaic power prediction method according to claim 1, wherein: In steps C-1 and C-2, the first K values with the smallest distances in each interval are calculated in turn according to the divided intervals. The distance calculation function adopts a weighted distance calculation scheme, and the final normalized average calculation function uses the arithmetic mean as the output.
Citation Information
Patent Citations
Short-term photovoltaic generation power prediction method and system based on LSTM
CN108734331A
Integrated learning based mountain wind generation set behavior predicating model
CN110685857A