Power system inertia time constant estimation method based on improved long short-term memory network model

By improving the combination of long and short-term memory network model and carnivorous plant algorithm, the accuracy problem of traditional power system inertia time constant estimation methods in noise and nonlinear environments is solved, and efficient and accurate estimation effects are achieved.

CN119885890AActive Publication Date: 2025-04-25GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510045049.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-04-25
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

The traditional inertial time constant estimation method of power system is difficult to meet the high-demand engineering application requirements when facing external noise, system nonlinearity and parameter changes.

Method used

The power system inertia time constant estimation method based on the improved long and short-term memory network model is adopted. By arranging, randomly sorting and normalizing the frequency change amount, frequency change rate and inertia time constant of the power system, a long and short-term memory network model is built, and the carnivorous plant algorithm is used to iterate to find the optimal parameter configuration of the model.

Benefits of technology

It effectively avoids the local optimal solution problem of long and short-term memory network model when setting hyperparameters, improves the estimation accuracy and convergence speed, and realizes the accurate estimation of the inertia time constant of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885890A_ABST
    Figure CN119885890A_ABST
Patent Text Reader

Abstract

The invention discloses a power system inertia time constant estimation method based on an improved long short-term memory network model, and the method comprises the following steps: S1, arranging the frequency variation, the frequency change rate and the inertia time constant of a power system to generate an array, carrying out the random sorting and data set division of the array, and carrying out the normalization processing; s2, defining a long short-term memory network model structure, and building a long short-term memory network model; and S3, taking the processed frequency variation and frequency change rate as input data of the model, taking the processed inertia time constant as output data of the model, applying a carnivorous plant algorithm for iterative optimization to obtain optimal parameter configuration of the long-short-term memory network model, and training, testing and verifying the model to obtain the optimal parameter configuration of the long-short-term memory network model. Acquiring an inertia time constant estimation value of the power system; according to the method, the advantages of high optimization precision and high convergence speed of the carnivorous plant algorithm are utilized, the global optimal solution of the hyper-parameter is quickly obtained, and accurate estimation of the inertia time constant is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of power system inertia time constant estimation, in particular to a power system inertia time constant estimation method based on an improved long short-term memory network model. Background Art

[0002] With the increase in the proportion of renewable energy in the power system, the synchronous machine in the system is gradually replaced, resulting in a decrease in the inertia time constant of the system, which in turn weakens the frequency regulation ability of the system and poses severe challenges to the stability of the system. Traditional inertia time constant estimation methods are usually based on classical control theory, such as model identification, Kalman filtering, etc., but these methods are often affected by external noise, system nonlinearity, parameter changes and other factors, and the accuracy is difficult to meet the high requirements of engineering applications. In recent years, artificial intelligence technology based on deep learning, especially the long short-term memory network model, can effectively capture long-term dependencies in time series through its special gating mechanism. However, the long short-term memory network model is prone to fall into local optimal solutions and slow convergence during training, which affects its performance in estimating the inertia time constant of the power system. To this end, the present invention proposes a method for estimating the inertia time constant of a power system based on an improved long short-term memory network model. Summary of the invention

[0003] To achieve the above purpose, the technical solution provided by the present invention is:

[0004] A method for estimating the inertia time constant of a power system based on an improved long short-term memory network model comprises the following steps:

[0005] S1: Arrange the frequency change, frequency change rate and inertia time constant of the power system to generate an array, randomly sort and divide the data set, and perform normalization processing;

[0006] S2: Define the long short-term memory network model structure and build a long short-term memory network model;

[0007] S3: The processed frequency change and frequency change rate are used as the input data of the model, and the processed inertia time constant is used as the output data of the model. The carnivorous plant algorithm is used to iteratively optimize and obtain the optimal parameter configuration of the long short-term memory network model. The model is trained, tested and verified to obtain the estimated value of the inertia time constant of the power system.

[0008] Furthermore, in step S1, the frequency change amount, frequency change rate and inertia time constant of the power system are arranged to generate an array, randomly sorted and divided into data sets, and normalized. The specific steps are as follows:

[0009] S1-1: Obtain the time series data of the frequency change and frequency change rate of the power system and the true value of the inertia time constant at the corresponding time point, merge the corresponding time series data of the frequency change and frequency change rate with the inertia time constant, and form input data in the format of a two-dimensional array, which can be expressed as:

[0010]

[0011] In formula (1), X is an array consisting of frequency change, frequency change rate and inertia time constant, Δf mn is the frequency change, is the frequency change rate, H m is the inertia time constant, m is the number of data sets, and n is the time step;

[0012] S1-2: Randomly sort the time series data and divide them into training set, test set and validation set. The training set is used to train the model, the test set is used to evaluate the effect of the model, and the validation set is used to evaluate the generalization ability of the model.

[0013] S1-3: Use linear normalization method to adjust the data set to [0,1], and its expression is:

