Electric power carbon emission factor calculation method, system and equipment based on QR matrix decomposition, medium and product
By constructing a power carbon emission factor calculation system based on QR matrix decomposition, the problems of large computational load and low accuracy of traditional methods in large-scale dynamic power grids are solved, and the carbon emission factor calculation is achieved quickly and accurately.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-10
AI Technical Summary
Traditional carbon emission calculation methods are computationally intensive and have poor real-time performance in large-scale dynamic power grids. They are difficult to accurately reflect the time-varying fluctuation characteristics of carbon emissions and cannot fully capture the complex nonlinear coupling relationships of the system, resulting in low calculation accuracy and reliability.
A QR matrix decomposition-based method is adopted to obtain the carbon emission information and power flow information of generators in the power grid, construct the node power balance equation and carbon emission conservation equation, and use the sparse matrix properties and QR decomposition to solve the linear equation of carbon emission factor to obtain the carbon emission factor value of each node.
It achieves rapid response and efficient calculation of multi-node carbon emission factors, improves the accuracy and reliability of carbon emission factor calculation, avoids the risk of slow convergence or failure of iterative methods, and has excellent numerical stability.
Smart Images

Figure CN121834100A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of carbon emission calculation, and in particular to a power carbon emission factor calculation method, system, device, medium and product based on QR matrix decomposition. BACKGROUND
[0002] As one of the main sources of carbon emissions, the accurate calculation of carbon emission factors in the power industry plays a key role in guiding the transformation of low-carbon energy structure and decision support. Traditional carbon emission calculation methods mostly rely on power flow analysis of the power system, by analyzing node voltage, power injection and line transmission capacity and other parameters, to determine the flow path of electric energy in the system, and thus to infer the load distribution of each node and the power output of the generator set. Combined with the fuel characteristics and combustion efficiency of each generator set, the carbon emissions of different parts of the system are further estimated. This method has certain theoretical basis and practical value, and is widely used in carbon emission assessment of static power grids.
[0003] However, with the continuous expansion of the power grid and the increasingly dynamic and complex operating conditions, the traditional carbon emission calculation based on power flow faces many challenges. First, the calculation of power flow in a complex large-scale system is computationally intensive, and real-time calculation is difficult and significantly affected by the current state of the system. Second, these methods are highly dependent on generator dispatching strategies and load change data, lack effective real-time dispatching coordination and optimization support, and are difficult to accurately reflect the time-varying fluctuation characteristics of carbon emissions. In addition, many models use simplified linear or nonlinear assumptions in the solving process to reduce complexity, which cannot fully capture the complex nonlinear coupling relationships in system operation. The above problems seriously limit the application effect of traditional methods in real-time carbon emission dynamic assessment of power grid operation, resulting in poor accuracy and low reliability of carbon emission calculation. SUMMARY
[0004] Therefore, in order to solve the above technical problems, the present application provides a power carbon emission factor calculation method, system, device, medium and product based on QR matrix decomposition.
[0005] The first aspect of the present application provides a power carbon emission factor calculation method based on QR matrix decomposition, comprising:
[0006] Obtaining carbon emission information and power flow power information of each generator in the power grid;
[0007] According to the carbon emission information and the power flow power information, determining a node power balance equation and a carbon emission conservation equation;
[0008] Based on the node power balance equation and the carbon emission conservation equation, a linear equation for the carbon emission factor is constructed; wherein, the linear equation for the carbon emission factor is used to characterize the correlation between the sparse matrix, the right-hand vector, and the carbon emission factor of each node.
[0009] The linear equation of the carbon emission factor is solved based on QR matrix decomposition to obtain the carbon emission factor value of each node.
[0010] Preferably, the carbon emission information includes the node number corresponding to each generator, the actual power generation, and the carbon emission factor; the power flow information includes the active power of each node in the power grid and the power exchange power between nodes.
[0011] The step of determining the nodal power balance equation and the carbon emission conservation equation based on the carbon emission information and the power tidal flow information includes:
[0012] Based on the node number corresponding to each generator, the actual generated power is allocated to the corresponding node, and the node power balance equation is established in combination with the active power.
[0013] The carbon emissions of local power generation are obtained by multiplying the carbon emission factor of each generator by its active power. Based on the carbon emissions of local power generation, the carbon emissions from power exchange between neighboring nodes, and the total carbon emissions of each node, a carbon emission conservation equation is constructed.
[0014] Preferably, constructing a linear equation for the carbon emission factor based on the node power balance equation and the carbon emission conservation equation includes:
[0015] The nodal power balance equation and the carbon emission conservation equation are rearranged to obtain a linear equation form;
[0016] The coefficient matrix in the linear equation form is rearranged into a sparse matrix, and the right-hand vector is determined.
[0017] Based on the correlation between the sparse matrix, the right-hand vector, and the carbon emission factors of each node, a linear equation for the carbon emission factors is constructed.
[0018] Preferably, the method further includes:
[0019] The carbon emission information and the tidal power information are validated for data format, and the carbon emission information and the tidal power information are corrected according to the data format validation results.
[0020] Preferably, the method further includes:
[0021] Based on the power exchange between nodes in the power flow information, a logical adjacency matrix is constructed; wherein, if there is power exchange between two nodes, the position corresponding to the node in the logical adjacency matrix is 1, and if there is no power exchange between two nodes, the position corresponding to the node in the logical adjacency matrix is 0.
[0022] Based on the connectivity analysis of the logical adjacency matrix, all nodes in the power grid are divided into connected regions, and all independent connected components are determined based on the results of the connected region division.
[0023] The linear equation for the carbon emission factor is broken down into sub-equations corresponding to each connected component;
[0024] For each of the connected components, the node with the largest power generation in the connected component is used as the reference node, and a weighted average carbon factor is determined based on the total carbon emissions and total power of all local power generation in the connected component.
[0025] The sub-equations corresponding to the reference nodes are corrected based on the weighted average carbon factor, and the corrected sub-equations are combined to obtain the corrected linear equation of carbon emission factor.
[0026] Preferably, the step of solving the linear equation of the carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value for each node includes:
[0027] QR matrix decomposition is performed on the sparse matrix in the linear equation of the carbon emission factor to obtain an orthogonal matrix and an upper triangular matrix.
[0028] Based on the orthogonal matrix and the upper triangular matrix, the linear equation of the carbon emission factor is transformed into a system of upper triangular equations;
[0029] The upper triangular equations are simplified by using predefined intermediate variables, and the simplified upper triangular equations are solved step by step by using the back substitution method to obtain the carbon emission factor values of each node.
[0030] Secondly, the present invention also provides a power carbon emission factor calculation system based on QR matrix decomposition, comprising:
[0031] The information acquisition module is used to acquire carbon emission information and power flow information of each generator in the power grid;
[0032] The first equation determination module is used to determine the nodal power balance equation and the carbon emission conservation equation based on the carbon emission information and the power tidal flow information.
[0033] The second equation determination module is used to construct a linear equation for carbon emission factors based on the node power balance equation and the carbon emission conservation equation; wherein, the linear equation for carbon emission factors is used to characterize the correlation between the sparse matrix, the right-hand vector and the carbon emission factors of each node.
[0034] The carbon factor calculation module is used to solve the linear equation of the carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value of each node.
[0035] Thirdly, the present invention also provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program, the computer program being executed by the processor causing the processor to perform the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the first aspect.
[0036] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the first aspect.
[0037] Fifthly, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein, when the program instructions are executed by a computer, the computer performs the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the first aspect.
[0038] As can be seen from the above technical solutions, this invention obtains the carbon emission information and power flow information of each generator in the power grid, determines the node power balance equation and carbon emission conservation equation, constructs the linear equation of carbon emission factor, solves the linear equation of carbon emission factor based on QR matrix decomposition, and obtains the carbon emission factor value of each node. Thus, it utilizes the sparse matrix characteristics and QR decomposition to solve efficiently, achieves a fast response in solving the carbon emission factor of multiple nodes, does not depend on the initial solution setting, avoids the risk of slow convergence or failure of the iterative method, has excellent numerical stability, and improves the accuracy and reliability of carbon emission factor calculation. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1An application environment diagram of a method for calculating the carbon emission factor of electricity based on QR matrix decomposition provided in an embodiment of the present invention;
[0041] Figure 2 A flowchart of a method for calculating the carbon emission factor of electricity based on QR matrix decomposition is provided for embodiments of the present invention;
[0042] Figure 3 A schematic diagram of the structure of a power carbon emission factor calculation system based on QR matrix decomposition provided in an embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0044] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0045] The electricity carbon emission factor calculation method based on QR matrix decomposition provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 101 communicates with server 102 via a network. A data storage system can store the data that server 102 needs to process. The data storage system can be integrated onto server 102 or placed in the cloud or on other network servers. Terminal 101 or server 102 acquires carbon emission information and power flow information of each generator in the power grid; based on the carbon emission information and power flow information, it determines the node power balance equation and carbon emission conservation equation; based on the node power balance equation and carbon emission conservation equation, it constructs a linear equation for the carbon emission factor; wherein, the linear equation for the carbon emission factor is used to characterize the correlation between the sparse matrix, the right-hand vector, and the carbon emission factor of each node; the linear equation for the carbon emission factor is solved based on QR matrix decomposition to obtain the carbon emission factor value of each node.
[0046] Terminal 101 can be, but is not limited to, various personal computers, laptops, smartphones, and tablets.
[0047] Server 102 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0048] like Figure 2As shown, this application provides a method for calculating the carbon emission factor of electricity based on QR matrix decomposition, which is then applied to... Figure 1 Taking terminal 101 or server 102 as an example, the explanation includes the following steps S1 to S4. Wherein:
[0049] Step S1: Obtain carbon emission information and power flow information of each generator in the power grid.
[0050] This involves the systematic and standardized organization and processing of node numbers, branch numbers, and related power and carbon factor data within the power grid. The node list, serving as the unique identifier for each node in the power system, forms the data foundation of the entire calculation model, and the uniqueness and continuity of the numbers must be ensured. The branch list clearly describes the connection relationships between nodes in the network, including information on the starting and ending nodes, laying the foundation for constructing the topology matrix.
[0051] Carbon emission information includes the node number, actual power generation, and carbon emission factor of each generator; power flow information includes the active power of each node in the power grid and the power exchange between nodes.
[0052] In one example, carbon emission information is presented in matrix form. The carbon emission factor of the generator is obtained as follows: First, fuel type identification is performed by reading the generator's fuel type (coal, diesel, natural gas, hydropower, photovoltaic, wind power, nuclear power) from power system data; second, based on internationally accepted life cycle assessment databases and national standards, minimum and maximum values are set for each fuel; finally, the arithmetic mean of the minimum and maximum values is taken as the generator's carbon emission factor. These parameters collectively reflect the generator's specific contribution to carbon emissions in the power grid.
[0053] Power flow information is presented as a power flow matrix, which needs to show the directed power exchange between each node in detail. It is necessary to accurately record the power injection of the nodes. The power flow matrix is obtained from the power flow results of the power system. After executing the power flow operation results, the power flow matrix includes the active power of each node in the power grid and the power exchange between nodes, reflecting the power consumption and flow characteristics through different nodes, thereby ensuring the authenticity and completeness of the basic data for carbon emission calculation.
[0054] After obtaining the carbon emission information and power flow information of each generator, the data format of the carbon emission information and power flow information is verified, and the carbon emission information and power flow information are corrected according to the data format verification results.
[0055] Specifically, when validating the data format of carbon emission information and power flow information, the system checks whether the data conforms to predetermined format specifications, such as whether the data type is correct, whether the data is complete, and whether the data is within a reasonable range. If errors or non-compliance with specifications are found in the data format, a correction mechanism is immediately triggered. For carbon emission information, corrections may include adjusting the numerical range of the carbon emission factor, correcting errors in node numbers, or supplementing missing actual power generation data. For power flow information, corrections may involve adjusting the active power value, correcting the direction or magnitude of power exchange between nodes, and supplementing missing power exchange data. Through data format validation and correction, the carbon emission information and power flow information of each generator meet the data format validation conditions, ensuring the accuracy of the data used in subsequent calculations, thereby improving the accuracy and reliability of carbon emission calculations.
[0056] Step S2: Determine the nodal power balance equation and carbon emission conservation equation based on carbon emission information and power tidal flow information.
[0057] The power grid is viewed as a complex network consisting of several nodes and branches connecting them. Each node generates its own power, receives power from other nodes via branches, and is responsible for transmitting power to loads or other nodes. To consider the carbon emission factors of all nodes in the grid, the mathematical relationship between these energy flows and carbon emissions must be accurately reflected. The node power balance equation precisely expresses the power flow relationships between nodes and the local generation carbon emission characteristics. By establishing a system of linear equations, the carbon emission factors between nodes can be calculated and correlated.
[0058] The carbon emission conservation equation, based on the principles of energy conservation and carbon emission transfer, is used to ensure the overall balance of carbon emissions in the entire power grid system. Specifically, it considers carbon emissions from local power generation, carbon emissions carried by power exchange between nodes, and the total carbon emissions of the entire power grid system. By constructing this equation, the carbon emission correlations between different nodes in the power grid can be further revealed, providing an important basis for subsequent carbon emission factor calculations. When constructing the carbon emission conservation equation, it is necessary to analyze in detail the sources and destinations of carbon emissions at each node, including carbon emissions from local power generation, carbon emissions carried by power received from other nodes, and carbon emissions carried away by power sent to other nodes. By comprehensively considering these factors, the accuracy and reliability of the carbon emission conservation equation can be ensured.
[0059] Step S3: Construct a linear equation for carbon emission factors based on the node power balance equation and the carbon emission conservation equation; wherein, the linear equation for carbon emission factors is used to characterize the correlation between the sparse matrix, the right-hand vector and the carbon emission factors of each node.
[0060] Among them, the linear equation of carbon emission factor is a mathematical form that integrates the nodal power balance equation and the carbon emission conservation equation to form a solvable linear equation system.
[0061] In this system of equations, the sparse matrix represents the power flow and carbon emission transfer relationships between nodes in the power grid, with its non-zero elements corresponding to the actual power exchange and carbon emission transfer between nodes. The vector on the right side contains the known carbon emission and power information of each node in the power grid, such as the carbon emissions from local power generation and the active power of the node. The carbon emission factor of each node is the unknown quantity that this system of equations needs to solve for. By constructing such a linear equation for the carbon emission factor, we can use mathematical methods (such as QR matrix factorization) to solve for the carbon emission factor value of each node, thereby achieving accurate calculation and analysis of the power grid's carbon emissions. When constructing the linear equation for the carbon emission factor, it is necessary to ensure the accuracy and sparsity of the equation to improve the solution efficiency and computational accuracy.
[0062] Step S4: Solve the linear equation of carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value of each node.
[0063] QR matrix decomposition is a linear algebraic method that decomposes a matrix into the product of an orthogonal matrix and an upper triangular matrix. When solving the linear equation for the carbon emission factor, we first perform QR matrix decomposition on the sparse matrix to obtain the orthogonal matrix Q and the upper triangular matrix R. The key to this step is utilizing the properties of orthogonal matrices to transform the original system of equations into a more easily solvable form.
[0064] It should be noted that, in this embodiment of the application, carbon emission information and power flow information of each generator in the power grid are obtained to determine the node power balance equation and carbon emission conservation equation, thereby constructing a linear equation for the carbon emission factor. The linear equation for the carbon emission factor is solved based on QR matrix decomposition to obtain the carbon emission factor value of each node. This method utilizes the sparse matrix properties and QR decomposition to solve the problem efficiently, achieving a fast response in solving the carbon emission factor of multiple nodes. It also does not depend on the initial solution setting, avoiding the risk of slow convergence or failure of the iterative method. The numerical stability is excellent, improving the accuracy and reliability of the carbon emission factor calculation.
[0065] In some embodiments, carbon emission information includes the node number corresponding to each generator, the actual power generation, and the carbon emission factor; power flow information includes the active power of each node in the power grid and the power exchange power between nodes; in this case, based on the carbon emission information and the power flow information, the node power balance equation and the carbon emission conservation equation are determined, including:
[0066] Step S201: Based on the node number corresponding to each generator, allocate the actual power generation to the corresponding node, and establish the node power balance equation in combination with the active power.
[0067] By identifying the node number corresponding to each generator, the specific location of each generator in the power grid can be determined, thus accurately allocating its actual power generation to the corresponding node. Simultaneously, by combining the active power data of each node in the power grid, considering the node's own power generation, the power injected from other nodes, and the power transferred to loads or other nodes, and based on the power balance principle—that the total power flowing into a node equals the total power flowing out of a node plus the power consumed by the node itself—a node power balance equation is established. This node power balance equation is:
[0068] (1)
[0069] In the formula, Let i be the total power of node i. This refers to the local generator power. Power injected into neighboring nodes The total power injected into all neighboring nodes of node i.
[0070] Step S202: Based on the product of the carbon emission factor and active power of each generator, the carbon emission of local power generation is obtained. Based on the carbon emission of local power generation, the carbon emission brought about by the power exchange between neighboring nodes, and the total carbon emission of each node, a carbon emission conservation equation is constructed.
[0071] Of which, the carbon emissions from locally generated electricity are:
[0072] (2)
[0073] In the formula, Carbon emissions from local power generation, For nodes The generator set on the site, Let g be the active power of the generator. Let g be the carbon emission factor of the generator.
[0074] Wherein, the total carbon emissions of node i are equal to the product of the total power of node i and the carbon emission factor of node i, i.e.
[0075] (3)
[0076] In the formula, Let i be the total carbon emissions of node i. Let be the carbon emission factor of node i, which is an unknown value to be solved.
[0077] The total carbon emissions of a node are equal to the sum of the carbon emissions from local power generation and the carbon emissions from power exchange with neighboring nodes. Therefore, combining the formula (3) for the total carbon emissions of a node mentioned above, the carbon emission conservation equation is:
[0078] (4)
[0079] In the formula, For the set of neighboring nodes, Inject the power from neighbor node j into i. Let be the carbon emission factor of neighboring node j.
[0080] In some embodiments, a linear equation for the carbon emission factor is constructed based on the node power balance equation and the carbon emission conservation equation, including:
[0081] Step S301: Perform conservation and rearrangement on the nodal power balance equation and carbon emission conservation equation to obtain the linear equation form.
[0082] In this process, by combining the nodal power balance equation, the carbon emission conservation equation, i.e., formula (4), is rearranged by moving all terms containing the unknown (carbon emission factor of node i) to the left side, resulting in the linear equation form:
[0083] (5)
[0084] Step S302: Rearrange the coefficient matrix in the linear equation form into a sparse matrix and determine the right-hand vector.
[0085] Here, it is assumed that the power grid has n nodes, and each node corresponds to a system of equations. The first line represents a row, where A is a sparse matrix and x is the carbon emission factor of each node to be solved. This is the vector on the right side.
[0086] matrix As the coefficient matrix (sparse matrix) in the linear equation form, it plays a crucial role in reflecting the entire power system network structure and power flow relationships. It encompasses not only the active power output of each node's own generators but also the power injected into that node by neighboring nodes through transmission lines. By summarizing and organizing these power contributions, the matrix... This accurately represents the complex interactions between power transmission and carbon emissions between nodes. Since the node and line connections in a real power grid are often very sparse, matrix A is stored as a sparse matrix, which not only significantly reduces memory usage and computational complexity but also closely matches the physical topology of the power system. This design ensures that when constructing and solving the electric carbon factor equations, the transmission patterns of power and carbon emission factors in the power network can be captured efficiently and accurately, providing a solid mathematical foundation for dynamic analysis of carbon emissions across the entire network. The construction of the coefficient matrix reflects the balance of node power and the flow constraints of carbon emissions.
[0087] Specifically, the elements of matrix A (an n × n sparse matrix) include the diagonal elements. (i-th row, i-th column) and non-diagonal elements (in the i-th row and j-th column, (j≠i)), where:
[0088] diagonal elements Corresponding to The coefficient, i.e. = If node j is a neighbor of i (power exchange exists), then off-diagonal elements... for- If node j is not a neighbor of i, or a non-diagonal element =0 (reflecting the sparsity of the matrix).
[0089] Right-hand vector This is the right-hand side constant vector in the linear equation form, representing the carbon emission contribution directly from the generators connected to the nodes in the system. It is a weighted multiplication and summation of the generator's active power output and relevant electrical carbon factors, thus quantitatively reflecting the magnitude of the carbon emission "source term" at each node. (Vector) The defined vector clarifies the starting point of carbon emissions in the network, serving as the boundary condition for the equation system and providing fundamental input data for subsequent calculations of carbon emission factor distribution. This vector effectively distinguishes the differences in the roles of different generators in node carbon emissions, enabling the calculation of carbon flow in the power grid to truly combine generation characteristics with actual power output.
[0090] Specifically, the right-hand vector Let be the constant term on the right-hand side of the linear equation, i.e.:
[0091] (6)
[0092] Carbon emission factors of each node to be solved This is an unknown quantity in the linear equation form, storing the electrical carbon factor values of all nodes in the power system. Each element corresponds to the electrical carbon factor of a node, characterizing the carbon dioxide emissions contained in a unit of electricity consumption or transmission at that node. Solving this vector reveals the spatial distribution characteristics of carbon emissions driven by generator carbon emissions, formed through grid power flow transmission, allocation, and inter-node coupling effects, namely:
[0093] (7)
[0094] In the formula, It is a node The carbon emission factor reflects the carbon emission intensity corresponding to a unit of electricity consumption. is the total number of nodes in the power grid, and T is the matrix transpose.
[0095] Step S303: Construct a linear equation for carbon emission factors based on the correlation between the sparse matrix, the right-hand vector, and the carbon emission factors of each node.
[0096] The linear equation for carbon emission factors is: .
[0097] In some embodiments, due to the linear equation of carbon emission factors The equations are derived based on power balance and carbon emission conservation. However, when the power grid has multiple connected components (independent subnets), the equations become linearly dependent. Connected components are independent subnets in the power grid that do not exchange power with each other (such as two unconnected substation areas). The power balance equations of all nodes within each connected component are linearly dependent (the total power / total carbon emissions of the entire component are conserved, which is equivalent to the sum of the equations of all nodes being 0). Actual power grid systems often contain multiple independent connected regions (connected components). Such a block structure leads to the node power balance equations having local "translation invariance," or in other words, a lack of sufficient constraints, thus causing matrix rank deficiency and linear equations of carbon emission factors. Problems such as those with no unique solution.
[0098] Therefore, this method also includes:
[0099] Step S31: Construct a logical adjacency matrix based on the power exchange between nodes in the power flow information; where, if there is power exchange between two nodes, the corresponding position of the node in the logical adjacency matrix is 1, and if there is no power exchange between two nodes, the corresponding position of the node in the logical adjacency matrix is 0.
[0100] The logical adjacency matrix is an n×n matrix (where n is the total number of nodes in the power grid), and its elements reflect the power exchange status between nodes. Specifically, the element A in this matrix... ij (i,j=1,2,...,n) is defined as follows: if there is power exchange between node i and node j (i.e., there is a transmission line connection and the power is not zero), then A ij =1; conversely, if there is no power exchange between node i and node j (no direct connection or zero power), then A ij =0. By constructing such a logical adjacency matrix, the topology of the power grid can be clearly depicted, that is, which nodes are directly connected and which nodes are isolated or belong to different connected components.
[0101] Step S32: Based on the connectivity analysis of the logical adjacency matrix, divide all nodes in the power grid into connected regions, and determine all independent connected components based on the connected region division results.
[0102] Based on connectivity analysis of the logical adjacency matrix, depth-first search can be used to partition all nodes in the power grid into connected regions. Starting from the initial node, the search proceeds along a path to explore the grid nodes as deeply as possible until no further progress is possible. Then, it backtracks and explores other paths. This process identifies all sets of interconnected nodes, i.e., connected regions. Each connected region represents an independent subnetwork where nodes are interconnected through power exchange, while there is no direct power exchange between different connected regions. Based on the connected region partitioning results, all independent connected components in the power grid can be identified, exhibiting relative independence in terms of power balance and carbon emission conservation.
[0103] Step S33: Decompose the linear equation of carbon emission factor into sub-equations corresponding to each connected component.
[0104] The original linear equation for the carbon emission factor, Ax=B, is decomposed based on all independent connected components in the power grid. For each connected component, since its nodes are relatively independent in terms of power balance and carbon emission conservation, a corresponding sub-equation can be constructed separately. Specifically, for each connected component, the coefficient matrix elements and right-hand vector elements corresponding to all nodes within that component are extracted, forming a sub-coefficient matrix and sub-right-hand vector for that component. Based on this, a sub-equation containing only the nodes within that connected component is constructed. The sub-equation is as follows:
[0105] A m x m =B m (8)
[0106] In the formula, m is the index of the connected component, and A m Let x be the subcoefficient matrix of the connected component m. m B is the unknown for the connected component m. m Let be the right-hand vector of the connected component m.
[0107] Step S34: For each connected component, take the node with the largest power generation in the connected component as the reference node, and determine the weighted average carbon factor based on the total carbon emissions and total power of all local power generation in the connected component.
[0108] In this process, for each connected component, the node with the highest power generation is selected as the reference node. This selection is based on the node's dominant position in power output and can better represent the power generation characteristics of the entire connected component. Subsequently, the weighted average carbon factor is determined by calculating the ratio of the total carbon emissions and total power of all local power generation within the connected component. Specifically, the weighted average carbon factor is calculated by dividing the sum of the carbon emissions of all generators within the connected component by the sum of their active power, i.e.:
[0109] (9)
[0110] In the formula, This is the set matrix of generators for the entire system.
[0111] Step S35: Correct the sub-equations corresponding to the reference nodes based on the weighted average carbon factor, and combine the corrected sub-equations to obtain the corrected linear equations for carbon emission factors.
[0112] In this process, the row corresponding to the reference node is replaced from the original power balance equation with the anchoring constraint equation, i.e.:
[0113] = (10)
[0114] Corresponding to sub-coefficient matrix A m In the row where the reference node is located, only the column coefficient corresponding to the reference node is 1, and the coefficients of the other columns are 0 (i.e., a unit row vector).
[0115] Corresponding to the right-hand vector B m The element at the reference node's position is set to .
[0116] After correcting the sub-equations corresponding to the reference nodes, the corrected sub-equations are recombinated according to their positional relationships in the original linear equations. Specifically, the corrected sub-coefficient matrix A of each connected component is... m Arrange them according to their positions in the original global coefficient matrix A to form a new global coefficient matrix A'; similarly, modify the right-hand vectors B of each connected component. m The corresponding positions are combined to form a new overall right-hand vector B'. This yields the modified linear equation for the carbon emission factor, A'x = B'. This modified equation, by introducing a weighted average carbon factor and anchoring constraint equations, effectively solves problems such as matrix rank deficiency and lack of unique solutions caused by the presence of multiple connected components in the power grid. This allows for a more accurate and stable solution to the carbon emission factor of each node, taking into account the actual topology and power exchange characteristics of the power grid.
[0117] In some embodiments, the linear equation of carbon emission factors is solved based on QR matrix decomposition to obtain the carbon emission factor values for each node, including:
[0118] Step S401: Perform QR matrix decomposition on the sparse matrix in the linear equation of carbon emission factors to obtain an orthogonal matrix and an upper triangular matrix.
[0119] Here, QR matrix decomposition is the decomposition of coefficient matrix A into orthogonal matrix Q (satisfying Q... TQ=I, where I is the identity matrix, and the upper triangular matrix R; combined with column pivoting permutation (to avoid amplifying numerical errors), the final decomposition form is:
[0120] AP=QR (11)
[0121] In the formula, P is the column permutation matrix.
[0122] Step S402: Based on the orthogonal matrix and the upper triangular matrix, convert the linear equation of the carbon emission factor into a system of upper triangular equations.
[0123] Specifically, based on the orthogonal matrix and the upper triangular matrix, both sides of the linear equation Ax=B for the carbon emission factor are simultaneously multiplied on the left by the transpose P of the column permutation matrix P. T And the transpose Q of the orthogonal matrix Q T Because of Q T Q=I, and A=QRP T Substituting this into the linear equation for carbon emission factors, Ax=B, we get:
[0124] QRP T x=B (12)
[0125] Since Q is an orthogonal matrix, multiplying both sides by Q... T The equation simplifies to:
[0126] RP T x=Q T B (13)
[0127] Step S403: Simplify the upper triangular equation system by using predefined intermediate variables, and use the back substitution method to solve the simplified upper triangular equation system step by step to obtain the carbon emission factor value of each node.
[0128] Here, we define an intermediate variable y and let y = P. T x, then the upper triangular equation system can be further simplified to:
[0129] Ry=C (14)
[0130] Where C=Q T B.
[0131] Since R is a full-rank upper triangular matrix, we can directly solve for y using the back substitution method. Specifically, we solve for y sequentially, starting from the last row of R. n ,y n-1 ..., y1, then from y=P T x, multiply both sides by P(P) T P=I), therefore:
[0132] x=Py (15)
[0133] The resulting x is the carbon emission factor vector for each node (already matched to the original node numbering order), such as:
[0134] (16)
[0135] In the formula, vector The 1st to the 1st A subvector consisting of elements. It is an upper triangular matrix. Let A be the rank of matrix A. These are the first r components of the y vector.
[0136] When the matrix is rank deficient, complete back substitution is impossible. In this case, the equation has infinitely many solutions. To select the most "reasonable" one, we use the "least norm solution in the least squares sense." The logic is to... Extract the non-zero "valid parts" of the matrix and solve for the corresponding values. For the first few terms, set the remaining undetermined free variables to 0.
[0137] The QR matrix algorithm exhibits excellent adaptive processing capabilities. In power system networks, due to topology, faulty equipment, and other practical operating conditions, the constructed nodal power balance equations may not have a full-rank matrix, making direct inversion impossible to obtain a unique solution. QR decomposition determines the rank of the effective matrix by thresholding the absolute values of the diagonal elements of the R matrix and automatically identifies rank-deficient parts. When rank is deficient, the algorithm employs a minimum norm solution strategy, which minimizes the norm of the solution vector in the least-squares sense for the non-full-rank matrix, thus ensuring the physical rationality of the calculation results. This adaptive capability ensures that the calculation program remains stable and reliable in real-world application scenarios involving network anomalies or temporary disconnections, preventing calculation failures or error propagation due to matrix singularities.
[0138] Based on the same inventive concept, this application also provides a QR matrix decomposition-based power carbon emission factor calculation system for implementing the above-mentioned QR matrix decomposition-based power carbon emission factor calculation method.
[0139] The solution provided by this system is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the electricity carbon emission factor calculation system based on QR matrix decomposition provided below can be found in the limitations of the electricity carbon emission factor calculation method based on QR matrix decomposition above, and will not be repeated here.
[0140] like Figure 3 As shown in the figure, this application provides a power carbon emission factor calculation system based on QR matrix decomposition, including:
[0141] The information acquisition module 100 is used to acquire carbon emission information and power flow information of each generator in the power grid;
[0142] The first equation determination module 200 is used to determine the nodal power balance equation and the carbon emission conservation equation based on carbon emission information and power flow information.
[0143] The second equation determination module 300 is used to construct a linear equation for carbon emission factors based on the node power balance equation and the carbon emission conservation equation; wherein, the linear equation for carbon emission factors is used to characterize the correlation between the sparse matrix, the right-hand vector and the carbon emission factors of each node.
[0144] The carbon factor calculation module 400 is used to solve the linear equation of carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value of each node.
[0145] like Figure 4 As shown in the embodiment of this application, an electronic device is provided. The electronic device 10 includes a memory 20 and a processor 30. The memory 20 stores a computer program. When the computer program is executed by the processor 30, the processor 30 performs the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the above embodiment.
[0146] This application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed, it implements the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the above embodiments.
[0147] This application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, wherein when the program instructions are executed by a computer, the computer performs the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in the above embodiments.
[0148] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, electronic devices, computer storage media, and computer program products described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0149] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0150] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0151] In the several embodiments provided by this invention, it should be understood that the disclosed systems, electronic devices, computer storage media, computer program products, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0152] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0153] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0154] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for executing all or part of the steps of the methods described in the various embodiments of the present invention through a computer device (which may be a personal computer, a server, or a network device, etc.). The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0155] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for calculating the carbon emission factor of electricity based on QR matrix decomposition, characterized in that, include: Obtain carbon emission information and power flow information of each generator in the power grid; Based on the carbon emission information and the power tidal flow information, determine the nodal power balance equation and the carbon emission conservation equation; Based on the node power balance equation and the carbon emission conservation equation, a linear equation for the carbon emission factor is constructed; wherein, the linear equation for the carbon emission factor is used to characterize the correlation between the sparse matrix, the right-hand vector, and the carbon emission factor of each node. The linear equation of the carbon emission factor is solved based on QR matrix decomposition to obtain the carbon emission factor value of each node.
2. The method for calculating the carbon emission factor of electricity based on QR matrix decomposition according to claim 1, characterized in that, The carbon emission information includes the node number, actual power generation, and carbon emission factor of each generator; the power flow information includes the active power of each node in the power grid and the power exchange power between nodes. The step of determining the nodal power balance equation and the carbon emission conservation equation based on the carbon emission information and the power tidal flow information includes: Based on the node number corresponding to each generator, the actual generated power is allocated to the corresponding node, and the node power balance equation is established in combination with the active power. The carbon emissions of local power generation are obtained by multiplying the carbon emission factor of each generator by its active power. Based on the carbon emissions of local power generation, the carbon emissions from power exchange between neighboring nodes, and the total carbon emissions of each node, a carbon emission conservation equation is constructed.
3. The method for calculating the carbon emission factor of electricity based on QR matrix decomposition according to claim 2, characterized in that, The construction of a linear equation for the carbon emission factor based on the node power balance equation and the carbon emission conservation equation includes: The nodal power balance equation and the carbon emission conservation equation are rearranged to obtain a linear equation form; The coefficient matrix in the linear equation form is rearranged into a sparse matrix, and the right-hand vector is determined. Based on the correlation between the sparse matrix, the right-hand vector, and the carbon emission factors of each node, a linear equation for the carbon emission factors is constructed.
4. The method for calculating the carbon emission factor of electricity based on QR matrix decomposition according to any one of claims 1 to 3, characterized in that, Also includes: The carbon emission information and the tidal power information are validated for data format, and the carbon emission information and the tidal power information are corrected according to the data format validation results.
5. The method for calculating the carbon emission factor of electricity based on QR matrix decomposition according to any one of claims 1 to 3, characterized in that, Also includes: Based on the power exchange between nodes in the power flow information, a logical adjacency matrix is constructed; wherein, if there is power exchange between two nodes, the position corresponding to the node in the logical adjacency matrix is 1, and if there is no power exchange between two nodes, the position corresponding to the node in the logical adjacency matrix is 0. Based on the connectivity analysis of the logical adjacency matrix, all nodes in the power grid are divided into connected regions, and all independent connected components are determined based on the results of the connected region division. The linear equation for the carbon emission factor is broken down into sub-equations corresponding to each connected component; For each of the connected components, the node with the largest power generation in the connected component is used as the reference node, and a weighted average carbon factor is determined based on the total carbon emissions and total power of all local power generation in the connected component. The sub-equations corresponding to the reference nodes are corrected based on the weighted average carbon factor, and the corrected sub-equations are combined to obtain the corrected linear equation of carbon emission factor.
6. The method for calculating the carbon emission factor of electricity based on QR matrix decomposition according to any one of claims 1 to 3, characterized in that, The process of solving the linear equation of the carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value for each node includes: QR matrix decomposition is performed on the sparse matrix in the linear equation of the carbon emission factor to obtain an orthogonal matrix and an upper triangular matrix. Based on the orthogonal matrix and the upper triangular matrix, the linear equation of the carbon emission factor is transformed into a system of upper triangular equations; The upper triangular equations are simplified by using predefined intermediate variables, and the simplified upper triangular equations are solved step by step by using the back substitution method to obtain the carbon emission factor values of each node.
7. A power carbon emission factor calculation system based on QR matrix decomposition, characterized in that, include: The information acquisition module is used to acquire carbon emission information and power flow information of each generator in the power grid; The first equation determination module is used to determine the nodal power balance equation and the carbon emission conservation equation based on the carbon emission information and the power tidal flow information. The second equation determination module is used to construct a linear equation for carbon emission factors based on the node power balance equation and the carbon emission conservation equation; wherein, the linear equation for carbon emission factors is used to characterize the correlation between the sparse matrix, the right-hand vector and the carbon emission factors of each node. The carbon factor calculation module is used to solve the linear equation of the carbon emission factor based on QR matrix decomposition to obtain the carbon emission factor value of each node.
8. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor performs the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, wherein when the program instructions are executed by a computer, the computer performs the steps of the electricity carbon emission factor calculation method based on QR matrix decomposition as described in any one of claims 1-6.