A gas flow meter anomaly detection method based on machine learning

Through the machine learning-based gas flowmeter abnormality detection method, the pre-trained model and hypothesis detection method are used to automatically detect abnormalities of the gas flowmeter, solving the problems of low manual detection efficiency and high subjectivity in the prior art, and achieving efficient and accurate abnormality detection effect.

CN119760592APending Publication Date: 2025-04-04CHANGZHOU WEIGE ELECTRONICS CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411763427.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the prior art, the abnormal detection of gas flowmeters relies on manual observation, which is inefficient and subjective, and cannot meet the detection needs of large-scale IoT gas flowmeter equipment.

Method used

The gas flowmeter abnormality detection method based on machine learning is adopted, and the gas flowmeter abnormality detection method is used to obtain time series data, predict the flow rate using pre-trained models, calculate the deviation between the observed flow rate and the predicted flow rate, and use hypothesis detection method to automatically detect the abnormality of the gas flowmeter.

Benefits of technology

It realizes efficient and accurate automated anomaly detection, reduces manual intervention, improves detection efficiency and interpretability, and can cope with the growing number of IoT devices and complex anomaly detection needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760592A_ABST
    Figure CN119760592A_ABST
Patent Text Reader

Abstract

The present invention provides a method for detecting abnormalities of a gas flow meter based on machine learning, which belongs to the technical field of gas metering equipment diagnosis, and includes: step S1, obtaining time series data of the gas flow meter within a preset time period, and using a prediction model to predict the predicted flow value corresponding to each observed flow value; step S2, calculating the flow deviation between the observed flow value and the corresponding predicted flow value; step S3, using a hypothesis test method to test the flow deviation, and according to the test result, obtaining the cumulative loss time when the flow deviation is greater than a preset flow deviation threshold within the preset time period; step S4, according to the cumulative loss time, obtaining the detection result of whether the gas flow meter has an abnormality. Beneficial effect: By using a pre-trained model to predict the flow, and calculating the flow deviation between the observed flow and the predicted flow, and combining the hypothesis test method to statistically calculate the cumulative loss time when the deviation exceeds the threshold, the abnormality of the gas flow meter can be automatically detected efficiently and accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of gas metering equipment diagnosis, and in particular to a gas flow meter anomaly detection method based on machine learning. Background Art

[0002] Gas flow meter is one of the commonly used metering equipment in the gas pipeline transmission and distribution system. Gas flow meter can monitor the gas transmission and distribution status and flow rate in real time to ensure the stability and safety of gas supply.

[0003] After the gas flow meter is installed and put into use, there may be distortion in the measurement data. The causes of this measurement error include but are not limited to natural wear of the mechanical structure, accidental physical damage, and malicious interference or misoperation by humans.

[0004] In practical applications, the observation flow F is introduced measured and the actual flow F actual To describe the metering state of the gas flow meter. Among them, the observed flow F measured It refers to the flow data directly measured and recorded by the gas flow meter over a period of time, while the actual flow F actual It refers to the actual gas flow in the real world. According to the observed flow F measured and the actual flow F actual According to the size relationship, the abnormal situations of gas flow meter can be divided into two categories:

[0005] 1. Dead meter. Dead meter is also called dormant meter. It refers to the observation flow F measured is 0, but the actual flow F actual Greater than 0, and the cumulative duration within 24 hours exceeds the set sleep threshold t sleep .

[0006] 2. Slow meter. Slow meter refers to the observation flow F measured Not 0, but the observed flow F measured The actual flow rate F actual The difference is greater than the set threshold F th , and the cumulative duration within 24 hours exceeds the set threshold t slow .

[0007] Both types of abnormal situations mean that the measurement value of the gas flow meter deviates significantly from the true value. If it is not discovered and handled in time, it will cause huge economic losses to the gas supply service provider.

[0008] In the prior art, manual observation is usually used to check the time series data (including temperature, pressure and flow) measured by the gas flow meter. The main criterion is whether the change in pressure in the time series will lead to a change in flow. The memes (i.e., similar patterns of data changes) of the time series curves of pressure and flow are observed by visual methods, and the parts of the curves that are inconsistent with the memes are found. Finally, the suspected abnormal situation is judged in combination with technical experience. This method has low work efficiency, high subjectivity, and is easily affected by the experience and skill level of the observer.

