Photovoltaic power prediction abnormal value detection method, system and device based on isolated forest algorithm and medium
By constructing an isolated forest algorithm with multidimensional feature vectors and a dynamic threshold strategy, the problem of poor outlier identification in photovoltaic power prediction is solved. It achieves efficient and accurate anomaly detection and processing, adapts to the time-varying nature of photovoltaic power data, and improves the reliability of power grid dispatch.
Patent Information
- Application Number
- CN202510908042.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-10-17
AI Technical Summary
Existing photovoltaic power prediction methods are ineffective in identifying anomalous data, especially anomalous data with no obvious pattern and random fluctuations in time and irradiance. They suffer from false positives and false negatives. Furthermore, the isolated forest algorithm lacks systematic feature engineering design in photovoltaic power prediction scenarios, cannot dynamically respond to changes in data distribution, and is not adaptable enough.
A multidimensional feature vector is constructed, including time, weather, and derived features. An isolated forest model is trained, and isolated trees are constructed through multiple random samplings. Anomaly scores are calculated, and a dynamic threshold calculation strategy is adopted. The threshold is dynamically updated by a sliding window to identify and handle temporary, persistent, and periodic anomalies.
It improves the detection accuracy of photovoltaic power prediction outliers, reduces false positives and false negatives, enhances the robustness and adaptability of the model, enables flexible response to different scenarios, and reduces operation and maintenance costs.
Smart Images

