GPU parallel solution method and solution system for power system linear equations
By defining the initial nodes in the power system and establishing a sparse decomposition thread tree, and the collection of brother nodes allocated threads are used to solve the sparse matrix in parallel, the overlapping calculation problem in parallel solution of GPU linear equations in the power system is solved, which improves the calculation accuracy and efficiency, and is suitable for large power grid current calculation.
Patent Information
- Application Number
- CN202510747873.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-06-06
AI Technical Summary
The existing GPU parallel solution method for linear equations in power systems has overlapping calculation problems, the calculation results are low in accuracy, and the parallel flow calculation execution efficiency is low.
By defining an initial node among all nodes of the power system, dividing the remaining nodes into different levels according to the distance from the initial node, a sparse decomposition thread tree is established, and the child nodes with the same parent node in the same level are called brother nodes, a collection of brother nodes is established, threads are allocated according to the collection of brother nodes in the GPU, and sparse matrix parallel solution calculation is performed for each node at the same level.
The overlapping calculation problem in sparse matrix factor decomposition and hierarchical parallel computing is solved, the calculation accuracy and the execution efficiency of parallel current calculation of power system are improved, and the online computing practicality is suitable for large power grid current calculation.
Smart Images

Figure CN120262428B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power system automation, and in particular to a GPU parallel solution method for power system linear equations and a solution system thereof. Background Art
[0002] With the expansion of power systems and the advancement of cloud-based grid control, the scale of grid analysis and computation is increasing. Currently, the modeling scope of the control center's cloud system ranges from ultra-high voltage (UHV) 1000kV to 10kV feeder lines. The number of computing nodes in a single province can reach tens of thousands, significantly increasing computational time and making it difficult to meet the needs of real-time grid analysis.
[0003] The core algorithms for current power system state estimation and power flow calculations rely on solving large-scale linear equations. Rapidly computing the corresponding sparse matrices is crucial for improving solution speed. Common computational methods include parallel computing using multi-core central processing units (CPUs) and graphics processing units (GPUs).
[0004] However, these approaches are all limited by memory bandwidth and the number of physical cores. Traditional multi-core CPUs face inherent computational bottlenecks in parallel computing, making them unsuitable for large-scale systems. Graphics processing units (GPUs), specialized processors designed for data parallelism, offer superior parallel computing capabilities due to their superior performance in floating-point operations, memory bandwidth, and large number of cores. These GPUs have been successfully applied to numerous scientific computing fields, including power systems.
[0005] Although there are some parallel computing studies in the existing technology, because the nodes of the sparse path graph have upward dependencies, that is, they rely on the calculation results of the nodes in the upper layer, there are overlapping calculation problems between the current parallel threads, which seriously affects the accuracy of the calculation results of the power flow calculation, resulting in slower convergence or even no convergence.
[0006] Therefore, there is a need for a GPU parallel solution method and solution system for power system linear equations that can solve the overlapping calculation problem in sparse matrix factorization hierarchical parallel calculation, improve calculation accuracy, and improve the efficiency of power system parallel power flow calculation. Summary of the Invention
[0007] The present invention aims to solve the defects of the existing GPU parallel solution method for power system linear equations, such as the problem of overlapping calculations, low calculation result accuracy, and low parallel power flow calculation execution efficiency. It provides a GPU parallel solution method for power system linear equations and its solution system, which can solve the overlapping calculation problem in sparse matrix factorization hierarchical parallel calculation, improve calculation accuracy, and improve the efficiency of power system parallel power flow calculation.
[0008] The GPU parallel solution method for power system linear equations of the present invention comprises the following steps:
[0009] An initial node is defined among all nodes in the power system, and the remaining nodes are divided into different levels according to their distance from the initial node, thereby establishing a sparse decomposition thread tree;
[0010] The child nodes with the same parent node in the same level are called sibling nodes, and a sibling node set is established;
[0011] Allocating threads in the GPU according to the set of sibling nodes;
[0012] Perform sparse matrix parallel solution calculations on each node at the same level.
[0013] Furthermore: the step of establishing a sparse decomposition thread tree includes:
[0014] A weighted directed factor graph is used to describe all nodes of the power system; p, j, k, and l are nodes for power flow calculation, where p is the generating point and j, k, and l are the receiving points;
[0015] On the weighted directed factor graph, among the edges emitted from each node, the edge with the smallest receiving node number is taken as the path on the sparse decomposition path graph.
[0016] Furthermore, in the parallel sparse matrix calculation for each node at the same level, the sparse matrix calculations for nodes at the same level are simultaneously calculated in parallel. The specific process includes:
[0017] In the sparse decomposition path graph of node j, the parent node number parent(j) of node j is defined as:
[0018] ;
[0019] Where, It is the element in the p-th row and j-th column of the lower triangular matrix L in the Jacobian matrix A. Node p is called the parent node of node j, and node j is the child node of node p.
[0020] The in-degree In_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is less than i, that is:
[0021] ;
[0022] in, is the edge weight of each node j pointing to node i, i = p, j, k or l;
[0023] The out-degree Out_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is greater than i, that is:
[0024] ;
[0025] in, is the edge weight of node j starting from node i.
[0026] Furthermore, in the parallel sparse matrix solution calculation for each node at the same level, the parent node starts to calculate only after the child node calculation is completed, thereby achieving the stratification of the sparse decomposition path graph. The specific stratification process includes:
[0027] Initial level of all nodes;
[0028] ;
[0029] In the formula, level (i) represents the i-th level;
[0030] Traverse all nodes and assign the node with in-degree 0 to level 0;
[0031] ;
[0032] For nodes with in-degree greater than 0, the level of node i is defined as:
[0033] ;
[0034] in, is the column number of the nonzero off-diagonal element in the i-th row of the lower triangular matrix L.
[0035] Furthermore: the process of solving the linear equation for each node includes:
[0036] The linear equation is decomposed using the triangular decomposition algorithm based on Gaussian elimination to obtain a triangular matrix;
[0037] The decomposed triangular matrix is used to perform forward and back substitution calculations to solve the unknown variables of the linear equation.
[0038] Further: in the previous generation process, the previous generation calculations are performed in parallel according to the different layer sets to which the nodes belong;
[0039] The triangular decomposition algorithm and the previous generation calculation start from layer i=0 and end at layer i=n-1, and the back generation calculation starts from layer i=n-1 and ends at layer i=0; in each layer, the number of GPU threads is allocated according to the number of sibling node sets at the current layer.
[0040] Furthermore, the triangular decomposition algorithm comprises the following steps:
[0041] Decomposing the Jacobian matrix formed by the linear equations into an upper triangular matrix and a lower triangular matrix using a triangular decomposition algorithm; solving for unknown variables of the nodes, the unknown variables including the voltage amplitude and voltage phase angle of the nodes;
[0042] The diagonal elements of the upper triangular matrix are updated and corrected; at the same time, the non-zero elements of the upper triangular matrix are corrected.
[0043] Furthermore, the operations of the forward generation and the back generation are:
[0044] ;
[0045] in, is the i-th element of the unknown variable; is the amount of imbalance; is the element in the i-th row and j-th column of the upper triangular matrix;
[0046] By means of previous generation and back generation calculations, unknown variables of the nodes of the weighted directed factor graph are updated.
[0047] The parallel solution system disclosed in the present invention for implementing the GPU parallel solution method for the power system linear equations includes a sparse decomposition thread tree establishment module, a node definition module, a thread allocation module and a GPU;
[0048] The sparse decomposition thread tree establishment module is used to generate a sparse decomposition thread tree for all nodes in the power system;
[0049] The node definition module is used to define the nodes of the sparse decomposition thread tree to form a brother node set;
[0050] The thread allocation module is used to match threads according to the brother node set of the sparse decomposition thread tree;
[0051] The GPU performs parallel computing based on threads at the same level.
[0052] Furthermore: the GPU includes a triangular decomposition module and a previous generation back generation calculation module;
[0053] The triangular decomposition module is used to decompose the linear equation based on the triangular decomposition algorithm of Gaussian elimination to obtain a triangular matrix;
[0054] The previous and back-substitution calculation module is used to perform previous and back-substitution calculations using the decomposed triangular matrix to solve the unknown variables of the linear equation.
[0055] The beneficial effects of the present invention are:
[0056] The present invention divides all nodes into different levels according to their distance from the initial node, establishes a sparse decomposition thread tree, and the sparse matrix calculations of nodes at the same level can be calculated in parallel at the same time. This can solve the problem of overlapping matrix calculations in the process of solving the power system power flow linear equations in the CPU+GPU heterogeneous mode, improve the execution efficiency of the power system parallel power flow calculation, and thus improve the online calculation practicality of large power grid power flow calculation.
[0057] The present invention proposes a GPU parallel computing method for matrix calculation of power grid power flow linear equations based on a sparse decomposition path thread tree of sibling nodes. All nodes are divided into different levels according to their distance from the initial node, and a sparse decomposition thread tree is established. Sparse matrix calculations for nodes at the same level can be performed in parallel. BroNode nodes are searched for nodes at the same level on the sparse decomposition path tree. Child nodes with the same parent node in the same layer are referred to as sibling nodes. A BroNodeSet set is established. Threads are allocated according to the BroNodeSet set during GPU parallel computing programming. Factor decomposition and previous generation back generation calculations of nodes in the BroNodeSet set are performed sequentially in the same thread. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 This is a schematic diagram of the layered BroNode-based sparse decomposition path thread tree;
[0059] Figure 2 This is a schematic diagram of the multi-threaded concurrent computing process based on BroNode;
[0060] Figure 3 This is a schematic diagram of the triangular decomposition algorithm based on Gaussian elimination;
[0061] Figure 4 It is a node diagram of the elimination operation with p as the axis;
[0062] Figure 5 is a schematic diagram of the original matrix A. DETAILED DESCRIPTION
[0063] The following are only preferred specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or replacements that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the scope of protection of the present invention. The embodiments described below are only used to explain the present invention and cannot be interpreted as limiting the present invention. The scope of protection of the present invention should be based on the scope of protection of the claims. The embodiments of the present invention are described in detail below. In order to facilitate the description of the present invention and simplify the description, the technical terms used in the description of the present invention should be interpreted broadly, including but not limited to conventional replacement schemes not mentioned in this application, and also including direct implementation and indirect implementation.
[0064] Example 1
[0065] Combine Figure 1-Figure 5 This embodiment describes a method for GPU parallel solving of linear equations in a power system, including the following steps:
[0066] An initial node is defined among all nodes of the power system, and the remaining nodes are divided into different levels according to their distance from the initial node, thereby establishing a sparse decomposition thread tree;
[0067] The steps of establishing a sparse decomposition thread tree include:
[0068] like Figure 4 and Figure 5 As shown in the figure, a weighted directed factor graph is used to describe all nodes of the power system; p, j, k and l are all nodes for power flow calculation, where p is the generating point, j, k and l are the receiving points;
[0069] On the weighted directed factor graph, among the edges emitted from each node, the edge with the smallest receiving node number is taken as the path on the sparse decomposition path graph.
[0070] The child nodes with the same parent node in the same level are called sibling nodes, and a sibling node set is established;
[0071] Allocating threads in the GPU according to the set of sibling nodes;
[0072] Perform sparse matrix parallel solution calculations on each node at the same level.
[0073] In performing sparse matrix solution calculations on each node, sparse matrix calculations on nodes at the same level are performed in parallel. The specific process includes:
[0074] In the sparse decomposition path graph of node j, the parent node number parent(j) of node j is defined as:
[0075] ;
[0076] Where, is the element in the p-th row and j-th column of the lower triangular matrix L in the Jacobian matrix A. Node p is called the parent node of node j, and node j is the child node of node p.
[0077] The in-degree In_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is less than i, that is:
[0078] ;
[0079] in, is the edge weight of each node j pointing to node i, i = p, j, k or l;
[0080] The out-degree Out_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is greater than i, that is:
[0081] ;
[0082] in, is the edge weight of node j starting from node i.
[0083] In the sparse matrix solution calculation for each node, the parent node starts to calculate only after the child node calculation is completed, thereby realizing the sparse decomposition path graph to be layered. The specific process of the layering includes:
[0084] Initial level of all nodes;
[0085] ;
[0086] In the formula, level (i) represents the i-th level;
[0087] Traverse all nodes and assign the node with in-degree 0 to level 0;
[0088] ;
[0089] For nodes with in-degree greater than 0, the level of node i is defined as:
[0090] ;
[0091] in, is the column number of the nonzero off-diagonal element in the i-th row of the lower triangular matrix L.
[0092] Based on the above analysis, the basic steps of GPU-based matrix decomposition and forward / backward parallel computing are as follows, with n-1 layers:
[0093] (1) All nodes are layered according to the above method;
[0094] (2) Starting from layer i=0 to layer i=n-1 (decomposition and previous generation calculation) or from layer i=n-1 to layer i=0 (back generation calculation), at each layer, the corresponding GPU threads are allocated according to the number of nodes in the layer to perform parallel calculations.
[0095] like Figure 5 As shown in the figure, the core problem of power system state estimation and power flow calculation can be reduced to solving a large set of linear algebraic equations. , A is the Jacobian matrix, x is the state variable in the power system, including voltage, amplitude, and phase angle, and b is the unbalanced variable. The unknown state variable x is obtained. The most common and effective method for solving linear algebraic equations is the direct method based on Gaussian elimination. Algorithms for parallel solving large sparse linear algebraic equations mainly include: triangular decomposition; forward and backward iteration.
[0096] Assuming state estimation, the generalized power flow matrix is a symmetric matrix, the symmetric matrix of the Jacobian matrix A. In order to save storage space, only the upper triangle is stored;
[0097] like Figure 5 As shown, the Jacobian matrix A is subjected to LDU decomposition, namely:
[0098] A=LDU, D is a diagonal matrix, L is a unit lower triangular matrix (diagonal elements are 1, upper triangular elements are all 0), U is a unit upper triangular matrix, lower triangular elements are all 0;
[0099] The process of solving the linear equations at each node includes:
[0100] The linear equation is decomposed using the triangular decomposition algorithm based on Gaussian elimination to obtain a triangular matrix;
[0101] like Figure 3 and Figure 4 As shown, the triangular decomposition algorithm based on Gaussian elimination is described as follows: when the p-th row and p-th column are eliminated;
[0102] For the elements of a diagonal matrix The update correction and elimination operation should be as follows:
[0103] ;
[0104] In the weighted directed graph, the edge weights of the edges sent by node p at the receiving points j, k, and l are modified, and the edge weights are reduced. ;
[0105] in, is the element in the p-th row and p-th column of the diagonal matrix;
[0106] is the element in the pth row and ith column of the upper triangular matrix.
[0107] like Figure 4 As shown, for the non-zero elements in the upper triangular part, there are three elements that need to be corrected, which are , , .
[0108] in, is the element in the jth row and kth column of the upper triangular matrix;
[0109] is the k-th row and l-th column element of the upper triangular matrix;
[0110] is the j-th row and l-th column element of the upper triangular matrix;
[0111] The formula for the elimination operation is:
[0112] ;
[0113] in, is the element in the i-th row and m-th column of the upper triangular matrix;
[0114] is the element in the i-th row and p-th column of the lower triangular matrix;
[0115] is the element in the pth row and mth column of the upper triangular matrix;
[0116] Because only the upper triangular part of the matrix is stored, Should use Instead, we have:
[0117] ;
[0118] After the nodes of the power flow calculation are optimized and numbered, the factor table matrix factorization process is to perform the following steps in ascending order of node numbers on the weighted directed factor graph. The processing of node p is used as an example:
[0119] Step (1) Divide the edge weight of the mutual edge sent by node p by the edge weight of node p;
[0120] Step (2) For the receiving point of the mutual edge sent by node p, the self-edge weight on that point is subtracted from the square of the mutual edge weight multiplied by the self-edge weight on node p;
[0121] ;
[0122] Step (3) For all mutual edges issued by node p, the weight of the mutual edges between each pair of these mutual edges should be reduced by the product of the weights of the two sandwiched edges and the weight of the node p's own edge. Before the operation, if there is no edge between the sandwiched node pairs, it can be regarded as having a zero-weight edge.
[0123] Step (4) Cover all edges connected to p, select the next node, and return to step (1).
[0124] Finally, the decomposed triangular matrix is used to perform forward and back substitution to solve the linear equation Unknown state quantity x.
[0125] In the previous generation process, the previous generation calculations are performed in parallel according to the different levels to which the nodes belong;
[0126] The triangular decomposition and forward generation calculation start from layer i=0 and end at layer i=n-1, and the back generation calculation starts from layer i=n-1 and ends at layer i=0; in each layer, the number of GPU threads is allocated according to the number of sibling node sets at the current layer.
[0127] The triangular decomposition algorithm comprises the following steps:
[0128] Decomposing the Jacobian matrix formed by the linear equations into an upper triangular matrix and a lower triangular matrix using a triangular decomposition algorithm; solving for unknown variables of the nodes, the unknown variables including the voltage amplitude and voltage phase angle of the nodes;
[0129] The diagonal elements of the upper triangular matrix are updated and corrected; at the same time, the non-zero elements of the upper triangular matrix are corrected.
[0130] The calculation process of the forward generation and back generation is:
[0131] ;
[0132] in, is the i-th element of the unknown variable; is the amount of imbalance; is the element in the i-th row and j-th column of the upper triangular matrix;
[0133] By means of previous generation and back generation calculations, unknown variables of the nodes of the weighted directed factor graph are updated.
[0134] If the points on the weighted directed factor graph are used Indicates that the edge weights of the mutual edges on the weighted directed factor graph are , then the above program can be written as:
[0135] ;
[0136] in, Represents the node position of node j, condition express is the edge weight of the edge emanating from node i, which implies This condition.
[0137] Normalization process: After the previous generation ends, the point position of node i Divided by the edge weight of node i on the weighted directed factor graph ,Right now
[0138] ;
[0139] This is the result of normalization.
[0140] Update the points on the weighted directed factor graph to the values after the previous generation and normalization. In this graph, the node number j starts from n and goes from large to small. The point positions of the starting node i of all edges pointing to j are corrected. The correction formula is:
[0141] ;
[0142] The steps for calculating the previous generation back substitution on a directed factor graph are as follows:
[0143] Assign the non-zero elements of the independent vector b to points on the weighted directed factor graph;
[0144] Scan i from 1 to n-1, using the formula , correct the point position of the opposite node j of the edge sent by node i;
[0145] For all nodes, use the formula Normalize the points;
[0146] Scan j from n to 2, and for all the nodes i that start at the edge pointing to node j, use the formula Correct its position.
[0147] Graph theory describes sparse matrix factorization and previous-generation back-generation computations, demonstrating that each node in matrix computations has certain forward and backward dependencies, while also allowing for a large amount of node parallelism. On a directed factor graph, the edge with the smallest incoming node number from each node is used as the path on the sparse decomposition path graph. The analysis of the current node only affects the amplitude and phase angle of the nodes on its own sparse decomposition path graph. Therefore, during the previous generation process, previous-generation computations can be performed in parallel, according to the different levels to which the nodes belong, without affecting each other. Sparse matrix computations on nodes at the same level can be performed in parallel because these nodes have upward dependencies, relying on the results of the nodes in the previous level.
[0148] like Figure 2 As shown, the triangular decomposition process is:
[0149] The processing process for node 1 is:
[0150] ;
[0151] Where, represents the element in the first row and third column of matrix A, represents the element in the 3rd row and 3rd column of matrix A, represents the element in row 1 and column 1 of matrix A, represents the element in the 1st row and 6th column of matrix A, represents the element in the 6th row and 6th column of matrix A, represents the element in the 6th row and 1st column of matrix A, represents the element in the 3rd row and 6th column of matrix A, Represents the element in the 3rd row and 1st column of matrix A;
[0152] The processing process for node 2 is:
[0153] ;
[0154] Where, represents the element in the 2nd row and 3rd column of matrix A, represents the element in row 2 and column 2 of matrix A, represents the element in the 2nd row and 8th column of matrix A, represents the element in row 8 and column 8 of matrix A, represents the element in the 3rd row and 3rd column of matrix A, represents the element in the 8th row and 2nd column of matrix A, represents the element in the 3rd row and 8th column of matrix A, Represents the element in the 3rd row and 2nd column of matrix A;
[0155] Previous generation calculation corresponding to node 1:
[0156] ;
[0157] Where, represents the element in row 1 and column 1 of matrix A, Represents the element in the first row of the right-hand side. 3 , Represents the element in the 6th row of the right-hand side. represents the first row and third column element in the upper triangular matrix U, represents the element in the 1st row and 6th column of the upper triangular matrix U;
[0158] Previous generation calculation corresponding to node 2:
[0159] ;
[0160] Where, represents the element in the first row and first column of the matrix, Represents the element in the second row of the right-hand side. Represents the element in the 8th row of the right-hand side. represents the element in the 2nd row and 3rd column of the upper triangular matrix U, Represents the 2nd row and 8th column element in the upper triangular matrix U;
[0161] The calculation of subsequent nodes is similar to the above and will not be repeated here.
[0162] From the above calculation process, it can be seen that when executing sequentially, when processing node 1, node 1 is connected to node 3, as shown in formula (1b) and formula (3b), 、 Diagonal elements of node 3 and the right-hand element There is an update calculation. When processing node 2, node 2 is connected to node 3, as shown in formula (2b) and formula (4b). 、 Diagonal elements of node 3 and the right-hand element There is an update calculation, and the result of the cumulative update is the same as the processing of node 1, that is:
[0163] ;
[0164] .
[0165] Example 2
[0166] This embodiment is described in conjunction with Example 1. The parallel solution system disclosed in this embodiment is used to implement the GPU parallel solution method for a power system linear equation system, including a sparse decomposition thread tree establishment module, a node definition module, a thread allocation module and a GPU;
[0167] The sparse decomposition thread tree establishment module is used to generate a sparse decomposition thread tree for all nodes in the power system;
[0168] The node definition module is used to define the nodes of the sparse decomposition thread tree to form a brother node set;
[0169] The thread allocation module is used to match threads according to the brother node set of the sparse decomposition thread tree;
[0170] The GPU performs parallel computing based on threads at the same level.
[0171] The GPU includes a triangular decomposition module and a previous generation back generation calculation module;
[0172] The triangular decomposition module is used to decompose the linear equation based on the triangular decomposition algorithm of Gaussian elimination to obtain a triangular matrix;
[0173] The previous and back-substitution calculation module is used to perform previous and back-substitution calculations using the decomposed triangular matrix to solve the unknown variables of the linear equation.
[0174] Example 3
[0175] This embodiment is described in conjunction with Example 1 and Example 2. This embodiment discloses a GPU parallel solution method for a power system linear equation system, such as Figure 2 As shown in the figure, the steps for GPU parallel solution of the power flow linear equations based on the sparse decomposition path thread tree of BroNode are as follows:
[0176] 1. The initial level of all nodes:
[0177] ;
[0178] 2. Then traverse all nodes and assign the node with in-degree 0 to level 0;
[0179] ;
[0180] For nodes with in-degree > 0, the level of node i is defined as:
[0181] ;
[0182] in, is the column number of the nonzero off-diagonal element in row i of the lower triangular matrix L;
[0183] 3. Establish a sparse decomposition path thread tree according to the above method;
[0184] 4. Traverse the nodes at the same level and put the nodes with the same parent node into the BroNodeSet;
[0185] 5. Starting from i=0 to i=n-1 layer (decomposition and previous generation calculation) or from i=n-1 layer to i=0 layer (back generation calculation), the number of GPU threads is allocated at each layer according to the number of sibling nodes in the current layer;
[0186] 6. Perform parallel computations on the current layer.
[0187] Calculation example 1:
[0188] As shown in Table 1: Taking a large power grid in a certain region as an example, the number of computing nodes in this power grid is 3956. Through the above-mentioned sparse decomposition path thread layering, the number of nodes in the 0th layer is 1586. The calculations between these nodes are independent of each other. Therefore, the matrix decomposition calculation kernel function can theoretically be allocated 1586 threads. However, through analysis, it is found that among these 1586 nodes, 79 nodes have the same parent node. If 1586 threads are allocated for parallel calculation, then the calculation of the parent nodes of these 79 nodes will cause errors.
[0189] As shown in Table 2, the second test case has 2027 compute nodes, including 995 level-0 compute nodes, 53 of which share a common parent node. While thread mutexes implemented using the atomic CAS function in CUDA can ensure the independence of memory access during multithreaded parallel execution, once a CUDA mutex locks a block of memory, all threads executing the current statement must wait for that memory block to be unlocked before continuing, significantly reducing parallel computing efficiency.
[0190] In Example 1, the 79 mutually exclusive threads are serial. After execution, other threads can proceed in parallel. During matrix decomposition in the above example, the average out-degree of each node is 3. Therefore, the processing of one matrix decomposition node requires an average of 8 multiplication and addition calculations. The test is run on a Linux server with a main frequency of 2.1 GHz, 8GB of memory, and an NVIDIA A40 GPU. The calculation time comparison of the above layer 0 is as follows, and the average value of multiple calculations is taken.
[0191] Table 1: Example 1
[0192]
[0193] Table 2: Example 2
[0194]
[0195] From the comparison of the time in Table 1 and Table 2 above, it can be seen that the method of the present invention greatly improves the calculation efficiency while ensuring the calculation accuracy.
Claims
1. GPU parallel solution method for power system linear equations, characterized by: The steps include: An initial node is defined among all nodes in the power system, and the remaining nodes are divided into different levels according to their distance from the initial node, thereby establishing a sparse decomposition thread tree; The steps of establishing a sparse decomposition thread tree include: A weighted directed factor graph is used to describe all nodes of the power system; p, j, k, and l are nodes for power flow calculation, where p is the generating point and j, k, and l are the receiving points; On the weighted directed factor graph, from the edges emitted from each node, the edge with the smallest receiving node number is taken as the path on the sparse decomposition path graph; The child nodes with the same parent node in the same level are called sibling nodes, and a sibling node set is established; Allocating threads in the GPU according to the set of sibling nodes; Perform sparse matrix parallel solution calculations on each node at the same level; In the parallel sparse matrix calculation for each node at the same level, the sparse matrix calculations for nodes at the same level are calculated in parallel at the same time. The specific process includes: In the sparse decomposition path graph of node j, the parent node number parent(j) of node j is defined as: ; Where, It is the element in the p-th row and j-th column of the lower triangular matrix L in the Jacobian matrix A. Node p is called the parent node of node j, and node j is the child node of node p. The in-degree In_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is less than i, that is: ; in, is the edge weight of each node j pointing to node i, i = p, j, k or l; The out-degree Out_Degree(i) of node i is defined as the sum of the number of nodes connected to node i and whose node number is greater than i, that is: ; in, is the edge weight of node j starting from node i; The process of solving the linear equations at each node includes: The linear equation is decomposed using the triangular decomposition algorithm based on Gaussian elimination to obtain a triangular matrix; Using the decomposed triangular matrix to perform forward and back substitution calculations to solve the unknown variables of the linear equation; The triangular decomposition algorithm comprises the following steps: Decomposing the Jacobian matrix formed by the linear equations into an upper triangular matrix and a lower triangular matrix using a triangular decomposition algorithm; solving for unknown variables of the nodes, the unknown variables including the voltage amplitude and voltage phase angle of the nodes; The diagonal elements of the upper triangular matrix are updated and corrected; at the same time, the non-zero elements of the upper triangular matrix are corrected.
2. The GPU parallel solution method for power system linear equations according to claim 1, characterized in that: In the parallel sparse matrix solution calculation for each node at the same level, the parent node starts to calculate only after the child node calculation is completed, thereby realizing the sparse decomposition path graph to be layered. The specific layering process includes: Initial level of all nodes; ; In the formula, level (i) represents the i-th level; Traverse all nodes and assign the node with in-degree 0 to level 0; ; For nodes with in-degree greater than 0, the level of node i is defined as: ; in, is the column number of the nonzero off-diagonal element in the i-th row of the lower triangular matrix L.
3. The GPU parallel solution method for power system linear equations according to claim 1, characterized in that: In the previous generation process, the previous generation calculations are performed in parallel according to the different layer sets to which the nodes belong; The triangular decomposition algorithm and the forward generation calculation are from layer i=0 to layer i=n-1, and the back generation calculation is from layer i=n-1 to layer i=0. In each layer, the number of GPU threads is allocated according to the number of sibling node sets in the current layer.
4. The GPU parallel solution method for power system linear equations according to claim 1, characterized in that: The calculation process of the forward generation and back generation is: ; in, is the i-th element of the unknown variable; is the amount of imbalance; is the element in the i-th row and j-th column of the upper triangular matrix; By means of previous generation and back generation calculations, unknown variables of the nodes of the weighted directed factor graph are updated.
5. A parallel solution system for implementing the GPU parallel solution method for power system linear equations according to any one of claims 1 to 4, characterized in that: It includes sparse decomposition thread tree building module, node definition module, thread allocation module and GPU; The sparse decomposition thread tree establishment module is used to generate a sparse decomposition thread tree for all nodes in the power system; The node definition module is used to define the nodes of the sparse decomposition thread tree to form a brother node set; The thread allocation module is used to match threads according to the brother node set of the sparse decomposition thread tree; The GPU performs parallel computing based on threads at the same level.
6. The parallel solution system of the GPU parallel solution method for power system linear equations according to claim 5, characterized in that: The GPU includes a triangular decomposition module and a previous generation back generation calculation module; The triangular decomposition module is used to decompose the linear equation based on the triangular decomposition algorithm of Gaussian elimination to obtain a triangular matrix; The previous and back-substitution calculation module is used to perform previous and back-substitution calculations using the decomposed triangular matrix to solve the unknown variables of the linear equation.
Citation Information
Patent Citations
Large-scale power grid flow correction equation parallel solving method
CN104158182A
System and method for re-factorizing a square matrix into lower and upper triangular matrices on a parallel processor
US20140196043A1