Adaptive photovoltaic system fault judgment method and system

By extracting the moving mode component of the photovoltaic system and calculating its energy entropy, combined with the SVM model, it solves the problem of the four DC arc failures in the photovoltaic system in the existing technology, and achieves high accuracy of failure detection and maintenance efficiency. Improvement.

CN118296497BActive Publication Date: 2025-01-24MAIN ENERGY (BEIJING) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410433728.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-11
Publication Date
2025-01-24
Estimated Expiration
2044-04-11

AI Technical Summary

Technical Problem

The prior art is difficult to effectively distinguish four DC arc faults in photovoltaic systems, resulting in inaccurate diagnosis and high maintenance costs.

Method used

By extracting the model's modal component (IMF) of the photovoltaic system and calculating its energy entropy, combined with the support vector machine (SVM) model, the intelligent distinction of the four DC arc faults.

Benefits of technology

It improves the accuracy and efficiency of photovoltaic system fault detection, reduces false alarms and false negatives, and reduces maintenance costs and downtime.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118296497B_ABST
    Figure CN118296497B_ABST
Patent Text Reader

Abstract

The present invention discloses an adaptive photovoltaic system fault judgment method and system; the present invention relates to the technical field of photovoltaic systems; first, the energy E of each intrinsic mode component IMF is calculated. Then, these energies E are normalized to obtain the energy ratio of each intrinsic mode component IMF. Next, the energy entropy H is calculated to measure the uniformity of energy distribution between different intrinsic mode components IMF. A higher energy entropy H indicates a more uniform energy distribution. By combining signal processing and machine learning techniques, the present invention can accurately detect and classify various faults in photovoltaic systems, help reduce false alarms and missed alarms, and thus improve the reliability and safety of the system. And through real-time monitoring and fault warning, the technical solution enables operation and maintenance personnel to take preventive measures before a fault occurs, avoid or reduce the impact of system faults on photovoltaic power generation, and reduce maintenance costs and downtime.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of photovoltaic systems, specifically to the technical field of photovoltaic fault troubleshooting based on energy entropy characteristics, and particularly to an adaptive photovoltaic system fault judgment method and system. Background Art

[0002] In photovoltaic power generation systems, abnormal arcing (hereinafter referred to as "fault arc") may occur due to various reasons. It is a common and potentially dangerous phenomenon. The generation of such fault arcs may cause functional damage to the photovoltaic system and even cause safety accidents such as fire.

[0003] Fault arcs can be divided into several categories according to their occurrence locations: intra-string series arcs, inter-string parallel arcs, intra-string parallel arcs, busbar series arcs, busbar parallel arcs, and photovoltaic shading faults. [1,5] .

[0004] However, the current research on the diagnosis of these arc faults is not balanced. Among them, the busbar parallel arc fault can be effectively detected by the protection device because its fault current amplitude usually exceeds the action value of the low-voltage circuit breaker. In contrast, the intelligent differentiation technology of other arc faults is not mature. When other arc faults occur, the staff often need to conduct on-site inspections and maintenance to determine the fault type, which is not only time-consuming and labor-intensive, but also may lead to greater economic losses and inefficiency. [2] .

[0005] To solve this problem, the current mainstream technical solution is to extract the energy entropy characteristics of the photovoltaic system and combine it with the corresponding algorithm to realize the diagnosis of arc faults. For example:

[0006] A prior art [3] By extracting the energy entropy features in the time domain, frequency domain, and after empirical mode decomposition, a fault arc feature space is constructed. This technology determines the boundary threshold of the fault space through experiments, thereby realizing fault diagnosis. However, this method is more subjective in determining the threshold and only considers a single type of arc fault, so it has certain limitations in practical applications.

[0007] Another existing technology [4] The empirical mode decomposition analysis method and probabilistic neural network are used to perform time-frequency decomposition of arc current. This technology calculates dimensionless indicators and forms a multi-feature matrix for arc fault diagnosis. Although this method has shown some effectiveness in the diagnosis of arc faults in residential power systems, it does not involve photovoltaic power generation systems that are prone to DC arc faults.

[0008] In summary, there is still a lot of room for exploration in the current diagnosis technology for photovoltaic string arcs, especially parallel arc faults within and between photovoltaic strings. Considering that the safety hazards caused by these two types of arcs are more serious than series arcs, the existing methods are still unable to effectively distinguish the above four types of DC arc faults. Therefore, the technical problem to be solved by the present invention is summarized as: how to distinguish the above four types of DC arc faults based on the extraction of energy entropy characteristics of the photovoltaic system.

[0009] To this end, the present invention proposes an adaptive photovoltaic system fault judgment method and system. Summary of the invention

[0010] The technical solution of the embodiment of the present invention is achieved as follows:

[0011] First, adaptive photovoltaic system fault judgment method:

[0012] 1. Overview:

[0013] The present invention aims to realize intelligent troubleshooting and differentiation of series arcs within a string, parallel arcs between strings, parallel arcs within a string, busbar series arcs, and photovoltaic shading faults. By extracting the intrinsic mode components IMF of the photovoltaic system without over-envelope, under-envelope, and different degrees of end effects and modal aliasing to construct energy entropy, the SVM model is used to effectively distinguish the types of photovoltaic faults. Through real-time monitoring and fault warning, this technical solution enables operation and maintenance personnel to take preventive measures before the fault occurs, avoid or reduce the impact of system faults on photovoltaic power generation, and reduce maintenance costs and downtime.

[0014] (II) Extraction of eigenmode components:

[0015] First, based on the EWT algorithm (Empirical Wavelet Transform, joint wavelet threshold denoising algorithm), the time-frequency input signal of the photovoltaic string group of the photovoltaic system is extracted, and then decomposed to form the intrinsic mode component IMF (Intrinsic Mode Function). Unlike traditional empirical mode decomposition and wavelet transform, the EWT algorithm does not require the selection of wavelet basis functions, so there are no problems such as over-envelope, under-envelope, and different degrees of end effects and mode aliasing.

[0016] 2.1 EWT decomposition steps:

[0017] First, the time-frequency input signal of the photovoltaic system is Fourier transformed to convert it from the time domain to the frequency domain. That is, the frequency domain support interval is decomposed into N parts and the boundaries between them are represented by the signal spectrum and the midpoint ω between two adjacent maximum points n express:

[0018] ;

[0019] ;

[0020] Among them, the nth frequency domain support interval, that is, [ω n−1 , ω n ]; [0,π] is the total range of the frequency domain support interval; N is the number of parts the frequency domain support interval is divided into; ω n is the boundary frequency of the nth interval, determined by the midpoint between two adjacent maximum points. The union of all frequency domain support intervals should cover the entire frequency domain support interval [0,π].

[0021] Second, through empirical wavelet, for different intervals Λ n Construct empirical scaling function φ n (ω) and the empirical wavelet function ψ n (ω) and as a bandpass filter bank; in the frequency domain, the support interval of the signal is decomposed into multiple parts, and the boundary of each part is determined by the midpoint between adjacent maximum points in the signal spectrum; the bandpass filter bank is:

[0022] ;

[0023] ;

[0024] Among them, γ is a scaling factor between 0 and 1, which is used to determine the frequency support of the scaling function and the wavelet function; β is the relationship function Ck([0,1]) between any Fourier series and the Fourier transform of the non-periodic signal; x is the frequency variable of the Fourier transform.

[0025] Third, based on the frequency domain interval obtained by decomposition, reference [5] The empirical formula is given to construct the empirical scaling function and the empirical wavelet function. After forming a set of bandpass filters, the original signal is reconstructed:

[0026] ;

[0027] Among them, W f (0, t) is the approximate coefficient of the inner product of the empirical scaling function and the signal; W f (n, t) is the detail coefficient of the inner product of the empirical wavelet function and the signal; φ1(t) is the scaling function, also called the approximate coefficient or low-frequency component; φ n (t) represents the different orders or scales of the wavelet function. For n>1, φ n (t) represents wavelet functions at different scales, which are used to analyze the high frequency or details of the signal.

[0028] Fourth, apply these bandpass filters to filter the original signal, thereby obtaining a series of intrinsic mode components IMF:

[0029] ;

[0030] Among them, f0(t) and f k (t) is the specific form of IMF, f0(t) is the first IMF, which represents the lowest frequency component in the original signal, and f k (t) represents the kth IMF, where k is a positive integer representing the sequence number of the IMF, and these IMFs are arranged in order from low to high frequency. f (0,t) and W f (k, t) are the coefficients of the empirical wavelet transform, W f (0, t) is the approximation coefficient, which represents the projection of the original signal on the scaling function φ1(t), W f (k, t) is the detail coefficient, which represents the original signal in the kth wavelet function φ k (t), these coefficients describe the strength or amplitude of the original signal in different frequency bands. k (t) is the empirical wavelet function, φ1(t) is the scaling function, similar to the scaling function in wavelet transform, which is used to extract the low-frequency components in the original signal, and φ k (t) is the kth wavelet function, which is used to extract the components of a specific frequency band in the original signal.

[0031] 2.2 Technical ideas:

[0032] Each intrinsic mode component IMF represents the characteristics of the original signal in different frequency bands. Each IMF represents an independent mode or vibration mode, and they all have the same characteristics, that is, their number of poles and zero crossings differ by at most one. At the same time, traditional signal processing methods often have errors when processing the endpoints of the signal, resulting in endpoint effects. At the same time, components between different modes may interfere with each other and produce modal aliasing. The use of the EWT algorithm can alleviate the problems of endpoint effects and modal aliasing and improve the extraction accuracy of IMFs through the precise division of the frequency domain support interval and the design of filters.

[0033] However, for the technical problem to be solved, extracting the intrinsic mode component IMF does not mean that the fault characteristics of the photovoltaic system can be extracted. Therefore, other algorithms need to be introduced to realize fault feature identification.

[0034] (III) Technical solution:

[0035] Based on the intrinsic mode component IMF obtained in 2.1, the present invention first calculates its energy entropy, and then extracts and selects features. Subsequently, a classification model is constructed to distinguish four types of DC arc faults and trained, and finally the model is deployed to achieve real-time fault detection and classification of photovoltaic systems. The steps specifically include the following steps S1 to S4.

[0036] 3.1 Step S1, energy entropy calculation:

[0037] The fault features of the intrinsic mode component IMF obtained by signal decomposition are extracted through the EWT algorithm. Considering that most existing technologies directly use time domain and frequency domain as fault feature quantities, which are easily interfered by environmental noise, the entropy feature can characterize the complexity of the signal sequence, has strong anti-interference ability, and can effectively extract fault information from the signal. Therefore, constructing energy entropy can provide strong data support for the fault retrieval in the following text.

[0038] First, the energy E of each intrinsic mode component IMF is calculated. Then these energies E are normalized to obtain the energy ratio of each intrinsic mode component IMF. Next, the energy entropy H is calculated to measure the uniformity of energy distribution among different intrinsic mode components IMF. A higher energy entropy H indicates a more uniform energy distribution, while a lower energy entropy H indicates that the energy is mainly concentrated in a few intrinsic mode components IMF.

[0039] 3.1.1 Step S100, calculate the energy E of each intrinsic mode component IMF:

[0040] Integrate the square of each intrinsic mode component IMF: Each intrinsic mode component IMF is represented as a continuous signal x(t) or a discrete signal x[n], where t is the time variable and n is the discrete time index.

[0041] For a continuous signal x(t), its energy E is:

[0042] ;

[0043] For a continuous signal in a finite time interval [T1, T2], the energy E is:

[0044] ;

[0045] For a discrete signal x[n], energy calculation uses summation instead of integration:

[0046] ;

[0047] Where N is the total number of signal samples.

[0048] In practical applications, since the signal may be complex (especially when dealing with frequency domain data), we can take the square of the modulus x(t) 2 or x[n] 2 to ensure that the energy is non-negative. However, for real signals, the square of the modulus is simply the square of x(t) 2 or x[n] 2 .

[0049] 3.1.2 Step S101, normalization:

