Transform model-based carbon emission flow evaluation method and system
Through the carbon emission flow evaluation method based on the Transformer model, the Transformer model is constructed for data supplement and training using sequential Monte Carlo simulation and power system trend calculation, and the carbon emission flow results are directly output, solving the problems of incomplete data and high computational complexity in traditional methods, and efficient long-term evaluation is achieved.
Patent Information
- Application Number
- CN202510515776.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2025-04-16
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-01
AI Technical Summary
The traditional power system carbon emission flow evaluation method has high computational complexity under incomplete data and long-term time scales, which cannot meet the real-time evaluation needs.
Using the carbon emission flow evaluation method based on the Transformer model, complete data is generated through sequential Monte Carlo simulation, combined with power system flow calculation and carbon emission analysis, a Transformer model is constructed for training, and the carbon emission flow results are directly output and statistical analysis is performed.
It effectively solves the problem of carbon emission flow assessment when data is incomplete, significantly reduces calculation complexity and time consumption, and supports efficient evaluation on long-term time scales.
Smart Images

Figure CN120409932A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power system planning, and in particular relates to a carbon emission flow assessment method and system based on a Transformer model. Background Art
[0002] With the transformation of energy structures, reducing carbon emissions has become a key goal, particularly in addressing climate change and promoting sustainable development. As a major source of CO2 emissions, the power industry's effective assessment and management of carbon emissions is crucial for achieving emission reduction targets. However, traditional carbon emission flow assessments in power systems typically rely on fixed physical models and computational methods, which face numerous challenges when dealing with complex and dynamically changing power systems.
[0003] Currently, carbon emission flow assessment primarily relies on traditional physical modeling and numerical calculation methods. These methods typically estimate carbon emissions through power flow calculations, optimal power flow (ACOPF) optimization, and carbon emission flow analysis. The primary purpose of power flow calculations is to determine the voltage, power flow, and load conditions at each node in the power system. Power flow calculations provide the power flow and voltage levels for each branch of the power grid, providing the fundamental data for carbon emission flow assessment. Optimal power flow methods further refine power flow calculations, aiming to minimize system operating costs or maximize benefits by rationally scheduling generators, substations, and loads within the power system while satisfying various physical constraints. Carbon emission flow analysis combines carbon emission intensity with the power system's operating mode to calculate the carbon emission impact of different power sources, loads, and transmission networks. This process typically requires extrapolating the results of power flow calculations and ACOPF optimization, taking into account factors such as fuel consumption, generator type, and efficiency.
[0004] However, existing technologies face two key problems. The first is data incompleteness. Especially in newly built power systems, relevant measurement data, historical data or system operating status data are incomplete, resulting in a lack of sufficient support for the assessment of carbon emission flows. This makes it impossible for traditional methods to assess carbon emission flows in power systems. The second is the high computational cost of long-term assessments. When assessing carbon emission flows over long time scales, existing calculation methods need to process a large number of samples and data. This not only requires complex power flow calculations, but also involves detailed calculations of carbon emission flows. As the time scale increases, the computational complexity of existing methods increases exponentially, causing the calculation process to become extremely inefficient and time-consuming, and unable to meet the needs of real-time or efficient assessment. Although existing technologies can complete carbon emission flow assessments to a certain extent, their limitations in data processing and computational efficiency are still significant. Summary of the Invention
[0005] The object of the present invention is to overcome the problem that traditional methods cannot calculate carbon emission flows when power system data is incomplete, and a carbon emission flow assessment method based on the Transformer model is proposed.
[0006] To achieve the above object, the present invention adopts the following technical solutions: In the first aspect, the present invention provides a carbon emission flow assessment method based on the Transformer model, including the following steps: S1. Generate incomplete power system data through sequential Monte Carlo simulation, fit the power system data with incomplete data to the known power system data, and obtain complete load and wind power output data; S2. Perform power system power flow calculation and carbon emission analysis based on the complete load and wind power output data, and obtain output data including the unit-load carbon flow correlation analysis matrix; S3. Construct a Transformer model and use the input and output data in step S2 for training; S4. Based on the trained Transformer model, conduct long-term carbon emission flow assessment, directly output the carbon emission flow result by inputting power system parameters, and perform statistical analysis.
[0007] Further, the sequential Monte Carlo simulation in S1 includes the following steps: Input the known partial load data and wind power output data, and initialize the particle state; Update the particle state through the state transition model, where the load data is modeled by the normal distribution and the wind power output is modeled by the Weibull distribution; Update the particle weights according to the observed data through Bayes' theorem; Perform the resampling operation, update the particle set and reset the particle weights; Calculate the estimated values of the load and wind power output through weighted average, and generate complete load data and wind power output data.
[0008] Further, the power system power flow calculation in S2 includes the following steps: Construct a node power balance equation, use the Newton method for iterative solution, and obtain the node voltage amplitude and phase angle; Based on the power flow calculation results, construct an optimal power flow model, and the optimization objectives include generator generation cost and system loss, and satisfy power balance constraints, generator output constraints, voltage amplitude constraints, branch transmission capacity constraints, and static stability constraints; Based on the optimal power flow results, conduct carbon emission analysis, and calculate the carbon flow correlation relationship between units, loads, and branches; The output data also includes the branch power flow matrix, the nodal active power matrix, the nodal carbon potential distribution vector, the branch carbon flow rate distribution matrix, the load carbon flow rate vector, the unit-node carbon flow correlation analysis matrix, the unit-load carbon flow correlation analysis matrix, and the unit-branch carbon flow correlation analysis matrix.
[0009] Furthermore, the Transformer model described in S3 includes: An input embedding layer that converts branch power flow data, generator power output, base power, carbon emission intensity, load data, and power system node data into dense vectors of a fixed dimension; A self-attention mechanism that calculates the correlation between input data through Query, Key, and Value matrices; A multi-head attention mechanism that captures information in different subspaces in parallel; A feed-forward neural network that processes data and extracts high-order features; A decoder that predicts the carbon emission flow-related matrix and vector based on the context information generated by the encoder; The Transformer model is trained using input and output data to learn the implicit relationship between the input and output.
[0010] Furthermore, the long-term carbon emission flow assessment described in S4 includes the following steps: Based on the trained Transformer model, directly output the carbon emission flow results through an implicit function; Input the long-term power system parameters and calculate the carbon emission flow results day by day; Conduct statistical analysis on the carbon emission flow results, calculate the mean, standard deviation, maximum value, minimum value, and quantiles, and identify the time series characteristics.
[0011] Furthermore, the training objective of the Transformer model is to minimize the loss function, and the loss function is expressed as:
[0012] where, represents the input power system data, represents the output result, the training dataset , the implicit function , θ is the parameter of the model, represents the output of the carbon emission flow results through the trained Transformer model.
[0013] Furthermore, the statistical analysis of the long-term carbon emission flow assessment includes calculating the mean, standard deviation, maximum value, minimum value, and quantiles of the carbon emission flow, and identifying the carbon emission characteristics in specific seasons or cycles through time series analysis.
[0014] In a second aspect, the present invention provides a carbon emission flow assessment system based on a Transformer model, comprising: A sequential Monte Carlo simulation module, configured to generate incomplete power system data through sequential Monte Carlo simulation, fit the incomplete power system data with known power system data, and obtain complete load and wind power output data; A power system power flow calculation and carbon emission analysis module, configured to perform power system power flow calculation and carbon emission analysis based on the complete load and wind power output data, and obtain output data including a unit-load carbon flow correlation analysis matrix; A Transformer training module, configured to construct a Transformer model and train it using the input and output data in step S2; A long-time scale carbon emission flow assessment module, configured to perform long-time scale carbon emission flow assessment based on the trained Transformer model, directly output carbon emission flow results by inputting power system parameters, and perform statistical analysis.
[0015] In a third aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the carbon emission flow assessment method based on a Transformer model as described above is implemented.
[0016] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the carbon emission flow assessment method based on a Transformer model as described above is implemented.
[0017] Compared with the prior art, the present invention has the following beneficial technical effects: A carbon emission flow assessment method based on the Transformer model proposed by the present invention generates missing data through Monte Carlo simulation according to existing partial power system load data and distribution, making up for the data gap and solving the problem that traditional methods cannot conduct carbon emission assessment on power systems with incomplete data. In addition, the training method based on the Transformer model adopted by the present invention has significant advantages in terms of calculation compared with traditional carbon emission assessment methods. Traditional methods usually require complex power flow calculations, optimal power flow optimization, and carbon emission flow analysis for all samples, resulting in high calculation costs. However, the present invention only calculates and analyzes partial sample data, and directly learns the internal relationship between these data through the input and output data of the training samples. It avoids repeatedly performing complex calculations and analyses, thereby effectively reducing the calculation complexity and time consumption, and realizing the carbon emission flow assessment on a long time scale. It effectively solves the problem that traditional methods cannot calculate the carbon emission flow when the power system data is incomplete, and also overcomes the deficiencies of existing carbon emission flow assessment methods in terms of high calculation complexity and large time consumption on a long time scale BRIEF DESCRIPTION OF THE DRAWINGS The drawings described herein are for illustrative purposes only and are not intended to limit the scope of the present disclosure in any way. Additionally, the shapes and proportional dimensions of the components in the drawings are only schematic for helping the understanding of the present invention, and do not specifically limit the shapes and proportional dimensions of the components of the present invention. In the drawings: Figure 1 is a flowchart of a carbon emission flow assessment method based on the Transformer model of the present invention.
[0018] Figure 2 is a structural diagram of a carbon emission flow assessment system based on the Transformer model of the present invention.
[0019] Figure 3 is a diagram of an electronic device for a carbon emission flow assessment method based on the Transformer model of the present invention.
[0020] Figure 4 is a flowchart of a carbon emission flow assessment method based on the Transformer model.
[0021] Figure 5 is a flowchart of Monte Carlo simulation. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0022] To enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0023] Embodiment 1 See Figure 1 , a carbon emission flow assessment method based on the Transformer model, comprising the following steps: S1. Generate incomplete power system data through sequential Monte Carlo simulation, and fit the power system data of the incomplete data with the known power system data to obtain complete load and wind power output data; the sequential Monte Carlo simulation includes the following steps: input the known partial load data and wind power output data, and initialize the particle state; update the particle state through the state transition model, where the load data is modeled by the normal distribution and the wind power output is modeled by the Weibull distribution; update the particle weights according to the observation data through Bayes' theorem; perform the resampling operation, update the particle set and reset the particle weights; calculate the estimated values of the load and wind power output through weighted averaging to generate complete load data and wind power output data.
[0024] S2. Perform power system power flow calculation and carbon emission analysis based on the complete load and wind power output data to obtain output data including the unit-load carbon flow correlation analysis matrix; the power system power flow calculation includes the following steps: construct the node power balance equation, and use the Newton method for iterative solution to obtain the node voltage amplitude and phase angle; based on the power flow calculation results, construct an optimal power flow model, and the optimization objectives include generator power generation cost and system loss, and satisfy the power balance constraint, generator output constraint, voltage amplitude constraint, branch transmission capacity constraint and static stability constraint; based on the optimal power flow results, perform carbon emission analysis, and calculate the carbon flow correlation relationship between units, loads and branches; the output data also includes the branch power flow matrix, node active power matrix, node carbon potential distribution vector, branch carbon flow rate distribution matrix, load carbon flow rate vector, unit-node carbon flow correlation analysis matrix, unit-load carbon flow correlation analysis matrix and unit-branch carbon flow correlation analysis matrix.
[0025] S3. Build a Transformer model and train it using the input and output data in step S2. The Transformer model includes: an input embedding layer that converts branch power flow data, generator power output, base power, carbon emission intensity, load data, and power system node data into dense vectors of a fixed dimension; a self-attention mechanism that calculates the correlation between input data through Query, Key, and Value matrices; a multi-head attention mechanism that captures information in different subspaces in parallel; a feed-forward neural network that processes data and extracts high-order features; a decoder that predicts the carbon emission flow correlation matrix and vectors based on the context information generated by the encoder. The Transformer model is trained using the input and output data to learn the implicit relationship between the input and output. The training objective of the Transformer model is to minimize the loss function, which is expressed as:
[0026] where represents the input power system data, represents the output result, the training dataset , the implicit function , θ are the parameters of the model, represents the output of the carbon emission flow result through the trained Transformer model.
[0027] S4. Based on the trained Transformer model, conduct carbon emission flow assessment on a long time scale, directly output the carbon emission flow result by inputting power system parameters, and conduct statistical analysis. The long-time scale carbon emission flow assessment includes the following steps: Based on the trained Transformer model, directly output the carbon emission flow result through the implicit function; input the power system parameters on a long time scale and calculate the carbon emission flow result day by day; conduct statistical analysis on the carbon emission flow result, calculate the mean, standard deviation, maximum value, minimum value, and quantiles, and identify the time series characteristics. The statistical analysis of the long-time scale carbon emission flow assessment includes calculating the mean, standard deviation, maximum value, minimum value, and quantiles of the carbon emission flow, and identifying the carbon emission characteristics in specific seasons or cycles through time series analysis.
[0028] The Transformer model of the present invention shortens the calculation time of the traditional method from hours to seconds, supporting real-time decision-making. Through multi-sample training, the model can adapt to different power system configurations (such as changes in the renewable energy penetration rate). The present invention solves the problems of data missing and calculation bottlenecks in carbon emission assessment through a closed-loop design of data generation, feature learning, and fast inference, providing an efficient decision-making tool for the low-carbon transformation of power systems. Its technical path combines the theoretical innovation of Monte Carlo and Transformer fusion with the application value of long-time scale assessment, having significant promotion potential.
[0029] Example 2 Refer to Figure 2 , a carbon emission flow evaluation system based on the Transformer model, comprising: A sequential Monte Carlo simulation module, configured to generate incomplete power system data through sequential Monte Carlo simulation, fit the incomplete power system data with known power system data, and obtain complete load and wind power output data; A power system power flow calculation and carbon emission analysis module, configured to perform power system power flow calculation and carbon emission analysis based on the complete load and wind power output data, and obtain output data including a unit-load carbon flow correlation analysis matrix; A Transformer training module, configured to construct a Transformer model and use the input and output data in step S2 for training; A long-time scale carbon emission flow evaluation module, configured to perform long-time scale carbon emission flow evaluation based on the trained Transformer model, directly output carbon emission flow results by inputting power system parameters, and perform statistical analysis.
[0030] Example 3 Refer to Figure 3 , an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the above-mentioned carbon emission flow evaluation method based on the Transformer model. The method includes the following steps: S1, generating incomplete power system data through sequential Monte Carlo simulation, fitting the incomplete power system data with known power system data, and obtaining complete load and wind power output data; S2, performing power system power flow calculation and carbon emission analysis based on the complete load and wind power output data, and obtaining output data including a unit-load carbon flow correlation analysis matrix; S3, constructing a Transformer model and using the input and output data in step S2 for training; S4, performing long-time scale carbon emission flow evaluation based on the trained Transformer model, directly outputting carbon emission flow results by inputting power system parameters, and performing statistical analysis.
[0031] Example 4 A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is a carbon emission flow evaluation method based on a Transformer model. The method includes the following steps: S1. Generate incomplete power system data through sequential Monte Carlo simulation, and fit the incomplete power system data with known power system data to obtain complete load and wind power output data; S2. Based on the complete load and wind power output data, perform power system power flow calculation and carbon emission analysis to obtain output data including a unit-load carbon flow correlation analysis matrix; S3. Construct a Transformer model and use the input and output data in step S2 for training; S4. Based on the trained Transformer model, perform long-term scale carbon emission flow evaluation, directly output the carbon emission flow result by inputting power system parameters, and perform statistical analysis.
[0032] Embodiment 5 Using the present invention, missing data can be effectively supplemented based on existing partial data for carbon emission flow evaluation and long-term scale carbon emission flow evaluation can be efficiently performed. As Figure 4 shown, first, missing data required for carbon emission analysis is supplemented through the Monte Carlo simulation method. Then, using existing partial sample data, steps such as power flow calculation, ACOPF optimization, and carbon emission analysis are sequentially performed to obtain output data including a unit-load carbon flow correlation analysis matrix, etc. Subsequently, a Transformer model is used to train these input and output samples, deeply learning the internal relationship between the data, and constructing an implicit relationship between the input and output. Finally, using the trained implicit relationship, efficient long-term scale carbon emission flow calculation is performed, and carbon emission flow evaluation is performed based on statistical analysis, thus avoiding the cumbersome calculation steps in traditional methods.
[0033] S1. Generate incomplete data through sequential Monte Carlo simulation; Usually, the data in a newly built power system is incomplete, and it is not clear whether sufficient data is available for carbon flow evaluation. Therefore, incomplete data needs to be generated through sequential Monte Carlo simulation based on existing partial load data and distribution. Combining Figure 5, the process is described. First, the known partial load data and wind power output data are input, and the particle state is initialized, including the initial values of active load, reactive load, and wind power output. Second, the state of each particle is updated using the state transition model. The load data is modeled by a normal distribution, and the wind power output is modeled by a Weibull distribution, considering process noise and uncertainty. Then, according to the observed data (including the known load and wind power data), the weights of the particles are updated through Bayes' theorem, and the matching degree between the particle state and the observed data is calculated. After that, in order to avoid particle degeneracy, a resampling operation is performed, the set of particles is updated, and the weights of the particles are initialized to be equal to ensure the diversity of the particles. Finally, the estimated values of the load and wind power output of the particles are calculated by weighted average, and the complete load data and wind power output data are finally output to fill in the missing parts.
[0034] Assume that the state vector of the system consists of two parts: load data and wind power output data , then the state model of the system is as follows:
[0035] where represents the active load data at time t, represents the reactive load data at time t, represents the wind power output data at time t.
[0036] In the sequential Monte Carlo simulation, the state of the particles is updated through the following state transition model:
[0037] where is the state of the i-th particle at time t. is the state transition function, which describes the state evolution from time to time t. is the control input. is the process noise, considering model errors and uncertainties.
[0038] Load data follows a normal distribution at time t, and its mean and standard deviation are and . The load change can be expressed as follows:
[0039] where and are the time-dependent mean and standard deviation of the load data respectively, which can be obtained by fitting historical data, N(0,1) is the standard normal distribution noise.
[0040] Wind power output is modeled by the Weibull distribution of wind speed. Assume that the wind speed obeys the Weibull distribution, then the wind power output can be expressed by the following formula:
[0041] where Weibull represents the wind speed obeys the Weibull distribution, with the shape parameter k and the scale parameter λ. η is the efficiency of the wind turbine. p is the exponent of the wind turbine.
[0042] The probability density function of the Weibull distribution is expressed as follows:
[0043] At each time step t, update the weights of the particles according to the observed data. The observation model is usually expressed by the following formula:
[0044] where: is the observed data at time t (including the known partial load and wind power data). is the observation function that maps the state vector to the observation space. is the observation noise, usually assumed to be Gaussian noise.
[0045] For the observation models of load and wind power output, they can be expressed separately as follows:
[0046]
[0047]
[0048] According to the observed data update the weights of each particle. Assume that the particle weight is , and use Bayes' theorem to update the weight:
[0049] where is the observation likelihood of particle i at time t, indicating the degree of matching between the state of the particle and the actual observed data. Assume that the observation noise follows a normal distribution, then the observation likelihood can be expressed as follows:
[0050] To avoid particle degeneracy, resampling is performed. After resampling, the set of particles will be updated, and the weights of the particles are re-initialized to be equal. The resampled particle set is { }. The estimated values of load and wind power data are calculated by weighted average:
[0051]
[0052]
[0053] where N is the number of particles, and are the active and reactive power outputs of the load of the i-th particle respectively. is the wind power output. Thus, the incomplete load and wind power output data can be supplemented by the sequential Monte Carlo method.
[0054] S2. Power flow calculation and carbon emission analysis of power system; S201. Power flow calculation of power system; After fitting the required load and wind power output data, the power flow of the power system is calculated using the data. It includes steps such as constructing the nodal power balance equation, Jacobian matrix, iterative steps of Newton's method, and convergence judgment.
[0055] For each node in the power system (including generator nodes and load nodes), its power flow can be described by the following power balance equation:
[0056]
[0057] where and are the active power and reactive power (per unit value) of the i-th node. and are the voltage magnitudes of node i and node j respectively. and are the voltage phase angles of node i and node j respectively.
[0058] and are the real and imaginary parts (conductance and susceptance) of the admittance matrix of the system.
[0059] Newton's method uses the Jacobian matrix for iteration. The Jacobian matrix is the partial derivative matrix of the power flow equation with respect to voltage magnitude and phase angle. These partial derivatives form the Jacobian matrix J of the power flow equation, which is used to calculate the correction amount of the nodal voltage in Newton's method:
[0060]
[0061]
[0062]
[0063] The core formula for Newton's method iteration is as follows:
[0064] where and are the correction amounts of the voltage amplitude and voltage phase angle respectively. and are parts in the Jacobian matrix, corresponding to the active and reactive power parts respectively. and are the calculated active and reactive power of the nodes and are the active and reactive power provided by the load.
[0065] The voltage correction is obtained by multiplying the inverse matrix of the Jacobian matrix by the power imbalance. Here, and are the power imbalances, which are the differences between the active and reactive powers:
[0066] Branch power ]>The calculation formula is as follows:
[0067] where and are the voltage amplitudes of nodes i and j. and are the voltage phase angles of nodes i and j. The convergence condition is determined by the power imbalance:
[0068] where is the preset convergence accuracy.
[0069] S202, Optimal power flow model; Based on the power flow calculation, the voltage amplitudes , phase angles of each node, and the power flow distribution of each branch in the system can be obtained. These data provide a basis for the optimal power flow (ACOPF).
[0070] The optimization objectives include the power generation cost of the generator and the system losses. Construct the comprehensive objective function.
[0071]
[0072]
[0073] where is the power generation cost function of the \(i\)-th generator, usually a quadratic function. and and are the coefficients of the power generation cost function.
[0074] The existing constraints include power balance constraint, generator output constraint, voltage magnitude constraint, branch transfer capacity constraint, static stability constraint:
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083] where and are the active and reactive power outputs of the generator at node \(i\), and are the active and reactive power demands of the load at node \(i\). and are the minimum and maximum active power outputs of generator \(i\). and are the minimum and maximum reactive power outputs of generator \(i\). and are the minimum and maximum voltage magnitudes at node \(i\). is the actual power flow of branch \(i - j\), and are the active and reactive power flows of branch \(i - j\), is the rated power capacity of branch \(i - j\). is the maximum allowable voltage phase angle difference. The interior point method is used to solve the ACOPF problem.
[0084] S203, Carbon Emission Analysis Model; After calculating the optimal power flow of the power system, carbon emission analysis is used to estimate the carbon flow correlation relationships among various nodes, branches, loads, and generators. Based on the system power flow calculation, the carbon emissions and carbon flow dynamics between each generator and load, branch can be further calculated, thus providing decision-making support for power system optimization and carbon emission reduction.
[0085] Branch Power Flow Matrix is the actual power flow calculated according to the per-unit value power flow, and the negative values in the branches are corrected to 0. The formula is as follows:
[0086]
[0087] where is the per-unit value power flow of branch i−j. is the system base power.
[0088] Generator Injection Power Distribution Matrix , Node Active Power Flux Matrix , Generator Carbon Emission Intensity Vector are as follows:
[0089]
[0090]
[0091] where k is the generator number. n is the node number associated with generator k. is the active power injected by generator k at node n. is a row vector of all 1s. is the matrix after splicing the branch power flow matrix and the generator power injection matrix. represents the carbon emission intensity of the kth generator (unit: gCO2 / kWh).
[0092] Node Carbon Potential Distribution Vector is calculated according to the power imbalance. The load distribution matrix is used to represent the distribution of loads on each node. The branch carbon-sulfur rate distribution matrix can be calculated by The load carbon flow rate vector is calculated from the load distribution matrix and the carbon potential vector The expression is as follows:
[0093]
[0094]
[0095]
[0096]
[0097]
[0098] wherein is the node power flux matrix. and are the transposes of the branch power flow matrix and the unit power matrix respectively. is the power of load k at node n. For and unit conversions are performed respectively to obtain the carbon flow rate on the branch (unit: tCO2 / MWh) and the carbon flow rate of each load (unit: tCO2).
[0099] Unit-node carbon flow correlation analysis matrix is used to represent the carbon flow contribution of each unit at different nodes, and the unit-load carbon flow correlation analysis matrix , for the kth unit, the relationship of the unit-branch carbon flow correlation analysis matrix is as follows:[[]]
[0100]
[0101]
[0102] wherein is the diagonal matrix representing the carbon emission intensity of the generator set, is the all-ones vector of the number of loads. is a column vector of length k, representing the influence of the kth unit:[[]] S3. Training based on the Transformer model; According to the power flow calculation and carbon emission analysis of the power system, when inputting the branch power flow data and generator information , base power , generator carbon emission intensity , load data , and power system node data. The power flow distribution matrix of each branch , node active power matrix , node carbon potential distribution vector , branch carbon flow rate distribution matrix , load carbon flow rate vector , unit-node carbon flow correlation analysis matrix , Unit-load carbon flow correlation analysis matrix , Unit-branch carbon flow correlation analysis matrix , thus obtaining a carbon emission flow analysis of part of the power system. On this basis, the Transformer model is used to capture various information from the input data and generate useful output.
[0103] The structure of the Transformer model includes input embedding, self-attention mechanism, multi-head attention, feedforward neural network, decoder and output components.
[0104] S301, input embedding; The input data contains multiple parts, including branch flow data , generator power output , benchmark power, carbon emission intensity , load data , power system node data, etc. In order for the Transformer model to process these data, they need to be converted into a unified vector representation. The role of the input embedding layer is to convert these data from different sources into dense vectors of fixed dimensions. , the model converts this data into a vector representation through the embedding layer as follows:
[0105] in Is a dense vector of dimension d, representing the vectorized representation of each input element. The embedding layer is usually a linear transformation that maps the original features of the input into a unified high-dimensional space, enabling the model to process different types of data.
[0106] S302, self-attention mechanism; The self-attention mechanism is the core of the Transformer model, allowing the model to calculate the correlation or dependencies between different inputs when processing input data. The self-attention mechanism calculates the importance of each input data point using three matrices: query, key, and value.
[0107] When calculating the three matrices of Query, Key and Value, given the input embedding vector , through linear transformation, Query Q, Key K and Value are generated, which are represented by A, B and C as follows:
[0108]
[0109]
[0110] Among them 、 、 are weight matrices, which are used to calculate Query, Key, and Value respectively.
[0111] The attention scores are calculated using Query and Key to measure the correlation between each pair of elements in the input data. The expression is as follows:
[0112] Wherein is the dimension of Key. The attention scores are calculated through dot product and normalized using . Finally, the result is multiplied by the Value matrix to obtain the weighted sum.
[0113] S303, Multi-Head Attention; To enhance the learning ability of the model, Transformer uses the multi-head attention mechanism. In multi-head attention, multiple attention heads can capture information in different subspaces in parallel, thus learning richer features:
[0114] where h represents the number of attention heads. Each attention head calculates an independent attention mechanism in parallel to capture the dependencies in different dimensions of the input. represents the output of the i-th attention head, and each head independently calculates its corresponding attention score. is to concatenate the outputs of all attention heads to obtain a large matrix, allowing the model to capture information in multiple subspaces simultaneously. is a linear transformation matrix used to combine the outputs of multiple heads into a unified output. By combining and transforming the outputs of each head, the final output will contain the information learned from all subspaces.
[0115] S304, Feed-Forward Neural Network; After constructing each attention layer, Transformer uses a feed-forward neural network to further process the data. The feed-forward neural network generally consists of two linear transformation layers and an activation function (ReLU), and the formula is as follows:
[0116] Wherein and are weight matrices, 、 is the bias term. This network is used to extract higher-order features and helps the model capture more complex patterns in subsequent layers.
[0117] S305, Decoder and Output; The decoder is responsible for generating the final output. For this problem, the decoder will predict multiple output matrices and vectors based on the context information generated by the encoder, including: the power flow distribution matrix of each branch , the active power matrix of nodes , the node carbon potential distribution vector , the branch carbon flow rate distribution matrix , the load carbon flow rate vector , the unit-node carbon flow correlation analysis matrix , the unit-load carbon flow correlation analysis matrix , the unit-branch carbon flow correlation analysis matrix .
[0118] After being trained by Transformer, when the parameters of the power system are given as input, it is possible to output the predicted values of the matrices and vectors related to carbon emission flow, avoiding complex power flow calculations and carbon emission analysis calculations, and achieving efficient carbon emission flow calculations.
[0119] S4, Long-term Scale Carbon Emission Flow Assessment.
[0120] In the long-term scale carbon emission flow problem, using the trained Transformer model, based on the implicit function relationship between the input and output, the long-term scale carbon emission flow can be calculated. Avoiding repeated steps such as power flow calculations and ACOPF optimizations, the model directly outputs the carbon emission flow results of the power system by learning the implicit input-output mapping relationship, and then evaluates the results based on statistical analysis.
[0121] S401, Implicit Function Learning Based on Transformer; During the training process, we learn the relationship between the input X and the output Y through the training dataset , where represents the input power system data (such as load data, wind power output, etc.), represents the output results (such as carbon emission flow, branch power flow, etc.). By training the Transformer model, an implicit function is obtained, where θ are the parameters of the model. The goal of the training process is to minimize the loss function as follows:
[0122] where It represents the output of the carbon emission flow results achieved through the trained Transformer model.
[0123] S402. Fast long - time - scale carbon emission flow calculation; In the carbon emission flow calculation for the long - time scale (taking 1 year as an example) of the power system, we input the input data for 1 year into the trained Transformer model. The input data for each day can be system parameters such as wind power output, load data, branch power flow, etc. After training, the Transformer model will directly output the corresponding carbon emission flow results through the implicit function. .
[0124] For each day t (t = 1, 2,..., 365), the evaluation result can be expressed as follows.
[0125]
[0126] Among them, represents the output at time t.
[0127] S403. Long - time - scale carbon emission flow evaluation; Perform statistical analysis on the calculated carbon emission flow results for one year, and calculate key indicators such as its average value, standard deviation, maximum value, and minimum value. These statistics help to reveal the overall trend and volatility of carbon emissions on the long - time scale.
[0128] Calculate the average value of the carbon emission flow for one year, which represents the overall carbon emission level of the system within one year. The formula is as follows:
[0129] Among them, represents the average value of the carbon emission flow for one year, and T is the total number of days (for example, 365 days).
[0130] Adopt the standard deviation to calculate the volatility of the carbon emission flow and evaluate the stability of the system's carbon emissions. The formula is as follows:
[0131] Calculate the maximum value and the minimum value , to determine the extreme values of the carbon emission flow, which helps to identify the time points within the system that may lead to abnormal carbon emissions.
[0132] Analyze the distribution characteristics of the carbon emission flow in different time periods through quantiles (such as 25%, 50%, 75%, etc.) to further understand the carbon emission patterns in different stages.
[0133] Temporal feature recognition, through the temporal analysis of the carbon emission flow results of each day, identifies the carbon emission characteristics of the system in specific seasons or cycles. For example, certain months may see a significant increase in carbon emissions due to high demand or low wind power output.
[0134] Through these statistical analysis and verification processes, the carbon emission performance of the power system over a long time scale can be comprehensively evaluated, providing strong data support for optimizing system operation and carbon emission management.
[0135] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0136] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0137] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0138] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are performed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide means for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1Steps of the functions specified in one or more boxes. Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications or equivalent substitutions can still be made to the specific embodiments of the present invention, and any modification or equivalent substitution that does not depart from the spirit and scope of the present invention should be covered within the protection scope of the present invention.
Claims
1. A carbon emission flow assessment method based on the Transformer model, characterized in that, It includes the following steps: S1. Generate incomplete power system data through sequential Monte Carlo simulation, fit the power system data of the incomplete data with the known power system data to obtain complete load and wind power output data; S2. Based on the complete load and wind power output data, conduct power flow calculation and carbon emission analysis of the power system to obtain output data including the unit-load carbon flow correlation analysis matrix; S3. Construct a Transformer model and train it using the input and output data in step S2; S4. Based on the trained Transformer model, conduct carbon emission flow assessment on a long time scale, directly output the carbon emission flow results by inputting power system parameters, and conduct statistical analysis.
2. The carbon emission flow assessment method based on the Transformer model according to claim 1, wherein, The sequential Monte Carlo simulation described in S1 includes the following steps: Input the known partial load data and wind power output data, and initialize the particle state; Update the particle state through the state transition model, where the load data is modeled by the normal distribution and the wind power output is modeled by the Weibull distribution; According to the observation data, update the particle weights through Bayes' theorem; Perform the resampling operation, update the particle set, and reset the particle weights; Calculate the estimated values of the load and wind power output through weighted averaging to generate complete load data and wind power output data.
3. The carbon emission flow assessment method based on the Transformer model according to claim 1, characterized in that The power flow calculation of the power system described in S2 includes the following steps: Construct a nodal power balance equation and use the Newton method for iterative solution to obtain the nodal voltage magnitude and phase angle; Based on the power flow calculation results, construct an optimal power flow model, and the optimization objectives include generator generation cost and system loss, and satisfy power balance constraints, generator output constraints, voltage magnitude constraints, branch transmission capacity constraints, and static stability constraints; Based on the optimal power flow results, conduct carbon emission analysis and calculate the carbon flow correlation relationships among units, loads, and branches; [[ID= 4. The carbon emission flow evaluation method based on the Transformer model according to claim 3, wherein 5. A carbon emission flow assessment method based on the Transformer model according to claim 1, characterized in that, Statistically analyze the carbon emission flow results, calculate the mean, standard deviation, maximum, minimum, and quantiles, and identify the time series characteristics.
6. The carbon emission flow evaluation method based on the Transformer model according to claim 1, characterized in that The training objective of the Transformer model is to minimize the loss function, which is expressed as: Among them, represents the input power system data, represents the output result, the training data set , the implicit function , θ is the parameter of the model, represents the output of the carbon emission flow result through the trained Transformer model.
7. The carbon emission flow evaluation method based on the Transformer model according to claim 1, wherein, The statistical analysis of the long-term carbon emission flow assessment includes calculating the mean, standard deviation, maximum, minimum, and quantiles of the carbon emission flow, and identifying the carbon emission characteristics in specific seasons or cycles through time series analysis.
8. A carbon emission flow assessment system based on the Transformer model, characterized in that, It includes: A sequential Monte Carlo simulation module for generating incomplete power system data through sequential Monte Carlo simulation, fitting the incomplete power system data with known power system data to obtain complete load and wind power output data; A power system power flow calculation and carbon emission analysis module for performing power system power flow calculation and carbon emission analysis based on the complete load and wind power output data to obtain output data including the unit-load carbon flow correlation analysis matrix; A Transformer training module for constructing a Transformer model and training it using the input and output data in step S2; A long-term carbon emission flow assessment module for performing long-term carbon emission flow assessment based on the trained Transformer model, directly outputting the carbon emission flow results by inputting power system parameters, and performing statistical analysis.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements a carbon emission flow assessment method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements a carbon emission flow assessment method according to any one of claims 1-7.