An artificial intelligence-based carbon analysis diagnosis method and system

By using self-supervised pre-training of temporal convolutional networks and BERT models, combined with multi-dimensional feature clustering and abnormal data repair, the problem of incomplete identification of abnormal energy consumption data of equipment is solved, and high-precision, low-cost energy consumption prediction and energy efficiency optimization across equipment types are achieved.

CN122347434APending Publication Date: 2026-07-07JIANGXI BAIDIAN INFORMATION IND CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-09
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing technologies suffer from incomplete identification of abnormal equipment energy consumption data, low reconstruction accuracy, poor generalization ability for prediction across equipment types, and sensitivity of traditional models to parameters, leading to distortion in equipment-level energy efficiency optimization and carbon emission management decisions.

Method used

An AI-based energy and carbon analysis and diagnostic method is adopted. Through self-supervised pre-training of temporal convolutional networks and BERT models, combined with multi-dimensional feature adaptive clustering and density analysis, global outliers and local abnormal patterns in equipment energy consumption data are identified. Neighbor shape matching is used to repair abnormal data, achieving high-precision and low-cost energy consumption prediction.

Benefits of technology

It achieves high-precision identification and reconstruction of device energy consumption data, reduces model training costs, improves prediction generalization ability across device types, and supports edge deployment and real-time diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122347434A_ABST
    Figure CN122347434A_ABST
Patent Text Reader

Abstract

The application provides an artificial intelligence-based carbon analysis and diagnosis method and system, which comprises the following steps: identifying and reconstructing abnormal data from original energy consumption time series data; dividing the standardized energy consumption data set into time blocks in time sequence, mapping the potential representation of the time block into a discrete token sequence through a time convolution network encoder; inputting the discrete token sequence into a preset BERT model for self-supervised pre-training; fine-tuning the linear prediction layer using labeled historical energy consumption data, outputting energy consumption or carbon emission prediction values, and performing energy efficiency analysis and diagnosis based on the energy consumption or carbon emission prediction values. The application can effectively process multi-source heterogeneous device energy consumption data, improve the prediction accuracy and generalization ability in cross-device type scenarios, and provide reliable diagnosis basis for device-level carbon management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of artificial intelligence and equipment energy and carbon management, specifically relating to an energy and carbon analysis and diagnosis method and system based on artificial intelligence. Background Technology

[0002] With increasing energy efficiency requirements in the industrial and building sectors, energy consumption monitoring and carbon emission analysis of key energy-consuming equipment have become increasingly important. During the data collection process, equipment energy consumption data often generates anomalies such as missing values, zero values, constant values, or abrupt changes due to sensor malfunctions, communication interruptions, and environmental interference. If these anomalies are not processed, they will lead to severe distortion in equipment energy consumption predictions, thereby affecting equipment-level energy efficiency optimization and carbon emission management decisions. Existing anomaly detection methods, such as local anomaly factors, can identify local density anomalies, but they have high computational complexity and are sensitive to parameters; isolated forests have high computational efficiency, but their ability to detect local anomalies is insufficient. Furthermore, the energy consumption patterns of different equipment types (such as refrigeration equipment and lighting equipment) or the same equipment under different operating conditions vary significantly. Traditional prediction models trained for single equipment are difficult to transfer to other equipment, resulting in poor cross-equipment generalization ability. Therefore, there is an urgent need for an energy and carbon analysis and diagnostic method that can uniformly process multi-source equipment energy consumption anomaly data and has strong generalization ability. Summary of the Invention

[0003] To address the aforementioned technical problems, this invention proposes an energy and carbon analysis and diagnosis method and system based on artificial intelligence. This method solves the problems of incomplete identification of abnormal energy consumption data of equipment, low reconstruction accuracy, and poor generalization ability of prediction across equipment types in the existing technology. At the same time, it reduces the model's dependence on manually labeled data and improves the automation level of equipment-level energy and carbon management.

[0004] In a first aspect, the present invention provides the following technical solution: an energy and carbon analysis and diagnostic method based on artificial intelligence, comprising: Collect raw energy consumption time-series data of the target device, and perform abnormal data identification and reconstruction on the raw energy consumption time-series data to obtain a standardized energy consumption dataset; The standardized energy consumption dataset is divided into several time blocks according to time sequence, and the latent representation of the time blocks is mapped into a discrete label sequence by a temporal convolutional network encoder. The discrete labeled sequence is input into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; The underlying parameters of the pre-trained model are frozen and a linear prediction layer is added to the top layer. The linear prediction layer is fine-tuned using labeled historical energy consumption data to output predicted energy consumption or carbon emissions. Energy efficiency analysis and diagnosis are then performed based on the predicted energy consumption or carbon emissions.