[0014]

[0015] In formula (2), X' is the normalized data, X max is the maximum value in the original data, X min is the minimum value in the original data;

[0016] Furthermore, in the step S2, the structure of the long short-term memory network model is defined, and the specific steps for building the long short-term memory network model are as follows:

[0017] S2-1: Define the LSTM network model: input layer, LSTM network units, 4 hidden layers and output layer. The number of units in the hidden layer is the hyperparameter to be optimized, and its parameter range is [10,300]. At the same time, regularization and batch normalization techniques are added to the network to prevent overfitting.

[0018] S2-2: Build a long short-term memory network model, which can be expressed as:

[0019]

[0020] In formula (3), t is the current time step, t-1 is the previous time step, t+1 is the next time step, γ t is the forgetting unit of the current time step t, σ is the Sigmoid activation function, W γ is the weight matrix of the forgetting unit γ, [ε t-1 ,xt ] is the output ε of the previous time step t-1 t-1 and the input x at the current time step t t The vector composed of γ is the bias term of the forgetting unit γ, δ t is the input unit of the current time step t, W δ is the weight matrix of the input unit δ, β δ is the bias term of the input unit δ, υ t is the long-term memory information of the current time step t, tanh is the hyperbolic tangent function, W υ is the weight matrix of long-term memory information υ, β υ is the bias term of long-term memory information υ, λ t is the output unit λ of the current time step t, W λ is the weight matrix of the output unit λ, β λ is the bias term of the output unit λ, υ t-1 is the long-term memory information of the previous time step t-1, ε t is the hidden layer output at the current time step t, θ t+1 is the parameter value for the next time step t+1, θ t is the parameter value of the current time step t, η is the predefined learning rate, is the gradient second-order moment estimate of the current time step t, To prevent division by zero for small constants, is the first-order moment momentum of the gradient at the current time step t, G t is the sample number gradient estimate of the current time step t, B is the predefined sample number, is the loss function of the lth training sample, o l is the input of the lth sample, p l is the output of the lth sample, is the gradient of the next time step t+1, is the gradient of the current time step t, T is the predefined gradient clipping threshold, is the gradient norm of the current time step t;

[0021] S2-3: Select Adam optimizer as the optimization method of the model. The learning rate is a key hyperparameter for model optimization. Its parameter range is [0.001, 0.01]. The maximum number of training times is set to 100. The number of samples in each mini-batch during mini-batch training is set to 128, and the gradient clipping threshold is set to 1.

[0022] Furthermore, in the step S3, the processed frequency change amount and frequency change rate are used as the input data of the model, and the processed inertia time constant is used as the output data of the model. The carnivorous plant algorithm is used to iteratively optimize to obtain the optimal parameter configuration of the long short-term memory network model, and the model is trained, tested and verified to obtain the estimated value of the inertia time constant of the power system. The specific steps are as follows:

[0023] S3-1: Select the frequency change amount and frequency change rate processed in step S1-3 as the input features of the model, and the processed inertia time constant as the output feature of the model;

[0024] S3-2: Determine the objective function of the carnivorous plant algorithm, with the goal of minimizing the mean square error between the estimated value and the true value of the inertia time constant of the power system, and obtain the optimal hyperparameter combination of the model, which can be expressed as:

[0025]

[0026] In formula (4), Min is the minimum value function, is the mean square error vector between the estimated value and the true value of the inertia time constant, H e is the true value of the e-th inertia time constant, is the estimated value of the e-th inertial time constant of the model under the configuration of the a-th set of hyperparameter combinations, is the vector of the a-th group of hyperparameter combinations, x a1 ,x a2 ,x a3 ,x a4 is the number of hidden layer units to be optimized in the a-th group of hyperparameter combinations, x a5 is the learning rate to be optimized in the a-th group of hyperparameter combinations;

[0027] S3-3: Determine the constraint function of the carnivorous plant algorithm, define the parameter range of the number of hidden layer units and the learning rate, prevent the model from being too simple, resulting in low estimation accuracy of the inertial time constant, and avoid too slow convergence speed of learning frequency data and inertial time constant data, which can be expressed as:

[0028]

[0029] S3-4: The carnivorous plant algorithm is used to optimize the number of hidden layer units and learning rate of the long short-term memory network model. A population of carnivorous plants and prey is randomly initialized to form multiple sets of hyperparameter combinations for estimating the inertial time constant of the model, which can be expressed as:

[0030]

[0031] In formula (6), P is the population matrix, which represents the matrix composed of all hyperparameter combinations of the model, xab is the carnivorous plant or prey individual, representing the specific hyperparameter value, a is the number of individuals, representing the number of hyperparameter combinations, and b is the dimension, representing the number of hyperparameters to be optimized;

[0032] S3-5: According to the constraints in step S3-3, each carnivorous plant and prey individual is randomly initialized to generate an initial hyperparameter combination, which can be expressed as:

