A Method for Estimating the Inertial Time Constant of Power Systems Based on an Improved Long Short-Term Memory Network Model

By combining an improved long short-term memory network model with a carnivorous plant algorithm, the problems of accuracy and speed in inertial time constant estimation in traditional methods are solved, achieving high-precision estimation and fast convergence of the inertial time constant of power systems.

CN119885890BActive Publication Date: 2025-11-14GUANGDONG UNIV OF TECH
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Traditional methods for estimating inertial time constants are difficult to achieve high accuracy when faced with external noise, system nonlinearity, and parameter variations. Long short-term memory network models are prone to getting stuck in local optima during training and have slow convergence speed, which affects the frequency regulation capability of power systems.

Method used

An improved Long Short-Term Memory (LSTM) network model was adopted. By randomly sorting and normalizing the frequency change and frequency change rate of the power system, an LSM network model was constructed. The Carnivorous Plant Algorithm was used to iteratively optimize the model hyperparameters and obtain the estimated value of the power system inertial time constant.

Benefits of technology

It enables the rapid finding of the global optimal solution in a vast hyperparameter space, improves the estimation accuracy and speed of the inertial time constant, and enhances the frequency regulation capability of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885890B_ABST
    Figure CN119885890B_ABST
Patent Text Reader

Abstract

This invention discloses a method for estimating the inertial time constant of a power system based on an improved long short-term memory (LSTM) network model, comprising the following steps: S1: arranging the power system frequency change, frequency change rate, and inertial time constant into an array, randomly sorting and dividing the dataset, and normalizing it; S2: defining the LSM network model structure and building the LSM network model; S3: using the processed frequency change and frequency change rate as the model input data, and the processed inertial time constant as the model output data, using the carnivorous plant algorithm for iterative optimization to obtain the optimal parameter configuration of the LSM network model, and training, testing, and validating the model to obtain the estimated value of the power system inertial time constant; this invention utilizes the advantages of the carnivorous plant algorithm—high optimization accuracy and fast convergence speed—to quickly obtain the global optimal solution of hyperparameters, achieving accurate estimation of the inertial time constant.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system inertial time constant estimation, and in particular to a method for estimating power system inertial time constant based on an improved long short-term memory network model. Background Technology

[0002] With the increasing proportion of renewable energy in power systems, synchronous machines are gradually being replaced, leading to a decrease in the system's inertial time constant. This weakens the system's frequency regulation capability and poses a serious challenge to system stability. Traditional inertial time constant estimation methods are usually based on classical control theory, such as model identification and Kalman filtering. However, these methods are often affected by external noise, system nonlinearity, and parameter variations, making it difficult to meet the high accuracy requirements of engineering applications. In recent years, deep learning-based artificial intelligence technology, especially long short-term memory (LSTM) network models, can effectively capture long-term dependencies in time series through their unique gating mechanisms. However, LSTM network models are prone to getting stuck in local optima and have slow convergence speeds during training, affecting their performance in estimating the power system's inertial time constant. Therefore, this invention proposes a power system inertial time constant estimation method based on an improved LSTM network model. Summary of the Invention

[0003] To achieve the above objectives, the technical solution provided by this invention is as follows:

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

[0005] S1: Arrange the frequency change, frequency change rate, and inertial time constant of the power system into an array, randomly sort and divide the dataset, and perform normalization.

[0006] S2: Define the structure of the long short-term memory network model and build the 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 inertial 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 inertial time constant of the power system.

[0008] Further, in step S1, the frequency change, frequency change rate, and inertial time constant of the power system are arranged to generate an array, randomly sorted and divided into datasets, and then normalized. The specific steps are as follows:

[0009] S1-1: Obtain the time series data of the frequency change and the rate of frequency change of the power system, and the true value of the inertial time constant at the corresponding time points. Merge the time series data of the corresponding frequency change and the rate of frequency change with the inertial time constant to form input data in the format of a two-dimensional array, which can be represented as:

[0010] (1)

[0011] In equation (1), X It is an array consisting of frequency change, rate of frequency change, and inertial time constant. The change in frequency The rate of change of frequency, H m The inertial time constant, m The number of data sets, n For time steps;