[0005] Compared to existing technologies, the advantages of this invention are as follows: By integrating multi-dimensional feature adaptive clustering, shape similarity-based density analysis, and random isolation strategies, this invention can comprehensively identify global outliers and local anomaly patterns in equipment energy consumption data, especially demonstrating a high detection rate for hidden anomalies such as continuous shutdowns and zero-value drift. Furthermore, by utilizing neighbor shape matching and trend consistency constraints to perform weighted repair on anomaly data, the reconstruction error is controlled within an extremely low range, significantly outperforming conventional filling methods. Simultaneously, this invention employs a discrete labeling and bidirectional contextual pre-training architecture to autonomously extract general energy consumption variation patterns from a large amount of unlabeled multi-device operating data. This allows the model to be adapted to new devices or operating conditions with only a minimal amount of labeled data, significantly improving prediction accuracy and reducing training costs. In addition, the pre-training-fine-tuning paradigm avoids repetitive training for each device, and the linear evaluation method requires very few parameters, facilitating edge deployment and real-time diagnosis. Overall, it achieves high-precision, strong generalization, and low-cost equipment-level energy and carbon analysis and diagnosis.

[0006] Preferably, the step of identifying and reconstructing abnormal data from the original energy consumption time-series data to obtain a standardized energy consumption dataset includes: The original energy consumption time-series data is normalized to obtain a normalized dataset, and the eigenvalue of each feature in the normalized dataset is calculated. : ; ; In the formula, For the first The feature in the first Relative frequency on each sample For the sample size, For the normalized dataset, the first The feature in the first The specific values ​​on each sample; Calculate the feature weight of each feature based on the feature values. : ; In the formula, Number of features: Determine the optimal number of clusters Random selection 1 sample was used as the initial cluster center. ; For each sample Calculate its distance to each cluster center Weighted Euclidean distance and the sample Assign to the nearest cluster center to form initial clusters : ; In the formula, For the first The cluster centers at the in Values ​​on each feature; Recalculate the cluster centers of each initial cluster and iteratively repeat the clustering process until the iteration stopping condition is met, then output the result. One final cluster; Based on the final cluster, a standardized energy consumption dataset is determined.

[0007] Preferably, the step of determining the standardized energy consumption dataset based on the final cluster includes: Calculate the local anomaly score of samples in each final cluster. Compared with isolated forest anomaly scores The local anomaly score is calculated using dynamic time-warped distance instead of Euclidean distance. ; ; ; In the formula, For samples in the final cluster The dynamic time-normalized distance between them For the sample To its first The nearest neighbor of the first distance, For reachable distance, For locally achievable density, To show of A set of nearest neighbors; The local anomaly score Normalization was performed on the isolated forest anomaly scores. and the normalized local outlier scores Weighted fusion is performed to obtain the final score. : ; In the formula, For weighting; Determine the preset abnormality ratio value Based on the final score, the samples in the final cluster are sorted in descending order, and the top... The sorted data is considered outlier; Within the same final cluster, find the data with the smallest DTW distance to the anomalous data. Each normal data point is used as a neighbor data point, and the calculation of each neighbor data point is performed. energy consumption change slope : ; In the formula, For neighbor data The data value at the previous moment, The sampling interval; Retain neighbor data with slope differences less than a preset value to obtain Given a set of valid neighbor data, calculate the effective weight for each of the valid neighbors. : ; In the formula, It is the reciprocal of the DTW distance. For the first One valid neighbor data point, This is abnormal data. For the first Neighbor data; Based on the effective weights The abnormal data is reconstructed to obtain a standardized energy consumption dataset: .

[0008] Preferably, the optimal number of clusters Cluster statistics Determine which option maximizes the cluster statistic. Value as the optimal number of clusters : ; In the formula, For the number of clusters is The total cohesion of the real dataset at that time. For the first The total cohesion of the reference datasets This represents the number of reference datasets.

[0009] Preferably, the step of dividing the standardized energy consumption dataset into several time blocks according to time sequence, and mapping the latent representation of the time blocks into discrete labeled sequences through a temporal convolutional network encoder includes: The standardized energy consumption dataset Divided into Non-overlapping time blocks ,in The length of the time series; Each time block is fed into the temporal convolutional network encoder. Latent representation extraction is performed to obtain the latent representation. : ; In the formula, For the first One time block; The latent representation is obtained through vector quantization. Mapping to codebook The nearest neighbor vector in the matrix is ​​used to obtain the mapping features. : ; In the formula, For codebook size, For the first in the codebook Each code character; via decoder For the mapping features Perform a reconstruction mapping to obtain a discrete label sequence. : .

[0010] Preferably, the specific steps for inputting the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain a pre-trained model are as follows: Each discrete token in the discrete token sequence is randomly assigned a word embedding from the BERT vocabulary, and the discrete token sequence with word embeddings is input into a preset BERT model for self-supervised pre-training. Among them, the pre-training adopts a high proportion of masked label prediction: more than 30% of the labels in the discrete label sequence are randomly masked, and the preset BERT model is controlled to predict the masked labels based on the unmasked context. Masking Prediction Loss for: ; In the formula, For the set of mask locations, The sequence after removing the mask markers, These are the parameters for the BERT model. The model predictions are masked. The probability of; Pre-training total loss function for: ; In the formula, For balance coefficient, For reconstruction loss.