[0050] Normalize the energy E to get the energy ratio of each eigenmode component IMF: Normalization is to calculate the energy ratio of each eigenmode component IMF. That is, divide the energy of all eigenmode component IMFs by the sum of these energies to ensure that their sum is 1, thereby obtaining the relative energy contribution of each eigenmode component IMF.

[0051] Suppose there are M intrinsic mode components IMF whose energies are represented by E1, E2, ..., E M The normalization process is to calculate the energy ratio p of each intrinsic mode component IMF i , where i is an index from 1 to M:

[0052] ;

[0053] in, represents the sum of all intrinsic mode components IMF energy, and p i It is the energy ratio of the i-th IMF component.

[0054] In practical applications, the normalization process allows the comparison of the relative energy sizes between different intrinsic mode components (IMFs) without being affected by the total energy level, which is of great help for subsequent feature extraction and classification tasks.

[0055] 3.1.3 Step S102, calculate the energy entropy H:

[0056] The energy ratio p based on the intrinsic mode component IMF i , the energy entropy H is obtained by the following method:

[0057] ;

[0058] The logarithm base is chosen to be 2 so that entropy can be measured in bits.

[0059] It should be noted that if an energy ratio p i is equal to 0, then the corresponding term p i log2(p i) is mathematically undefined. However, in practice, due to computational precision and rounding errors, you may encounter values ​​that are very close to 0 but not exactly 0. To avoid computational errors, you can use a small positive number (such as machine precision) instead of 0 for calculations.

[0060] 3.2 Step S2, Feature Engineering:

[0061] Construct a feature set FS. In addition to the energy entropy H of the time-frequency input signal of the photovoltaic string group, the feature set FS also needs to extract time domain features, frequency domain features and time-frequency features to construct a more comprehensive feature set. Use feature selection technology to reduce the feature dimension and select the features that contribute most to distinguishing different arc faults.

[0062] 3.2.1 Step S200, construct feature set FS:

[0063] The feature set FS includes energy entropy H, as well as the extracted time domain feature vector V1, frequency domain feature vector V2 and time-frequency feature vector V3; the feature set FS is constructed as follows:

[0064] FS=[H,V1 T ,V2 T ,V3 T ] T ;

[0065] Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Indicates the transpose operation of a matrix or vector. In this way, a one-dimensional feature vector can be obtained, which is convenient for subsequent machine learning algorithm processing.

[0066] Among them, the time domain feature vector V1, the frequency domain feature vector V2 and the time-frequency feature vector V3 include their respective means, variances, peak values, skewnesses and kurtosis.

[0067] 3.2.1.1 The time domain feature is a vector V1 composed of the following features:

[0068] 1) Mean μ(Mean): ;

[0069] Where x[n] is the nth sample of the signal and N is the total number of samples in the signal.

[0070] 2) Variance σ 2 (Variance): ;

[0071] Among them, the variance σ 2 A measure of the square of the average deviation of the signal sample values ​​from their mean.

[0072] 3) Peak PV (Peak Value): ;

[0073] The peak PV is the maximum absolute value in the signal.

[0074] 4) Skewness: ;

[0075] Among them, the skewness S is used to measure the asymmetry of the signal probability distribution.

[0076] 5) Kurtosis K(Kurtosis): ;

[0077] Among them, the kurtosis K is used to describe the sharpness of the signal probability distribution.

[0078] 3.2.1.2 Frequency domain features are vectors V2 consisting of the following features:

[0079] 1) Power Spectral Density (PSD):

[0080] It is obtained by normalizing the square of the magnitude of the FFT result of the signal:

[0081] ;

[0082] Where X[k] is the FFT result of x[n] and k is the frequency index.

[0083] 2) Mean μ, variance σ 2 , peak PV, skewness S and kurtosis K:

[0084] Same formula form as 3.2.1.1, but x[n] is replaced by PSD[K].

[0085] 3.2.1.3 The time-frequency feature is a vector V3 consisting of the following features:

[0086] The mean μ and variance σ of the short-time Fourier transform processing result STFTx[n](m,k) on the time-frequency characteristics 2 , peak PV, skewness S and kurtosis K, but considering that for real signals, the result of short-time Fourier transform is symmetrical, so the energy E in this step needs to be adaptively changed:

[0087] ;

[0088] Where M is the total number of time windows.

[0089] The short-time Fourier transform method is:

[0090] ;

[0091] Where w[n] is the Hanning window function, m is the sliding position index of the window function, H does not refer to the energy entropy only in this formula, but the sliding step size of the window function, N is the length of the window function, k is the frequency index, and e is the base of the natural logarithm. is a complex exponential function, j is the imaginary unit, and n is the time index.

[0092] Furthermore, for the mean μ and variance σ of STFTx[n](m,k) 2 , peak PV, skewness S and kurtosis K are in the same formula form as in 3.2.1.1, but x[n] is replaced by E(m).

[0093] 3.2.2 Step S201, feature selection technology:

[0094] For the feature set FS, the feature selection technique is principal component analysis PCA to reduce the feature dimension and form the feature set FS'; then the recursive feature elimination method RFE is used to select the features in the feature set FS' that contribute most to distinguishing different arc faults.

[0095] 3.2.2.1 Step S2010, perform principal component analysis PCA on the feature set FS:

[0096] For the original feature set FS, firstly, standardization is performed so that the mean of each feature is 0 and the variance is 1; then, for the standardized data set, its covariance matrix C is calculated. The element C of the covariance matrix is ij represents the covariance between the i-th feature and the j-th feature.

[0097] Then, calculate the eigenvalues ​​and eigenvectors of the covariance matrix:

[0098] Solve the characteristic equation of the covariance matrix C(v) =λ(v) to obtain the eigenvalue λ and the corresponding eigenvector b.

[0099] Arrange the eigenvalues ​​in descending order, and select the eigenvectors corresponding to the first k largest eigenvalues ​​to form the projection matrix W. These k principal components can retain most of the variance in the original data set.

[0100] Finally, the projection matrix W is used to project the original data set into a new low-dimensional space to obtain the reduced-dimensional feature set: new FS = original FS*W;

[0101] 3.2.2.2 Step S2011, recursive feature elimination method RFE is used for the new feature set FS:

[0102] First, initialize the feature set: use the new feature set FS as the initial feature set.

[0103] Second, evaluate the importance of features: Based on the SVM classifier model constructed later, evaluate the importance of each feature in the feature set FS'.

[0104] Third, remove the least important features: Based on the evaluation results of feature importance, remove one or more of the least important features in the current feature set.

[0105] Fourth, recursive iteration: repeat the above steps until the desired number of features is reached.

[0106] 3.3 Step S3, build classification model:

[0107] Based on the features of the feature set FS, a classification model is constructed to distinguish at least four types of DC arc faults; the classifier model is trained using a dataset D constructed from historical data, wherein the dataset D has labeled fault data; and the performance of the model is evaluated through a cross-validation technique and model parameters are adjusted to optimize the classification performance.

[0108] 3.3.1 Step S300, constructing a SVM classifier model:

[0109] The SVM (Support Vector Machine, SVM) classifier model is used to distinguish four types of DC arc faults. However, the traditional SVM classifier model is mainly applicable to binary classification problems. For multi-classification problems (i.e., the four types of DC arc faults to be distinguished by this technical solution), it is necessary to construct a one-to-one strategy or a one-to-many strategy to construct an SVM classifier model.

[0110] 3.3.1.1 Step S3000, build strategy:

[0111] 1) One-Versus-One Strategy:

[0112] The one-to-one strategy is to build multiple binary SVM classifier models, each of which is used to distinguish two categories (i.e., any two DC arc faults). For a multi-classification problem with K categories, K(K-1) / 2 binary SVM classifier models need to be built. During prediction, each binary SVM classifier model will classify the samples, and finally select the category with the most votes as the prediction result.

[0113] 1.1) First, we need to construct a decision function f(x):

[0114] f(x)=sign(α i y i <w⋅x> + b);

[0115] Among them, sign is the sign function, which determines the category of the sample according to the positive or negative value of (w⋅x+b), w is the weight vector, and x is the input feature vector (that is, any feature set FS i ), b is the bias term, <·,·> is the dot product operation; α i is the Lagrange multiplier, y i is the sample x i The true label of (see the definition below).

[0116] This hyperplane can separate samples of different categories and maximize the distance from the sample point closest to the hyperplane (i.e., support vector) to the hyperplane.

[0117] 1.2) For each binary SVM classifier model, use the RBF kernel function K(x i ,x j ), also known as the Gaussian kernel function:

[0118] ;

[0119] Where γ is the coefficient of the Gaussian kernel, which controls the width of the Gaussian function. i and x j are any two samples of the input feature vector. After the RBF kernel function is trained to obtain the optimal model parameter value in step 302, it will replace the decision function f(x)<w⋅x> .

[0120] 1.3) Introducing loss function:

[0121] As mentioned above, for multi-classification problems, such as distinguishing four types of DC arc faults, multiple binary SVM classifier models are constructed when using a one-to-one strategy. Each binary SVM classifier model attempts to find an optimal hyperplane to distinguish two specific classes.

[0122] When training each binary SVM classifier model, it is necessary to enable the SVM classifier model to adjust its decision boundary so that the support vector (i.e., the sample point closest to the decision boundary) is on the correct side of the boundary and as far away from the boundary as possible. This can maximize the interval between categories, thereby improving the generalization ability of the classifier.

[0123] However, this training strategy is similar to the regression problem solved by the SVR model, so it is not suitable for the SVM classifier model. However, the Hinge loss function can be selected and improved to achieve the same technical effect; this technical solution is called the Hinge insensitive loss function:

[0124] L(y,f(x))=max(0,1−y⋅f(x));

[0125] Where y is the true label (for binary classification, the value is ±1), and f(x) is the output of the decision function. When y⋅f(x)≥1, the loss is 0, indicating that the classification is correct and the confidence is high; when y⋅f(x)<1, the loss is positive, indicating that the classification is wrong or the confidence is low.

[0126] The introduction of Hinge insensitive loss function enables the SVM classifier model to distinguish different labels L during training. i ;

[0127] In the one-to-one strategy, each binary SVM is trained using the Hinge insensitive loss function. In the prediction phase, the classification results of multiple SVMs are combined through voting or other strategies to make the final classification decision. Therefore, the introduction of the Hinge insensitive loss function significantly helps the performance of the SVM classifier model to which the technical solution applies in multi-classification problems. It enables the model to adaptively learn and distinguish different categories, especially when dealing with complex or high-dimensional data.

[0128] 1.4) Setting the optimization problem:

[0129] When training each SVM classifier model, the optimization problem (optimization goal) is as follows:

[0130] ;

[0131] Where C is the regularization parameter used to control the interval size and the penalty for classification errors; i is a slack variable, allowing some samples not to meet the constraints; y i is the sample x i The true label; N is the total number of samples; this optimization problem can be solved by Lagrange multiplier method and quadratic programming techniques.

[0132] 2) One-Versus-Rest strategy:

[0133] For each binary SVM, the Gaussian kernel function K(x i ,x j ) and Hinge insensitive loss function. The difference is that the one-to-one strategy is to build an SVM classifier model for each category to distinguish that category from all other categories. For a multi-classification problem with K categories, K binary SVM classifier models need to be built. When predicting, each SVM classifier model will give the confidence that the sample belongs to its corresponding category, and finally select the category with the highest confidence as the prediction result.

[0134] 3.3.2 Step S301, construct a label set L of fault data:

[0135] L = [L0, L1, L2, L3, L4, L5];

[0136] Among them, L i is any label, L i where i=0~5, where 0 represents normal situation; 1 represents busbar series arc fault; 2 represents series arc fault within a string; 3 represents parallel arc fault within a string; 4 represents parallel arc fault between strings; and 5 represents photovoltaic shading fault.

[0137] 3.3.3 Step S302, training the SVM classifier model:

[0138] Collect historical data of photovoltaic systems to form several feature sets FS and form a data set D:

[0139] During training, the cross-validation method is used to divide the dataset D into k non-overlapping subsets, each time using k−1 subsets as the training set TS and the remaining subset as the validation set VS. This process is repeated k times, each time selecting a different subset as the validation set VS i Finally, the performance of the SVM classifier model is evaluated by the average results of k validations. The Lagrange multiplier α is updated based on the optimization problem. i , weight vector w, bias term b, coefficient γ and regularization parameter C.

[0140] 3.3.3.1 Step S3020, forming a data set D:

[0141] D=[(FS1,L1),(FS2,L2),...,(FS M ,L M )];

[0142] Among them, FS i is the feature set of any time step in M ​​time steps; L i The corresponding FS i The label (0~5).

[0143] 3.3.3.2 Step S3021, perform cross validation:

[0144] S30210, Data partitioning: Divide the original data set D into k subsets of similar size, denoted as D1, D2, …, D k . Each subset D i All subsets should be randomly selected from the original data set, and the subsets should not overlap with each other;

[0145] S30211, training and validation: For each subset Di (i=1,2,…,k), perform the following steps:

[0146] 1) Use except subset D i The union of the remaining k-1 subsets is taken as the training set TS, that is:

[0147] TS=D−D i ;

[0148] 2) Assign an initial value to the coefficient γ and the regularization parameter C;

[0149] 3) Train the SVM classifier model on the training set TS and solve the Lagrange multiplier α by the quadratic programming (QP) method i , weight vector w and bias term b;

[0150] 4) Use subset D i As a validation set VS, evaluate the performance of the trained SVM classifier model and record the accuracy performance index and recall performance index;

[0151] S30212, performance evaluation: repeat step S30211 k times, selecting a different subset D each time i As the validation set. In each repetition, update the coefficient γ and regularization parameter C. At the same time, calculate the average of the performance indicators of k validations as the final performance evaluation result of the SVM classifier model;

[0152] S30213, parameter selection: for different hyperparameter combinations (weight vector w, bias term b, coefficient γ and regularization parameter C), repeat steps S30211 and S30212 until the predetermined number of iterative training times is reached. The hyperparameter combination with the best performance evaluation result is selected as the final model parameter;

[0153] S30214, model training: retrain the SVM classifier model using the entire original data set D and the selected optimal hyperparameters to obtain the final SVM classifier model.

[0154] 3.4 Step S4, real-time fault detection and classification:

[0155] The trained SVM classifier model is deployed to the real-time photovoltaic system, and the real-time extracted intrinsic mode component IMF' is converted into the input feature vector x'; the input feature vector x' is classified and output based on the SVM classifier model. According to the classification output results, the fault type is judged, and a fault warning is issued in real time or corresponding fault handling measures are taken.

[0156] 3.4.1 Step S400, construct input feature vector x':

[0157] As described in steps S1 to S2, the intrinsic mode component IMF' is converted into energy entropy H, and then the time domain eigenvector V1, frequency domain eigenvector V2 and time-frequency eigenvector V3 of the intrinsic mode component IMF are extracted to construct the input eigenvector x':

[0158] x'=[H,V1 T ,V2 T ,V3 T ] T ;

[0159] Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Represents the transpose operation of a matrix or vector.

[0160] 3.4.2 Step S401, classification output:

[0161] Input the input feature vector x' into the decision function f(x) of the SVM classifier model:

[0162] ;

[0163] Where x is the input sample; x i Iteration is support vector;

[0164] The output of the decision function f(x) is the label L i ; According to the output of the SVM classifier model, determine whether the current photovoltaic string status of the photovoltaic system is normal or a certain fault category.

[0165] 3.4.3 Step S402, fault warning and processing:

[0166] The label L obtained from S401 i , if L i If i=any value from 1 to 5, a fault warning will be issued in real time according to the fault type, and the staff will be notified to trigger corresponding fault handling measures, such as shutting down, switching to the backup system, etc.

[0167] Second, the adaptive photovoltaic system fault judgment system:

[0168] It includes a processor, the processor is connected to an MPPT solar controller, the MPPT solar controller is connected to,

[0169] Photovoltaic strings of photovoltaic systems;

[0170] DC load points of photovoltaic systems;

[0171] An AC load point of a photovoltaic system, wherein the AC load point is connected to the MPPT solar controller via an inverter;

[0172] The processor is also connected to a display device and a register, wherein the register stores program instructions;

[0173] When the photovoltaic string group transmits the time-frequency input signal to the MPPT solar controller, the processor synchronously reads the time-frequency input signal;

[0174] When the time-frequency input signal is read by the processor, the program instructions are executed by the processor, so that the processor executes the adaptive photovoltaic system fault judgment method as described above, and reflects the photovoltaic string group status on the display device.

[0175] Compared with the prior art, the present invention has the following beneficial effects:

[0176] 1. Improved accuracy of fault detection and classification: By combining signal processing and machine learning technology, the present invention can accurately detect and classify various faults in the photovoltaic system, which helps to reduce false alarms and missed alarms, thereby improving the reliability and safety of the system. And through real-time monitoring and fault warning, this technical solution enables operation and maintenance personnel to take preventive measures before the fault occurs, avoid or reduce the impact of system faults on photovoltaic power generation, and reduce maintenance costs and downtime.

[0177] 2. Optimization of photovoltaic system performance: The present invention can discover bottlenecks and potential problems in system performance by continuously monitoring and analyzing the working status of the photovoltaic system, and provide data support for system optimization and upgrading. At the same time, the present invention also realizes intelligent management of the photovoltaic system, improves management efficiency and reduces labor costs through automated data collection, processing and analysis.

[0178] 3. Improve the accuracy of fault detection: The present invention obtains the intrinsic mode component IMF by means of technical means without over-envelope, under-envelope, different degrees of end effect and modal aliasing, and further can effectively extract fault features from the signal through energy entropy calculation to reduce the interference of environmental noise. And the feature engineering step provides rich fault information by constructing a comprehensive feature set (including energy entropy, time domain, frequency domain and time-frequency features), which helps the model to distinguish different types of faults more accurately.

[0179] 4. Adaptability and generalization ability: By introducing the LMF strategy and SVM model, the technical solution of the present invention can adaptively handle different fault conditions. The LMF strategy helps to extract the intrinsic characteristics of the signal, while the SVM model learns these characteristics to accurately classify. At the same time, the feature selection technology used in the present invention further improves the generalization ability of the model, and by reducing the influence of irrelevant or redundant features, the model can better adapt to new, unlabeled data.

[0180] V. Flexibility and scalability: The present invention can further improve the classification performance and meet the needs of different application scenarios by adjusting and optimizing the parameters of the SVM model (such as the regularization parameter C and the kernel function coefficient γ). At the same time, the present invention introduces an improved Hinge insensitive loss function, which is applicable to the SVM classifier model in the scenario of the technical solution, because the Hinge insensitive loss function enables the model to adaptively learn and distinguish different categories, which significantly helps the performance in multi-classification problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0181] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0182] Figure 1 It is a schematic diagram of the method flow of the present invention;

[0183] Figure 2 It is a schematic diagram of the construction of the SVM classifier model of the present invention;

[0184] Figure 3 Schematic diagram of the training method of the SVM classifier model of the present invention;

[0185] Figure 4 It is a schematic diagram of the flow chart of the additional technical solution of the present invention;

[0186] Figure 5 It is a schematic diagram of the composition of the system of the present invention;

[0187] Figure 6 It is a schematic diagram showing the trend of accuracy and loss of the SVM classifier model of the present invention during the training process;

[0188] Figure 7 Schematic diagram of the hyperplane of the SVM classifier model of the present invention;

[0189] Figure 8 It is a schematic diagram of the effect of the additional technical solution of the present invention;

[0190] Fig. 9 It is a kernel function classification effect diagram of the SVM classifier model of the present invention;

[0191] Fig.10 It is a normalized schematic diagram of the energy entropy H in the first embodiment of the present invention. DETAILED DESCRIPTION

[0192] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below;

[0193] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0194] Embodiment 1: At present, there is still a lot of room for exploration in the diagnosis technology of photovoltaic string arcs, especially parallel arc faults within and between photovoltaic strings. Considering that the safety hazards caused by these two types of arcs are more serious than series arcs, existing methods still cannot effectively distinguish the above four types of DC arc faults.

[0195] To do this, see Figure 1 , this embodiment discloses an adaptive photovoltaic system fault judgment method;

[0196] For the photovoltaic string group of the photovoltaic system, the time-frequency input signal of the photovoltaic string group is extracted, decomposed based on the EWT algorithm to form the intrinsic mode component IMF, and then the energy entropy is calculated, and then feature extraction and selection are performed. Subsequently, a classification model is constructed to distinguish four types of DC arc faults and trained, and finally the model is deployed to achieve real-time fault detection and classification of the photovoltaic system. The steps specifically include the following steps S1~S4.

[0197] In this embodiment, regarding step S1, energy entropy calculation: the energy E of each intrinsic mode component IMF is calculated. Then these energies E are normalized to obtain the energy ratio of each intrinsic mode component IMF. Next, the energy entropy H is calculated to measure the uniformity of energy distribution between different intrinsic mode components IMF. A higher energy entropy H indicates a more uniform energy distribution, while a lower energy entropy H indicates that the energy is mainly concentrated on a few intrinsic mode components IMF. Step S1 specifically includes three sub-steps, namely steps S100 to S102.

[0198] Specifically, in step S100, the energy E of each intrinsic mode component IMF is calculated as follows: The square of each intrinsic mode component IMF is integrated: Each intrinsic mode component IMF is represented as a continuous signal x(t) or a discrete signal x[n], where t is a time variable and n is a discrete time index. This step is the basis for subsequent fault judgment because it provides important information about the signal energy distribution.

[0199] Among them, for the continuous signal x(t), its energy E is:

[0200] ;

[0201] It represents the total energy of the signal over time.

[0202] However, in practical applications, signals within a finite time interval are often processed. Therefore, for a continuous signal within a finite time interval [T1, T2], the calculation formula for energy E becomes:

[0203] ;

[0204] Among them, for the discrete signal x[n], the calculation of energy E uses summation instead of integration:

[0205] ;

[0206] Where N is the total number of signal samples.

[0207] It should be noted that in practical applications, since the signal may be complex (especially when processing frequency domain data), we can take the square of the modulus x(t) 2 or x[n] 2 to ensure that the energy is non-negative. However, for real signals, the square of the modulus is simply the square of x(t) 2 or x[n] 2 .

[0208] It is understandable that the implementation of step S100 provides key information for subsequent feature extraction and fault classification. By calculating the energy of each IMF, it is possible to understand the energy distribution of the signal on different frequency components, which helps to identify possible fault modes in the photovoltaic system. For example, certain faults may cause an increase or decrease in energy on a specific frequency component. By comparing the energy distribution of the IMF in normal and fault states, accurate judgment of the fault can be achieved.

[0209] Specifically, step S101, normalization: normalizing the energy E to obtain the energy ratio of each intrinsic mode component IMF: normalization is to calculate the energy ratio of each intrinsic mode component IMF. That is, the energies of all eigenmode components IMF are divided by the sum of these energies to ensure that their sum is 1, thereby obtaining the relative energy contribution of each eigenmode component IMF.

[0210] Furthermore, there are M eigenmode components IMF energies, denoted as E1, E2, ..., E M The normalization process is to calculate the energy ratio p of each intrinsic mode component IMF i , where i is an index from 1 to M:

[0211] ;

[0212] in, represents the sum of all intrinsic mode components IMF energy, and p i It is the energy ratio of the i-th IMF component.

[0213] It should be pointed out that the significance of the normalization process is that it allows the comparison of the relative energy sizes between different IMFs without being affected by the total energy level. This is of considerable help for subsequent feature extraction and classification tasks. For example, certain faults may cause the energy of a specific IMF to increase or decrease significantly, and the normalized energy ratio can reveal this change more clearly. In addition, normalization also helps to improve the robustness of the algorithm because it reduces the impact of total energy fluctuations on feature extraction results. The implementation of step S101 not only provides key features (i.e., the energy ratio of each IMF) for subsequent fault judgment, but also makes these features more comparable and interpretable by eliminating the impact of dimensional differences and total energy levels. Therefore, this step plays an indispensable role in the adaptive photovoltaic system fault judgment method and system.

