Power average carbon emission factor short-term prediction method, system and device based on double attention mechanism and storage medium
Patent Information
- Application Number
- CN202611125646.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]本发明的目的在于提供一种基于双重注意力机制的电力平均碳排放因子短期预测方法、系统、设备及存储介质,以解决现有技术中预测精度不足、无法动态识别关键历史时刻和输入特征的问题
[0009]与现有技术相比,本发明具有如下显著优点:1、通过双重注意力机制构建短期预测模型,将时间注意力和特征注意力相结合,能够同时捕捉历史序列中的关键时段信息以及输入各类特征之间的耦合影响关系,提高对电力平均碳排放因子变化规律的刻画能力;2、通过在短期预测模型中设置时间-特征耦合模块,对发电、气象、时间等多维信息进行统一获取、筛选和评估,有助于增强输入特征的代表性和有效性,进而提高模型对电力平均碳排放因子波动规律的识别能力;3、通过引入特征注意力机制,考虑电碳因子的区域差异性,使预测模型能够更贴合不同区域的实际运行状态,从而提高模型在多区域场景下的适用性和预测可信度。
Smart Images

Figure CN123014293A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method, system, device, and storage medium for short-term prediction of the average carbon emission factor of electricity, specifically to a method, system, device, and storage medium for short-term prediction of the average carbon emission factor of electricity based on a dual attention mechanism. Background Technology
[0002] As the core carrier of carbon emissions from energy activities, the characterization and regulation of carbon emissions during the operation of the power system have attracted widespread attention. The average carbon emission factor (CAEP) of electricity is typically used to characterize the average carbon emission level corresponding to a unit of electricity consumption and is a crucial fundamental parameter for conducting power carbon accounting, green energy assessment, demand-side low-carbon response, coordinated power-carbon dispatch, and carbon trading settlement. Under the background of new power system construction, the large-scale grid connection of new energy sources, the enhanced electronic characteristics of power, increased load fluctuations, and increasingly frequent inter-regional power flows have led to significant time-varying, volatile, and coupled characteristics of power system carbon emissions. Traditional static accounting methods are no longer sufficient to meet the needs of short-cycle, dynamic applications. Therefore, conducting short-term prediction research on the average carbon emission factor of electricity has become an important technical direction to support the refined low-carbon operation of the power system.
[0003] While existing technologies have made some progress in areas such as electricity carbon emission accounting and the calculation of average carbon emission factors for electricity, several shortcomings remain in short-term prediction. First, existing methods for predicting average carbon emission factors for electricity often struggle to simultaneously handle nonlinear relationships, multidimensional categorical variables, and complex coupling relationships between multi-source data, leading to insufficient fitting ability or poor generalization performance. Second, changes in the average carbon emission factor for electricity are not determined by a single factor but are influenced by multiple factors, including the power generation structure, renewable energy absorption, meteorological disturbances, and periodic temporal characteristics. Existing technologies focus only on single dimensions such as meteorology or power generation structure, resulting in insufficient characterization of the actual fluctuation mechanism. Third, differences in energy endowment, unit structure, renewable energy penetration levels, load characteristics, and inter-regional power reception across different regions lead to inconsistent formation mechanisms and fluctuation characteristics of the average carbon emission factor for electricity at the same time scale. Existing technologies typically use uniform models or parameters, failing to reflect individual regional characteristics. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, device and storage medium for short-term prediction of average carbon emission factor of electricity based on a dual attention mechanism, so as to solve the problems of insufficient prediction accuracy and inability to dynamically identify key historical moments and input features in the prior art.
[0005] This invention provides a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism, the method comprising: Obtain power generation data, emission factor values, and electricity input data from outside the region for each energy type within a given region. Utilize the power source geolocation method to calculate the average carbon emission factor of electricity for the given region based on the power generation data, emission factor values, and electricity input data from outside the region for each energy type within the given region. Acquire power generation forecast data for each energy type, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, construct the original dataset, and perform data preprocessing; Construct a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention; Based on the original dataset and the corresponding average carbon emission factor labels for electricity, a loss function is constructed. The loss function is then used to iteratively train a short-term prediction model for the average carbon emission factor for electricity, and the average carbon emission factor for electricity during the prediction period is output.
[0006] This invention provides a short-term prediction system for the average carbon emission factor of electricity based on a dual attention mechanism, comprising: The data acquisition unit is used to acquire power generation data, emission factor values and electricity data input from outside the region for each energy type within a given area. Using the power source geolocation method, it calculates the average carbon emission factor of electricity in the given area based on the power generation data, emission factor values and electricity data input from outside the region for each energy type within the given area. The data preprocessing unit is used to acquire power generation forecast data of various energy types, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, to construct the original dataset and perform data preprocessing. The model building unit is used to build a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention. The model includes a time attention module, a feature attention module, a time-feature coupling module, and a prediction module. The prediction output unit is used to construct a loss function based on the original dataset and the corresponding average carbon emission factor label of electricity, use the loss function to iteratively train a short-term prediction model of average carbon emission factor of electricity, and output the average carbon emission factor of electricity for the prediction period.
[0007] The present invention provides an electronic device comprising a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the steps of the aforementioned method for short-term prediction of average carbon emission factors of electricity based on a dual attention mechanism.
[0008] The computer-readable storage medium of the present invention stores at least one instruction, which, when executed by a processor, implements the steps of the short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism.
[0009] Compared with existing technologies, this invention has the following significant advantages: 1. By constructing a short-term prediction model through a dual attention mechanism, combining time attention and feature attention, it can simultaneously capture key time period information in historical sequences and the coupling influence relationship between various input features, thereby improving the ability to characterize the variation pattern of the average carbon emission factor of electricity; 2. By setting a time-feature coupling module in the short-term prediction model, it can uniformly acquire, filter, and evaluate multi-dimensional information such as power generation, meteorology, and time, which helps to enhance the representativeness and effectiveness of input features, thereby improving the model's ability to identify the fluctuation pattern of the average carbon emission factor of electricity; 3. By introducing a feature attention mechanism, it considers the regional differences of the carbon emission factor of electricity, enabling the prediction model to better fit the actual operating conditions of different regions, thereby improving the applicability and prediction reliability of the model in multi-regional scenarios. Attached Figure Description
[0010] Figure 1 This is a schematic diagram of a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism, provided in an embodiment of the present invention.
[0011] Figure 2 This is a schematic diagram of the short-term prediction model architecture for the average carbon emission factor of electricity provided in an embodiment of the present invention;
[0012] Figure 3 This is a structural block diagram of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0013] The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0014] To address the problem of insufficient prediction accuracy in existing technologies due to the inability to dynamically identify key historical moments and input features, this invention constructs a short-term prediction model for the average carbon emission factor of electricity, incorporating both temporal and feature-based attention. This model adaptively learns and assigns attention weights from multi-source heterogeneous data, thereby significantly improving the accuracy of predicting short-term changes in the average carbon emission factor of electricity.
[0015] In this invention, the average carbon emission factor for electricity refers to the amount of carbon dioxide emitted per unit of electricity generated, typically expressed as tonnes of carbon dioxide per megawatt-hour (tCO2 / MWh). This factor is a key indicator for measuring the carbon emission level of the power system, and its short-term forecasts have important reference value for power dispatch, carbon trading markets, and regional carbon emission management.
[0016] Example 1
[0017] See Figure 1 This embodiment provides a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism, specifically including the following steps:
[0018] S1. Obtain power generation data, emission factor values, and electricity input data from outside the region for each energy type within the given region. Using the power source geolocation method, calculate the average carbon emission factor of electricity for the given region based on the power generation data, emission factor values, and electricity input data from outside the region for each energy type within the given region.
[0019] According to one embodiment of the present invention, the average carbon emission factor of electricity can be calculated using the power source geographic location method. This method can accurately track the source of electricity, including self-generated electricity within the region and electricity imported from outside the region, thereby avoiding carbon emission accounting bias caused by cross-regional electricity flows. For example, for a provincial region, the electricity generation of each energy type within the province (such as coal-fired, gas-fired, hydropower, wind power, photovoltaic, etc.) and the electricity imported from outside the province for each energy type are obtained, and the provincial average carbon emission factor of electricity is calculated by weighted averaging. Similarly, for a prefecture-level city region, the electricity generation of each energy type within the prefecture-level city, the electricity transferred from other prefecture-level cities within the province, and the electricity imported from outside the province for each energy type are obtained, and the prefecture-level city average carbon emission factor of electricity is calculated.
[0020] Specifically, the formula for calculating the provincial average carbon emission factor for electricity is as follows: ;
[0021] in, EF p Indicates provincial power grid p The average carbon emission factor of electricity EF i Indicates the type of power generation i The average carbon emission factor of electricity E p,i Indicates provincial power grid p Types of power generation within the covered geographical area i Electricity generation, E imp,i,p,j Indicates provincial power grid j Medium power generation type i Transferred to provincial power grid p The amount of electricity, E exp,i,p,j Indicates provincial power grid p Medium power generation type i Transfer to provincial power grid j The amount of electricity.
[0022] The formula for calculating the average carbon emission factor of electricity at the prefecture-level city level is as follows: ;
[0023] in, EF c Indicates the municipal-level power grid c The average carbon emission factor of electricity EF i Indicates the type of power generation i The average carbon emission factor of electricity E c,i Indicates the municipal-level power grid c Types of power generation within the covered geographical area i Electricity generation, E imp,i,c,j Indicates provincial power grid j Medium power generation type i Transferred to municipal power grid c The amount of electricity, E exp,i,c,j Indicates the municipal-level power grid c Medium power generation type i Transfer to provincial power grid j The amount of electricity, EF k Indicates the municipal-level power grid k The average carbon emission factor of electricity E imp,c,k Indicates the municipal-level power grid k Transferred to municipal power grid c The amount of electricity.
[0024] S2. Obtain power generation forecast data for each energy type, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, construct the original dataset, and perform data preprocessing.
[0025] According to one embodiment of the present invention, the prediction time scale can be flexibly selected according to different application scenarios, such as being set to hourly or daily levels, to calculate the average carbon emission factor of electricity within a given region at the corresponding time scale. Hourly predictions can be used for real-time dispatching and load balancing of power systems; daily predictions can be used for intraday settlement and carbon emission management in carbon trading markets. After determining the prediction time scale, it is necessary to acquire various types of data matching that time scale. Specifically, it is necessary to acquire power generation prediction data for each energy type within a given region, including prediction data for photovoltaic power generation, wind power generation, coal-fired power generation, and gas-fired power generation. Simultaneously, it is necessary to acquire weather forecast data for the given region, such as prediction data for temperature, wind speed, irradiance, and humidity, as these meteorological factors directly affect the output of new energy power generation (such as wind power and photovoltaic), thereby affecting the average carbon emission factor of electricity. Furthermore, it is also necessary to acquire power generation prediction data input from outside the region and power generation prediction data output to outside the region to reflect the impact of inter-regional power exchange on the carbon emission factor. Finally, it is also necessary to obtain time features, such as the number of hours in a day, weekdays, months, and whether it is a holiday. These time features can capture the periodic patterns of electricity consumption and power generation.
[0026] The acquired features are integrated into the original dataset and then preprocessed. Data preprocessing can include three main steps: data missing completion, data normalization, and feature encoding.
[0027] First, for any missing values that may exist in the original dataset, spline interpolation can be used to fill in the missing values. Spline interpolation is an interpolation method based on piecewise polynomial fitting, which can smoothly estimate the values of missing data points. Compared with simple linear interpolation or mean imputation, spline interpolation not only considers the numerical changes between adjacent data points, but also takes into account the smoothness of the data change trend. Therefore, it can better reflect the continuous change characteristics of variables within the interval.
[0028] Secondly, in order to eliminate the impact of differences in units and numerical ranges between different features on model training, it is necessary to normalize all numerical data except for time features. The calculation formula is as follows: ;
[0029] in, This represents the standardized data, where x represents the original data, μ represents the mean, and σ represents the standard deviation.
[0030] Finally, for time features, specialized feature encoding processing is required. For time features with periodic characteristics, such as the number of hours in a day (0-23 hours) or the number of months in a year (January-December), sine and cosine functions can be used for encoding, mapping linear time onto a unit circle. Periodic encoding can better reflect the cyclical characteristics of time variables. The formula is expressed as follows: ;
[0031] Where x represents the time position and T represents the period length.
[0032] For non-periodic time features, such as whether it is a holiday, calendar effect coding can be used to extract time attributes such as holidays and weekdays as dummy variables. Calendar effect coding can reflect abnormal fluctuations or regular changes in time series during specific periods, improving the predictive model's ability to identify abrupt changes. For example, holidays can be marked as 1, and non-holidays as 0.
[0033] S3. Construct a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention, including a time attention module, a feature attention module, a time-feature coupling module, and a prediction module. This short-term prediction model, by introducing a dual attention mechanism, can dynamically evaluate the importance of input data from both time and feature dimensions.
[0034] Specifically, the time attention module is used to extract the importance of different historical moments to the electricity average carbon emission factor prediction task, and assigns a time attention weight to each historical moment to represent the contribution of that moment to the current prediction result; the larger the weight, the greater the contribution of the historical information at that moment to the current prediction.
[0035] The feature attention module is used to characterize the importance of different input features (such as power generation, temperature, wind speed, etc.) to the prediction result of the average carbon emission factor of electricity at the same time. It assigns a feature attention weight to each feature to measure the relative contribution of the feature in the current prediction, thereby highlighting key features and suppressing redundant or noisy features.
[0036] The time-feature coupling module fuses the time dimension weights and feature dimension weights to generate a weighted feature representation that combines the importance of time and features, which serves as the input to the prediction module. Its expression is: ;
[0037] in, , Indicates coupling weights. Indicates time i Time attention weights Indicates the firstk The feature attention weights of each feature at the current time, where b represents the bias parameter. This represents a time-feature coupling module.
[0038] The prediction module takes the output of the time-feature coupling module as input, performs a nonlinear transformation through one or more fully connected layers, and finally outputs the predicted value of the average carbon emission factor of electricity at the target time. Its expression is: ;
[0039] in, This indicates the prediction module. This represents the output of the time-feature coupling module. Indicates the bias parameter. This represents the weighting parameter.
[0040] S4. Construct a loss function based on the original dataset and the corresponding average carbon emission factor label for electricity, iteratively train a short-term prediction model, and output the average carbon emission factor for electricity during the prediction period.
[0041] Specifically, during the training and prediction phases of the model, a suitable loss function needs to be constructed to quantify the error between the predicted and actual values. The model parameters, including temporal attention weights and feature attention weights, are then iteratively optimized using a backpropagation algorithm. According to one embodiment of the invention, the loss function can be a loss function commonly used in regression tasks, such as mean squared error or mean absolute error. During iterative training, the model adaptively adjusts the attention weights, enabling the network to dynamically identify which historical periods and input features are most critical for the current prediction. For example, when predicting the average carbon emission factor of electricity in the next hour, the model might assign higher temporal attention weights to historical data from the most recent hours, while simultaneously assigning higher feature attention weights to wind speed and irradiance from weather forecast data. This dynamic adjustment mechanism allows the model to flexibly respond to prediction needs in different scenarios, thereby significantly improving the robustness and accuracy of the prediction. Finally, after the model converges, the trained model can be used to make short-term predictions of the future average carbon emission factor of electricity and output the prediction results.
[0042] Example 2
[0043] This embodiment provides a short-term prediction system for the average carbon emission factor of electricity based on a dual attention mechanism. The system may include a data acquisition unit, a data preprocessing unit, a model building unit, and a prediction output unit.
[0044] The data acquisition unit is used to acquire power generation data, emission factor values, and electricity data input from outside the region for each energy type within a given area. Using the power source geolocation method, it calculates the average carbon emission factor of electricity for the given area based on the power generation data, emission factor values, and electricity data input from outside the region for each energy type within the given area.
[0045] Specifically, the data acquisition unit can first acquire power system operation data within a given region. For example, for a provincial region, it can acquire power generation data for various energy types within the province (such as thermal power, hydropower, wind power, solar power, nuclear power, etc.), as well as power generation data for various energy types imported from outside the province. Simultaneously, it can also acquire emission factor values corresponding to various energy types, which reflect the carbon emissions per unit of power generation. Using the power source geographic location method, the provincial average carbon emission factor can be calculated. Similarly, for a prefecture-level city, it can acquire power generation for various energy types within the city, power transferred from other cities within the province, and power imported from outside the province, thereby calculating the prefecture-level city average carbon emission factor. In some embodiments, the power source geographic location method can accurately calculate the carbon emission factor on the electricity consumption side based on the geographical location of power plants and the topology of transmission lines, thus more accurately reflecting the carbon emission level of regional electricity consumption.
[0046] The data preprocessing unit is used to acquire power generation forecast data for each energy type, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, to construct the original dataset and perform data preprocessing.
[0047] Specifically, weather forecast data includes data such as temperature, wind speed, irradiance, and humidity, and time characteristics can include the number of hours in a day, the day of the week, the month, and whether it is a holiday.
[0048] The model building unit is used to build a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention. The model includes a time attention module, a feature attention module, a time-feature coupling module, and a prediction module.
[0049] The model building unit can construct a short-term prediction model for the average carbon emission factor of electricity based on a dual attention mechanism. For example... Figure 2 As shown, the model may include a temporal attention module, a feature attention module, and a temporal-feature coupling module. And the prediction module. The time attention module can be used to extract the importance of different historical moments for the prediction task of the average carbon emission factor of electricity, and assign a time attention weight to each historical moment. This weight can represent the contribution of that moment to the current prediction result. In some embodiments, time attention weights... It can dynamically adjust according to changes in historical data, allowing the model to focus on key historical periods. The feature attention module can be used to characterize the importance of different input features to the prediction result of the average carbon emission factor of electricity at the same time, assigning a feature attention weight to each feature. This weight measures the relative contribution of the feature to the current prediction. In some embodiments, feature attention weights... The time-feature coupling module can dynamically change with time and input data, enabling the model to adaptively identify key input features. It fuses time-dimension weights and feature-dimension weights, integrating these two types of important information as input to the prediction module. The prediction module can then input the results from the time-feature coupling module into the fully connected layer to obtain the predicted value of the average carbon emission factor for electricity at the target time.
[0050] During model construction, the temporal attention module and the feature attention module can work in parallel, extracting important information from the temporal and feature dimensions, respectively. The feature attention module can be based on a multilayer perceptron or a self-attention mechanism, generating feature attention weights by calculating the correlations between different input features. The temporal-feature coupling module can weightedly fuse the temporal and feature attention weights, for example, through matrix multiplication or element-wise multiplication, to generate a comprehensive attention representation. The prediction module can include one or more fully connected layers, mapping the output of the temporal-feature coupling module to the final predicted value. In some embodiments, the prediction module may also include activation function layers and regularization layers to improve the model's generalization ability. Through this structure, the model can simultaneously capture the dynamic changes of time series and the complex relationships between features, thereby improving prediction accuracy.
[0051] The prediction output unit is used to construct a loss function based on the original dataset and the corresponding average carbon emission factor label of electricity, iteratively train a short-term prediction model, and output the average carbon emission factor of electricity for the prediction period.
[0052] The prediction output unit can be trained and used for prediction based on a pre-built model. First, a loss function, such as the mean squared error loss function or the mean absolute error loss function, can be determined to quantify the error between the predicted result and the true value. Then, iterative training can be performed based on the dataset. During training, the time attention weights and feature attention weights can be adaptively optimized using the backpropagation algorithm, enabling the network to dynamically identify key historical periods and key input features. In some embodiments, the optimization process can employ the Adam optimizer or the stochastic gradient descent optimizer to accelerate convergence and improve model performance. After training, a prediction model under optimal conditions can be obtained, outputting the average carbon emission factor of electricity for the predicted period. For example, for a given region, multi-source heterogeneous data at the current moment can be input, and the model can output the predicted value of the average carbon emission factor of electricity for the next hour or day. In some embodiments, the prediction output unit can also provide the confidence interval or uncertainty estimate of the prediction result to assist decision-makers in risk assessment.
[0053] In addition, the data preprocessing unit can perform operations such as data missing data completion, data normalization, and feature encoding. For missing data, it can identify the location of missing data and use spline interpolation to complete it, thus ensuring the integrity of the dataset. For data normalization, it can perform standardization processing on data other than time features, such as Z-score standardization or Min-Max standardization, to eliminate the influence of different units of measurement. For feature encoding, it can perform feature encoding processing on time features. For periodic features (such as the number of hours in a day, days of the week, and months), it can use sine and cosine functions to capture their periodic patterns; for non-periodic time features (such as whether it is a holiday), it can use calendar effect encoding, such as one-hot encoding or label encoding. In some embodiments, data preprocessing can also include outlier detection and filtering to further improve data quality. Through this preprocessing, the consistency and validity of the input data can be ensured, providing a reliable foundation for subsequent model training and prediction.
[0054] In some embodiments, the short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism can be applied to cross-regional power dispatch scenarios. For example, for provincial-level regions, this method can acquire power generation data for various energy types within the province, including coal, gas, hydropower, wind power, photovoltaic, and nuclear power, while simultaneously acquiring power generation data for various energy types input from outside the province. The provincial average carbon emission factor can be calculated using the power source geographic location method. In some embodiments, for prefecture-level cities, this method can acquire power generation data for various energy types within the prefecture-level city, power transferred from other prefecture-level cities within the province, and power input from various energy types outside the province, thereby calculating the prefecture-level city-level average carbon emission factor. This multi-level calculation approach can adapt to the carbon emission monitoring needs of different administrative regions, improving the flexibility and applicability of prediction. In some embodiments, this method can also be applied to the prediction of carbon emission factors for industrial parks or specific grid nodes, achieving accurate prediction for local areas by adjusting the data acquisition scope and calculation parameters.
[0055] In alternative embodiments, the time scale of the forecast can be flexibly adjusted according to application needs. For example, for power dispatching departments, hourly forecasts can be selected to support real-time power balance and carbon emission control; for carbon trading markets, daily forecasts can be selected to assist trading decisions and quota allocation. In some embodiments, time features may include at least one of the following: the number of hours in a day, the day of the week, the month, and whether it is a holiday. These time features can be processed through feature encoding. For example, for periodic features (such as the number of hours and the month), sine and cosine functions can be used for encoding to capture their periodicity; for non-periodic time features (such as holidays), calendar effect encoding can be used to reflect their impact on electricity consumption and carbon emissions. In some embodiments, weather forecast data may include at least one of temperature, wind speed, irradiance, and humidity, which can affect renewable energy generation and power load, thereby indirectly affecting the carbon emission factor.
[0056] Example 3
[0057] Please refer to Figure 3. The present invention also provides an electronic device 100 for implementing a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism. The electronic device 100 includes a memory 101, at least one processor 102, a computer program 103 stored in the memory 101 and executable on the at least one processor 102, and at least one communication bus 104.
[0058] The memory 101 can be used to store the computer program 103. The processor 102 implements various functions of the electronic device 100 by running or executing the computer program stored in the memory 101 and calling the data stored in the memory 101. The memory 101 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device 100 (such as audio data), etc. In addition, the memory 101 may include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other non-volatile solid-state storage device.
[0059] The at least one processor 102 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 102 may be a microprocessor or any conventional processor. The processor 102 is the control center of the electronic device 100, connecting various parts of the electronic device 100 via various interfaces and lines.
[0060] The memory 101 in the electronic device 100 stores multiple instructions to implement a substation control layer communication method, and the processor 102 can execute the multiple instructions to achieve the following: The client sends commands to the server; The server returns data to the client; The commands and data sent between the client and the server use the Station Control Layer Service Protocol Message (APDU) structure.
[0061] If the modules / units integrated in the electronic device 100 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0062] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, electronic devices, storage media, or 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. Furthermore, the present invention can take the form of a computer program product embodied 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.
[0063] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0064] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0065] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0066] 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 skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism, characterized in that, The method includes: Obtain power generation data, emission factor values, and electricity input data from outside the region for each energy type within a given region. Utilize the power source geolocation method to calculate the average carbon emission factor of electricity for the given region based on the power generation data, emission factor values, and electricity input data from outside the region for each energy type within the given region. Acquire power generation forecast data for each energy type, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, construct the original dataset, and perform data preprocessing; Construct a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention; Based on the original dataset and the corresponding average carbon emission factor labels for electricity, a loss function is constructed. The loss function is then used to iteratively train a short-term prediction model for the average carbon emission factor for electricity, and the average carbon emission factor for electricity during the prediction period is output.
2. The method according to claim 1, characterized in that, The calculation of the average carbon emission factor for electricity includes: For provincial regions, obtain the power generation of each energy type within the province and the power input of each energy type from outside the province, and calculate the provincial average carbon emission factor for electricity. For prefecture-level regions, the electricity generation of each energy type within the prefecture-level city, the electricity transferred from other prefecture-level cities within the province, and the electricity input from various energy types outside the province are obtained to calculate the average carbon emission factor of electricity at the prefecture-level city level.
3. The method according to claim 2, characterized in that, The formula for calculating the provincial average carbon emission factor for electricity is as follows: ; in, EF p This represents the average carbon emission factor of the provincial power grid p. EF i This represents the average carbon emission factor of electricity for power generation type i. E p,i This represents the power generation of power generation type i within the geographical area covered by the provincial power grid p. E imp,i,p,j This represents the amount of electricity generated by power generation type i in provincial power grid j and transferred to provincial power grid p. E exp,i,p,j This represents the amount of electricity transferred from generation type i in provincial power grid p to provincial power grid j; The formula for calculating the average carbon emission factor of electricity at the prefecture-level city level is as follows: ; in, EF c This represents the average carbon emission factor of electricity in the prefecture-level power grid c. EF i This represents the average carbon emission factor of electricity for power generation type i. E c,i This represents the power generation of type i within the geographical area covered by the prefecture-level power grid c. E imp,i,c,j This represents the amount of electricity generated by power generation type i in provincial power grid j and transferred to municipal power grid c. E exp,i,c,j This represents the amount of electricity generated by power generation type j in the municipal power grid c and transferred to the provincial power grid j. EF k This represents the average carbon emission factor of electricity in a prefecture-level power grid (k). E imp,c,k This represents the amount of electricity transferred from the municipal power grid k to the municipal power grid c.
4. The method according to claim 1, characterized in that, The method also includes: selecting hourly or daily time scales as the prediction time scale according to different application scenarios, and calculating the average carbon emission factor of electricity under the corresponding time scale in a given region. The system acquires power generation forecast data for each energy type in a given region, including forecast data for photovoltaic power generation, wind power generation, coal-fired power generation, and gas-fired power generation; it also acquires power generation data transferred into the given region and power generation data transferred out of the given region to other regions; it acquires weather forecast data for the given region, including forecast data for meteorological factors such as temperature, wind speed, irradiance, and humidity; and it acquires time features including hourly, weekly, monthly, and holiday information.
5. The method according to claim 1, characterized in that, The data preprocessing includes: identifying the location of missing data and completing it using spline interpolation; standardizing the data except for time features; and performing feature encoding on the time features, wherein periodic time features are encoded using sine and cosine functions, and non-periodic time features are encoded using calendar effects.
6. The method according to claim 1, characterized in that, The short-term prediction model for the average carbon emission factor of electricity includes: The time attention module is used to extract the importance of different historical moments to the electricity average carbon emission factor prediction task, and assigns a time attention weight to each historical moment to represent the contribution of that moment to the current prediction result. The feature attention module is used to characterize the importance of different input features to the prediction results of the average carbon emission factor of electricity at the same time. Each feature is assigned a feature attention weight to measure the relative contribution of the feature to the current prediction. The time-feature coupling module is used to fuse the time dimension weights and feature dimension weights as inputs to the prediction module; The prediction module is used to input the results of the time-feature coupling module into the fully connected layer to obtain the predicted value of the average carbon emission factor of electricity at the target time.
7. The method according to claim 6, characterized in that, The expression for the time-feature coupling module is: ; in, , Indicates coupling weights. Indicates time i Time attention weights Indicates the first k The feature attention weights of each feature at the current time, where b represents the bias parameter. This represents a time-feature coupling module; The expression for the prediction module is: ; in, This indicates the prediction module. This represents the output of the time-feature coupling module. Indicates the bias parameter. This represents the weighting parameter.
8. A short-term prediction system for the average carbon emission factor of electricity based on a dual attention mechanism, comprising: The data acquisition unit is used to acquire power generation data, emission factor values and power input data from outside the region for each energy type within a given region, and to calculate the average carbon emission factor of the power in the given region using the power source geographic location method. The data preprocessing unit is used to acquire power generation forecast data of various energy types, weather forecast data, power generation forecast data input from outside the region, power generation forecast data output to outside the region, time characteristics, and the calculated average carbon emission factor of electricity, to construct the original dataset and perform data preprocessing. The model building unit is used to build a short-term prediction model for the average carbon emission factor of electricity based on time attention and feature attention. The model includes a time attention module, a feature attention module, a time-feature coupling module, and a prediction module. The prediction output unit is used to construct a loss function based on the original dataset and the corresponding average carbon emission factor label of electricity, use the loss function to iteratively train a short-term prediction model of average carbon emission factor of electricity, and output the average carbon emission factor of electricity for the prediction period.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory, the processor being configured to execute a computer program stored in the memory to implement the steps of a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction that, when executed by a processor, implements the steps of a short-term prediction method for the average carbon emission factor of electricity based on a dual attention mechanism as described in any one of claims 1 to 7.