[0011] Preferably, the steps of freezing the low-level parameters of the pre-trained model, adding a linear prediction layer at the top level, fine-tuning the linear prediction layer using labeled historical energy consumption data, and outputting predicted energy consumption or carbon emissions include: Freeze all parameters of the pre-trained model and retain only the feature representation of its output. ; Add a linear prediction layer at the top: ,in, , For the first and second trainable parameters, For predicting output; A linear prediction layer is trained using labeled historical energy consumption data, with mean squared error as the loss function. After training, an adjusted linear prediction layer is output, and energy consumption or carbon emission predictions are output based on the adjusted linear prediction layer.

[0012] Secondly, the present invention provides the following technical solution: an energy and carbon analysis and diagnostic system based on artificial intelligence, the system comprising: The identification module is used to collect the raw energy consumption time-series data of the target device, and to identify and reconstruct abnormal data in the raw energy consumption time-series data to obtain a standardized energy consumption dataset. The mapping module is used to divide the standardized energy consumption dataset into several time blocks according to time sequence, and to map the latent representation of the time blocks into discrete label sequences through a temporal convolutional network encoder; The training module is used to input the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; The output module is used to freeze the underlying parameters of the pre-trained model and add a linear prediction layer at the top layer. It then fine-tunes the linear prediction layer using labeled historical energy consumption data, outputs predicted energy consumption or carbon emissions, and performs energy efficiency analysis and diagnosis based on the predicted energy consumption or carbon emissions.

[0013] Thirdly, the present invention provides the following technical solution: a computer, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described artificial intelligence-based energy and carbon analysis and diagnosis method.

[0014] Fourthly, the present invention provides the following technical solution: a storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the above-described artificial intelligence-based energy and carbon analysis and diagnosis method. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A flowchart of an energy and carbon analysis and diagnostic method based on artificial intelligence provided in Embodiment 1 of the present invention; Figure 2 This is a structural block diagram of the energy and carbon analysis and diagnostic system based on artificial intelligence provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the hardware structure of a computer provided for another embodiment of the present invention.

[0017] The embodiments of the present invention will be further described below with reference to the accompanying drawings. Detailed Implementation

[0018] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain embodiments of the present invention, and should not be construed as limiting the present invention.

[0019] Example 1 In Embodiment 1 of the present invention, as Figure 1 As shown, an artificial intelligence-based energy and carbon analysis and diagnostic method includes: S1. Collect the raw energy consumption time-series data of the target device, and perform abnormal data identification and reconstruction on the raw energy consumption time-series data to obtain a standardized energy consumption dataset. Step S1 includes: S11. Normalize the original energy consumption time-series data to obtain a normalized dataset, and calculate the feature value of each feature in the normalized dataset. : ; ; In the formula, For the first The feature in the first Relative frequency on each sample For the sample size, For the normalized dataset, the first The feature in the first The specific values ​​on each sample; S12. Calculate the feature weight of each feature based on the feature values. : ; In the formula, Number of features: S13. Determine the optimal number of clusters. Random selection 1 sample was used as the initial cluster center. ; S14. For each sample Calculate its distance to each cluster center Weighted Euclidean distance and the sample Assign to the nearest cluster center to form initial clusters : ; In the formula, For the first The cluster centers at the in Values ​​on each feature; S15. Recalculate the cluster centers of each initial cluster and iteratively repeat the clustering process until the iteration stopping condition is met, then output the results. One final cluster; Specifically, the method for recalculating cluster centers here is the same as that of the traditional K-means algorithm, so it will not be described in detail here; Meanwhile, the traditional K-means algorithm treats all features equally, and the clustering effect deteriorates significantly when the feature set contains noise or redundant information. This step introduces eigenvalues ​​to quantify the discriminative power of each feature: the smaller the eigenvalue, the greater the difference in the value of that feature among different samples, and the better it reflects the essential differences in the operating status of the equipment; conversely, features with large eigenvalues ​​(such as almost constant sensor values) contribute little to clustering. By converting eigenvalues ​​into weights and weighting them in distance calculation, this invention can automatically suppress useless features and highlight key features, thereby obtaining clustering results with clearer physical meaning in high-dimensional, noisy equipment energy consumption data.

[0020] Preferably, the optimal number of clusters Cluster statistics Determine which option maximizes the cluster statistic. Value as the optimal number of clusters : ; In the formula, For the number of clusters is The total cohesion of the real dataset at that time. For the first The total cohesion of the reference datasets This represents the number of reference datasets.

[0021] Cluster statistics are used to automatically determine the number of clusters, avoiding the subjectivity of human experience in setting clusters and making clustering more objective and adaptive. The benefits of this step include: improved targeting of subsequent anomaly detection (consistent device operating modes within each cluster make anomalies easier to detect); reduced false alarms across modes; and providing a basis for feature importance analysis.

[0022] S16. Determine the standardized energy consumption dataset based on the final cluster.

