A gas leakage prediction method and system based on gas consumption data of a gas meter
By combining a time-series coding model and a gradient boosting tree model, and by utilizing users' historical habits and business rules, the problem of high false alarm rate in smart gas meters was solved, enabling accurate prediction and interpretable analysis of gas leaks.
Patent Information
- Application Number
- CN202611371326.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-04
- Publication Date
- 2026-11-24
AI Technical Summary
Existing methods for predicting leaks in smart gas meters rely on fixed threshold alarms, which makes it difficult to distinguish between normal behavior and leaks, resulting in a high false alarm rate and an inability to adapt to individual differences among users and data quality issues.
A dual-branch fusion method based on gas meter usage data is adopted, combining a time-series coding model and a gradient boosting tree model. By utilizing users' historical habits and business rules, the probability and risk level of gas leakage are generated. Fusion decisions are then made through rule confidence and data quality control.
It reduces false alarms caused by wall-hung boilers and prolonged cooking, preserves the morphological characteristics of gas usage curves, lowers threshold judgment jumps, and improves the accuracy and interpretability of gas leak identification.
Smart Images

Figure CN123158535A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary fields of intelligent gas safety monitoring, IoT metering data processing, and machine learning. Specifically, it relates to a method and system for predicting indoor gas leakage risk based on the dual-branch fusion of micro-flow and constant-flow data from intelligent gas meters. Background Technology
[0002] Smart gas meters can report cumulative gas consumption, incremental gas consumption, valve status, and alarm information at fixed time granularities. Existing platforms mostly rely on fixed threshold alarm methods, meaning an alarm is triggered whenever low flow persists or continuous gas consumption reaches a set duration. This approach easily misidentifies normal activities such as boiler insulation, constant-temperature water heaters, and cooking (like boiling water or porridge) as leaks. Furthermore, significant differences exist between users' equipment, seasons, lifestyles, and data quality, making it difficult to balance false alarm and false alarm rates with a single threshold.
[0003] The current business rules are as follows: After a micro-flow alarm, review the gas consumption from 0:00 to 4:00 in the previous week. If there are records of zero gas consumption in the historical period, it is considered that the user has a complete gas outage, and the current continuous micro-flow is more likely to be abnormal; if there is always gas consumption, it is more likely that the equipment is operating normally. After a constant current alarm, review the gas consumption of the previous 15 days. If there is gas consumption for all 24 hours, it is considered normal; if the historical single gas consumption is less than 4 hours, the current constant current is considered abnormal; if there is a history of long gas consumption of more than 4 hours, compare the current hourly gas consumption with the historical long gas consumption. If the deviation is no more than 30%, it tends to be normal; if it exceeds 30%, it tends to be abnormal.
[0004] Directly solidifying the above rules still has problems such as sudden changes in threshold boundaries, sensitivity to missing data, inability to utilize complete curve shapes, and insufficient individual adaptation. There is an urgent need for a fusion scheme that can both retain the explanatory power of the rules and learn complex patterns from historical samples. Summary of the Invention
[0005] The present invention provides a gas leakage prediction method and system based on gas meter usage data, which can predict gas leaks by taking users’ historical habits as a benchmark, combining time-series morphology and structural statistical characteristics and being subject to business rules, and can at least solve one of the above-mentioned technical problems.
[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A gas leak prediction method based on gas meter usage data includes the following steps: S1. Obtain the alarm event corresponding to the target gas meter, the gas consumption sequence of the current alarm window, and the historical reference window gas consumption sequence before the alarm event; S2. Perform time alignment, missing labeling, and anomaly handling on the gas consumption sequence. Input the processed gas consumption sequence into the time-series coding model. The time-series coding model extracts the continuity, periodicity, and mutation features and outputs the first leakage risk score. S3. Construct a structured feature vector based on the historical benchmark window, including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption, and input it into the gradient boosting tree model to obtain the second leakage risk score. S4. Execute the corresponding business rules according to the alarm type to obtain the rule status, rule confidence and gating constraints, and merge them with the first leakage risk score and the second leakage risk score to obtain the gas leakage probability, risk level, handling instructions and explainable cause code.
[0007] Furthermore, in S4, when the alarm type is a micro-flow alarm, the historical reference window includes preset nighttime periods for multiple natural days prior to the alarm. It determines whether there are valid zero-gas sampling points in the preset nighttime periods for these multiple natural days, and generates a rule judgment value based on the zero-gas existence flag, zero-gas ratio, longest continuous zero-gas duration, and effective coverage of the valid zero-gas sampling points.
[0008] Furthermore, under the microflow alarm state, multiple natural days are set to 7 days, and the preset nighttime period is set to 0:00 to 4:00 every day. When there is a valid zero gas consumption sampling point, an abnormal prior is generated. When there is no valid zero gas consumption sampling point and the continuous gas consumption mode meets the stability threshold, a normal prior is generated.
[0009] Furthermore, in S4, when the alarm type is a constant current alarm, the historical reference window includes the gas consumption sequence of the 15 days prior to the alarm, divides the continuous gas consumption segment based on the gas consumption threshold, and determines the continuous gas consumption status throughout the day, the set of historical long-term gas consumption segments, and the regularity of historical short-term gas consumption.
[0010] Furthermore, under constant current alarm status, when the historical gas consumption is continuous throughout the day, a normal prior is generated; when there are no historical periods exceeding the long-term threshold and short-term gas consumption is regular, an abnormal prior is generated; when there are historical periods exceeding the long-term threshold, the deviation rate between the current hourly gas consumption and the historical reference hourly gas consumption is calculated, and a judgment value is generated according to the deviation threshold.
[0011] Furthermore, under constant current alarm status, the long-term threshold is 4 hours, the deviation threshold is 30%, and the historical reference hourly gas consumption is the median of the hourly gas consumption of historical long-term gas consumption segments that match the current alarm segment in at least one of the following: time location, season, or duration.
[0012] Furthermore, in S2, the time-series coding model is LSTM, GRU, TCN and / or Transformer, and the data input to the time-series coding model also includes a missing mask, time interval, hourly cycle coding and / or weekly cycle coding.
[0013] Furthermore, in S4, the gating constraint includes: when the first leakage risk score or the second leakage risk score reaches a high-risk threshold, the risk level below the preset rule confidence level is reduced to the no-push level; The fusion weight is determined based on the alarm type, data quality, or rule confidence. When the time-series coding model or gradient boosting tree model conflicts with the business rules or the rule confidence is lower than the threshold, manual review is required.
[0014] Furthermore, the results of on-site verification, outbound call review, or work order processing are correlated with alarms to form training samples, and the temporal coding model, gradient boosting tree model, fusion weights, and / or rule parameters are updated based on the training samples.
[0015] A gas leak prediction system based on gas meter usage data, applicable to the gas leak prediction method based on gas meter usage data, includes: The data acquisition and preprocessing module is used to acquire the incremental gas consumption, timestamp, alarm type, equipment status and historical data of the target gas meter, and perform preprocessing such as time alignment, missing data marking and anomaly handling to obtain standardized, multi-scale gas consumption data. The time series prediction module is connected to the data acquisition and preprocessing module. It encodes standardized, multi-scale gas consumption data based on the time series coding model, extracts continuous, periodic and abrupt features, and outputs the first leakage risk score. The structured prediction module is connected to the data acquisition and preprocessing module. It constructs a structured feature vector including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption. The vector is input into the gradient boosting tree model and outputs a second leakage risk score. The rule prior module, which is integrated with the first leakage risk score and the second leakage risk score, is used to execute business rules corresponding to micro-flows and / or constant flows, and generate rule conclusions, confidence levels and interpretable reason codes. The fusion decision module, connected to the rule prior module, is used to combine the temporal risk score, structural risk score, and rule prior, and sequentially perform gating fusion, probability calibration, and conflict detection to form the final prediction result.
[0016] Compared with the prior art, the advantages of this invention are as follows: 1. Use users' own historical habits as a dynamic baseline to reduce false alarms caused by wall-hung boilers, water heaters, and prolonged cooking; 2. Temporal branches preserve the curve shape, while structural branches provide interpretable feature contributions; 3. The rule is a calibrable prior rather than a single hard-coded rule, reducing decision jumps near the threshold; 4. Improve high-risk recall through cost-sensitive training and security gating, and output reason codes to support closed-loop review. Attached Figure Description
[0017] The accompanying drawings, which are provided to further illustrate this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application.
[0018] Figure 1 This is a schematic diagram of the dual-branch and rule-based prior fusion architecture of the gas leak prediction system based on gas meter usage data according to an embodiment of the present invention.
[0019] Figure 2 This is a schematic diagram of the overall process of the gas leak prediction method based on gas meter usage data according to an embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram of the prior generation process of micro-flow alarm rules in an embodiment of the present invention.
[0021] Figure 4 This is a schematic diagram of the constant current alarm layering determination and deviation rate calculation process according to an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] It should be noted that the meaning of "and / or" throughout the text includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or a solution that simultaneously satisfies A and B. Furthermore, "multiple" refers to two or more. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0024] This invention also provides a gas leak prediction system based on gas meter usage data, such as... Figure 1The diagram shown illustrates a dual-branch and rule-based prior fusion architecture, including: The data acquisition and preprocessing module is used to acquire the incremental gas consumption, timestamp, alarm type, equipment status and historical data of the target gas meter, and perform preprocessing such as time alignment, missing data marking and anomaly handling to obtain standardized, multi-scale gas consumption data. The time series prediction module is connected to the data acquisition and preprocessing module. It encodes standardized, multi-scale gas consumption data based on the time series coding model, extracts continuous, periodic and abrupt features, and outputs the first leakage risk score. The structured prediction module is connected to the data acquisition and preprocessing module. It constructs a structured feature vector including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption. The vector is input into the gradient boosting tree model and outputs a second leakage risk score. The rule prior module, which is integrated with the first leakage risk score and the second leakage risk score, is used to execute business rules corresponding to micro-flows and / or constant flows, and generate rule conclusions, confidence levels and interpretable reason codes. The fusion decision module, connected to the rule prior module, is used to combine the temporal risk score, structural risk score, and rule prior, and sequentially perform gating fusion, probability calibration, and conflict detection to form the final prediction result.
[0025] like Figure 2 As shown, this embodiment of the invention also provides a gas leak prediction method based on gas meter usage data, implemented based on the gas leak prediction system based on gas meter usage data, including the following steps: S1. Obtain the alarm event corresponding to the target gas meter, the gas consumption sequence of the current alarm window, and the historical reference window gas consumption sequence before the alarm event; S2. Perform time alignment, missing labeling, and anomaly handling on the gas consumption sequence. Input the processed gas consumption sequence into the time-series coding model. The time-series coding model extracts the continuity, periodicity, and mutation features and outputs the first leakage risk score. S3. Construct a structured feature vector based on the historical benchmark window, including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption, and input it into the gradient boosting tree model to obtain the second leakage risk score. S4. Execute the corresponding business rules according to the alarm type to obtain the rule status, rule confidence and gating constraints, and merge them with the first leakage risk score and the second leakage risk score to obtain the gas leakage probability, risk level, handling instructions and explainable cause code.
[0026] In this embodiment, as Figure 3The diagram shows the prior generation process of the microflow alarm rule. In step S4, when the alarm type is a microflow alarm, the historical reference window includes preset nighttime periods for multiple natural days before the alarm. It determines whether there are valid zero-gas sampling points in the preset nighttime periods of these multiple natural days, and generates rule judgment values based on the zero-gas existence flag, zero-gas ratio, longest continuous zero-gas duration, and effective coverage of the valid zero-gas sampling points.
[0027] In the state of microflow alarm, multiple natural days are set to 7 days, the preset nighttime period is set to 0:00 to 4:00 every day, when there is a valid zero gas consumption sampling point, an abnormal prior is generated, and when there is no valid zero gas consumption sampling point and the continuous gas consumption mode meets the stability threshold, a normal prior is generated.
[0028] In this embodiment, as Figure 4 The diagram shows the process of determining the stratification of constant current alarms and calculating the deviation rate. In step S4, when the alarm type is a constant current alarm, the historical reference window includes the gas consumption sequence of the 15 days before the alarm, divides the continuous gas consumption segment based on the gas consumption threshold, and determines the continuous gas consumption status throughout the day, the set of historical long-term gas consumption segments, and the regularity of historical short-term gas consumption.
[0029] Under constant current alarm status, if the historical gas consumption is continuous throughout the day, a normal prior is generated. If there are no historical periods exceeding the long-term threshold and short-term gas consumption is regular, an abnormal prior is generated. If there are historical periods exceeding the long-term threshold, the deviation rate between the current hourly gas consumption and the historical reference hourly gas consumption is calculated, and a judgment value is generated according to the deviation threshold.
[0030] Under constant current alarm status, the long-term threshold is 4 hours, the deviation threshold is 30%, and the historical reference hourly gas consumption is the median of the hourly gas consumption of historical long-term gas consumption segments that match the current alarm segment in at least one of the following: time location, season, or duration.
[0031] In this embodiment, in step S2, the time-series coding model is LSTM, GRU, TCN and / or Transformer, and the data input to the time-series coding model also includes a missing mask, time interval, hourly cycle coding and / or weekly cycle coding.
[0032] In this embodiment, in step S4, the gating constraint includes: when the first leakage risk score or the second leakage risk score reaches a high-risk threshold, the risk level below the preset rule confidence level is reduced to the no-push level; The fusion weight is determined based on the alarm type, data quality, or rule confidence. When the time-series coding model or gradient boosting tree model conflicts with the business rules or the rule confidence is lower than the threshold, manual review is required.
[0033] In this embodiment, the results of on-site verification, outbound call review, or work order processing are associated with alarms to form training samples, and the temporal coding model, gradient boosting tree model, fusion weights, and / or rule parameters are updated based on the training samples.
[0034] To further verify the feasibility and superiority of this system and method, the present invention is analyzed in conjunction with the following practical application case.
[0035] It should be noted that in this practical application case, the following 7 days, 15 days, 0-4 hours, 4 hours and 30% are preferred configurable parameters, which can be adjusted according to phenotype, region, season, user type or validation set results, and do not constitute a limitation on the scope of protection.
[0036] Step 1: Data Definition and Preprocessing Let x_t be the incremental gas consumption at time point t, and Δt be the sampling interval. For alarm event a, construct the current alarm window W_a, the short-term historical window W_7, and the long-term historical window W_15. W_7 preferably covers 0:00–4:00 daily for the 7 days prior to the alarm, and W_15 preferably covers the entire 15 days prior to the alarm. Accumulated meter readings are first differentially analyzed between adjacent values; in cases of meter replacement, callback, or communication anomalies, data is segmented according to device events to avoid spurious negative values or spurious peak values.
[0037] Preprocessing includes uniform grid resampling, distinguishing between real zero gas consumption and unreported missing gas, short gap interpolation, long gap missing masking, isolated spike processing, and normalization by phenotypic range or user robust statistics.
[0038] Step 2: Microflow Rules and Characteristics Considering the gas meter resolution ε, sampling points where x_t≤ε and the data is valid are defined as zero gas consumption points. The following are extracted: zero-value existence flag I_zero, zero-value proportion r_zero, longest continuous zero gas consumption duration L_zero, number of non-zero nights, nighttime mean, and nighttime coefficient of variation: I_zero = 1( t∈W_7, x_t≤ε) r_zero = Σ1(x_t≤ε) / N_valid Where N_valid is the number of valid sample points in window W_7; When data coverage reaches the threshold and I_zero=1, a prior of "suspected anomaly in small flow" is generated; when I_zero=0 and the nighttime continuous gas consumption pattern is stable, a prior of "normal continuous gas consumption" is generated. If coverage is insufficient, no hard judgment is made; only the rule confidence is reduced to avoid mistaking missing records for zero gas consumption.
[0039] Step 3: Constant Current Rules and Characteristics Divide W_15 into continuous gas consumption segments S_k based on x_t>ε, and calculate the duration d_k, average hourly gas consumption q_k, start and end times, and daily cycle position. Construct the total number of gas consumption days D_24, the longest continuous duration L_on, the set of historical segments exceeding 4 hours H, the short-term regularity score R_period, and the current hourly gas consumption q_a.
[0040] Continuous gas consumption throughout the day can be considered as achieving a coverage rate of 95%-100%, tolerating minor communication gaps. If there is no historical period exceeding T_long and short-term gas consumption is regular, an anomalous prior of "current constant current deviates from short-term habits" is generated; T_long is preferably 4 hours. If H is not empty, the median hourly gas consumption q_ref of historical periods similar to the current time period, season, or duration is taken, and the deviation rate is calculated. δ : δ = |q_a q_ref| / max(q_ref, ε_q) × 100% Where ε_q is a positive stable term set to prevent the denominator from being zero; When δ≤θ_dev, a normal prior is generated that is "consistent with historical long-term gas usage"; when δ>θ_dev, an abnormal prior is generated that is "deviation from historical long-term habits". θ_dev is the deviation rate threshold, preferably 30%.
[0041] Step 4: Timing Model Branch The current and historical multi-scale sequences are organized as X_seq∈R^(B×T×F), where B is the batch size, T is the number of time steps in the sequence, and F is the feature dimension of each time step, which includes at least the incremental gas consumption, time interval, missing mask, hour code, and weekday code. The time encoder can use a two-layer LSTM and take the last valid time step or attention pooling vector h_t, which is then passed through a fully connected layer and a sigmoid function to obtain the first risk score p_t. The calculation expressions for both are as follows: h_t = Encoder(X_seq,M) p_t = σ(W_t h_t+b_t) Where M is the missing mask used to identify the validity of data at each time step, σ is the Sigmoid activation function, W_t is the weight matrix of the fully connected layer, and b_t is the bias term of the fully connected layer.
[0042] Step 5: XGBoost Structured Branch The structured vectors contain the features shown in Table 1 below. XGBoost fits the log odds of the leaked labels using multiple regression trees and handles missing values using the default orientation of the tree model.
[0043] Table 1. Structured Vector Feature Table
[0044] Step Six: Rule Confidence and Fusion The rules module outputs r∈{0,1,unknown} and confidence level c_r∈[0,1]. The confidence level is determined at least by data coverage, historical days, pattern stability, and the number of reference segments. No mandatory directional constraints are applied when the rule is unknown.
[0045] z=w_t p_t+w_s p_s+w_r c_r(2r 1)+w_q q+b p=σ(z) Where z is the linear output value of the fusion model, w_t is the fusion weight of the temporal risk score p_t, w_s is the fusion weight of the structural risk score, p_s is the second leakage risk score output by the XGBoost structured branch, w_r is the fusion weight of the rule prior, r is the rule decision value, c_r is the rule confidence, and w_q Let q be the transpose of the data quality feature weight vector, p be the final leakage probability, and b be the bias term.
[0046] The fusion unit can be logistic regression, a small multilayer perceptron, or a weighted function configured according to alarm type. To meet low false negative requirements, a safety gating system is implemented: if any model reaches a high-risk threshold and the data quality is acceptable, low-confidence normal rules are not allowed to be directly downgraded to invalid; when a model conflicts with a rule, the system outputs "Manual review required"; when coverage is insufficient, the system outputs "Insufficient data". The final probability is calibrated using Platt Scaling or ordinal-preserving regression.
[0047] Step 7: Training, Evaluation, and Closure Samples are obtained by correlating historical alarms, outbound calls, on-site safety inspections, repair work orders, and confirmed leak events. Positive samples include confirmed leaks, gas left on, or abnormal continuous gas usage; negative samples include wall-hung boilers, constant-temperature water heaters, and normal long-duration cooking. Training, validation, and test sets are segmented by user or gas meter identifier to prevent leaks caused by the same user's habits. Class weighting or focus loss is used to improve positive class recall; evaluation metrics include at least recall rate, precision, F1 score, PR-AUC, false alarms per 10,000 households, and calibration error. Manual handling conclusions are fed back into the sample database, and the model and thresholds are periodically updated.
[0048] Step 8: Output and Business Processing The output should include at least the alarm ID, gas meter ID, leakage probability, risk level, reason code, main contributing characteristics, data quality, and suggested actions. High-risk alarms will be pushed to the CIS and trigger outbound calls or on-site verification; normal, routine alarms will not be pushed but audit records will be retained. The relevant reason codes, their meanings, and corresponding suggested actions are shown in Table 2 below.
[0049] Table 2. Reason Code, Meaning, and Corresponding Suggested Action Table
[0050] Step Nine: Experimental Verification and Data Evidence It should be noted that the following data is used to demonstrate the verification method, evidence chain and expected improvement trend of the present invention. It is publicly available, non-confidential example data and does not correspond to any specific gas company, region or user.
[0051] 1. Dataset composition and annotation basis In a set of exemplary offline experiments, 12,480 gas meter alarm records generated over a consecutive 12-month period were selected, as shown in Table 3 below. Among them, 7,360 were micro-current alarms and 5,120 were constant current alarms. Each alarm was associated with the historical gas consumption sequence before the alarm, the gas consumption sequence during the alarm period, equipment attributes, and subsequent handling results. The final label was formed by outbound call verification, on-site safety inspection, maintenance work order, or leak confirmation records; records with only system alarms but no handling evidence were not used as samples for determining labels.
[0052] Table 3. Gas Meter Alarm Record Form
[0053] Data is partitioned mutually exclusively by gas meter number, with the training, validation, and test sets in a 70%:15%:15% ratio to ensure that the same user's gas usage habits do not appear in both the training and test sets simultaneously. The test set contains approximately 1,872 records, of which about 417 are anomalous. All models use the same test set, the same labeling, and the same alarm time cutoff point to avoid data leakage caused by using information after the alarm occurs.
[0054] 2. Comparative Experiment Four comparison schemes were set up: A is the existing business expert rules; B is XGBoost using only structured features; C is LSTM using only time series; and D is the "time series branch + XGBoost branch + rule prior gating fusion" of the present invention. On the example test set, with "abnormal alarm" as the positive class, the results are shown in Table 4 below.
[0055] Table 4. Comparison of Multi-Indicator Evaluation of Different Schemes
[0056] As the example results show, compared with expert rules, the present invention improves the anomaly recall rate by 15.0 percentage points, the F1 score by 14.7 percentage points, and the number of false alarms per 10,000 alarms decreases from 412 to 168, a reduction of approximately 59.2%. Compared with XGBoost alone, the present invention improves the F1 score by 8.4 percentage points; compared with LSTM alone, the present invention improves the F1 score by 6.2 percentage points, indicating that the temporal pattern, structural features, and rule priors are complementary.
[0057] 3. Verification by alarm type To verify the adaptability of the scheme to different expert rules, the test set was statistically analyzed separately for microcurrent and constant current. The statistical results are shown in Table 5 below.
[0058] Table 5. Comparison of Multi-Indicator Evaluation for Different Alarm Types
[0059] As shown in the table above, the improvement in the micro-flow scenario mainly comes from the differentiation of "true zero value, missing and unreported, and short-term jitter"; the improvement in the constant flow scenario mainly comes from the joint identification of continuous operation of the wall-hung boiler, regular short-term gas consumption, and abnormal flow deviation.
[0060] 4. Ablation test To demonstrate the contribution of each component to the final effect of the invention, one module was removed sequentially while maintaining consistency in the training data and threshold. The experimental results are shown in Table 6 below.
[0061] Table 6. Comparison of Multi-Indicator Evaluation for Different Experimental Configurations
[0062] The ablation results show that XGBoost contributes the most to the nonlinear interaction between structural rule features and user profiles. The time series model can supplement persistence, mutation and periodic patterns. Rule priors can improve the stability of small samples and boundary scenarios. However, if hard rules are directly applied to the model, it will cause a significant performance degradation in threshold boundary samples. Therefore, this invention adopts soft fusion with confidence and security gating.
[0063] 5. Threshold sensitivity experiment For the historical hourly gas consumption deviation threshold θ_dev in the constant flow scenario, exemplary sensitivity analyses were performed with thresholds of 20%, 30%, and 40%. The analysis results are shown in Table 7 below.
[0064] Table 7. Comparison of Multi-Indicator Evaluations with Different Deviation Thresholds
[0065] The example results indicate that 30% is a relatively good compromise on this dataset, but this invention does not limit it to a fixed constant. In practical deployments, a threshold in the range of 20%–40% can be selected based on season, phenotype, user category, or risk-cost function, or the deviation rate can be directly used as a continuous feature for the fusion model to learn.
[0066] 6. Evidence from data characteristic monitoring This invention not only outputs the final category but also retains the key data characteristics that form the judgment. As shown in Table 8 below, four anonymized example records are given, demonstrating the correspondence between the original monitoring data, rule evidence, model scores, and the final result.
[0067] Table 8. Comparison of Data Characteristics of Different Monitoring Samples
[0068] Taking sample M-001 as an example, there is a clear period of complete gas outage in the historical window, while the current alarm window continuously generates non-zero microflows during the same nighttime period; the time-series branch detects the morphological change of "not returning to zero when it should have," while the structural branch simultaneously identifies a high proportion of zero values and a long historical gas outage duration, with both types of evidence pointing in the same direction. Although sample M-002 has microflows, it has maintained low-fluctuation continuous gas usage for a long period of historical nighttimes, and both the model and rules tend to be normal. This comparison shows that observing only the current flow rate is insufficient to distinguish leaks; it is necessary to compare the current curve with the user's own historical gas outage capacity and periodic patterns.
[0069] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the gas leak prediction method based on gas meter usage data described above.
[0070] This invention also provides a computer device, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the gas leak prediction method based on gas meter usage data described above.
[0071] This invention also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps of the gas leak prediction method based on gas meter usage data described above.
[0072] It is understood that the systems, devices and storage media provided in the embodiments of the present invention correspond to the methods provided in the embodiments of the present invention, and the explanations, examples and beneficial effects of the relevant contents can be referred to the corresponding parts of the above-mentioned gas leakage prediction method based on gas meter gas consumption data.
[0073] It should be noted that those skilled in the art will understand that all or part of the steps implemented in the embodiments of the present invention can be implemented entirely or partially by software, hardware, firmware, or any combination thereof. When implemented in hardware, it can be implemented entirely or partially by purchasing standard parts or modifications. When implemented in software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid state disks (SSDs)).
[0074] In summary, this invention addresses the problems of high false alarm rates, weak generalization of fixed rules, difficulty in interpreting pure machine learning results, and high costs associated with missed alarms in safety scenarios associated with existing smart gas meters. It provides a method and system for predicting indoor gas leak risks based on a dual-branch fusion of smart gas meter micro-flow and constant current data. This method forms a leak prediction approach that uses users' historical habits as a benchmark, combines temporal morphology and structural statistical features, and is constrained by business rules. Specifically, this method combines complete temporal usage data from smart gas meters, XGBoost structured learning, and business rules, upgrading micro-flow and constant current alarms from fixed thresholds to probabilistic predictions based on individual user habits. Simultaneously, through rule confidence, data quality control, deviation rate comparison, and safety gating, it improves the ability to identify complex scenarios while preserving interpretability. This method is suitable for large-scale alarm noise reduction, leak screening, and CIS closed-loop handling in gas companies.
[0075] It should be understood that the examples and embodiments described herein are for illustrative purposes only and are not intended to limit the invention. Those skilled in the art can make various modifications or changes based on them. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.
Claims
1. A gas leak prediction method based on gas meter usage data, characterized in that, Includes the following steps: S1. Obtain the alarm event corresponding to the target gas meter, the gas consumption sequence of the current alarm window, and the historical reference window gas consumption sequence before the alarm event; S2. Perform time alignment, missing labeling, and anomaly handling on the gas consumption sequence. Input the processed gas consumption sequence into the time-series coding model. The time-series coding model extracts the continuity, periodicity, and mutation features and outputs the first leakage risk score. S3. Construct a structured feature vector based on the historical benchmark window, including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption, and input it into the gradient boosting tree model to obtain the second leakage risk score. S4. Execute the corresponding business rules according to the alarm type to obtain the rule status, rule confidence and gating constraints, and merge them with the first leakage risk score and the second leakage risk score to obtain the gas leakage probability, risk level, handling instructions and explainable cause code.
2. The gas leak prediction method based on gas meter usage data as described in claim 1, characterized in that, In S4, when the alarm type is a micro-flow alarm, the historical reference window includes preset nighttime periods for multiple natural days prior to the alarm. It determines whether there are valid zero-gas sampling points in the preset nighttime periods for these multiple natural days, and generates rule judgment values based on the zero-gas existence flag, zero-gas ratio, longest continuous zero-gas duration, and effective coverage of the valid zero-gas sampling points.
3. The gas leak prediction method based on gas meter usage data as described in claim 2, characterized in that, In the state of microflow alarm, multiple natural days are set to 7 days, the preset nighttime period is set to 0:00 to 4:00 every day, when there is a valid zero gas consumption sampling point, an abnormal prior is generated, and when there is no valid zero gas consumption sampling point and the continuous gas consumption mode meets the stability threshold, a normal prior is generated.
4. The gas leak prediction method based on gas meter usage data as described in claim 1, characterized in that, In S4, when the alarm type is a constant current alarm, the historical reference window includes the gas consumption sequence of the 15 days prior to the alarm, divides the continuous gas consumption segment based on the gas consumption threshold, and determines the continuous gas consumption status throughout the day, the set of historical long-term gas consumption segments, and the regularity of historical short-term gas consumption.
5. The gas leak prediction method based on gas meter usage data as described in claim 4, characterized in that, Under constant current alarm status, if the historical gas consumption is continuous throughout the day, a normal prior is generated. If there are no historical periods exceeding the long-term threshold and short-term gas consumption is regular, an abnormal prior is generated. If there are historical periods exceeding the long-term threshold, the deviation rate between the current hourly gas consumption and the historical reference hourly gas consumption is calculated, and a judgment value is generated according to the deviation threshold.
6. The gas leak prediction method based on gas meter usage data as described in claim 5, characterized in that, Under constant current alarm status, the long-term threshold is 4 hours, the deviation threshold is 30%, and the historical reference hourly gas consumption is the median of the hourly gas consumption of historical long-term gas consumption segments that match the current alarm segment in at least one of the following: time location, season, or duration.
7. The gas leak prediction method based on gas meter usage data as described in claim 1, characterized in that, In S2, the time-series coding model is LSTM, GRU, TCN and / or Transformer, and the data input to the time-series coding model also includes a missing mask, time interval, hourly cycle coding and / or weekly cycle coding.
8. The gas leak prediction method based on gas meter usage data as described in claim 1, characterized in that, In S4, the gating constraint includes: when the first leakage risk score or the second leakage risk score reaches the high-risk threshold, the risk level below the preset rule confidence level is reduced to the no-push level; The fusion weight is determined based on the alarm type, data quality, or rule confidence. When the time-series coding model or gradient boosting tree model conflicts with the business rules or the rule confidence is lower than the threshold, manual review is required.
9. The gas leak prediction method based on gas meter usage data as described in claim 8, characterized in that, The results of on-site verification, outbound call review, or work order processing are correlated with alarms to form training samples, and the temporal coding model, gradient boosting tree model, fusion weights, and / or rule parameters are updated based on the training samples.
10. A gas leak prediction system based on gas meter usage data, applicable to the gas leak prediction method based on gas meter usage data as described in any one of claims 1-9, characterized in that, include: The data acquisition and preprocessing module is used to acquire the incremental gas consumption, timestamp, alarm type, equipment status and historical data of the target gas meter, and perform preprocessing such as time alignment, missing data marking and anomaly handling to obtain standardized, multi-scale gas consumption data. The time series prediction module is connected to the data acquisition and preprocessing module. It encodes standardized, multi-scale gas consumption data based on the time series coding model, extracts continuous, periodic and abrupt features, and outputs the first leakage risk score. The structured prediction module is connected to the data acquisition and preprocessing module. It constructs a structured feature vector including zero gas consumption status, continuous gas consumption duration, gas consumption cycle, and the deviation of the current gas consumption from the historical reference gas consumption. The vector is input into the gradient boosting tree model and outputs a second leakage risk score. The rule prior module, which is integrated with the first leakage risk score and the second leakage risk score, is used to execute business rules corresponding to micro-flows and / or constant flows, and generate rule conclusions, confidence levels and interpretable reason codes. The fusion decision module, connected to the rule prior module, is used to combine the temporal risk score, structural risk score, and rule prior, and sequentially perform gating fusion, probability calibration, and conflict detection to form the final prediction result.