[0214] Specifically, in step S102, the energy entropy H is calculated based on the energy ratio p of each intrinsic mode component (IMF) calculated previously. i The purpose is to quantify the uniformity of energy distribution among different IMFs.i , the energy entropy H is obtained by the following method:

[0215] ;

[0216] The logarithm base is chosen to be 2 so that entropy can be measured in bits.

[0217] It should be pointed out that the energy entropy H comes from the entropy concept theory and is used to describe the distribution of energy among different IMFs.

[0218] It should be pointed out that if an energy ratio p i is equal to 0, then the corresponding term p i log2(p i ) is mathematically undefined. However, in practical applications, due to calculation accuracy and rounding errors, you may encounter values ​​that are very close to 0 but not exactly 0. To avoid calculation errors, you can use a small positive number (such as machine precision) instead of 0 for calculation. This ensures that the calculation is carried out smoothly without significantly affecting the result.

[0219] It can be understood that the implementation of S102 provides an important basis for subsequent fault judgment. The higher the value of energy entropy H, the more evenly the energy is distributed among different IMFs; conversely, if the energy is mainly concentrated on a few IMFs, the value of energy entropy H will be lower. This energy distribution is closely related to the operating state of the photovoltaic system. For example, under normal operating conditions, energy may be relatively evenly distributed on various IMFs; while under certain fault conditions, energy may be concentrated on specific IMFs, causing the value of energy entropy H to change. Therefore, by monitoring the changes in energy entropy H, potential faults of the photovoltaic system can be discovered in a timely manner and handled accordingly.

[0220] Furthermore, the Python execution program (matplotlib library needs to be installed) of the above steps S100 to S102 is as follows:

[0221] import numpy as np

[0222] import matplotlib.pyplot as plt

[0223] from mpl_toolkits.mplot3d import Axes3D

[0224] # Step S100: Calculate the energy E of each IMF

[0225] energies = np.sum(imfs ** 2, axis=1)

[0226] # Step S101: Normalize the energy to get the energy proportion of each IMF

[0227] total_energy = np.sum(energies) # Calculate the total energy

[0228] energy_ratios = energies / total_energy # Calculate energy ratio

[0229] # Step S102: Calculate energy entropy H

[0230] epsilon = 1e-10 # avoid log(0) cases

[0231] energy_entropy = -np.sum(energy_ratios * np.log2(energy_ratios +epsilon))

[0232] # Output energy entropy H

[0233] print("Energy entropy H:", energy_entropy)

[0234] # Draw a normalized graph

[0235] z_axis = np.linspace(0, 1, time_length)

[0236] x_axis = np.arange(num_imfs)

[0237] y_axis = energies

[0238] # Draw a 3D space graph

[0239] fig = plt.figure()

[0240] ax = fig.add_subplot(111, projection='3d')

[0241] ax.bar3d(x_axis, np.zeros(num_imfs), z_axis[::time_length / / num_imfs],1, y_axis, np.ones(num_imfs)*0.5, shade=True)

[0242] ax.set_xlabel('IMF Index')

[0243] ax.set_ylabel('Energy')

[0244] ax.set_zlabel('Additional Dimension (eg, Time or Frequency)')

[0245] plt.show()

[0246] For example, based on the data set D of the experimental example below, 10 groups of IMF are randomly selected for the above program to run, and the normalized graph output is as follows: Fig.10 As shown in the figure, it can be seen that the energy entropy H of the four types of faults that need to be clearly distinguished are significantly different, which provides theoretical support for the aforementioned statement that "by monitoring the changes in energy entropy H, potential faults of the photovoltaic system can be discovered in time and handled accordingly."

[0247] In this embodiment, regarding step S2, feature engineering: construct a feature set FS. The construction of the feature set FS not only depends on the energy entropy H, but also combines the time domain features, frequency domain features and time-frequency features, thereby providing a multi-angle and comprehensive fault judgment basis. Use feature selection technology to reduce the feature dimension and select the features that contribute most to distinguishing different arc faults. Step S2 specifically includes two sub-steps, steps S200~S201.

[0248] Specifically, in step S200, construct a feature set FS:

[0249] The feature set FS includes energy entropy H, as well as the extracted time domain feature vector V1, frequency domain feature vector V2 and time-frequency feature vector V3; the feature set FS is constructed as follows:

[0250] FS=[H,V1 T ,V2 T ,V3 T ] T

[0251] Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Indicates the transpose operation of a matrix or vector. In this way, a one-dimensional feature vector can be obtained, which is convenient for subsequent machine learning algorithm processing.

[0252] Among them, the time domain feature vector V1, the frequency domain feature vector V2 and the time-frequency feature vector V3 include their respective means, variances, peak values, skewnesses and kurtosis.

[0253] Optionally, step S201, feature selection technology: for feature set FS, use feature selection technology for principal component analysis PCA to reduce feature dimensions to form feature set FS'; then use recursive feature elimination method RFE to select the features in feature set FS' that contribute most to distinguishing different arc faults. If you want to perform this step, you can refer to the technical solution disclosed in embodiment 3, which includes two sub-steps, steps S2010~S2011.

[0254] In this embodiment, regarding step S3, a classification model is constructed: based on the features of the feature set FS, a classification model is constructed to distinguish at least four types of DC arc faults; a data set D constructed from historical data is used to train the classifier model, wherein the data set D has labeled fault data; and the performance of the model is evaluated by cross-validation technology and model parameters are adjusted to optimize the classification performance. Specifically, it includes three sub-steps from S300 to S302.

[0255] For details, please refer to Figure 2 , step S300, constructing an SVM classifier model: the SVM classifier model is used to distinguish four types of DC arc faults. However, the traditional SVM classifier model is mainly applicable to binary classification problems. For multi-classification problems (i.e., the four types of DC arc faults to be distinguished by the present technical solution), it is necessary to construct a one-to-one strategy or a one-to-many strategy to construct an SVM classifier model.

[0256] Further, in step S3000, a strategy is constructed:

[0257] 1) One-versus-one strategy: Build multiple binary classification SVM models, each model distinguishes two fault categories. For four faults, it is necessary to build 6 (4 out of 2 combinations) binary classification SVM models; when predicting, each binary classification SVM classifier model will classify the sample, and finally select the category with the most votes as the prediction result;

[0258] The architecture of the SVM classifier model is as follows Figure 2 As shown, including:

[0259] 1.1) Decision function f(x): It is the basis of classification and is used to determine the category of the sample:

[0260] f(x)=sign(α i y i

[0261] Among them, sign is the sign function, which determines the category of the sample according to the positive or negative value of (w⋅x+b), w is the weight vector, and x is the input feature vector (that is, any feature set FS i), b is the bias term, <·,·> is the dot product operation; α i is the Lagrange multiplier, y i is the sample x i The true label of (see the definition below).

[0262] Preferably, the symbol function sign is:

[0263] ;

[0264] The determination of the decision boundary is based on the principle of maximizing the interval, rather than directly relying on whether the decision function is exactly zero.

[0265] 1.2) For each binary SVM classifier model, use the RBF kernel function K(x i ,x j ): It is used to map linearly inseparable data into a high-dimensional space and find a hyperplane to make it linearly separable:

[0266] ;

[0267] Wherein, γ is the coefficient of the Gaussian kernel, which controls the width of the Gaussian function and needs to be determined through the training of step S302 to obtain the optimal value. i and x j are any two samples of with the input feature vectors as .

[0268] It should be noted that after the RBF kernel function is trained to obtain the optimal model parameter value in step 302, the RBF kernel function K(x i ,x j ) will replace the decision function f(x) in

[0269] Because when using the RBF kernel function in SVM, we are actually looking for an optimal hyperplane in a high-dimensional space, such as Figure 7 As shown. When the kernel function RBF kernel function K(x i ,x j ) After mapping the data to a high-dimensional space, this hyperplane can separate samples of different categories and maximize the distance from the sample point closest to the hyperplane (i.e., the support vector) to the hyperplane, such as Fig. 9 As shown in Figure 2. This hyperplane is not found directly in the original feature space, but is a hyperplane in a high-dimensional space implicitly defined by the kernel function. Therefore, the inner product in the decision function

[0270] 1.3) Introducing loss function:

[0271] The Hinge loss function is selected and improved to form the Hinge insensitive loss function:

[0272] L(y,f(x))=max(0,1−y⋅f(x));

[0273] Where y is the true label (for binary classification, the value is ±1), and f(x) is the output of the decision function. When y⋅f(x)≥1, the loss is 0, indicating that the classification is correct and the confidence is high; when y⋅f(x)<1, the loss is positive, indicating that the classification is wrong or the confidence is low.

[0274] Furthermore, the meaning of this loss function is that when the product of the predicted value y and the target value t is less than 1 (i.e., the classification is wrong or the confidence of the classification is not high enough), a loss will occur. When the product is greater than or equal to 1, the loss is 0, indicating that the classification is correct and the confidence is sufficient.

[0275] Preferably, the Hinge insensitive loss function can be further optimized:

[0276] ;

[0277] Among them, y i is the sample x i The true category label of f(x i ) is the model's prediction for sample x i The decision function output. j traverses all except the true category y i All other categories except . D is a positive number used to adjust the penalty of loss. ε is an insensitive parameter, which is a small positive number indicating the width of the insensitive region.

[0278] The term calculates the relative difference between the true category and other categories and is normalized to ensure scale consistency.

[0279] The preferred Hinge insensitive loss function has the following effects:

[0280] 1) Adapting to multi-classification problems: Based on a one-to-one strategy, a loss term is calculated for each pair of different categories. To achieve this, that is, the true category y of the current sample i Compare with all other categories j.

[0281] 2) Introducing an insensitive region: The introduction of the insensitive parameter ε creates a region where a small change in the predicted value does not lead to an increase in loss. This helps the model to be more robust to small perturbations near the classification boundary while avoiding overfitting to noise or outliers in the training data.

[0282] 3) Adjust the penalty for loss: Parameter D is used to adjust the penalty for loss. A larger D value means that the model will punish classification errors or points close to the boundary more severely, thus tending to form a stricter classification boundary; while a smaller D value will make the model more tolerant and allow some small errors in classification.

[0283] 4) Relative difference and normalization: The term calculates the relative difference between the true category and other categories. The normalization here (i.e., dividing by the term in the denominator) is to ensure that the predicted values ​​of different scales are consistent when compared, thereby avoiding unfair comparisons due to different magnitudes of predicted values.

[0284] It can be understood that the introduction of any of the above two Hinge insensitive loss functions enables the SVM classifier model to distinguish different labels L during the training process. i ; That is, this function enables the SVM model to adjust the decision boundary during training, maximize the category interval, and improve the generalization ability. When y·f(x)≥1, it means that the classification is correct and the confidence is high, and the loss is 0; otherwise, it means that the classification is wrong or the confidence is low, and the loss is positive. The introduction of the Hinge insensitive loss function significantly helps the performance of the SVM classifier model to which the technical solution applies in multi-classification problems. It enables the model to adaptively learn and distinguish different categories, especially when dealing with complex or high-dimensional data.

[0285] 1.4) Setting the optimization problem:

[0286] When training each SVM classifier model, the optimization problem (optimization goal) is as follows:

[0287] ;

[0288] Where C is the regularization parameter used to control the interval size and the penalty for classification errors; ξ i is a slack variable, allowing some samples not to meet the constraints; y i is the sample x i The real label (i.e., the real data value) of ; N is the total number of samples; this optimization problem can be solved by the Lagrange multiplier method, or the quadratic programming technology disclosed in Example 4;

[0289] It can be understood that the above optimization problem is essentially stating: minimize the sum of the norm of the weight vector and the penalty term of the classification error;