[0033] x ab =Low b +(High b -Low b )×rand (7)

[0034] In formula (7), Low b The lower bound of the parameter range predefined for the bth hyperparameter, High b is the upper bound of the parameter range predefined for the bth hyperparameter, and rand is a randomly selected value between 0 and 1;

[0035] S3-6: Use different hyperparameter combinations to construct a long short-term memory network model, obtain the estimated value of the inertial time constant, calculate the mean square error between it and the true value, use it as the fitness function of the individual and sort them from small to large, select the i individuals with the lowest mean square error as carnivorous plants, and the remaining j individuals as prey, which can be expressed as:

[0036]

[0037] In formula (8), is the individual mean square error vector, E cp(i) is the mean square error of the carnivorous plant ranked i, E prey(j) is the mean square error of the j-ranked prey, i is the number of carnivorous plants, j is the number of prey, and i <j;

[0038] S3-7: According to the sorting result in step S3-6, the population matrix in step S3-4 is sorted in ascending order. The higher the ranking, the closer the hyperparameter combination is to the optimal solution, which can be expressed as:

[0039]

[0040] In formula (9), S_P is the sorted population matrix, CP ib is the hyperparameter value of the carnivorous plant ranked i in column b, Prey jb is the hyperparameter value of the j-ranked prey in column b, It is the i-ranked carnivorous plant. is the prey ranked j;

[0041] S3-8: Carnivorous plants and prey are grouped according to a certain rule. The first-ranked prey is assigned to the first-ranked carnivorous plant, the second-ranked prey is assigned to the second-ranked carnivorous plant, and so on, until the i-ranked prey is assigned to the i-ranked carnivorous plant, and then the i+1-ranked prey is assigned to the first-ranked carnivorous plant. Repeat the cycle to complete the grouping of carnivorous plants and prey, and each group contains 1 carnivorous plant and no less than 2 prey, which can be expressed as:

[0042]

[0043] In formula (10), SS_P is the grouping matrix of carnivorous plants and prey, each row is the same group, and k is an integer;

[0044] S3-9: In the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will randomly select prey from the same group in the grouping matrix SS_P, capture and digest the prey to promote their own growth, forming a new model hyperparameter value, which can be expressed as:

[0045] NewCP ib =g cp ×CP ib +(1-g cp )×Prey cb (11)

[0046] In formula (11), NewCP ib is the hyperparameter value of the newly generated carnivorous plant, Prey cb is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g cp For CP ib The growth rate is expressed as:

[0047] g cp =g×rand (12)

[0048] In formula (12), g is the predefined growth rate;

[0049] S3-10: If the attraction rate is less than the random number, the prey escapes and continues to grow, which can be expressed as:

[0050] NewPrey ib =g p ×Prey cb +(1-g p )×Prey db c≠d (13)

[0051] In formula (13), NewPrey ib The new prey hyperparameter value for the prey to escape and continue to grow, Preydb is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g p is the growth rate of the prey, which is expressed as:

[0052]

[0053] In formula (14), E prey(c) is the mean square error of the prey ranked c, E prey(d) is the mean square error of the prey ranked d;

[0054] S3-11: In the reproduction stage, only the carnivorous plants with the smallest mean square error are allowed to reproduce, and a new generation of carnivorous plants is generated by concentrating resources. The hyperparameter value can be expressed as:

[0055] NewCP ib =CP 1b +r×rand×m ib (15)

[0056] In formula (15), CP 1b is the hyperparameter value of the carnivorous plant ranked first in column b, r is the predefined reproduction rate, m ib is the hyperparameter value of the breeding partner, and its expression is:

[0057]

[0058] In formula (16), CP ib , CP cb is the hyperparameter value corresponding to the randomly selected carnivorous plant in column b, E cp(c) is the mean square error of the carnivorous plant ranked c;

[0059] S3-12: Combine the newly generated carnivorous plants and prey with the original population, calculate their mean square error and re-sort them in ascending order, retain the hyperparameter combination with the smallest mean square error in group a according to the elite selection strategy, and repeat the above steps for grouping, growth, reproduction, etc. until the maximum number of iterations is met, generate the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and select the optimal individual as the model hyperparameter configuration;

[0060] S3-13: Select the optimal hyperparameter combination obtained by iterative optimization of the carnivorous plant algorithm to configure the long short-term memory network model, train the model using the pre-processed training set, and test the model to obtain the estimated value of the inertia time constant of the power system.

[0061] Compared with the prior art, the principles and advantages of the present invention are as follows:

[0062] The present invention discloses a method for estimating the inertia time constant of a power system based on an improved long short-term memory network model. Firstly, the frequency change amount, frequency change rate and inertia time constant of the power system are arranged to generate an array, which is randomly sorted and the data set is divided, and normalized; then, the long short-term memory network model structure is defined, and the long short-term memory network model is built; finally, the processed frequency change amount and frequency change rate are used as input data of the model, and the processed inertia time constant is used as output data of the model, and the carnivorous plant algorithm is used to iteratively optimize, so as to obtain the optimal parameter configuration of the long short-term memory network model, and the model is trained, tested and verified to obtain the estimated value of the inertia time constant of the power system.

[0063] The present invention utilizes the advantages of high optimization accuracy and fast convergence speed of the carnivorous plant algorithm to perform a global search in a huge hyperparameter space, effectively avoiding the local optimal solution problem of the long short-term memory network model during hyperparameter setting. Through its unique predation mechanism and population update method, the hyperparameter optimization process is accelerated, thereby quickly obtaining the global optimal solution of the model hyperparameters and achieving accurate estimation of the inertial time constant. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 This is a flow chart of estimating the inertia time constant of a power system in an embodiment of the present invention;

[0065] Figure 2 A comparison diagram of the estimated inertia value and the true value of the training set in an embodiment of the present invention;

[0066] Figure 3 This is a diagram showing the relative error of inertia estimation of a training set in an embodiment of the present invention;

[0067] Figure 4 A comparison diagram of the estimated inertia value and the true value of the test set in an embodiment of the present invention;

[0068] Figure 5 This is a relative error diagram of inertia estimation of a test set in an embodiment of the present invention;

[0069] Figure 6 This is a comparison diagram of the estimated value and the true value of the inertia of the verification set in an embodiment of the present invention;

[0070] Figure 7 This is a diagram of the relative error of the inertia estimation of the verification set in an embodiment of the present invention. Specific implementation methods

[0072] The present invention will be further described below in conjunction with specific embodiments:

[0073] Figure 1The figure shows a flow chart of estimating the inertia time constant of a power system. The method for estimating the inertia time constant of a power system based on the improved long short-term memory network model described in this embodiment includes the following steps:

[0074] S1: Arrange the frequency change, frequency change rate and inertia time constant of the power system to generate an array, randomly sort and divide the data set, and perform normalization. The specific process is as follows:

[0075] S1-1: Obtain the time series data of the frequency change and frequency change rate of the power system and the true value of the inertia time constant at the corresponding time point, merge the corresponding time series data of the frequency change and frequency change rate with the inertia time constant, and form input data in the format of a two-dimensional array, which can be expressed as:

[0076]

[0077] In formula (17), X is an array consisting of frequency change, frequency change rate and inertia time constant, Δf mn is the frequency change, is the frequency change rate, H m is the inertia time constant, m is the number of data sets, and n is the time step;

[0078] S1-2: Randomly sort the time series data and divide them into training set, test set and validation set. The training set is used to train the model, the test set is used to evaluate the effect of the model, and the validation set is used to evaluate the generalization ability of the model.

[0079] S1-3: Use linear normalization method to adjust the data set to [0,1], and its expression is:

[0080]

[0081] In formula (18), X' is the normalized data, X max is the maximum value in the original data, X min is the minimum value in the original data;

[0082] S2: Define the long short-term memory network model structure and build a long short-term memory network model. The specific process is as follows:

[0083] S2-1: Define the LSTM network model: input layer, LSTM network units, 4 hidden layers and output layer. The number of units in the hidden layer is the hyperparameter to be optimized, and its parameter range is [10,300]. At the same time, regularization and batch normalization techniques are added to the network to prevent overfitting.

[0084] S2-2: Build a long short-term memory network model, which can be expressed as:

[0085]

[0086] In formula (19), t is the current time step, t-1 is the previous time step, t+1 is the next time step, γ t is the forgetting unit of the current time step t, σ is the Sigmoid activation function, W γ is the weight matrix of the forgetting unit γ, [ε t-1 ,x t ] is the output ε of the previous time step t-1 t-1 and the input x at the current time step t t The vector composed of γ is the bias term of the forgetting unit γ, δ t is the input unit of the current time step t, W δ is the weight matrix of the input unit δ, β δ is the bias term of the input unit δ, υ t is the long-term memory information of the current time step t, tanh is the hyperbolic tangent function, W υ is the weight matrix of long-term memory information υ, β υ is the bias term of long-term memory information υ, λ t is the output unit λ of the current time step t, W λ is the weight matrix of the output unit λ, β λ is the bias term of the output unit λ, υ t-1 is the long-term memory information of the previous time step t-1, ε t is the hidden layer output at the current time step t, θ t+1 is the parameter value for the next time step t+1, θ t is the parameter value of the current time step t, η is the predefined learning rate, is the gradient second-order moment estimate of the current time step t, To prevent division by zero for small constants, is the first-order moment momentum of the gradient at the current time step t, G t is the sample number gradient estimate of the current time step t, B is the predefined sample number, is the loss function of the lth training sample, o l is the input of the lth sample, p l is the output of the lth sample, is the gradient of the next time step t+1, is the gradient of the current time step t, T is the predefined gradient clipping threshold, is the gradient norm of the current time step t;