[0012] S1-2: Randomly sort the time series data and divide it 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 model's performance, and the validation set is used to evaluate the model's generalization ability.

[0013] S1-3: The dataset is adjusted to the range [0,1] using linear normalization. The expression is as follows:

[0014] (2)

[0015] In equation (2), For the normalized data, The maximum value in the original data. It is the minimum value in the original data;

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

[0017] S2-1: Define the Long Short-Term Memory Network Model: Input layer, Long Short-Term Memory Network Units, 4 hidden layers and output layer, where 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: Constructing a Long Short-Term Memory (LSTM) network model can be represented as:

[0019] (3)

[0020] In equation (3), t For the current time step, t -1 represents the previous time step.t+ 1 represents the next time step. For the current time step t The forgetting unit, It is the Sigmoid activation function. Forgetting Unit The weight matrix, For the previous time step t- Output of 1 and current time step t Input The vector formed Forgetting Unit The bias term, For the current time step t The input unit, For input unit The weight matrix, For input unit The bias term, For the current time step t Long-term memory information, tanh It is the hyperbolic tangent function. For long-term memory information The weight matrix, For long-term memory information The bias term, For the current time step t Output unit , For output unit The weight matrix, For output unit The bias term, For the previous time step t -1 is long-term memory information. For the current time step t The hidden layer output, For the next time step t +1 parameter value, For the current time step t The parameter value, For a predefined learning rate, For the current time step t Gradient second moment estimation, To prevent small constants from being divided by zero, For the current time step t The gradient of the first moment momentum, For the current time step t Gradient estimation of sample number, For a predefined number of samples, For the first lThe loss function for each training sample. For the first l Input of each sample, For the first l The output of each sample For the next time step t The gradient of +1, For the current time step t gradient, For a predefined gradient clipping threshold, For the current time step t The gradient norm;

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

[0022] Further, in step S3, the processed frequency change and frequency change rate are used as input data for the model, and the processed inertial time constant is used as output data. The carnivorous plant algorithm is used for iterative optimization to obtain the optimal parameter configuration of the long short-term memory network model. The model is then trained, tested, and validated to obtain the estimated value of the power system inertial time constant. The specific steps are as follows:

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

[0024] S3-2: Determine the objective function of the carnivorous plant algorithm, aiming to minimize the mean square error between the estimated and true values ​​of the power system's inertial time constant. Obtain the optimal combination of hyperparameters for the model, which can be expressed as:

[0025] (4)

[0026] In equation (4), It is a minimum value function. Let be the mean square error vector between the estimated and true values ​​of the inertial time constant. For the first e The true value of the inertial time constant. For the model in configuration number a Group of hyperparameter combinations e An estimated value of the inertial time constant. For the first a A vector of hyperparameter combinations. For the first aThe number of hidden layer units to be optimized in the set of hyperparameter combinations. For the first a The learning rate to be optimized in a set of hyperparameter combinations;

[0027] S3-3: Determine the constraint functions for the carnivorous plant algorithm, define the parameter ranges for the number of hidden layer units and the learning rate, prevent the model from being too simple leading to low accuracy in inertial time constant estimation, and avoid excessively slow convergence speed when learning from frequency data and inertial time constant data. This can be expressed as:

[0028] (5)

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

[0030] (6)

[0031] In equation (6), P The population matrix represents the matrix composed of all hyperparameter combinations of the model. For individual carnivorous plants or prey, these represent specific hyperparameter values. a The number of individuals represents the number of hyperparameter combinations. b The dimension represents the number of hyperparameters to be optimized.

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

[0033] (7)

[0034] In equation (7), For the first b The lower bound of the parameter range is predefined for each hyperparameter. For the first b Each hyperparameter has a predefined upper bound on its parameter range. rand The value is randomly selected between 0 and 1;

[0035] S3-6: Construct a Long Short-Term Memory (LSTM) network model using different hyperparameter combinations, obtain an estimate of the inertial time constant, calculate its mean square error (MSE) compared to the true value, use it as the fitness function for each individual, sort them from smallest to largest, and select the model with the lowest MSE. i Each individual is a carnivorous plant, the rest... j Each individual being prey can be represented as:

[0036] (8)

[0037] In equation (8), Let be the individual mean square error vector. Ranked i Mean square error of carnivorous plants Ranked j The mean square error of the prey, i The number of carnivorous plants. j The number of prey, and i < j ;

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

[0039] (9)

[0040] In equation (9), S_P The sorted population matrix is ​​as follows: Ranked i Carnivorous plants in the first b The hyperparameter values ​​of the column, Ranked j The prey in the b The hyperparameter values ​​of the column, Ranked i Carnivorous plants, Ranked j The prey;

[0041] S3-8: Group carnivorous plants and prey according to a certain pattern. The prey ranked first is assigned to the carnivorous plant ranked first, the prey ranked second is assigned to the carnivorous plant ranked second, and so on, until the prey ranked third... i The prey was distributed to the ranked i Carnivorous plants, then ranked i The prey with +1 is assigned to the top-ranked carnivorous plant, and this process is repeated to group carnivorous plants and prey, with each group containing 1 carnivorous plant and at least 2 prey. This can be represented as:

[0042] (10)

[0043] In equation (10), SS_P A grouping matrix for carnivorous plants and prey, with each row belonging to the same group. k It is an integer;

[0044] S3-9: During the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will leave the group matrix. SS_PWithin the same group, prey is randomly selected, captured, and digested to promote its own growth, forming new model hyperparameter values, which can be represented as:

[0045] (11)

[0046] In equation (11), These are the hyperparameter values ​​for the newly generated carnivorous plants. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, for The growth rate is expressed as:

[0047] (12)

[0048] In equation (12), g A 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] (13)

[0051] In equation (13), Hyperparameter values ​​for new prey that allow prey to escape and continue to grow. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, The growth rate of prey is expressed as:

[0052] (14)

[0053] In equation (14), Ranked c The mean square error of the prey, Ranked d The mean square error of the prey;

[0054] S3-11: During the propagation stage, only carnivorous plants with the smallest mean square error are allowed to reproduce. By concentrating resources to generate a new generation of carnivorous plants, the hyperparameter values ​​can be expressed as:

[0055] (15)

[0056] In equation (15), The number one carnivorous plant in the world b The hyperparameter values ​​of the column, r For a predefined reproduction rate, The expression for the mate hyperparameter value for reproduction is:

[0057] (16)

[0058] In equation (16), , For randomly selected carnivorous plants in the first b The hyperparameter values ​​corresponding to the column, Ranked c The mean square error of carnivorous plants;

[0059] S3-12: Combine the newly generated carnivorous plants and prey with the existing population, calculate their mean squared error, and re-sort them in ascending order. Retain them according to the elite selection strategy. a The hyperparameter combination with the smallest mean square error is selected, and the above steps are repeated for grouping, growth, reproduction, combination sorting and elite selection until the maximum number of iterations is met, generating the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and selecting the best individual as the model hyperparameter configuration.

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

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

[0062] This invention discloses a method for estimating the inertial time constant of a power system based on an improved long short-term memory (LSTM) network model. First, the power system frequency change, frequency change rate, and inertial time constant are arranged into an array, randomly sorted, and the dataset is divided and normalized. Then, the LTM network model structure is defined and constructed. Finally, the processed frequency change and frequency change rate are used as input data, and the processed inertial time constant is used as output data. The Carnivorous Plant Algorithm is used iteratively to find the optimal parameter configuration of the LTM network model. The model is then trained, tested, and validated to obtain an estimated value for the power system inertial time constant.

[0063] This invention leverages the advantages of carnivorous plant algorithms, such as high optimization accuracy and fast convergence speed, to perform a global search in a vast hyperparameter space. This effectively avoids the local optimum problem in hyperparameter setting of long short-term memory network models. Through its unique predation mechanism and population update method, it accelerates the hyperparameter optimization process, thereby quickly obtaining the global optimum of the model's hyperparameters and achieving accurate estimation of the inertial time constant. Attached Figure Description

[0064] Figure 1 This is a flowchart illustrating the estimation of the inertial time constant of a power system in an embodiment of the present invention.