[0290] It can be understood that the one-to-one strategy can improve the classification accuracy by constructing and combining multiple binary SVM models to perform more refined classification for four DC arc faults. The introduction of RBF kernel function and improved Hinge loss function enables the model to process nonlinearly separable data and adjust the decision boundary to maximize the class interval, thereby enhancing the generalization ability of the model. Moreover, the one-to-one strategy allows the construction of multi-classification SVM models for any number of categories, so it has better flexibility and scalability.

[0291] Optional, One-Versus-Rest strategy: For each binary SVM, use the Gaussian kernel function K(x i ,x j ) and Hinge insensitive loss function are the same as the one-to-one strategy. The difference is that the one-to-many strategy builds an SVM classifier model for each category to distinguish that category from all other categories. For a multi-classification problem with K categories, K binary SVM classifier models need to be built. When predicting, each SVM classifier model will give the confidence that the sample belongs to its corresponding category, and finally select the category with the highest confidence as the prediction result.

[0292] Furthermore, the python (using the SVC class from the scikit-learn library) architecture of the above SVM classifier model is as follows:

[0293] from sklearn.svm import SVC

[0294] # Initialize the SVM classifier model

[0295] svm_classifier = SVC(kernel='rbf', probability=True, decision_function_shape='ovo')

[0296] # Decision function (used after model training)

[0297] decision_func = svm_classifier.decision_function(X_test) # X_test is the test set feature

[0298] print(decision_func) # Output the value of the decision function

[0299] # The RBF kernel function and Hinge loss function are implemented inside SVC and do not need to be called explicitly; during model training, SVC will optimize according to the set kernel parameters ('rbf') and loss function (the default is Hinge loss)

[0300] # Model training example (this step is performed in S302)

[0301] svm_classifier.fit(X_train, y_train) # X_train is the training set feature, y_train is the training set label

[0302] # implement

[0303] predictions = svm_classifier.predict(X_test) # Predict the test set

[0304] print(predictions) # Output prediction results

[0305] Specifically, in step S301, a label set L of fault data is constructed: L=[L0, L1, L2, L3, L4, L5];

[0306] Among them, L i is any label, L i Where i=0~5, the label information is shown in the following table:

[0307]

[0308] For details, please refer to Figure 3 , step S302, training the SVM classifier model: collecting historical data of the photovoltaic system, forming several feature sets FS and forming a data set D:

[0309] During training, the cross-validation method is used to divide the dataset D into k non-overlapping subsets, each time using k−1 subsets as the training set TS and the remaining subset as the validation set VS. This process is repeated k times, each time selecting a different subset as the validation set VS i Finally, the performance of the SVM classifier model is evaluated by the average results of k validations. The Lagrange multiplier α is updated based on the optimization problem. i , weight vector w, bias term b, coefficient γ and regularization parameter C. The specific training method of step S302 can refer to the technical solution disclosed in the fourth embodiment.

[0310] In this embodiment, regarding step S4, real-time fault detection and classification: deploy the trained SVM classifier model to the real-time photovoltaic system, convert the real-time extracted intrinsic mode component IMF' into an input feature vector x'; classify and output the input feature vector x' based on the SVM classifier model. According to the classification output result, determine the fault type, and issue a fault warning or take corresponding fault handling measures in real time. Step S4 specifically includes two sub-steps, S400~S401.

[0311] Specifically, step S400, constructing an input feature vector x': as described in steps S1 to S2, the intrinsic mode component IMF' is converted into energy entropy H, and then the time domain feature vector V1, frequency domain feature vector V2 and time-frequency feature vector V3 of the intrinsic mode component IMF are extracted to construct the input feature vector x':

[0312] x'=[H,V1 T ,V2 T ,V3 T ] T ;

[0313] Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Represents the transpose operation of a matrix or vector.

[0314] Specifically, step S401, classification output: During prediction, each binary SVM classifier model will classify the sample, and finally select the category with the most votes as the prediction result; first, the input feature vector x' is input into the decision function f(x) of the SVM classifier model:

[0315] ;

[0316] Then, the counting process is introduced: a vote counter function votes[N] is set, initialized to 0, and for each output of the binary SVM classifier model, the number of votes of the corresponding category is updated. Finally, the category with the most votes is selected as the prediction result; the counting python program is as follows:

[0317] votes = array of size N initialized with 0

[0318] for each binary SVM classifier model m:

[0319] label_m = f_m(x') / / Call the decision function of the mth binary SVM classifier model

[0320] votes[label_m] += 1 / / Update the number of votes for the corresponding category

[0321] end for

[0322] predicted_label = argmax(votes) / / Select the category with the most votes as the predicted result

[0323] Among them, the argmax function returns the index corresponding to the maximum value in the votes array votes. Finally, predicted_label (i.e. L i ) is the category label with the most votes, which will be used as the output of the photovoltaic system fault detection and classification system. That is, the final predicted category label L i .

[0324] Specifically, the logic of the above prediction is:

[0325] P1. Initialization: First, create an array votes of size N, where N is the total number of categories. Since the category labels Li range from 0 to 5, N should be equal to 6. Each element of the array votes is initialized to 0, indicating that each category does not receive any votes at the beginning.

[0326] P2. Prediction of SVM classifier model: For each trained binary SVM classifier model m (these models are trained under a one-to-one strategy or other strategies to distinguish each pair of different categories), a prediction is made for the current data point x' to be classified. This prediction is done by calling the decision function "f_m(x')" of the SVM classifier model, which returns a binary label with a value of -1 or 1 (which can also be converted to 0 and 1, depending on the specific implementation).

[0327] P3, Voting: Each time the decision function is called, the votes array is updated according to the returned label. Specifically, if the label returned by "f_m(x')" is label_m, the element indexed by label_m in the votes array will increase by 1. This can be regarded as a vote for the category label_m.

[0328] P4. Count the votes: After traversing all binary SVM classifier models and making predictions and votes for each model, each element in the votes array represents the number of votes for the corresponding category.

[0329] P5. Select the category with the most votes: Finally, use the argmax function to find the index corresponding to the maximum value in the votes array. This index is the predicted_label of the category with the most votes, which is Li. argmax(votes) returns an integer representation of the category label (one from 0 to 5).

[0330] Therefore, the label Li is predicted by multiple binary SVM classifier models under a one-to-one strategy and voted based on the output of these models. Each classifier classifies the data point and casts a vote for the category it believes, and the category with the most votes is selected as the prediction result. This method allows SVM, an essentially binary classification algorithm, to handle multi-classification problems.

[0331] It should be pointed out that the RBF kernel function here is different from the "K(x i ,x j )”, where x is the feature vector of the input sample to be classified; the RBF kernel function K(x i ,x) is used to transform the input sample x and into the support vector x i Mapping from the original feature space to a higher-dimensional space, and then calculating their inner product in this high-dimensional space as a measure of similarity. In this way, SVM is able to handle nonlinear separable problems.

[0332] Specifically, step S402, fault warning and processing: according to the label L obtained in S401 i , if L i If i=any value from 1 to 5, a fault warning will be issued in real time according to the fault type, and the staff will be notified to trigger corresponding fault handling measures, such as shutting down, switching to the backup system, etc.

[0333] Embodiment 2: Based on Embodiment 1, this embodiment further discloses a specific implementation of step S200.

[0334] In step S200, the time domain feature vector V1, the frequency domain feature vector V2 and the time-frequency feature vector V3 include their respective means, variances, peak values, skewnesses and kurtosis.

[0335] Specifically, the time domain feature is a vector V1 composed of the following features:

[0336] 1) Mean μ: It indicates the average level of the signal and reflects the central trend of the signal:

[0337] ;

[0338] Where x[n] is the nth sample of the signal and N is the total number of samples in the signal.

[0339] 2) Variance σ 2 (Variance): Measures the square of the average deviation between the signal sample value and its mean, reflecting the degree of dispersion of the signal:

[0340] ;

[0341] Among them, the variance σ 2 A measure of the square of the average deviation of the signal sample values ​​from their mean.

[0342] 3) Peak Value (PV): The maximum absolute value of a signal, reflecting the strength or amplitude of the signal:

[0343] ;

[0344] The peak PV is the maximum absolute value in the signal.

[0345] 4) Skewness S (Skewness): Measures the asymmetry of the signal probability distribution and reflects the degree of skewness of the signal distribution:

[0346] ;

[0347] Among them, the skewness S is used to measure the asymmetry of the signal probability distribution.

[0348] 5) Kurtosis K (Kurtosis): describes the sharpness of the signal probability distribution and reflects the peak state of the signal distribution:

[0349] ;

[0350] Among them, the kurtosis K is used to describe the sharpness of the signal probability distribution.

[0351] Specifically, the frequency domain feature is a vector V2 composed of the following features:

[0352] 1) Power Spectral Density (PSD): reflects the energy distribution of the signal in the frequency domain. It is obtained by normalizing the modulus square of the FFT result of the signal:

[0353] ;

[0354] Where X[k] is the FFT result of x[n] and k is the frequency index.

[0355] 2) Mean μ, variance σ2 , peak PV, skewness S and kurtosis K: The formula form is the same as vector V1, but x[n] is replaced by PSD[K]. By calculating the mean μ and variance σ of PSD 2 , peak PV, skewness S and kurtosis K are used to describe the statistical characteristics of the signal in the frequency domain.

[0356] Specifically, the time-frequency feature is a vector V3 composed of the following features: the mean μ and variance σ of the short-time Fourier transform processing result STFTx[n](m,k) of the time-frequency feature 2 , peak PV, skewness S and kurtosis K, but considering that for real signals, the result of short-time Fourier transform is symmetrical, so the energy E in this step needs to be adaptively changed:

[0357] ;

[0358] Where M is the total number of time windows.

[0359] It should be pointed out that, considering that the STFT result of the real signal is symmetrical, only the first half of the frequency components are taken for calculation to obtain the energy E(m) in each time window.

[0360] Furthermore, based on the energy distribution of the signal at different times and frequencies, STFT slides a window function on the time axis and performs Fourier transform on the signal within the window function to obtain the time-frequency representation of the signal. The method of short-time Fourier transform is:

[0361] ;

[0362] Where w[n] is the Hanning window function, m is the sliding position index of the window function, H does not refer to the energy entropy only in this formula, but the sliding step size of the window function, N is the length of the window function, k is the frequency index, and e is the base of the natural logarithm. is a complex exponential function, j is the imaginary unit, and n is the time index.

[0363] Furthermore, for the mean μ and variance σ of STFTx[n](m,k) 2 , peak PV, skewness S and kurtosis K, are in the same formula form as vector V1, but x[n] is replaced by E(m).

[0364] It can be understood that based on the above solution of this embodiment, a comprehensive and rich feature set FS is constructed by extracting and combining these features, which can reflect the operating status of the photovoltaic system from different angles. For subsequent fault judgment and classification, more information and clues are provided to distinguish different fault types. At the same time, through feature selection and dimensionality reduction technology, the feature set FS can be further optimized to improve the accuracy and efficiency of fault judgment.

[0365] Furthermore, the Python execution program of the above step S200 is as follows:

[0366] import numpy as np

[0367] from scipy.fft import fft

[0368] from scipy.signal import stft

[0369] # Time domain feature vector V1

[0370] def compute_time_domain_features(x):

[0371] mean = np.mean(x)

[0372] variance = np.var(x)

[0373] peak_value = np.max(np.abs(x))

[0374] skewness = np.mean((x - mean)**3) / (variance**(3 / 2))

[0375] kurtosis = np.mean((x - mean)**4) / (variance**2)

[0376] return np.array([mean, variance, peak_value, skewness, kurtosis])

[0377] V1 = compute_time_domain_features(x)

[0378] # Frequency domain feature vector V2

[0379] def compute_frequency_domain_features(x):

[0380] X = fft(x)

[0381] PSD = np.abs(X)**2 / len(x)

[0382] mean = np.mean(PSD)

[0383] variance = np.var(PSD)

[0384] peak_value = np.max(PSD)

[0385] skewness = np.mean((PSD - mean)**3) / (variance**(3 / 2))

[0386] kurtosis = np.mean((PSD - mean)**4) / (variance**2)

[0387] return np.array([mean, variance, peak_value, skewness, kurtosis])

