Distribution network line loss calculation method and device based on ADPSO optimized GRU neural network, and electronic equipment

By applying ADPSO to optimize GRU neural network in distribution network line loss calculation, combining the maximum information coefficient method and improved particle swarm algorithm, the problem of low accuracy and time-consuming line loss calculation in the existing technology is solved, and a more efficient and more accurate line loss assessment is achieved.

CN119558166APending Publication Date: 2025-03-04国网新疆电力有限公司营销服务中心
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411358932.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

The existing distribution network wire loss calculation methods have low accuracy and long time, making it difficult to meet the needs of refined management of modern distribution networks.

Method used

The distribution network line loss calculation is performed using ADPSO-based GRU neural network calculation, and relevant parameters are screened through the maximum information coefficient method, combined with the improved particle swarm algorithm optimization model to improve calculation accuracy and efficiency.

Benefits of technology

It significantly improves the accuracy and efficiency of line loss calculation in distribution network, can process massive data more quickly, and provides more accurate line loss assessment results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119558166A_ABST
    Figure CN119558166A_ABST
Patent Text Reader

Abstract

The invention discloses a distribution network line loss calculation method and device based on an ADPSO optimized GRU neural network, and electronic equipment, and aims to solve the problems of low accuracy, long time consumption and the like of an existing distribution network line loss calculation method. The method disclosed by the invention comprises the following steps of: (1) analyzing the correlation of data parameters associated with distribution network line loss calculation, and selecting parameters with relatively high correlation as the input of a distribution network line loss calculation model; (2) preprocessing the selected data parameters, and establishing a GRU neural network model in combination with a GRU neural network theory to complete the calculation of the distribution network line loss; and step (3), optimizing the distribution network model by using an improved particle swarm optimization (ADPSO) to form a distribution network line loss calculation model based on an ADPSO-GRU neural network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a distribution network line loss evaluation technology, and in particular to a distribution network line loss calculation technology based on ADPSO optimized GRU neural network. Background Art

[0002] In the operation of the power network, the distribution network will inevitably generate a large amount of power loss due to its large number of equipment, wide coverage and low voltage level. Especially in the context of widespread access to distributed renewable energy, key indicators such as power flow, line loss, and voltage distribution in the low-voltage distribution system have changed significantly, which has brought great challenges to the line loss management of the distribution system. With the rapid progress of the times, the coverage of the distribution network has continued to expand, and higher requirements have been put forward for the line loss control and management of the distribution network. Therefore, it is particularly important to perform accurate calculation of the line loss of the distribution network. This not only helps to deeply analyze the power loss of the distribution network, but also provides an important basis for formulating effective energy-saving measures and optimizing the structure of the distribution network, so as to achieve efficient, economical and reliable operation of the distribution network.

[0003] Traditional line loss calculation models, such as the maximum current method and the root mean square current method, all belong to the category of simplified circuit equivalent models. Although they are simple and easy to use, their calculation accuracy is relatively low and it is difficult to meet the needs of refined management of modern distribution networks. In contrast, the power flow calculation method occupies an important position in the distribution network loss assessment with its high calculation accuracy. However, the implementation of the power flow calculation method also faces many challenges. As classic methods for power flow calculation, the Newton method and the decoupling method are perfect in theory, but in practical applications, they often encounter the dilemma of non-convergence of calculations due to the limitations of the algorithm principles, resulting in large errors in the calculation results. Similarly, although the loop impedance method is suitable for ring network loop scenarios and has good convergence, its node and branch numbering is cumbersome, the calculation amount is large, and it is difficult to effectively reveal the intrinsic relationship between the massive data and losses of the distribution network. At present, when adjusting the power flow of the distribution network, it mainly relies on personal experience and lacks a systematic adjustment method. This undoubtedly limits the depth and breadth of the optimization of distribution network operation and also restricts the further development of the power industry. Summary of the invention

[0004] The technical problem to be solved by the invention is to provide a method, device and electronic device for calculating the line loss of a distribution network based on ADPSO optimized GRU neural network, so as to solve the problems of low accuracy and long time consumption of the existing distribution network line loss calculation method. Considering that there are many factors related to line loss calculation, it will take a lot of time to use them as model input, thus affecting the performance of the model. Therefore, the maximum information coefficient method is used to perform correlation analysis, and the parameters with higher correlation are selected as model input. In view of the problem that traditional optimization algorithms are prone to fall into local optimality, an improved particle swarm algorithm is used to optimize the GRU neural network, and a distribution network line loss calculation model is constructed, and the model is verified through a data test set.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, the present invention discloses a method for calculating distribution network line loss based on ADPSO optimized GRU neural network, comprising:

[0007] Step (1): Analyze the correlation of data parameters associated with distribution network line loss calculation, and select parameters with greater correlation as input of distribution network line loss calculation model;

[0008] Step (2): pre-process the selected data parameters, combine the GRU neural network theory, and establish a GRU neural network model to complete the calculation of distribution network line loss;

[0009] Step (3): Use the improved particle swarm algorithm (ADPSO) to optimize the distribution network model and form a distribution network line loss calculation model based on the ADPSO-GRU neural network.

[0010] Furthermore, the step (1) is to use the maximum information coefficient (MIC) to analyze the correlation between various parameters in the input distribution network data and the distribution network line loss, and select parameters with greater correlation as inputs of the distribution network line loss calculation model;

[0011] Let X = {x1, x2, ..., x n} and Y = {y1, y2, ..., y n} are random variables in the data set, n is the number of samples, then the mutual information MI between X and Y is:

[0012]

[0013] In formula (1), ∫ represents the integral sign; p(x, y) is the joint probability density between X and Y; p(x) and p(y) are the marginal probability densities between X and Y respectively;

[0014] The MIC calculation formula is:

[0015]

[0016] In formula (2), B is the number of samples, and the size is set to about 0.6 of the data volume; N is the sample variable; I(x, y) is the mutual information MI between x and y; MIC∈[0,1], the closer the MIC value is to 1, the stronger the correlation is;

[0017] The steps of performing parameter index correlation analysis using the above maximum information coefficient (MIC) are as follows:

[0018] Step 1: Given i and j, grid the scatter plot of X and Y into i columns and j rows, and use formula (1) to find the maximum mutual information value MI;

[0019] Step 2: Divide the obtained maximum mutual information by log2 min(x, y) for normalization;

[0020] Step 3: Select the maximum value of mutual information at different scales as the MIC value;

[0021] Step 4: According to the calculated MIC values ​​between each parameter and the line loss, determine the correlation between each parameter and the distribution network line loss value.

[0022] Furthermore, the step (2) is:

[0023] Preprocess the line loss index, combine the GRU neural network theory, and establish a GRU neural network model to complete the calculation of the line loss of the substation power grid, including:

[0024] S11, before inputting data, preprocess the distribution network data; including three steps: addition and deletion, normalization and clustering;

