Super real-time electric power carbon footprint metering system
By constructing an ultra-real-time electricity carbon footprint metering system, the shortcomings of the existing electricity carbon metering system in terms of real-time performance and accuracy have been addressed. It achieves second-level data acquisition and data processing within 50ms, meeting the real-time trading and dispatching needs of the electricity market and improving the accuracy and reliability of metering.
Patent Information
- Application Number
- CN202511543078.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-06
AI Technical Summary
The existing electricity carbon metering system is difficult to adapt to the second-level fluctuations of wind and solar power and the dynamic topology of the power grid. It has poor real-time performance, low accuracy and high link delay, making it difficult to meet the needs of the new power grid and the spot electricity market.
An ultra-real-time electricity carbon footprint measurement system was constructed, including a data acquisition module, a data processing module, and a model module. Time consistency was achieved through GPS+PPS dual-calibration clocks, and a cascaded three-subnet architecture was used for data processing and model training. Combined with three-level self-healing fault diagnosis, the real-time output of carbon factor sequences was ensured.
It achieves second-level data acquisition and 50ms-level data processing, meeting the needs of real-time power market transactions and dispatch, improving the accuracy and reliability of metering, and supporting the safe operation of the power grid and low-carbon dispatch.
Smart Images

Figure CN121480932A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of carbon emission metering in power systems, and specifically to an ultra-real-time power carbon footprint metering system. Background Technology
[0002] With the large-scale grid connection of renewable energy, the rapid growth of distributed power generation, and the full operation of the spot electricity market, the measurement of grid carbon emission factors has shifted from "post-event statistics" to "real-time decision-making." However, most existing electricity carbon metering systems still use the "offline calibration + online table lookup" model. This model does not consider the second-level fluctuations in wind and solar power output, the dynamic changes in grid topology, and the triple coupling relationship between nodes, branches, and time, making it difficult to adapt to the new grid operation requirements. Specifically, it has the following shortcomings: Insufficient monitoring accuracy and real-time performance: Traditional metering uses a 15-minute average calculation method, with peak-valley metering errors exceeding 12%, which cannot meet the spot electricity market's demand for accurate metering with a 1-second settlement cycle, and is difficult to support real-time transaction pricing and carbon emission cost accounting; Limited fault prediction capability: The lack of synchronous perception capability for dynamic events such as grid topology jumps, unit ramping, and power flow exceeding limits leads to the continuous accumulation and amplification of errors during the fault prediction process, making it impossible to provide effective early warning for the safe operation of the power grid. Maintenance decisions lack scientific basis: offline calibration data becomes invalid as soon as it is released, and cannot reflect changes in power grid parameters in real time. This makes it difficult to guide on-site real-time dispatch optimization and low-carbon operation strategy formulation, resulting in a lack of scientific data support for maintenance decisions. Insufficient data utilization: Second-level multi-source data generated by synchronous phasor measurement devices (PMU), energy management systems (EMS), meteorological monitoring equipment, load forecasting systems, etc. are scattered and "each fighting its own battle", failing to form a time series tensor under a unified spatiotemporal reference, making it difficult to fully explore the value of the data; Lack of systematic solutions: The carbon emission factor extrapolation model and the power flow verification process are separated, and the satisfaction of model constraints depends on repeated manual calibration, resulting in a comprehensive delay of more than 200ms in the entire metering link.
[0003] In summary, the existing carbon metering system has significant shortcomings in terms of real-time performance, accuracy, dynamic adaptability, data fusion, and system coordination, and there is an urgent need for a new carbon metering system to solve these problems. Summary of the Invention
[0004] The technical problem to be solved by this invention is how to address the issues that existing systems are difficult to adapt to second-level fluctuations in wind and solar power, dynamic grid topology, have poor real-time performance, low accuracy, high link latency, and are unable to meet the needs of new power grids and the spot electricity market.
[0005] This invention solves the above-mentioned technical problems through the following technical means: a real-time electricity carbon footprint measurement system, comprising: Data acquisition module: used to synchronously collect power grid operation data, meteorological environment data, load demand data and market price data at the second level, and align the timestamps with GPS (Global Positioning System) + PPS dual-calibrated clocks and encapsulate them as time series tensors; Data processing module: Used to receive the time series tensor, complete missing data repair, anomaly removal, statistical normalization and topological consistency alignment within 50ms, and output a clean tensor; Model Module: Based on the clean tensor and real-time topological adjacency matrix, this module uses an end-to-end algorithm framework with three time scales for parallel prediction to generate and output the final carbon factor sequence that satisfies the physical constraints of the power grid. The algorithm framework uses a cascaded three-subnet as the core architecture. It executes the Euclidean projection algorithm through the GPU-based OSQP quadratic programming solver to satisfy three types of constraints: power balance, power flow limit exceedance, and statistical consistency. It combines a three-scale window construction method with shared memory views to achieve multi-granularity adaptation and uses a three-time-scale composite loss function and gradient backpropagation based on KKT conditions to complete model training. Application module: used to call the final carbon factor sequence and real-time topological adjacency matrix to achieve real-time monitoring, early warning and visualization; the application module has a built-in three-level self-healing fault diagnosis and decision-making process to ensure the continuous output of the final carbon factor sequence.
[0006] This invention constructs an ultra-real-time electricity carbon footprint measurement system through a full-link collaborative architecture consisting of a data acquisition module, a data processing module, a model module, and an application module. The data acquisition module synchronizes multi-source data at the second-level granularity, ensuring time consistency with a GPS+PPS dual-calibration clock. The data processing module completes purification and topology alignment within 50ms, outputting a high-fidelity clean tensor. The model module, relying on a cascaded three-subnet and end-to-end algorithm framework, explicitly embeds power grid physical constraints, enabling parallel prediction at three time scales: 10s, 60s, and 600s. The application module ensures continuous output through a three-level self-healing process. This comprehensive approach addresses the problems of traditional carbon footprint measurement lagging behind power grid operation, measurement errors due to neglected constraints, difficulty adapting to multiple electricity market scenarios, and susceptibility to output interruptions due to faults. It provides accurate and reliable measurement support for real-time electricity carbon cost accounting, trading decisions, and low-carbon dispatching.
[0007] Furthermore, the data acquisition module comprises five parallel units: PMU (Phase Module Unit): Used to collect power grid operation data, capturing bus voltage phasors, bus voltage phase angles, branch active power and branch reactive power with a fixed step size; EMS / SCADA (Supervisory Control and Data Acquisition) unit: Used to collect power grid operation data, including unit output, switch status, fuel type coding, unit fuel carbon emission coefficient, and branch circuit data. The real-time power flow and real-time topology adjacency matrix are packaged into structured messages; Meteorological satellite downlink unit: used to collect meteorological and environmental data, providing irradiance, wind speed, temperature and relative humidity, and mapping them to power grid nodes through spatial interpolation; Load forecasting interface unit: used to collect load demand data and output node load power; Market gateway unit: used to subscribe to market price data and output real-time carbon price and real-time electricity price; The multi-source heterogeneous data collected by each unit is aggregated through the Kafka millisecond-level streaming bus, and then combined with the GPS+PPS dual-calibration clock to generate a nanosecond-level unified timestamp, which is encapsulated as a time series tensor and then sent to the data processing module through the zero-copy CUDA IPC (CUDA Inter-Process Communication) real-time tensor stream transmission link.
[0008] This invention covers multi-dimensional data through five parallel acquisition units, and combines GPS+PPS dual-calibration clocks with high-efficiency transmission links to ensure data comprehensiveness, time consistency and transmission efficiency, providing a high-quality front-end data foundation for ultra-real-time metering.
[0009] Furthermore, the data processing module includes: Spatiotemporal Missing Data Repair Unit: Receives temporal tensors from the data acquisition module, calculates the tensor missing rate, and performs end-to-end imputation of missing data in the tensor using spatiotemporal gated convolution. Spatiotemporal anomaly detection unit: Calculates the moving average and standard deviation for each node-feature channel, and calculates the Z-score. If the Z-score > preset threshold... If an anomaly is detected, the spatiotemporal gap repair unit is triggered to re-interpolate; Topology Consistency Alignment Unit: EMS / SCADA updates the adjacency matrix every 5 seconds, performs linear interpolation on the adjacency matrix, and when topology changes cause node splitting or merging, it uses a weighted average method based on node degree to redistribute node features. Normalization and Feature Derivation Unit: Used to perform Min-Max normalization on the data based on the sliding extreme value, and derive the instantaneous value of node carbon intensity and line power flow utilization feature. The output data dimension is kept to 16 dimensions, but the 15th and 16th dimensions are dynamically replaced with the above-mentioned derived features to obtain a clean tensor. Data quality monitoring unit: used to calculate data integrity rate and anomaly rate in real time. When the data integrity rate is <95% or the anomaly rate is >2%, it switches to the backup data channel. Caching and Distribution Unit: Used to employ a three-level caching architecture, including GPU HBM, NVMe RAID and edge HDFS, and provides the model module with three data interfaces: real-time tensor stream, backtracking window and offline batch through a zero-copy CUDA IPC real-time tensor stream transmission link.
[0010] This invention achieves data missing repair, anomaly removal, and dynamic topology alignment through collaborative processing of multiple units. Combined with a three-level caching and quality monitoring mechanism, it outputs high-fidelity clean tensors, improving data availability and access flexibility.
[0011] Furthermore, the model module includes a cascaded three-subnet: Spatiotemporal dynamic filtering subnet: Receives a clean tensor and a real-time topological adjacency matrix. Divides each node of the clean tensor into non-overlapping patches of length P=8 along the time axis. Constructs a k-nearest neighbor graph for the patches and calculates the edge weights using an exponential kernel function that satisfies the Mercer condition. Performs Top-p routing to retain the top p% of edges with the weights. After sparse graph convolution processing, all patches are concatenated along the time dimension to obtain the node-level spatiotemporal embedding. Constraint-based diffusion generation subnet: The node-level spatiotemporal embedding is upgraded to a conditional vector. A diffusion scheduling framework is adopted, and a one-step DDIM is used in the inference phase. Noise is estimated and carbon factor sequences are generated through a 6-layer Time-Transformer + Graph Convolution denoising network. A quadratic programming model containing power balance equations, power flow limit inequalities, and statistical consistency soft constraints is constructed. The carbon factor sequences are flattened into vectors and fed into the model. On the GPU, the Euclidean projection algorithm is executed through the OSQP solver to output the carbon factor tensors that satisfy the constraints. The KKT conditions of the quadratic programming are used as implicit layers. The gradient is calculated by combining the implicit function theorem. Based on the three-scale window construction method of shared memory and view, the carbon factor tensors are cut into three business lengths of 10s, 60s, and 600s according to the market granularity and mapped by 1×1 convolution. At the same time, a three-scale joint total loss function is introduced to achieve backpropagation. Ultra-real-time inference subnet: The carbon factor tensor output by the constrained diffusion generation subnet is subjected to INT8 dynamic quantization and CUDA Graph solidification. After 1×1 convolution mapping, deterministic resampling is performed by selecting 1-step or 4-step DDIM (Denoising Diffusion Implicit Models is a deterministic diffusion sampling method) according to the PMU packet loss rate, and the final carbon factor sequence is output.
[0012] This invention uses a cascaded three-subnet architecture to accurately extract the spatiotemporal correlation features of carbon factors, efficiently embed the physical constraints of the power grid and accelerate the inference process, supporting ultra-real-time, high-precision carbon factor sequence generation.
[0013] Furthermore, the quadratic programming model in the constraint diffusion generation subnet includes: Power balancing: for all nodes With all future time points
[0014]
[0015] in, For nodes In time For nodes In time The active power of the load, It is a sparse matrix of 600×600N. Carbon factor sequence A flattened vector. It is a 600×1 vector; Trend exceeding limits: for all branches ( ) and all future time points
[0016]
[0017] in, For branch roads ( The rated transmission capacity of ) For vector c Branches calculated using linearized power flow equations ( In time Trend value, It is a sparse matrix of 2B×600N, where B is the number of branches in the system. It is a 2B×1 vector; Statistical consistency: with historical mean Deviation is limited:
[0018] in, Maximum allowable L2 deviation threshold This represents a 600×600N selection matrix.
[0019] This invention ensures that the carbon factor sequence conforms to the physical rules and statistical laws of the power grid by defining a mathematical model with three types of constraints, thereby improving the physical feasibility and numerical stability of the measurement results.
[0020] Furthermore, the constrained diffusion generation subnet performs Euclidean projection algorithm, the calculation formula of which is:
[0021] in, For the carbon factor tensor, Carbon factor sequence The flattened vector.
[0022] This invention uses the Euclidean projection algorithm to retain the core information of model prediction while satisfying the constraints, and combines it with a GPU solver to achieve efficient convergence, balancing constraint satisfaction and prediction accuracy.
[0023] Furthermore, the three-scale window construction method based on memory-view sharing for generating the constrained diffusion subnet is specifically as follows: The carbon factor tensor is sliced for execution time at market granularity, using the following formula:
[0024] in, The number of prediction steps corresponding to market granularity. =1 Corresponding to the FM market, =2 Corresponding to the real-time market hour In response to the current market, For scale The carbon factor quantum tensor.
[0025] This invention achieves shared memory views through tensor slicing, reducing memory usage for multi-scale predictions, while accurately matching different time granularities of the electricity market, thus improving resource utilization and scenario adaptability.
[0026] Furthermore, the formula for calculating the gradient in the constrained diffusion generation subnet is:
[0027] in, For parameters in the denoising network, For Lagrange Hessian matrices, To constrain the Jacobian matrix, This is the loss function for joint training across three time scales.
[0028] This invention utilizes a gradient backpropagation method based on KKT conditions and implicit function theorem to enable constraints to participate in end-to-end model training, thereby enhancing the model's sensitivity to power grid constraints and improving its learning efficiency.
[0029] Furthermore, the formula for calculating the loss function of the three-timescale joint training in the constrained diffusion generation subnet is as follows:
[0030] in, The total loss is the combined loss across the three scales. Discrete indices with values of 10, 60, and 600. These are the scale weighting coefficients. To predict the carbon factor tensor, This is the truth carbon factor tensor.
[0031] This invention balances the prediction accuracy across multiple time scales and optimizes model training stability through a composite loss function with scale weights, ensuring that the model optimization direction aligns with actual business needs.
[0032] Furthermore, the three-level self-healing fault diagnosis and decision-making process is set up in the application module and runs independently, including: Fault detection: The residual between the final carbon factor sequence output by the real-time calculation model module and the real-time measurement value is used to trigger a level 3 response when the absolute value of the residual at any node exceeds 0.05 tCO2 / MWh and lasts for 3 seconds. Level 1 response: Immediately revert to the previous grid topology state and recalculate the final carbon factor sequence using the 4-step DDIM algorithm within the CPU core; Second-level response: If the anomaly persists after the first-level response, reduce the data sampling frequency to reduce noise interference; Level 3 response: If the problem persists after the first two levels of processing, the system will automatically switch to the backup statistical model to ensure that the final carbon factor sequence output is continuously available.
[0033] This invention achieves rapid response and automatic recovery from anomalies through a three-level self-healing process, reducing manual intervention, ensuring continuous output of carbon factor sequences, and improving system reliability.
[0034] The advantages of this invention are: 1. This invention uses constraint diffusion to generate subnets embedded in the physical constraints of the power grid, and combines Euclidean projection algorithm to ensure that the carbon factor sequence conforms to the actual power grid operation rules, fundamentally improving the reliability of metering results; the three-level self-healing process ensures that the system continues to output under abnormal conditions, laying the foundation for the reliability of electricity carbon cost accounting.
[0035] 2. The present invention features a full-link design of second-level data acquisition, 50ms data processing, and GPU-accelerated inference, enabling high-frequency updates of the carbon factor sequence. This meets the timeliness requirements for carbon footprint measurement in real-time electricity market transactions and frequency regulation scheduling, breaking through the technical bottleneck of traditional minute-level lag.
[0036] 3. The three-timescale parallel prediction architecture of this invention accurately matches the differentiated needs of frequency regulation, real-time, and day-ahead markets. The memory-view sharing technology reduces the resource consumption of multi-scale computing, enabling the system to be flexibly applied to all scenarios of power carbon management, from real-time decision-making to medium- and long-term planning.
[0037] 4. The cascaded three-subnet architecture improves the accuracy of spatiotemporal feature extraction, the composite loss function with scale weights optimizes the model training efficiency, and gradient backpropagation based on KKT conditions realizes end-to-end fusion of constraints and models, ensuring the efficient implementation of core functions from the technical level. Attached Figure Description
[0038] Figure 1 This is a system architecture diagram of Embodiment 1 of the present invention. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] like Figure 1 As shown, an ultra-real-time electricity carbon footprint measurement system includes a data acquisition module, a data processing module, a model module, and an application module.
[0041] 1. The data acquisition module serves as the system's front-end data entry point, used to synchronously collect four types of heterogeneous data—grid operation data, meteorological environment data, load demand data, and market price data—at the second-level granularity. It achieves timestamp alignment through GPS+PPS dual-calibration clocks, encapsulates the data into time-series tensors, and outputs them to the data processing module.
[0042] Specifically, it includes five parallel units: 1.1 PMU Synchronization Phasor Unit: with fixed step size Collect power grid operation data, including: bus voltage phasors Bus voltage phase angle Branch active power and branch reactive power ,in, This indicates the total number of PMU synchronization phasor units installed in the power grid, which is the number of physical measurement points for synchronization phasor data.
[0043] 1.2 EMS / SCADA Unit: Used to collect power grid operation data and output power of generating units. Switch status Fuel type coding Unit fuel carbon emission coefficient Branch roads Real-time trend and real-time topological adjacency matrix Packaged into a structured message, in which, The number of online synchronous generator sets, This refers to the number of transmission lines / branches in the power grid that can be remotely switched. This represents the total number of busbars at each node of the power grid.
[0044] 1.3 Meteorological satellite downlink unit: used to collect meteorological and environmental data and provide irradiance information. Wind speed ,temperature and relative humidity And it is mapped to the grid nodes through spatial interpolation, where, This refers to the number of discrete meteorological grid points covered by the downlink unit of the meteorological satellite.
[0045] 1.4 Load Forecasting Interface Unit: Used to collect load demand data and output node load power. ,in, This refers to the number of power consumption nodes on the power grid that require separate load forecasting.
[0046] 1.5 Market Gateway Unit: Used to subscribe to market price data and output real-time carbon price and real-time electricity price (data update frequency is synchronized with PMU, 1 second / time).
[0047] Multi-source heterogeneous data collected from each unit are aggregated via a Kafka millisecond-level streaming bus and combined with GPS+PPS dual-calibrated clocks to generate nanosecond-level unified timestamps, which are then encapsulated into a 16-dimensional time series tensor. ,in, The nanosecond-level timestamp identifier generated by GPS+PPS is sent to the data processing module via a zero-copy CUDA IPC real-time tensor stream transmission link.
[0048] 2. Data Processing Module: Receives the temporal tensor, performs missing data repair, anomaly removal, statistical normalization, topological consistency alignment, and feature derivation within 50ms, and outputs a clean 16-dimensional tensor. Meanwhile, data reliability is ensured through data quality monitoring and a three-level caching system. Specifically, it includes six units: 2.1 Spatiotemporal Missing Point Repair Unit: Receives temporal tensors The tensor missing rate is calculated, and the missing data is imputed end-to-end using spatiotemporal gated convolution, outputting the initially repaired temporal tensor. , Represents the grid node index. Indicates the feature dimension index.
[0049] Specifically, the data acquisition module occasionally experiences PMU packet loss or satellite link interruption, resulting in elements being... The missing values are determined by the missing mask matrix. Describe the situation.
[0050] The formula for calculating tensor missing rate is:
[0051] in, For missing mask matrix of Norm, which is the number of non-zero elements in a matrix. For time tensors No. Line number Column elements, This indicates that data is missing. This indicates that the data is complete.
[0052] Based on neighbor nodes Time lag Valid data Missing values are repaired by attention-weighted interpolation using spatiotemporal gated convolution, and the initial repaired temporal tensor is calculated. The formula is as follows:
[0053]
[0054] in, Neighboring nodes Time lag The Column elements, For nodes The set of neighboring nodes, Node-time dual attention weights are used to measure the node's attention. with neighboring nodes Lag similarity at the time For Gaussian kernel bandwidth, Sigmoid gate, For learnable convolutional kernels, The radius of the time window is empirically set to 3 fixed steps, i.e., 3 seconds.
[0055] Experiments show that when When the percentage is ≤15%, the repair error RMSE is <0.8%.
[0056] 2.2 Spatiotemporal Anomaly Detection Unit: Calculates the 5-minute moving average and standard deviation for each node-feature channel, and identifies anomalies using the Z-score. The formula for calculating the moving average is:
[0057] The formula for calculating the sliding standard deviation is:
[0058] The formula for calculating the Z-score is:
[0059] in, For timestamp Next, the The node, the first Temporal tensor after feature channel repair The observed values, Corresponding to 5 minutes, 1 second / sampling point. Current timestamp Next, the The node, the first The current observation after repair of each feature channel. and It updates every 1 second.
[0060] when When the data is missing, it is marked as anomalous data and re-impacted using a spatiotemporal missing repair unit.
[0061] 2.3 Topology Consistency Alignment Unit: EMS / SCADA updates the adjacency matrix every 5 seconds, performs linear interpolation on the adjacency matrix, and when topology changes cause node splitting or merging, it uses a weighted average method based on node degree to redistribute node features.
[0062] Specifically, topology snapshot synchronization: EMS / SCADA updates the adjacency matrix every 5 seconds.
[0063] To synchronize the topology with second-level time-series data, the adjacency matrix is... Based on the current time Perform linear interpolation to obtain the time interval. The adjacency matrix below The calculation formula is:
[0064] in, , In the EMS / SCADA unit , EMS snapshot adjacency matrix , For the first , Each EMS snapshot time, After interpolation, one consecutive adjacency matrix is output per second. This ensures that the node-branch correspondence is accurate in real time.
[0065] Node feature mapping: If a topology change leads to node splitting or merging, the new set of nodes after the topology change is mapped. Features are assigned in a weighted manner based on node degree:
[0066] in, The j-th eigenvalue assigned to the new node after weighted average calculation. For timestamp At that time, the first The node, the first Temporal tensor after feature channel repair The current observation value, For nodes The degree, To normalize the weights, the higher the degree, the lower the weight, to prevent high-degree nodes from dominating the merge result. This is the current EMS snapshot sequence number, used only to identify the time base and has no calculation meaning, ensuring that the features still have physical meaning after merging.
[0067] 2.4 Normalization and Feature Derivation Unit: Used to perform Min-Max normalization on the data based on the sliding extreme value, and derive the instantaneous value of node carbon intensity and line power flow utilization feature. The output data dimension is kept to 16 dimensions, but the 15th and 16th dimensions are dynamically replaced with the above-mentioned derived features to obtain a clean tensor.
[0068] Specifically, normalization: Min-Max normalization based on a 24-hour moving average is applied to each feature channel.
[0069] in, , Take the most recent 24-hour sliding extreme value.
[0070] Feature Derivation: Add two-dimensional features: instantaneous node carbon intensity and line power flow utilization, dynamically replacing the 15th and 16th dimensions. The formula for calculating the instantaneous value of nodal carbon intensity is:
[0071] in, The instantaneous value of the nodal carbon intensity. For nodes The unit's fuel carbon emission coefficient, For nodes i The active power output of the synchronous generator set, For nodes i Active power of the load.
[0072] The formula for calculating the power flow utilization rate of a power line is:
[0073] in, For branch roads ( Rated capacity, For branch roads ( Real-time trend of ).
[0074] Output a clean tensor:
[0075] The final output is a clean tensor. .
[0076] 2.5 Data Quality Monitoring Unit: Used to calculate data integrity rate and anomaly rate in real time. When the data integrity rate is <95% or the anomaly rate is >2%, an alarm is triggered and the system switches to the backup data channel.
[0077] Two quality indicators are calculated in real time: The formula for calculating data integrity rate is:
[0078] in, This is the currently missing mask.
[0079] The formula for calculating the data anomaly rate is:
[0080] in, Let be the anomaly mask matrix at time t, used to mark whether all node-feature channels are judged as anomalies at the current time. For time t, the first The element in row j, with a value of 1, indicates that the data in that channel is marked as abnormal, and a value of 0 indicates that it is normal. To standardize the residuals, This is the threshold for anomaly detection. When the standardized residual |z| exceeds this threshold, the corresponding data is marked as an anomaly.
[0081] like <95% or If the value exceeds 2%, an alarm will be triggered immediately and the system will switch to the backup data channel.
[0082] 2.6 Caching and Distribution Unit: This unit employs a three-level caching architecture, including GPU HBM, NVMe RAID, and edge HDFS, and provides three data interfaces to downstream model modules: real-time tensor stream, backtracking window, and offline batch processing.
[0083] Three-level cache is used: L1 cache: GPU HBM, 40 GB, latency <10 µs.
[0084] L2 cache: NVMe RAID, 4 TB, latency <100 µs.
[0085] L3 cache: edge HDFS, 100 TB.
[0086] Three interfaces are provided to downstream model modules: Real-time Tensor Flow: The model module is directly transmitted via CUDA IPC.
[0087] Backtracking window: Supported arrive Sliding slices.
[0088] Offline batch processing: Parquet format storage, supports direct querying with Spark SQL.
[0089] Data Processing Module: This implementation migrates the entire process to the GPU memory: Missing data repair uses a 1×1 spatiotemporal convolution directly applied to the tensor view in the memory, with a kernel size of 3 and a stride of 1. Anomaly removal is performed in parallel within the same memory block, calculating the moving average and standard deviation over a 5-minute period. The Z-score threshold is set to 3.5. Anomaly marking is written back with zero copies. Topology alignment utilizes the adjacency matrix updated every 5 seconds by EMS, generating a continuous adjacency matrix in real-time on the GPU using linear interpolation. The entire process requires no disk round trips, and topology interpolation and missing data repair share the same video memory view, avoiding redundant copying and cache invalidation issues that occur in traditional solutions. 3. Model Module: Based on the clean tensor and real-time topological adjacency matrix, a three-subnet cascade of "spatiotemporal dynamic filtering - constraint diffusion generation - ultra-real-time inference" is adopted to generate the final carbon factor sequence at three scales of 10s / 60s / 600s that satisfies the physical constraints of the power grid. The overall data flow is as follows:
[0090] in For node-level spatiotemporal embedding, 128-dimensional 8×8 matrix multiplication unit adapted to Tensor Core. For the carbon factor tensor, For the final carbon factor sequence, .
[0091] 3.1 Spatiotemporal Dynamic Filtering Subnet Node characteristics: Graph structure: ,in, For a set of nodes, corresponding to the total number of power grid nodes and buses, each node carries 16-dimensional features. Let be the set of edges, corresponding to the set of branches in the power grid. The existence and weight of each edge at time t are determined by the adjacency matrix. Given, It is provided in real time after linear interpolation by the data processing module.
[0092] Continuous topological adjacency matrix Synchronizing with node features ensures that the topology and electrical state used in graph convolution are strictly aligned. If there is a time deviation of more than 1 second, the error in line power flow distribution will be significantly amplified.
[0093] Patch splitting: Each node's 16-dimensional feature is divided along the time axis into lengths. The non-overlapping patches are linearly mapped to obtain a 128-dimensional patch embedding:
[0094] in, For nodes i The A time patch, This is the 128-dimensional patch embedding vector after linear mapping.
[0095] Dynamic routing: Construct a k-nearest neighbor graph for the patch and use a kernel function to calculate edge weights (satisfying the Mercer condition):
[0096] in, To patch the Euclidean distance standard deviation, ensure that the weight distribution variance is approximately 1, and avoid gradient vanishing, the Mercer condition states that for the kernel function used, the square matrix obtained by performing kernel function calculations on each pair of vectors generated on any finite set of points is always positive semi-definite.
[0097] Performing Top-p routing: Only retain the top p% of edges by weight, resulting in a decrease in edge density and a linear reduction in computational cost.
[0098] Sparse graph convolution: Spatiotemporal features are extracted through 4 layers of sparse graph convolution, with the following formula:
[0099] in, For nodes The The patch is in the 1st After the convolutional layers are completed, the 128-dimensional feature vector is obtained. For learnable weights, , , For the sake of border rights and, For the first The learnable bias vector of the sparse graph convolution, with the same dimension as the output feature dimension, is used to provide translational degrees of freedom after the affine transformation. For nodes The The patch is in the 1st The convolutional layers produce a 128-dimensional feature vector. Residual connections are injected synchronously with sinusoidal temporal positional encoding to prevent patch misalignment. SiLU has a non-zero derivative near 0, mitigating neuron death, and its smoothness also satisfies the Lipschitz condition. The Lipschitz condition states that when the input changes slightly, the output change will not exceed a fixed multiple of the input change, thus ensuring the stability and controllability of the entire computation process. This facilitates convergence analysis of the subsequent constrained projection solver.
[0100] Output: Concatenate all patches to obtain node-level spatiotemporal embedding:
[0101] in, For node-level spatiotemporal embedding matrices, For patch sequence number The splicing operation performed Represents a node The The patch is the feature vector after convolution in the fourth (final) layer.
[0102] 3.2 Constrained Diffusion Generation of Subnets Conditional encoding: via Convolution embeds a 128-dimensional vector into a 256-dimensional conditional vector:
[0103] in, A 256-dimensional conditional vector is used to continuously inject spatiotemporal context information during the denoising process.
[0104] Diffusion scheduling: Set the number of diffusion steps Noise variance scheduling Define the cumulative signal-to-noise ratio coefficient:
[0105] in, The cumulative signal-to-noise ratio coefficient represents the change from the original data to the diffusion step. So far, the proportion of data variance retained is such that the closer it is to 1, the more data is retained; the closer it is to 0, the closer the data is to pure noise.
[0106] The inference phase uses a one-step DDIM ( =0), The intensity of random noise injected during backsampling, when When = 0, the sampling process becomes a completely deterministic implicit mapping, no longer introducing additional random noise, therefore only... and .
[0107] Initialize noise: Randomly sample noise tensors from a standard Gaussian source.
[0108] in, Let N×60 be a pure noise tensor, representing the random state at the end of the diffusion chain, which serves as the starting point for inverse denoising. It is an identity matrix with dimension N×60, used to indicate that the elements of the noise are independently and identically distributed and follow a standard normal distribution.
[0109] This noise tensor is the "end point" of the diffusion chain.
[0110] One-step reverse denoising: a denoising network using a 6-layer Time-Transformer + Graph Convolution layer. Estimated noise to be removed in step 600:
[0111] According to DDIM The deterministic formula for =0 yields the pre-denoised sequence, which is then used by a denoising network. From pure noise Estimate the noise vector to be removed. (Based on coefficients) and By performing a weighted difference between the noisy and clean data, the carbon factor sequence without random terms can be directly obtained. .
[0112]
[0113] at this time It is "clean," but may still violate the physical constraints of the power grid.
[0114] Explicit definition of the constrained feasible region: The carbon factor sequence Flattened into a vector Construct a quadratic programming model.
[0115] Power balance (equality constraint): for all nodes With all future time points ,in The nodes are the corresponding graphs. One vertex:
[0116] in, For nodes future time point For nodes future time point The active power of the load, A sparse matrix of 600×600N, assembled in one step by node-to-node associations. This is the vector after flattening the carbon factor sequence. It is a 600×1 vector with 0 elements, indicating that the algebraic sum of the net injection power of all nodes at all 600 future time points must be zero.
[0117] Power flow exceeding limits (inequality): For all branches (m,n) and all future time points :
[0118] in, The rated transmission capacity of branch (m,n) For vector c The branch (m,n) calculated using the linearized power flow equations at future time points Trend value, It is a sparse matrix of 2B×600N (B is the number of branches in the system). It is a 2B×1 vector, representing the upper limit of power flow for each branch at each time point.
[0119] Statistical consistency: the flattened vector of carbon factor sequences versus the historical mean Deviation is limited:
[0120] in, The maximum allowable L2 deviation threshold (scalar) is obtained from historical data statistics and is used to limit the carbon factor over the next 600 steps from the historical mean. The overall deviation. This represents a 600×600N selection matrix, retaining only the elements that are... The element at the corresponding position ensures that the constraint applies only to the carbon factor itself and does not affect other variables.
[0121] matrix , From the real-time adjacency matrix It is assembled in real time with the line's rated capacity, and thus updates dynamically with the topology.
[0122] Euclidean projection: The projection is performed on the GPU using the OSQP solver to obtain the carbon factor tensor that satisfies the constraints.
[0123] This quadratic programming problem is implemented on the GPU using a lightweight OSQP solver. After solving, the result is reshaped back to its original form. That is, the final carbon factor sequence that is both noise-free and fully satisfies the physical constraints of the power grid.
[0124] Gradient backpropagation: To make the network end-to-end trainable, the KKT (Karush-Kuhn-Tucker conditions, i.e., the first-order necessary conditions that the optimal solution of QP must satisfy,) conditions of QP (Quadratic Programming, i.e., the optimization problem of minimizing a quadratic objective function under the premise of satisfying a set of linear equality and linear inequality constraints) are regarded as implicit layers, and the gradient is calculated using the implicit function theorem:
[0125] in For Lagrange Hessian matrices, To constrain the Jacobian matrix. The combined total loss across the three scales is achieved using a 6-layer Time-Transformer + GraphConvolution denoising network. This is a deep learning module containing trainable weights and biases. This represents all trainable weights and biases within this deep learning module.
[0126] Time Slicing and Loss Calculation: Segmentation by Market Granularity The values are mapped to three-scale predictions via 1×1 convolution and trained using a composite loss function. Time slice:
[0127] in, The number of prediction steps corresponding to market granularity. =1 Corresponding to the FM market, =2 Corresponding to the real-time market hour In response to the current market, For scale The carbon factor quantum tensor.
[0128]
[0129] After time slicing, the values are mapped to differentiable predicted values using a three-scale 1×1 convolution head. .
[0130] Joint total loss across three scales:
[0131] in, The total loss is the combined loss across the three scales. Discrete indices with values of 10, 60, and 600 correspond to the frequency modulation market, real-time market, and day-ahead market, respectively. These are the scale weighting coefficients. Let N be the predicted carbon factor tensor output by the network in the same forward pass, with dimension N×s, corresponding to the s-th step size. It is the truth carbon factor tensor of the same dimension.
[0132] Three-timescale loss function: Existing techniques typically train models using a single time window, leading to overfitting in short-period predictions and underfitting in long-period predictions, requiring additional parameter tuning or segmented training. This implementation integrates three time axes—10 s, 60 s, and 600 s—into a single composite loss function: First, the mean squared error is calculated for each axis. Then, the results are weighted and summed using coefficients of 1 / 10, 1 / 60, and 1 / 600, respectively. This allows short-period errors to obtain a larger gradient, while long-period errors provide global constraints. Additionally, residual terms and total variation regularization are added as constraints. The weights are determined once through Bayesian optimization and remain unchanged.
[0133] 3.4 Ultra-real-time inference subnet Ensuring ultra-real-time inference through quantization and computational graph optimization: Dynamic INT8 Quantization: Quantification scaling factor:
[0134] The quantization scale is dynamically determined to ensure that the numerical range of each channel is fully utilized.
[0135] Quantization tensor:
[0136] in, () rounds the input value to the nearest integer. The quantization scaling factor of this channel is used to... The numerical range is linearly mapped to the 8-bit interval. To quantize an 8-bit integer tensor, the 32-bit floating-point tensor is compressed to 8-bit, reducing the model size by a factor of four and the bandwidth requirement by a factor of four.
[0137] Inverse quantization:
[0138] During inference, the 8-bit data is restored to 32-bit precision for subsequent convolution or DDIM, while maintaining high accuracy in computation and negligible error.
[0139] CUDA Graph: Three sets of 1×1 convolutions (weights) bias )Calculation and solidification, executed in one go:
[0140] This step yielded The preliminary result is "noise removed and no further diffusion," indicating that only a 1×1 convolution mapping has been completed and DDIM resampling has not yet been performed.
[0141] Adaptive DDIM resampling: Selecting resampling based on PMU packet loss rate. PMU packet loss rate:
[0142] Step selection:
[0143] High signal-to-noise ratio, single-step DDIM is sufficient, delay is 28 ms.
[0144] The signal-to-noise ratio is low, and even after annealing to 4-step DDIM, the time is still <40 ms, ensuring the settlement cycle time.
[0145] Final output:
[0146] in Perform s-step DDIM in INT8 precision and CUDA Graph. Perform another deterministic resampling to obtain the final carbon factor sequence. .
[0147] 4. Application Module: Calls the final carbon factor sequence. With a real-time topology adjacency matrix, real-time monitoring, early warning, and visualization are achieved, reducing overall latency.
[0148] Specifically, the application module, as the system's endpoint, relies only on existing tensors and matrices, without introducing new parameters. Internally, it consists of four parallel pipelines: Monitoring pipeline: Calculate carbon emission rates in real time and write them to a time-series database.
[0149] Predictive pipeline: Generate 10s / 60s / 600s carbon factor curves in a rolling manner.
[0150] Optimize the production line: Output unit adjustment instructions based on secondary planning.
[0151] Visualized pipeline: Renders the results as a node-branch heatmap.
[0152] The three-level self-healing fault diagnosis and decision-making process is set up in the application module and runs independently, triggering a graded response through residual comparison: Fault Detection: Real-time Comparison With real-time measurement values ,in, The node-level carbon factor measurement value is collected in real time by the application module. It consists of the active power of the node and the carbon emission factor for the corresponding time period (the CO2 emission corresponding to 1 MW·h of active load generated by node i within a 1-second measurement period). This value is the instantaneous value of node carbon intensity given in real time by the model module. (Directly provided) The product is obtained in real time and updated every 1 second, compared with the output of the model module. Same-dimensional, synchronous clocks are used for residual comparison.
[0153] When any node And if it lasts for 3 seconds, a level 3 response is triggered.
[0154] Level 1 response: Immediately revert to the previous topology state. The final carbon factor sequence is recalculated within the CPU core using a 4-step DDIM algorithm.
[0155] Second-level response: If the residual still exceeds the limit after the first-level response, reduce the data sampling frequency to reduce noise interference.
[0156] Level 3 response: If the problem persists after the first two levels of processing, the system automatically switches to the backup statistical model to ensure the final carbon factor sequence is accurate. Continuous output.
[0157] In this embodiment, within the three-level self-healing fault diagnosis and decision-making process, the residual monitor built into this module directly reads the difference between the three-scale output and the real-time measurement. If the residual of any node exceeds a certain value for 3 consecutive seconds within a 10-second scale, the monitoring will be initiated. At that time, the module immediately reverts to the previous topology. It also calls 4 steps of DDIM to recalculate within a separate CPU core.
[0158] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A real-time electricity carbon footprint measurement system, characterized in that, include: Data acquisition module: used to synchronously collect power grid operation data, meteorological environment data, load demand data and market price data at the second level, align timestamps with GPS+PPS dual-calibrated clocks and encapsulate them as time series tensors; Data processing module: Used to receive the time series tensor, complete missing data repair, anomaly removal, statistical normalization and topological consistency alignment within 50ms, and output a clean tensor; Model Module: Based on the clean tensor and real-time topological adjacency matrix, this module uses an end-to-end algorithm framework with three time scales for parallel prediction to generate and output the final carbon factor sequence that satisfies the physical constraints of the power grid. The algorithm framework uses a cascaded three-subnet as the core architecture. It executes the Euclidean projection algorithm through the GPU-based OSQP quadratic programming solver to satisfy three types of constraints: power balance, power flow limit exceedance, and statistical consistency. It combines a three-scale window construction method with shared memory views to achieve multi-granularity adaptation and uses a three-time-scale composite loss function and gradient backpropagation based on KKT conditions to complete model training. Application module: used to call the final carbon factor sequence and real-time topological adjacency matrix to achieve real-time monitoring, early warning and visualization; the application module has a built-in three-level self-healing fault diagnosis and decision-making process to ensure the continuous output of the final carbon factor sequence.
2. The ultra-real-time electricity carbon footprint measurement system according to claim 1, characterized in that, The data acquisition module comprises five parallel units: PMU (Phase Module Unit): Used to collect power grid operation data, capturing bus voltage phasors, bus voltage phase angles, branch active power and branch reactive power with a fixed step size; EMS / SCADA unit: Used to collect power grid operation data, including unit output, switch status, fuel type coding, unit fuel carbon emission coefficient, and branch circuit data. The real-time power flow and real-time topology adjacency matrix are packaged into structured messages; Meteorological satellite downlink unit: used to collect meteorological and environmental data, providing irradiance, wind speed, temperature and relative humidity, and mapping them to power grid nodes through spatial interpolation; Load forecasting interface unit: used to collect load demand data and output node load power; Market gateway unit: used to subscribe to market price data and output real-time carbon price and real-time electricity price; The multi-source heterogeneous data collected by each unit is aggregated through the Kafka millisecond-level streaming bus, and then combined with the GPS+PPS dual-calibration clock to generate a nanosecond-level unified timestamp, which is encapsulated as a time series tensor and then sent to the data processing module through the zero-copy CUDA IPC real-time tensor stream transmission link.
3. The ultra-real-time electricity carbon footprint measurement system according to claim 1, characterized in that, The data processing module includes: Spatiotemporal Missing Data Repair Unit: Receives temporal tensors from the data acquisition module, calculates the tensor missing rate, and performs end-to-end imputation of missing data in the tensor using spatiotemporal gated convolution. Spatiotemporal anomaly detection unit: Calculates the moving average and standard deviation for each node-feature channel, and calculates the Z-score. If the Z-score > preset threshold... If an anomaly is detected, the spatiotemporal gap repair unit is triggered to re-interpolate; Topology Consistency Alignment Unit: EMS / SCADA updates the adjacency matrix every 5 seconds, performs linear interpolation on the adjacency matrix, and when topology changes cause node splitting or merging, it uses a weighted average method based on node degree to redistribute node features. Normalization and Feature Derivation Unit: Used to perform Min-Max normalization on the data based on the sliding extreme value, and derive the instantaneous value of node carbon intensity and line power flow utilization feature. The output data dimension is kept to 16 dimensions, but the 15th and 16th dimensions are dynamically replaced with the above-mentioned derived features to obtain a clean tensor. Data quality monitoring unit: used to calculate data integrity rate and anomaly rate in real time. When the data integrity rate is <95% or the anomaly rate is >2%, it switches to the backup data channel. Caching and Distribution Unit: Used to employ a three-level caching architecture, including GPU HBM, NVMe RAID and edge HDFS, and provides the model module with three data interfaces: real-time tensor stream, backtracking window and offline batch through a zero-copy CUDA IPC real-time tensor stream transmission link.
4. The ultra-real-time electricity carbon footprint measurement system according to claim 1, characterized in that, The model module includes a cascaded three-subnet: Spatiotemporal dynamic filtering subnet: Receives a clean tensor and a real-time topological adjacency matrix. Divides each node of the clean tensor into non-overlapping patches of length P=8 along the time axis. Constructs a k-nearest neighbor graph for the patches and calculates the edge weights using an exponential kernel function that satisfies the Mercer condition. Performs Top-p routing to retain the top p% of edges with the weights. After sparse graph convolution processing, all patches are concatenated along the time dimension to obtain the node-level spatiotemporal embedding. Constraint-based diffusion generation subnet: The node-level spatiotemporal embedding is upgraded to a conditional vector. A diffusion scheduling framework is adopted, and a one-step DDIM is used in the inference phase. Noise is estimated and carbon factor sequences are generated through a 6-layer Time-Transformer + Graph Convolution denoising network. A quadratic programming model containing power balance equations, power flow limit inequalities, and statistical consistency soft constraints is constructed. The carbon factor sequences are flattened into vectors and fed into the model. On the GPU, the Euclidean projection algorithm is executed through the OSQP solver to output the carbon factor tensors that satisfy the constraints. The KKT conditions of the quadratic programming are used as implicit layers. The gradient is calculated by combining the implicit function theorem. Based on the three-scale window construction method of shared memory and view, the carbon factor tensors are cut into three business lengths of 10s, 60s, and 600s according to the market granularity and mapped by 1×1 convolution. At the same time, a three-scale joint total loss function is introduced to achieve backpropagation. Ultra-real-time inference subnet: The carbon factor tensor output by the constrained diffusion generation subnet is subjected to INT8 dynamic quantization and CUDAGraph solidification computation graph processing. After 1×1 convolution mapping, deterministic resampling is performed by 1-step or 4-step DDIM according to the PMU packet loss rate, and the final carbon factor sequence is output.
5. The ultra-real-time electricity carbon footprint measurement system according to claim 4, characterized in that, The quadratic programming model in the constraint diffusion generation subnet includes: Power balancing: for all nodes With all future time points in, For nodes In time For nodes In time It is a sparse matrix of 600×600N. Carbon factor sequence A flattened vector. It is a 600×1 vector; Trend exceeding limits: for all branches ( ) and all future time points in, For branch roads ( The rated transmission capacity of ) For vector c Branches calculated using linearized power flow equations ( In time Trend value, It is a sparse matrix of 2B×600N, where B is the number of branches in the system. It is a 2B×1 vector; Statistical consistency: with historical mean Deviation is limited: in, Maximum allowable L2 deviation threshold This represents a 600×600N selection matrix.
6. The ultra-real-time electricity carbon footprint measurement system according to claim 4, characterized in that, The constrained diffusion generation subnet executes the Euclidean projection algorithm, and its calculation formula is as follows: in, For the carbon factor tensor, Carbon factor sequence The flattened vector.
7. The ultra-real-time electricity carbon footprint measurement system according to claim 4, characterized in that, The specific method for constructing the constrained diffusion subnet based on memory-view sharing using a three-scale window is as follows: The carbon factor tensor is sliced for execution time at market granularity, using the following formula: in, The number of prediction steps corresponding to market granularity. =1 Corresponding to the FM market, =2 Corresponding to the real-time market hour In response to the current market, For scale The carbon factor quantum tensor.
8. The ultra-real-time electricity carbon footprint measurement system according to claim 4, characterized in that, The formula for calculating the gradient in the constrained diffusion generation subnet is: in, For parameters in the denoising network, For Lagrange Hessian matrices, To constrain the Jacobian matrix, This is the loss function for joint training across three time scales.
9. A real-time electricity carbon footprint measurement system according to claim 4, characterized in that, The formula for calculating the loss function of the three-timescale joint training in the constrained diffusion generation subnet is as follows: in, The total loss is the combined loss across the three scales. Discrete indices with values of 10, 60, and 600. These are the scale weighting coefficients. To predict the carbon factor tensor, This is the truth carbon factor tensor.
10. A real-time electricity carbon footprint measurement system according to claim 1, characterized in that, The three-level self-healing fault diagnosis and decision-making process is set up in the application module and runs independently, including: Fault detection: The residual between the final carbon factor sequence output by the real-time calculation model module and the real-time measurement value is used to trigger a level 3 response when the absolute value of the residual at any node exceeds 0.05 tCO2 / MWh and lasts for 3 seconds. Level 1 response: Immediately revert to the previous grid topology state and recalculate the final carbon factor sequence using the 4-step DDIM algorithm within the CPU core; Second-level response: If the anomaly persists after the first-level response, reduce the data sampling frequency to reduce noise interference; Level 3 response: If the problem persists after the first two levels of processing, the system will automatically switch to the backup statistical model to ensure that the final carbon factor sequence output is continuously available.