[0087] S2-3: Select Adam optimizer as the optimization method of the model. The learning rate is a key hyperparameter for model optimization. Its parameter range is [0.001, 0.01]. The maximum number of training times is set to 100. The number of samples in each mini-batch during mini-batch training is set to 128, and the gradient clipping threshold is set to 1.

[0088] S3: The processed frequency change and frequency change rate are used as the input data of the model, and the processed inertia time constant is used as the output data of the model. The carnivorous plant algorithm is used to iteratively optimize and obtain the optimal parameter configuration of the long short-term memory network model. The model is trained, tested and verified to obtain the estimated value of the inertia time constant of the power system. The specific process is as follows:

[0089] S3-1: Select the frequency change amount and frequency change rate processed in step S1-3 as the input features of the model, and the processed inertia time constant as the output feature of the model;

[0090] S3-2: Determine the objective function of the carnivorous plant algorithm, with the goal of minimizing the mean square error between the estimated value and the true value of the inertia time constant of the power system, and obtain the optimal hyperparameter combination of the model, which can be expressed as:

[0091]

[0092] In formula (20), Min is the minimum function, is the mean square error vector between the estimated value and the true value of the inertia time constant, H e is the true value of the e-th inertia time constant, is the estimated value of the e-th inertial time constant of the model under the configuration of the a-th set of hyperparameter combinations, is the vector of the a-th group of hyperparameter combinations, x a1 ,x a2 ,x a3 ,x a4 is the number of hidden layer units to be optimized in the a-th group of hyperparameter combinations, x a5 is the learning rate to be optimized in the a-th group of hyperparameter combinations;

[0093] S3-3: Determine the constraint function of the carnivorous plant algorithm, define the parameter range of the number of hidden layer units and the learning rate, prevent the model from being too simple, resulting in low estimation accuracy of the inertial time constant, and avoid too slow convergence speed of learning frequency data and inertial time constant data, which can be expressed as:

[0094]

[0095] S3-4: The carnivorous plant algorithm is used to optimize the number of hidden layer units and learning rate of the long short-term memory network model. A population of carnivorous plants and prey is randomly initialized to form multiple sets of hyperparameter combinations for estimating the inertial time constant of the model, which can be expressed as:

[0096]

[0097] In formula (22), P is the population matrix, which represents the matrix composed of all hyperparameter combinations of the model, x ab is the carnivorous plant or prey individual, representing the specific hyperparameter value, a is the number of individuals, representing the number of hyperparameter combinations, and b is the dimension, representing the number of hyperparameters to be optimized;

[0098] S3-5: According to the constraints in step S3-3, each carnivorous plant and prey individual is randomly initialized to generate an initial hyperparameter combination, which can be expressed as:

[0099] x ab =Low b +(High b -Low b )×rand (23)

[0100] In formula (23), Low b The lower bound of the parameter range predefined for the bth hyperparameter, High b is the upper bound of the parameter range predefined for the bth hyperparameter, and rand is a randomly selected value between 0 and 1;

[0101] S3-6: Use different hyperparameter combinations to construct a long short-term memory network model, obtain the estimated value of the inertial time constant, calculate the mean square error between it and the true value, use it as the fitness function of the individual and sort them from small to large, select the i individuals with the lowest mean square error as carnivorous plants, and the remaining j individuals as prey, which can be expressed as:

[0102]

[0103] In formula (24), is the individual mean square error vector, E cp(i) is the mean square error of the carnivorous plant ranked i, E prey(j) is the mean square error of the j-ranked prey, i is the number of carnivorous plants, j is the number of prey, and i <j;

[0104] S3-7: According to the sorting result in step S3-6, the population matrix in step S3-4 is sorted in ascending order. The higher the ranking, the closer the hyperparameter combination is to the optimal solution, which can be expressed as:

[0105]

[0106] In formula (25), S_P is the sorted population matrix, CP ib is the hyperparameter value of the carnivorous plant ranked i in column b, Prey jb is the hyperparameter value of the j-ranked prey in column b, It is the i-ranked carnivorous plant. is the prey ranked j;

[0107] S3-8: Carnivorous plants and prey are grouped according to a certain rule. The first-ranked prey is assigned to the first-ranked carnivorous plant, the second-ranked prey is assigned to the second-ranked carnivorous plant, and so on, until the i-ranked prey is assigned to the i-ranked carnivorous plant, and then the i+1-ranked prey is assigned to the first-ranked carnivorous plant. Repeat the cycle to complete the grouping of carnivorous plants and prey, and each group contains 1 carnivorous plant and no less than 2 prey, which can be expressed as:

[0108]