[0065] Figure 2 This is a comparison chart of the estimated and true values ​​of the inertia of the training set in an embodiment of the present invention.

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

[0067] Figure 4 This is a comparison chart of the estimated and actual values ​​of the test set inertia in an embodiment of the present invention;

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

[0069] Figure 6 This is a comparison chart of the estimated and actual values ​​of the verification set inertia in an embodiment of the present invention;

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

[0071] The present invention will be further described below with reference to specific embodiments:

[0072] Figure 1 The diagram shows the flowchart for estimating the inertial time constant of a power system. The power system inertial time constant estimation method based on an improved long short-term memory network model described in this embodiment includes the following steps:

[0073] S1: Arrange the power system frequency variation, frequency variation rate, and inertial time constant into an array, randomly sort and divide the dataset, and then normalize it. The specific process is as follows:

[0074] S1-1: Obtain the time series data of the frequency change and the rate of frequency change of the power system, and the true value of the inertial time constant at the corresponding time points. Merge the time series data of the corresponding frequency change and the rate of frequency change with the inertial time constant to form input data in the format of a two-dimensional array, which can be represented as:

[0075] (17)

[0076] In equation (17), X It is an array consisting of frequency change, rate of frequency change, and inertial time constant. The change in frequency The rate of change of frequency, H m The inertial time constant, mThe number of data sets, n For time steps;

[0077] S1-2: Randomly sort the time series data and divide it 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 model's performance, and the validation set is used to evaluate the model's generalization ability.

[0078] S1-3: The dataset is adjusted to the range [0,1] using linear normalization. The expression is as follows:

[0079] (18)

[0080] In equation (18), For the normalized data, The maximum value in the original data. It is the minimum value in the original data;

[0081] S2: Define the structure of the Long Short-Term Memory (LSTM) network model and build the LTM network model. The specific process is as follows:

[0082] S2-1: Define the Long Short-Term Memory Network Model: Input layer, Long Short-Term Memory Network Units, 4 hidden layers and output layer, where 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.

[0083] S2-2: Constructing a Long Short-Term Memory (LSTM) network model can be represented as:

[0084] (19)

[0085] In equation (19), t For the current time step, t -1 represents the previous time step. t+ 1 represents the next time step. For the current time step t The forgetting unit, It is the Sigmoid activation function. Forgetting Unit The weight matrix, For the previous time step t- Output of 1 and current time step t Input The vector formed Forgetting Unit The bias term, For the current time step t The input unit, For input unit The weight matrix, For input unit The bias term, For the current time step t Long-term memory information, tanh It is the hyperbolic tangent function. For long-term memory information The weight matrix, For long-term memory information The bias term, For the current time step t Output unit , For output unit The weight matrix, For output unit The bias term, For the previous time step t -1 is long-term memory information. For the current time step t The hidden layer output, For the next time step t +1 parameter value, For the current time step t The parameter value, For a predefined learning rate, For the current time step t Gradient second moment estimation, To prevent small constants from being divided by zero, For the current time step t The gradient of the first moment momentum, For the current time step t Gradient estimation of sample number, For a predefined number of samples, For the first l The loss function for each training sample. For the first l Input of each sample, For the first l The output of each sample For the next time step t The gradient of +1, For the current time step t gradient, For a predefined gradient clipping threshold, For the current time step t The gradient norm;

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

[0087] S3: Using the processed frequency change and frequency change rate as input data to the model, and the processed inertial time constant as output data, the carnivorous plant algorithm is used for iterative optimization to obtain the optimal parameter configuration of the Long Short-Term Memory network model. The model is then trained, tested, and validated to obtain an estimate of the power system's inertial time constant. The specific process is as follows:

[0088] S3-1: Select the frequency change and frequency change rate after processing in step S1-3 as the input features of the model, and the processed inertial time constant as the output feature of the model.

[0089] S3-2: Determine the objective function of the carnivorous plant algorithm, aiming to minimize the mean square error between the estimated and true values ​​of the power system's inertial time constant. Obtain the optimal combination of hyperparameters for the model, which can be expressed as:

[0090] (20)