Figure CN120804977A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of photovoltaic power prediction, in particular to a photovoltaic power prediction outlier detection method, system, device and medium based on an isolation forest algorithm. BACKGROUND
[0002] With the continuous rise of new energy generation proportion, photovoltaic power generation system occupies an increasingly important position in the power system. Photovoltaic power prediction, as an important basis for dispatching operation, power optimization configuration and energy management, relies on historical power data and meteorological information for modeling and analysis. However, in the actual operation process, there are often various types of outliers in the historical data of photovoltaic power. These outliers come from a wide range of sources, and may be caused by measurement errors, communication failures, equipment abnormalities, weather mutations or model biases. If not identified and processed, it will seriously affect the training quality of the power prediction model and its application effect in the dispatching system.
[0003] The existing photovoltaic power outlier detection methods mainly include rule-based methods and statistical analysis methods. For example, threshold setting, slope judgment or moving average are used to identify outliers; or traditional statistical methods such as standard deviation analysis and box plot identification are used to screen outliers. However, these methods mostly rely on strong hypothesis conditions or static rules, and cannot effectively adapt to the time series, nonlinearity and multi-source heterogeneity characteristics of photovoltaic power data, especially when facing the fourth type of outliers, i.e. "no obvious pattern, random fluctuations over time and irradiance", the recognition effect is not good, and there are often false positives and false negatives.
[0004] In recent years, machine learning technology has shown good generalization ability in anomaly detection. Isolation Forest, as an efficient unsupervised anomaly detection algorithm, can identify data points that are more easily isolated as outliers by constructing a set of random split tree structures. It has the advantages of no label, high training efficiency, sensitivity to high-dimensional data, etc. However, the existing research on applying Isolation Forest to photovoltaic power prediction anomaly detection still has the following shortcomings:
[0005] There is a lack of systematic and multi-dimensional feature engineering design for the data characteristics of photovoltaic power prediction scenarios, and the model input information is not sufficient; the determination of outliers in Isolation Forest mainly relies on the average path length, and is not further optimized for photovoltaic data characteristics; fixed threshold or empirical setting is usually used, which cannot dynamically respond to changes in data distribution, limiting the adaptability to different scenarios in actual engineering.
[0006] Therefore, there is an urgent need to develop an outlier detection method that is more suitable for the data characteristics of photovoltaic power prediction, has good robustness and real-time performance, and can efficiently screen and process high-proportion and difficult-to-judge outliers. SUMMARY
[0007] In view of the above-mentioned problems, the present application is proposed.
[0008] Therefore, the technical problem solved by the present application is how to improve the detection accuracy of photovoltaic power prediction original data outliers, reduce false positives and false negatives, and provide reliable decision support for power grid dispatching.
[0009] To solve the above technical problems, the present application provides the following technical scheme: a photovoltaic power prediction outlier detection method based on an isolation forest algorithm, comprising,
[0010] Collecting historical power generation data, meteorological data and predicted power data of a photovoltaic power plant, preprocessing the data; constructing a multi-dimensional feature vector based on the preprocessed data, the feature vector including time features, meteorological features, power features and derived features, each feature vector as a data point; training an isolation forest model using the data points, the training process including constructing an isolation tree through multiple random sampling and calculating the anomaly score of each data point in the isolation forest; based on the anomaly score distribution of historical normal data points, using a dynamic threshold calculation strategy to determine the anomaly determination threshold; constructing a feature vector as a data point for real-time data to be tested, inputting it into the trained isolation forest model, obtaining the anomaly score, and comparing it with the threshold to determine whether it is an outlier; identifying the type of abnormal data based on the duration of the abnormal data and its context information, and taking processing measures based on the identification result.
[0011] As a preferred scheme of the photovoltaic power prediction outlier detection method based on the isolation forest algorithm, wherein: the preprocessing includes filling in missing data and removing duplicate data in the collected data.
[0012] As a preferred scheme of the photovoltaic power prediction outlier detection method based on the isolation forest algorithm, wherein: the time features include hours, weeks and seasons, respectively represented by integer encoding; the meteorological features include irradiance, air temperature, relative humidity, wind speed and wind direction; the power features include actual power generation, the ratio of the difference between the current power and the previous power, and the ratio of the power standard deviation to the mean in a set sliding time window; the derived features include the ratio of photovoltaic power to corresponding irradiance, and power-related features constructed based on historical similar days.
[0013] As a preferred scheme of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm, the training isolated forest model comprises: performing multiple random sampling on the preprocessed data to construct a forest structure composed of multiple isolated trees; the training sample of each isolated tree is randomly selected from part of the samples in the preprocessed data set, and each isolated tree is set to have a limited maximum depth during construction.
[0014] As a preferred scheme of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm, the abnormal score is obtained by calculating the average path length of each data point in the multiple isolated trees, and the average path length is processed by ratio with the theoretical path expectation value corresponding to the sample quantity; the theoretical path expectation value is calculated according to the sample quantity, and is used to reflect the average partition depth under the condition of random partition.
[0015] As a preferred scheme of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm, the dynamic threshold calculation strategy comprises: calculating an initial threshold based on the abnormal score distribution of historical normal data points, the initial threshold being a pre-set signal level quantile of the score distribution; setting a fixed-size sliding window, and calculating the abnormal score mean and standard deviation of the current data points in the window, and dynamically updating the current threshold according to the mean and standard deviation; the updating mode is to set the current threshold as the weighted sum of the mean and standard deviation of the current window abnormal score; when the variation range of the weighted coefficient in the continuous multiple sliding windows is less than a set threshold, the current weighted coefficient is fixed and no longer updated.
[0016] The beneficial effects of the preferred technical scheme are: by introducing the initial threshold calculated based on the abnormal score distribution of historical normal data, and dynamically updating the mean and standard deviation of the abnormal score in the sliding window, the abnormal judgment threshold can flexibly adapt to the change of data distribution, and the robustness and generalization ability of the model to abnormal values are improved. The dynamic adjustment and convergence mechanism of the weighted coefficient effectively avoids the misjudgment and omission caused by the excessive sensitivity or excessive dullness of the threshold variation, and improves the accuracy and stability of the photovoltaic power abnormality detection.
[0017] As a preferred scheme of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm, the processing measures comprise: dividing the abnormal types into temporary abnormality, persistent abnormality and periodic abnormality; for the data points of temporary abnormality, the historical data of adjacent time slices are interpolated and repaired; for the data points of persistent abnormality, an alarm mark is generated to prompt possible equipment failure or prediction model deviation; for the data points of periodic abnormality, the periodic characteristic parameters are extracted and the parameter module for fitting seasonal changes in the prediction model is updated.
[0018] The beneficial effects of the preferred technical solutions are that: according to the abnormal duration and context information, the abnormal types are divided into temporary, persistent and periodic, the further semantic analysis of the abnormal detection result is realized, and different nature of abnormal phenomena is distinguished and targeted processing measures are taken. Among them, the interpolation repair is carried out on the temporary abnormality, the data continuity is guaranteed, and the interference on the prediction model is reduced;The persistent abnormality is alarmed and prompted, which is helpful to timely find the equipment abnormality or the prediction model failure risk;The periodic abnormality extracts the period parameter and feeds back the model, which is helpful to the model self-adaptation of seasonal law and the improvement of future prediction accuracy, and enhances the intelligence and self-adaptation ability of the whole system.
[0019] The application provides a photovoltaic power prediction abnormal value detection system based on an isolated forest algorithm.
[0020] To solve the above technical problems, the application provides the following technical scheme: a photovoltaic power prediction abnormal value detection system based on an isolated forest algorithm, comprising: a data processing module, used for collecting historical power generation data, weather data and predicted power data of a photovoltaic power station, and pre-processing the data;A feature construction module, used for constructing a multi-dimensional feature vector based on the pre-processed data, wherein the feature vector comprises time features, weather features, power features and derived features, and each feature vector is used as a data point;A model training module, used for training an isolated forest model using the data points, and the training process comprises constructing an isolated tree through multiple random sampling and calculating the abnormal score of each data point in the isolated forest;A threshold setting module, used for determining an abnormal judgment threshold value based on the abnormal score distribution of historical normal data points by using a dynamic threshold value calculation strategy;An abnormality detection module, used for constructing a feature vector as a data point for real-time data to be measured, inputting the data point into the trained isolated forest model, obtaining an abnormal score, and comparing the abnormal score with the threshold value to determine whether it is an abnormal value;And an abnormality processing module, used for identifying the abnormal type according to the duration and context information of the abnormal data point, and taking processing measures based on the identification result.
[0021] The application provides a computer device, comprising a memory and a processor, and the memory stores a computer program, characterized in that the processor executes the computer program to realize the steps of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm.
[0022] The application provides a computer readable storage medium, which stores a computer program, characterized in that the computer program is executed by a processor to realize the steps of the photovoltaic power prediction abnormal value detection method based on the isolated forest algorithm.
[0023] The beneficial effects of the present application: construct a multi-dimensional feature vector containing time, weather, power and derived attributes, effectively enhance the context information basis of anomaly recognition, cooperate with the high-dimensional processing capability of the isolated forest model, and significantly improve the detection accuracy of photovoltaic power prediction outliers.
[0024] The isolated forest algorithm has an efficient model reasoning structure, which can realize rapid detection without relying on labeled data, and meets the requirements of power grid dispatching for real-time and reliability of photovoltaic power prediction data.
[0025] By introducing a sliding window and a dynamic weighting mechanism, the model threshold can be flexibly adjusted according to the data distribution changes, improving the robustness of the model in dealing with data fluctuations in different operating environments.
[0026] Combined with the duration of the anomaly and the context features, it can distinguish between temporary, persistent and periodic anomalies, and accordingly link alarm, interpolation repair or model optimization operations to improve the intelligent level of power station anomaly disposal.
[0027] By constructing a full-process automatic detection and identification mechanism, the need for manual inspection and labeling is significantly reduced, the data quality management efficiency is improved, and the long-term operation and maintenance cost is reduced. BRIEF DESCRIPTION OF DRAWINGS
[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained without creative labor on the basis of these drawings.
[0029] Figure 1 The overall flowchart of a photovoltaic power prediction outlier detection method based on an isolated forest algorithm provided by an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the above-mentioned purposes, features and advantages of the present application more apparent and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.
[0031] Embodiment 1, refer to Figure 1 For an embodiment of the present application, the embodiment provides a photovoltaic power prediction outlier detection method based on an isolated forest algorithm, comprising:
[0032] Step 101: collect historical power generation data, meteorological data and predicted power data of a photovoltaic power station, and pre-process the data; Step 102: construct a multi-dimensional feature vector based on the pre-processed data, the feature vector comprising time features, meteorological features, power features and derived features, and each feature vector is taken as a data point; Step 103: train an isolation forest model using the data points, the training process comprising constructing an isolation tree through multiple random sampling and calculating the anomaly score of each data point in the isolation forest; Step 104: based on the anomaly score distribution of historical normal data points, determine an anomaly judgment threshold value by using a dynamic threshold value calculation strategy; Step 105: construct a feature vector as a data point for real-time to-be-tested data, input the data point into the trained isolation forest model, obtain an anomaly score, and compare the anomaly score with the threshold value to determine whether the to-be-tested data is an abnormal value; and Step 106: identify an abnormal type according to the duration of the abnormal data point and context information of the abnormal data point, and take processing measures based on the identification result.
[0033] In step 101, the pre-processing comprises filling in missing data in the collected data and removing duplicate data.
[0034] In a preferred embodiment of the present application, the pre-processing mode comprises filling in missing items in the original collected data and removing duplicate items. The missing items are filled in by using a linear interpolation-based method to estimate and fill in the missing values according to the data trend of the adjacent time slices; the duplicate items are removed by time stamp comparison and data redundancy detection. To further improve the data quality, the pre-processing process further comprises smoothing processing of abnormal mutation data, and the sliding mean method or the median filter method is used to correct the continuous power dramatic change section.
[0035] The beneficial effects of the preferred technical solution are that by comprehensively cleaning missing data, removing duplicate data and smoothing mutation data, the stability and representativeness of the training samples can be significantly improved, the sensitivity of the model to data noise is reduced, the learning effect of the isolation forest model is enhanced, and the accuracy and robustness of the anomaly detection are improved.
[0036] In an optional embodiment of the present application, the pre-processing mode adopts a rule-driven data screening mechanism, the missing data is uniformly filled in by using a global mean method; and the duplicate records detected are uniformly kept as the data with later time. Meanwhile, the Z-score standardization method is optionally introduced to standardize all numerical features, so that the mean value is 0 and the variance is 1, so as to eliminate the dimensional influence between different dimensions and provide a unified scale basis for subsequent feature modeling.
[0037] In step 102, the time features, including hours, weeks and seasons, are respectively represented by integer coding; the weather features, including irradiance, air temperature, relative humidity, wind speed and wind direction; the power features, including actual power generation, the ratio of current power and the power at the previous time, and the ratio of power standard deviation and mean value in a set sliding time window; and the derived features, including the ratio of photovoltaic power and corresponding irradiance, and power-related features constructed based on historical similar days.
[0038] In step 103, the training of the isolated forest model includes multiple random sampling of the preprocessed data to construct a forest structure composed of multiple isolated trees; the training sample of each isolated tree is randomly selected from part of the samples in the preprocessed data set, and each isolated tree is set with a limited maximum depth when constructed.
[0039] In step 104, the anomaly score is obtained by calculating the average path length of each data point in the multiple isolated trees, and the average path length is processed by ratio with the theoretical path expectation value corresponding to the sample number; the theoretical path expectation value is calculated according to the sample number, and is used to reflect the average partition depth under the condition of random partition.
[0040] In step 105, the dynamic threshold calculation strategy includes calculating an initial threshold based on the anomaly score distribution of historical normal data points, the initial threshold being a pre-set confidence level quantile of the score distribution; setting a sliding window with a fixed size, and calculating the mean value and standard deviation of the anomaly score of the current data points in the window, and dynamically updating the current threshold value according to the mean value and standard deviation; the updating method is to set the current threshold value as the weighted sum of the mean value and standard deviation of the anomaly score in the current window; when the variation range of the weighted coefficient in the continuous multiple sliding windows is less than a set threshold, the current weighted coefficient is fixed and no longer updated.
[0041] In a preferred embodiment of the present application, the dynamic threshold obtaining method includes calculating the confidence level quantile value of the anomaly score distribution of historical normal data points as the initial judgment threshold, and introducing a sliding window mechanism to dynamically adjust the threshold during system operation. The sliding window is set to a fixed length, and in each time period, the mean value and standard deviation of the anomaly score of the data points in the window are calculated, and the current threshold value is set as: threshold = mean value + weighted coefficient x standard deviation. When the variation range of the weighted coefficient in the continuous multiple sliding windows is less than a set variation threshold, the coefficient is automatically locked, and the threshold value is fixed and no longer updated.
[0042] The preferred technical scheme has the beneficial effects that the method combines historical statistical characteristics and current distribution trend, has good self-adaptive ability, can dynamically adapt to non-stationary and seasonal changes of photovoltaic power data, improves real-time accuracy of abnormal value identification, and reduces misjudgment rate caused by improper fixed threshold setting.
[0043] In an optional embodiment of the present application, the dynamic threshold acquisition method is based on a quantile updating mechanism in a sliding window. Each time the window slides, the 95% quantile value of the abnormal score in the current window is recalculated as the latest threshold, and a maximum threshold fluctuation range is set. When the difference between the results of adjacent two window calculations exceeds the range, a historical trend smoothing factor is introduced to perform weighted average on the threshold, thereby alleviating the problem of sharp fluctuation of the threshold and enhancing the stability of the abnormal detection result.
[0044] In step 106, the taking of the processing measures includes dividing the abnormal types into temporary abnormality, persistent abnormality and periodic abnormality; for the data points of the temporary abnormality, interpolation repair is performed according to the historical data of adjacent time slices; for the data points of the persistent abnormality, an alarm mark is generated to prompt possible equipment failure or prediction model deviation; and for the data points of the periodic abnormality, periodic characteristic parameters are extracted and a parameter module for fitting seasonal changes in the prediction model is updated.
[0045] In a preferred embodiment of the present application, the modeling method of the isolation forest algorithm includes: generating a plurality of sample subsets from the preprocessed historical feature data by using non-replacement random sampling, and the size of each subset is 80% of the original sample quantity; a single isolation tree is constructed for each sample subset, and in the construction process, the sample set is recursively divided by randomly selecting features and feature value intervals until each data point is isolated or the depth of the tree reaches a preset upper limit. Finally, a group of isolation trees is constructed to form a complete isolation forest model. The typical parameter settings are: the number of isolation trees is 100, the maximum tree depth is 10, and the sampling ratio is 0.8.
[0046] The preferred technical scheme has the beneficial effects that the forest model construction method can improve the abnormal detection sensitivity and anti-interference ability of the model, while controlling the computational complexity of the training process, and is suitable for abnormal identification of high-dimensional, nonlinear and noisy data such as photovoltaic power data, and is especially suitable for online deployment and large-scale application.
[0047] In an optional embodiment of the present application, in the modeling method of the isolation forest algorithm, the construction of the isolation tree adopts a weighted feature random selection strategy, and the importance of each feature in the historical data is estimated according to the variance or information gain of the feature, and the importance is used as the probability distribution of feature selection to improve the effectiveness of the split point. In the tree construction process, a minimum sample number limit can also be introduced to avoid overfitting and improve the generalization performance of the model on new data.
[0048] Embodiment 2, which is an embodiment of the present application, provides an isolated forest algorithm-based photovoltaic power prediction outlier detection method based on the previous embodiment, comprising:
[0049] Step 201: data collection and preprocessing:
[0050] Collect historical power data, meteorological data and predicted power data of the photovoltaic power station. The historical power data includes the actual power generation of the photovoltaic power station in the past period of time, the meteorological data includes irradiance, temperature, humidity, wind speed, wind direction, etc., and the predicted power data includes the power predicted by the numerical weather prediction model and the power predicted by the statistical prediction model.
[0051] Clean and standardize the collected data. Data cleaning includes handling missing values, outliers and repeated values. For missing values, interpolation, mean or median method can be used for filling; for repeated values, they can be directly deleted.
[0052] Step 202: construct a multi-dimensional feature vector, comprising:
[0053] Time features: extract time information such as year, month, day, hour, minute, season, holiday, etc., and convert them into numerical features, for example, convert season into an integer from 1 to 4, and convert holiday into a binary feature from 0 to 1.
[0054] Meteorological features: including irradiance, temperature, humidity, wind speed, wind direction, etc. Feature extraction and conversion are performed on meteorological data, such as calculating the rate of change of irradiance and the daily range of temperature.
[0055] Power features: actual power, power change rate, power fluctuation coefficient, etc.; the power change rate calculation formula is:
[0056]
[0057] Wherein, Pt is the power at the current time, and Pt-1 is the power at the previous time.
[0058] The power fluctuation coefficient calculation formula is:
[0059]
[0060] Wherein, σ(P) is the standard deviation of power, is the mean value of power.
[0061] Derived features: power-to-irradiance ratio, historical similar day features, etc. including power-to-irradiance ratio, historical similar day features, etc. The power-to-irradiance ratio reflects the power generation efficiency of the photovoltaic power station, and the calculation formula is: power-to-irradiance ratio = G / P, wherein P is the power and G is the irradiance.
[0062] The historical similar day features are obtained by calculating the feature similarity between the current day and the historical days, and several days with the highest similarity are selected as the historical similar days, and the power features of these days are extracted as the derived features of the current day.
[0063] Step 203: Isolation Forest Model Training
[0064] The Isolation Forest model is trained using the preprocessed historical data, and a set of typical specific parameters can be set: a. Number of trees: 100; b. Sample sampling ratio: 0.8; c. Maximum tree depth: 10.
[0065] The main steps are as follows: a. Random sampling to generate multiple subsets: randomly sample multiple subsets from the preprocessed historical data, and the size of each subset is n.
[0066] Specific process: build an isolation tree for each subset, isolate the data points by randomly selecting features and split points; start from the root node, randomly select a feature and a split point; divide the data points into left and right two child nodes according to the split point; recursively repeat the above process for the child nodes until all data points are isolated or the maximum depth of the tree is reached.
[0067] b. Calculate the average path length of each data point in all isolation trees to generate an anomaly score. The calculation formula of the anomaly score is:
[0068]
[0069] Where s(x) is the anomaly score of data point x, E(h(x)) is the average path length of data point x in all isolation trees, and c(n) is the path length expectation when the sample size is n, and the calculation formula is:
[0070]
[0071] Where H(n-1) is the harmonic number, which can be approximated as ln(n-1)+0.5772 (Euler's constant).
[0072] The closer the anomaly score is to 1, the more likely the data point is an outlier; the closer the anomaly score is to 0, the more likely the data point is a normal value.
[0073] Step 204: Dynamic determination of anomaly threshold: based on the anomaly score distribution of historical data, the dynamic threshold method is used to determine the anomaly threshold, which includes:
[0074] a. Calculate the anomaly score distribution of historical normal data: select normal data from historical data and calculate the anomaly score distribution of these data.
[0075] b. Determine the initial threshold according to the preset confidence level; determine the initial threshold according to the preset confidence level (such as 95%). For example, select the 95th percentile of the abnormal score distribution as the initial threshold.
[0076] c. Introduce a sliding window mechanism to dynamically adjust the threshold according to the abnormal score distribution of the latest data. The principle of setting the sliding window is:
[0077] Set a sliding window with a window size of m time points; calculate the abnormal score distribution of the data in the window; adjust the threshold according to the statistical characteristics (such as mean, standard deviation) of the current abnormal score distribution. For example, the threshold can be expressed as:
[0078] Threshold = μ + kσ
[0079] Where μ is the mean of the abnormal score in the window, σ is the standard deviation, and k is an adjustable parameter calculated according to the previous threshold, the current abnormal score mean, and the standard deviation.
[0080] When the k values of consecutive 5 windows differ by less than 0.05, the k value is fixed and no longer changes. According to this k, the threshold of different windows is calculated.
[0081] In specific implementation, the specific parameters can be set as follows: based on the abnormal score distribution of historical normal data, the initial threshold is determined to be 0.75. Introduce a sliding window mechanism with a window size of 1000 time points.
[0082] Step 205 real-time anomaly detection:
[0083] For the real-time data point to be detected, calculate its abnormal score in the trained isolation forest model, and compare it with the dynamic threshold. If the score exceeds the threshold, it is determined to be an abnormal value.
[0084] Step 206 anomaly type identification and processing:
[0085] According to the characteristics and context information of the abnormal value, identify the abnormal type and take corresponding processing measures. The abnormal type is divided into temporary abnormality, persistent abnormality, periodic abnormality, etc.; different types of abnormality are treated differently, such as data correction, alarm, equipment maintenance, etc.
[0086] Temporary anomaly: the duration of abnormal value is short, usually caused by sudden weather changes, temporary equipment failure, etc.; for temporary anomaly, data correction can be performed, such as using interpolation method or replacing with similar historical data; persistent anomaly: the duration of abnormal value is long, which may be caused by long-term equipment failure, prediction model deviation, etc.; for persistent anomaly, an alarm signal is sent to notify the operation and maintenance personnel to carry out equipment maintenance or model adjustment; periodic anomaly: the abnormal value presents periodic change, which may be caused by periodic maintenance of equipment, seasonal change, etc. For periodic anomaly, analyze the cause of anomaly, adjust the prediction model or optimize the equipment maintenance plan.
[0087] The method of the embodiment fully excavates the spatio-temporal characteristics and correlation of photovoltaic power data by constructing a multi-dimensional feature vector, and combines the advantages of the isolation forest algorithm, which can accurately identify various types of abnormal values.
[0088] The isolation forest algorithm has high calculation efficiency and is suitable for real-time online detection, which can timely discover abnormal situations in photovoltaic power prediction and provide timely decision support for power grid dispatching.
[0089] The dynamic threshold method can automatically adjust the threshold according to the change of data distribution, which is suitable for the time-varying and uncertainty of photovoltaic power data.
[0090] By analyzing the characteristics and context information of abnormal values, the type of abnormal value can be accurately identified, and corresponding processing measures can be taken to improve the operation and management level of photovoltaic power station.
[0091] The automatic detection and processing of photovoltaic power prediction abnormal values are realized, which reduces the manual intervention and reduces the operation and maintenance cost.
[0092] Embodiment 3 is an embodiment of the present application, which provides an isolated forest algorithm-based photovoltaic power prediction outlier detection system, comprising: a data processing module, configured to collect historical power generation data, meteorological data and predicted power data of a photovoltaic power plant, and pre-process the data; a feature construction module, configured to construct a multi-dimensional feature vector based on the pre-processed data, the feature vector comprising time features, meteorological features, power features and derived features, and each feature vector serving as a data point; a model training module, configured to train an isolated forest model using the data points, the training process comprising constructing isolated trees through multiple random sampling and calculating the anomaly scores of the data points in the isolated forest; a threshold setting module, configured to determine an anomaly judgment threshold based on the anomaly score distribution of historical normal data points using a dynamic threshold calculation strategy; an anomaly detection module, configured to construct a feature vector as a data point for real-time data to be tested, input the data point into the trained isolated forest model, obtain an anomaly score, and compare the anomaly score with the threshold to determine whether the data point is an outlier; and an anomaly processing module, configured to identify an anomaly type according to the duration and context information of the anomaly data point, and take processing measures based on the identification result.
[0093] According to the photovoltaic power anomaly characteristics and cause analysis results, the photovoltaic power anomaly points can be divided into four types. Compared with normal data points, anomaly type 1, anomaly type 2 and anomaly type 3 have significant numerical characteristics, that is, the power values of these anomaly points do not change with the change of irradiance in a continuous period of time. By using this feature to form an identification criterion, these anomaly points can be identified. For type 4 anomaly points, the photovoltaic power value fluctuates randomly with irradiance and time, and the anomaly characteristics are not significant, so it is not possible to form a unified identification criterion to identify this type of anomaly points. Machine learning models can be used to identify them. The main features and identification strategies of each type of anomaly point are shown in Table 1:
[0094] Table 1 Identification strategy table for different types of anomaly points
[0095]
[0096] The characteristics of type 1, type 2 and type 3 anomaly points are that the power value remains constant in the presence of irradiance fluctuations. The key to identifying them lies in: on the one hand, the persistence of the power value in a period of time needs to be determined; on the other hand, the volatility of the irradiance in a period of time needs to be determined.
[0097] The method of the embodiment is aimed at detecting the fourth kind of abnormal data. The isolation forest algorithm, as an unsupervised learning method, has the advantages of high computational efficiency and sensitivity to abnormal values, and is particularly suitable for processing high-dimensional and nonlinear data. However, there are some problems in directly applying the isolation forest to photovoltaic power prediction abnormal value detection, such as unreasonable feature engineering, inaccurate abnormal score calculation, and unscientific threshold determination, which leads to insufficient detection accuracy and robustness to improve the accuracy and real-time performance of detection, and meets the actual engineering requirements.
[0098] The embodiment also provides an electronic device suitable for a photovoltaic power prediction abnormal value detection method based on an isolation forest algorithm, including a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to realize the photovoltaic power prediction abnormal value detection method based on the isolation forest algorithm proposed in the above embodiment.
[0099] The embodiment also provides a storage medium having a computer program stored thereon, and the program is executed by a processor to realize the photovoltaic power prediction abnormal value detection method based on the isolation forest algorithm proposed in the above embodiment.
[0100] The storage medium proposed in the embodiment and the photovoltaic power prediction abnormal value detection method based on the isolation forest algorithm proposed in the above embodiment belong to the same inventive concept, and the technical details not described in detail in the embodiment can be referred to the above embodiment, and the embodiment has the same beneficial effects as the above embodiment.
[0101] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary general hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a floppy disk, a read-only memory (ROM), a random access memory (RAM), a FLASH memory, a hard disk or an optical disk, etc., including a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods of various embodiments of the present application.
[0102] It should be noted that the above examples are only used to illustrate the technical solutions of the present application but not to limit the present application. Although the present application is described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalently replaced, without departing from the spirit and scope of the technical solutions of the present application, and all of them should be covered in the scope of the claims of the present application.
Claims
1. A photovoltaic power forecasting outlier detection method based on the isolation forest algorithm, characterized by: include, Collect historical power generation data, meteorological data, and predicted power data of the photovoltaic power station and pre-process the data; Constructing a multidimensional feature vector based on the preprocessed data, wherein the feature vector includes time features, meteorological features, power features, and derived features, and each feature vector is regarded as a data point; Using the data points to train an isolation forest model, the training process includes constructing an isolation tree through multiple random samplings and calculating an anomaly score for each data point in the isolation forest; Based on the anomaly score distribution of historical normal data points, a dynamic threshold calculation strategy is used to determine the anomaly judgment threshold; Construct a feature vector for the real-time test data as a data point, input it into the trained isolation forest model, obtain anomaly scores, and compare them with the threshold to determine whether it is an outlier; Identify the anomaly type based on the duration of the abnormal data point and its contextual information, and take processing measures based on the identification results.
2. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 1, characterized in that: The preprocessing includes completing missing data and removing duplicate data in the collected data.
3. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 2, characterized in that: The time features, including hours, weeks and seasons, are represented by integer codes respectively; The meteorological characteristics include irradiance, air temperature, relative humidity, wind speed and direction; The power characteristics include the actual generated power, the ratio of the difference between the current power and the power at the previous moment, and the ratio of the power standard deviation to the mean within a set sliding time window; The derived features include the ratio of photovoltaic power to irradiance at the corresponding moment, and power-related features constructed based on historical similar days.
4. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 3, characterized in that: The training of the isolation forest model includes performing multiple random samplings on the preprocessed data to construct a forest structure consisting of multiple isolated trees; The training samples of each isolated tree are randomly selected from some samples in the preprocessed data set, and each isolated tree is set with a limited maximum depth when it is constructed.
5. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 4, characterized in that: The anomaly score is obtained by calculating the average path length of each data point in the multiple isolated trees and performing a ratio processing on the average path length and the theoretical path expectation value corresponding to the sample number; The theoretical path expectation value is calculated based on the number of samples and is used to reflect the average segmentation depth under random segmentation conditions.
6. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 4, characterized in that: The dynamic threshold calculation strategy includes calculating an initial threshold based on the abnormal score distribution of historical normal data points, wherein the initial threshold is a preset confidence level quantile of the score distribution; Set a sliding window of fixed size, calculate the mean and standard deviation of the anomaly score of the current data point within the window, and dynamically update the current threshold based on the mean and standard deviation; The update method is to set the current threshold to the weighted sum of the mean and standard deviation of the anomaly score of the current window; When the variation range of the weighting coefficient in multiple consecutive sliding windows is less than a set threshold, the current weighting coefficient is fixed and no longer updated.
7. The photovoltaic power prediction outlier detection method based on the isolation forest algorithm according to claim 4, characterized in that: The said taking of treatment measures includes classifying the abnormality types into temporary abnormality, persistent abnormality and periodic abnormality; For temporarily abnormal data points, interpolation and repair are performed based on historical data of adjacent time slices; For persistently abnormal data points, alarm marks are generated to indicate possible equipment failure or prediction model deviation; For data points with periodic anomalies, their periodic characteristic parameters are extracted and the parameter module used to fit seasonal changes in the prediction model is updated.
8. A photovoltaic power prediction anomaly detection system based on an isolation forest algorithm, applying the photovoltaic power prediction anomaly detection method based on an isolation forest algorithm according to any one of claims 1 to 7, characterized in that: include: A data processing module is used to collect historical power generation data, meteorological data and predicted power data of the photovoltaic power station and pre-process the data; A feature construction module is used to construct a multidimensional feature vector based on the preprocessed data. The feature vector includes time features, meteorological features, power features, and derived features, and each feature vector is regarded as a data point. A model training module is used to train an isolation forest model using the data points, wherein the training process includes constructing an isolation tree through multiple random samplings and calculating an anomaly score of each data point in the isolation forest; The threshold setting module is used to determine the anomaly judgment threshold based on the anomaly score distribution of historical normal data points using a dynamic threshold calculation strategy; The anomaly detection module is used to construct feature vectors for real-time test data as data points, input them into the trained isolation forest model, obtain anomaly scores, and compare them with the threshold to determine whether they are outliers; The exception handling module is used to identify the exception type according to the duration of the abnormal data point and its context information, and take processing measures based on the identification results.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the photovoltaic power prediction anomaly detection method based on the isolation forest algorithm according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a photovoltaic power prediction anomaly detection method based on an isolation forest algorithm according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Abnormality detection method and electronic equipment
CN121050986A
Photovoltaic string reflux identification method and system based on current characteristics
CN121071567A
Sandbox terminal file protection method based on improved isolated forest
CN121327822A
Photovoltaic equipment operation monitoring method and system based on big data
CN121567059A
Photovoltaic device operation monitoring method and system based on big data
CN121567059B