[0009] With the popularization of IoT technology and the development of the concept of smart cities, the number of IoT gas flow meter installations has grown exponentially. Traditional methods based on manual observation can no longer meet the needs of large-scale gas flow meter anomaly detection. Summary of the invention

[0010] In order to solve the above technical problems, the present invention provides a gas flow meter abnormality detection method based on machine learning.

[0011] The technical problem solved by the present invention can be achieved by adopting the following technical solutions:

[0012] A gas flow meter anomaly detection method based on machine learning, comprising:

[0013] Step S1, obtaining time series data of a gas flow meter within a preset time period, and using a pre-trained prediction model to predict a predicted flow value corresponding to each observed flow value in the time series data;

[0014] Step S2, calculating the flow deviation between all the observed flow values ​​and the corresponding predicted flow values ​​within the preset time period;

[0015] Step S3, using a hypothesis test method to test the flow deviation to obtain a test result, and statistically obtain the cumulative loss time during which the flow deviation is greater than a preset flow deviation threshold value within the preset time period according to the test result;

[0016] Step S4, obtaining a detection result of whether the gas flow meter has an abnormality according to the accumulated loss time.

[0017] Preferably, in step S1, the training step of the prediction model includes:

[0018] Step S11, acquiring time series data sampled from a calibrated gas flow meter;

[0019] Step S12, performing time integration processing on the time series data to extract low-frequency features in the time series data as a basic data set;

[0020] Step S13, applying a machine learning algorithm to perform data feature mining analysis, and extracting key features in the basic data set as a training data set;

[0021] Step S14: performing model training according to the training data set to obtain the prediction model.

[0022] Preferably, the step S11 comprises:

[0023] Step S111, screening the acquired time series data according to preset upper and lower boundaries to eliminate invalid data;

[0024] Step S112, filtering outliers in the time series data.

[0025] Preferably, in the step S111, a percentage threshold of the maximum range is set as the preset upper and lower boundaries according to the model specification parameters of the gas flow meter.

[0026] Preferably, the step S12 comprises:

[0027] Step S121, aggregating and grouping the time series data according to time features to form multiple subsets;

[0028] Step S122, using the trapezoidal rule to perform time integration processing on each characteristic variable in the time series data, to obtain the cumulative changes of pressure, temperature and flow in different time windows;

[0029] Step S123, constructing a data structure including the cumulative changes of pressure, temperature and flow rate in each time window according to the time characteristics, and integrating all data structures to form the basic data set.

[0030] Preferably, in step S122, the calculation formula of the time integral is:

[0031]

[0032] Among them, I X represents the time integral estimated value of the characteristic variable X in the time series data, where the value of X is the pressure value p, the temperature value T, or the flow rate value f; Δt i represents the time interval, i represents the subset G (d,h) The i-th data point in G, i = 0, 2, ..., n-1, n represents the subset G (d,h) The total number of data points in .

[0033] Preferably, the step S13 comprises:

[0034] Step S131, performing feature dimension reduction on the features of the basic data set to obtain a feature set;

[0035] Step S132, training a distributed gradient enhancement model based on the feature set to determine the importance of each feature in the feature set;

[0036] Step S133, sorting the features in the feature set according to their importance, and screening out the key features according to the sorting results.

[0037] Preferably, the step S131 includes:

[0038] Perform statistics on the characteristics of the basic data set in different time windows to obtain summary data; and / or

[0039] Based on time window statistics and rolling time windows to capture characteristic trends, seasonal changes or outliers in the basic data set; and / or

[0040] Performing Fourier transform or wavelet transform on the features in the basic data set to capture frequency domain features; and / or

[0041] Autocorrelation and partial autocorrelation are calculated for the features in the basic data set.

[0042] Preferably, the hypothesis testing method adopts a single sample t-test method.

[0043] Preferably, step S4 comprises:

[0044] Determine whether the accumulated loss time exceeds a preset time threshold:

[0045] If yes, output the detection result indicating that the gas flow meter is abnormal;

[0046] If yes, then the detection result indicating that there is no abnormality in the gas flow meter is output.

[0047] The advantages or beneficial effects of the technical solution of the present invention are:

[0048] The present invention obtains the time series data of the gas flow meter, uses the pre-trained model to predict the flow, calculates the flow deviation between the observed flow and the predicted flow, and combines the hypothesis testing method to statistically calculate the cumulative loss time when the deviation exceeds the threshold, so as to efficiently and accurately automatically detect gas flow meter anomalies, quantify the metering deviation and cumulative loss, reduce manual intervention, improve detection efficiency and explainability, and can cope with the growing number of IoT gas flow meter devices and complex anomaly detection needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1A schematic diagram of a flow chart of a method for detecting abnormality of a gas flow meter in a preferred embodiment of the present invention;

[0050] Figure 2 This is a flow chart of step S1 in a preferred embodiment of the present invention;

[0051] Figure 3 This is a flow chart of step S11 in a preferred embodiment of the present invention;

[0052] Figure 4 This is a flow chart of step S12 in a preferred embodiment of the present invention;

[0053] Figure 5 This is a flow chart of step S13 in a preferred embodiment of the present invention;

[0054] Figure 6 FIG. 4 is a flow chart of step S4 in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0056] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0057] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.

[0058] In order to simplify the description, the present invention combines the two abnormal situations of dead meter and slow meter into one category, called "metering loss", and defines it as: observed flow F measured The actual flow rate F actual The difference F diff Greater than the threshold F th , and the cumulative loss time (or cumulative duration) within the preset time period (usually 24 hours) exceeds the preset time threshold t th .

[0059] See also Figure 1 In a preferred embodiment of the present invention, based on the above-mentioned problems existing in the prior art, a gas flow meter anomaly detection method based on machine learning is provided, which aims to perform anomaly detection of "metering loss" based on data-driven automation.

[0060] The gas flow meter abnormality method includes the following steps:

[0061] Step S1, obtaining time series data of the gas flow meter within a preset time period, and using a pre-trained prediction model to predict a predicted flow value corresponding to each observed flow value in the time series data;

[0062] The preset time period is preferably one day, i.e. 24 hours. However, in practical applications, it can be set to a longer or shorter time range according to actual application needs. For example, the preset time period can be set to one week or one month, etc.

[0063] Step S2, calculating the flow deviation between all observed flow values ​​and corresponding predicted flow values ​​within a preset time period;

[0064] Step S3, using a hypothesis test method to test the flow deviation, obtain a test result, and obtain the cumulative loss time during which the flow deviation is greater than a preset flow deviation threshold within a preset time period according to the test result;

[0065] Step S4, obtaining a detection result of whether the gas flow meter is abnormal according to the accumulated loss time.

[0066] Specifically, the traditional method based on manual observation cannot meet the needs of large-scale gas flow meter anomaly detection. In this embodiment, first, the time series data of the gas flow meter is obtained. The time span of the time series data is a preset time period, which is generally 24 hours. The time series data within 24 hours reflects the change state or degree of pressure, temperature and flow over time, including the flow data directly measured and recorded by the gas flow meter, which is recorded as the observed flow F measured .

[0067] Then, for the time series data within a given period of time, the prediction model is used to make predictions to obtain the predicted flow value corresponding to the actual flow at each time point.

[0068] Next, the flow deviation between all observed flow values ​​in the sequence and the corresponding predicted flow values ​​is calculated. Specifically, for the data at each time point in a given period of time, the observed flow F is calculated. measured and the predicted flow F estimated The difference between error quantitative indicators.

[0069] Then, the flow deviation is tested using the hypothesis test method. In this embodiment, the t-test method is used to calculate the flow deviation F error When the p-value is less than the set significance level α (such as 0.05), it is determined that there is a credible measurement deviation F in the calculation period. diffFurthermore, the measurement deviation F in a preset time period (such as 24 hours) is counted. diff Greater than the preset threshold F th The cumulative duration, i.e. the cumulative loss time t loss .