[0109] In formula (26), SS_P is the grouping matrix of carnivorous plants and prey, each row is the same group, and k is an integer;

[0110] S3-9: In the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will randomly select prey from the same group in the grouping matrix SS_P, capture and digest the prey to promote their own growth, forming a new model hyperparameter value, which can be expressed as:

[0111] NewCP ib =g cp ×CP ib +(1-g cp )×Prey cb (27)

[0112] In formula (27), NewCP ib is the hyperparameter value of the newly generated carnivorous plant, Prey cb is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g cp For CP ib The growth rate is expressed as:

[0113] g cp =g×rand (28)

[0114] In formula (28), g is the predefined growth rate;

[0115] S3-10: If the attraction rate is less than the random number, the prey escapes and continues to grow, which can be expressed as:

[0116] NewPrey ib =g p ×Prey cb +(1-g p )×Prey db c≠d (29)

[0117] In formula (29), NewPrey ib The new prey hyperparameter value for the prey to escape and continue to grow, Prey db is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g p is the growth rate of the prey, which is expressed as:

[0118]

[0119] In formula (30), E prey(c) is the mean square error of the prey ranked c, E prey(d) is the mean square error of the prey ranked d;

[0120] S3-11: In the reproduction stage, only the carnivorous plants with the smallest mean square error are allowed to reproduce, and a new generation of carnivorous plants is generated by concentrating resources. The hyperparameter value can be expressed as:

[0121] NewCP ib =CP 1b +r×rand×m ib (31)

[0122] In formula (31), CP 1b is the hyperparameter value of the carnivorous plant ranked first in column b, r is the predefined reproduction rate, m ib is the hyperparameter value of the breeding partner, and its expression is:

[0123]

[0124] In formula (32), CP ib , CP cb is the hyperparameter value corresponding to the randomly selected carnivorous plant in column b, E cp(c) is the mean square error of the carnivorous plant ranked c;

[0125] S3-12: Combine the newly generated carnivorous plants and prey with the original population, calculate their mean square error and re-sort them in ascending order, retain the hyperparameter combination with the smallest mean square error in group a according to the elite selection strategy, and repeat the above steps for grouping, growth, reproduction, etc. until the maximum number of iterations is met, generate the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and select the optimal individual as the model hyperparameter configuration;

[0126] S3-13: Select the optimal hyperparameter combination obtained by iterative optimization of the carnivorous plant algorithm to configure the long short-term memory network model, train the model using the pre-processed training set, and test the model to obtain the estimated value of the inertia time constant of the power system.

[0127] Figure 2 and Figure 3 The figure shows the comparison between the estimated inertia value of the training set and the true value, and the relative error diagram of the inertia estimation of the training set. It can be seen from the figure that the estimated value of the inertia time constant of the power system obtained by the optimized model basically coincides with the true value curve in the training set, indicating that the optimized model can highly fit the training data. Specifically, the relative error in the training set is basically lower than 0.015%, and the maximum relative error does not exceed 0.045%. This shows that the optimized model has high fitting accuracy in the training set and can effectively learn the characteristics of frequency data and inertia data.

[0128] Figure 4 and Figure 5 Shown are the comparison diagram of the estimated inertia value and the true value of the test set and the relative error diagram of the inertia estimation of the test set. It can be seen from the figure that the optimized model performs well in the estimation of the inertia time constant of the power system. The estimated value and the true value curve in the test set are basically consistent, with high estimation accuracy. Specifically, the relative error on the test set is basically maintained within 0.03%, and the maximum relative error does not exceed 0.07%, which indicates that the optimized model has high robustness and accuracy when processing unknown data.

[0129] Figure 6 and Figure 7 Shown are the comparison diagram of the validation set inertia estimation value and the true value and the validation set inertia estimation relative error diagram. It can be seen from the figure that the estimated value of the inertia time constant of the power system by the optimized model in the validation set is almost consistent with the true value, indicating the stability of the optimized model on multiple data sets. Specifically, the relative error on the validation set is basically maintained within 0.015%, and the maximum relative error does not exceed 0.025%, which shows that the optimized model can effectively adapt to different data distributions and has good generalization ability.

[0130] The embodiments described above are only preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. Therefore, all changes made according to the shape and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for estimating the inertia time constant of a power system based on an improved long short-term memory network model, characterized in that: The following steps are involved: S1: Arrange the frequency change, frequency change rate and inertia time constant of the power system to generate an array, randomly sort and divide the data set, and perform normalization processing; S2: Define the long short-term memory network model structure and build a long short-term memory network model; S3: The processed frequency change and frequency change rate are used as the input data of the model, and the processed inertia time constant is used as the output data of the model. The carnivorous plant algorithm is used to iteratively optimize and obtain the optimal parameter configuration of the long short-term memory network model. The model is then trained, tested and verified to obtain the estimated value of the inertia time constant of the power system.