[0023] Step S16 includes: S161. Calculate the local anomaly score of samples in each final cluster. Compared with isolated forest anomaly scores The local anomaly score is calculated using dynamic time-warped distance instead of Euclidean distance. ; ; ; In the formula, For samples in the final cluster The dynamic time-normalized distance between them For the sample To its first The nearest neighbor of the first distance, For reachable distance, For locally achievable density, To show of A set of nearest neighbors; S162, The local anomaly score Normalization was performed on the isolated forest anomaly scores. and the normalized local outlier scores Weighted fusion is performed to obtain the final score. : ; In the formula, For weighting; S163. Determine the preset abnormality ratio value. Based on the final score, the samples in the final cluster are sorted in descending order, and the top... The sorted data is considered outlier; Specifically, the preset anomaly ratio here is set to 0.05. Each individual anomaly detection method has its limitations: density-based LOF algorithms excel at finding local sparse points but are insensitive to global anomalies, and Euclidean distance cannot capture shape similarity when the data contains time-series characteristics; Isolation Forest (iForest) is computationally efficient but easily overlooks local density differences. By combining these two complementary methods and introducing DTW distance instead of Euclidean distance, LOF can effectively compare energy consumption sequences with different time lengths or phase shifts. For example, the load curves of air conditioners on Monday and Tuesday may shift overall, but DTW can still identify their shape similarity. Specific benefits include: simultaneous detection of global outliers and local anomaly clusters; robustness to time-series deformation; and the fusion of the two scores reduces the false alarm rate and false negative rate of a single algorithm. Meanwhile, since the two types of outlier scores have different numerical ranges (theoretically, local outlier scores can be greater than 1), direct weighting would result in scores with larger values ​​dominating the outcome. Normalization eliminates the difference in units of measurement, making the fusion fair and reasonable. Weighting The selection can be adjusted according to the actual scenario: if the device's operating mode is relatively simple, the size can be increased. Highlight local anomalies; if the equipment has a large amount of global noise, it can be reduced. This invention defaults to This reflects the emphasis on local anomalies, as most device power consumption anomalies (such as short shutdowns or sensor spikes) manifest as local outliers. The fused score combines the advantages of both algorithms, improving the robustness and accuracy of anomaly detection.

[0024] S164. Within the same final cluster, find the data with the smallest DTW distance to the anomalous data. Each normal data point is used as a neighbor data point, and the calculation of each neighbor data point is performed. energy consumption change slope : ; In the formula, For neighbor data The data value at the previous moment, The sampling interval; S165. Retain neighbor data with slope differences less than a preset value to obtain... Given a set of valid neighbor data, calculate the effective weight for each of the valid neighbors. : ; In the formula, It is the reciprocal of the DTW distance. For the first One valid neighbor data point, This is abnormal data. For the first Neighbor data; S166, Based on the effective weights The abnormal data is reconstructed to obtain a standardized energy consumption dataset: ; Specifically, directly removing outlier data would disrupt the continuity and periodicity of the time series, leading to increased prediction errors in subsequent data. This step addresses this by finding normal neighbors most similar to the historical patterns of outliers and performing a weighted average based on DTW distance. This preserves the temporal integrity of the data while avoiding simple outlier removal. The core reason for introducing slope filtering is that even with a small DTW distance, if the trends (upward or downward) are opposite, direct weighting may still produce unreasonable correction values ​​(e.g., using neighbors from the downward trend in an upward trend). Slope constraints effectively remove neighbors with inconsistent trends, improving the physical rationality of the correction. The iterative correction strategy for continuous outliers solves the "chicken or egg" problem: an approximation is obtained using KNN without slope, then the slope is calculated based on the approximation, and finally, slope filtering is used for further refinement.

[0025] S2. Divide the standardized energy consumption dataset into several time blocks according to time sequence, and map the latent representation of the time blocks into discrete label sequences through a temporal convolutional network encoder. Step S2 includes: S21, The standardized energy consumption dataset is... Divided into Non-overlapping time blocks ,in The length of the time series; Specifically, directly processing long input sequences leads to an explosion in computational cost, and positional encoding struggles to capture local patterns. Block segmentation compresses the sequence into several local segments, each retaining details of short-term energy consumption changes while reducing sequence length, enabling subsequent BERT processing to be more efficient. Fixed block length (For example, 7 hours) balances computational efficiency and resolution.

[0026] S22. Input each time block into the temporal convolutional network encoder. Latent representation extraction is performed to obtain the latent representation. : ; In the formula, For the first One time block; Specifically, TCN offers advantages in parallel computation compared to RNN, and dilated convolution can exponentially expand the receptive field, making it suitable for extracting multi-period features from energy consumption sequences (such as 24-hour daily cycles and 168-hour weekly cycles). Causal convolution ensures that future information is not used during prediction, conforming to the basic constraints of time series modeling. Encoded latent representation It condenses key dynamic information within the time block, laying the foundation for subsequent quantification.