[0025] For data that are obviously abnormal or missing in large quantities, delete them; for missing data with a small number of missing values, use the cubic Hermite polynomial interpolation method to fill them in. The process is as follows:

[0026] For two known nodes x0, the function value and derivative value on x1 are: i =f(x i ), m i =f′(x i ), (i = 0, 1), what is required is a polynomial H3(x) with a degree not exceeding 3, so that H3(x i )=y i , H3′(x i )=m i , (i = 0, 1), H3(x) is called a cubic Hermite polynomial. The above conditions are the interpolation conditions for this problem; where f′(xi ) represents the function f(x i ) at point x = x i The derivative at ;

[0027] S22, using different methods to normalize the data in the dataset;

[0028] The original input data set is divided into data set 1 which only contains daily energy consumption data and data set 2 which does not contain daily energy consumption data. Data set 2 is normalized and its calculation formula is as follows:

[0029]

[0030] Among them, x i represents the original data value, x′ i represents the normalized data, X imax represents the maximum value of the elements in the i-th vector; X imin represents the minimum value of the elements in the i-th vector, and n represents the number of data in the sample;

[0031] The PCA method is used to reduce the dimension of daily energy consumption data in Dataset 1;

[0032] The M-dimensional original daily active power supply dataset is reduced to a new K-dimensional orthogonal feature dataset; before the dimensionality reduction process, the original daily active power supply dataset is represented as a matrix X of size n×m;

[0033]

[0034] Where n is the total number of distribution lines; m is the data collection frequency; x nm is the active power supply of the nth distribution line at time m;

[0035] The specific steps of the PCA method are as follows:

[0036] 1) Sample standardization;

[0037]

[0038] In the formula, x ij Represents the original data value of daily active power supply; x′ ij represents the normalized data; n represents the number of data in the sample;

[0039] 2) Calculate the sample covariance matrix C;

[0040]

[0041] Where, X Tis the transposed matrix of matrix X; n is the number of columns of matrix X, that is, the total number of distribution lines;

[0042] 5) Calculate the eigenvalue p of the covariance matrix i and its corresponding eigenvector λ i ;

[0043] 6) Select the K eigenvectors with the largest eigenvalues, and then form the corresponding eigenvector matrix P;

[0044] 5) The matrix after dimension reduction is Y=XP;

[0045] 6) In the process of dimensionality reduction, the dimension of the new matrix is ​​determined by the contribution rate of each principal component The calculation formula is as follows:

[0046]

[0047] In the formula, λ i is the eigenvector corresponding to the i-th eigenvalue; m is the number of eigenvalues;

[0048] 7) Set the threshold to ε = 0.85, and solve the sum of the variance ratios of the k eigenvectors to ρ; if ρ>ε, it is considered that the new k-dimensional matrix retains most of the information of the original matrix;

[0049] The method also includes a step of merging the data set 1 and the data set 2 together again to serve as input data of a distribution network line loss calculation model;

[0050] Then, the K-Means clustering algorithm is used to perform cluster analysis on the correlation degree of the data, and the distance between the feature cluster center point and the cluster object point and the center is calculated according to the following formula:

[0051]

[0052] Among them, x1, y1 represent the horizontal and vertical coordinates of the center point, x n ,y n represents the horizontal and vertical coordinates of the sample points, and k represents the number of samples;

[0053] The steps of the K-Means clustering algorithm based on association analysis are:

[0054] S101: Determine input and output; take the data set sample set as input, determine the number of clusters and the maximum number of algorithm iterations; divide the clusters at output so that the square error is minimized;

[0055] S102: Selecting an initial cluster center for each cluster;

[0056] S103: assigning the sample set to the nearest neighbor cluster according to the minimum distance principle;

[0057] S104: Update the cluster center using the sample mean of each cluster;

[0058] S105: Repeat steps S103 and S104 until the cluster center no longer changes;

[0059] S106: Output the final feature clustering center and k cluster divisions;

[0060] Furthermore, in step (3), while building a distribution network line loss calculation model, the processed data is used as input for line loss calculation, and the line loss value of the substation power grid is used as an output indicator;

[0061] The Gated Recurrent Unit (GRU) neural network is a derivative model of the long short-term memory network; the GRU contains an input gate x t , reset gate t , update gate z t , where the update gate captures the long-term correlation in the time series, and the reset gate captures the short-term correlation in the time series. The mathematical model is as follows:

[0062] S201: Input data x t , calculate the output after passing through the update gate and the reset gate, the calculation formula is shown in equations (9) and (10);

[0063]

[0064]

[0065] Where σ is the sigmoid function; W r , W z is the input weight matrix; R r , R z is the circulant weight matrix; is the bias matrix; h t-1 is the information of the previous moment; r t , z t Represent the outputs after the reset gate and the update gate respectively;

[0066] S202: Intermediate processing unit performs candidate hidden state Calculation, the calculation formula is shown in formula (11);

[0067]

[0068] Among them, tanh is the hyperbolic tangent function; is the input weight matrix; is the circulant weight matrix; is the bias matrix; h t-1is the information of the previous moment; is the candidate hidden state;

[0069] S203: Output O t Calculate and output the results;

[0070]

[0071]

[0072] Where W is the input weight matrix; R is the cyclic weight matrix; b is the bias matrix; h t-1 is the information of the previous moment; is a candidate hidden state; ⊙ represents the Hadamard product operation; O t is the neuron output; z t Represents the output after the update gate;

[0073] S204: After calculating the line loss using the above model, the root mean square error (RMSE) is used for performance evaluation. The calculation method is as follows:

[0074]

[0075] Among them, Y I is the true value, is the predicted value; n is the number of data in the data set;

[0076] Based on the above GRU neural network mathematical model, a grid line loss calculation model for the substation area is established;

[0077] Furthermore, the step (3) is:

[0078] The proposed ADPSO optimization algorithm is used to optimize the established substation power grid model, forming a substation power grid line loss calculation model based on the ADPSO algorithm to optimize the GRU neural network, including:

[0079] S301, using particle swarm optimization (PSO) to perform population intelligence optimization algorithm; global optimization is achieved by updating the speed and position of particles, and the process is as follows:

[0080] If a population of N individuals searches for the optimal position in an M-dimensional space, the search direction and speed of each individual can be expressed by the mathematical models shown in formula (15) and formula (16), respectively:

[0081]

[0082] Where: X i 、V i They are respectively represented as the position and velocity of individual i in the population; is the position of individual i in the population in the k-th dimension search space; is the speed of individual i in the population searching the k-th dimension of the space; N is the number of individuals in the population; M is the dimension of the population search space;

[0083] S302: Start searching and record the initial position of each individual, i.e., the initial optimal position;

[0084] S303: Continuously perform iterative search; update the speed and location of the individual according to formula (17) and formula (18), as shown below:

[0085]

[0086]

[0087]