2. The method for estimating the inertia time constant of a power system based on an improved long short-term memory network model according to claim 1, characterized in that: The step S1 comprises: S1-1: Obtain the time series data of the frequency change and frequency change rate of the power system and the true value of the inertia time constant at the corresponding time point, merge the corresponding time series data of the frequency change and frequency change rate with the inertia time constant, and form input data in the format of a two-dimensional array, which can be expressed as: In formula (1), X is an array consisting of frequency change, frequency change rate and inertia time constant, Δf mn is the frequency change, is the frequency change rate, H m is the inertia time constant, m is the number of data sets, and n is the time step; S1-2: Randomly sort the time series data and divide them into training set, test set and validation set. The training set is used to train the model, the test set is used to evaluate the effect of the model, and the validation set is used to evaluate the generalization ability of the model. S1-3: Use linear normalization method to adjust the data set to [0,1], and its expression is: In formula (2), X' is the normalized data, X max is the maximum value in the original data, X min is the minimum value in the original data.

3. The method for estimating the inertia time constant of a power system based on an improved long short-term memory network model according to claim 2 is characterized in that: The step S2 comprises: S2-1: Define the LSTM network model: input layer, LSTM network units, 4 hidden layers and output layer. The number of units in the hidden layer is the hyperparameter to be optimized, and its parameter range is [10,300]. At the same time, regularization and batch normalization techniques are added to the network to prevent overfitting. S2-2: Build a long short-term memory network model, which can be expressed as: In formula (3), t is the current time step, t-1 is the previous time step, t+1 is the next time step, γ t is the forgetting unit of the current time step t, σ is the Sigmoid activation function, W γ is the weight matrix of the forgetting unit γ, [ε t-1 ,x t ] is the output ε of the previous time step t-1 t-1 and the input x at the current time step t t The vector composed of γ is the bias term of the forgetting unit γ, δ t is the input unit of the current time step t, W δ is the weight matrix of the input unit δ, β δ is the bias term of the input unit δ, υ t is the long-term memory information of the current time step t, tanh is the hyperbolic tangent function, W υ is the weight matrix of long-term memory information υ, β υ is the bias term of long-term memory information υ, λ t is the output unit λ of the current time step t, W λ is the weight matrix of the output unit λ, β λ is the bias term of the output unit λ, υ t-1 is the long-term memory information of the previous time step t-1, ε t is the hidden layer output at the current time step t, θ t+1 is the parameter value for the next time step t+1, θ t is the parameter value of the current time step t, η is the predefined learning rate, is the gradient second-order moment estimate of the current time step t, To prevent division by zero for small constants, is the first-order moment momentum of the gradient at the current time step t, G t is the sample number gradient estimate of the current time step t, B is the predefined sample number, is the loss function of the lth training sample, o l is the input of the lth sample, p l is the output of the lth sample, is the gradient of the next time step t+1, is the gradient of the current time step t, T is the predefined gradient clipping threshold, is the gradient norm of the current time step t; S2-3: Select Adam optimizer as the optimization method for the model. The learning rate is a key hyperparameter for model optimization. Its parameter range is [0.001, 0.01]. The maximum number of training times is set to 100. The number of samples contained in each mini-batch during mini-batch training is set to 128, and the gradient clipping threshold is set to 1.