[0388] V2 = compute_frequency_domain_features(x)

[0389] # Time-frequency feature vector V3

[0390] def compute_time_frequency_domain_features(x, fs, window_length, hop_length):

[0391] f, t, Sxx = stft(x, fs=fs, nperseg=window_length, noverlap=window_length-hop_length)

[0392] E = np.sum(np.abs(Sxx)**2, axis=0) # Calculate the energy of each time window

[0393] mean = np.mean(E)

[0394] variance = np.var(E)

[0395] peak_value = np.max(E)

[0396] skewness = np.mean((E - mean)**3) / (variance**(3 / 2))

[0397] kurtosis = np.mean((E - mean)**4) / (variance**2)

[0398] return np.array([mean, variance, peak_value, skewness, kurtosis])

[0399] # fs is the sampling frequency, window_length is the window function length, hop_length is the window function sliding step length

[0400] fs = ... # Set the sampling frequency

[0401] window_length = ... # Set the window function length

[0402] hop_length = ... # Set the sliding step length of the window function

[0403] V3 = compute_time_frequency_domain_features(x, fs, window_length,hop_length)

[0404] # Build feature set FS

[0405] FS = np.concatenate(([np.sum(np.log(1 + 1 / PSD))], V1, V2, V3))

[0406] In the above program, the signal x is directly statistically calculated to obtain the mean, variance, peak, skewness and kurtosis. These features reflect the basic statistical properties of the signal. Then the signal x is subjected to a fast Fourier transform (FFT) to obtain the spectrum X. Then the power spectral density (PSD), which is the normalized value of the square of the spectrum modulus, is calculated. Finally, the PSD is statistically calculated similarly to the time domain features. These features describe the energy distribution and statistical characteristics of the signal in the frequency domain. Then the signal is processed using the short-time Fourier transform (STFT). STFT obtains the time-frequency representation of the signal by sliding a window function on the signal and calculating the FFT in each window. Then the energy in each time window is calculated, and these energy values ​​are statistically calculated. These features combine information in the two dimensions of time and frequency, and can reflect the local characteristics of the signal. Finally, the calculated time domain, frequency domain and time-frequency feature vectors and energy entropy H (a simple calculation method is given in the example) are merged into a feature set FS. This feature set will be used for subsequent fault judgment and classification tasks.

[0407] Embodiment 3: Based on Embodiment 1, this embodiment further discloses the specific implementation of step S201:

[0408] In this embodiment, regarding step S2010, principal component analysis PCA is performed on the feature set FS: for the original feature set FS, firstly, a standardization process is performed so that the mean value of each feature is 0 and the variance is 1:

[0409] ;

[0410] Among them, z is the standardized value, x is the original value, μ is the mean, and σ is the standard deviation. Through this step, the mean of each feature becomes 0 and the variance becomes 1.

[0411] Then, for the standardized data set, calculate its covariance matrix C. The elements of the covariance matrix C ij represents the covariance between the i-th feature and the j-th feature. Then, the eigenvalues ​​and eigenvectors of the covariance matrix are calculated:

[0412] 1) Solve the characteristic equation of the covariance matrix C(v) =λ(v) to obtain the eigenvalue λ and the corresponding eigenvector b.

[0413] 2) Arrange the eigenvalues ​​in descending order, and select the eigenvectors corresponding to the first k largest eigenvalues ​​to form the projection matrix W. These k principal components can retain most of the variance in the original data set.

[0414] 3) Finally, use the projection matrix W to project the original data set into a new low-dimensional space to obtain the reduced feature set: new FS = original FS*W.

[0415] It can be understood that the technical solution of this embodiment is processed by PCA, and the original high-dimensional feature set is compressed into a feature set FS' in a low-dimensional space, which simplifies the complexity of the fault judgment model and improves the calculation efficiency. At the same time, the new features (principal components) after PCA conversion are independent of each other (i.e., unrelated), which helps to reduce redundant information between features and make the model more robust. Moreover, by selecting the eigenvectors corresponding to the first k largest eigenvalues, PCA can retain most of the important information (variance) in the original data, thereby reducing the dimension without losing too much useful information. This is crucial for accurately judging the faults of photovoltaic systems.

[0416] In this embodiment, regarding step S2011, the recursive feature elimination method RFE is applied to the new feature set FS:

[0417] First, initialize the feature set: use the new feature set FS as the initial feature set.

[0418] Second, evaluate the importance of features: Based on the SVM classifier model constructed later, evaluate the importance of each feature in the feature set FS'.

[0419] Third, remove the least important features: Based on the evaluation results of feature importance, remove one or more of the least important features in the current feature set.

[0420] Fourth, recursive iteration: repeat the above steps until the desired number of features is reached.

[0421] It should be pointed out that step S2011 needs to be coordinated with step S3021, ie, the training process of the SVM classifier model in real time; therefore, it can be implemented simultaneously in combination with the technical solution disclosed in Example 4.

[0422] Example 4: Please refer to Figure 3 Based on the first embodiment, this embodiment further discloses a specific training method of the SVM classifier model as described in step S302, which specifically includes the following steps S3020~S3021.

[0423] In this embodiment, regarding S3020, a data set D in vector form is formed:

[0424] D=[(FS1,L1),(FS2,L2),...,(FS M ,L M )];

[0425] Among them, FS i is the feature set of any time step in M ​​time steps; L i The corresponding FS i The label (0~5).

[0426] In this embodiment, regarding step S3021, a cross-validation method is performed, which includes the following steps:

[0427] S30210, Data partitioning: Divide the original data set D into k subsets of similar size D1, D2, ..., D k . Each subset D i is obtained from the original data set by random sampling, and each subset D i The purpose of this is to ensure that in the subsequent cross-validation process, each subset D i can be used independently as a validation set to more comprehensively evaluate the performance of the model.

[0428] S30211, training and validation: For each subset D i (i=1,2,…,k), perform the following steps:

[0429] 1) Construct training set TS: Use the current subset D i The union of the remaining k-1 subsets is taken as the training set TS. That is, in each iteration, a different subset will be excluded from the training set for subsequent verification.

[0430] 2) Initialization parameters: Assign an initial value to the coefficient γ and the regularization parameter C. These parameters play an important role in the training process of the SVM classifier and need to be found through continuous iteration and optimization to find the best value.

[0431] 3) Training SVM classifier: Train the SVM classifier model on the training set TS. Solve the Lagrange multiplier α by quadratic programming method i , weight vector w and bias term b. These parameters together define the decision boundary and classification rule of the SVM classifier.

[0432] Specifically, the implementation method of the quadratic programming method is:

[0433] 3.1) Based on the quadratic programming method, introduce the original optimization problem:

[0434] ;

[0435] This problem is a constrained optimization problem, which can be transformed into an unconstrained optimization problem through the Lagrange multiplier method. In the Lagrange multiplier method, a Lagrange multiplier is introduced for each constraint condition, and a Lagrange function is constructed. Then, by taking the partial derivatives of the Lagrange function and setting the partial derivatives to zero, a set of equations can be obtained, which can be used to solve the optimal solution of the original optimization problem.

[0436] However, it is very difficult to solve this set of equations directly, especially when the amount of data is large or the feature dimension is high. Since the quadratic programming method can be transformed into a standard quadratic programming problem through a series of transformations, in this embodiment, the quadratic programming method is combined with Lagrangian duality to transform the original optimization problem into a dual problem;

[0437] 3.2) Iterate the original optimization problem into:

[0438] ;

[0439] Where N is the number of training samples; α i and α j are the i-th and j-th Lagrange multipliers respectively; y i is the sample x i The data label of (+1 or -1 in the binary classification problem); K(x i ,x j ) is the RBF kernel function, which is used to calculate the sample x i and x j The similarity between

[0440] in, The term is the dual problem mentioned above. Once the optimal Lagrange multiplier α is obtained i , we can use them to calculate the weight vector w and the bias term b, thereby obtaining the decision function of SVM.

[0441] 3.3) Once the optimal Lagrange multiplier α is obtained through the quadratic programming method i , we can further derive the weight vector w:

[0442] ;

[0443] Or do not directly calculate the weight vector w, because the RBF kernel function form K(x i ,x j ) maps the data into an infinite-dimensional feature space. Therefore, the support vectors and the corresponding Lagrange multipliers α are directly used by the decision function f(x) i And the RBF kernel function K(x i ,x j ) to calculate the weight vector w.

[0444] 3.4) The bias term b can be obtained by any support vector x s To calculate:

[0445] ;

[0446] Among them, y sis the support vector x s Corresponding data label; K(x i ,x j ) is the RBF kernel function, which is used to calculate the sample x i and the support vector x s The similarity between .

[0447] It should be noted that the support vector is x s Refers to the non-zero Lagrange multiplier α during the training process i (i.e. 0<α i

[0448] 4) Verify model performance: Use the current subset D i As the validation set VS, evaluate the performance of the trained SVM classifier model. Record the loss curve and accuracy curve for subsequent quantitative evaluation of the model performance.

[0449] For example, Figure 6 As shown in the figure, the loss curve (calculated by the Hinge insensitive loss function) and the accuracy curve (determined by the result judgment of the decision function and the actual data label) of step S30211 executed 1950 times are recorded; it can be seen that through the above cross-validation method, the higher the number of iterations, the better the performance of the model.

[0450] S30212, performance evaluation: repeat step S30211 k times, selecting a different subset D each time i As the validation set. In each repetition, the coefficient γ and the regularization parameter C are updated to find the best parameter combination. At the same time, the average of the performance indicators of k validations is calculated as the final performance evaluation result of the SVM classifier model. This ensures that the evaluation results of the model performance are more stable and reliable. Including:

[0451] 1) Each time step S30211 is executed, the F1 score on the validation set is calculated:

[0452] ;

[0453] ;

[0454] ;

[0455] Among them, RP is the precision of the validation set, RE is the recall of the validation set, TP is the true positive example of the validation set, FP is the false positive example of the validation set, and FN is the false negative example of the validation set;

[0456] 2) Fit the relationship between F1 score and γ and C through Bayesian optimization. Enter the iterative loop until the maximum number of iterations is reached, and then update the best observed F1 score and its corresponding γ and C values.

[0457] S30213, parameter selection: for different hyperparameter combinations (including weight vector w, bias term b, coefficient γ and regularization parameter C), repeat steps S30211 and S30212 until the predetermined number of iterative training is reached. In each iteration, the value of the hyperparameter is updated according to the performance index of the validation set. Finally, the hyperparameter combination with the best performance evaluation result is selected as the final model parameter. This ensures that the trained SVM classifier model has the best performance.

[0458] S30214, Model training: Retrain the SVM classifier model using the entire original data set D and the selected optimal hyperparameters. During the training process, the previously selected optimal hyperparameter combination will be used to optimize the decision boundary and classification rules of the model. The resulting SVM classifier model will have better generalization ability and accuracy, providing strong support for subsequent photovoltaic system fault judgment.

[0459] Furthermore, the Python execution program of steps S3020 to S3021 of this embodiment is as follows (the scikit-learn library needs to be installed for SVM training and cross-validation, and the scikit-optimize library needs to be installed for Bayesian optimization):

[0460] import numpy as np

[0461] from sklearn import svm, datasets

[0462] from sklearn.model_selection import cross_val_score, StratifiedKFold

[0463] from sklearn.metrics import f1_score, make_scorer

[0464] from skopt import gp_minimize

[0465] from skopt.space import Real

[0466] from skopt.utils import use_named_args

[0467] # S3020: Import dataset D

[0468] # Use the scikit-learn built-in iris dataset

[0469] iris = datasets.load_iris()

[0470] X, y = iris.data, iris.target

[0471] # Define the SVM training function, which will accept γ and C as parameters and return the cross-validated F1 score

[0472] @use_named_args(dimensions=[Real(1e-6, 1e+6,'log-uniform', name='gamma'),

[0473] Real(1e-6, 1e+6,'log-uniform', name='C')])

[0474] def svm_cross_val(gamma, C):

[0475] # S3021: Perform cross validation