[0070] Finally, according to the cumulative loss time t loss Determine whether the gas flow meter has "metering loss" abnormality. Specifically, when the cumulative loss time t loss Exceeding the preset time threshold t th When the gas flow meter is abnormal, it is determined that there is a "metering loss"

[0071] The method of the embodiment of the present invention can efficiently and accurately detect the abnormality of the gas flow meter and quantify the measurement deviation F. diff and the cumulative loss time t loss , reducing manual intervention, improving detection efficiency, and providing highly interpretable detection results, which can cope with the growing number of IoT gas flow meter devices and complex anomaly detection needs.

[0072] As a preferred implementation, in step S1, the training step of the prediction model includes:

[0073] Step S11, acquiring time series data sampled from a calibrated gas flow meter;

[0074] Step S12, performing time integration processing on the time series data to extract low-frequency features in the time series data as a basic data set;

[0075] Step S13, applying a machine learning algorithm to perform data feature mining analysis, extracting key features in the basic data set as a training data set;

[0076] Among them, the machine learning algorithm is the distributed gradient boosting XGBoost algorithm.

[0077] Step S14, performing model training according to the training data set to obtain a prediction model.

[0078] Specifically, in the model training step, first, time series data is collected from a calibrated gas flow meter, including but not limited to key parameters such as temperature, pressure and flow. Since the flow meter has been calibrated, the collected data has high accuracy and reliability, and can serve as an important basis for evaluating the gas flow status.

[0079] Next, the collected time series data is processed by time integration to extract low-frequency features in the data, which usually reflect the long-term trend and stability of gas flow. Through time integration, high-frequency noise can be filtered out and low-frequency information useful for predictive model construction can be retained. The processed data will constitute the basic data set and provide raw materials for subsequent feature mining.

[0080] Then, based on the basic data set, the XGBoost algorithm is applied to perform data feature mining and analysis to extract variables that have a significant impact on the predicted target (such as gas flow) as key features.

[0081] Finally, the prediction model is trained using the training data set obtained through feature mining analysis. Preferably, the prediction model can be constructed based on the XGBoost algorithm, and the model can be iteratively optimized using the training data set, and the model parameters (such as learning rate, maximum number of iterations, etc.) and feature combinations are continuously adjusted to gradually improve the prediction accuracy and generalization ability of the model.

[0082] As a preferred embodiment, step S11 includes:

[0083] Step S111, screening the acquired time series data according to preset upper and lower boundaries to eliminate invalid data;

[0084] Step S112, filtering outliers in the time series data.

[0085] Specifically, in this embodiment, the data screening step is used to ensure the accuracy and validity of the data set, improve the data quality, and thus ensure the accuracy and reliability of the model.

[0086] The data screening step includes the removal of invalid data and outliers.

[0087] The invalid data can be filtered out based on the upper and lower boundaries of the data. These boundary values ​​are based on the flow meter's range, accuracy, and actual working environment. In the specific implementation process, the acquired time series data is compared with the preset upper and lower boundaries. For data outside the boundary range, it is regarded as invalid data and is eliminated to remove abnormal data caused by metering equipment failure, data transmission errors, or environmental factors.

[0088] Outliers refer to data that are significantly different from most data points, which may be caused by measurement errors, data entry errors, or other reasons. Therefore, it is necessary to further remove outliers in time series data.

[0089] During the specific implementation, the interquartile range (IQR) method can be used to screen out outliers.

[0090] The IQR method is a commonly used statistical method to determine the degree of dispersion of data and identify potential outliers.

[0091] The screening steps of the IQR method include:

[0092] First, the quartiles of the time series data, namely the first quartile (Q1) and the third quartile (Q3), are calculated.

[0093] Then, the IQR value was calculated, which was the difference between the first quartile (Q1) and the third quartile (Q3).

[0094] Next, a threshold is set, usually a multiple of IQR (such as 1.5 or 3 times), to determine whether a data point is an outlier. For any data point, if it is less than Q1 minus 1.5 times IQR or greater than Q3 plus 1.5 times IQR (or other set multiples), it is considered an outlier and removed.

