High-temporal-spatial-resolution electric power carbon emission factor calculation method and system and readable storage medium
By constructing and enhancing the electric carbon knowledge graph, combining the matching-aggregation model and time correlation calculation, the problem of low spatiotemporal resolution of power carbon emission factors is solved, and the calculation of power carbon emission factors with high spatiotemporal resolution is achieved, which improves the calculation accuracy and interpretability.
Patent Information
- Application Number
- CN202510178912.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-06
AI Technical Summary
The existing power carbon emission factor calculation methods have low spatiotemporal resolution and cannot accurately extract and calculate information for specific local areas, resulting in inaccurate calculation results.
By constructing an electric carbon knowledge graph, spatial relationship enhancement processing is performed, and the power carbon emission sequence with spatiotemporal keywords is input, the target electric carbon entity is retrieved using a matching-polymerization model, and weighted calculations are performed in combination with the time correlation, a calculation graph is generated and topologically sorted, and the influence of power transfer is finally corrected to obtain a power carbon emission factor with high spatiotemporal resolution.
It significantly improves the expression ability and calculation accuracy of electrocarbon data, enhances the interpretability of the calculation results, and provides an accurate basis for regional emission reduction strategies.
Smart Images

Figure CN120106369A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power system protection, and in particular to a method, system and readable storage medium for calculating power carbon emission factors with high temporal and spatial resolution. Background Art
[0002] The electricity carbon emission factor is the basis for accurately calculating the indirect greenhouse gas emissions caused by electricity consumption. It is an important parameter for quantitatively analyzing and promoting carbon emission reduction at the consumer end. Its spatial accuracy and timeliness have a significant impact on the indirect emissions of emission units at different levels, such as regions, industries, and enterprises. The data related to the calculation of the electricity carbon emission factor are collectively referred to as electricity carbon emission data, and the electricity carbon attributes used for calculation are collectively referred to as electricity carbon variables. The electricity carbon emission data comes from the reports and business statements of related companies. According to different forms, it can be divided into electricity carbon documents and electricity carbon statements. At the same time, it is also necessary to consider that there are often complex relationships and interactions between the various variables of electricity carbon emission data, and different data collection methods are likely to lead to inconsistent data, which will bring difficulties to data analysis and decision-making.
[0003] Acquiring carbon emission data with high spatiotemporal resolution is the key to accurately calculating regional electricity carbon emission factors. The spatiotemporal validity of carbon emission data directly affects the accuracy of electricity carbon emission factor calculation. At present, existing known methods are often calculated based on carbon emission data obtained at low spatiotemporal resolution. For example, the Chinese patent application number CN202411149659.3 proposes a system that includes carbon emission factor calculation and carbon emission information entry. By calling the data of the database and model library, the latest electricity carbon dioxide emission factor of the target area is dynamically calculated; in addition, the Chinese patent application number CN202410892782.8 provides an online carbon emission dynamic measurement and display method and system, which monitors the energy consumption and emissions of the equipment in real time through sensors, collects key parameters and dynamically calculates carbon emissions in combination with database data, and can visualize the calculation results through the device display or cloud platform.
[0004] The carbon emission data of the above methods are all obtained by statistics at low spatial and temporal resolution in units of countries and regions. In addition, carbon emission data with high spatial and temporal resolution also puts forward new requirements on the updating speed of electricity carbon emission factors. In order to accurately calculate the carbon emission factors, it is also necessary to extract information on specific local areas of carbon emission data.
[0005] In view of this, in order to address the problem that the existing electricity carbon emission factors have defects such as slow updating, low spatiotemporal resolution, and inability to extract and calculate information for specific local areas, which leads to the obtained electricity carbon emission factors being inaccurate, this application proposes a method for calculating electricity carbon emission factors with high spatiotemporal resolution to provide data support for the power industry to implement energy-saving and emission reduction strategies. Summary of the invention
[0006] The main purpose of this application is to provide a method, system and readable storage medium method for calculating the carbon emission factor of electricity with high temporal and spatial resolution, aiming to solve the problem of how to improve the accuracy of the carbon emission factor of electricity.
[0007] To achieve the above purpose, the present application provides a method for calculating the carbon emission factor of electricity with high temporal and spatial resolution, the method comprising:
[0008] S1, constructing an electric carbon knowledge graph based on the collected electric carbon documents and electric carbon reports, and performing spatial relationship enhancement processing on the electric carbon knowledge graph to obtain a preprocessed electric carbon knowledge graph;
[0009] S2, inputting a power carbon emission sequence with a spatiotemporal keyword into the preprocessed power carbon knowledge graph, and using a matching-aggregation model to retrieve a target power carbon entity associated with the target spatial keyword in the preprocessed power carbon knowledge graph; and,
[0010] S3, based on a pre-designed distance measurement query method including a distance function, query the electric carbon attributes in the pre-processed electric carbon knowledge graph, normalize the retrieved electric carbon attributes, and then perform weighted calculation on the electric carbon attributes in combination with time correlation to obtain time fine-grained electric carbon variables that meet the target requirements, and construct an electric carbon variable dictionary based on each of the time fine-grained electric carbon variables;
[0011] S4, generating a computational graph node according to the electric carbon variable dictionary, adding directed edges to the graph nodes in the order of formula execution marked in a preset electric carbon formula library, and generating a computational graph;
[0012] S5, executing the formulas corresponding to the vertices in the topological sorting sequence in the calculation graph, instantiating the formula trees corresponding to the formulas, and solving them through post-order traversal to obtain instantiated formula trees, and calculating the direct carbon emission factor of the target area according to the instantiated formula trees;
[0013] S6, correcting the direct carbon emission factor by taking into account the impact of power transfer, and obtaining the average carbon emission factor of the target area as a power carbon emission factor with high temporal and spatial resolution.
[0014] Optionally, the S1 step includes:
[0015] Preprocessing the electrocarbon document and the electrocarbon report;
[0016] Annotating the target entities in the electric carbon document, dividing the annotated electric carbon document into a training set and a data set, and then inputting them into a deep learning model to identify the electric carbon entities in the electric carbon document and predict the relationship categories of the electric carbon entities to obtain electric carbon triples, and performing spatial relationship enhancement processing on the electric carbon triples; and
[0017] After standardizing the names in the electric carbon report, extracting the target power generation information in the electric carbon report as the electric carbon attribute;
[0018] The electric-carbon triplet with enhanced spatial relationship and the electric-carbon attribute are added to the electric-carbon knowledge graph to obtain a preprocessed electric-carbon knowledge graph with enhanced spatial relationship.
[0019] Optionally, the step of performing spatial relationship enhancement processing on the electric-carbon triplet comprises:
[0020] S10, decompose the input sequence S into a vocabulary sequence using a word segmenter, and then input it into the BERT model to obtain the context representation H of each word in the sequence, wherein the expression of the input sequence S is:
[0021] S=[CLS]h|MASK|t[SEP]
[0022] Wherein, [CLS] is the sentence start marker of the BERT model; h and t represent the head entity and the tail entity respectively, the head entity is the electric carbon entity, the tail entity is the fine-grained location division location, |MASK| represents the spatial relationship to be predicted; [SEP] is the sentence end marker of the BERT model, corresponding to [CLS], indicating the end of the sequence;
[0023] The context represents the expression of H as follows:
[0024]
[0025] S20, through the fully connected layer Mapping to the output space of the vocabulary size, we can get the score of each candidate word, and then use the softmax function to convert the score into a probability distribution p(e|S):
[0026]
[0027] Where W 0 are the parameters of the BERT model;
[0028] S30, select the word with the highest probability as the prediction result of the mask position, and define the new sequence after the mask position prediction of sequence S as s * ;
[0029] S40, using the cross entropy function to optimize the model, optimizing the model parameters through back propagation and gradient descent method, and continuously adjusting the weights of each layer to minimize the loss function, thereby obtaining the electric-carbon triplet after the spatial relationship enhancement processing.
[0030]
[0031] In the formula, e * is the vocabulary of the actual mask position.
[0032] Optionally, the process of constructing the electricity carbon emission sequence with time and space keywords includes:
[0033] From the electricity carbon emission text sequence Q with spatiotemporal keywords, we fine-tune the BERT model and perform named entity recognition on it to identify a topic entity e t ;
[0034] Identify all entities e that are close to the subject t One-hop and two-hop electric carbon entities are combined into a candidate electric carbon entity set
[0035] The candidate electro-carbon entity set Each entity e in c Connecting them in series along the relationship path to form a sequence, obtaining an electric-carbon basis candidate sequence Q, wherein the electric-carbon basis candidate sequence does not include the last embedded vector;
[0036] The candidate sequence Q of the electric carbon basis is converted into an embedded representation Q' = (q 1 ,q 2 ,…,q m ), where q i (1≤i≤m) represents the embedding vector corresponding to the vocabulary;
[0037] The embedding vector expression C of the candidate sequence of electro-carbon basis * for:
[0038] c * =(c 1 ,…,c n-1 ,c n ):
[0039] in,
[0040]
[0041] In the formula, c n is the embedding representation of the candidate sequence of the electric carbon basis, β r represents the importance coefficient of the relation embedding representation r in the electric-carbon relation set for the electric-carbon basis candidate sequence Q, represents a single vector after the arithmetic mean of the candidate sequence Q' of the electric carbon basis is taken, exp(·) is the exponential function, w and b are the model parameters of the graph attention network, q i (1≤i≤m) represents the embedding vector corresponding to a single word, Represents the candidate answer entity e c A collection of electro-carbon contextual relationships.
[0042] Optionally, the step of using the matching-aggregation model to retrieve the target electric carbon entity associated with the target space keyword in the preprocessed electric carbon knowledge graph includes:
[0043] S21, for the embedded representation Q' and the embedded vector expression C * Encode and get the reflection q i and c j The similarity variable e between ij :
[0044] e ij =F(q i ) T F(c j )
[0045] S22, according to the similarity variable e ij , calculate the first normalized attention weight a from the answer sequence to the target sequence ij , and the second normalized attention weight b from the answer sequence to the target sequence ij :
[0046]
[0047] Where exp(·) is the exponential function, e ij Measuring q i With c j The similarity of i'j Measuring q i' With c j similarity;
[0048] S23, according to the first normalized attention weight a ij and the second normalized attention weight b ij , calculate the embedding representation component of the electric carbon problem sequence and electro-carbon enhanced candidate representation sequence embedding representation component
[0049]
[0050] S24, for all components Calculate and get the new electric carbon problem expression and electro-carbon enhanced candidate representation sequences
[0051] S25, OK and The first similarity v between 1,i, and the second similarity v between the weighted representation of the electro-carbon enhanced candidate sequence and its corresponding problem representation sequence at the jth position 2,j :
[0052]
[0053] In the formula, ⊙ is element-wise multiplication, that is, multiplying the elements of corresponding positions of two matrices of the same size one by one, and FNN is a feedforward neural network with ReLU as the activation function;
[0054] S26, using a long short-term memory network to analyze the first similarity v 1,i and the second similarity v 2,j Perform aggregation to obtain the aggregate vector and
[0055]
[0056] S27, solved using the maximum pooling method and The maximum value of and Will and After connection, use the feedforward neural network FNN to get the matching score
[0057]
[0058] S28, will match the score Entities greater than the threshold are output as candidate answers to obtain the target electric carbon entity Among them, the set E of target electric carbon entities area The expression is:
[0059]
[0060] Optionally, the expression of the time fine-grained electric carbon variable is:
[0061]
[0062] In the formula, represents the electric carbon variable corresponding to the electric carbon attribute x of the electric carbon entity k; n' represents the number of records with the same attribute ID that meet the minimum distance threshold, x i K represents the attribute value of the ith record under the electric carbon attribute x corresponding to the electric carbon entity k; s represents the start timestamp extracted from Q, K e Indicates the end timestamp extracted from Q, R s Indicates the start timestamp of the record, Re Indicates the end timestamp of the record.
[0063] Optionally, the step S6 specifically includes:
[0064] S61, query entity e j Direct carbon emission factor EF of the region j As an entity j Direct carbon emission factor, calculation entity e j Carbon emissions V' of electricity imported into target area z z,j :
[0065]
[0066] S62, searching other target entities that have a "power transfer" relationship with the target area z on the electric carbon knowledge graph, and obtaining the carbon emissions V' of the other target entities transferred to the target area z z and net electricity import Finally, the carbon emissions V' z and net electricity import Sum them up to get the net carbon emissions transferred to the target area z and the net amount of electricity transferred into the target area z, E' z :
[0067]
[0068] S63, calculating the average carbon emission factor of the target area z as the electricity carbon emission factor with high spatiotemporal resolution:
[0069]
[0070] In addition, to achieve the above-mentioned objectives, the present application also provides a computer system, which includes: a memory, a processor, and a high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory and executable on the processor, wherein the high temporal and spatial resolution electricity carbon emission factor calculation program, when executed by the processor, implements the steps of calculating the high temporal and spatial resolution electricity carbon emission factor as described in any of the above items.
[0071] In addition, to achieve the above-mentioned objectives, the present application also provides a computer-readable storage medium, on which is stored a program for calculating the carbon emission factor of electricity with high temporal and spatial resolution. When the program for calculating the carbon emission factor of electricity with high temporal and spatial resolution is executed by a processor, the steps of the method for calculating the carbon emission factor of electricity with high temporal and spatial resolution as described in any of the above items are implemented.
[0072] This application has at least the following beneficial effects:
[0073] (1) In order to address the problem of low spatiotemporal resolution of existing electricity carbon emission data, the present invention achieves higher-precision electricity carbon data modeling by enhancing the spatial and temporal resolution of the electricity carbon knowledge graph; by introducing spatial relationship completion technology, the spatial attributes of electricity carbon entities are further refined, and the dynamic changes of electricity carbon variables are accurately described through the time granularity enhancement method, which significantly improves the expression ability of electricity carbon data and further provides an accurate basis for regional emission reduction strategies.
[0074] (2) In view of the problem that traditional knowledge graph retrieval often stays at the entity level and is difficult to deeply explore attribute relationships, the present invention innovatively designs a hierarchical retrieval mechanism from entities to attributes, extracts subgraphs through a matching-aggregation model, and generates structured information from rapidly evolving subgraphs, which significantly improves the retrieval accuracy and is suitable for dynamic information queries in the complex electrocarbon field.
[0075] (3) In order to solve the redundancy problem caused by recursive formulas in traditional calculation methods, the present invention proposes a calculation framework based on a formula tree and adopts topological sorting of the calculation graph to achieve non-redundant calculation, which significantly improves the calculation efficiency and enhances the interpretability of the calculation results, providing a more reasonable basis for the formulation of emission reduction policies. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 This is a flow chart of the first embodiment of the method for calculating the electricity carbon emission factor with high temporal and spatial resolution of the present application;
[0077] Figure 2 A schematic diagram of the architecture of the hardware operating environment of the computer system involved in the embodiment of the present application;
[0078] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0079] In order to better understand the above technical solution, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0080] First embodiment
[0081] In this embodiment, the method for calculating the carbon emission factor of electricity with high temporal and spatial resolution includes the following steps:
[0082] S1, constructing an electric carbon knowledge graph based on the collected electric carbon documents and electric carbon reports, and performing spatial relationship enhancement processing on the electric carbon knowledge graph to obtain a preprocessed electric carbon knowledge graph;
[0083] In this embodiment, the data related to the calculation of the electricity carbon emission factor are collectively referred to as electricity carbon emission data, and the key elements involved are collectively referred to as electricity carbon variables. The electricity carbon emission data comes from corporate reports and business statements, including electricity carbon documents and electricity carbon statements.
[0084] For electric carbon documents, optical character recognition (OCR) technology is used to extract text content. The extracted text is standardized and cleaned using regular expressions to filter out redundant punctuation and duplicate items. The extracted text is segmented using the Bert-base-Chinese Tokenizer, and the text sequence is converted into standardized model input in the form of Token ID, Token Type ID and Attention Mask.
[0085] Create index tables for entities and attributes, establish mapping relationships from entity name to entity ID and attribute name to attribute ID, create a storage table containing fields such as entity ID, attribute ID, time range, attribute value, etc., use entity ID, attribute ID, and time range to form a composite primary key for the table, and store all attribute information in the table.
[0086] Further and optionally, the S1 step includes:
[0087] S11, preprocessing the electrocarbon document and the electrocarbon report;
[0088] S12, marking the target entities in the electric carbon document, dividing the marked electric carbon document into a training set and a data set, and then inputting them into a deep learning model to identify the electric carbon entities in the electric carbon document and predict the relationship categories of the electric carbon entities to obtain electric carbon triples, and performing spatial relationship enhancement processing on the electric carbon triples; and
[0089] S13, after standardizing the name in the electric carbon report, extracting the target power generation information in the electric carbon report as the electric carbon attribute;
[0090] S14, adding the electric-carbon triplet with enhanced spatial relationship and the electric-carbon attribute to the electric-carbon knowledge graph to obtain a preprocessed electric-carbon knowledge graph with enhanced spatial relationship.
[0091] In this embodiment, the open source annotation tool Label Studio is used to annotate the entities such as power transfer in and out, location affiliation, etc. in the electric carbon document, as well as the entities such as power generation units, specific regions, power users, and time information. The preprocessed data is input into the open source model Bert-base-Chinese pre-trained for Chinese, and the cross entropy function and AdamW optimizer are used to calculate the entity category distribution of each word through forward propagation:
[0092]
[0093] Where N represents the sequence length, that is, the number of words in the sentence; C represents the total number of entity categories; y ij Indicates the true label that the i-th word belongs to the j-th category, It represents the probability that the model predicts that the i-th word belongs to the j-th category.
[0094] The trained model is used to identify the electric carbon entities in the electric carbon document. The open source Python library pandas is used to read the electric carbon table data in csv format to obtain the standardized input object. A rule matching method based on regular expressions is designed to extract power generation information such as "power supply coal consumption" and "operating hours" from the input object. These key-value pairs are used as the attributes of the electric carbon entity, called electric carbon attributes. The event type entity in the data is identified from the table and processed into the form of "start time ~ end time". The timestamp and the symbol unit of the data are used as additional information of the electric carbon attribute.
[0095] Combine the acquired entities to obtain all possible entity pairs, retrieve the electric carbon documents to obtain the context related to these entities, use the symbols [E1] and [E2] to mark the head entity and tail entity in the context text respectively, add a classification layer to the output layer of the Bert-base-Chinese model, use the [CLS] tag output by the model to achieve accurate division of relationship categories, and use the multi-classification cross entropy function to define the loss function:
[0096]
[0097] Among them, M represents the total number of categories, y i The label of the true category i (0 or 1 indicates whether it belongs to the relationship category), represents the predicted probability of category i.
[0098] Then the entity pairs and their relationships output by the model are constructed as triples in the form of (head entity, relationship, tail entity)<h,r,t> , these triplets are called electric-carbon triplets. Based on the electric-carbon triplets, the initial electric-carbon knowledge graph G is constructed as follows:<h,r,t>}, where h represents the head entity, r represents the relationship between the head and tail entities, and t represents the tail entity.
[0099] Further and optionally, in order to further refine the spatial granularity of the electric carbon knowledge graph and improve the accuracy of electric carbon entity query in a given area, the spatial relationship enhancement processing of the electric carbon triple is performed as follows:
[0100] According to the administrative planning information of the target area's geographical location published on the Internet, the electric carbon entity obtained by entity recognition is used as the head entity, and the location division area to which the head entity belongs is manually added as the tail entity. "Belongs to" is used as the fine spatial granularity relationship, and the sequence set S is used to fine-tune the Bert-base-Chinese model to guide the model to discover more fine-grained triples. Specifically, the triples are first<h,r,t> The corresponding text sequence set S = {[CLS]hrt[SEP]} is generated, where [CLS] is the sentence start marker, used to indicate the beginning of a complete sequence, h and t represent the head entity and the tail entity respectively, r represents the relationship, and [SEP] is the sentence end marker corresponding to [CLS], indicating the end of the sequence.
[0101] Combine any entity pairs to get the mask sequence S', and use the mask mark |MASK| to predict the positional relationship between the entity pairs:
[0102] S'=[CLS]h|MASK|t[SEP] (1-3)
[0103] Input the sequence S' into the Bert-base-Chinese model to obtain the context representation H of each word in the sequence:
[0104] H=BERT(S')=[s cls ,s h ,s mask ,s t ,s SEP ] (1-4)
[0105] The model uses a fully connected layer to represent the context of the mask position s mask Mapped to the output space of the vocabulary size, we get the score of each candidate word, and then use the Softmax function to convert the score into a probability distribution p(e|S'), which indicates the possibility of each word e being a filler word in the mask position:
[0106] p(e|S')=Softmax(W 0 *s mask) (1-5)
[0107] Among them, W 0 is the weight matrix of the fully connected layer.
[0108] Use the following cross entropy function to optimize the model, optimize the model parameters through back propagation and gradient descent, and continuously adjust the weights of each layer to minimize the loss function:
[0109]
[0110] Among them, e * is the vocabulary of the actual mask position, and S' is the corresponding text sequence.
[0111] Select the position word r' with the highest probability as the prediction result of the mask position, and get the corresponding triple<h,r’,t> Add the initial electric carbon knowledge graph G and iterate all entity pair sequences to obtain the preprocessed electric carbon knowledge graph G * .
[0112] S2, inputting a power carbon emission sequence with a spatiotemporal keyword into the preprocessed power carbon knowledge graph, and using a matching-aggregation model to retrieve a target power carbon entity associated with the target spatial keyword in the preprocessed power carbon knowledge graph; and,
[0113] In this embodiment, the electric carbon knowledge graph G * The process of identifying electric carbon entities related to electricity carbon emissions in the target area is regarded as a sequence matching between spatiotemporal questions and target answers.
[0114] Optionally, how to construct an electricity carbon emission sequence with time and space keywords is as follows:
[0115] First, we construct candidate sequences for matching for carbon emission calculation. By fine-tuning the Bert-base-Chinese model, we can find the text sequences of electricity carbon emission problems with spatiotemporal keywords. Perform named entity recognition to obtain the subject entity e t , used to locate key electric carbon entities in target area information. Tracking t In the Electric Carbon Knowledge Graph G * In the relationship, all distances e t One-hop and two-hop electric-carbon entity combinations as candidate electric-carbon entity sets If other entities that are more than two hops away from the subject entity are selected, the complexity of executing sequence matching will be greatly increased. Considering the relevance and computational complexity of the target entity, other electric carbon entities that are one hop and two hops away from the subject entity are selected. Each entity e in c, and concatenate them along the relationship path to form a basic candidate sequence.
[0116] To maintain the consistency of semantic space, the Bert-base-Chinese model applied in step S1 is used to complete the embedding, and the target electricity carbon emission problem text sequence Q with spatiotemporal keywords is converted into the embedding representation Q' = (q 1 ,q 2 ,…,q m ), where q i (1≤i≤m) represents the embedding vector corresponding to the vocabulary. The embedding of the candidate sequence of the electric carbon basis is represented as C=(c 1 ,c 2 ,…,c n-1 ), where c i (1≤i≤n-1) represents the embedding vector corresponding to the vocabulary, and the candidate electric carbon entity e c The corresponding embedding vector is e c To avoid overfitting of the matching-aggregation model and reduce the accuracy of electric carbon entity retrieval, C does not contain e c .
[0117] In order to improve the accuracy of matching Q and C, the candidate electric carbon entity e c The base candidate sequence is enhanced. Retrieve link to e c Other electric-carbon relations, and put the retrieved electric-carbon relations into the electric-carbon candidate answer entity e c The contextual relationship set middle, Does not include e c Link to e t A collection of relationships.
[0118] To obtain the electric carbon contextual relationship embedding representation c n , taking the arithmetic mean to encode the embedded representation Q' of the electricity carbon emission problem into a single vector
[0119]
[0120] Use graph attention network to determine the importance β of relation r in the set of electric-carbon relations for question Q r :
[0121]
[0122] Among them, exp(·) is the exponential function, W is the weight matrix of the graph attention network, b is the bias vector, and r is the embedding representation of the relation r.
[0123] β r As a weight parameter multiplied by the relationship r, all β are accumulatedr The electric-carbon relationship is not equal to 0, calculate The relational embedding representation c n :
[0124]
[0125] Finally, the embedding of the electro-carbon enhanced candidate sequence is represented as C * =(c 1 ,…,c n-1 ,c n )(1≤i≤n), where c 1 ,c 2 ,(,c n-1 is the embedded representation of the candidate sequence of electro-carbon basis.
[0126] Further and optionally, the step of using the matching-aggregation model to retrieve the target electric carbon entity associated with the target space keyword in the preprocessed electric carbon knowledge graph includes:
[0127] S21, for the embedded representation Q' and the embedded vector expression C * Encode and get the reflection q i and c j The similarity variable e between ij :
[0128] e ij =F(q i ) T F(c j )
[0129] S22, according to the similarity variable e ij , calculate the first normalized attention weight a from the answer sequence to the target sequence ij , and the second normalized attention weight b from the answer sequence to the target sequence ij :
[0130]
[0131] Where exp(·) is the exponential function, e ij Measuring q i With c j The similarity of i'j Measuring q i' With c j similarity;
[0132] S23, according to the first normalized attention weight a ij and the second normalized attention weight b ij , calculate the embedding representation component of the electric carbon problem sequence and electro-carbon enhanced candidate representation sequence embedding representation component
[0133]
[0134] S24, for all components Calculate and get the new electric carbon problem expression and electro-carbon enhanced candidate representation sequences
[0135] S25, OK and The first similarity v between 1,i , and the second similarity v between the weighted representation of the electro-carbon enhanced candidate sequence and its corresponding problem representation sequence at the jth position 2,j :
[0136]
[0137] In the formula, ⊙ is element-wise multiplication, that is, multiplying the elements of corresponding positions of two matrices of the same size one by one, and FNN is a feedforward neural network with ReLU as the activation function;
[0138] S26, using a long short-term memory network to analyze the first similarity v 1,i and the second similarity v 2,j Perform aggregation to obtain the aggregate vector and
[0139]
[0140] S27, solved using the maximum pooling method and The maximum value of and Will and After connection, use the feedforward neural network FNN to get the matching score
[0141]
[0142] S28, will match the score Entities greater than the threshold are output as candidate answers to obtain the target electric carbon entity Among them, the set E of target electric carbon entities area The expression is:
[0143]
[0144] S3, based on a pre-designed distance measurement query method including a distance function, query the electric carbon attributes in the pre-processed electric carbon knowledge graph, normalize the retrieved electric carbon attributes, and then perform weighted calculation on the electric carbon attributes in combination with time correlation to obtain time fine-grained electric carbon variables that meet the target requirements, and construct an electric carbon variable dictionary based on each of the time fine-grained electric carbon variables;
[0145] In this embodiment, the distance measurement query method is mainly as follows: query the index table established in step 1 to obtain the entity ID corresponding to the entity name, design a query template based on the SQL statement, fill the entity ID into the template, retrieve all attributes by default, select the time range extracted from Q, complete the query statement instantiation, and implement the distance measurement function dis in the query statement. Specifically, the input time interval is [K s ,K e ], the time range recorded in the storage table is [R s ,R e ], the distance metric function dis is a piecewise function:
[0146]
[0147] In this embodiment, the retrieved electric-carbon attributes are normalized and weightedly calculated based on the time correlation to obtain time-fine-grained electric-carbon variables that meet the target requirements, and an electric-carbon variable dictionary is constructed based on each of the time-fine-grained electric-carbon variables.
[0148] Optionally, the target requirement is: set a minimum distance threshold θ, where θ is in days, select annual granularity (θ≤365), quarterly granularity (θ≤90), and monthly granularity (θ≤30) as needed, and output all records whose function values are less than θ.
[0149] According to the different attribute IDs of the records, the records with the same entity ID and the same attribute ID but different time ranges are normalized based on the time range of Q, and then the normalized electric carbon attributes are summed to obtain the expression of the time fine-grained electric carbon variable:
[0150]
[0151] in, represents the electric carbon variable corresponding to the electric carbon attribute x of the electric carbon entity k; n' represents the number of records with the same attribute ID that meet the minimum distance threshold, x i K represents the attribute value of the ith record under the electric carbon attribute x corresponding to the electric carbon entity k; s represents the start timestamp extracted from Q, K e Indicates the end timestamp extracted from Q, R sIndicates the start timestamp of the record, R e Indicates the end timestamp of the record.
[0152] Electric Carbon Entity All electric carbon variables After the calculation is completed, the electric carbon variable set is established Electrocarbon Entity All electric carbon variables Stored in the collection in the form of key-value pairs of "variable name: variable value" In the above example, a dictionary of electric carbon variables is formed.
[0153] S4, generating a computational graph node according to the electric carbon variable dictionary, adding directed edges to the graph nodes in the order of formula execution marked in a preset electric carbon formula library, and generating a computational graph;
[0154] S5, executing the formulas corresponding to the vertices in the topological sorting sequence in the calculation graph, instantiating the formula trees corresponding to the formulas, and solving them through post-order traversal to obtain instantiated formula trees, and calculating the direct carbon emission factor of the target area according to the instantiated formula trees;
[0155] In this embodiment, the calculation formula for electricity carbon emissions is called the electricity carbon formula. The collected electricity carbon formula is manually converted into a LaTeX equation ε. The parse function provided by the open source Python library Sympy is used to take ε as a parameter and return the string representation T of the formula tree. Different Ts are selected to form different formula libraries. in For the A formula tree, Formula Tree Variables and symbols in the formula library Each formula tree is numbered in the formula tree, and the number of formula ε is ID ε , used to constrain the execution order of the formula. Logically abstracted as a computational graph Where ID ε To number the formula, set the ID ε As the vertices in the graph, E is a directed edge between vertices, indicating the execution order of the vertices.
[0156] Construct different formula libraries for different types of electric carbon entities The calculation graph structure is adjusted dynamically. Electric carbon entities directly related to power generation, such as power plants and generators, are defined as power generation entities. The electric carbon variable set D corresponding to the power generation entity is queried. According to the required calculation formula, the electric carbon variable set D is selected from the formula library. Select the formula number to generate a directed acyclic graph If there are multiple electric carbon variables of the same type but different sources in the set D, that is, the same formula needs to be executed multiple times to complete the calculation, then multiple vertices corresponding to the formula are generated according to the formula required by the variable, and the same logical number is set for the vertices. The electric carbon variable name and the logical number are combined to distinguish different vertices. When all vertices are generated, they are sorted according to the formula library. According to the pre-agreed formula numbering order, first add directed edges to the vertices with logical numbers 1 to form a minimal connected subgraph Then, according to the principle that vertices of the same type are logically equivalent, Generate directed edges for the remaining vertices, thus transforming the calculation order into a topological sorting sequence for executing the directed acyclic graph.
[0157] When executing, first query the fields in the electric carbon attribute set D, extract the value corresponding to the key, assign values to the numerical nodes of the formula tree, and obtain the instantiated electric carbon formula tree T', using T' as the basic unit for each calculation. Perform a depth-first search. Once all adjacent nodes of a node have been visited, the node is pushed into the stack. Finally, the elements in the stack are taken out in reverse order. Topological sorting sequence of Finally press The formulas in the formula library are called sequentially to perform calculations in the order specified in .
[0158] There are operator nodes and value nodes in the formula tree. After the formula tree is instantiated, there will be some intermediate variable nodes in the value nodes that are not assigned values temporarily, which can be ignored in actual calculations. First, perform post-order traversal on the formula tree and push the nodes into the stack, which is called the traversal stack; in the specific calculation, configure a new stack to save the calculation order, which is called the calculation stack. Pop the top element from the traversal stack to the calculation stack in sequence. If the popped node is an operator node, continue to pop elements from the traversal stack. If the popped node is a value node, check whether the top element of the calculation stack is a value node. If the top node of the calculation stack is a value node, take out the top node of the calculation stack and the next top node. This node must be an operator node. According to the order of taking out from the calculation stack, take the value node and the operator node as parameters and pass them into the calculation function to complete the calculation. Take the return value of the calculation function as the new value node as the top of the calculation stack until there is only one value node left in the calculation stack, and take the remaining value node as the calculation result of the public tree.
[0159] All power generation entities Execute the operation in step 3.3 and record the results in the result set Sum all the results to get the carbon emissions of region z
[0160]
[0161] in, That is, a power generation entity e i of carbon emissions.
[0162] By querying the electric carbon variable set D, the power generation of each power generation entity in the region is obtained and summed up to obtain the regional direct power generation E that meets the requirements of the problem z Then, according to the carbon emission factor solution formula, the direct carbon emission factor EF of region z is obtained z :
[0163]
[0164] S6, correcting the direct carbon emission factor by taking into account the impact of power transfer, and obtaining the average carbon emission factor of the target area as a power carbon emission factor with high temporal and spatial resolution.
[0165] In this embodiment, in actual application scenarios, there may be a situation where electricity is transferred in and out between regions. By further considering the problem of electricity transferred in and out between regions, the average carbon emission factor can be calculated.
[0166] Generally, the target area z will contain an entity e from other areas j Net electricity imports The power entity e needs to be considered in the calculation j Carbon emissions V' transferred to target area z z,h , use the above calculation method to first calculate the direct carbon emission factor EF of other regions, and query entity e j Direct carbon emission factor EF of the region j As an entity j The direct carbon emission factor of entity e is calculated using the following formula j Carbon emissions V' of electricity imported into target area z z,j :
[0167]
[0168] Among them, EF j It is entity e j Direct carbon emission factor of the region, Yes j Transfer the power of target area z.
[0169] Retrieve other entities with “power transfer” relationship with target area z on the electric carbon knowledge graph, and imitate the above search for entity e j The processing method is to obtain the carbon emissions V' of these entities transferred to the target area z zand net electricity import Finally, the carbon emissions V' z and net electricity import Sum them up to get the net carbon emissions transferred to the target area z and the net amount of electricity transferred into the target area z, E' z :
[0170]
[0171] Finally, the average carbon emission factor EF' of the target area z is obtained z :
[0172]
[0173] In the technical solution provided in this embodiment, entities and relationships are extracted from electric carbon documents to form electric carbon triples, and a regular expression-based electric carbon table data extraction method is designed for the electric carbon table. According to the obtained entities, relationships and attributes, an electric carbon knowledge graph is constructed; then the given questions and the answers corresponding to the questions are regarded as sequences, and based on the sequence matching idea and the two-way attention mechanism, a power carbon emission data retrieval method is designed in combination with distance metric query to achieve the discovery of target electric carbon entities and electric carbon attributes from the electric carbon field knowledge graph, and then the corresponding calculation graph is generated, and the relevant formulas in the electric carbon formula library are called according to the topological sorting of the calculation graph to complete the calculation and obtain the regional direct carbon emission factor; finally, according to the power transfer relationship in the electric carbon knowledge graph, the regional average carbon emission factor considering power transfer is corrected on the basis of the regional direct carbon emission factor. This method can effectively improve the update frequency of the carbon emission factor, make the calculation results interpretable, improve the accuracy of power system operation and planning, and help achieve low-carbon transformation and sustainable development in the power industry.
[0174] Second embodiment
[0175] In this embodiment, based on the method in the first embodiment, the carbon emission factors of various districts in Kunming in the second quarter of 2019 are taken as an example for specific calculation:
[0176] (1) Construction of electric carbon knowledge graph
[0177] First, the electric carbon documents were standardized and cleaned to filter out redundant punctuation and duplicates. Then, Bert-base-Chinese Tokenizer was used for word segmentation to convert the text sequence into a standardized input for the model. Some of the vocabularies are shown in Table 1. A comparison table of electric carbon vocabulary was designed, and a storage table was established for the extracted electric carbon attributes. Some of the records in the storage table are shown in Table 2.
[0178] Table 1. Partial vocabulary of the electric carbon knowledge graph
[0179]
[0180] Table 2. Storage table structure and some carbon property records
[0181]
[0182] Next, Label Studio was used to annotate the entities in the electric carbon document, and the annotated data set was divided into a training set and a validation set in a ratio of 8:2. The preprocessed data was input into the Bert-base-Chinese model, and the AdamW optimizer was used. After the model training was completed, the electric carbon entities were identified from the electric carbon document. Some electric carbon entities and space entities are shown in Table 3.
[0183] Table 3. Some electric carbon entities and space entities
[0184]
[0185] Next, the electric carbon entities obtained in the previous step are combined to obtain entity pairs, and the context texts of these entities are obtained in the electric carbon document. After the texts are spliced, the head entity is identified by a special tag [E1], and [E2] is used to identify the tail entity. The relationship category is predefined, and the Bert-base-Chinese model is used to discover the potential relationship in the context text, which is combined with the entity pairs to form triples. Some entity pairs and relationships are shown in Table 4.
[0186] Table 4. Some entity pairs and their partial relations
[0187]
[0188] In the relation enhancement stage, part of the input sequence S is decomposed into a context representation H after vocabulary decomposition, where some of the decomposed sequences are shown in Table 5. and its corresponding probability distribution p(e|S), the one with the highest probability After decoding, new triples are formed as output to complete the spatial relationship enhancement of the electric-carbon knowledge graph.
[0189] Table 5. Disassembly sequence corresponding to the input sequence
[0190]
[0191] (2) Obtaining carbon emission information
[0192] Identify the subject entity e from the electricity carbon emission text sequence Q t , some of the subject entity recognition results are shown in Table 6. t One-hop and two-hop electric carbon entities are identified and combined as candidate electric carbon entity sets The candidate electricity carbon entities are connected in series along the relationship path to form an electricity carbon base candidate sequence. To maintain semantic space consistency, the Bert-base-Chinese model in step 1 is used to complete the embedding, and the target electricity carbon emission text sequence with spatiotemporal keywords is converted into an electricity carbon problem embedding representation Q = q 1 ,q 2 ,…,q m ), where q i (1≤i≤m) represents the embedding vector corresponding to the vocabulary.
[0193] Table 6 Part of the topic entity recognition results
[0194]
[0195] Further, we calculate c n , thus the embedded representation of the electric carbon enhanced candidate sequence is obtained. The basic candidate sequences and contextual relationships corresponding to some candidate entities are shown in Table 7.
[0196] Table 7. Candidate entities and their candidate sequences and contextual relationships
[0197]
[0198] Further, the calculation reflects q i and c j Similarity variable e ij , some of the results are shown in Table 8. ij Calculate the normalized attention weight a ij and b ij , use a ij and b ij As the weight, a more accurate embedding representation of the electric carbon problem sequence is calculated. and electro-carbon enhanced candidate representation sequence embedding representation
[0199] Table 8. Similarity e ij The calculation results
[0200]
[0201] Further, we calculate v 1,i and v 2,j , and then use LSTM to 1,i and v 2,j Aggregation and The new vector obtained using the maximum pooling and Get the maximum value and A feedforward neural network is used to calculate the matching score s between the question representation sequence Q and the candidate representation sequence C. Based on the matching score, a probability distribution partial matching score s is generated, as shown in Table 9.
[0202] Table 9. Partial table of matching scores between question representation sequence Q and candidate representation sequence C
[0203]
[0204] Calculate v 1,i and v 2,j , and then use LSTM to 1,i and v 2,j Aggregation and The new vector obtained using the maximum pooling and Get the maximum value and A feedforward neural network is used to calculate the matching score s between the question representation sequence Q and the candidate representation sequence C. Based on the matching score, a probability distribution partial matching score s is generated, as shown in Table 9.
[0205] Furthermore, for the electric carbon entity obtained in the previous step, the storage table is queried to obtain the electric carbon attributes, and the electric carbon attributes are weighted to obtain the electric carbon variables. Some calculation results are shown in Table 10, where the values in brackets represent the values after normalization and weighted operations.
[0206] Table 10. Calculation results of some electrocarbon variables
[0207]
[0208] (3) Calculation of electricity carbon emission factors
[0209] The electro-carbon formula is parsed to obtain a formula tree, and the formula tree is selected to form a formula library, some of which are shown in Table 11.
[0210] Table 11. Partial formula library structure
[0211]
[0212]
[0213] Determine the number of formula vertices based on the electric carbon attribute set, and generate a calculation graph based on the execution order agreed upon by the formula library Traverse again Get A topological sort is performed, and the formula library is executed in the order of the topological sort. Each time it is executed, the relevant variables are queried from the electric carbon attribute set and assigned values, so as to obtain the instantiated formula tree.
[0214] The instantiated formula tree is solved, and some of the solution results are shown in Table 12.
[0215] Table 12. Solution results of some electric carbon entities
[0216]
[0217] When all the formula trees in the entire formula forest are solved, the solution results are summed up and summarized as a single electric carbon entity e i Carbon emissions After all the electric carbon entities are solved and the results are obtained, they are summed up. Some of the solution results are shown in Table 13, and the data unit is kilograms of carbon dioxide.
[0218] Table 13. Final results after polymerization of some electrocarbon entities
[0219]
[0220] First, the regional direct carbon emission factor is calculated, and then the direct carbon emission factor is corrected to obtain the regional average carbon emission factor. The correction results are shown in Table 14.
[0221] Table 14. Regional carbon emission factors and their correction results
[0222]
[0223] Reference Figure 2 As an implementation solution, Figure 2 This is a schematic diagram of the architecture of the hardware operating environment of the computer system involved in the embodiment of the present application.
[0224] like Figure 2As shown, the computer system may include: a processor 1001, such as a CPU, a memory 1005, a user interface 1003, a network interface 1004, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0225] Those skilled in the art will understand that Figure 2 The computer system architecture shown in the figure does not constitute a limitation of the computer system, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0226] like Figure 2 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a high-temporal-resolution electricity carbon emission factor calculation program. Among them, the operating system is a program that manages and controls the hardware and software resources of the computer system, the high-temporal-resolution electricity carbon emission factor calculation program and other software or programs.
[0227] exist Figure 2 In the computer system shown, the user interface 1003 is mainly used to connect to the terminal and communicate data with the terminal; the network interface 1004 is mainly used for the background server and communicates data with the background server; the processor 1001 can be used to call the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005.
[0228] In this embodiment, the computer system includes: a memory 1005, a processor 1001, and a high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory and executable on the processor, wherein:
[0229] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0230] S1, constructing an electric carbon knowledge graph based on the collected electric carbon documents and electric carbon reports, and performing spatial relationship enhancement processing on the electric carbon knowledge graph to obtain a preprocessed electric carbon knowledge graph;
[0231] S2, inputting a power carbon emission sequence with a spatiotemporal keyword into the preprocessed power carbon knowledge graph, and using a matching-aggregation model to retrieve a target power carbon entity associated with the target spatial keyword in the preprocessed power carbon knowledge graph; and,
[0232] S3, based on a pre-designed distance measurement query method including a distance function, query the electric carbon attributes in the pre-processed electric carbon knowledge graph, normalize the retrieved electric carbon attributes, and then perform weighted calculation on the electric carbon attributes in combination with time correlation to obtain time fine-grained electric carbon variables that meet the target requirements, and construct an electric carbon variable dictionary based on each of the time fine-grained electric carbon variables;
[0233] S4, generating a computational graph node according to the electric carbon variable dictionary, adding directed edges to the graph nodes in the order of formula execution marked in a preset electric carbon formula library, and generating a computational graph;
[0234] S5, executing the formulas corresponding to the vertices in the topological sorting sequence in the calculation graph, instantiating the formula trees corresponding to the formulas, and solving them through post-order traversal to obtain instantiated formula trees, and calculating the direct carbon emission factor of the target area according to the instantiated formula trees;
[0235] S6, correcting the direct carbon emission factor by taking into account the impact of power transfer, and obtaining the average carbon emission factor of the target area as a power carbon emission factor with high temporal and spatial resolution.
[0236] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0237] Preprocessing the electrocarbon document and the electrocarbon report;
[0238] Annotating the target entities in the electric carbon document, dividing the annotated electric carbon document into a training set and a data set, and then inputting them into a deep learning model to identify the electric carbon entities in the electric carbon document and predict the relationship categories of the electric carbon entities to obtain electric carbon triples, and performing spatial relationship enhancement processing on the electric carbon triples; and
[0239] After standardizing the names in the electric carbon report, extracting the target power generation information in the electric carbon report as the electric carbon attribute;
[0240] The electric-carbon triplet with enhanced spatial relationship and the electric-carbon attribute are added to the electric-carbon knowledge graph to obtain a preprocessed electric-carbon knowledge graph with enhanced spatial relationship.
[0241] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0242] S10, decompose the input sequence S into a vocabulary sequence using a word segmenter, and then input it into the BERT model to obtain the context representation H of each word in the sequence, wherein the expression of the input sequence S is:
[0243] S=[CLS]h|MASK|t[SEP]
[0244] Wherein, [CLS] is the sentence start marker of the BERT model; h and t represent the head entity and the tail entity respectively, the head entity is the electric carbon entity, the tail entity is the fine-grained location division location, |MASK| represents the spatial relationship to be predicted; [SEP] is the sentence end marker of the BERT model, corresponding to [CLS], indicating the end of the sequence;
[0245] The context represents the expression of H as follows:
[0246]
[0247] S20, through the fully connected layer Mapping to the output space of the vocabulary size, we can get the score of each candidate word, and then use the softmax function to convert the score into a probability distribution p(e|S):
[0248]
[0249] Where W 0 are the parameters of the BERT model;
[0250] S30, select the word with the highest probability as the prediction result of the mask position, and define the new sequence after the mask position prediction of sequence S as s * ;
[0251] S40, using the cross entropy function to optimize the model, optimizing the model parameters through back propagation and gradient descent method, and continuously adjusting the weights of each layer to minimize the loss function, thereby obtaining the electric-carbon triplet after the spatial relationship enhancement processing.
[0252]
[0253] In the formula, e * is the vocabulary of the actual mask position.
[0254] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0255] From the electricity carbon emission text sequence Q with spatiotemporal keywords, we fine-tune the BERT model and perform named entity recognition on it to identify a topic entity et ;
[0256] Identify all entities e that are close to the subject t One-hop and two-hop electric carbon entities are combined into a candidate electric carbon entity set
[0257] The candidate electro-carbon entity set Each entity e in c Connecting them in series along the relationship path to form a sequence, obtaining an electric-carbon basis candidate sequence Q, wherein the electric-carbon basis candidate sequence does not include the last embedded vector;
[0258] The candidate sequence Q of the electric carbon basis is converted into an embedded representation Q' = (q 1 ,q 2 ,…,q m ), where q i (1≤i≤m) represents the embedding vector corresponding to the vocabulary;
[0259] The embedding vector expression C of the candidate sequence of electro-carbon basis * for:
[0260] C * =(c 1 ,…,c n-1 ,c n ):
[0261] in,
[0262]
[0263] In the formula, c n is the embedding representation of the candidate sequence of the electric carbon basis, β r represents the importance coefficient of the relation embedding representation r in the electric-carbon relation set for the electric-carbon basis candidate sequence Q, represents a single vector after the arithmetic mean of the candidate sequence Q' of the electric carbon basis is taken, exp(·) is the exponential function, w and b are the model parameters of the graph attention network, q i (1≤i≤m) represents the embedding vector corresponding to a single word, Represents the candidate answer entity e c A collection of electro-carbon contextual relationships.
[0264] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0265] S21, for the embedded representation Q' and the embedded vector expression C * Encode and get the reflection q i and cj The similarity variable e between ij :
[0266] e ij =F(q i ) T F(c j )
[0267] S22, according to the similarity variable e ij , calculate the first normalized attention weight a from the answer sequence to the target sequence ij , and the second normalized attention weight b from the answer sequence to the target sequence ij :
[0268]
[0269] Where exp(·) is the exponential function, e ij Measuring q i With c j The similarity of i ' j Measuring q i 'With c j similarity;
[0270] S23, according to the first normalized attention weight a ij and the second normalized attention weight b ij , calculate the embedding representation component of the electric carbon problem sequence and electro-carbon enhanced candidate representation sequence embedding representation component
[0271]
[0272] S24, for all components Calculate and get the new electric carbon problem expression and electro-carbon enhanced candidate representation sequences
[0273] S25, OK and The first similarity v between 1,i , and the second similarity v between the weighted representation of the electro-carbon enhanced candidate sequence and its corresponding problem representation sequence at the jth position 2,j :
[0274]
[0275] In the formula, ⊙ is element-wise multiplication, that is, multiplying the elements of corresponding positions of two matrices of the same size one by one, and FNN is a feedforward neural network with ReLU as the activation function;
[0276] S26, using a long short-term memory network to analyze the first similarity v 1,i and the second similarity v 2,j Perform aggregation to obtain the aggregate vector and
[0277]
[0278] S27, solved using the maximum pooling method and The maximum value of and Will and After connection, use the feedforward neural network FNN to get the matching score
[0279]
[0280] S28, will match the score Entities greater than the threshold are output as candidate answers to obtain the target electric carbon entity Among them, the set E of target electric carbon entities area The expression is:
[0281]
[0282] When the processor 1001 calls the high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory 1005, the following operations are performed:
[0283] S61, query entity e j Direct carbon emission factor EF of the region j As an entity j Direct carbon emission factor, calculation entity e j Carbon emissions V' of electricity imported into target area z z,j :
[0284]
[0285] S62, searching other target entities that have a "power transfer" relationship with the target area z on the electric carbon knowledge graph, and obtaining the carbon emissions V' of the other target entities transferred to the target area z z and net electricity import Finally, the carbon emissions V' z and net electricity import Sum them up to get the net carbon emissions transferred to the target area z and the net amount of electricity transferred into the target area z, E' z :
[0286]
[0287] S63, calculating the average carbon emission factor of the target area z as the electricity carbon emission factor with high spatiotemporal resolution:
[0288]
[0289] It is understood that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in a computer system to implement the process steps of the embodiment of the above method.
[0290] Therefore, the present application also provides a computer-readable storage medium, which stores a high temporal and spatial resolution electricity carbon emission factor calculation program. When the high temporal and spatial resolution electricity carbon emission factor calculation program is executed by a processor, it implements the various steps of the high temporal and spatial resolution electricity carbon emission factor calculation method described in the above embodiment.
[0291] The computer-readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which may store program codes.
[0292] It should be noted that since the storage medium provided in the embodiment of the present application is the storage medium used to implement the method of the embodiment of the present application, based on the method introduced in the embodiment of the present application, the person skilled in the art can understand the specific structure and deformation of the storage medium, so it is not repeated here. All storage media used in the method of the embodiment of the present application belong to the scope of protection of this application.
[0293] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt 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.) that contain computer-usable program code.
[0294] The present application is described with reference to flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0295] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0296] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0297] It should be noted that in the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claim. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The present application may be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0298] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0299] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for calculating electricity carbon emission factors with high temporal and spatial resolution, characterized in that: The method comprises the following steps: S1, constructing an electric carbon knowledge graph based on the collected electric carbon documents and electric carbon reports, and performing spatial relationship enhancement processing on the electric carbon knowledge graph to obtain a preprocessed electric carbon knowledge graph; S2, inputting a power carbon emission sequence with a spatiotemporal keyword into the preprocessed power carbon knowledge graph, and using a matching-aggregation model to retrieve a target power carbon entity associated with the target spatial keyword in the preprocessed power carbon knowledge graph; and, S3, based on a pre-designed distance measurement query method including a distance function, query the electric carbon attributes in the pre-processed electric carbon knowledge graph, normalize the retrieved electric carbon attributes, and then perform weighted calculation on the electric carbon attributes in combination with time correlation to obtain time fine-grained electric carbon variables that meet the target requirements, and construct an electric carbon variable dictionary based on each of the time fine-grained electric carbon variables; S4, generating a computational graph node according to the electric carbon variable dictionary, adding directed edges to the graph nodes in the order of formula execution marked in a preset electric carbon formula library, and generating a computational graph; S5, executing the formulas corresponding to the vertices in the topological sorting sequence in the calculation graph, instantiating the formula trees corresponding to the formulas, and solving them through post-order traversal to obtain instantiated formula trees, and calculating the direct carbon emission factor of the target area according to the instantiated formula trees; S6, correcting the direct carbon emission factor by taking into account the impact of power transfer, and obtaining the average carbon emission factor of the target area as a power carbon emission factor with high temporal and spatial resolution.
2. The method according to claim 1, characterized in that The S1 step includes: Preprocessing the electrocarbon document and the electrocarbon report; Annotating the target entities in the electric carbon document, dividing the annotated electric carbon document into a training set and a data set, and then inputting them into a deep learning model to identify the electric carbon entities in the electric carbon document and predict the relationship categories of the electric carbon entities to obtain electric carbon triples, and performing spatial relationship enhancement processing on the electric carbon triples; and After standardizing the names in the electric carbon report, extracting the target power generation information in the electric carbon report as the electric carbon attribute; The electric-carbon triplet with enhanced spatial relationship and the electric-carbon attribute are added to the electric-carbon knowledge graph to obtain a preprocessed electric-carbon knowledge graph with enhanced spatial relationship.
3. The method according to claim 2, characterized in that The step of performing spatial relationship enhancement processing on the electric-carbon triplet comprises: S10, decompose the input sequence S into a vocabulary sequence using a word segmenter, and then input it into the BERT model to obtain the context representation H of each word in the sequence, wherein the expression of the input sequence S is: S=[CLS]h|MASK|t[SEP] Wherein, [CLS] is the sentence start marker of the BERT model; h and t represent the head entity and the tail entity respectively, the head entity is the electric carbon entity, the tail entity is the fine-grained location division location, |MASK| represents the spatial relationship to be predicted; [SEP] is the sentence end marker of the BERT model, corresponding to [CLS], indicating the end of the sequence; The context represents the expression of H as follows: S20, through the fully connected layer Mapping to the output space of the vocabulary size, we can get the score of each candidate word, and then use the softmax function to convert the score into a probability distribution p(e|S): Where W0 is the parameter of the BERT model; S30, select the word with the highest probability as the prediction result of the mask position, and define the new sequence after the mask position prediction of sequence S as s * ; S40, using the cross entropy function to optimize the model, optimizing the model parameters through back propagation and gradient descent method, and continuously adjusting the weights of each layer to minimize the loss function, thereby obtaining the electric-carbon triplet after the spatial relationship enhancement processing. In the formula, e * is the vocabulary of the actual mask position.
4. The method according to claim 1, characterized in that The construction process of the electricity carbon emission sequence with time and space keywords includes: From the electricity carbon emission text sequence Q with spatiotemporal keywords, we fine-tune the BERT model and perform named entity recognition on it to identify a topic entity e t ; Identify all entities e that are close to the subject t One-hop and two-hop electric carbon entities are combined into a candidate electric carbon entity set The candidate electro-carbon entity set For each entity e c Connecting them in series along the relationship path to form a sequence, obtaining an electric-carbon basis candidate sequence Q, wherein the electric-carbon basis candidate sequence does not include the last embedded vector; The candidate sequence Q of the electric carbon basis is converted into an embedded representation Q' = (q1, q2, ..., q m ), where q i (1≤i≤m) represents the embedding vector corresponding to the vocabulary; The embedding vector expression C of the candidate sequence of electro-carbon basis * for: C * =(c1,…,c n-1 ,c n ): in, In the formula, c n is the embedding representation of the candidate sequence of the electric carbon basis, β r represents the importance coefficient of the relation embedding representation r in the electric-carbon relation set for the electric-carbon basis candidate sequence Q, represents a single vector after the arithmetic mean of the candidate sequence Q' of the electric carbon basis is taken, exp(·) is the exponential function, w and b are the model parameters of the graph attention network, q i (1≤i≤m) represents the embedding vector corresponding to a single word, Represents the candidate answer entity e c A collection of electro-carbon contextual relationships.
5. The method according to claim 4, characterized in that The step of using the matching-aggregation model to retrieve the target electric carbon entity associated with the target space keyword in the pre-processed electric carbon knowledge graph includes: S21, for the embedded representation Q' and the embedded vector expression C * Encode and get the reflection q i and c j The similarity variable e between ij : e ij =F(q i ) T F(c j ) S22, according to the similarity variable e ij , calculate the first normalized attention weight a from the answer sequence to the target sequence ij , and the second normalized attention weight b from the answer sequence to the target sequence ij : Where exp(·) is the exponential function, e ij Measuring q i With c j The similarity of i ' j Measuring q i 'With c j similarity; S23, according to the first normalized attention weight a ij and the second normalized attention weight b ij , calculate the embedding representation component of the electric carbon problem sequence and electro-carbon enhanced candidate representation sequence embedding representation component S24, for all components Calculate and get the new electric carbon problem expression and electro-carbon enhanced candidate representation sequences S25, OK and The first similarity v between 1,i , and the second similarity v between the weighted representation of the electro-carbon enhanced candidate sequence and its corresponding problem representation sequence at the jth position 2,j : In the formula, ⊙ is element-wise multiplication, that is, multiplying the elements of corresponding positions of two matrices of the same size one by one, and FNN is a feedforward neural network with ReLU as the activation function; S26, using a long short-term memory network to analyze the first similarity v 1,i and the second similarity v 2,j Perform aggregation to obtain the aggregate vector and S27, solved using the maximum pooling method and The maximum value of and Will and After connection, use the feedforward neural network FNN to get the matching score S28, will match the score Entities greater than the threshold are output as candidate answers to obtain the target electric carbon entity Among them, the set E of target electric carbon entities area The expression is:
6. The method according to claim 1, characterized in that The expression of the time fine-grained electric carbon variable is: In the formula, represents the electric carbon variable corresponding to the electric carbon attribute x of the electric carbon entity k; n' represents the number of records with the same attribute ID that meet the minimum distance threshold, x i K represents the attribute value of the ith record under the electric carbon attribute x corresponding to the electric carbon entity k; s represents the start timestamp extracted from Q, K e Indicates the end timestamp extracted from Q, R s Indicates the start timestamp of the record, R e Indicates the end timestamp of the record.
7. The method according to claim 1, characterized in that The S6 step specifically includes: S61, query entity e j Direct carbon emission factor EF of the region j As an entity j Direct carbon emission factor, calculation entity e j Carbon emissions V' of electricity imported into target area z z,j : S62, searching other target entities that have a "power transfer" relationship with the target area z on the electric carbon knowledge graph, and obtaining the carbon emissions V' of the other target entities transferred to the target area z z and net electricity import Finally, the carbon emissions V' z and net electricity import Sum them up to get the net carbon emissions transferred to the target area z and the net amount of electricity transferred into the target area z, E' z : S63, calculating the average carbon emission factor of the target area z as the electricity carbon emission factor with high spatiotemporal resolution:
8. A computer system, characterized in that: The computer system includes: a memory, a processor, and a high temporal and spatial resolution electricity carbon emission factor calculation program stored in the memory and executable on the processor. When the high temporal and spatial resolution electricity carbon emission factor calculation program is executed by the processor, the steps of calculating the high temporal and spatial resolution electricity carbon emission factor are implemented as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for calculating the carbon emission factor of electricity with high spatiotemporal resolution, and when the program for calculating the carbon emission factor of electricity with high spatiotemporal resolution is executed by a processor, the steps of the method for calculating the carbon emission factor of electricity with high spatiotemporal resolution as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Online carbon emission dynamic measurement display method and system
CN118863920A
Regional power carbon dioxide dynamic emission factor accounting system
CN118866144A
Cited By
Carbon dioxide distribution prediction method and system
CN120996831A
Space-time traceable power average emission factor generation and presentation method and system
CN121189617A
Space-time traceable electric power average emission factor generation and presentation method and system
CN121189617B