[0088] Where: d=1,2,3...,M represents the velocity vector and position vector of the dth dimension of individual i in the kth iteration respectively; d=1,2,3...,M is the historical optimal position of individual i in the dth dimension in the kth iteration, that is, the optimal solution searched by individual i after the kth iteration; d=1,2,3...,M is the historical optimal position of the population in the dth dimension in the kth iteration, that is, the optimal solution in the entire population after the kth iteration; M is the population search space dimension; c1, c2 are learning factors; r1, r2 are random numbers in the range of [0, 1]; α is the constraint factor that controls the update speed weight; ω is the inertia weight factor; t max is the maximum number of iterations set for optimization; t is the current number of iterations; M is the population search space dimension;

[0089] S304: Calculate the fitness of individuals in the population; select the sum of square errors (SSE) as the criterion function, define it as a fitness function to evaluate individuals in the population, and the expression is:

[0090]

[0091] In the formula, Represents the optimal position coordinates of individual j in the q-th dimensional space; represents the optimal position coordinates of the population in the q-th dimension space; N is the number of individuals in the population; M is the dimension of the population search space;

[0092] S305: After each position search, in each search process, record the optimal position of each individual:

[0093]

[0094] Where P ibest represents the optimal position of individual i in the population; d = 1, 2, 3..., M is the optimal position of individual i in the d-th dimension search space; N is the number of individuals in the population;

[0095] S306: Repeat the search (iteration) until the maximum number of iterations set is reached, and record the optimal position of the entire population as shown below;

[0096]

[0097] Among them, G ibest represents the optimal position of the population; d=1, 2, 3..., M is the optimal position of individual i in the population in the d-th dimension space; N is the number of individuals in the population.

[0098] Furthermore, in step (3), when solving the overall optimum of multiple objective functions or constraints, since ω, c1, and c2 in the PSO algorithm are constants, improvements are made to the three parameters ω, c1, and c2 to form an ADPSO algorithm, making it more suitable for solving the overall optimum of multiple constraints. The specific improvements are as follows:

[0099] S401: A new learning factor c′1, c′2 that continuously changes nonlinearly with the number of iterations. The proposed new learning factors are shown in formula (23) and formula (24) respectively:

[0100]

[0101]

[0102] Among them, c′1, c′2 are the proposed new learning factors; t is the current iteration number; t max The maximum number of iterations set for the optimization;

[0103] S402: segmentally process ω, and use the idea of ​​nonlinear time-varying to adjust the inertia weight factor ω, so that the inertia weight factor ω is nonlinearly time-varying, that is, update formula (19) as shown in formula (25);

[0104]

[0105] Among them, c′1, c′2 are the proposed new learning factors; t is the current iteration number; t max is the maximum number of iterations for optimization setting; ω is the inertia weight factor;

[0106] In the later stage of iteration, all individuals will approach the optimal individual, and a local optimal solution will appear; the optimal individual is subjected to non-uniform mutation operation, and the process is as follows:

[0107] Assume X i =(x i1 , x i2 , ..., x iM ) is an individual in the population, and its upper and lower boundaries are x imax 、x imin , randomly generate an integer k∈[1,M], and then take the corresponding element x from the individual ik , and then determine the mutation x′ according to the following formula ik , forming a new individual X′ i =(x i1 , x i2 , ..., x′ ik , ..., x iM );

[0108]

[0109] Among them, x imax 、x imin The variables x ik The function Δ(t, z) returns a value between [0, z], and as t increases, the function Δ(t, z) approaches 0. The characteristics of the function Δ(t, z) enable the algorithm to have a larger search range in the early stage and to make small adjustments in the later stage. The function Δ(t, z) is expressed as:

[0110]

[0111] Where r is a random number in the range of [0, 1]; is a parameter of uniformity; t is the current evolutionary generation; t max represents the maximum evolutionary generation;

[0112] The steps of ADPSO algorithm are as follows:

[0113] S501: Set the number of individuals in the population N and the maximum number of iterations of the algorithm T max , initialize individual position and velocity information and the starting iteration number t = 1;

[0114] S502: Calculate the initial fitness of each individual in the population, find the position of the current optimal individual and retain it as the initial optimal position value of the population;

[0115] S503: Start iteration, calculate according to formulas (17) and (18), and update the individual position and velocity;

[0116] S504: After the position and speed are updated, the fitness of each individual is calculated according to formula (20), and compared with the fitness values ​​of the previously retained optimal positions of the individual and the population; if better, the optimal position value of the individual and the optimal position value of the population are updated using the new optimal value;

[0117] S505: Determine whether the current number of iterations reaches the maximum number of iterations t max ; If yes, output the optimal solution and the calculation ends; otherwise, enter the next iteration and return to step 3 until the maximum number of iterations t is reached max until.

[0118] Furthermore, the step (3) uses the ADPSO algorithm to optimize the parameters such as the neuron weight, threshold and number of hidden layer neurons of the established GRU neural network model to form an improved ADPSO-GRU neural network model to calculate the line loss of the power grid. The ADPSO optimization steps are as follows:

[0119] S601: input distribution network data, and use the maximum information coefficient (MIC) to analyze the correlation between various parameters in the input data and the distribution network line loss; select parameters with greater correlation as inputs of the distribution network line loss calculation model;

[0120] S602: pre-process the selected data parameters and divide them into a training set and a test set in a ratio of 7:3; use the training set data as input for calculating the distribution network line loss;

[0121] S603: Build a GRU neural network line loss calculation model; use the improved ADPSO algorithm to optimize the number of hidden layer neurons, thresholds and connection weight matrix of the GRU neural network model;

[0122] S604: Establish an improved ADPSO-GRU distribution network line loss calculation neural network model;

[0123] S605: input distribution network test set data, output calculated theoretical line loss value, and perform performance evaluation;

[0124] In a second aspect, the present invention further discloses a distribution network line loss calculation method and device based on ADPSO optimized GRU neural network, comprising:

[0125] Data acquisition module: used to obtain relevant power flow data collected by the power grid acquisition system;

[0126] Parameter correlation calculation module: Use the maximum information coefficient (MIC) to analyze the correlation between each parameter in the input data and the distribution network line loss; select the parameters with greater correlation as the input of the distribution network line loss calculation model;

[0127] Algorithm optimization module: optimizes and learns the constructed distribution network line loss calculation model using the improved ADPSO-GRU algorithm to obtain the distribution network line loss calculation model after optimization and learning;

[0128] Line loss calculation and analysis module: After the data samples to be tested are processed by the parameter correlation calculation module, they are input into the distribution network line loss calculation model to calculate the distribution network line loss and output the results.

[0129] In a third aspect, the present invention further discloses an electronic device, including a processor and a storage medium;

[0130] The storage medium is used to store instructions;

[0131] The processor is configured to operate according to the instructions to execute the steps of any of the aforementioned methods.

[0132] The beneficial effects of the present invention are:

[0133] 1. The maximum information coefficient (MIC) method is used to analyze the correlation between various parameters in the power grid collection data and the distribution network line loss, and the parameters with greater correlation are selected as the input of the distribution network line loss calculation model, thereby reducing the complexity of the model and improving the calculation speed of the model;