[0095] As a preferred implementation, in step S111, percentage thresholds of the maximum range are set as preset upper and lower boundaries according to the model and specification parameters of the gas flow meter.

[0096] Specifically, in this embodiment, according to the model and specification parameters of the gas flow meter, data with relatively small flow rates are eliminated according to a percentage threshold of the maximum range to reduce data redundancy.

[0097] As an example, assume that the maximum range of the gas flow meter is R max , usually R min If the percentage threshold is 1%, the traffic exceeding (1-1%) R will be eliminated. max The data for each data point in the range.

[0098] As a preferred embodiment, step S12 includes:

[0099] Step S121, aggregate and group the time series data according to the time characteristics to form multiple subsets G (d,h) ;

[0100] Step S122, using the trapezoidal rule to perform time integration processing on each characteristic variable in the time series data, to obtain the cumulative changes of pressure, temperature and flow in different time windows;

[0101] Step S123, constructing a data structure including the cumulative changes of pressure, temperature and flow rate in each time window according to the time characteristics, and integrating all data structures to form a basic data set.

[0102] Specifically, in this embodiment, the features in the time series data are extracted using time integration, which specifically includes the following steps:

[0103] First, extract the time features, which include hour h and date d. Specifically, let t be the time column in the data, and convert each timestamp in the time column into an operable date and time format. For each row in the time series data, extract the hour h and date d:

[0104] Next, according to each unique combination of hour h and date d, the data is grouped into multiple subsets G for which the integral is calculated (d,h) . Each subset G (d,h) Contains all data points within a specific day d and hour h.

[0105] For each subset G (d,h) , defined as containing n data points (t i , p i , T i , f i ).

[0106] Among them, t i Represents the subset G (d,h) The timestamp of the i-th point in the

[0107] p i Indicates time t i The pressure value at

[0108] T i Indicates time t i The temperature value at

[0109] f i Indicates time t i The flow velocity value at .

[0110] Then, for the data in a given hour (ie, a set of data), the time interval from each data point to the initial time in the hour is calculated, and the trapezoidal rule is used to numerically integrate multiple variables X of the time series.

[0111] As a preferred implementation, in step S122, the calculation formula of the time integral is:

[0112]

[0113] Among them, I X It represents the estimated time integral of the characteristic variable X in the time series data, where X is the pressure value p, the temperature value T, or the flow rate value f; Δt i represents the time interval, i represents the subset G (d,h)The i-th data point in G, i = 0, 2, ..., n-1, n represents the subset G (d,h) The total number of data points in .

[0114] Calculate the time interval Δt in seconds i =t i+1 -t i . Apply the trapezoidal rule to the variable X of the time series data row by row, where X is p or T or f, and finally get the estimated value I of the time integral of the corresponding variable P ,I T ,I F .

[0115] For example, the subset G (d,h) An estimate of the time integral of the upper pressure can be expressed as:

[0116]

[0117] Subset G (d,h) An estimate of the time integral of the upper temperature can be expressed as:

[0118]

[0119] Subset G (d,h) An estimate of the time integral of the flow velocity can be expressed as:

[0120]

[0121] After performing the integration for each hour group, the function compiles a graph with the integrated value I for each hour h and day d. P ,I T and I F The data structure:

[0122] Output DataFrame:{(d,h,I P ,I T ,I F )}

[0123] The resulting DataFrame contains comprehensive indicators for each hour, recording the cumulative changes in pressure, temperature, and flow at different time intervals.

[0124] As a preferred embodiment, step S13 includes:

[0125] Step S131, performing feature dimension reduction on the features of the basic data set to obtain a feature set;

[0126] Among them, the XGBoost algorithm is used to perform data feature mining and analysis on the gas flow meter to achieve feature dimension reduction. XGBoost is an efficient gradient boosting algorithm that can build a strong classifier by learning a combination of multiple weak classifiers and automatically perform feature selection and weight adjustment during the training process.

[0127] In step S131, the basic data set may be subjected to dimensionality reduction processing in the following manner to extract richer features.