[0027] S23. The latent representation is quantized by vector quantization. Mapping to codebook The nearest neighbor vector in the matrix is ​​used to obtain the mapping features. : ; In the formula, For codebook size, For the first in the codebook Each code character; Specifically, representations in continuous vector space cannot be directly input into BERT (BERT expects discrete inputs). Vector quantization maps similar continuous vectors to the same discrete codeword, essentially building an "energy consumption dictionary," allowing the model to process energy consumption patterns like words. Codebook size It provides sufficient expressive power while avoiding the sparsity problem caused by an excessively large codebook. This step also introduces a regularization effect: forcing the encoder output to align with the codewords, preventing overfitting.

[0028] S24, via decoder For the mapping features Perform a reconstruction mapping to obtain a discrete label sequence. : ; Specifically, the training objective of this step is to minimize the reconstruction error, and the loss also includes codebook commitment loss to stabilize training. For simplicity, only the main loss is listed here. The reconstruction loss forces the encoder-decoder to retain sufficient information from the original sequence, thereby ensuring that the discrete labels do not lose key energy consumption features. High-fidelity reconstruction is the foundation for subsequent self-supervised pre-training. Furthermore, this process requires no labels, is fully self-supervised, and can make full use of massive amounts of unlabeled device energy consumption data.

[0029] S3. Input the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; Specifically, step S3 is as follows: Each discrete token in the discrete token sequence is randomly assigned a word embedding from the BERT vocabulary, and the discrete token sequence with word embeddings is input into a preset BERT model for self-supervised pre-training. Among them, the pre-training adopts a high proportion of masked label prediction: more than 30% of the labels in the discrete label sequence are randomly masked, and the preset BERT model is controlled to predict the masked labels based on the unmasked context. Masking Prediction Loss for: ; In the formula, For the set of mask locations, The sequence after removing the mask markers, These are the parameters for the BERT model. The model predictions are masked. The probability of; Pre-training total loss function for: ; In the formula, For balance coefficient, For reconstruction loss; Specifically, BERT's bidirectional attention mechanism is naturally well-suited for capturing contextual dependencies in time series, but the original BERT cannot directly handle continuous numerical values. This invention addresses modal differences through vector quantization and vocabulary mapping. A high masking ratio (40% in this embodiment) is a key design feature: in conventional natural language processing, the masking ratio is typically 15%, but energy consumption sequences have high redundancy. A higher masking ratio forces the model to utilize more distant contextual information to infer the masked portion, thereby learning deeper periodic patterns (e.g., if a whole day's data is masked, the model needs to reconstruct it based on patterns from previous days). This self-supervised task does not rely on any manual annotation and can utilize a large amount of mixed data from different device types (air conditioners, lighting, air compressors, etc.) for training, making the energy consumption representation extracted by the model universal across devices. The total loss... It balances the fidelity of the original sequence with advanced semantic learning, avoiding the model from focusing only on reconstruction and ignoring abstract patterns.

[0030] S4. Freeze the underlying parameters of the pre-trained model and add a linear prediction layer at the top. Fine-tune the linear prediction layer using labeled historical energy consumption data, output energy consumption or carbon emission prediction values, and perform energy efficiency analysis and diagnosis based on the energy consumption or carbon emission prediction values.

[0031] Step S4 includes: S41. Freeze all parameters of the pre-trained model, retaining only its output feature representation. ; S42. Add a linear prediction layer at the top level: ,in, , For the first and second trainable parameters, For predicting output; S43. Use labeled historical energy consumption data to train a linear prediction layer. The loss function used for training is mean squared error. After training, output the adjusted linear prediction layer. Based on the adjusted linear prediction layer, output the predicted energy consumption or carbon emission values. Specifically, freezing the pre-trained model parameters and training only the linear layers, i.e., "linear evaluation," has the following advantages: 1) It greatly reduces the number of trainable parameters (only linear layers), avoiding overfitting on downstream tasks with small sample sizes; 2) The training speed is extremely fast, typically converging in a few dozen iterations; 3) It directly reflects the representational power of the pre-trained features—if the features are good enough, even a simple linear model can achieve excellent results. For carbon emission diagnosis, after the linear layer outputs the predicted value, multiplying it by the carbon emission factor yields the carbon emission prediction. The system can compare the predicted value with the energy efficiency benchmark and automatically generate alarms or optimization suggestions. This paradigm allows the present invention to quickly adapt to new equipment types without repeating expensive pre-training.

[0032] The energy and carbon analysis and diagnosis method based on artificial intelligence provided in Embodiment 1 of this invention integrates multi-dimensional feature adaptive clustering, shape similarity-based density analysis, and random isolation strategies. This enables comprehensive identification of global outliers and local anomaly patterns in equipment energy consumption data, exhibiting a high detection rate, particularly for hidden anomalies such as continuous shutdowns and zero-value drift. Furthermore, it utilizes neighbor shape matching and trend consistency constraints to weighted repair of anomaly data, keeping reconstruction errors within an extremely low range, significantly outperforming conventional filling methods. Simultaneously, this invention employs a discrete labeling and bidirectional contextual pre-training architecture, autonomously extracting general energy consumption variation patterns from a large amount of unlabeled multi-device operating data. This allows the model to be adapted to new devices or operating conditions with only a minimal amount of labeled data for top-level adaptation, significantly improving prediction accuracy and reducing training costs. Moreover, the pre-training-fine-tuning paradigm avoids repetitive training for each device, and the linear evaluation method requires very few parameters, facilitating edge deployment and real-time diagnosis. Overall, it achieves high-precision, strong generalization, and low-cost equipment-level energy and carbon analysis and diagnosis.