[0134] 2. The three parameters in the original particle swarm algorithm are improved respectively to form an improved particle swarm optimization algorithm (ADPSO), which overcomes the shortcomings of the original particle swarm algorithm that it is easy to fall into local optimality and has poor optimization ability;

[0135] 3. The improved particle swarm algorithm (ADPSO) is used to optimize the GRU neural network model parameters, and an optimization model mixed with the GRU neural network is proposed. It has obvious advantages in line loss calculation, faster calculation speed, and is more suitable for distribution network line loss calculation than the basic algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0136] Figure 1 A GRU neural network structure diagram of an embodiment of the present invention;

[0137] Figure 2 This is a flow chart of an improved ADPSO algorithm according to an embodiment of the present invention;

[0138] Figure 3 This is a flow chart of ADPSO optimizing GRU neural network model parameters according to an embodiment of the present invention;

[0139] Figure 4 A flow chart of an ADPSO-GRU neural network model constructed for an embodiment of the present invention;

[0140] Figure 5The figure is a schematic diagram comparing the algorithm error and the convergence speed according to an embodiment of the present invention. DETAILED DESCRIPTION

[0141] The specific implementation of the present invention is described below in conjunction with the accompanying drawings and embodiments:

[0142] In a first aspect, the present invention proposes a method for calculating line loss in a distribution network based on ADPSO optimized GRU neural network, comprising:

[0143] Analyze the correlation of data parameters associated with the calculation of distribution network line loss, and select parameters with greater correlation as input of the distribution network line loss calculation model;

[0144] Preprocess the selected data parameters, combine with GRU neural network theory, and establish a GRU neural network model to complete the calculation of distribution network line loss;

[0145] Then, the improved particle swarm algorithm (ADPSO) proposed in this patent is used to optimize the distribution network model to form a distribution network line loss calculation model based on the ADPSO-GRU neural network;

[0146] Further simulation analysis of examples shows that the proposed algorithm has a better ability to balance local search and global development, faster iteration speed, and higher accuracy. It also proves that the ADPSO algorithm of this patent is more suitable for distribution network line loss calculation than the basic algorithm.

[0147] The maximum information coefficient (MIC) is further used to analyze the correlation between each parameter in the input distribution network data and the distribution network line loss. The parameters with greater correlation are selected as the input of the distribution network line loss calculation model. Let X = {x1, x2, ..., x n} and Y = {y1, y2, ..., y n} are random variables in the data set, n is the number of samples, then the mutual information MI between X and Y is:

[0148]

[0149] Where ∫ represents the integral sign; p(x, y) is the joint probability density between X and Y; p(x) and p(y) are the marginal probability densities between X and Y, respectively.

[0150] The MIC calculation formula is:

[0151]

[0152] In the formula, B is the number of samples, which is set to the 0.6th power of the data volume; N is the sample variable; I(x, y) is the mutual information MI between x and y. MIC∈[0,1], the closer the MIC value is to 1, the stronger the correlation is.

[0153] The steps for performing parameter index correlation analysis using the maximum information coefficient (MIC) are as follows:

[0154] Step 1: Given i and j, grid the scatter plot of X and Y into i columns and j rows, and use formula (1) to find the maximum mutual information value MI;

[0155] Step 2: Divide the obtained maximum mutual information by log2 min(x, y) for normalization;

[0156] Step 3: Select the maximum value of mutual information at different scales as the MIC value. Specifically, given a lot of (i, j) values, calculate the value of MIC(X; Y) in each case according to formula (2), and take the maximum value of all MIC(X; Y) as the MIC value.

[0157] Step 4: According to the calculated MIC values ​​between each parameter and the line loss, determine the correlation between each parameter and the line loss value of the distribution network. The larger the MIC value, the greater the variable correlation, and vice versa. Parameters are screened to reduce the dimension of the data.

[0158] A total of 12 parameters including the forward active power of the transformer, the reverse active power of the transformer, the three-phase imbalance, the power factor of the meter, the length of the transmission line, the monthly active power consumption of the load end, the monthly active power consumption of the load end, the voltage at the head end of the transmission side, the daily energy consumption data, the wire transmission loss, the power sales and the standard deviation of the monthly active power supply were selected from the distribution network data, and the maximum information coefficient was used for correlation analysis. The results are shown in Table 1. As can be seen from Table 1, the MIC values ​​of the parameters numbered 11 and 12 are close to 0, indicating that the correlation between these two parameters and the calculation of the distribution network line loss is extremely weak. These two parameters are removed from the 12 parameters, and the remaining 10 parameters are used as the input of the distribution network line loss calculation model to calculate the distribution network line loss value.

[0159] Table 1 MIC values ​​of different parameters and distribution network line losses

[0160]

[0161] Furthermore, the line loss index is preprocessed, and combined with the GRU neural network theory, a GRU neural network model is established to complete the calculation of the line loss of the substation power grid, including:

[0162] First, before inputting the data, the distribution network data is preprocessed, which mainly includes three steps: addition and deletion, normalization and clustering.

[0163] For data that are obviously abnormal or missing in large quantities, delete them; for missing data with a small number of missing values, use the cubic Hermite polynomial interpolation method to fill them in. The process is as follows:

[0164] For two known nodes x0, the function value and derivative value on x1 are: i =f(x i ), m i =f′(x i ), (i = 0, 1), what is required is a polynomial H3(x) with a degree not exceeding 3, so that H3(x i )=y i , H3′(x i )=m i , (i = 0, 1), H3(x) is called a cubic Hermite polynomial. The above conditions are the interpolation conditions for this problem. i ) represents the function f(x i ) at point x = x i The derivative at .

[0165] Secondly, the amount of daily energy consumption data is very large, which will lead to the problem of redundant input feature dimensions, increase the amount of calculation and training difficulty. Therefore, different methods are used to normalize the data in the dataset.

[0166] The original input data set is divided into data set 1 containing only daily energy consumption data and data set 2 not containing daily energy consumption data; data set 2 is normalized, and the calculation formula is as follows:

[0167]

[0168] Among them, x i represents the original data value, x′ i represents the normalized data, x imax represents the maximum value of the elements in the i-th vector; x imin represents the minimum value of the elements in the i-th vector, and n represents the number of data in the sample.

[0169] The PCA method is used to reduce the dimension of daily energy consumption data in data set 1.

[0170] The M-dimensional original daily active power supply dataset is reduced to a new K-dimensional orthogonal feature dataset. Before dimensionality reduction, the original daily active power supply dataset is represented as a matrix X of size n×m.

[0171]

[0172] Where n is the total number of distribution lines; m is the data collection frequency; x nm is the active power supply of the nth distribution line at time m.

[0173] The specific steps of PCA are as follows:

[0174] 1) Sample standardization;

[0175]

[0176] In the formula, x ij Represents the original data value of daily active power supply; x′ ii represents the normalized data; n represents the number of data in the sample.

