A method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM
By using NCA screening and the SSA-KELM model to identify leakage current types in photovoltaic (PV) grid-connected distribution networks, the problem of distinguishing leakage current from biological electric shock faults in PV grid-connected distribution networks has been solved, thus enabling the safe and reliable operation of PV grid-connected distribution networks.
Patent Information
- Application Number
- CN202211156808.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2042-09-22
AI Technical Summary
Existing technologies cannot effectively distinguish between common-mode leakage current and leakage current caused by biological electric shock faults in photovoltaic grid connections, leading to malfunctions of residual current protection devices and posing safety hazards.
The residual current characteristics of photovoltaic (PV) grid-connected distribution networks were screened using nearest neighbor component analysis (NCA). Combined with the kernel extreme learning machine (KELM) model and optimized by the sparrow search algorithm (SSA), an SSA-KELM leakage current identification model was established to identify the leakage current types of PV grid-connected distribution networks.
Accurately identify the leakage fault types of photovoltaic grid-connected distribution networks, avoid malfunctions of residual current protection devices, improve power supply reliability, and ensure the safe and reliable operation of the distribution network.
Smart Images

Figure CN115618261B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fault identification technology, and in particular to a method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM. Background Technology
[0002] In recent years, with the continuous growth of photovoltaic (PV) installed capacity, a large number of distributed PV systems have been connected to the power distribution network. As a key component connecting the PV system and the power grid, the grid-connected inverter typically uses a power frequency transformer to achieve grid voltage matching and electrical isolation. However, the power frequency transformer increases the weight, size, and cost of the PV system, and reduces system efficiency. Transformerless, non-isolated grid-connected inverters are small in size, low in cost, and simple in structure. Their most prominent advantage is that they can improve the overall system efficiency. Therefore, more and more PV grid-connected systems are adopting non-isolated access schemes.
[0003] In non-isolated photovoltaic (PV) distribution networks, the lack of transformer isolation creates an electrical connection between the PV cells and the grid, leading to common-mode leakage current on the parasitic capacitance between the PV panels and the ground. Due to this common-mode leakage current, traditional leakage fault detection technologies cannot distinguish it from leakage current generated during biological electric shock, causing frequent malfunctions of residual current devices (RCDs) and compromising the safe and reliable operation of the distribution network. In practice, common solutions include increasing the operating threshold of RCDs or removing them altogether, resulting in safety hazards in the distribution network.
[0004] Current leakage current identification methods are mainly researched for traditional distribution networks, and there is no research on leakage current identification for photovoltaic distribution networks. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the present invention aims to provide a method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM.
[0006] To achieve the above objectives, the present invention provides the following technical solution:
[0007] A method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM includes the following steps:
[0008] Step 1: Collect residual current data under different conditions of photovoltaic grid connection;
[0009] Step 2: Extract feature quantities from the collected residual current data;
[0010] Step 3: Preprocess the extracted features;
[0011] Step 4: Screen the preprocessed features using nearest neighbor component analysis (NCA).
[0012] Step 5: Train the Kernel Extreme Learning Machine (KELM) model using the selected features, and optimize the parameters of the KELM model using the Sparrow Search Algorithm (SSA) to obtain the SSA-KELM leakage current identification model.
[0013] Step 6: Input the residual current feature sample to be tested into the SSA-KELM model for output category identification, thereby obtaining the leakage current type of the sample to be tested.
[0014] Furthermore, in step 1, the different states of the power distribution network include: normal operation, when a living organism is electrocuted, and when a non-living organism is electrocuted; in step 6, the output categories include normal operation, electrocution by living organisms, and electrocution by non-living organisms; among them, electrocution by non-living organisms indicates leakage of photovoltaic equipment; the leakage types include electrocution by living organisms and leakage of photovoltaic equipment.
[0015] Furthermore, in step 2, the extracted features include nine dimensions: root square magnitude p1, absolute mean p2, root mean square p3, kurtosis index p4, skewness index p5, peak index p6, waveform factor p7, margin coefficient p8, and impulse index p9.
[0016] Furthermore, in step 3, the preprocessing method used is the max-min normalization method.
[0017] Furthermore, step 4 specifically includes:
[0018] Let the preprocessed original feature set be S = {(x i ,y i ), i = 1, 2, ..., n}, where x i Let y represent the feature of the i-th sample. i Let be the label of the i-th sample; arbitrarily select a sample feature from the feature set S, and calculate the distance to its nearest neighbor samples:
[0019]
[0020] In the formula, w m This represents the feature weights when the sample features are m-dimensional; m is the feature dimension, and r represents the total number of feature dimensions; x j For x i Nearest neighbor samples; x im Let x represent the m-th dimension feature of the i-th sample. jm This represents the m-th dimension feature of the j-th sample;
[0021] x j Selected as x i The probability of the nearest neighbor sample is:
[0022]
[0023] In the formula, n is the sample size; x j Let x represent the j-th sample. i Nearest neighbor samples, when the number of samples i = j, p ij =0; x t Indicates division by x i All samples outside; k is the kernel function, defined as:
[0024]
[0025] In the formula, σ is the kernel width, then x i The probability of being correctly classified is:
[0026]
[0027] In the formula, y j For sample x j The tag; y ij =y i -y j For sample x i With x j Label error, when y i =y j At that time, y ij =1, otherwise y ij =0;
[0028] Calculate p i Average value:
[0029]
[0030] Introducing a regularization term, we obtain the following objective function:
[0031]
[0032] In the formula, n is the number of samples; λ is the regularization parameter; and r represents the total number of features.
[0033] The goal of nearest neighbor component analysis is to compute the weights w that maximize F(w), and the equivalence problem is also expressed as:
[0034]
[0035] F(w) represents the objective function to be minimized; F(w) represents the objective function to be maximized.
[0036] Therefore, the weights of each feature in the sample set are calculated. The larger F(w) is, the greater the weight of each feature in the sample set. The smaller the value, the higher the correlation between the current feature and the leakage current identification model, and vice versa.
[0037] Features with high feature weights are selected based on their weight values.
[0038] Furthermore, step 5 specifically includes:
[0039] Step 501: Divide the feature data after NCA screening into training data and test data;
[0040] Step 502: Train the Kernel Extreme Learning Machine (KELM) model using the training data;
[0041] Step 503: Optimize the regularization coefficient C and kernel function parameter σ of the KELM model using the Sparrow Search Algorithm (SSA) to obtain the optimal parameters, and then establish the SSA-KELM leakage current identification model.
[0042] Step 504: Test the constructed SSA-KELM model using test data, and use recognition accuracy as the evaluation metric.
[0043] Further, step 502 specifically includes:
[0044] Suppose we have N input samples x k =[x k1 ,x k2 ,…,x km ] T and N output samples t k =[t k1 ,t k2 ,t k3 ] T Train the KELM model; where k = 1, ..., N, x k Let x represent the k-th input sample. km Let t represent the m-th dimension feature of the k-th input sample. k Let t represent the k-th output sample. k1 This represents the first feature of the k-th output sample;
[0045] This makes the error between the network's predicted output and the actual output approach zero, at which point:
[0046]
[0047] Where: β i The weights between the hidden layer nodes and the output layer; g(x) i ,w i ,b i ) is the activation function, w i b represents the weights between the hidden layer nodes and the input layer.i Let L be the threshold value for the hidden layer nodes; L is the number of neurons in the hidden layer; the above formula can be rewritten as:
[0048] HB = T
[0049]
[0050] In the formula, H is the hidden layer output matrix, and B = [β1,…,β] L ] T β is a matrix consisting of the output weight vectors between the hidden layer nodes and the output nodes. L Let T be the output weight vector between the Lth hidden layer node and the output node; T = [t1, ..., t2] N ] T A matrix composed of the actual output values of the samples;
[0051] By solving for the least squares solution, we obtain:
[0052]
[0053] The network output weights are obtained by solving the Lagrange multiplier method:
[0054]
[0055] In the formula: C represents the regularization coefficient, i.e., the penalty coefficient; I is a diagonal matrix; the output of ELM obtained from the above formula is:
[0056]
[0057] Based on Mercer's condition, the kernel matrix is defined as follows:
[0058]
[0059] In the formula: K(x) i ,x k () represents the kernel function for the i-th and k-th input samples, using the radial basis function kernel function:
[0060]
[0061] In the formula: σ represents the kernel function parameter;
[0062] The output of the KELM model obtained from the above formula is:
[0063]
[0064] In the formula: f(x) is the actual output value of the KELM model.
[0065] Further, step 503 specifically includes:
[0066] Step 5031: Initialize the parameters of the Sparrow Search Algorithm (SSA), including the sparrow population size Pop, the search space dimension d, and the maximum number of iterations iter. max The percentage of sparrows aware of the danger (SD), the percentage of those who discover the danger (PD), and the warning value (ST);
[0067] Step 5032: Calculate the fitness value of each sparrow and find the position X corresponding to the current best fitness. best The position X corresponding to the worst fitness worst ;
[0068] Step 5033: Update the positions of discoverers, joiners, and individuals aware of danger in the sparrow population according to the sparrow search algorithm update rules;
[0069] Step 5034: Recalculate the fitness value of each sparrow after updating its position and compare it with the fitness value from the previous iteration. If the new position value is higher than the original fitness value, then the new position value is taken as the optimal fitness value X. best Otherwise, the existing fitness value remains unchanged.
[0070] Step 5035: Determine whether the maximum number of iterations or the solution accuracy has been reached. If not, return to step 5033; if so, stop the iteration process and return the sparrow position information with the best fitness, which is the optimal (C,σ) combination.
[0071] Furthermore, the sparrow search algorithm update rules in step 5033 include:
[0072] The rules for updating the discoverer's location are as follows:
[0073]
[0074] In the formula, This represents the position information of the i-th sparrow in the j-th dimension at the (t+1)-th iteration; Iter represents the position of the i-th sparrow in the j-th dimension at the t-th iteration; t represents the current iteration number; iter max The maximum number of iterations of the algorithm is represented; α is a uniformly random number between (0, 1); ST∈[0.5, 1] and R2∈[0, 1] represent the safety value and the warning value, respectively; Q is a random number that follows a normal distribution; L represents a 1×d matrix in which all elements are 1;
[0075] The rules for updating the position of new members are as follows:
[0076]
[0077] In the formula, X worst This represents the position of the global worst-case scenario at the t-th iteration. Let represent the optimal position occupied by the discoverer in the (t+1)th iteration; i represents the population size; A represents a 1×d matrix, where each element is randomly assigned a value of 1 or -1, and A + =A T (AA T ) -1 ;num represents the number of sparrows;
[0078] The location update rules for individuals who are aware of danger are as follows:
[0079]
[0080] In the formula, The current global optimal position; β represents the step size control parameter, which is a random number following a normal distribution with a mean of 0 and a variance of 1; K represents the direction of the sparrow's movement, which is a random number between [-1, 1]; f i f represents the fitness value of the i-th sparrow; g and f w ε represents the best and worst fitness values of the current sparrow population, respectively; ε is a very small constant to avoid the denominator being zero.
[0081] Furthermore, in step 501, the feature data selected by NCA is randomly divided into training data and test data in a ratio of 7:3.
[0082] The beneficial effects of this invention are as follows: Compared with the prior art, this invention's method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM uses nearest neighbor component analysis (NCA) to filter the extracted residual current signal features. The filtered features are then input into a kernel extreme learning machine (KELM) model for training. The parameters in the KELM model are optimized using a sparrow search algorithm (SSA) to obtain the optimal parameters, thereby establishing an SSA-optimized KELM leakage current identification model. By inputting the residual current data to be measured into the trained leakage current identification model, the leakage fault type can be obtained. This invention can accurately identify the leakage fault type in photovoltaic-connected distribution networks, avoid maloperation of residual current protection devices, further improve the power supply reliability of photovoltaic-connected distribution networks, and ensure the safe and reliable operation of the distribution network. Attached Figure Description
[0083] Figure 1 This is a flowchart of the photovoltaic grid leakage current identification method based on NCA and SSA-KELM of the present invention;
[0084] Figure 2 This is a schematic diagram of the Kernel Extreme Learning Machine (KELM) model in this invention;
[0085] Figure 3 This is a schematic diagram of the residual current signal under different states provided in an embodiment of the present invention; wherein:
[0086] Figure 3 (a) is a schematic diagram of the residual current signal under normal conditions in this embodiment;
[0087] Figure 3 (b) is a schematic diagram of the residual current signal when a living organism is electrocuted in this embodiment;
[0088] Figure 3 (c) is a schematic diagram of the residual current signal when a non-living object is electrocuted in this embodiment;
[0089] Figure 4 This is a schematic diagram of residual current sample characteristics in an embodiment of the present invention; wherein:
[0090] Figure 4 (a) is a schematic diagram of the feature quantity with the square root amplitude p1 in this embodiment;
[0091] Figure 4 (b) is a schematic diagram of the feature quantity p2, which is the absolute average value of the feature quantity in this embodiment;
[0092] Figure 4 (c) is a schematic diagram of the feature quantity of rooted p3 in this embodiment;
[0093] Figure 4 (d) is a schematic diagram of the feature quantity, which is the kurtosis index p4, in this embodiment;
[0094] Figure 4 (e) is a schematic diagram of the feature quantity, which is the skewness index p5, in this embodiment.
[0095] Figure 4 (f) is a schematic diagram of the feature quantity with peak index p6 in this embodiment;
[0096] Figure 4 (g) is a schematic diagram of the feature quantity with waveform factor p7 in this embodiment;
[0097] Figure 4 (h) is a schematic diagram of the feature quantity, which is the margin coefficient p8, in this embodiment;
[0098] Figure 4 (i) is a schematic diagram of the characteristic quantity of pulse index p9 in this embodiment;
[0099] Figure 5This is a schematic diagram of the feature weights calculated by the NCA algorithm in an embodiment of the present invention;
[0100] Figure 6 This is a schematic diagram of the SSA-KELM model recognition results in an embodiment of the present invention. Detailed Implementation
[0101] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0102] Please refer to Figure 1 This invention relates to a method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM, comprising the following steps:
[0103] Step 1: Collect residual current data under different conditions of photovoltaic grid connection;
[0104] The different states of the power distribution network include: normal operation, electric shock to living beings and electric shock to non-living beings; among them, electric shock to non-living beings means leakage of photovoltaic equipment.
[0105] In this embodiment of the invention, 390 sets of residual current data were obtained through a photovoltaic grid connection simulation model during normal operation, when a living organism experiences electric shock, and when a non-living organism experiences electric shock (photovoltaic equipment leakage). Figure 3 The figure shows the residual current signals under three simulated states. Figure 3 (a) shows the residual current signal diagram under normal conditions. Figure 3 (b) shows a schematic diagram of the residual current signal when a living organism is electrocuted. Figure 3 (c) shows a schematic diagram of the residual current signal when a non-living object is electrocuted.
[0106] Step 2: Calculate and extract feature quantities from the collected residual current data;
[0107] The acquired residual current signal is converted into: root square amplitude p1, absolute average p2, root mean square p3, kurtosis index p4, skewness index p5, peak value index p6, waveform factor p7, margin coefficient p8, and impulse index p9, for a total of 9 dimensions, as shown in the appendix. Figure 4 As shown. The calculation formulas for each characteristic quantity are as follows:
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117] In the above formula, x represents the data of each residual current sample collected, and N represents the total number of residual current samples collected.
[0118] Step 3: Preprocess the extracted features
[0119] Considering the large numerical dispersion among different features, the maximum and minimum normalization processes are applied to all sample features.
[0120] The normalization calculation formula is as follows:
[0121]
[0122] In the formula, x imin x imax Let x be the minimum and maximum values of the feature of the i-th sample, respectively. i For the i-th sample feature, This represents the feature of the i-th sample after normalization.
[0123] Step 4: Use Nearest Neighbor Component Analysis (NCA) to screen the preprocessed features and eliminate redundant features that affect the recognition accuracy.
[0124] This invention, from the perspective of correlation between features, employs NCA (Neural Coefficient of Analysis) to select the optimal feature set with high correlation from a nine-dimensional feature set, thereby further improving the recognition model. NCA is a distance metric learning algorithm that selects the optimal feature subset for the leakage current recognition model by maximizing the leave-one-out classification accuracy. The NCA feature selection steps are as follows:
[0125] Let the preprocessed original feature set be S = {(x i ,y i ), i = 1, 2, ..., n}, where x i Let y represent the feature of the i-th sample. i Let be the label of the i-th sample; arbitrarily select a sample feature from the feature set S, and calculate the distance to its nearest neighbor samples:
[0126]
[0127] In the formula, w mThis represents the feature weights when the sample features are m-dimensional; m is the feature dimension, and r represents the total number of feature dimensions; x j For x i Nearest neighbor samples; x im Let x represent the m-th dimension feature of the i-th sample. jm This represents the m-th dimension feature of the j-th sample;
[0128] x j Selected as x i The probability of the nearest neighbor sample is:
[0129]
[0130] In the formula, n is the sample size; x j Let x represent the j-th sample. i Nearest neighbor samples, when the number of samples i = j, p ij =0; x t Indicates division by x i All samples outside; k is the kernel function, defined as:
[0131]
[0132] In the formula, σ is the kernel width, then x i The probability of being correctly classified is:
[0133]
[0134] In the formula, y j For sample x j The tag; y ij =y i -y j For sample x i With x j Label error, when y i =y j At that time, y ij =1, otherwise y ij =0;
[0135] Calculate p i Average value:
[0136]
[0137] Introducing a regularization term, we obtain the following objective function:
[0138]
[0139] In the formula, n is the number of samples; λ is the regularization parameter; and r represents the total number of features.
[0140] The goal of nearest neighbor component analysis is to compute the weights w that maximize F(w), and the equivalence problem is also expressed as:
[0141]
[0142] This represents minimizing the objective function; This is to distinguish it from F(w), which maximizes the objective function. Therefore, when calculating the weights, you can either find w that maximizes the objective function F(w) or minimize the objective function. w at that time.
[0143] Therefore, the weights of each feature in the sample set are calculated. The larger F(w) is, the greater the weight of each feature in the sample set. The smaller the value, the higher the correlation between the current feature and the leakage current identification model, and vice versa.
[0144] Features with high feature weights are selected based on their weight values. In this embodiment, the appendix... Figure 5 The figure shows the calculated feature weights of all feature quantities. Based on the magnitude of the feature weight values, p1, p2, p3, and p5 are selected as the optimal feature quantities.
[0145] Step 5: Train a Kernel Extreme Learning Machine (KELM) model using the selected features, and simultaneously optimize the parameters of the KELM model using the Sparrow Search Algorithm (SSA), thus obtaining the SSA-KELM leakage current detection model. Step 5 specifically includes:
[0146] Step 501: Divide the NCA-selected feature data into training data and test data; in this embodiment, the NCA-selected feature data is randomly divided into training data and test data in a ratio of 7:3.
[0147] Step 502: Train the Kernel Extreme Learning Machine (KELM) model using the training data; Step 502 specifically involves:
[0148] The structure of the kernel extreme learning machine model is shown in the attached figure. Figure 2 As shown, its recognition principle is as follows:
[0149] Suppose we have N input samples x k =[x k1 ,x k2 ,…,x km ] T and N output samples t k =[t k1 ,t k2 ,t k3 ] T right Figure 2 The KELM model shown is trained; where k = 1, ..., N, x kLet x represent the k-th input sample. km Let t represent the m-th dimension feature of the k-th input sample. k Let t represent the k-th output sample. k1 This represents the first feature of the k-th output sample;
[0150] Training causes the error between the network's predicted output and the actual output to approach zero, at which point:
[0151]
[0152] Where: β i The weights between the hidden layer nodes and the output layer; g(x) i ,w i ,b i ) is the activation function, w i b represents the weights between the hidden layer nodes and the input layer. i Let L be the threshold value for the hidden layer nodes; L is the number of neurons in the hidden layer; the above formula can be rewritten as:
[0153] HB = T
[0154]
[0155] In the formula, H is the hidden layer output matrix, and B = [β1,…,β] L ] T β is a matrix consisting of the output weight vectors between the hidden layer nodes and the output nodes. L Let T be the output weight vector between the Lth hidden layer node and the output node; T = [t1, ..., t2] N ] T A matrix composed of the actual output values of the samples;
[0156] By solving for the least squares solution, we obtain:
[0157]
[0158] The network output weights are obtained by solving the Lagrange multiplier method:
[0159]
[0160] In the formula: C represents the regularization coefficient, i.e., the penalty coefficient; I is a diagonal matrix; the output of ELM (Extreme Learning Machine) is obtained from the above formula:
[0161]
[0162] Based on Mercer's condition, the kernel matrix is defined as follows:
[0163]
[0164] In the formula: K(x) i ,x k ) represents the kernel function for the i-th input sample and the k-th input sample. This invention uses a radial basis function (RBF) kernel function:
[0165]
[0166] In the formula: σ represents the kernel function parameter;
[0167] The output of the KELM model obtained from the above formula is:
[0168]
[0169] In the formula: f(x) is the actual output value of the KELM model.
[0170] The KELM model is derived from ELM using a kernel function. First, the expression for ELM is obtained, and then a kernel function is used to obtain the KELM model.
[0171] Step 503: Optimize the regularization coefficient C and kernel function parameter σ of the KELM model using the Sparrow Search Algorithm (SSA) to obtain the optimal parameters, and then establish the SSA-KELM leakage current identification model.
[0172] A sparrow search algorithm is introduced to optimize the regularization coefficient C and kernel function parameter σ of the KELM model, thereby enhancing its generalization ability. The sparrow search algorithm is a novel swarm intelligence optimization algorithm inspired by the foraging and anti-predation behaviors of sparrows in nature. The specific steps of optimizing the KELM model parameters using the sparrow search algorithm are as follows:
[0173] Step 5031: Initialize the parameters of the Sparrow Search Algorithm (SSA), including the sparrow population size Pop, the search space dimension d, and the maximum number of iterations iter. max The percentage of sparrows aware of the danger (SD), the percentage of those who discover the danger (PD), and the warning value (ST);
[0174] Step 5032: Calculate the fitness value of each sparrow and find the position X corresponding to the current best fitness. best The position X corresponding to the worst fitness worst ;
[0175] Step 5033: Update the positions of discoverers, joiners, and individuals aware of danger in the sparrow population according to the corresponding update rules of the sparrow search algorithm; the sparrow search algorithm update rules include:
[0176] The rules for updating the discoverer's location are as follows:
[0177]
[0178] In the formula, This represents the position information of the i-th sparrow in the j-th dimension at the (t+1)-th iteration; Iter represents the position of the i-th sparrow in the j-th dimension at the t-th iteration; t represents the current iteration number; iter max The maximum number of iterations of the algorithm is represented; α is a uniformly random number between (0, 1); ST∈[0.5, 1] and R2∈[0, 1] represent the safety value and the warning value, respectively; Q is a random number that follows a normal distribution; L represents a 1×d matrix in which all elements are 1;
[0179] The rules for updating the position of new members are as follows:
[0180]
[0181] In the formula, X worst This represents the position of the global worst-case scenario at the t-th iteration. Let represent the optimal position occupied by the discoverer in the (t+1)th iteration; i represents the population size; A represents a 1×d matrix, where each element is randomly assigned a value of 1 or -1, and A + =A T (AA T ) -1 ;num represents the number of sparrows;
[0182] The location update rules for individuals who are aware of danger are as follows:
[0183]
[0184] In the formula, The current global optimal position; β represents the step size control parameter, which is a random number following a normal distribution with a mean of 0 and a variance of 1; K represents the direction of the sparrow's movement, which is a random number between [-1, 1]; f i f represents the fitness value of the i-th sparrow; g and f w ε represents the best and worst fitness values of the current sparrow population, respectively; ε is a very small constant to avoid the denominator being zero.
[0185] Step 5034: Recalculate the fitness value of each sparrow after updating its position and compare it with the fitness value from the previous iteration. If the new position value is higher than the original fitness value, then the new position value is taken as the optimal fitness value X. best Otherwise, the existing fitness value remains unchanged.
[0186] Step 5035: Determine whether the maximum number of iterations or the solution accuracy has been reached. If not, return to step 5033; if so, stop the iteration process and return the sparrow position information with the best fitness, which is the optimal (C,σ) combination.
[0187] Step 504: Test the recognition performance of the constructed SSA-KELM model using test data, with recognition accuracy as the evaluation metric. In this embodiment, the residual current characteristic samples of the test samples are input into the SSA-KELM model to identify the leakage fault type of the test samples, thus obtaining the leakage type of the test samples. A recognition result for one instance is attached. Figure 6 As shown, the recognition accuracy rate is 98.29%.
[0188] Step 6: Input the residual current feature sample to be tested into the SSA-KELM model for output category identification to obtain the leakage current type of the sample to be tested; the output categories include normal operation, electric shock to living organisms and electric shock to non-living organisms; among them, electric shock to non-living organisms indicates leakage current of photovoltaic equipment; the leakage current type includes electric shock to living organisms and leakage current of photovoltaic equipment.
[0189] This invention establishes an efficient leakage current identification model, accurately identifies the type of leakage current fault, and ensures the correct operation of residual current protection devices, which is of great significance for realizing the safe and reliable operation of photovoltaic grid connection.
[0190] All parts not covered in this invention are the same as or implemented using existing technologies.
[0191] The above description, in conjunction with specific embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A method for identifying leakage current in photovoltaic-connected distribution networks based on NCA and SSA-KELM, characterized in that, Includes the following steps: Step 1: Collect residual current data under different conditions of photovoltaic grid connection; Step 2: Extract feature quantities from the collected residual current data; Step 3: Preprocess the extracted features; Step 4: Screen the preprocessed features using nearest neighbor component analysis (NCA). Step 5: Train the Kernel Extreme Learning Machine (KELM) model using the selected features, and optimize the parameters of the KELM model using the Sparrow Search Algorithm (SSA) to obtain the SSA-KELM leakage current identification model. Step 6: Input the residual current characteristic sample to be tested into the SSA-KELM model for output type identification, thereby obtaining the leakage current type of the sample to be tested; Step 4 specifically includes: Let the preprocessed original feature set be S = {(x i ,y i ), i = 1, 2, ..., n}, where x i Let y represent the feature of the i-th sample. i Let be the label of the i-th sample; arbitrarily select a sample feature from the feature set S, and calculate the distance to its nearest neighbor samples: In the formula, w m This represents the feature weights when the sample features are m-dimensional; m is the feature dimension, and r represents the total number of feature dimensions; x j For x i Nearest neighbor samples; x im Let x represent the m-th dimension feature of the i-th sample. jm x represents the m-th dimension feature of the j-th sample; j Selected as x i The probability of the nearest neighbor sample is: In the formula, n is the sample size; x j Let x represent the j-th sample. i Nearest neighbor samples, when the number of samples i = j, p ij =0; x t Indicates division by x i All samples outside; k is the kernel function, defined as: In the formula, σ is the kernel width, then x i The probability of being correctly classified is: In the formula, y j For sample x j The tag; y ij =y i -y j For sample x i With x j Label error, when y i =y j At that time, y ij =1, otherwise y ij =0; Calculate p i Average value: Introducing a regularization term, we obtain the following objective function: In the formula, n is the number of samples; λ is the regularization parameter; and r represents the total number of features. The goal of nearest neighbor component analysis is to compute the weights w that maximize F(w), and the equivalence problem is also expressed as: F(w) represents the objective function to be minimized; F(w) represents the objective function to be maximized. Therefore, the weights of each feature in the sample set are calculated. The larger F(w) is, the greater the weight of each feature in the sample set. The smaller the value, the higher the correlation between the current feature and the leakage current identification model, and vice versa; Features with high feature weights are selected based on their weight values.
2. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM as described in claim 1, characterized in that: In step 1, the different states of the power distribution network include: normal operation, electric shock to living beings, and electric shock to non-living beings; In step 6, the output categories include normal operation, electric shock to living organisms and electric shock to non-living organisms; among them, electric shock to non-living organisms indicates leakage current in photovoltaic equipment; the leakage current types include electric shock to living organisms and leakage current in photovoltaic equipment.
3. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM as described in claim 1, characterized in that: In step 2, the extracted features include nine dimensions: root square magnitude p1, absolute mean p2, root mean square root p3, kurtosis index p4, skewness index p5, peak index p6, waveform factor p7, margin coefficient p8, and impulse index p9.
4. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 1, characterized in that: In step 3, the preprocessing method used is the max-min normalization method.
5. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 1, characterized in that: Step 5 specifically involves: Step 501: Divide the feature data after NCA screening into training data and test data; Step 502: Train the Kernel Extreme Learning Machine (KELM) model using the training data; Step 503: Optimize the regularization coefficient C and kernel function parameter σ of the KELM model using the Sparrow Search Algorithm (SSA) to obtain the optimal parameters, and then establish the SSA-KELM leakage current identification model. Step 504: Test the constructed SSA-KELM model using test data, and use recognition accuracy as the evaluation metric.
6. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 5, characterized in that: Step 502 specifically involves: Suppose we have N input samples x k =[x k1 ,x k2 ,…,x km ] T and N output samples t k =[t k1 ,t k2 ,t k3 ] T Train the KELM model; where k = 1, ..., N, x k Let x represent the k-th input sample. km Let t represent the m-th dimension feature of the k-th input sample. k Let t represent the k-th output sample. k1 This represents the first feature of the k-th output sample; This makes the error between the network's predicted output and the actual output approach zero, at which point: Where: β i The weights between the hidden layer nodes and the output layer; g(x) i ,w i ,b i ) is the activation function, w i b represents the weights between the hidden layer nodes and the input layer. i Let L be the threshold value for the hidden layer nodes; L is the number of neurons in the hidden layer; the above formula can be rewritten as: HB = T In the formula, H is the hidden layer output matrix, and B = [β1,…,β] L ] T β is a matrix consisting of the output weight vectors between the hidden layer nodes and the output nodes. L Let T be the output weight vector between the Lth hidden layer node and the output node; T = [t1, ..., t2] N ] T A matrix composed of the actual output values of the samples; By solving for the least squares solution, we obtain: The network output weights are obtained by solving the Lagrange multiplier method: In the formula: C represents the regularization coefficient, i.e., the penalty coefficient; I is a diagonal matrix; the output of ELM obtained from the above formula is: Based on Mercer's condition, the kernel matrix is defined as follows: In the formula: K(x) i ,x k () represents the kernel function for the i-th and k-th input samples, using the radial basis function kernel function: In the formula: σ represents the kernel function parameter; The output of the KELM model obtained from the above formula is: In the formula: f(x) is the actual output value of the KELM model.
7. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 5, characterized in that: Step 503 specifically involves: Step 5031: Initialize the parameters of the Sparrow Search Algorithm (SSA), including the sparrow population size Pop, the search space dimension d, and the maximum number of iterations iter. max The percentage of sparrows aware of the danger (SD), the percentage of those who discover the danger (PD), and the warning value (ST); Step 5032: Calculate the fitness value of each sparrow and find the position X corresponding to the current best fitness. best The position X corresponding to the worst fitness worst ; Step 5033: Update the positions of discoverers, joiners, and individuals aware of danger in the sparrow population according to the sparrow search algorithm update rules; Step 5034: Recalculate the fitness value of each sparrow after updating its position and compare it with the fitness value from the previous iteration. If the new position value is higher than the original fitness value, then the new position value is taken as the optimal fitness value X. best Otherwise, the existing fitness value remains unchanged. Step 5035: Determine whether the maximum number of iterations or the solution accuracy has been reached. If not, return to step 5033; if so, stop the iteration process and return the sparrow position information with the best fitness, which is the optimal (C,σ) combination.
8. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 7, characterized in that: The sparrow search algorithm update rules in step 5033 include: The rules for updating the discoverer's location are as follows: In the formula, This represents the position information of the i-th sparrow in the j-th dimension at the (t+1)-th iteration; Iter represents the position of the i-th sparrow in the j-th dimension at the t-th iteration; t represents the current iteration number; iter max The maximum number of iterations of the algorithm is represented; α is a uniformly random number between (0, 1); ST∈[0.5, 1] and R2∈[0, 1] represent the safety value and the warning value, respectively; Q is a random number that follows a normal distribution; L represents a 1×d matrix in which all elements are 1; The rules for updating the position of new members are as follows: In the formula, X worst This represents the position of the global worst-case scenario at the t-th iteration. Let represent the optimal position occupied by the discoverer in the (t+1)th iteration; i represents the population size; A represents a 1×d matrix, where each element is randomly assigned a value of 1 or -1, and A + =A T (AA T ) -1 ;num represents the number of sparrows; The location update rules for individuals who are aware of danger are as follows: In the formula, The current global optimal position; β represents the step size control parameter, which is a random number following a normal distribution with a mean of 0 and a variance of 1; K represents the direction of the sparrow's movement, which is a random number between [-1, 1]; f i f represents the fitness value of the i-th sparrow; g and f w ε represents the best and worst fitness values of the current sparrow population, respectively; ε is a very small constant to avoid the denominator being zero.
9. The method for identifying leakage current in photovoltaic grid-connected distribution networks based on NCA and SSA-KELM according to claim 5, characterized in that: In step 501, the feature data selected by NCA is randomly divided into training data and test data in a ratio of 7:3.