[0091] In equation (20), It is a minimum value function. Let be the mean square error vector between the estimated and true values ​​of the inertial time constant. For the first e The true value of the inertial time constant. For the model in configuration number a Group of hyperparameter combinations e An estimated value of the inertial time constant. For the first a A vector of hyperparameter combinations. For the first a The number of hidden layer units to be optimized in the set of hyperparameter combinations. For the first a The learning rate to be optimized in a set of hyperparameter combinations;

[0092] S3-3: Determine the constraint functions for the carnivorous plant algorithm, define the parameter ranges for the number of hidden layer units and the learning rate, prevent the model from being too simple leading to low accuracy in inertial time constant estimation, and avoid excessively slow convergence speed when learning from frequency data and inertial time constant data. This can be expressed as:

[0093] (twenty one)

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

[0095] (twenty two)

[0096] In equation (22), P The population matrix represents the matrix composed of all hyperparameter combinations of the model. For individual carnivorous plants or prey, these represent specific hyperparameter values. a The number of individuals represents the number of hyperparameter combinations. b The dimension represents the number of hyperparameters to be optimized.

[0097] S3-5: Based on the constraints in step S3-3, randomly initialize each carnivorous plant and prey individual to generate an initial hyperparameter combination, which can be expressed as:

[0098] (twenty three)

[0099] In equation (23), For the first b The lower bound of the parameter range is predefined for each hyperparameter. For the first b Each hyperparameter has a predefined upper bound on its parameter range. rand The value is randomly selected between 0 and 1;

[0100] S3-6: Construct a Long Short-Term Memory (LSTM) network model using different hyperparameter combinations, obtain an estimate of the inertial time constant, calculate its mean square error (MSE) compared to the true value, use it as the fitness function for each individual, sort them from smallest to largest, and select the model with the lowest MSE. i Each individual is a carnivorous plant, the rest... j Each individual being prey can be represented as:

[0101] (twenty four)

[0102] In equation (24), Let be the individual mean square error vector. Ranked i Mean square error of carnivorous plants Ranked j The mean square error of the prey, i The number of carnivorous plants. j The number of prey, and i < j ;

[0103] S3-7: Based on the sorting results in step S3-6, sort the population matrix in step S3-4 in ascending order. The higher the ranking, the closer the hyperparameter combination is to the optimal solution, which can be expressed as:

[0104] (25)

[0105] In equation (25), S_P The sorted population matrix is ​​as follows: Ranked i Carnivorous plants in the first b The hyperparameter values ​​of the column, Ranked j The prey in the b The hyperparameter values ​​of the column, Ranked i Carnivorous plants, Ranked j The prey;

[0106] S3-8: Group carnivorous plants and prey according to a certain pattern. The prey ranked first is assigned to the carnivorous plant ranked first, the prey ranked second is assigned to the carnivorous plant ranked second, and so on, until the prey ranked third... i The prey was distributed to the ranked i Carnivorous plants, then ranked i The prey with +1 is assigned to the top-ranked carnivorous plant, and this process is repeated to group carnivorous plants and prey, with each group containing 1 carnivorous plant and at least 2 prey. This can be represented as:

[0107] (26)

[0108] In equation (26), SS_P A grouping matrix for carnivorous plants and prey, with each row belonging to the same group. k It is an integer;

[0109] S3-9: During the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will leave the group matrix. SS_P Within the same group, prey is randomly selected, captured, and digested to promote its own growth, forming new model hyperparameter values, which can be represented as:

[0110] (27)

[0111] In equation (27), These are the hyperparameter values ​​for the newly generated carnivorous plants. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, for The growth rate is expressed as:

[0112] (28)

[0113] In equation (28), g A predefined growth rate;

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

[0115] (29)

[0116] In equation (29), Hyperparameter values ​​for new prey that allow prey to escape and continue to grow. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, The growth rate of prey is expressed as:

[0117] (30)

[0118] In equation (30), Ranked c The mean square error of the prey, Ranked d The mean square error of the prey;

[0119] S3-11: During the propagation stage, only carnivorous plants with the smallest mean square error are allowed to reproduce. By concentrating resources to generate a new generation of carnivorous plants, the hyperparameter values ​​can be expressed as:

[0120] (31)

[0121] In equation (31), The number one carnivorous plant in the world b The hyperparameter values ​​of the column, r For a predefined reproduction rate, The expression for the mate hyperparameter value for reproduction is:

[0122] (32)

[0123] In equation (32), , For randomly selected carnivorous plants in the first b The hyperparameter values ​​corresponding to the column, Ranked c The mean square error of carnivorous plants;

[0124] S3-12: Combine the newly generated carnivorous plants and prey with the existing population, calculate their mean squared error, and re-sort them in ascending order. Retain them according to the elite selection strategy. a The hyperparameter combination with the smallest mean square error is selected, and the above steps are repeated for grouping, growth, reproduction, combination sorting and elite selection until the maximum number of iterations is met, generating the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and selecting the best individual as the model hyperparameter configuration.

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

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

[0127] Figure 4 and Figure 5 The figure shows a comparison between the estimated and actual values ​​of the inertia in the test set, and a relative error graph of the inertia estimation in the test set. As can be seen from the figure, the optimized model performs well in estimating the inertial time constant of the power system. Its estimated value and the actual value curve in the test set are basically consistent, and it has high estimation accuracy. Specifically, the relative error in the test set is basically kept within 0.03%, and the maximum relative error does not exceed 0.07%. This shows that the optimized model has high robustness and accuracy when dealing with unknown data.

[0128] Figure 6 and Figure 7 The figure shows a comparison between the estimated and actual values ​​of the inertia on the validation set, and a relative error of the inertia estimation on the validation set. As can be seen from the figure, the estimated value of the inertia time constant of the power system by the optimized model is almost consistent with the actual value on the validation set, indicating the stability of the optimized model on multiple datasets. Specifically, the relative error on the validation set is basically kept within 0.015%, and the maximum relative error does not exceed 0.025%. This shows that the optimized model can effectively adapt to different data distributions and has good generalization ability.

[0129] The above-described embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Therefore, any changes made in accordance with the shape and principle of the present invention should be covered within the protection scope of the present invention.

Claims

1. A method for estimating the inertial time constant of a power system based on an improved long short-term memory network model, characterized in that, Includes the following steps: S1: Arrange the frequency change, frequency change rate, and inertial time constant of the power system into an array, randomly sort and divide the dataset, and perform normalization. S2: Define the structure of the long short-term memory network model and build the long short-term memory network model; S3: Using the processed frequency change and rate of change as input data to the model, and the processed inertial time constant as output data, determine the objective function and constraint function of the carnivorous plant algorithm. Randomly initialize a population consisting of carnivorous plants and prey. Generate initial hyperparameter combinations based on the parameter range defined by the constraint function. Use different hyperparameter combinations to construct a long short-term memory network model. Obtain the estimated value of the inertial time constant and calculate its mean square error compared to the true value. Use this as the fitness function for individuals and sort them from smallest to largest. Select the individual with the lowest mean square error. i Each individual is a carnivorous plant, the rest... j Individuals are designated as prey, and carnivorous plants and prey are grouped. New hyperparameter values ​​for carnivorous plants and prey are generated through growth and reproduction stages, combined with the original population, and their mean squared errors are calculated. The plants are then reordered in ascending order, and individuals are retained according to an elite selection strategy. a The hyperparameter combination with the minimum mean square error is selected, and the grouping, growth, reproduction, combination sorting and elite selection processes are repeated until the maximum number of iterations is met to obtain the optimal parameter configuration of the long short-term memory network model. The model is then trained, tested and validated to obtain the estimated value of the inertial time constant of the power system.

2. The method for estimating the inertial time constant of a power system based on an improved long short-term memory network model according to claim 1, characterized in that, Step S1 includes: S1-1: Obtain the time series data of the frequency change and the rate of frequency change of the power system, and the true value of the inertial time constant at the corresponding time points. Merge the time series data of the corresponding frequency change and the rate of frequency change with the inertial time constant to form input data in the format of a two-dimensional array, which can be represented as: (1) In equation (1), X It is an array consisting of frequency change, rate of frequency change, and inertial time constant. The change in frequency The rate of change of frequency, H m The inertial time constant, m The number of data sets, n For time steps; S1-2: Randomly sort the time series data and divide it 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 model's performance, and the validation set is used to evaluate the model's generalization ability. S1-3: The dataset is adjusted to the range [0,1] using linear normalization. The expression is as follows: (2) In equation (2), For the normalized data, The maximum value in the original data. This is the minimum value in the original data.