[0177] 2) Calculate the sample covariance matrix C;

[0178]

[0179] Where, X T is the transposed matrix of matrix X; n is the number of columns of matrix X, that is, the total number of distribution lines.

[0180] 7) Calculate the eigenvalue p of the covariance matrix i and its corresponding eigenvector λ i .

[0181] 8) Select the K eigenvectors with the largest eigenvalues, and then form the corresponding eigenvector matrix P;

[0182] 5) The matrix after dimension reduction is Y=XP;

[0183] 6) In the process of dimensionality reduction, the dimension of the new matrix is ​​determined by the contribution rate of each principal component The calculation formula is as follows:

[0184]

[0185] In the formula, λ i is the eigenvector corresponding to the i-th eigenvalue; m is the number of eigenvalues.

[0186] 7) Set the threshold to ε = 0.85, and solve the sum of the variance ratios of the k eigenvectors to ρ. If ρ>ε, it is considered that the new k-dimensional matrix retains most of the information of the original matrix.

[0187] Further, data set 1 and data set 2 are re-merged together as input data for the distribution network line loss calculation model.

[0188] Then, the K-Means clustering algorithm is used to perform cluster analysis on the correlation degree of the data, and the distance between the feature cluster center point and the cluster object point and the center is calculated according to the following formula:

[0189]

[0190] Among them, x1, y1 represent the horizontal and vertical coordinates of the center point, x n ,y n represents the horizontal and vertical coordinates of the sample points, and k represents the number of samples.

[0191] K-Means algorithm steps based on association analysis:

[0192] 1) Determine input and output. Take the data set sample set as input, determine the number of clusters and the maximum number of algorithm iterations; divide the clusters at output to minimize the square error;

[0193] 2) Select an initial cluster center for each cluster;

[0194] 3) Assign the sample set to the nearest neighbor cluster according to the minimum distance principle;

[0195] 4) Update the cluster center using the sample mean of each cluster;

[0196] 5) Repeat steps 3) and 4) until the cluster center no longer changes;

[0197] 6) Output the final feature clustering center and k cluster divisions.

[0198] The data is processed through the K-Means clustering algorithm, and the cluster centers and clusters are continuously updated, so that the similarity of data objects in the same cluster is as large as possible, and the difference of data objects in different clusters is as large as possible.

[0199] Furthermore, a distribution network line loss calculation model is built. At the same time, the processed data is used as the input of the line loss calculation, and the line loss value of the substation power grid is used as the output indicator.

[0200] Gated Recurrent Unit (GRU) is a derivative model of LSTM with good performance. t , reset gate t , update gate z t The update gate captures the long-term correlation in the time series, and the reset gate captures the short-term correlation in the time series. Its structure is as follows Figure 1 As shown, the mathematical model is as follows.

[0201] Step 1: Input data x t , calculate the output after passing through the update gate and the reset gate, the calculation formula is shown in equations (9) and (10);

[0202]

[0203] Where σ is the sigmoid function; W r , W z is the input weight matrix; R r , R z is the circulant weight matrix; is the bias matrix; h t-1 is the information of the previous moment; r t , z t Represent the outputs of the reset gate and update gate respectively.

[0204] Step 2: Intermediate processing unit performs candidate hidden state Calculation, the calculation formula is shown in formula (11);

[0205]

[0206] Among them, tanh is the hyperbolic tangent function; is the input weight matrix; is the circulant weight matrix; is the bias matrix; h t-1 is the information of the previous moment; is a candidate hidden state.

[0207] Step 3: Output O t Calculate and output the results;

[0208]

[0209]

[0210] Where W is the input weight matrix; R is the cyclic weight matrix; b is the bias matrix; h t-1 is the information of the previous moment; is a candidate hidden state; ⊙ represents the Hadamard product operation; O t is the neuron output; z t Represents the output of the update gate.

[0211] Step 4: After calculating the line loss using the above model, the root mean square error (RMSE) is used for performance evaluation. The calculation method is as follows:

[0212]

[0213] Among them, Y I is the true value, is the predicted value; n is the number of data in the data set.

[0214] Based on the above GRU neural network mathematical model, a power grid line loss calculation model is built.

[0215] Thirdly, the proposed ADPSO optimization algorithm is used to optimize the established substation power grid model, forming a substation power grid line loss calculation model based on the ADPSO algorithm to optimize the GRU neural network, including:

[0216] First of all, the particle swarm optimization (PSO) is a classic population intelligence optimization algorithm based on random search. Its core idea is to achieve global optimization by updating the speed and position of particles. The process is as follows.

[0217] If a population of N individuals searches for the optimal position in an M-dimensional space, the search direction and speed of each individual can be expressed by the mathematical models shown in formula (15) and formula (16), respectively:

[0218]

[0219]

[0220] Where: X i 、V i They are respectively represented as the position and velocity of individual i in the population; is the position of individual i in the population in the k-th dimension search space; is the speed of individual i in the population searching the k-th dimension of the space; N is the number of individuals in the population; M is the dimension of the population search space.

[0221] First, start searching and record the initial position of each individual, that is, the initial optimal position.

[0222] Then, the iterative search is continued. The speed and position of the individual are updated according to formula (17) and formula (18), as shown below:

[0223]

[0224]

[0225]

[0226] Where: d=1,2,3...,M represents the velocity vector and position vector of the dth dimension of individual i in the kth iteration respectively; d=1,2,3...,M is the historical optimal position of individual i in the dth dimension in the kth iteration, that is, the optimal solution searched by individual i after the kth iteration; is the historical optimal position of the population in the dth dimension in the kth iteration, that is, the optimal solution in the entire population after the kth iteration; M is the population search space dimension; c1, c2 are learning factors; r1, r2 are random numbers in the range of [0, 1]; α is the constraint factor that controls the update speed weight; ω is the inertia weight factor; t max is the maximum number of iterations set for optimization; t is the current number of iterations; M is the population search space dimension.

[0227] Then, the fitness of the individuals in the population is calculated. The sum of square errors (SSE) is selected as the criterion function and defined as the fitness function to evaluate the individuals in the population. The expression is:

[0228]

[0229] In the formula, Represents the optimal position coordinates of individual j in the q-th dimensional space; Represents the optimal position coordinates of the population in the q-th dimensional space; N is the number of individuals in the population; M is the dimension of the population search space.

[0230] Secondly, after each position search, during each search process, record the optimal position of each individual:

[0231]

[0232] Where P ibest represents the optimal position of individual i in the population; d = 1, 2, 3..., M is the optimal position of individual i in the d-th dimension search space; N is the number of individuals in the population.

[0233] Finally, the search (iteration) is repeated until the maximum number of iterations set is reached, and the optimal position of the entire population is recorded as shown below.

[0234]

[0235] Among them, G ibest represents the optimal position of the population; d=1, 2, 3..., M is the optimal position of individual i in the population in the d-th dimension space; N is the number of individuals in the population.