[0033] Example 2 like Figure 2 As shown, in Embodiment 2 of the present invention, an energy and carbon analysis and diagnostic system based on artificial intelligence is provided, the system comprising: The identification module 1 is used to collect the raw energy consumption time-series data of the target device, and to identify and reconstruct abnormal data in the raw energy consumption time-series data to obtain a standardized energy consumption dataset. Mapping module 2 is used to divide the standardized energy consumption dataset into several time blocks according to time sequence, and to map the potential representation of the time blocks into discrete label sequences through a temporal convolutional network encoder; Training module 3 is used to input the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; Output module 4 is used to freeze the underlying parameters of the pre-trained model and add a linear prediction layer at the top layer. It then uses labeled historical energy consumption data to fine-tune the linear prediction layer, outputs predicted energy consumption or carbon emissions, and performs energy efficiency analysis and diagnosis based on the predicted energy consumption or carbon emissions.

[0034] Specifically, the identification module 1 is used for: The original energy consumption time-series data is normalized to obtain a normalized dataset, and the eigenvalue of each feature in the normalized dataset is calculated. : ; ; In the formula, For the first The feature in the first Relative frequency on each sample For the sample size, For the normalized dataset, the first The feature in the first The specific values ​​on each sample; Calculate the feature weight of each feature based on the feature values. : ; In the formula, Number of features: Determine the optimal number of clusters Random selection 1 sample was used as the initial cluster center. ; For each sample Calculate its distance to each cluster center Weighted Euclidean distance and the sample Assign to the nearest cluster center to form initial clusters : ; In the formula, For the first The cluster centers at the in Values ​​on each feature; Recalculate the cluster centers of each initial cluster and iteratively repeat the clustering process until the iteration stopping condition is met, then output the result. One final cluster; Based on the final cluster, a standardized energy consumption dataset is determined.

[0035] The identification module 1 is further used for: Calculate the local anomaly score of samples in each final cluster. Compared with isolated forest anomaly scores The local anomaly score is calculated using dynamic time-warped distance instead of Euclidean distance. ; ; ; In the formula, For samples in the final cluster The dynamic time-normalized distance between them For the sample To its first The nearest neighbor of the first distance, For reachable distance, For locally achievable density, To show of A set of nearest neighbors; The local anomaly score Normalization was performed on the isolated forest anomaly scores. and the normalized local outlier scores Weighted fusion is performed to obtain the final score. : ; In the formula, For weighting; Determine the preset abnormality ratio value Based on the final score, the samples in the final cluster are sorted in descending order, and the top... The sorted data is considered outlier; Within the same final cluster, find the data with the smallest DTW distance to the anomalous data. Each normal data point is used as a neighbor data point, and the calculation of each neighbor data point is performed. energy consumption change slope : ; In the formula, For neighbor data The data value at the previous moment, The sampling interval; Retain neighbor data with slope differences less than a preset value to obtain Given a set of valid neighbor data, calculate the effective weight for each of the valid neighbors. : ; In the formula, It is the reciprocal of the DTW distance. For the first One valid neighbor data point, This is abnormal data. For the first Neighbor data; Based on the effective weights The abnormal data is reconstructed to obtain a standardized energy consumption dataset: .

[0036] Among them, the optimal number of clusters Cluster statistics Determine which option maximizes the cluster statistic. Value as the optimal number of clusters : ; In the formula, For the number of clusters is The total cohesion of the real dataset at that time. For the first The total cohesion of the reference datasets This represents the number of reference datasets.

[0037] Specifically, the mapping module 2 is used for: The standardized energy consumption dataset Divided into Non-overlapping time blocks ,in The length of the time series; Each time block is fed into the temporal convolutional network encoder. Latent representation extraction is performed to obtain the latent representation. : ; In the formula, For the first One time block; The latent representation is obtained through vector quantization. Mapping to codebook The nearest neighbor vector in the matrix is ​​used to obtain the mapping features. : ; In the formula, For codebook size, For the first in the codebook Each code character; via decoder For the mapping features Perform a reconstruction mapping to obtain a discrete label sequence. : .