[0128] The features of the basic data set are counted in different time windows to obtain summary data. For example, each feature is statistically summarized in different time windows (such as hourly, daily, and weekly), such as calculating the average, minimum, maximum, standard deviation and other statistics to reflect the changing trend and distribution of the features in different time periods.

[0129] Based on time window statistics and rolling time windows, we can capture the characteristic trends, seasonal changes or outliers in the basic data set. For example, based on the results of time window statistics, we can further introduce rolling time windows (such as lag values ​​and rolling statistics) to gain a deeper understanding of the evolution of features over time.

[0130] Perform Fourier transform or wavelet transform on the features in the underlying dataset to capture frequency domain features. These features can highlight patterns such as cyclic behavior and transient characteristics, thus providing more comprehensive feature information.

[0131] Autocorrelations and partial autocorrelations are calculated for the features in the underlying dataset to understand the temporal dependency of the features in each series.

[0132] Step S132, training a distributed gradient enhancement model based on the feature set to determine the importance of each feature in the feature set;

[0133] Step S133, sorting the features in the feature set according to their importance, and selecting key features according to the sorting results.

[0134] Specifically, after completing feature dimensionality reduction, the XGBoost algorithm is used for feature selection.

[0135] Specifically, an XGBoost model is trained on the above feature set; after training, feature importance is extracted from the XGBoost model; and features are sorted by importance. The basis for sorting is the size of the feature importance score, and the higher the score, the greater the contribution of the feature to the prediction accuracy.

[0136] Finally, based on the sorting results, only the key features that contribute most to the prediction accuracy are retained. Specifically, a threshold can be set or the top N important features can be selected to construct the final feature set.

[0137] Finally, as a preferred implementation, the hypothesis testing method adopts a single sample t-test method.

[0138] Specifically, first, define the null hypothesis H 0 There is no measurement deviation in the flow meter;

[0139] Then, the hypothesis test adopts the single sample t test method, and its calculation formula is:

[0140]

[0141] The t statistic is a ratio comparing the difference between the sample mean and the population mean relative to the variability of the sample data;

[0142] mean(r V ) is r V The mean of the series;

[0143] std(r V ) is r V The standard deviation of the series;

[0144] E(r V ) is r V The expected value of the sequence;

[0145] n is r V The sequence length of the sequence.

[0146] Then, based on the value of the statistic t, determine the p-value.

[0147] Finally, compare the p-value and the significance level α, and determine whether to reject the null hypothesis H based on the comparison results. 0 :

[0148] When p≤α, a smaller p-value indicates that there is strong evidence against the null hypothesis, so the null hypothesis H is rejected. 0 .

[0149] When p>α, a larger p-value indicates that the evidence against the null hypothesis is weaker, so the null hypothesis H is accepted. 0 .

[0150] As a preferred embodiment, step S4 includes:

[0151] Determine whether the accumulated loss time exceeds the preset time threshold:

[0152] If yes, then the output gas flow meter has abnormal test results;

[0153] If , then there is no abnormal detection result of the output gas flow meter.

[0154] Specifically, in this embodiment, if the cumulative loss time t within 24 hours loss Exceeding the preset time threshold t th , it is judged that there is a "measurement loss" anomaly; otherwise, it is judged that there is no "measurement loss" anomaly.

[0155] The advantages or beneficial effects of adopting the above technical solution are: the present invention obtains the time series data of the gas flow meter, uses the pre-trained model to predict the flow, and calculates the flow deviation between the observed flow and the predicted flow, and combines the hypothesis testing method to statistically calculate the cumulative loss time when the deviation exceeds the threshold, thereby efficiently and accurately automatically detecting gas flow meter anomalies, quantifying metering deviations and cumulative losses, reducing manual intervention, improving detection efficiency and interpretability, and being able to cope with the growing number of IoT gas flow meter devices and complex anomaly detection needs.

[0156] The above are only preferred embodiments of the present invention, and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of this specification and illustrations should be included in the protection scope of the present invention.

Claims