[0236] Furthermore, considering that when solving the overall optimal solution of multiple objective functions or constraints, since ω, c1, and c2 in the PSO algorithm are constants, it is easy to fall into the local optimal solution and the optimization ability is poor. Therefore, the three parameters of ω, c1, and c2 are improved to form the ADPSO algorithm, making it more suitable for solving the overall optimal solution of multiple constraints. The specific improvements are as follows.

[0237] First, in order to solve the problem that the global search capability and local development capability cannot be well adjusted when the learning factors c1 and c2 are constants, a learning factor c′1 and c′2 that continuously changes nonlinearly with the number of iterations is proposed. The proposed new learning factors are shown in formula (23) and formula (24) respectively:

[0238]

[0239]

[0240] Among them, c′1, c′2 are the proposed new learning factors; t is the current iteration number; t max The maximum number of iterations set for the optimization.

[0241] Next, when the inertia weight factor ω is too large, it is easy to cause "premature convergence" and oscillation near the global optimal solution in the later stage of the algorithm. To address this problem, ω is processed in sections, and the inertia weight factor ω is adjusted using the idea of ​​nonlinear time-varying, so that the inertia weight factor ω is nonlinearly time-varying, that is, formula (19) is updated as shown in formula (25).

[0242]

[0243] Among them, c′1, c′2 are the proposed new learning factors; t is the current iteration number; t max is the maximum number of iterations for the optimization setting; ω is the inertia weight factor.

[0244] Furthermore, in the later stages of iteration, all individuals will move closer to the optimal individual, resulting in a local optimal solution. In order to avoid falling into the local optimal solution, a non-uniform mutation operation is performed on the optimal individual. The process is as follows:

[0245] Assume X i =(x i1 , x i2 , ..., x iM ) is an individual in the population, and its upper and lower boundaries are x imax 、x imin , randomly generate an integer k∈[1,M], and then take the corresponding element x from the individual ik , and then determine the mutation x′ according to the following formula ik , forming a new individual X′ i =(x i1 , x i2 , ..., x′ ik , ..., x iM ).

[0246]

[0247] Among them, x imax 、x imin The variables x ik The function Δ(t, z) returns a value between [0, z], and as t increases, the function Δ(t, z) approaches 0. The characteristics of the function Δ(t, z) enable the algorithm to have a larger search range in the early stage and to make small adjustments in the later stage. The function Δ(t, z) is expressed as:

[0248]

[0249] Where r is a random number in the range of [0, 1]; is a parameter of uniformity; t is the current evolutionary generation; t max represents the maximum number of evolutionary generations.