[0476] clf = svm.SVC(gamma=gamma, C=C, kernel='rbf', probability=True)

[0477] cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)

[0478] f1_scorer = make_scorer(f1_score, average='macro')

[0479] f1_scores = cross_val_score(clf, X, y, cv=cv, scoring=f1_scorer)

[0480] return -np.mean(f1_scores) # Note that a negative number is returned because gp_minimize is a minimization function

[0481] # Bayesian optimization search space definition

[0482] search_space = [Real(1e-6, 1e+6,'log-uniform', name='gamma'),

[0483] Real(1e-6, 1e+6,'log-uniform', name='C')]

[0484] # Perform Bayesian optimization

[0485] result = gp_minimize(svm_cross_val, search_space, n_calls=30, random_state=42)

[0486] # Output the best parameter combination and the corresponding F1 score

[0487] best_gamma = result.x[0]

[0488] best_C = result.x[1]

[0489] best_f1 = -result.fun # Returns negative F1 scores in svm_cross_val

[0490] print(f"Best gamma: {best_gamma}, Best C: {best_C}, Best F1score: {best_f1}")

[0491] # Train the final SVM model using the optimal parameters

[0492] final_clf = svm.SVC(gamma=best_gamma, C=best_C, kernel='rbf',probability=True)

[0493] final_clf.fit(X, y)

[0494] The above program defines a function svm_cross_val, which accepts γ and C as parameters and uses cross validation to evaluate the F1 score of the SVM classifier. The Lagrange multiplier α is implemented internally in the scikit-learn library. i, weight vector w and bias term b. The function svm_cross_val is used as the objective function of Bayesian optimization. Then the gp_minimize function is used to perform Bayesian optimization to search for the best γ and C values. Finally, the best parameters found are used to train a final SVM classifier model.

[0495] At the same time, combined with the "recursive feature elimination method RFE" of the third embodiment, the training of the above SVM classifier model can be further optimized; just add the following program segment:

[0496] from sklearn.feature_selection import RFE

[0497] from sklearn.svm import SVC

[0498] from sklearn.datasets import load_iris

[0499] from sklearn.model_selection import StratifiedKFold, cross_val_score

[0500] from sklearn.metrics import f1_score, make_scorer

[0501] # Load the dataset

[0502] iris = load_iris()

[0503] X, y = iris.data, iris.target

[0504] svm_model = SVC(kernel='rbf', probability=True)

[0505] rfe = RFE(estimator=svm_model, n_features_to_select=2, step=1)

[0506] X_rfe = rfe.fit_transform(X, y)

[0507] print("Selected feature indices:", rfe.support_)

[0508] print("Feature ranking:", rfe.ranking_)

[0509] # Cross-validate using selected features

[0510] cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)

[0511] f1_scorer = make_scorer(f1_score, average='macro')

[0512] scores = cross_val_score(svm_model, X_rfe, y, cv=cv, scoring=f1_scorer)

[0513] # Output cross-validation F1 score

[0514] print("Cross-validation F1 scores:", scores)

[0515] print("Mean F1 score:", scores.mean())

[0516] The above program first loads the iris dataset in the SVM classifier model training program, then creates an RFE instance and specifies the number of features to be selected as 2 (n_features_to_select=2), that is, the RFE process will iteratively remove features until only two features are left. step=1 means that one feature is removed each iteration. Next, the feature set is RFE processed using the fit_transform method, which first fits the model to evaluate the feature importance and then transforms the feature set to include only the selected features. The rfe.support_ attribute gives the Boolean index of the selected feature, while the rfe.ranking_ attribute gives the ranking of all features (where 1 indicates the selected feature, 2 and above indicate the unselected feature, and the larger the number, the less important the feature). Finally, cross-validation is performed using the selected feature subset (X_rfe) and the original label (y), and the F1 score is calculated.

[0517] Example 5: Please refer to Figure 4 Based on the first to fourth embodiments, this embodiment can further optionally introduce a self-adjustment strategy for the adaptive photovoltaic system fault judgment method.

[0518] When the trained SVM classifier model has executed at least six time steps, the number of time steps from the completion of training to the current execution is taken as an interval, and the data sets of evidence A and evidence B within this time interval are collected:

[0519] A=[A1,A2,...,A k ]; B=[B1,B2,...,B k ];

[0520] Among them, A i and B i are a subset of evidence A and evidence B respectively, and k is the number of time steps;

[0521] A i and B i They are:

[0522] A i =[y i (t),L i ']; B i =[y i (t),L i '];

[0523] Among them, y i (t) is in A i or B i At the time step of , the label value (0~5) predicted by the decision function f(x); L i ' is in A i or B i After the time step, the label value (0~5) of the fault type of the photovoltaic system actually surveyed and recorded;

[0524] Preferably, in a step-by-step time step, each time step is interspersed with A i and B i ; to ensure the timeliness and consistency of data.

[0525] Subsequently, evidence A and evidence B are submitted to the DS evidence theory algorithmHYPERLINK"https: / / www.cnblogs.com / mmgf / p / 8025261.html" (Dempster-Shafer envidence theory) for operation. Evidence A and evidence B are combined through Dempster's combination principle to output the joint trust function Bel(A∪B); then the joint trust function Bel(A∪B) is mapped to an interval value between [0,1] as the correction factor θ, and the decision function f(x) is corrected. The decision function f(x) undergoes a weighted correction based on historical trends and outputs a label value at the current time step; in subsequent time steps, the weighted corrected label value will be used to continuously iterate through the DS evidence theory algorithm, so that the decision function f(x) is further subjected to a weighted "real-time training" based on the actual operating conditions on the basis of historical training, thereby realizing the self-adjustment strategy.

[0526] This self-adjustment strategy is called step S5. In S5, it includes:

[0527] Step S500, collecting evidence A and evidence B, the method is the same as above;

[0528] Step S501, execute Dempster's combination principle:

[0529] For a given set of evidence A i and B i , Dempster's combination rule computes a set called the combined belief assignment Bel(C), where C is the possible hypothesis or state space. In addition, the combined uncertainty assignment Pl(C) is computed:

[0530] Step S5010, merging trust distribution Bel(G):

[0531] ;

[0532] Step S5011, combined uncertainty allocation Pl(G):

[0533] ;

[0534] Among them, in S5010~S5011, and are a subset of evidence A and evidence B respectively; is the weight. If A at a certain time step i and B iIt does not have certain particularity, so it can be assigned a value of 0.5; G is a maybe set, that is, the elements in the set belong to the set with different possibilities or degrees; ∅ represents the empty set;

[0535] Step S502, obtain the joint trust function Bel(A∪B):

[0536] ;

[0537] Bel(A) and Pl(A) are the confidence and uncertainty distributions of the set of evidence A;

[0538] Bel(B) and Pl(B) are the confidence and uncertainty distributions of the set of evidence B;

[0539] (Pl(A)∩Pl(B)) is the uncertainty distribution of the intersection of evidence A and evidence B:

[0540] ;

[0541] Among them, the numerator is the mass sum of the evidence supporting A∩B, and 1 minus this sum gives Pl(A∩B), which represents the degree of uncertainty about A∩B.

[0542] Step S503: Map the joint trust function Bel(A∪B) to an interval value between [0,1] as a correction factor θ through a sigmoid function:

[0543] ;

[0544] e is the base of natural logarithm; the sigmoid function can map any real number to the interval [0,1], and when Bel(A∪B) is larger, θ is closer to 1; otherwise, it is closer to 0. In this way, θ can be used as an effective correction factor to adjust the output of the decision function f(x).

[0545] Step S504, modify the decision function f(x) at the current time step:

[0546] ;

[0547] By multiplying the output of the original decision function by θ, the dynamic adjustment of the decision result is mainly reflected in the scaling or weighting of the decision function output. This adjustment method can change the final output of the decision function according to the value of θ, thereby affecting the decision result. Specifically, when the value of θ is close to 1, the output of the original decision function is almost unaffected; however, when the value of θ is less than 1, the output of the original decision function will be reduced accordingly. This reduction can be understood as a "cautious" or "conservative" adjustment to the decision result, because it reduces the absolute value of the decision function output, which may reduce the confidence or certainty of the decision.

[0548] On the other hand, if the value of θ is dynamically calculated based on the degree of consistency between historical predictions and actual fault types, then θ can be regarded as an evaluation indicator that reflects the system's evaluation of the reliability of the current decision. In this case, multiplying by θ is actually a dynamic weighting of the output of the original decision function, which adjusts the result of the current decision based on the system's evaluation of the accuracy of historical predictions.

[0549] It can be understood that by multiplying the output of the original decision function by θ, the system can adjust its decision results in a dynamic and adaptive manner. This form of adjustment can not only reflect the system's learning results on the accuracy of historical predictions, but also flexibly adjust its decision-making strategy according to actual conditions, thereby improving the overall performance and accuracy of the system.

[0550] It should be further pointed out that in step S5, if the decision function After the weighted correction, the term will still be mapped by the sign function sign. Then for the vote counter function votes[N], the direct correction effect may no longer be obvious after the sign function acts, because the sign function maps all positive numbers to 1 and all negative numbers to -1 (or 0 under some definitions). However, the weighted correction θ can still indirectly affect the voting process. The specific mechanism is as follows:

[0551] 1) Adjustment of decision boundary: The weighted correction θ is actually adjusting the output value of the decision function, which affects the location of the decision boundary. Although the sign function converts continuous values ​​into discrete labels, a small shift in the decision boundary may cause some data points to be classified into different categories. Therefore, the correction of θ actually changes the decision-making ability of each binary SVM classifier, thereby affecting the final voting result.

[0552] 2) Adjustment of category bias: θ is dynamically calculated based on the consistency between historical predictions and actual fault types, so it actually reflects the system's assessment of the reliability of the current decision. A higher θ value may mean that the system is more confident in the decision of the classifier, while a lower θ value may mean that the system is skeptical about the decision of the classifier. Although the sign function converts this confidence or suspicion into a simple label, in multiple runs and voting processes, such as Figure 8 The test set test effect shown is i and B i The higher the number of , this tendency may accumulate, thus affecting the final result of votes[N]. And make the prediction and judgment of the SVM classifier model more accurate. Therefore, the weighted correction θ can still indirectly affect the result of the voting counter function votes[N] by adjusting the decision boundary, affecting the category tendency, or setting a non-standard voting threshold. This influence may accumulate during multiple runs and voting processes, thereby changing the final predicted category label L i .

[0553] Preferably, in view of the above phenomenon, the sign function of the first embodiment can be further designed: a threshold is set, so that only when the weighted modified decision function value exceeds the positive threshold, the label is set to 1; when it is lower than the negative threshold, the label is set to -1. In this way, the correction of θ will directly affect the generation of labels, and further affect the voting process.

[0554] In summary, this embodiment combines the information of multiple pieces of evidence through Dempster's combination principle, which can comprehensively consider the degree of support for fault judgment from data from different sources, thereby improving the accuracy of judgment. At the same time, the correction factor θ obtained by mapping the sigmoid function can further adjust the output of the decision function to make it more in line with the actual situation. And the self-adjustment strategy can dynamically adjust the output of the decision function according to the data of historical predictions and actual fault types, so that the system can better adapt to the changes in the fault characteristics of the photovoltaic system under different operating conditions. This adaptability can effectively improve the stability and reliability of the system.

[0555] It should be noted that the technical solution provided in this embodiment is optional. When the SVM classifier model trained in embodiments 1 to 4 is sufficient to cope with the fault judgment task of the photovoltaic system, the technical solution of this embodiment may not be used.

[0556] Example 6: Please refer to Figure 5 Based on all the above embodiments, this embodiment further discloses an adaptive photovoltaic system fault judgment system; the system includes a processor, the processor is connected to an MPPT solar controller, and the MPPT solar controller is connected to,

[0557] Photovoltaic strings of photovoltaic systems;

[0558] DC load points of photovoltaic systems;

[0559] The AC load point of the photovoltaic system is connected to the MPPT solar controller through an inverter;

[0560] The processor is also connected to a display device and a register, and the register stores program instructions;