3. The method for estimating the inertial time constant of a power system based on an improved long short-term memory network model according to claim 2, characterized in that, Step S2 includes: S2-1: Define the Long Short-Term Memory Network Model: Input layer, Long Short-Term Memory Network Units, 4 hidden layers and output layer, where 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: Constructing a Long Short-Term Memory (LSTM) network model can be represented as: (3) In equation (3), t For the current time step, t -1 represents the previous time step. t+ 1 represents the next time step. For the current time step t The forgetting unit, It is the Sigmoid activation function. Forgetting Unit The weight matrix, For the previous time step t- Output of 1 and current time step t Input The vector formed Forgetting Unit The bias term, For the current time step t The input unit, For input unit The weight matrix, For input unit The bias term, For the current time step t Long-term memory information, tanh It is the hyperbolic tangent function. For long-term memory information The weight matrix, For long-term memory information The bias term, For the current time step t Output unit , For output unit The weight matrix, For output unit The bias term, For the previous time step t -1 is long-term memory information. For the current time step t The hidden layer output, For the next time step t +1 parameter value, For the current time step t The parameter value, For a predefined learning rate, For the current time step t Gradient second moment estimation, To prevent small constants from being divided by zero, For the current time step t The gradient of the first moment momentum, For the current time step t Gradient estimation of sample number, For a predefined number of samples, For the first l The loss function for each training sample. For the first l Input of each sample, For the first l The output of each sample For the next time step t The gradient of +1, For the current time step t gradient, For a predefined gradient clipping threshold, For the current time step t The gradient norm; S2-3: The Adam optimizer is selected as the optimization method for the model. The learning rate is a key hyperparameter for model optimization, with a range of [0.001, 0.01]. The maximum number of training iterations is set to 100. The number of samples in each mini-batch during mini-batch training is set to 128. The gradient clipping threshold is set to 1.