[0250] Furthermore, we can get the flowchart of ADPSO algorithm (such as Figure 2 The algorithm steps are as follows.

[0251] Step 1: Set the number of individuals in the population N and the maximum number of iterations of the algorithm T max , initialize individual position and velocity information and the starting iteration number t = 1;

[0252] Step 2: Calculate the initial fitness of each individual in the population, find the position of the current optimal individual and retain it as the initial optimal position value of the population;

[0253] Step 3: Start iteration, calculate according to formulas (17) and (18), and update the individual position and velocity;

[0254] Step 4: After the position and speed are updated, the fitness of each individual is calculated according to formula (20), and compared with the fitness value of the previously retained individual and population optimal positions. If better, the new optimal value is used to update the individual optimal position value and the group optimal position value;

[0255] Step 5: Determine whether the current number of iterations has reached the maximum number of iterations t max If yes, the optimal solution is output and the calculation ends; otherwise, the next iteration is entered and step 3 is returned until the maximum number of iterations t is reached. max until.

[0256] Furthermore, the ADPSO algorithm is used to optimize the parameters of the established GRU neural network model, such as the neuron weight, threshold and number of hidden layer neurons, to form an improved ADPSO-GRU neural network model to calculate the line loss of the power grid. The ADPSO optimization steps are as follows, and the flow chart is as follows: Figure 3shown.

[0257] Furthermore, the specific implementation steps of the ADPSO-GRU neural network model are as follows: Figure 4 As shown:

[0258] Step 1: Input the distribution network data and use the maximum information coefficient (MIC) to analyze the correlation between each parameter in the input data and the distribution network line loss. Select the parameters with greater correlation as the input of the distribution network line loss calculation model. ;

[0259] Step 2: Preprocess the selected data parameters and divide them into training set and test set in a ratio of 7:3; use the training set data as the input for calculating the line loss of the distribution network;

[0260] Step 3: Build a GRU neural network line loss calculation model. Use the improved ADPSO algorithm to optimize the number of hidden layer neurons, thresholds, and connection weight matrices of the GRU neural network model;

[0261] Step 4: Establish an improved ADPSO-GRU distribution network line loss calculation neural network model;

[0262] Step 5: Input the distribution network test set data, output the calculated theoretical line loss value, and perform performance evaluation;

[0263] In a second aspect, the present invention provides a method and device for calculating line loss in a distribution network based on ADPSO optimized GRU neural network, comprising:

[0264] Data acquisition module: used to obtain relevant power flow data collected by the power grid acquisition system;

[0265] Parameter correlation calculation module: Use the maximum information coefficient (MIC) to analyze the correlation between each parameter in the input data and the distribution network line loss. Select the parameters with greater correlation as the input of the distribution network line loss calculation model;

[0266] Algorithm optimization module: optimize and learn the constructed distribution network line loss calculation model using the improved ADPSO-GRU algorithm to obtain the distribution network line loss calculation model after optimization and learning;

[0267] Line loss calculation and analysis module: After the data samples to be tested are processed by the parameter correlation calculation module, they are input into the distribution network line loss calculation model to calculate the distribution network line loss and output the results.

[0268] In a third aspect, the present invention provides an electronic device, including a processor and a storage medium;

[0269] The storage medium is used to store instructions;

[0270] The processor is configured to operate according to the instructions to execute the steps of any of the aforementioned methods.

[0271] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor. The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. Various changes can be made within the scope of knowledge possessed by ordinary technicians in the field without departing from the purpose of the present invention. These changes involve related technologies well known to those skilled in the art, which all fall within the scope of protection of the patent of the present invention.

[0272] Many other changes and modifications may be made without departing from the concept and scope of the present invention.It should be understood that the present invention is not limited to the specific embodiments, and the scope of the present invention is defined by the appended claims.

Claims

1. A distribution network line loss calculation method based on ADPSO optimized GRU neural network, characterized by: include: Step (1): Analyze the correlation of data parameters associated with distribution network line loss calculation, and select parameters with greater correlation as input of distribution network line loss calculation model; Step (2): pre-process the selected data parameters, combine the GRU neural network theory, and establish a GRU neural network model to complete the calculation of distribution network line loss; Step (3): Use the improved particle swarm algorithm (ADPSO) to optimize the distribution network model and form a distribution network line loss calculation model based on the ADPSO-GRU neural network.

2. The method according to claim 1, characterized in that: The step (1) is to use the maximum information coefficient (MIC) to analyze the correlation between various parameters in the input distribution network data and the distribution network line loss, and select parameters with greater correlation as inputs to the distribution network line loss calculation model; Let X = {x1, x2, …, x n } and Y={y1,y2,…,y n } are random variables in the data set, n is the number of samples, then the mutual information MI between X and Y is: In formula (1), ∫ represents the integral sign; p(x, y) is the joint probability density between X and Y; p(x) and p(y) are the marginal probability densities between X and Y respectively; The MIC calculation formula is: In formula (2), B is the number of samples, and the size setting is about 0.6 power of the data volume; N is the sample variable; I(x, y) is the mutual information MI between x and y; MIC∈[0,1], the closer the MIC value is to 1, the stronger the correlation is; The steps of performing parameter index correlation analysis using the above maximum information coefficient (MIC) are as follows: Step 1: Given i and j, grid the scatter plot of X and Y into i columns and j rows, and use formula (1) to find the maximum mutual information value MI; Step 2: Divide the obtained maximum mutual information by log2 min(x,y) for normalization; Step 3: Select the maximum value of mutual information at different scales as the MIC value; Step 4: According to the calculated MIC values ​​between each parameter and the line loss, determine the correlation between each parameter and the distribution network line loss value.

3. The method according to claim 1, characterized in that The step (2) is: Preprocess the line loss index, combine the GRU neural network theory, and establish a GRU neural network model to complete the calculation of the line loss of the substation power grid, including: S11, before inputting data, preprocess the distribution network data; including three steps: addition and deletion, normalization and clustering; For data that are obviously abnormal or missing in large quantities, delete them; for data that are missing and the number of missing values ​​is small, use the cubic Hermite polynomial interpolation method to fill in the missing values. The process is as follows: For the two known nodes x0 and x1, the function values ​​and derivative values ​​are: i =f(x i ), m i =f'(x i ), (i=0,1), what is required is a polynomial H3(x) with a degree not exceeding 3, so that H3(x i )=y i , H3'(x i )=m i , (i=0,1), H3(x) is called a cubic Hermite polynomial. The above conditions are the interpolation conditions for this problem; where f'(x i ) represents the function f(x i ) at point x = x i The derivative at ; S22, using different methods to normalize the data in the dataset; The original input data set is divided into data set 1 which only contains daily energy consumption data and data set 2 which does not contain daily energy consumption data. Data set 2 is normalized and its calculation formula is as follows: Among them, x i Represents the original data value, x' i represents the normalized data, x imax represents the maximum value of the elements in the i-th vector; x imin represents the minimum value of the elements in the i-th vector, and n represents the number of data in the sample; The PCA method is used to reduce the dimension of daily energy consumption data in Dataset 1; The M-dimensional original daily active power supply dataset is reduced to a new K-dimensional orthogonal feature dataset; before the dimensionality reduction process, the original daily active power supply dataset is represented as a matrix X of size n×m; Where n is the total number of distribution lines; m is the data collection frequency; x nm is the active power supply of the nth distribution line at time m; The specific steps of the PCA method are as follows: 1) Sample standardization; In the formula, x ij Indicates the original data value of daily active power supply; x' ij represents the normalized data; n represents the number of data in the sample; 2) Calculate the sample covariance matrix C; In the formula, X T is the transposed matrix of matrix X; n is the number of columns of matrix X, that is, the total number of distribution lines; 3) Calculate the eigenvalue p of the covariance matrix i and its corresponding eigenvector λ i ; 4) Select the K eigenvectors with the largest eigenvalues, and then form the corresponding eigenvector matrix P; 5) The matrix after dimension reduction is Y=XP; 6) In the process of dimensionality reduction, the dimension of the new matrix is ​​determined by the contribution rate of each principal component The calculation formula is as follows: In the formula, λ i is the eigenvector corresponding to the i-th eigenvalue; m is the number of eigenvalues; 7) Set the threshold to ε = 0.85, and solve the sum of the variance ratios of the k eigenvectors to ρ; if ρ>ε, it is considered that the new k-dimensional matrix retains most of the information of the original matrix; The method also includes the step of merging the data set 1 and the data set 2 together again to serve as input data of the distribution network line loss calculation model; Then, the K-Means clustering algorithm is used to perform cluster analysis on the correlation degree of the data, and the distance between the feature cluster center point and the cluster object point and the center is calculated according to the following formula: Among them, x1, y1 represent the horizontal and vertical coordinates of the center point, x n ,y n represents the horizontal and vertical coordinates of the sample points, and k represents the number of samples; The steps of the K-Means clustering algorithm based on association analysis are: S101: Determine input and output; take a data set sample set as input, determine the number of clusters and the maximum number of algorithm iterations; divide the clusters at output so that the square error is minimized; S102: Selecting an initial cluster center for each cluster; S103: assigning the sample set to the nearest neighbor cluster according to the minimum distance principle; S104: Update the cluster center using the sample mean of each cluster; S105: Repeat steps S103 and S104 until the cluster center no longer changes; S106: Output the final feature clustering center and k cluster divisions.

4. The method according to claim 1, characterized in that: In step (3), while building a distribution network line loss calculation model, the processed data is used as input for line loss calculation, and the line loss value of the substation power grid is used as an output indicator; The Gated Recurrent Unit (GRU) neural network is a derivative model of the long short-term memory network; the GRU contains an input gate x t , reset gate t , update gate z t , where the update gate captures the long-term correlation in the time series, and the reset gate captures the short-term correlation in the time series. The mathematical model is as follows: S201: Input data x t , calculate the output after passing through the update gate and the reset gate, the calculation formula is shown in equations (9) and (10); Where σ is the sigmoid function; W r , W z is the input weight matrix; R r , R z is the circulant weight matrix; is the bias matrix; h t-1 is the information of the previous moment; r t ,z t Represent the outputs after the reset gate and the update gate respectively; S202: Intermediate processing unit performs candidate hidden state Calculation, the calculation formula is shown in formula (11); Among them, tanh is the hyperbolic tangent function; is the input weight matrix; is the circulant weight matrix; is the bias matrix; h t-1 The information of the previous moment is the candidate hidden state; S203: Output O t Calculate and output the results; Where W is the input weight matrix; R is the cyclic weight matrix; b is the bias matrix; h t-1 is the information of the previous moment; is a candidate hidden state; ⊙ represents the Hadamard product operation; O t is the neuron output; z t Represents the output after the update gate; S204: After calculating the line loss using the above model, the root mean square error (RMSE) is used for performance evaluation. The calculation method is as follows: Among them, Y I is the true value, is the predicted value; n is the number of data in the data set; Based on the above GRU neural network mathematical model, a power grid line loss calculation model is built.