[0561] When the photovoltaic string group transmits the time-frequency input signal to the MPPT solar controller, the processor synchronously reads the time-frequency input signal;

[0562] When the time-frequency input signal is read by the processor, the program instructions are executed by the processor, so that the processor executes the adaptive photovoltaic system fault judgment method as described in all the above embodiments, and reflects the photovoltaic string group status on the display device.

[0563] Specifically, the processor is the brain of the entire system, responsible for receiving, processing and analyzing data, and executing corresponding program instructions. It is connected to the MPPT solar controller, and the photovoltaic string group transmits the time-frequency input signal to the MPPT solar controller for reading and extracting the time-frequency input signal of the photovoltaic string group.

[0564] Specifically, the DC load point is the location in the photovoltaic system where the DC power is directly used. In the photovoltaic power generation system, the power generated by the solar panels is DC power, so the DC load point can be directly connected to the output of the solar panel. These DC loads can be DC motors, LED lamps or DC charging equipment. The main feature of the DC load point is that the power can be used directly without conversion, reducing the loss in the energy conversion process.

[0565] Specifically, the AC load point is the location in the photovoltaic system where the DC power is converted to AC power by the inverter and then supplied to the AC load. The AC load point can be the industrial equipment used in the photovoltaic system. The main feature of the AC load point is that the power needs to be converted by the inverter to meet the needs of most conventional electrical equipment.

[0566] Preferably, the display device is a display screen.

[0567] All the above embodiments only express the implementation methods of the relevant practical applications of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.

[0568] For those skilled in the art, it can be further appreciated that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0569] At the same time, those skilled in the art can understand that all or part of the processes in all the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0570] The citations in this manual are as follows:

[0571] [1] Xiong Qing, Liu Xiaojun, Guo Ziqing, et al. Arc fault detection and location in photovoltaic system based on current spectrum integral difference[J]. High Voltage Engineering, 2021, 47(5): 1625-1633.

[0572] [2] Wu Chunhua, Xu Wenxin, Li Zhihua, et al. Study on DC arc fault detection method and anti-interference of photovoltaic system[J]. Proceedings of the CSEE, 2018, 38(12): 3546-3555+14.

[0573] [3]LU Liuxing, WEN Yinghong, XIAO Shi, et al. A deep learning approach for series DC arc fault diagnosing and real-time circuit behaviorpredicting[J]. IEEE Transactions on Electromagnetic Compatibility, 2022, 64(2): 569-579.

[0574] [4] Zhao Tiejun, Meng Jing, Song Yueqi, et al. DC series arc fault detection and protection strategy for string photovoltaic system [J]. Power System Protection and Control, 2020, 48(20): 74-82.

[0575] [5] Wang Tianze, Xu Yonghai, Yu Rongyue, et al. Photovoltaic string DC arc fault identification method based on entropy feature fusion [J / OL]. Journal of North China Electric Power University (Natural Science Edition).

Claims

1. An adaptive photovoltaic system fault judgment method, comprising a photovoltaic system having photovoltaic strings, characterized in that: The time-frequency input signal of the photovoltaic string group is extracted and decomposed into the intrinsic mode component IMF, and then the following steps are performed: S1, energy entropy calculation: calculating the energy E of each intrinsic mode component IMF and normalizing it to obtain the energy ratio of each intrinsic mode component IMF, and calculating the energy entropy H; S2, feature engineering: extracting the energy entropy H, time domain features, frequency domain features and time-frequency features of the time-frequency input signal to form a feature set FS; In S2, the time domain feature, frequency domain feature and time-frequency feature are respectively a time domain feature vector V1, a frequency domain feature vector V2 and a time-frequency feature vector V3; The feature set FS is: FS=[H,V1 T ,V2 T ,V3 T ] T ; Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Represents the transpose operation of a matrix or vector; The time domain feature vector V1, the frequency domain feature vector V2 and the time-frequency feature vector V3 include respective means, variances, peak values, skewnesses and kurtosis; The frequency domain feature vector V2 also includes the power spectrum density, which is obtained by normalizing the modulus square of the FFT result of the signal: ; Where X[k] is the FFT result of x[n] and k is the frequency index; The mean, variance, peak, skewness and kurtosis of the time-frequency feature vector V3 are calculated based on the processing result of the time-frequency feature by short-time Fourier transform; and also include the following steps S2010~S2011; S2010, perform principal component analysis PCA on the feature set FS: For the original feature set FS, first perform standardization so that the mean of each feature is 0 and the variance is 1: ; Among them, z is the standardized value, x is the original value, μ is the mean, and σ is the standard deviation; through this step, the mean of each feature becomes 0 and the variance becomes 1; then for the standardized data set, calculate its covariance matrix C: Solve the characteristic equation of the covariance matrix C(v) =λ(v) to obtain the eigenvalue λ and the corresponding eigenvector b; Arrange the eigenvalues ​​in descending order, and select the eigenvectors corresponding to the first k largest eigenvalues ​​to form the projection matrix W; Use the projection matrix W to project the original data set into a new low-dimensional space to obtain the reduced-dimensional feature set: new FS = original FS*W; S2011, RFE for FS recursive feature elimination method for new feature set: First, use the new feature set FS as the initial feature set; Second, evaluate the importance of each feature in the feature set FS'; Third, based on the evaluation results of feature importance; Fourth, recursively iterate until the required number of features is reached; S3, constructing a classifier model: based on the features of the feature set FS, constructing a classification model to distinguish at least four types of DC arc faults; using a data set D constructed from historical data to train the classifier model; the data set D includes fault data with labels; In said S3, it includes: S300, the classifier model is an SVM classifier model, and the construction strategy of the SVM classifier model is: One-to-one strategy: construct multiple binary classification SVM classifier models, each of which is used to distinguish the arc fault types of two photovoltaic systems; or, One-to-many strategy: build a SVM classifier model for each arc fault type; S301, construct a label set L of fault data: L = [L0, L1, L2, L3, L4, L5]; Among them, L i is any one of the labels; the label L i i=0~5, where 0 represents normal situation; 1 represents busbar series arc fault; 2 represents intra-string series arc fault; 3 represents intra-string parallel arc fault; 4 represents inter-string parallel arc fault; 5 represents photovoltaic shading fault; In S300, the SVM classifier model used in the one-to-one strategy or the one-to-many strategy is constructed by the following method: Construct the decision function f(x): ; Among them, sign is the sign function, which determines the category of the sample according to the positive or negative value of (w⋅x+b); w is the weight vector; x is the input feature vector, which is equal to the feature set FS; b is the bias term; <·,·> is the dot product operation; α i is the Lagrange multiplier; y i is the sample x i The true label of Using the RBF kernel function K(x i ,x j ): ; where γ is the coefficient of the Gaussian kernel, x i and x j are any two samples of which the input feature vectors are ; The SVM classifier model is used to distinguish different labels L during training. i ; The optimization problem selected when training each of the SVM classifier models is: ; Where C is the regularization parameter; ξ i is the slack variable; N is the total number of samples; The loss function is Hinge insensitive loss function: ; Among them, y i is the sample x i The true category label of f(x i ) is the model's prediction for sample x i The decision function output; j traverses all except the true category y i All other categories except ; D is a positive number; ε is an insensitive parameter; The item calculates the relative difference between the true category and other categories and is normalized to ensure the consistency of scale; S4 real-time fault detection and classification: using the feature set FS as the input feature vector x' to input into the trained classifier model, and judging the fault type of the photovoltaic string group according to the classification output result; In S4, the input feature vector x' is input into the decision function f(x): ; Where x is the input sample; x i Iteration is support vector; The output of the decision function f(x) is the label L i , to determine whether the current status of the photovoltaic string group is normal, bus series arc fault, intra-string series arc fault, intra-string parallel arc fault, inter-string parallel arc fault or photovoltaic shading fault; Also includes: S500, collect evidence A and evidence B: <h2 style=";text-align:left;direction:ltr">A=[A1,A2,...,A<h2 style=";text-align:left;direction:ltr"> k <h2 style=";text-align:left;direction:ltr"> ];B=[B1,B2,...,B<h2 style=";text-align:left;direction:ltr"> k <h2 style=";text-align:left;direction:ltr"> ]; Among them, A i and B i are a subset of evidence A and evidence B respectively, and k is the number of time steps; S501, implement Dempster's combination principle: For a given set of evidence A i and B i , calculate the set of combined trust assignments Bel(C), and the combined uncertainty assignments Pl(C): S5010, merge trust allocation Bel(C): ; S5011, combined uncertainty allocation Pl(C): ; Among them, in S5010~S5011, and are a subset of evidence A and evidence B respectively; is the weight; ∅ represents the empty set; S502, obtain the joint trust function Bel(A∪B): ; Bel(A) and Pl(A) are the confidence and uncertainty distributions of the set of evidence A; Bel(B) and Pl(B) are the confidence and uncertainty distributions of the set of evidence B; (Pl(A)∩Pl(B)) is the uncertainty distribution of the intersection of evidence A and evidence B; S503, the joint trust function Bel(A∪B) is mapped to an interval value between [0,1] as a correction factor θ through a sigmoid function: ; e is the base of natural logarithms; S504, modify the decision function f(x) at the current time step: 。 2. The adaptive photovoltaic system fault judgment method according to claim 1, characterized in that: In S1, the energy E, the normalization and the energy entropy H are obtained by the following steps: S100, each intrinsic mode component IMF is represented as a continuous signal x(t) or a discrete signal x[n], where t is a time variable and n is a discrete time index; the square of each intrinsic mode component IMF is integrated to obtain the energy E; S101, normalizing the energy E to obtain the energy ratio of each intrinsic mode component IMF: ; in, represents the sum of all intrinsic mode components IMF energy, p i is the energy ratio of the ith intrinsic mode component IMF; M is the number of the intrinsic mode components IMF; E i and E j are the energies of the i-th and j-th eigenmode components, respectively; S102, calculate the energy entropy H: ; Among them, the logarithm base log is chosen to be 2.

3. The adaptive photovoltaic system fault judgment method according to claim 2, characterized in that: In the S3, it also includes: S302, training the SVM classifier model: S3020, forming the data set D: Collect historical data of photovoltaic systems to form several feature sets FS and form a data set D D=[(FS1,L1),(FS2,L2),...,(FS M ,L M )]; Among them, FS i is the feature set of any time step among M time steps; S3021, perform cross-validation method: divide the original data set D into k subsets of similar size, and use them as training set TS and validation set VS respectively, and solve the coefficient γ, the regularization parameter C, and the Lagrange multiplier α used by the SVM classifier model. i , the optimal hyperparameters of the weight vector w and the bias term b; The SVM classifier model is retrained using the entire original data set D and the selected optimal hyperparameters; when a predetermined number of iterations is reached, the trained SVM classifier model is considered to be obtained.

4. The adaptive photovoltaic system fault judgment method according to claim 3, characterized in that: In S4, the input feature vector x' is: x'=[H,V1 T ,V2 T ,V3 T ] T ; Among them, V1 T 、V2 T and V3 T are the transpose of the time domain, frequency domain and time-frequency feature vector respectively, [·] T Represents the transpose operation of a matrix or vector.

5. The adaptive photovoltaic system fault judgment system is characterized by: It includes a processor, the processor is connected to an MPPT solar controller, the MPPT solar controller is connected to, Photovoltaic strings of photovoltaic systems; DC load points of photovoltaic systems; An AC load point of a photovoltaic system, wherein the AC load point is connected to the MPPT solar controller via an inverter; The processor is also connected to a display device and a register, wherein the register stores program instructions; When the photovoltaic string group transmits the time-frequency input signal to the MPPT solar controller, the processor synchronously reads the time-frequency input signal; when the time-frequency input signal is read by the processor, the program instructions are executed by the processor, so that the processor executes the adaptive photovoltaic system fault judgment method as described in any one of claims 1 to 4, and reflects the status of the photovoltaic string group on the display device.

Citation Information

Patent Citations

  • Abnormal current diagnosis method and system based on wavelet decomposition and empirical mode decomposition

    CN112881942A