4. The method for estimating the inertia time constant of a power system based on an improved long short-term memory network model according to claim 3 is characterized in that: The step S3 comprises: S3-1: Select the frequency change amount and frequency change rate processed in step S1-3 as the input features of the model, and the processed inertia time constant as the output feature of the model; S3-2: Determine the objective function of the carnivorous plant algorithm, with the goal of minimizing the mean square error between the estimated value and the true value of the inertia time constant of the power system, and obtain the optimal hyperparameter combination of the model, which can be expressed as: In formula (4), Min is the minimum value function, is the mean square error vector between the estimated value and the true value of the inertia time constant, H e is the true value of the e-th inertia time constant, is the estimated value of the e-th inertial time constant of the model under the configuration of the a-th set of hyperparameter combinations, is the vector of the a-th group of hyperparameter combinations, x a1 ,x a2 ,x a3 ,x a4 is the number of hidden layer units to be optimized in the a-th group of hyperparameter combinations, x a5 is the learning rate to be optimized in the a-th group of hyperparameter combinations; S3-3: Determine the constraint function of the carnivorous plant algorithm, define the parameter range of the number of hidden layer units and the learning rate, prevent the model from being too simple, resulting in low estimation accuracy of the inertial time constant, and avoid too slow convergence speed of learning frequency data and inertial time constant data, which can be expressed as: S3-4: The carnivorous plant algorithm is used to optimize the number of hidden layer units and learning rate of the long short-term memory network model. A population of carnivorous plants and prey is randomly initialized to form multiple sets of hyperparameter combinations for estimating the inertial time constant of the model, which can be expressed as: In formula (6), P is the population matrix, which represents the matrix composed of all hyperparameter combinations of the model, x ab is the carnivorous plant or prey individual, representing the specific hyperparameter value, a is the number of individuals, representing the number of hyperparameter combinations, and b is the dimension, representing the number of hyperparameters to be optimized; S3-5: According to the constraints in step S3-3, each carnivorous plant and prey individual is randomly initialized to generate an initial hyperparameter combination, which can be expressed as: x ab =Low b +(High b -Low b )×rand(7) In formula (7), Low b The lower bound of the parameter range predefined for the bth hyperparameter, High b is the upper bound of the parameter range predefined for the bth hyperparameter, and rand is a randomly selected value between 0 and 1; S3-6: Use different hyperparameter combinations to construct a long short-term memory network model, obtain the estimated value of the inertial time constant, calculate the mean square error between it and the true value, use it as the fitness function of the individual and sort them from small to large, select the i individuals with the lowest mean square error as carnivorous plants, and the remaining j individuals as prey, which can be expressed as: In formula (8), is the individual mean square error vector, E cp(i) is the mean square error of the carnivorous plant ranked i, E prey(j) is the mean square error of the j-ranked prey, i is the number of carnivorous plants, j is the number of prey, and i <j; S3-7: According to the sorting result in step S3-6, the population matrix in step S3-4 is sorted in ascending order. The higher the ranking, the closer the hyperparameter combination is to the optimal solution, which can be expressed as: In formula (9), S_P is the sorted population matrix, CP ib is the hyperparameter value of the carnivorous plant ranked i in column b, Prey jb is the hyperparameter value of the j-ranked prey in column b, It is the i-ranked carnivorous plant. is the prey ranked j; S3-8: Carnivorous plants and prey are grouped according to a certain rule. The first-ranked prey is assigned to the first-ranked carnivorous plant, the second-ranked prey is assigned to the second-ranked carnivorous plant, and so on, until the i-ranked prey is assigned to the i-ranked carnivorous plant, and then the i+1-ranked prey is assigned to the first-ranked carnivorous plant. Repeat the cycle to complete the grouping of carnivorous plants and prey, and each group contains 1 carnivorous plant and no less than 2 prey, which can be expressed as: In formula (10), SS_P is the grouping matrix of carnivorous plants and prey, each row is the same group, and k is an integer; S3-9: In the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will randomly select prey from the same group in the grouping matrix SS_P, capture and digest the prey to promote their own growth, forming a new model hyperparameter value, which can be expressed as: NewCP ib =g cp ×CP ib +(1-g cp )×Prey cb (11) In formula (11), NewCP ib is the hyperparameter value of the newly generated carnivorous plant, Prey cb is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g cp For CP ib The growth rate is expressed as: g cp =g×rand(12) In formula (12), g is the predefined growth rate; S3-10: If the attraction rate is less than the random number, the prey escapes and continues to grow, which can be expressed as: NewPrey ib =g p ×Prey cb +(1-g p )×Prey db c≠d(13) In formula (13), NewPrey ib The new prey hyperparameter value for the prey to escape and continue to grow, Prey db is the hyperparameter value corresponding to the randomly selected prey in the same group in the grouping matrix SS_P in column b, g p is the growth rate of the prey, which is expressed as: In formula (14), E prey(c) is the mean square error of the prey ranked c, E prey(d) is the mean square error of the prey ranked d; S3-11: In the reproduction stage, only the carnivorous plants with the smallest mean square error are allowed to reproduce, and a new generation of carnivorous plants is generated by concentrating resources. The hyperparameter value can be expressed as: NewCP ib =CP 1b +r×rand×m ib (15) In formula (15), CP 1b is the hyperparameter value of the carnivorous plant ranked first in column b, r is the predefined reproduction rate, m ib is the hyperparameter value of the breeding partner, and its expression is: In formula (16), CP ib , CP cb is the hyperparameter value corresponding to the randomly selected carnivorous plant in column b, E cp(c) is the mean square error of the carnivorous plant ranked c; S3-12: Combine the newly generated carnivorous plants and prey with the original population, calculate their mean square error and re-sort them in ascending order, retain the hyperparameter combination with the smallest mean square error in group a according to the elite selection strategy, and repeat the above steps for grouping, growth, reproduction, etc. until the maximum number of iterations is met, generate the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and select the optimal individual as the model hyperparameter configuration; S3-13: Select the optimal hyperparameter combination obtained by iterative optimization of the carnivorous plant algorithm to configure the long short-term memory network model, train the model using the pre-processed training set, and test the model to obtain the estimated value of the inertia time constant of the power system.

Citation Information

Patent Citations

  • Day-ahead economic dispatching method for micro-grid

    CN114285028A

  • Power system inertia evaluation method, device and equipment based on gradual difference method and medium

    CN119154388A