5. The method according to claim 1, characterized in that: The step (3) is: The proposed ADPSO optimization algorithm is used to optimize the established substation power grid model, forming a substation power grid line loss calculation model based on the ADPSO algorithm to optimize the GRU neural network, including: S301, using particle swarm optimization (PSO) to perform population intelligence optimization algorithm; global optimization is achieved by updating the speed and position of particles, and the process is as follows: If a population of N individuals searches for the optimal position in an M-dimensional space, the search direction and speed of each individual can be expressed by the mathematical models shown in formula (15) and formula (16), respectively: Where: X i 、V i They are respectively represented as the position and velocity of individual i in the population; k = 1, 2, 3…, M is the position of individual i in the population in the k-th dimension search space; k = 1, 2, 3…, M is the speed of individual i in the population searching the k-th dimension of the space; N is the number of individuals in the population; M is the dimension of the population search space; S302: Start searching and record the initial position of each individual, i.e., the initial optimal position; S303: Continuously perform iterative search; update the speed and location of the individual according to formula (17) and formula (18), as shown below: Where: d=1,2,3…,M represent the velocity vector and position vector of the dth dimension of individual i in the kth iteration respectively; d=1,2,3…,M is the historical optimal position of individual i in the dth dimension in the kth iteration, that is, the optimal solution searched by individual i after the kth iteration; d=1,2,3…,M is the historical optimal position of the population in the dth dimension in the kth iteration, that is, the optimal solution in the entire population after the kth iteration; M is the population search space dimension; c1, c2 are learning factors; r1, r2 are random numbers in the range of [0,1]; α is the constraint factor that controls the update speed weight; ω is the inertia weight factor; t max is the maximum number of iterations set for optimization; t is the current number of iterations; M is the population search space dimension; S304: Calculate the fitness of individuals in the population; select the sum of square errors (SSE) as the criterion function, define it as a fitness function to evaluate individuals in the population, and the expression is: In the formula, Represents the optimal position coordinates of individual j in the q-th dimensional space; represents the optimal position coordinates of the population in the q-th dimension space; N is the number of individuals in the population; M is the dimension of the population search space; S305: After each position search, in each search process, record the optimal position of each individual: Where P ibest represents the optimal position of individual i in the population; d=1,2,3…,M is the optimal position of individual i in the d-th dimension search space; N is the number of individuals in the population; S306: Repeat the search (iteration) until the maximum number of iterations set is reached, and record the optimal position of the entire population as shown below; Among them, G ibest represents the optimal position of the population; d=1,2,3…,M is the optimal position of individual i in the population in the d-dimensional space; N is the number of individuals in the population.

6. The method according to claim 5, characterized in that: In step (3), when solving the overall optimization of multiple objective functions or constraints, since ω, c1, and c2 in the PSO algorithm are constants, improvements are made to the three parameters ω, c1, and c2 to form an ADPSO algorithm, making it more suitable for solving the overall optimization of multiple constraints. The specific improvements are as follows: S401: A new learning factor c'1, c'2 that changes nonlinearly with the number of iterations. The proposed new learning factors are shown in formula (23) and formula (24) respectively: Among them, c'1, c'2 are the proposed new learning factors; t is the current iteration number; t max The maximum number of iterations set for the optimization; S402: segmentally process ω, and use the idea of ​​nonlinear time-varying to adjust the inertia weight factor ω, so that the inertia weight factor ω is nonlinearly time-varying, that is, update formula (19) as shown in formula (25); Among them, c'1, c'2 are the proposed new learning factors; t is the current iteration number; t max is the maximum number of iterations for the optimization setting; ω is the inertia weight factor; In the later stage of iteration, all individuals will approach the optimal individual, and a local optimal solution will appear. The optimal individual is subjected to non-uniform mutation operation, and the process is as follows: Assume X i =(x i1 ,x i2 ,...,x iM ) is an individual in the population, and its upper and lower boundaries are x imax 、x imin , randomly generate an integer k∈[1,M], and then take the corresponding element x from the individual ik , and then determine the mutation x' according to the following formula ik , forming a new individual X' i =(x i1 ,x i2 ,...,x' ik ,...,x iM ); Among them, x imax 、x imin The variables x ik The function Δ(t,z) returns a value between [0,z], and as t increases, the function Δ(t,z) approaches 0. The characteristics of the function Δ(t,z) enable the algorithm to have a larger search range in the early stage and to make small adjustments in the later stage. The function Δ(t,z) is expressed as: Among them, r is a random number in the range of [0,1]; is a parameter of uniformity; t is the current evolutionary generation; t max represents the maximum evolutionary generation; The steps of ADPSO algorithm are as follows: S501: Set the number of individuals in the population N and the maximum number of iterations of the algorithm T max , initialize individual position and velocity information and the starting iteration number t = 1; S502: Calculate the initial fitness of each individual in the population, find the position of the current optimal individual and retain it as the initial optimal position value of the population; S503: Start iteration, calculate according to formulas (17) and (18), and update the individual position and velocity; S504: After the position and speed are updated, the fitness of each individual is calculated according to formula (20), and compared with the fitness values ​​of the previously retained optimal positions of the individual and the population; if better, the optimal position value of the individual and the optimal position value of the population are updated using the new optimal value; S505: Determine whether the current number of iterations reaches the maximum number of iterations t max ; If yes, output the optimal solution and the calculation ends; otherwise, enter the next iteration and return to step 3 until the maximum number of iterations t is reached max until.

7. The method according to claim 1, characterized in that: The step (3) uses the ADPSO algorithm to optimize the parameters such as the neuron weight, threshold and number of hidden layer neurons of the established GRU neural network model to form an improved ADPSO-GRU neural network model to calculate the line loss of the power grid. The ADPSO optimization steps are as follows: S601: input distribution network data, and use the maximum information coefficient (MIC) to analyze the correlation between various parameters in the input data and the distribution network line loss; select parameters with greater correlation as inputs of the distribution network line loss calculation model; S602: pre-process the selected data parameters and divide them into a training set and a test set in a ratio of 7:3; use the training set data as input for calculating the distribution network line loss; S603: Build a GRU neural network line loss calculation model; use the improved ADPSO algorithm to optimize the number of hidden layer neurons, thresholds and connection weight matrix of the GRU neural network model; S604: Establish an improved ADPSO-GRU distribution network line loss calculation neural network model; S605: Input the distribution network test set data, output the calculated theoretical line loss value, and perform performance evaluation.

8. A distribution network line loss calculation device based on ADPSO optimized GRU neural network, including: Data acquisition module: used to obtain relevant power flow data collected by the power grid acquisition system; Parameter correlation calculation module: uses the maximum information coefficient (MIC) to analyze the correlation between each parameter in the input data and the distribution network line loss; Select the parameters with greater correlation as the input of the distribution network line loss calculation model; Algorithm optimization module: optimizes and learns the constructed distribution network line loss calculation model using the improved ADPSO-GRU algorithm to obtain the distribution network line loss calculation model after optimization and learning; Line loss calculation and analysis module: After the data samples to be tested are processed by the parameter correlation calculation module, they are input into the distribution network line loss calculation model to calculate the distribution network line loss and output the results.

9. An electronic device comprising a processor and a storage medium; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 7.