[0038] Specifically, the training module 3 is used for: Each discrete token in the discrete token sequence is randomly assigned a word embedding from the BERT vocabulary, and the discrete token sequence with word embeddings is input into a preset BERT model for self-supervised pre-training. Among them, the pre-training adopts a high proportion of masked label prediction: more than 30% of the labels in the discrete label sequence are randomly masked, and the preset BERT model is controlled to predict the masked labels based on the unmasked context. Masking Prediction Loss for: ; In the formula, For the set of mask locations, The sequence after removing the mask markers, These are the parameters for the BERT model. The model predictions are masked. The probability of; Pre-training total loss function for: ; In the formula, For balance coefficient, For reconstruction loss.

[0039] Specifically, the output module 4 is used for: Freeze all parameters of the pre-trained model and retain only the feature representation of its output. ; Add a linear prediction layer at the top: ,in, , For the first and second trainable parameters, For predicting output; A linear prediction layer is trained using labeled historical energy consumption data, with mean squared error as the loss function. After training, an adjusted linear prediction layer is output, and energy consumption or carbon emission predictions are output based on the adjusted linear prediction layer.

[0040] In other embodiments of the present invention, the present invention provides the following technical solution: a computer, including a memory 102, a processor 101, and a computer program stored in the memory 102 and executable on the processor 101, wherein the processor 101 executes the computer program to implement the energy and carbon analysis and diagnosis method based on artificial intelligence as described above.

[0041] Specifically, the processor 101 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention.

[0042] The memory 102 may include a large-capacity memory for data or instructions. For example, and not limitingly, the memory 102 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 102 may include removable or non-removable (or fixed) media. Where appropriate, the memory 102 may be internal or external to a data processing device. In a particular embodiment, the memory 102 is non-volatile memory. In a particular embodiment, the memory 102 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random Access Memory (FPMDRAM), Extended Data Out Dynamic Random Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.

[0043] The memory 102 can be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the processor 101.

[0044] The processor 101 reads and executes the computer program instructions stored in the memory 102 to implement the above-mentioned artificial intelligence-based energy and carbon analysis and diagnosis method.

[0045] In some embodiments, the computer may further include a communication interface 103 and a bus 100. For example, Figure 3 As shown, the processor 101, memory 102, and communication interface 103 are connected through bus 100 and complete communication with each other.

[0046] The communication interface 103 is used to enable communication between the various modules, devices, units, and / or equipment in the embodiments of the present invention. The communication interface 103 can also enable data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.

[0047] Bus 100 includes hardware, software, or both, that couples components of a computer device together. Bus 100 includes, but is not limited to, at least one of the following: data bus, address bus, control bus, expansion bus, and local bus. For example, and not as a limitation, bus 100 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 100 may include one or more buses. Although specific buses are described and illustrated in the embodiments of the present invention, the present invention is contemplated by any suitable bus or interconnect.

[0048] The computer can acquire an AI-based energy and carbon analysis diagnostic system and execute the AI-based energy and carbon analysis diagnostic method of this invention, thereby realizing AI-based energy and carbon analysis diagnostics.

[0049] In some further embodiments of the present invention, in conjunction with the above-described artificial intelligence-based energy and carbon analysis and diagnosis method, the present invention provides the following technical solution: a storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the above-described artificial intelligence-based energy and carbon analysis and diagnosis method.

[0050] Those skilled in the art will understand that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0051] More specific examples of readable media (a non-exhaustive list) include: electrical connections (electronic devices) with one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0052] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0053] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0054] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. An energy and carbon analysis and diagnostic method based on artificial intelligence, characterized in that, include: Collect raw energy consumption time-series data of the target device, and perform abnormal data identification and reconstruction on the raw energy consumption time-series data to obtain a standardized energy consumption dataset; The standardized energy consumption dataset is divided into several time blocks according to time sequence, and the latent representation of the time blocks is mapped into a discrete label sequence by a temporal convolutional network encoder. The discrete labeled sequence is input into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; The underlying parameters of the pre-trained model are frozen and a linear prediction layer is added to the top layer. The linear prediction layer is fine-tuned using labeled historical energy consumption data to output predicted energy consumption or carbon emissions. Energy efficiency analysis and diagnosis are then performed based on the predicted energy consumption or carbon emissions.

2. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 1, characterized in that, The steps of identifying and reconstructing abnormal data from the original energy consumption time-series data to obtain a standardized energy consumption dataset include: The original energy consumption time-series data is normalized to obtain a normalized dataset, and the eigenvalue of each feature in the normalized dataset is calculated. : ; ; In the formula, For the first The feature in the first Relative frequency on each sample For the sample size, For the normalized dataset, the first The feature in the first The specific values ​​on each sample; Calculate the feature weight of each feature based on the feature values. : ; In the formula, Number of features: Determine the optimal number of clusters Random selection 1 sample was used as the initial cluster center. ; For each sample Calculate its distance to each cluster center Weighted Euclidean distance and the sample Assign to the nearest cluster center to form initial clusters : ; In the formula, For the first The cluster centers at the in Values ​​on each feature; Recalculate the cluster centers of each initial cluster and iteratively repeat the clustering process until the iteration stopping condition is met, then output the result. One final cluster; Based on the final cluster, a standardized energy consumption dataset is determined.

3. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 2, characterized in that, The step of determining the standardized energy consumption dataset based on the final cluster includes: Calculate the local anomaly score of samples in each final cluster. Compared with isolated forest anomaly scores The local anomaly score is calculated using dynamic time-warped distance instead of Euclidean distance. ; ; ; In the formula, For samples in the final cluster The dynamic time-normalized distance between them For the sample To its first The nearest neighbor of the first distance, For reachable distance, For locally achievable density, To show of A set of nearest neighbors; The local anomaly score Normalization was performed on the isolated forest anomaly scores. and the normalized local outlier scores Weighted fusion is performed to obtain the final score. : ; In the formula, For fusion weights; Determine the preset abnormality ratio value Based on the final score, the samples in the final cluster are sorted in descending order, and the top... The sorted data is considered outlier; Within the same final cluster, find the data with the smallest DTW distance to the anomalous data. Each normal data point is used as a neighbor data point, and the calculation of each neighbor data point is performed. energy consumption change slope : ; In the formula, For neighbor data The data value at the previous moment, The sampling interval; Retain neighbor data with slope differences less than a preset value to obtain Given a set of valid neighbor data, calculate the effective weight for each of the valid neighbors. : ; In the formula, It is the reciprocal of the DTW distance. For the first One valid neighbor data point, This is abnormal data. For the first Neighbor data; Based on the effective weights The abnormal data is reconstructed to obtain a standardized energy consumption dataset: 。 4. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 2, characterized in that, The optimal number of clusters Cluster statistics Determine which option maximizes the cluster statistic. Value as the optimal number of clusters : ; In the formula, For the number of clusters is The total cohesion of the real dataset at that time. For the first The total cohesion of the reference datasets This represents the number of reference datasets.

5. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 1, characterized in that, The step of dividing the standardized energy consumption dataset into several time blocks according to time sequence, and mapping the latent representation of the time blocks into discrete labeled sequences through a temporal convolutional network encoder includes: The standardized energy consumption dataset Divided into Non-overlapping time blocks ,in The length of the time series; Each time block is fed into the temporal convolutional network encoder. Latent representation extraction is performed to obtain the latent representation. : ; In the formula, For the first One time block; The latent representation is obtained through vector quantization. Mapping to codebook The nearest neighbor vector in the matrix is ​​used to obtain the mapping features. : ; In the formula, For codebook size, For the first in the codebook Each code character; via decoder For the mapping features Perform a reconstruction mapping to obtain a discrete label sequence. : 。 6. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 1, characterized in that, The specific steps for inputting the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain the pre-trained model are as follows: Each discrete token in the discrete token sequence is randomly assigned a word embedding from the BERT vocabulary, and the discrete token sequence with word embeddings is input into a preset BERT model for self-supervised pre-training. Among them, the pre-training adopts a high proportion of masked label prediction: more than 30% of the labels in the discrete label sequence are randomly masked, and the preset BERT model is controlled to predict the masked labels based on the unmasked context. Masking Prediction Loss for: ; In the formula, For the set of mask locations, The sequence after removing the mask markers, These are the parameters for the BERT model. The model predictions are masked. The probability of; Pre-training total loss function for: ; In the formula, For balance coefficient, For reconstruction loss.

7. The energy and carbon analysis and diagnosis method based on artificial intelligence according to claim 1, characterized in that, The steps of freezing the bottom-level parameters of the pre-trained model, adding a linear prediction layer at the top level, fine-tuning the linear prediction layer using labeled historical energy consumption data, and outputting predicted energy consumption or carbon emissions include: Freeze all parameters of the pre-trained model and retain only the feature representation of its output. ; Add a linear prediction layer at the top: ,in, , For the first and second trainable parameters, For predicting output; A linear prediction layer is trained using labeled historical energy consumption data, with mean squared error as the loss function. After training, an adjusted linear prediction layer is output, and energy consumption or carbon emission predictions are output based on the adjusted linear prediction layer.

8. An energy and carbon analysis and diagnostic system based on artificial intelligence, characterized in that, The system includes: The identification module is used to collect the raw energy consumption time-series data of the target device, and to identify and reconstruct abnormal data in the raw energy consumption time-series data to obtain a standardized energy consumption dataset. The mapping module is used to divide the standardized energy consumption dataset into several time blocks according to time sequence, and to map the latent representation of the time blocks into discrete label sequences through a temporal convolutional network encoder; The training module is used to input the discrete labeled sequence into a preset BERT model for self-supervised pre-training to obtain a pre-trained model; The output module is used to freeze the underlying parameters of the pre-trained model and add a linear prediction layer at the top layer. It then fine-tunes the linear prediction layer using labeled historical energy consumption data, outputs predicted energy consumption or carbon emissions, and performs energy efficiency analysis and diagnosis based on the predicted energy consumption or carbon emissions.

9. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the artificial intelligence-based energy and carbon analysis and diagnosis method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the artificial intelligence-based energy and carbon analysis and diagnosis method as described in any one of claims 1 to 7.