Microgrid Transient Power Angle Trajectory Prediction Method Based on Attention Mechanism Spatiotemporal Graph Convolutional Neural Network
Through a spatiotemporal graph convolution neural network based on attention mechanism, combined with the spatiotemporal characteristics of the microgrid, the problem of inaccurate prediction of transient work angle trajectory of microgrids in the prior art is solved, and accurate prediction of large-scale complex microgrids is achieved.
Patent Information
- Application Number
- CN202210828283.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-13
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-07-13
AI Technical Summary
The existing methods for predicting transient work angle trajectory of microgrids fail to fully consider the spatiotemporal characteristics, resulting in inaccurate and unreliable predictions in large-scale complex microgrids.
A spatiotemporal graph convolution neural network based on attention mechanism is adopted to build a model including temporal attention layer, spatial attention layer, spatial convolution layer and temporal convolution layer, combined with an electrical adjacency matrix, capture the spatiotemporal dynamic characteristics of the microgrid and predict the work angle trajectory of each VSG of the microgrid.
Accurate transient work angle trajectory prediction of large-scale complex microgrids is achieved, and the accuracy and reliability of prediction are improved.
Smart Images

Figure CN115238980B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of microgrids, and in particular to a method for predicting the transient power angle trajectory of a microgrid based on a spatio-temporal graph convolutional neural network with an attention mechanism. Background Technique
[0002] Since the virtual synchronous generator (VSG) simulates the frequency regulation external characteristics of a synchronous generator, there will be a problem of power angle instability in the VSG in the microgrid when large disturbances such as short-circuit faults occur in the network, which affects the safe operation of the microgrid. Therefore, in order to provide information and gain time for the transient stability prevention and control of the microgrid and ensure the safe and stable operation of the microgrid, it is very important to quickly and accurately predict the trajectory of the online transient power angle of the microgrid.
[0003] Currently, the methods for predicting the online transient power angle trajectory of a microgrid mainly include:
[0004] 1. The method for transient stability assessment of a VSG multi-machine system based on an artificial neural network disclosed in Application No. 202111018894.3. This method selects an input feature set suitable for microgrid transient stability assessment and realizes the online transient stability assessment of a multi-VSG microgrid based on an artificial neural network. However, this method can only give a binary conclusion on whether the system transient power angle is stable or not, and the information provided for system transient stability prediction is relatively single.
[0005] 2. The method for microgrid transient stability assessment based on a long short-term memory network disclosed in Application No. 202111188280.X. This method proposes a method for predicting the power angle trajectory of a VSG based on an LSTM network. This method takes the VSG power angle as the input and realizes the prediction of the time-series trajectory of the VSG power angle of a single-machine infinite-bus system. However, in an actual large-scale complex microgrid, the transient power angle stability of each VSG is not only affected by its own characteristics, but also affected by the power angle characteristics of other VSGs, the system topology distribution, the fault location, the fault degree, and the fault duration. This shows that the transient power angle instability characteristics of each VSG are not only reflected in the time-series response trajectory of the inverter, but may also present in a certain dynamic distribution law in space. When the system encounters a severe transient accident, the power angle of the VSG that is severely disturbed and prone to instability may first swing open more than 360°. As the power imbalance at this node increases, the transient power angle stability of the rest of the VSGs in the system changes sharply, and the power angle unstable units will gradually expand to a larger area. Obviously, this method cannot extract the characteristics of the network spatial distribution, which restricts the reliability of this method applied to an actual complex microgrid.
[0006] If the spatial characteristics of the microgrid system are fully considered and the transient response trajectory information of the system is organically integrated with the network spatial topology and fault information, it is expected to comprehensively extract the key features affecting the transient power angle instability of the microgrid from a wide-area spatio-temporal perspective and accurately predict the power angle trajectory of the microgrid. However, there is almost no research considering the correlation between spatio-temporal characteristics and the system power angle trajectory in the existing patents and literature on microgrid transient power angle trajectory prediction, which restricts the reliability and accuracy of the existing methods when applied to large-scale complex microgrids. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a method for predicting the transient power angle trajectory of a microgrid based on an attention mechanism-based spatio-temporal graph convolutional neural network. This method considers the correlation between spatio-temporal characteristics and the system power angle trajectory and can effectively and accurately predict the power angle trajectories of each VSG in the microgrid.
[0008] To solve the above technical problem, the present invention adopts the following technical method: A method for predicting the transient power angle trajectory of a microgrid based on an attention mechanism-based spatio-temporal graph convolutional neural network, including:
[0009] Step S1, determining the input features and output features of the spatio-temporal graph convolutional neural network:
[0010] First, define the microgrid at any time section as an undirected graph G=(X t , A), where each node in the undirected graph represents a VSG, and X t is the detection value of all channels of each node at time section t in the undirected graph, including the output active power P, output reactive power Q, output voltage amplitude V, power angle δ, and power angle acceleration α of each node, and A is the electrical adjacency matrix composed of the electrical distances between each node in the undirected graph;
[0011] Then, determine the detection values of all channels of each VSG at the current time and the electrical adjacency matrix as the input features of the spatio-temporal graph convolutional neural network, and use the predicted power angle values of each VSG at future times as the output features of the spatio-temporal graph convolutional neural network;
[0012] Step S2, constructing a microgrid power angle trajectory prediction model based on an attention mechanism-based spatio-temporal graph convolutional neural network: The model includes m sequentially connected spatio-temporal modules and a two-dimensional standard convolutional layer for extracting spatio-temporal features; each spatio-temporal module includes a time attention layer TAL for capturing time dynamics, a space attention layer SAL for capturing space dynamics, a spatial convolutional layer GCN for mining spatial features, and a time convolutional layer 2DConV for mining temporal features that are sequentially connected;
[0013] Step S3, Sample Data Generation and Data Preprocessing: Obtain the undirected graph data of several time sections, generate sample data. Among them, the output active power P, output reactive power Q, output voltage amplitude V, power angle δ, power angle acceleration α, and electrical adjacency matrix A of all channels of each node in the previous time section are used as input feature data, and the power angle δ of all channels of each node in the subsequent time section is used as output feature data. Preprocess the sample data and divide the sample data into training samples, validation samples, and test samples;
[0014] Step S4, Use the training samples to train the model constructed in Step S2, and then send the validation samples into the trained model to calculate the validation prediction results. Take the training parameters of the best validation effect as the final model parameters to obtain the optimized model;
[0015] Step S5, Use the test samples to evaluate the performance of the optimized model. If the performance test result is ideal, the input features calculated from the current acquisition can be sent into the optimized model to obtain the output features, so as to predict the power angle trajectories of each VSG in the microgrid at future moments. Otherwise, go to Step S4.
[0016] Furthermore, the calculation methods of the parameters in the undirected graph are as follows:
[0017] 1) The detected value X of all channels of each node at time section t t
[0018] The detected value of all channels of each node within τ time is X = [X1, X2, X3, …, X τ , where X t at any moment t within the τ time section is expressed as:
[0019]
[0020] 2) Electrical adjacency matrix A
[0021] First, calculate the impedance matrix Z of each node according to the following formula (2) VSG :
[0022]
[0023] where Z ii is the self-impedance of the i-th VSG, and Z ij is the mutual impedance from the i-th VSG to the j-th VSG, 1 < i < N, 1 < j < N, i ≠ j;
[0024] Next, calculate the electrical distance D between any two nodes according to the following formula (3) ij ;
[0025] Dij = |(Z ii - Z ij ) - (Z ij - Z jj )| 2 (1 ≤ i, j ≤ N) (3)
[0026] Finally, normalize the electrical distance D according to the following formula (4); ij Perform normalization processing;
[0027]
[0028] Then the electrical adjacency matrix A as shown in the following formula (5) is obtained.
[0029]
[0030] Furthermore, for the output features of the spatio-temporal graph convolutional neural network, assuming to predict the power angle trajectories of each VSG in the microgrid at the future σ time cross-sections, the output features corresponding to the spatio-temporal graph convolutional neural network are expressed as Y = [Y τ+1 , Y τ+2 , Y τ+3 , …, Y τ+ρ , where, at any moment τ + ρ within the time from τ to τ + t, Y τ+t is expressed as:
[0031]
[0032] Furthermore, for any spatio-temporal module r in the model, 1 < r < m, its calculation process is as follows:
[0033] Step S21, first input the input features of the r-th spatio-temporal module into the time attention layer TAL, calculate the time attention matrix T according to formula (7), to ensure the fast convergence of the neural network, then perform Softmax normalization processing on the time attention matrix T according to formula (8), and finally, directly multiply the normalized time attention matrix T’ with the input to obtain a new time series based on the attention mechanism which is both the output of the time attention layer TAL and the input of the spatial attention layer SAL of this spatio-temporal module;
[0034]
[0035]
[0036]
[0037] Among them, V e , V1, V2, V3, b e are all learning parameters of the neural network, and σ is the ReLU activation function;
[0038] Step S22: First, input the time series obtained in step S21 into the Spatial Attention Layer SAL, calculate the spatial attention matrix S according to formula (10). To ensure the fast convergence of the neural network, then perform Softmax normalization on the spatial attention matrix S. This spatial attention matrix S’ will be used as the input of the Spatial Convolution Layer GCN for mining spatial features together with the electrical adjacency matrix A to dynamically adjust the weights between each VSG of the microgrid;
[0039]
[0040]
[0041] Among them, V s , W1, W2, W3, b s are all learning parameters of the neural network, and σ is the ReLU activation function;
[0042] Step S23: Send the time series spatial attention matrix S’ and the electrical adjacency matrix A obtained in steps S21 and S22 to the Spatial Convolution Layer GAN. First, replace the classical convolution operator with a linear operator diagonalized in the Fourier domain to implement the convolution operation, and then activate the graph convolution result using the ReLU function;
[0043] For any time segment t, the time series on the undirected graph is filtered by the convolution kernel gθ and approximated using Chebyshev polynomials. The calculation formula for the graph convolution operation based on the K - order Chebyshev polynomial is as follows:
[0044]
[0045] Among them, *G is the graph convolution operation, L is the graph Laplacian matrix, D is the degree matrix of L, which is a diagonal matrix, I N is the identity matrix, λ max is the largest eigenvalue of L, Θ is the parameter of the spatial - dimensional convolution kernel, and the recursive definition of the Chebyshev polynomial is: T k (x) = 2xT k-1 (x) - T k-2 (x), where T0(x) = 1, T1(x) = x;
[0046] Step S24, after the spatial convolutional layer GCN captures the adjacent information of each node on the graph, that is, the spatial information of the graph, a temporal convolutional layer 2DConV in the standard time dimension is stacked to merge the information of adjacent time segments, and finally activated by the ReLU function;
[0047] The calculation formula of the used temporal convolutional layer 2DConV is as follows:
[0048]
[0049] where Φ is the parameter of the convolutional kernel in the time dimension;
[0050] Step S25, finally, a two-dimensional standard convolutional layer is used in the model to further extract spatio-temporal features, and the output dimension of the two-dimensional standard convolutional layer is the same as the prediction dimension, ensuring that the output of each node has the same dimension and shape as the prediction target, and activated by the ReLU function. The calculation of this two-dimensional standard convolutional layer is the same as that of the temporal convolutional layer 2DConV, so refer to formula (13).
[0051] Furthermore, in step S3, the method for generating sample data is as follows:
[0052] First, through simulation or experiment, change the system fault location, fault duration, and system load level, collect and record the active power P, reactive power Q, output voltage amplitude V, power angle δ, and power angle acceleration α of each VSG at different time sections, and then calculate the electrical adjacency matrix A at different time sections through formulas (2)-(5) to generate sample data.
[0053] Furthermore, in step S2, the sampling interval of the time series data is 10 ms.
[0054] Furthermore, in step S2, the input features and output features of each time section in the sample data are normalized according to Z-score normalization.
[0055] Furthermore, in step S4, when training the model, first preset the parameters of the model. Among them, the spatio-temporal module m = 2, the size of the convolutional kernel in the time dimension in each spatio-temporal module is 64, the size of the convolutional kernel in the spatial dimension is 64, the order of the Chebyshev polynomial is 3, the model learning rate is 0.0001, the size of the data processed in one batch is 32, and the model loss function is MSE; then use the training samples and train the model based on the calculated value of the loss function.
[0056] Preferably, in step S5, the evaluation metrics for evaluating the performance of the optimized model are root mean square error RMSE, mean absolute error MAE, and mean absolute percentage error MAPE.
[0057] Compared with the existing methods, the transient power angle trajectory prediction method of the microgrid based on the attention mechanism of the spatio-temporal graph convolutional neural network proposed by the present invention starts from the wide-area spatio-temporal perspective and comprehensively considers the factors affecting the transient power angle instability of the system based on the spatio-temporal dynamic correlation of the transient response, and can realize the accurate prediction of the VSG transient power angle trajectory of a large-scale complex microgrid. Specifically, the present invention uses the spatial attention layer and the temporal attention layer of the spatio-temporal module to capture the dynamic characteristics of the microgrid transient in space and time, and mines the dynamic characteristics in space and time based on the spatial graph convolutional layer and the temporal convolutional layer of the spatio-temporal module, fully considering the correlation between the spatio-temporal characteristics and the power angle trajectory of the system, so as to solve the accuracy problem of power angle trajectory prediction in complex microgrids and realize the effective and accurate prediction of the power angle trajectories of each VSG in the microgrid. Description of the Drawings
[0058] Figure 1 It is a flow chart of the transient power angle trajectory prediction method of the microgrid based on the attention mechanism of the spatio-temporal graph convolutional neural network involved in the present invention;
[0059] Figure 2 It is the undirected graph G of the microgrid in the transient power angle trajectory prediction method of the microgrid based on the attention mechanism of the spatio-temporal graph convolutional neural network involved in the present invention;
[0060] Figure 3 It is an architecture diagram of the spatio-temporal graph convolutional neural network model involved in the present invention;
[0061] Figure 4 It is an architecture diagram of any spatio-temporal module in the spatio-temporal graph convolutional neural network model involved in the present invention;
[0062] Figure 5 It is a schematic diagram of a typical microgrid system with multiple VSGs. Detailed Embodiments
[0063] For the convenience of understanding by those skilled in the art, the present invention will be further described below in conjunction with the embodiments and the drawings. The content mentioned in the embodiments does not limit the present invention.
[0064] In an actual large-scale complex microgrid, the transient power angle instability characteristics of each VSG are not only affected by its own timing characteristics, but also by other factors such as the timing trajectory characteristics of other VSGs and the network spatial distribution characteristics. This makes it difficult to accurately and quickly predict the transient power angle trajectory of a complex microgrid using existing methods. It should be particularly noted that the spatial distribution characteristics of the microgrid are not fixed. If a fault occurs at different positions in the system, obviously the spatial distribution characteristics of the system will change. This shows that the spatial distribution characteristics of the system will change dynamically over time. At the same time, the contribution of the system timing trajectory information in each time segment to predicting the system's transient power angle trajectory at future moments is not the same. For example, compared with the power angle trajectory information at the fault occurrence moment, the power angle trajectory information at the fault clearing moment is obviously more contributive to predicting the future power angle trend of the system. Therefore, while considering the spatio-temporal characteristics of the system, the dynamic characteristics in space and time should be taken into account in the transient power angle trajectory prediction to further improve the accuracy of the microgrid power angle trajectory prediction. For this reason, this patent proposes a method for predicting the transient power angle trajectory of a microgrid based on an attention mechanism and a spatio-temporal graph convolutional neural network. Among them, the attention mechanism is used to reflect the spatio-temporal dynamic characteristics, and the spatio-temporal graph convolutional neural network is used to mine the spatio-temporal characteristics of the system to effectively realize the prediction of the transient power angle trajectory of the microgrid. The following will elaborate on the present invention in detail.
[0065] A method for predicting the transient power angle trajectory of a microgrid based on an attention mechanism and a spatio-temporal graph convolutional neural network, as Figure 1 shown, specifically includes the following five major steps.
[0066] Step S1, determine the input features and output features of the spatio-temporal graph convolutional neural network.
[0067] As Figure 2 shown, the present invention regards the microgrid as an undirected graph, and defines the microgrid at any time section as an undirected graph G=(X t , A). Among them, X t is the set of all channels detected by N nodes (in the present invention, they are N VSGs) in the undirected graph at time section t. In the present invention, each node (i.e., each VSG) detects 5 channels, namely the output active power P of the VSG, the output reactive power Q, the output voltage amplitude V, the power angle δ, and the power angle acceleration α. A is the electrical adjacency matrix of the undirected graph.
[0068] Determine the input features of the spatio-temporal graph convolutional neural network as the detection values of all channels of each VSG at the current time and the electrical adjacency matrix, and use the predicted power angle values of each VSG at future times as the output features of the spatio-temporal graph convolutional neural network.
[0069] The aforementioned X tAnd A are also the input features of the spatio-temporal graph convolutional neural network at time t, while X t The power angle δ in it is the output feature of the spatio-temporal graph convolutional neural network before time t. For the present invention, the prediction of the transient power angle trajectory of the microgrid is to predict the power angle values of each point in the undirected graph in the future τ + ρ time according to the detection values of all channels of each node in the undirected graph within the input τ time.
[0070] 1) Detection values X of all channels of each node in the time section t
[0071] The detection values of all channels of each node within τ time are X = [X1, X2, X3, …, X τ , where X at any moment t within the τ time section t is expressed as:
[0072]
[0073] 2) Electrical adjacency matrix A
[0074] First, calculate the impedance matrix Z of each node according to the following formula (2) VSG :
[0075]
[0076] where Z ii is the self-impedance of the i-th VSG, and Z ij is the mutual impedance from the i-th VSG to the j-th VSG, 1 < i < N, 1 < j < N, i ≠ j.
[0077] Next, calculate the electrical distance D between any two VSG nodes according to the following formula (3) ij .
[0078] D ij = |(Z ii - Z ij ) - (Z ij - Z jj )| 2 (1 ≤ i, j ≤ N) (3)
[0079] Finally, normalize the electrical distance D ij according to the following formula (4).
[0080]
[0081] Then the electrical adjacency matrix A shown in the following formula (5) is obtained.
[0082]
[0083] 3) Output Feature Y of Spatiotemporal Graph Convolutional Neural Network
[0084] Assume that the power angle trajectories of each VSG in the microgrid for the future σ time sections are predicted. Then, the output feature Y of the spatiotemporal graph convolutional neural network is Y = [Y τ+1 , Y τ+2 , Y τ+3 , …, Y τ+ρ , where, at any moment τ + t within the time period from τ to τ + ρ, Y τ+t is expressed as:
[0085]
[0086] Step S2: Construct a microgrid power angle trajectory prediction model based on an attention mechanism spatiotemporal graph convolutional neural network (hereinafter referred to as the model).
[0087] As Figure 3 and Figure 4 shown, the model constructed in the present invention includes m sequentially connected spatiotemporal modules and a two-dimensional standard convolutional layer for extracting spatiotemporal features. Among them, each spatiotemporal module includes a time attention layer TAL for capturing time dynamics, a spatial attention layer SAL for capturing spatial dynamics, a spatial convolutional layer GCN for mining spatial features, and a time convolutional layer 2DConV for mining temporal features, which are sequentially connected. The two-dimensional standard convolutional layer is located at the last position in the model to further extract the spatiotemporal features extracted by multiple spatiotemporal modules, so as to further accurately predict the power angle trajectories of each VSG in the future. The calculation processes of the spatiotemporal modules and the two-dimensional standard convolutional layer in this model are as follows.
[0088] I. Since the calculation processes of each spatiotemporal module are the same, only the calculation process of any one spatiotemporal module is described here. For example, for the r-th spatiotemporal module (r belongs to 1 to m), its calculation process is as follows.
[0089] Step S21: First, input the input feature of the r-th spatiotemporal module into the time attention layer TAL, calculate the time attention matrix T according to formula (7). To ensure the fast convergence of the neural network, then perform Softmax normalization processing on the time attention matrix T according to formula (8). Finally, directly multiply the normalized time attention matrix T’ by the input to obtain a new time series based on the attention mechanism , which is both the output of the time attention layer TAL and the input of the spatial attention layer SAL of this spatiotemporal module.
[0090]
[0091]
[0092]
[0093] Among them, V e , V1, V2, V3, b e are all learning parameters of the neural network, and σ is the ReLU activation function.
[0094] Step S22: First, input the time series obtained in step S21 into the spatial attention layer SAL, calculate the spatial attention matrix S according to formula (10). To ensure the fast convergence of the neural network, then perform Softmax normalization on the spatial attention matrix S. This spatial attention matrix S’ will be used as the input of the spatial convolutional layer GCN for mining spatial features together with the electrical adjacency matrix A to dynamically adjust the weights between each VSG of the microgrid.
[0095]
[0096]
[0097] Among them, V s , W1, W2, W3, b s are all learning parameters of the neural network, and σ is the ReLU activation function.
[0098] Step S23: Send the time series obtained in steps S21 and S22, the spatial attention matrix S’ and the electrical adjacency matrix A to the spatial convolutional layer GAN. First, replace the classical convolution operator with a linear operator diagonalized in the Fourier domain to achieve the convolution operation, and then activate the graph convolution result using the ReLU function.
[0099] For any time segment t, the time series on the undirected graph G is filtered by the convolution kernel gθ and approximated using Chebyshev polynomials. The calculation formula of the graph convolution operation based on the K-order Chebyshev polynomial is as follows:
[0100]
[0101] Among them, *G is the graph convolution operation, L is the graph Laplacian matrix, D is the degree matrix of L, which is a diagonal matrix, I N is the identity matrix, λ max is the largest eigenvalue of L, Θ is the parameter of the spatial dimension convolution kernel, and the recursive definition of the Chebyshev polynomial is: T k (x) = 2xT k-1 (x) - Tk-2 (x), where \(T_0(x) = 1\) and \(T_1(x) = x\).
[0102] In step S24, after the spatial convolutional layer GCN captures the adjacent information of each node on the graph, that is, the spatial information of the graph, a temporal convolutional layer 2DConV in the standard time dimension is stacked to merge the information of adjacent time segments, and finally activated by the ReLU function.
[0103] The calculation formula of the used temporal convolutional layer 2DConV is as follows:
[0104]
[0105] where \(\varPhi\) is the parameter of the convolutional kernel in the time dimension.
[0106] In step S25, finally, a two-dimensional standard convolutional layer is used in the model to further extract spatio-temporal features, and the output dimension of the two-dimensional standard convolutional layer is made consistent with the prediction dimension to ensure that the output of each node has the same dimension and shape as the prediction target, and is activated by the ReLU function. The calculation formula of this two-dimensional standard convolutional layer is the same as that of the temporal convolutional layer 2DConV, so refer to formula (13).
[0107] Step S3, sample data generation and data preprocessing.
[0108] Sample data generation: First, through simulation or experiment, change the system fault location, fault duration, and system load level, collect and record the active power \(P\), reactive power \(Q\), output voltage amplitude \(V\), power angle \(\delta\), and power angle acceleration \(\alpha\) of each VSG at different time sections. Then, calculate the electrical adjacency matrix \(A\) at different time sections through formulas (2)-(5) to generate sample data. Among them, the active power \(P\), reactive power \(Q\), output voltage amplitude \(V\), power angle \(\delta\), power angle acceleration \(\alpha\) of all channels of each node in the previous time section and the electrical adjacency matrix \(A\) are input feature data, and the power angle \(\delta\) of all channels of each node in the subsequent time section is output feature data. Then, preprocess the data samples, and then divide the sample data into training samples, validation samples, and test samples. The sampling interval of the time series data in this embodiment is 10 ms, and the first 10 time points are used to predict the next 10 time points, that is, the data of the first 0.1 s is used to predict the data of the next 0.1 s.
[0109] Regarding data preprocessing: To normalize the input features and output features of each time section in the data samples, the normalization method here is Z-score standardization to eliminate the gap between different dimensions and accelerate the model convergence speed.
[0110] Step S4, model training and validation.
[0111] First, set the parameters of the model: the number of spatio-temporal modules \(m = 2\), the size of the time-dimensional convolutional kernel in each spatio-temporal module is 64, the size of the space-dimensional convolutional kernel is 64, the order of the Chebyshev polynomial is 3, the learning rate of the model is 0.0001, the size of the data processed in one batch is 32, and the model loss function is MSE. MSE is one of the classical loss function calculation methods for neural network regression problems, and the present invention will not elaborate on it further.
[0112] Then, use the training samples and train the model based on the calculated value of the loss function.
[0113] Finally, use the validation samples and calculate the prediction results of the validation data set based on the trained model parameters, and take the training parameters of the best-performing validation as the final model training parameters.
[0114] Step S5, model testing and application.
[0115] Use the test samples to evaluate the model performance. The evaluation metrics are root mean square error RMSE, mean absolute error MAE, and mean absolute percentage error MAPE. Each evaluation metric is a commonly used evaluation metric for regression problems, and its mathematical formula will not be elaborated in this embodiment. If the model performance test results are ideal, the model can be directly put into application, that is, the currently collected and calculated input features are sent into the optimized model to obtain the output features to predict the power angle trajectories of each VSG in the microgrid at future moments. Otherwise, go to step S4 to continue optimizing the model to more accurately predict the power angle trajectories of each VSG in the microgrid at future moments.
[0116] To verify the effectiveness of the method involved in the present invention, next, a multi-machine microgrid system as shown in Figure 5 is used for example verification to obtain the actual power angle trajectory prediction effect of the method involved in the present invention, as shown in Table 1 below.
[0117] Table 1 Power angle trajectory prediction effects of the model involved in the present invention and the traditional LSTM time series prediction model
[0118]
[0119] Take Figure 4 the multi-machine microgrid system shown for example verification. A total of 46,413 samples are generated. Among them, the samples are divided into training samples, validation samples, and test samples according to 6:2:2. It can be seen from Table 1 that the evaluation metrics of the model involved in the present invention far exceed those of the traditional LSTM time series prediction model, which fully proves the effectiveness and superiority of the method involved in the present invention.
[0120] The above embodiments are preferred implementation solutions of the present invention. In addition, the present invention can also be implemented in other ways. Any obvious substitution without departing from the concept of the technical solution is within the protection scope of the present invention.
[0121] To make it more convenient for those of ordinary skill in the art to understand the improvements of the present invention over the prior art, some of the drawings and descriptions of the present invention have been simplified. And for the sake of clarity, some other elements have also been omitted in this application document. Those of ordinary skill in the art should be aware that these omitted elements may also constitute the content of the present invention.
Claims
1. A transient power angle trajectory prediction method for a microgrid based on an attention mechanism spatio-temporal graph convolutional neural network, characterized in that, Including: Step S1, determining the input features and output features of the spatio-temporal graph convolutional neural network: Define the microgrid at any time section as an undirected graph , where each node in the undirected graph represents a VSG, is the time section in the undirected graph the detection values of all channels of each node, including the active power output of each node , reactive power output , output voltage amplitude , power angle , power angle acceleration , is the electrical adjacency matrix composed of the electrical distances between each node in the undirected graph; Then, determining the detection values of all channels of each VSG at the current time and the electrical adjacency matrix as the input features of the spatio-temporal graph convolutional neural network, and taking the power angle values of each VSG at the predicted future time as the output features of the spatio-temporal graph convolutional neural network; Step S2, construct a microgrid power angle trajectory prediction model based on an attention mechanism-based spatio-temporal graph convolutional neural network: The model includes successively connected spatio-temporal modules and a two-dimensional standard convolutional layer for extracting spatio-temporal features; each spatio-temporal module includes a time attention layer TAL for capturing time dynamics, a spatial attention layer SAL for capturing spatial dynamics, a spatial convolutional layer GCN for mining spatial features, and a time convolutional layer 2DConV for mining temporal features; Step S3, sample data generation and data preprocessing: Obtain undirected graph data of several time sections to generate sample data, where the output active power of all channels of each node in the previous time section , the output reactive power , the output voltage amplitude , the power angle , the power angle acceleration , and the electrical adjacency matrix are used as input feature data, and the power angle of all channels of each node in the subsequent time section is used as output feature data. Preprocess the sample data and divide the sample data into training samples, validation samples, and test samples; Step S4, using the training samples to train the model constructed in Step S2, then sending the validation samples into the trained model to calculate the validation prediction results, and taking the training parameters of the best validation effect as the final model parameters to obtain the optimized model; Step S5, using the test samples to evaluate the performance of the optimized model. If the performance test result is ideal, the input features calculated from the currently collected data can be sent into the optimized model to obtain the output features, so as to predict the power angle trajectories of each VSG in the microgrid at future moments. Otherwise, go to Step S4; Electrical Adjacency Matrix The calculation method is as follows: First, calculate the impedance matrix of each node according to the following formula (2) :[[]]END]] (2) Among them, is the self-impedance of the th VSG, is the mutual impedance from the th VSG to the th VSG, ; Next, calculate the electrical distance between any two nodes according to the following formula (3) ; (3) Finally, normalize the electrical distance according to the following formula (4): ; (4) Then the electrical adjacency matrix shown in the following formula (5) is obtained ; (5)。 2. The transient power angle trajectory prediction method of the microgrid based on the spatio-temporal graph convolutional neural network with attention mechanism according to claim 1, wherein The calculation method of each parameter in the undirected graph is as follows: 1) Time section Detection values of all channels of each node : At the detection values of all channels of each node within are At any moment within the time section, is expressed as: (1)。 3. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 2, wherein: For the output features of the spatio-temporal graph convolutional neural network, assuming the prediction of the future power angle trajectories of each VSG in the time section of the microgrid, the output features corresponding to the spatio-temporal graph convolutional neural network are expressed as , where, at any moment to within the time of is expressed as: (6)。 4. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 3, wherein, Any spatio-temporal module in the model , , and its calculation process is as follows: Step S21, first input the input features of the time-space module of the layer into the time attention layer TAL, and calculate the time attention matrix according to formula (7) . To ensure the rapid convergence of the neural network, then normalize the time attention matrix using Softmax according to formula (8). Finally, directly multiply the normalized time attention matrix by the input to obtain a new time series based on the attention mechanism . This is both the output of the time attention layer TAL and the input of the spatial attention layer SAL of this time-space module. (7) (8) (9) Among them, are all learning parameters of the neural network, is the ReLU activation function; Step S22: First, input the time series obtained in step S21 into the spatial attention layer SAL, and calculate the spatial attention matrix according to formula (10) . To ensure the rapid convergence of the neural network, then perform Softmax normalization on the spatial attention matrix . This spatial attention matrix will be used together with the adjoint electrical adjacency matrix as the input of the spatial convolutional layer GCN for mining spatial features to dynamically adjust the weights between each VSG of the microgrid; (10) (11) Among them, are all learning parameters of the neural network, is the ReLU activation function; Step S23: Send the time series obtained in Steps S21 and S22 , the spatial attention matrix and the electrical adjacency matrix to the spatial convolutional layer GAN together. First, replace the classical convolutional operator with a linear operator diagonalized in the Fourier domain to perform the convolutional operation, and then activate the graph convolutional result using the ReLU function; For any time segment , the time series on the undirected graph is filtered by the convolution kernel and approximated by Chebyshev polynomials. Based on K the calculation formula of the graph convolution operation of the Chebyshev polynomial of order (12) Among them, is the graph convolution operation, is the graph Laplacian matrix, is 's degree matrix, which is a diagonal matrix, is the identity matrix, is 's largest eigenvalue, is the parameter of the spatial dimension convolution kernel, and the recursive definition of the Chebyshev polynomial is: , where ; Step S24, after the spatial convolutional layer GCN captures the adjacent information of each node on the graph, that is, the spatial information of the graph, stack a temporal convolutional layer 2DConV with a standard time dimension to merge the information of adjacent time segments, and finally activate it with the ReLU function; The calculation formula of the used temporal convolutional layer 2DConV is as follows: (13) Among them, is the parameter of the temporal dimension convolution kernel; Step S25, finally, use a two-dimensional standard convolutional layer in this model to further extract spatio-temporal features, and make the output dimension of the two-dimensional standard convolutional layer consistent with the prediction dimension, ensuring that the output of each node has the same dimension and shape as the prediction target, and activate it with the ReLU function. The calculation of this two-dimensional standard convolutional layer is the same as that of the temporal convolutional layer 2DConV, so refer to formula (13).
5. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 4, characterized in that: In Step S3, the method for generating sample data is as follows: First, through simulation or experiment, change the system fault location, fault duration, and system load level, and collect and record the active power output, reactive power output, output voltage amplitude, power angle, and power angle acceleration of each VSG at different time sections. , reactive power output , output voltage amplitude , power angle , power angle acceleration , and then calculate the electrical adjacency matrix at different time sections through formulas (2)-(5) to generate sample data.
6. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 5, characterized in that: In Step S2, the sampling interval of the time series data is 10 ms.
7. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 6, characterized in that: In Step S2, the input features and output features of each time section in the sample data are normalized according to Z-score normalization.
8. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 7, wherein: In step S4, when training the model, first preset the parameters of the model. Among them, the spatio-temporal module , the size of the time dimension convolutional kernel in each spatio-temporal module is 64, the size of the spatial dimension convolutional kernel is 64, the order of the Chebyshev polynomial is 3, the learning rate of the model is 0.0001, the size of the data processed in one batch is 32, and the model loss function is MSE; then use the training samples and train the model based on the calculated value of the loss function.
9. The transient power angle trajectory prediction method of the microgrid based on the attention mechanism spatio-temporal graph convolutional neural network according to claim 8, wherein: In Step S5, the evaluation metrics for evaluating the performance of the optimized model are root mean square error RMSE, mean absolute error MAE, and mean absolute percentage error MAPE.
Citation Information
Patent Citations
VSG multi-machine system transient stability evaluation method based on artificial neural network
CN113792481A
Microgrid transient stability evaluation method based on long short-term memory network
CN113937762A
Power system transient stability comprehensive judgment method based on actually-measured trajectory of WAMS and system
CN109301841A
Air quality prediction method based on space-time diagram convolutional network
CN114240000A