Indoor gas consumption abnormity early warning method, device and equipment and storage medium
By acquiring users' historical parameter information and dynamically adjusting the gas consumption threshold using a gas consumption prediction model, the problem of insufficient safety protection caused by the fixed threshold of ultrasonic gas meters is solved, and reliable monitoring and timely early warning of gas leaks are achieved.
Patent Information
- Application Number
- CN202511224666.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-29
- Publication Date
- 2025-12-12
AI Technical Summary
The flow threshold of existing ultrasonic gas meters is fixed and cannot be adjusted, which makes it impossible to detect and deal with real gas leak hazards in a timely manner, weakening the safety protection capability, causing frequent false alarms, and affecting the user experience.
By acquiring historical parameter information of target users, gas consumption is predicted using a gas consumption prediction model, and the consumption threshold range is dynamically adjusted to achieve proactive early warning.
It improves the reliability of gas leak detection, reduces the frequency of false alarms, and enhances the safety and user experience of gas use.
Smart Images

Figure CN121121983A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of gas early warning, and in particular to an indoor gas usage abnormality early warning method, device, equipment and storage medium. BACKGROUND
[0002] With the development of economic society and the improvement of residents' living standards, gas as a clean energy has been widely used in civil and industrial fields, and its use safety problem has become the core focus of the gas industry. Ultrasonic gas meter, with its high measurement accuracy and strong operation reliability, plays a key role in recording gas consumption (usually measured in cubic meters or cubic feet) and realizing accurate billing. To ensure gas safety, the ultrasonic gas meter is generally pre-configured with a flow threshold as a core safety mechanism when it is shipped. The original intention of its design is to automatically trigger an alarm and perform a valve closing action when the gas flow in the pipeline exceeds the set value, thereby providing technical support for preventing major safety hazards such as gas leakage.
[0003] However, the ultrasonic gas meter in the prior art has a significant limitation: the flow threshold pre-set at the factory is usually fixed and cannot be adjusted during the service of the meter. In order to avoid frequent false alarms and unnecessary valve closing operations that may be caused by the start of high-power gas equipment (such as large stoves and floor heating) under normal use conditions, manufacturers tend to conservatively set this flow threshold much higher than the maximum value of the user's daily actual flow. Although this design strategy superficially reduces the probability of false operation, it significantly weakens the safety warning function of the threshold, setting the critical flow monitoring range outside the interval where actual threats may occur.
[0004] Therefore, the current flow threshold setting method often makes it ineffective in the face of real possible gas leakage dangers, making it difficult to play an effective safety protection role. A threshold set too high essentially eliminates its value as a means of preventing leakage risks, not only failing to detect and handle risks indicated by abnormal flow increases, but also to some extent undermining the safety protection capabilities that ultrasonic gas meters should have, constituting an important defect in the prior art that needs to be overcome. SUMMARY
[0005] The present application provides an indoor gas usage abnormality early warning method, device, equipment and storage medium to improve the reliability of monitoring small leaks, reduce false positives and false interference with user experience, and introduce an active early warning mechanism, providing a technical basis for gas use safety warning.
[0006] According to an aspect of the present application, an indoor gas usage abnormality early warning method is provided. The method comprises:
[0007] Acquire historical parameter information related to gas information in a target user's house;
[0008] According to the historical parameter information and a pre-constructed gas consumption prediction model, a predicted gas consumption of the target user's house in a preset prediction period is predicted.
[0009] According to the historical parameter information and the predicted gas consumption, a target consumption threshold interval in the preset prediction period is determined.
[0010] In the preset prediction period, if the actual gas consumption in the target user's house is outside the target consumption threshold interval, it is determined that the gas consumption in the target user's house is abnormal, and an alarm is processed.
[0011] According to another aspect of the present application, a device for early warning of abnormal gas consumption in a house is provided. The device comprises: a parameter information acquisition module for acquiring historical parameter information related to gas information in a target user's house;
[0012] A prediction consumption determination module is configured to predict, according to the historical parameter information and a pre-constructed gas consumption prediction model, a predicted gas consumption of the target user's house in a preset prediction period.
[0013] A threshold interval determination module is configured to determine, according to the historical parameter information and the predicted gas consumption, a target consumption threshold interval in the preset prediction period.
[0014] A consumption abnormality early warning module is configured to determine, in the preset prediction period, that the gas consumption in the target user's house is abnormal and process an alarm if the actual gas consumption in the target user's house is outside the target consumption threshold interval.
[0015] According to another aspect of the present application, an electronic device is provided, which comprises:
[0016] at least one processor; and
[0017] a memory in communication with the at least one processor; wherein
[0018] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method for early warning of abnormal gas consumption in a house according to any one of the embodiments of the present application.
[0019] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the indoor gas consumption anomaly early warning method according to any of the embodiments of the present application when executed.
[0020] The technical solution of the embodiment of the present application acquires historical parameter information related to gas information of a target user. According to the historical parameter information and a pre-constructed gas consumption prediction model, a predicted gas consumption of the target user is predicted in a preset prediction period. According to the historical parameter information and the predicted gas consumption, a target consumption threshold interval is determined in the preset prediction period. If the actual gas consumption of the target user is outside the target consumption threshold interval, it is determined that the gas consumption of the target user is abnormal, and an alarm is triggered. The safety protection of the ultrasonic gas meter is changed from a fixed threshold mode to a dynamic threshold mode, the reliability of monitoring small leaks is improved, the user experience of false alarms and false interference is reduced, and an active early warning mechanism is introduced, thereby providing a technical basis for gas use safety warning.
[0021] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0023] Figure 1 is a flow chart of an indoor gas consumption anomaly early warning method according to an embodiment of the present application;
[0024] Figure 2 is a flow chart of an indoor gas consumption anomaly early warning method according to an embodiment of the present application;
[0025] Figure 3 is a structural diagram of an indoor gas consumption anomaly early warning device according to an embodiment of the present application;
[0026] Figure 4 is a structural diagram of an electronic device implementing the indoor gas consumption anomaly early warning method according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application, so that those skilled in the art can better understand the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0029] Embodiment one
[0030] Figure 1 A flowchart of a household gas consumption anomaly early warning method provided by the first embodiment of the present application is shown in the figure. The present embodiment can be applied to detect the case of gas consumption anomaly by dynamic early warning threshold. The method can be executed by a household gas consumption anomaly early warning device, which can be realized in the form of hardware and / or software, and can be configured in an electronic device. As shown in the figure, the method comprises: Figure 1
[0031] S101, obtaining historical parameter information related to gas information of a target user.
[0032] The historical parameter information includes historical gas parameters and historical peripheral information. The historical gas parameters include gas instantaneous flow, gas temperature information and gas pressure information. The historical peripheral information at least includes family geographic information, population age distribution, holiday distribution information and public weather information of the target user.
[0033] Specifically, the gas big data is collected by using the gas instantaneous flow sensor, temperature sensor and pressure sensor on the ultrasonic gas meter. The gas instantaneous flow sensor measures the gas instantaneous flow through the ultrasonic gas meter, the temperature sensor monitors the gas temperature characteristics through the ultrasonic gas meter, and the pressure sensor monitors the gas pressure characteristics through the ultrasonic gas meter.
[0034] Exemplarily, the sampling frequency of the ultrasonic gas meter is 2s and 0.125s, which can be selected according to the needs, and the default is 2s. The time information data of the sensor working can also be obtained synchronously, and the sampling frequency can be adjusted according to the needs. The gas data sampled by the sensor on the ultrasonic meter is as follows: the time data is accurate to seconds, such as July 2, 2025, 17:25:25; the flow data is accurate to 0.01m 3 / h, such as 0.68m 3 / h; the temperature data is accurate to 0.01℃, such as 26.45℃; the pressure data is accurate to 0.01kPa, such as 2.85kPa.
[0035] In addition, user household information data is obtained through questionnaire survey, including residence information data, age distribution data of residents, etc.; public service information data such as holidays and weather is obtained through the Internet, including holiday dates, weather conditions and outdoor temperature and humidity, etc.
[0036] The user household information data should cover as much as possible the housing information data, the population information data and other information data highly related to gas use, and the user is allowed to modify and improve according to the actual situation, such as gas equipment brand replacement, household population information adjustment, etc. The public service information data should be obtained from official data, and can be adjusted according to the actual situation, for example, the user's paid annual leave, rest, etc. It should be noted that the above information needs to be authorized by the target user before being obtained, in order to avoid leaking the private information of the target user.
[0037] S102, according to the historical parameter information and the pre-constructed gas consumption prediction model, the predicted gas consumption of the target user's indoor gas in the preset prediction period is predicted.
[0038] Among them, the gas consumption prediction model is obtained by training sample data, which can predict the gas consumption of the target user at the predicted future time.
[0039] The most basic scheme can directly input the historical parameter information into the gas consumption prediction model, and obtain the predicted gas consumption in the preset prediction period according to the output of the gas consumption prediction model.
[0040] Exemplarily, the prediction of the predicted gas consumption of the target user's indoor gas in the preset prediction period according to the historical parameter information and the pre-constructed gas consumption prediction model includes:
[0041] The historical parameter information is pre-data processed to obtain first parameter information; the first parameter information is subjected to space-time feature extraction to construct a space-time feature matrix; and the space-time feature matrix is input into the gas consumption prediction model to predict gas, so as to determine the predicted gas consumption of the target user in a preset prediction period.
[0042] The data preprocessing can include data denoising, missing value processing, and outlier processing, etc., to improve data quality.
[0043] The denoising is realized by using a sliding average method, as shown below:
[0044]
[0045] wherein x t represents original data, represents denoised data, ω represents a window size, N represents a total length of a time series, k represents a window offset index, and t represents a time index.
[0046] The formula represents a sliding average filtering, which is used to reduce random noise in time series data. By averaging the data in the neighborhood window of each time point t, high-frequency noise is smoothed, and low-frequency trends are retained.
[0047] The outlier processing adopts the IQR rule in the box plot, i.e., the lower bound of the box plot is Q1-1.5IQR, and the upper bound is Q3+1.5IQR, IQR=Q3-Q1. The data points exceeding the upper and lower bounds are abnormal points, which need to be deleted from the training data set to prevent adverse effects on the model.
[0048] The missing value processing adopts a linear interpolation method, i.e., if t a <t b are the nearest two endpoints of the missing value at time t and x(t a ), x(t b ) are valid, then the missing value at time t is replaced by t∈(t a ,t b ).
[0049] Specifically, the first parameter information obtained after pre-data processing is subjected to space-time feature extraction to construct a space-time feature matrix. The spatial dimension includes user geographic location, floor height, and relative position of surrounding users; and the time dimension includes continuous sampling data. Frequency domain features are extracted using time-frequency information conversion (such as Fourier transform and wavelet transform), and time domain features are extracted in combination with neural networks (multilayer perceptron, convolutional neural network, and graph neural network), to output user gas consumption trend and usage time period mode.
[0050] The equal-interval sequence obtained after preprocessing is denoted as m = 1, …, M, c = 1, …, C, k = 0, …, K-1. m represents the input dimension of each time step, and c represents the output dimension. In each time window (L points long), a time-frequency transform is performed on each (m, c) channel to generate multi-scale statistics, and then the resulting features are combined with the original time-domain statistics and dimensionally upgraded into a neural network. For each channel data, a time window of length L is defined: n = 0, …, L-1, where k0 is the window starting index.
[0051] The implementation of extracting frequency domain features by Fourier transform is as follows:
[0052]
[0053] Among them, the real part ReX[l] and the imaginary part ImX[l] are extracted from X[l], the amplitude ∠X[l] = atan2(ImX[l], ReX[l]) is the phase. l refers to the frequency index, n refers to the time domain index, L refers to the time window length, e -j2πln / L is a complex exponential basis function. The discrete Fourier transform converts the time domain signal x[n] into the frequency domain signal X[l], capturing periodic patterns.
[0054] The discrete wavelet transform needs to be filtered by low-pass h and high-pass g and down-sampled, and the implementation of extracting frequency domain features by wavelet transform is as follows:
[0055] Low-pass filtering: a1[n] = ∑ k h[k]x[2n-k];
[0056] High-pass filtering: d1[n] = ∑ k g[k]x[2n-k];
[0057] The approximation coefficients a j are iteratively decomposed to obtain the hierarchy {a J , d J , …, d1}. The wavelet basis function family includes but is not limited to the Daubechies, Symlet, or Coiflet series. Wavelet transform captures features at different time scales. The low-pass filter h generates approximation coefficients aj (low frequency), and the high-pass filter g generates detail coefficients dj (high frequency). Iterative decomposition produces a multi-scale representation.
[0058] The second generation wavelet transform needs to first split the sequence into odd and even, first obtaining x e [n] = x[2n], x o[n] = x[2n+1], then predict odd sample with even sample, and take the residual as detail coefficient, i.e. d[n] = x o [n] - P(x e [n] = P(x e [n] = ∑ k p k x e [n+k], finally correct even sample with detail coefficient to get approximation coefficient, i.e. s[n] = x e [n] + U(d)[n], U(d)[n] = ∑ k u k d[n+k].
[0059] After the time-frequency conversion is completed, the obtained frequency domain information and the original time domain information are spliced and dimensioned, and the specific rules are as follows: for Fourier transform, K f frequency domain data are retained and the amplitude and phase are output, so 2K f dimensions are added; for discrete wavelet transform, S scales are taken, and r statistics are taken for each scale, rS dimensions are added; for the second generation wavelet transform, J layers are taken, and r' statistics are taken for each layer, r'(J+1) dimensions are added. Then the added dimensions of each channel are 2K f +rS+r'(J+1). For example, if K f =16, S=8, r=2 (energy+mean), J=3, r'=2 (energy+variance), then 56 dimensions are added for each channel, and if C=4 channels, then 244 dimensions are added for each position, i.e. the dimension is expanded from n to n+244. In order to be compatible with complex spectrum features, ReX[l], ImX[l], |X[l]| and ∠X[l] are used as parallel real value features to input the subsequent network.
[0060] The gas consumption prediction model includes multilayer perceptron, convolutional neural network and graph neural network, etc., which are used to extract the change trend of user indoor gas consumption and the mode change of use time period. Assuming that the time-space feature matrix after time-frequency concatenation is z, the calculation method of multilayer perceptron (taking three layers as an example) is as follows:
[0061] h1 = φ(W1z+b1);
[0062] h2 = φ(W2h1+b2);
[0063] y = W3h2+b3;
[0064] wherein, φ is an activation function, generally ReLU or GELU, and Dropout and BatchNorm are also introduced between layers to suppress overfitting; W1, W2 and W3 are weight matrices; b1, b2 and b3 are bias vectors, and y is the output feature. It should be noted that the output dimensions of W1 and W2, the activation function and the Dropout ratio are all adjustable hyperparameters, which can be used for model hyperparameter optimization.
[0065] For sequence data One-dimensional convolution is performed as follows:
[0066]
[0067] wherein, K is the size of the convolution kernel, d is the dilation rate, C in is the number of input channels, and o is the output channel index. It should be noted that the size of the convolution kernel, the dilation rate, the number of output channels, the number of layers, and the pooling strategy are all adjustable hyperparameters, which can be used for model hyperparameter optimization.
[0068] For the space-time feature matrix, it is processed by a graph neural network method, and each node is a position-time composite node (m, k); an adjacency matrix A is used, and its elements can be determined according to distance, ventilation connectivity, historical correlation coefficient or pipe topology; after adding a self-loop is a degree matrix. Then, graph neural network calculation is performed by It should be noted that the graph type, the number of layers, and the hidden dimension are all adjustable hyperparameters, which can be used for model hyperparameter optimization.
[0069] S103, determining a target usage threshold interval in the preset prediction period according to the historical parameter information and the predicted gas usage.
[0070] Specifically, according to the historical parameter information and the predicted gas usage, a target usage threshold interval in the preset prediction period is formulated, wherein one implementation manner can be that the historical average gas usage of the target user is determined according to the historical parameter information, and a floating interval is set around the predicted gas usage according to the gas usage habit of the user, and the floating interval is set as the target usage threshold interval.
[0071] S104, determining that the gas usage in the target user's house is abnormal and performing alarm processing if the actual gas usage in the target user's house is located outside the target usage threshold interval in the preset prediction period.
[0072] That is to say, if the actual gas usage of the target user exceeds the target usage threshold interval in the preset prediction period, it is determined that the gas usage in the target user's house is abnormal, a leakage may occur, and alarm processing is performed through a multi-channel early warning mechanism.
[0073] Among them, the multi-channel early warning mechanism includes: sound alarm, issuing a continuous loud sound to attract the attention of the user; light warning, starting the flashing light to enhance the visual warning effect; alarm information sending, sending alarm information to the user's mobile phone or other smart devices, reminding the target user through SMS, mobile phone application and other ways, these alarm notifications can help the user to understand the potential danger in time, and take necessary measures, such as quickly evacuating the room, notifying the relevant departments or calling for help; automatic valve closing, which can immediately trigger the operation of closing the gas valve to cut off the gas supply, further reduce the potential risk, and prevent the gas leakage from causing fire or explosion and other serious accidents.
[0074] The technical scheme of the embodiment of the present application acquires the historical parameter information related to the gas information in the target user's house. According to the historical parameter information and the pre-constructed gas consumption prediction model, the predicted gas consumption of the target user's house in the preset prediction period is predicted. According to the historical parameter information and the predicted gas consumption, the target consumption threshold interval in the preset prediction period is determined. In the preset prediction period, if the actual gas consumption of the target user's house is located outside the target consumption threshold interval, it is determined that the gas consumption of the target user's house is abnormal, and an alarm is processed. The safety protection of the ultrasonic gas meter is changed from the fixed threshold mode to the dynamic threshold mode, the reliability of monitoring small leaks is improved, the user experience of false positives and false interference is reduced, an active early warning mechanism is introduced, and a technical foundation is provided for gas use safety warning.
[0075] Embodiment two
[0076] Figure 2 A flowchart of an indoor gas consumption anomaly early warning method provided by the second embodiment of the present application is provided. Based on the above-mentioned embodiments, the determination of the target consumption threshold interval is further refined. As shown in the following figure, the method comprises the following steps. Figure 2
[0077] S201, acquiring historical parameter information related to gas information in the target user's house.
[0078] S202, according to the historical parameter information and the pre-constructed gas consumption prediction model, predicting the predicted gas consumption of the target user's house in the preset prediction period.
[0079] S203, according to the historical parameter information, determining the predicted consumption residual of the historical predicted consumption and the historical actual consumption of the indoor gas in the sliding time window.
[0080] The sliding time window can be set according to actual conditions, and the application does not make specific limitations.
[0081] Specifically, the predicted usage residual of each time point in the sliding time window can be determined in the following manner:
[0082]
[0083] Wherein, y t is the historical actual usage, is the historical predicted usage, and ε t is the predicted usage residual.
[0084] S204, according to the predicted usage residual and the predicted gas usage, determine the target usage threshold interval within the preset prediction period through a preset adjustment method.
[0085] The preset adjustment method includes statistical modeling and Bayesian inference.
[0086] Specifically, statistical modeling or Bayesian inference is performed on the predicted usage residual to obtain an uncertainty interval (or quantile), the predicted gas usage is referred to, the early warning threshold is dynamically adjusted in combination with reinforcement learning, the dynamic safety boundary is formed, the target usage threshold interval is obtained, false positives and false negatives are reduced, and the early warning robustness is improved.
[0087] Exemplarily, in the case where the preset adjustment method is statistical modeling, according to the predicted usage residual and the predicted gas usage, the target usage threshold interval within the preset prediction period is determined, including:
[0088] According to the predicted usage residual, an assumption that the residual obeys a normal distribution with zero mean is established, and the residual sample variance within the sliding time window is calculated according to the statistical model;
[0089] According to the residual sample variance as a distribution parameter, a normal distribution probability model is constructed;
[0090] In the normal distribution probability model, the confidence interval quantile is determined according to a preset significance level;
[0091] According to the predicted gas usage, the confidence interval quantile and the residual variance estimate, the target usage threshold interval within the preset prediction period is determined.
[0092] Specifically, if statistical modeling is adopted, it is assumed that the residual is normal noise with zero mean and stable variance, i.e. t ~ N(0, σ 2 );
[0093] Based on the sliding window samples {εt-W+1 ,……,ε t Sliding window estimation:
[0094]
[0095] Under the zero-mean assumption, it can be considered that It is approximately 0. Therefore, given an alarm significance level α∈(0,1), the standard normal quantile, i.e., the confidence interval quantile z, is approximately 0. 1-α Then the upper limit of the target usage threshold range is The lower limit of the target dosage threshold range is in, This refers to predicting gas consumption. This refers to residual variance estimation.
[0096] For example, when the preset adjustment method is Bayesian inference, determining the target consumption threshold range within the preset prediction period based on the predicted consumption residual and the predicted gas consumption includes:
[0097] Define the normal-inverse gamma conjugate prior distribution of the residuals: the mean follows a normal prior, and the variance follows an inverse gamma prior;
[0098] Based on the predicted usage residual, calculate the sample mean and sample sum of squares within the sliding time window;
[0099] The posterior distribution parameters are updated based on the sample mean and the sample sum of squares to obtain the posterior mean, variance scaling factor, shape parameter and scale parameter.
[0100] Based on the updated posterior parameters, the posterior prediction distribution of the residuals at the next time step is determined to be the Student-t distribution;
[0101] Quantities of the confidence interval are determined based on the preset significance level and the degrees of freedom of the Student-t distribution;
[0102] Based on the predicted gas consumption, the confidence interval quantiles, and the scale parameter, the target consumption threshold range within the preset prediction period is determined.
[0103] Specifically, if a Bayesian method is used, the uncertainty of the parameters can be better determined. In this case, the conjugate prior of the normal mean and unknown variance is used, i.e.:
[0104] ε t |μ,σ 2 ~N(μ,σ 2 );
[0105]
[0106] σ 2 ~Inv-Gamma(a0,b0);
[0107] for the sliding window whose sample mean is whose sum of squares is then the posterior parameter is κ n = κ0+ W, κ0, μ0, b0 and a0 are all prior hyperparameters.
[0108] Under this posterior, the next time's residual error ε t+1 has a posterior predictive distribution of Student-t, i.e.
[0109]
[0110] where ε t+1 ~Student is the next time's error distribution, which is used to predict the possible range of future gas usage deviation, μ n is the distribution center, is the distribution width, and the degree of freedom v = 2a n On this basis, the posterior predictive distribution of gas usage is obtained as:
[0111]
[0112] where ε t+1 ~Student is the next time's error distribution, which is used to predict the possible range of future gas usage deviation, μ n is the distribution center, is the distribution width, and the degree of freedom v = 2a n , is the predicted value.
[0113] Therefore, if a given alarm significance level α ∈ (0, 1) is given, the Student-t confidence interval quantile is t v,1-α , then the upper limit of the target usage threshold interval is The lower limit of the target usage threshold interval is
[0114] where t v,1-α is the 1-α quantile of the Student-t distribution with degree of freedom v.
[0115] S205, if the actual gas usage in the target user household is located outside the target usage threshold interval, it is determined that the gas usage in the target user household is abnormal, and an alarm processing is performed.
[0116] Exemplarily, after judging whether the actual gas consumption in the target user household is located outside the target consumption threshold interval, the method further comprises:
[0117] determining a consumption distribution characteristic of the gas in the target user household in the preset prediction period, wherein the consumption distribution characteristic comprises a predicted gas consumption, a residual distribution mean and a residual distribution variance;
[0118] determining a reward feedback in the preset prediction period according to the actual gas consumption in the preset prediction period and the target consumption threshold interval;
[0119] inputting the consumption distribution characteristic and the reward feedback into a pre-trained target reinforcement learning model to determine a dynamic scaling coefficient of the upper and lower bounds of the target consumption threshold interval, wherein the target reinforcement learning model comprises a pre-defined interval upper and lower bound adjustment action;
[0120] optimizing and adjusting the target consumption threshold interval according to the dynamic scaling coefficient.
[0121] Specifically, the predicted gas consumption distribution characteristic in a preset prediction period T is taken as a state vector identifier, i.e. wherein is the predicted gas consumption, μ t is the residual distribution mean, and is the residual distribution variance.
[0122] determining a reward feedback in the preset prediction period, wherein when the actual gas consumption y t of the user falls within a set target consumption threshold interval [LCB t , UCB t ], the reward is positive, otherwise, the reward is negative, i.e. the reward feedback is:
[0123]
[0124] inputting the consumption distribution characteristic and the reward feedback into a pre-trained target reinforcement learning model, and determining a dynamic scaling coefficient of the upper and lower bounds of the target consumption threshold interval according to the boundary adjustment action of the target consumption threshold interval output by the target reinforcement learning model, and optimizing and adjusting the target consumption threshold interval according to the dynamic scaling coefficient. According to the continuous update of the actual gas consumption behavior feedback of the user, the dynamic adjustment and adaptive optimization of the target consumption threshold interval are realized.
[0125] Exemplarily, the training process of the target reinforcement learning model comprises:
[0126] obtaining training sample data and label data corresponding to the training sample data;
[0127] In the initial training stage, the DQN algorithm model is used for rapid exploration through the training sample data, output data is obtained, the training error is determined according to the output data and the label data, and the network parameters of the DQN algorithm model are adjusted according to the training error;
[0128] In the case of reaching the preset training number of times, the network parameters of the DQN algorithm model are determined as the network parameters of the DDQN algorithm model, the output result of the DQN algorithm model is determined as the input parameter of the DDQN algorithm model, and the DDQN algorithm model is trained;
[0129] In the case of reaching the training end condition, the DDQN algorithm model trained is determined as the target reinforcement learning model.
[0130] It should be noted that the reinforcement learning algorithm combines deep Q network and double Q network, in the exploration stage, the DQN algorithm model (deep Q network) is used to quickly learn the environment information, and in the convergence stage, the DDQN algorithm model (double Q network) is switched to.
[0131] In the initial training stage, the training sample data is input into the DQN algorithm model for rapid exploration, and output data is obtained. The DQN algorithm model is updated by minimizing the loss function of the Bellman equation, and the loss function is:
[0132]
[0133] Wherein, γ is a discount factor, θ and θ - are the current network and target network parameters respectively.
[0134] In the convergence stage, the double Q network separates action selection and action evaluation, reduces the overestimation bias, determines the network parameters of the DQN algorithm model as the network parameters of the DDQN algorithm model, and determines the output result of the DQN algorithm model as the input parameter of the DDQN algorithm model. The DDQN algorithm model is as follows:
[0135]
[0136] In the initial training stage, the DQN algorithm model actively relaxes the threshold boundary in the early high-risk scene. In the convergence stage, the DDQN algorithm model separates action selection and value evaluation, so as to realize the dynamic adjustment and adaptive optimization of the indoor gas safety risk threshold.
[0137] Embodiment three
[0138] Figure 3 A structure schematic view of an indoor gas usage abnormality early warning device provided by the embodiment three of the present application is shown in the figure. Figure 3 As shown in the figure, the device comprises:
[0139] The parameter information acquisition module 301 is configured to acquire historical parameter information related to gas information in a target user household.
[0140] The predicted consumption determination module 302 is configured to predict a predicted gas consumption of the target user household in a preset prediction period according to the historical parameter information and a pre-constructed gas consumption prediction model.
[0141] The threshold interval determination module 303 is configured to determine a target consumption threshold interval in the preset prediction period according to the historical parameter information and the predicted gas consumption.
[0142] The consumption anomaly early warning module 304 is configured to determine that the gas consumption of the target user household is abnormal and perform alarm processing if the actual gas consumption of the target user household is located outside the target consumption threshold interval in the preset prediction period.
[0143] The technical scheme of the embodiment of the application acquires historical parameter information related to gas information in a target user household. The predicted gas consumption of the target user household in a preset prediction period is predicted according to the historical parameter information and a pre-constructed gas consumption prediction model. A target consumption threshold interval in the preset prediction period is determined according to the historical parameter information and the predicted gas consumption. It is determined that the gas consumption of the target user household is abnormal and alarm processing is performed if the actual gas consumption of the target user household is located outside the target consumption threshold interval in the preset prediction period. The safety protection of the ultrasonic gas meter is changed from a fixed threshold mode to a dynamic threshold mode, the reliability of monitoring small leaks is improved, the use experience of users who are misreported or misinterfered is reduced, an active early warning mechanism is introduced, and a technical foundation is provided for gas use safety early warning.
[0144] Optionally, the threshold interval determination module 303 comprises:
[0145] The consumption residual determination unit is configured to determine a predicted consumption residual of historical predicted consumption and historical actual consumption of household gas in a sliding time window according to the historical parameter information.
[0146] The threshold interval determination unit is configured to determine a target consumption threshold interval in the preset prediction period according to the predicted consumption residual and the predicted gas consumption by a preset adjustment method, wherein the preset adjustment method comprises statistical modeling and Bayesian inference.
[0147] Optionally, the threshold interval determination unit is specifically configured to:
[0148] In a case where the preset adjustment method is statistical modeling, an assumption that a residual error obeys a normal distribution with a zero mean value is established according to the predicted gas consumption residual error, and a residual error sample variance in a sliding time window is calculated according to a statistical model;
[0149] A normal distribution probability model is constructed according to the residual error sample variance as a distribution parameter;
[0150] In the normal distribution probability model, a confidence interval quantile is determined according to a preset significance level;
[0151] A target consumption threshold interval in the preset prediction period is determined according to the predicted gas consumption, the confidence interval quantile and the residual error variance estimation.
[0152] Optionally, the threshold interval determination unit is specifically configured to:
[0153] In a case where the preset adjustment method is Bayesian inference, a normal-inverse gamma conjugate prior distribution of the residual error is set, that is, a mean value obeys a normal prior and a variance obeys an inverse gamma prior;
[0154] A sample mean value and a sample sum of squares in a sliding time window are calculated according to the predicted gas consumption residual error;
[0155] A posterior distribution parameter is updated according to the sample mean value and the sample sum of squares, to obtain a posterior mean value, a variance scaling factor, a shape parameter and a scale parameter;
[0156] Based on the updated posterior parameter, a posterior predictive distribution of the residual error at a next time is determined as a Student-t distribution;
[0157] A confidence interval quantile is determined according to a preset significance level and a degree of freedom of the Student-t distribution;
[0158] A target consumption threshold interval in the preset prediction period is determined according to the predicted gas consumption, the confidence interval quantile and the scale parameter.
[0159] Optionally, the device further includes a threshold interval adjustment module configured to:
[0160] After it is determined whether the actual gas consumption in the target user household is located outside the target consumption threshold interval, a gas consumption distribution characteristic in the preset prediction period is determined, wherein the consumption distribution characteristic includes a predicted gas consumption, a residual error distribution mean value and a residual error distribution variance;
[0161] According to the actual gas consumption in the preset prediction period and the target consumption threshold interval, a reward feedback in the preset prediction period is determined.
[0162] input the usage distribution feature and the reward feedback into a pre-trained target reinforcement learning model to determine a dynamic scaling coefficient of an upper and lower bound of a target usage threshold interval, wherein the target reinforcement learning model comprises a pre-defined interval upper and lower bound adjustment action;
[0163] perform an optimized adjustment processing on the target usage threshold interval according to the dynamic scaling coefficient.
[0164] Optionally, the threshold interval adjustment module further comprises a reinforcement learning model training unit, configured to:
[0165] obtain training sample data and label data corresponding to the training sample data;
[0166] in the initial training stage, use a DQN algorithm model to perform rapid exploration through the training sample data, obtain output data, determine a training error according to the output data and the label data, and adjust network parameters of the DQN algorithm model according to the training error;
[0167] in the case of reaching a preset training number of times, determine the network parameters of the DQN algorithm model as network parameters of a DDQN algorithm model, determine an output result of the DQN algorithm model as an input parameter of the DDQN algorithm model, and train the DDQN algorithm model;
[0168] in the case of reaching a training end condition, determine the trained DDQN algorithm model as a target reinforcement learning model.
[0169] Optionally, the prediction usage determination module 302 is specifically configured to:
[0170] perform pre-data processing on the historical parameter information to obtain first parameter information;
[0171] perform space-time feature extraction on the first parameter information to construct a space-time feature matrix;
[0172] input the space-time feature matrix into the gas usage prediction model to perform gas prediction, and determine the predicted gas usage of the target user indoor gas in a preset prediction period.
[0173] The indoor gas usage abnormality early warning device provided in the embodiments of the present application can perform the indoor gas usage abnormality early warning method provided in any embodiment of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0174] Embodiment Four
[0175] Figure 4A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0176] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0177] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0178] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as an indoor gas consumption anomaly warning method.
[0179] In some embodiments, the indoor gas consumption anomaly early warning method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 18. In some embodiments, parts or all of the computer program can be loaded and / or installed onto electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the above-described indoor gas consumption anomaly early warning method can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the indoor gas consumption anomaly early warning method by other any suitable means, e.g., with the aid of firmware.
[0180] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0181] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a standalone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0182] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0183] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0184] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0185] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0186] It should be understood that the various forms of flow shown above can be reordered, added to, or have steps deleted. For example, the steps described in the present application can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which are not limited herein.
[0187] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for early warning of abnormal indoor gas consumption, characterized in that, include: Obtain historical parameter information related to gas information within the target user's household; Based on the historical parameter information and the pre-built gas consumption prediction model, the predicted gas consumption of the target user's indoor gas within the preset prediction period is predicted. Based on the historical parameter information and the predicted gas consumption, the target consumption threshold range within the preset prediction period is determined. If, within the preset prediction period, the actual gas consumption of the target user's household is outside the target consumption threshold range, the gas consumption of the target user's household is determined to be abnormal, and an alarm is triggered.
2. The method according to claim 1, characterized in that, The step of determining the target consumption threshold range within the preset prediction period based on the historical parameter information and the predicted gas consumption includes: Based on the historical parameter information, determine the predicted residual between the historical predicted consumption and the historical actual consumption of indoor gas within the sliding time window; By using a preset adjustment method, a target consumption threshold range within the preset prediction period is determined based on the predicted consumption residual and the predicted gas consumption. The preset adjustment method includes statistical modeling and Bayesian inference.
3. The method according to claim 2, characterized in that, When the preset adjustment method is statistical modeling, the target consumption threshold range within the preset prediction period is determined based on the predicted consumption residual and the predicted gas consumption, including: Based on the predicted usage residuals, the assumption that the residuals follow a zero-mean normal distribution is established, and the residual sample variance within the sliding time window is calculated based on the statistical model. Based on the variance of the residual samples as the distribution parameter, a normal distribution probability model is constructed; In the normal distribution probability model, confidence interval quantiles are determined according to a preset significance level; Based on the confidence interval quantiles and residual variance estimation of the predicted gas consumption, the target consumption threshold range within the preset prediction period is determined.
4. The method according to claim 2, characterized in that, When the preset adjustment method is Bayesian inference, the target consumption threshold range within the preset prediction period is determined based on the predicted consumption residual and the predicted gas consumption, including: Define the normal-inverse gamma conjugate prior distribution of the residuals: the mean follows a normal prior, and the variance follows an inverse gamma prior; Based on the predicted usage residual, calculate the sample mean and sample sum of squares within the sliding time window; The posterior distribution parameters are updated based on the sample mean and the sample sum of squares to obtain the posterior mean, variance scaling factor, shape parameter and scale parameter. Based on the updated posterior parameters, the posterior prediction distribution of the residuals at the next time step is determined to be the Student-t distribution; Quantities of the confidence interval are determined based on the preset significance level and the degrees of freedom of the Student-t distribution; Based on the predicted gas consumption, the confidence interval quantiles, and the scale parameter, the target consumption threshold range within the preset prediction period is determined.
5. The method according to claim 1, characterized in that, After determining whether the actual gas consumption in the target user's household is outside the target consumption threshold range, the method further includes: Determine the gas consumption distribution characteristics of the target user's indoor gas consumption within the preset prediction period, wherein the consumption distribution characteristics include predicted gas consumption, residual distribution mean, and residual distribution variance; The reward feedback for the preset prediction period is determined based on the actual gas consumption within the preset prediction period and the target consumption threshold range. The usage distribution features and reward feedback are input into a pre-trained target reinforcement learning model to determine the dynamic scaling coefficients for the upper and lower bounds of the target usage threshold interval, wherein the target reinforcement learning model includes predefined interval upper and lower bound adjustment actions. The target usage threshold range is optimized and adjusted based on the dynamic scaling factor.
6. The method according to claim 5, characterized in that, The training process of the target reinforcement learning model includes: Obtain training sample data and the corresponding label data of the training sample data; In the early stages of training, the DQN algorithm model is used to quickly explore the training sample data to obtain output data. The training error is determined based on the output data and the label data, and the network parameters of the DQN algorithm model are adjusted based on the training error. When the preset number of training iterations is reached, the network parameters of the DQN algorithm model are determined as the network parameters of the DDQN algorithm model, and the output of the DQN algorithm model is determined as the input parameters of the DDQN algorithm model, and the DDQN algorithm model is trained. Once the training termination conditions are met, the trained DDQN algorithm model is designated as the target reinforcement learning model.
7. The method according to claim 1, characterized in that, The step of predicting the predicted gas consumption of the target user's indoor gas within a preset prediction period based on the historical parameter information and a pre-built gas consumption prediction model includes: The historical parameter information is pre-processed to obtain the first parameter information; The first parameter information is subjected to spatiotemporal feature extraction to construct a spatiotemporal feature matrix; The spatiotemporal feature matrix is input into the gas consumption prediction model to predict gas consumption and determine the predicted gas consumption of the target user's indoor gas within a preset prediction period.
8. A device for early warning of abnormal indoor gas consumption, characterized in that, include: The parameter information acquisition module is used to acquire historical parameter information related to gas information within the target user's household. The predicted gas consumption determination module is used to predict the predicted gas consumption of the target user's indoor gas within a preset prediction period based on the historical parameter information and the pre-built gas consumption prediction model. The threshold range determination module is used to determine the target consumption threshold range within the preset prediction period based on the historical parameter information and the predicted gas consumption. The abnormal gas consumption warning module is used to determine that the gas consumption of the target user is abnormal and to trigger an alarm if the actual gas consumption in the target user's household is outside the target consumption threshold range within the preset prediction period.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the indoor gas consumption abnormality early warning method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the indoor gas consumption abnormality early warning method according to any one of claims 1-7.
Citation Information
Cited By
Early warning method and device of meter and electronic equipment
CN122090603A
Early warning methods, devices and electronic equipment for meters
CN122090603B