4. The method for estimating the inertial time constant of a power system based on an improved long short-term memory network model according to claim 3, characterized in that, Step S3 includes: S3-1: Select the frequency change and frequency change rate after processing in step S1-3 as the input features of the model, and the processed inertial time constant as the output feature of the model. S3-2: Determine the objective function of the carnivorous plant algorithm, aiming to minimize the mean square error between the estimated and true values ​​of the power system's inertial time constant. Obtain the optimal combination of hyperparameters for the model, which can be expressed as: (4) In equation (4), It is a minimum value function. Let be the mean square error vector between the estimated and true values ​​of the inertial time constant. For the first e The true value of the inertial time constant. For the model in configuration number a Group of hyperparameter combinations e An estimated value of the inertial time constant. For the first a A vector of hyperparameter combinations. For the first a The number of hidden layer units to be optimized in the set of hyperparameter combinations. For the first a The learning rate to be optimized in a set of hyperparameter combinations; S3-3: Determine the constraint functions for the carnivorous plant algorithm, define the parameter ranges for the number of hidden layer units and the learning rate, prevent the model from being too simple leading to low accuracy in inertial time constant estimation, and avoid excessively slow convergence speed when learning from frequency data and inertial time constant data. This can be expressed as: (5) S3-4: The carnivorous plant algorithm is used to optimize the number of hidden layer units and the learning rate of the long short-term memory network model. A population composed of carnivorous plants and prey is randomly initialized to form multiple sets of hyperparameters for estimating the inertial time constant of the model, which can be expressed as: (6) In equation (6), P The population matrix represents the matrix composed of all hyperparameter combinations of the model. For individual carnivorous plants or prey, these represent specific hyperparameter values. a The number of individuals represents the number of hyperparameter combinations. b The dimension represents the number of hyperparameters to be optimized. S3-5: Based on the constraints in step S3-3, randomly initialize each carnivorous plant and prey individual to generate an initial hyperparameter combination, which can be expressed as: (7) In equation (7), For the first b The lower bound of the parameter range is predefined for each hyperparameter. For the first b Each hyperparameter has a predefined upper bound on its parameter range. rand The value is randomly selected between 0 and 1; S3-6: Construct a Long Short-Term Memory (LSTM) network model using different hyperparameter combinations, obtain an estimate of the inertial time constant, calculate its mean squared error (MSE) compared to the true value, use it as the fitness function for each individual, sort them from smallest to largest, and select the one with the lowest MSE. i Each individual is a carnivorous plant, the rest... j Each individual being prey can be represented as: (8) In equation (8), Let be the individual mean square error vector. Ranked i Mean square error of carnivorous plants Ranked j The mean square error of the prey, i The number of carnivorous plants. j The number of prey, and i < j ; S3-7: Based on the sorting results in step S3-6, sort the population matrix in step S3-4 in ascending order. The higher the ranking, the closer the hyperparameter combination is to the optimal solution, which can be expressed as: (9) In equation (9), S_P The sorted population matrix is ​​as follows: Ranked i Carnivorous plants in the first b The hyperparameter values ​​of the column, Ranked j The prey in the b The hyperparameter values ​​of the column, Ranked i Carnivorous plants, Ranked j The prey; S3-8: Group carnivorous plants and prey according to a certain pattern. The prey ranked first is assigned to the carnivorous plant ranked first, the prey ranked second is assigned to the carnivorous plant ranked second, and so on, until the prey ranked third... i The prey was distributed to the ranked i Carnivorous plants, then ranked i The prey with +1 is assigned to the top-ranked carnivorous plant, and this process is repeated to group carnivorous plants and prey, with each group containing 1 carnivorous plant and at least 2 prey. This can be represented as: (10) In equation (10), SS_P A grouping matrix for carnivorous plants and prey, with each row belonging to the same group. k It is an integer; S3-9: During the growth stage of each group of carnivorous plants, if the attraction rate is greater than the random number, the carnivorous plants will leave the group matrix. SS_P Within the same group, prey is randomly selected, captured, and digested to promote its own growth, forming new model hyperparameter values, which can be represented as: (11) In equation (11), These are the hyperparameter values ​​for the newly generated carnivorous plants. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, for The growth rate is expressed as: (12) In equation (12), g A 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: (13) In equation (13), Hyperparameter values ​​for new prey that allow prey to escape and continue to grow. Grouped matrix SS_P The prey randomly selected from the same group in the first b The hyperparameter values ​​corresponding to the column, The growth rate of prey is expressed as: (14) In equation (14), Ranked c The mean square error of the prey, Ranked d The mean square error of the prey; S3-11: During the propagation stage, only carnivorous plants with the smallest mean square error are allowed to reproduce. By concentrating resources to generate a new generation of carnivorous plants, the hyperparameter values ​​can be expressed as: (15) In equation (15), The number one carnivorous plant in the world b The hyperparameter values ​​of the column, r For a predefined reproduction rate, The expression for the mate hyperparameter value for reproduction is: (16) In equation (16), , For randomly selected carnivorous plants in the first b The hyperparameter values ​​corresponding to the column, Ranked c The mean square error of carnivorous plants; S3-12: Combine the newly generated carnivorous plants and prey with the existing population, calculate their mean squared error, and re-sort them in ascending order. Retain them according to the elite selection strategy. a The hyperparameter combination with the smallest mean square error is selected, and the above steps are repeated for grouping, growth, reproduction, combination sorting and elite selection until the maximum number of iterations is met, generating the optimized population matrix, that is, the optimized model hyperparameter combination matrix, and selecting the best individual as the model hyperparameter configuration. S3-13: Select the optimal combination of hyperparameters obtained by the carnivorous plant algorithm to configure the long short-term memory network model, train the model using the pre-processed training set, test the model, and obtain the estimated value of the power system inertial time constant.

Citation Information

Patent Citations

  • Day-ahead economic dispatching method for micro-grid

    CN114285028A