1. A gas flow meter anomaly detection method based on machine learning, characterized in that: include: Step S1, obtaining time series data of a gas flow meter within a preset time period, and using a pre-trained prediction model to predict a predicted flow value corresponding to each observed flow value in the time series data; Step S2, calculating the flow deviation between all the observed flow values ​​and the corresponding predicted flow values ​​within the preset time period; Step S3, using a hypothesis test method to test the flow deviation to obtain a test result, and statistically obtain the cumulative loss time during which the flow deviation is greater than a preset flow deviation threshold value within the preset time period according to the test result; Step S4, obtaining a detection result of whether the gas flow meter has an abnormality according to the accumulated loss time.

2. The gas flow meter abnormality detection method according to claim 1, characterized in that: In step S1, the training step of the prediction model includes: Step S11, acquiring time series data sampled from a calibrated gas flow meter; Step S12, performing time integration processing on the time series data to extract low-frequency features in the time series data as a basic data set; Step S13, applying a machine learning algorithm to perform data feature mining analysis, and extracting key features in the basic data set as a training data set; Step S14: performing model training according to the training data set to obtain the prediction model.

3. The gas flow meter abnormality detection method according to claim 2, characterized in that: The step S11 comprises: Step S111, screening the acquired time series data according to preset upper and lower boundaries to eliminate invalid data; Step S112, filtering outliers in the time series data.

4. The gas flow meter abnormality detection method according to claim 3, characterized in that: In the step S111, according to the model and specification parameters of the gas flow meter, a percentage threshold of the maximum range is set as the preset upper and lower boundaries.

5. The gas flow meter abnormality detection method according to claim 2, characterized in that: The step S12 comprises: Step S121, aggregating and grouping the time series data according to time features to form multiple subsets; Step S122, using the trapezoidal rule to perform time integration processing on each characteristic variable in the time series data, to obtain the cumulative changes of pressure, temperature and flow in different time windows; Step S123, constructing a data structure including the cumulative changes of pressure, temperature and flow rate in each time window according to the time characteristics, and integrating all data structures to form the basic data set.

6. The gas flow meter abnormality detection method according to claim 5, characterized in that: In step S122, the calculation formula of the time integral is: Among them, I X represents the time integral estimated value of the characteristic variable X in the time series data, where the value of X is the pressure value p, the temperature value T, or the flow rate value f; Δt i represents the time interval, i represents the subset G (d,h) The i-th data point in G, i = 0, 2, ..., n-1, n represents the subset G (d,h) The total number of data points in .

7. The gas flow meter abnormality detection method according to claim 2, characterized in that: The step S13 comprises: Step S131, performing feature dimension reduction on the features of the basic data set to obtain a feature set; Step S132, training a distributed gradient enhancement model based on the feature set to determine the importance of each feature in the feature set; Step S133, sorting the features in the feature set according to their importance, and screening out the key features according to the sorting results.

8. The gas flow meter abnormality detection method according to claim 2, characterized in that: The step S131 includes: Perform statistics on the characteristics of the basic data set in different time windows to obtain summary data; and / or Based on time window statistics and rolling time windows to capture characteristic trends, seasonal changes or outliers in the basic data set; and / or Performing Fourier transform or wavelet transform on the features in the basic data set to capture frequency domain features; and / or Autocorrelation and partial autocorrelation are calculated for the features in the basic data set.

9. The gas flow meter abnormality detection method according to claim 1, characterized in that: The hypothesis testing method adopts the single sample t test method.

10. The gas flow meter abnormality detection method according to claim 1, characterized in that: The step S4 comprises: Determine whether the accumulated loss time exceeds a preset time threshold: If yes, output the detection result indicating that the gas flow meter is abnormal; If yes, then the detection result indicating that there is no abnormality in the gas flow meter is output.

Citation Information

Cited By

  • Pressure gauge temperature data processing method based on temperature verification drift error compensation

    CN120372233A

  • Temperature data processing method of pressure gauge based on temperature calibration drift error compensation

    CN120372233B

  • Detection and diagnosis method and system for mass flow controller

    CN122194963A

  • A detection and diagnostic method and system for a mass flow controller

    CN122194963B