Gas consumption abnormity monitoring method based on ultrasonic flow terminal

By combining the ultrasonic flow terminal with the K nearest neighbor algorithm and ε-greedy training of the Q model, the natural gas pipeline flow is monitored in real time, which solves the problems of detection delay and false alarms of existing gas alarms and achieves high-precision monitoring and early warning of gas use. Improved gas safety.

CN118865604AActive Publication Date: 2024-10-29CHENGDU QIANJIA TECH CO LTD

Patent Information

Application Number
CN202411365625.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-10-29
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

Existing gas alarms are delayed in detecting gas leaks and are installed in inappropriate locations, which may result in false alarms or no alarms, increasing gas consumption risks and making it difficult to monitor gas safety in advance.

Method used

The gas usage anomaly monitoring method based on ultrasonic flow terminals is adopted, and the gas usage habit vector table is established through multi-day pre-operation. The K nearest neighbor algorithm and Q model are combined, and the ε-greedy algorithm is used for training to monitor the instantaneous flow of the pipeline in real time to achieve small leakage and Detection of over-limit flow provides early warning of gas accidents.

Benefits of technology

It achieves high-precision monitoring of gas use, can provide early warning of small leaks and over-limit flow, improves gas safety, and reduces false alarms and non-reports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118865604A_ABST
    Figure CN118865604A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of gas flow monitoring, and discloses a gas consumption abnormity monitoring method based on an ultrasonic flow terminal, which comprises the following steps: the ultrasonic flow terminal obtains the instantaneous flow of natural gas in a user pipeline through multi-day pre-operation, and establishes a user gas consumption habit vector table; a gas consumption peak value vector table is initialized, and the ultrasonic flow terminal updates the daily hour peak value instantaneous flow of the user into the gas consumption peak value vector table; and based on the user gas consumption habit vector table and the gas consumption peak value vector table, judging whether the gas consumption of the user is abnormal or not by using a K nearest neighbor algorithm. The instantaneous flow of the pipeline is monitored in real time in the gas using process of a user, detection of tiny leakage and over-limit flow is achieved through self-learning of the ultrasonic flow terminal, early warning of gas accidents is achieved, and gas using safety is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of gas flow monitoring, and in particular to a method for monitoring abnormal gas consumption based on an ultrasonic flow terminal. Background Art

[0002] In the field of gas safety, combustible gas alarms are often used to monitor methane (CH 4 ) gas, if it exceeds the preset threshold, the alarm will be triggered to remind the user to turn off the gas and open the window to avoid gas accidents. However, in theory, this type of alarm device can only be detected by the sensor when the gas leaks and accumulates to a certain extent. In addition, if the alarm is installed in an inappropriate position, such as at a low height or at a vent, there will be a large deviation between the gas concentration in the sampling area and the actual concentration of the space, which is prone to false alarms or no alarms, which undoubtedly increases the hidden dangers of gas use. Therefore, in order to achieve ex ante monitoring of gas safety, a high-precision gas monitoring method is urgently needed. Summary of the invention

[0003] The purpose of the present invention is to more accurately monitor whether there is any abnormality in gas usage and to provide a gas usage abnormality monitoring method based on an ultrasonic flow terminal.

[0004] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:

[0005] The method for monitoring abnormal gas consumption based on ultrasonic flow terminal comprises the following steps:

[0006] Step 1: The ultrasonic flow terminal obtains the instantaneous flow of natural gas in the user's pipeline through multi-day pre-operation and establishes a user's gas consumption habit table;

[0007] Step 2: Initialize the gas consumption peak vector table. The ultrasonic flow terminal updates the user's daily hourly peak instantaneous flow into the gas consumption peak vector table.

[0008] Step 3: Based on the user's gas usage habit vector table and the gas usage peak vector table, use the K nearest neighbor algorithm to determine whether the user's gas usage is abnormal.

[0009] The step 3 specifically comprises the following steps:

[0010] Step 3-1, defining the distance between two vectors based on the K nearest neighbor algorithm, thereby calculating the outlier score;

[0011] Step 3-2, define the state, action, and reward of the Q model;

[0012] Step 3-3, train the Q model based on the ε-greedy algorithm.

[0013] Compared with the prior art, the present invention has the following beneficial effects: the present invention proposes a method for monitoring abnormal gas usage based on an ultrasonic flow terminal. The user monitors the instantaneous flow of the pipeline in real time during gas usage, and detects tiny leaks and excessive flow through self-learning of the ultrasonic flow terminal, thereby providing early warning of gas accidents and safeguarding gas safety. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0015] Figure 1 This is a schematic diagram of the installation of the ultrasonic flow terminal of the present invention;

[0016] Figure 2 is a flow chart of the method of the present invention;

[0017] Figure 3 This is a flow chart of the Q model training of the present invention. DETAILED DESCRIPTION

[0018] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.

[0019] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0020] like Figure 1As shown, in this scheme, the ultrasonic flow terminal is set in the pipeline between the safety device and the gas-using equipment. The safety device may include an intelligent safety valve, an electric window opener, etc., and the gas-using equipment may include a water heater, a gas cooker, a wall-mounted boiler, etc. The ultrasonic flow terminal is used to obtain the instantaneous flow of natural gas in the pipeline, and the gas flow is compared and judged whether it is abnormal according to the set gas flow range of the gas-using equipment. For example, under the rated natural gas pipeline pressure of 2kPa, the approximate gas flow range of common gas cookers and water heaters is: 50 L / h ~ 1000 L / h for cookers; 300 L / h ~ 5000 L / h for water heaters. If the ultrasonic flow terminal measures the current instantaneous flow as Q, when Q≤10L / h, it is determined that the gas consumption fluctuates normally. When Q>10L / h, it can be determined whether there is leakage or abnormal flow exceeding the limit according to the threshold setting shown in Table 1.

[0021] Table 1 Thresholds for determining abnormal gas usage

[0022] The abnormal gas usage can be directly determined according to the threshold value set in Table 1. However, when the method determines that there is no abnormality, there may still be an abnormality. Therefore, in order to improve the accuracy of abnormality monitoring, the present invention is implemented through the following technical solution. Even if the gas usage is normal according to Table 1, the abnormal situation can be detected by the solution of the present invention. Figure 2 As shown, the present invention proposes a method for monitoring gas consumption anomalies based on an ultrasonic flow terminal, comprising the following steps:

[0023] Step 1: The ultrasonic flow terminal obtains the instantaneous flow of natural gas in the user's pipeline through multi-day pre-operation and establishes a user's gas consumption habit vector table.

[0024] The ultrasonic flow terminal detects abnormal gas usage by self-learning the user's gas usage habits. After the ultrasonic flow terminal is installed, it will perform a 15-day pre-operation for self-learning (the pre-operation duration can be customized).

[0025] First, we create a user gas usage habit vector table X, whose vector length is 24 and dimension is 15, and is initialized as:

[0026]

[0027] Among them, [x] represents an element in the user's gas usage habit vector table. The vector length 24 in the user's gas usage habit vector table X represents 24 hours, the dimension 15 represents 15 days, and "0" is the flow data corresponding to the initialization of the user's gas usage habit vector table X, that is, 0L / h (unit: liter / hour; flow data is the user's gas consumption, also called instantaneous flow in this solution).

[0028] During the 15 days of pre-operation, the user's hourly peak instantaneous flow is counted and updated to the user's gas usage habit vector table X. Specifically, the peak instantaneous flow in each hour of the first day is counted in the user's gas usage habit vector table X, the peak instantaneous flow in each hour of the second day is counted in the user's gas usage habit vector table X, and so on. After 15 days, the 15×24 vectors in the user's gas usage habit vector table X are all the peak instantaneous flow corresponding to each hour in these 15 days. For example, the peak instantaneous flow of gas consumption from 9:00 to 10:00 on the first day is 801L / h, then [x] 1,10 =801 L / h. It should be noted that this embodiment is only for demonstration and is not limited to 15 days of pre-operation or 24 vector lengths per day. Those skilled in the art can set it according to actual conditions.

[0029] After 15 days, the statistics are completed. Each vector in the user's gas usage habit vector table X is the hourly peak instantaneous flow rate, which is recorded in the non-volatile memory of the ultrasonic flow terminal and will not be changed later.

[0030] Step 2: Initialize the gas consumption peak vector table. The ultrasonic flow terminal updates the user's daily hourly peak instantaneous flow into the gas consumption peak vector table.

[0031] After the ultrasonic flow terminal is officially put into operation, the gas consumption peak vector table Y is initialized first, which has the same vector length as the user's gas consumption habit vector table X and is used to record the daily hourly peak instantaneous flow:

[0032]

[0033] Where [y] represents an element in the gas consumption peak vector table; a vector length of 24 represents 24 hours, and a dimension of 1 represents 1 day.

[0034] The ultrasonic flow terminal measures the instantaneous flow, and updates the peak instantaneous flow of each hour to the gas consumption peak vector table Y of the day. The time period when gas is not used or not reached is marked as 0. Since the flow usage is continuous, the ultrasonic flow terminal also detects the instantaneous flow in real time. After completing one hour of detection, the peak instantaneous flow of gas consumption in that hour is stored in the corresponding vector in the gas consumption peak vector table Y. Alternatively, the ultrasonic flow terminal writes the detected instantaneous flow into the gas consumption peak vector table Y in real time. If the instantaneous flow is increasing, it is updated in real time. If the instantaneous flow begins to decrease or remains unchanged, the maximum value before the decrease is retained.

[0035] Step 3: Based on the user's gas usage habit vector table and the gas usage peak vector table, use the K nearest neighbor algorithm to determine whether the user's gas usage is abnormal.

[0036] The distance between vector A and vector B is defined using the improved K nearest neighbor algorithm:

[0037]

[0038] Among them, a i represents the i-th element in vector A, b i Represents the i-th element in vector B, i=1,2,...,n, n represents the total number of elements in vector A and also the total number of elements in vector B; p represents a definable parameter.

[0039] When p=1 is selected, formula (1) is the Manhattan distance, that is:

[0040]

[0041] When p=2 is selected, formula (1) is the Euclidean distance, that is:

[0042]

[0043] When choosing hour Formula (1) is the Chebyshev distance, that is:

[0044]

[0045] Before calling the improved K-nearest neighbor algorithm in this step, the current hour is recorded, and the user gas usage habit vector table X and the gas usage peak vector table Y are sliced ​​to obtain vector X' and vector Y'. Since the matrix size of the user gas usage habit vector table X is 15×24, and the matrix size of the gas usage peak vector table Y is 1×24, for example, if the current time has reached the 8th hour, the matrix size of the sliced ​​vector X' is 15×8, and the matrix size of the sliced ​​vector Y' is 1×8. Then the distance between vector X' and vector Y' is calculated as , where X` j Represents the vector X`, X` corresponding to the jth day j The matrix size is 1×8. For example, when j=1, X` 1 represents the sum of instantaneous flow in the first 8 hours of the first day in the user's gas usage habit table X, j=1,2,..,15. Calculate the outlier score:

[0046]

[0047] Where c represents the outlier score and K = 15. Selecting the anomaly detection threshold ,like , then it is judged that the gas usage is normal. , it is judged as abnormal gas usage.

[0048] Since the gas usage time periods are different and the span is large, it is necessary to select appropriate p-values ​​and anomaly detection thresholds. It is particularly important to train the Q model offline in advance so that the Q model can select the most appropriate p value and anomaly detection threshold at different time periods. , thus outputting accurate results. Before training the Q model, three elements need to be defined: state, action, and reward.

[0049] Divide the 24 time periods into 6 states S=(s 1 ,s 2 ,...,s 6 ), that is, s 1 Representative gas usage period 1~4, s 2 Representative gas usage period 5~8,...,s 6 Represents the gas usage period 21 to 24.

[0050] Action D = (d 1 ,d 2 ,d 3 ) is used to evaluate vector distance The p-value in , and the corresponding anomaly detection threshold .d 1 Manhattan distance calculation for representative selection formula (2) , that is, choose p=1, and choose the anomaly detection threshold as ;d 2 Representative selection formula (3) Euclidean distance calculation , that is, choose p=2, and choose the anomaly detection threshold as ;d 3 Manhattan distance calculation for representative selection formula (4) , that is, select , and select the anomaly detection threshold as .

[0051] Obtain historical gas usage data in advance as the training data set G. In the training data set G, the data with normal gas usage is marked as positive samples, and the data with abnormal gas usage is marked as negative samples. The normal gas usage data set is recorded as E, and the abnormal gas usage data set is recorded as F. When using the training data set to learn and train the Q model, the learning effect of the Q model is improved by setting rewards and penalties. When the prediction result of the Q model is consistent with the actual label, if the training data set G∈E, then r=0.5; if the training data set G∈F, then r=5; when the prediction result of the Q model is inconsistent with the actual label, if the training data set G∈E, then r=-0.1; if the training data set G∈F, then r=-1. It should be noted that r greater than 0 represents a reward, and r less than 0 represents a penalty.

[0052] The Q model is a 6×3 matrix:

[0053]

[0054] like Figure 3 As shown, the training process of the Q model is as follows:

[0055] Step (1), initialize each element Q(s,d) in the matrix Q(s,d) v ,d u )=0, v=1,...,6, u=1,2,3; initialize the current round t=0; let the normal gas usage data set be E and the abnormal gas usage data set be F.

[0056] Step (2), t=t+1, if t>T, then end the training, otherwise execute steps (2-a) and (2-b) simultaneously or in no particular order:

[0057] Step (2-a), calculate ε in the ε-greedy algorithm:

[0058]

[0059] Among them, ε represents the search factor, which is used to control the probability of random search actions; T represents the total number of training rounds, and t represents the current training round;

[0060] Step (2-b), randomly select 15 data from the normal gas consumption data set E as the normal gas consumption data regularity matrix H, the length of each randomly selected data is 24, execute E`=(EH)∪F, use E` as the training data set for this round of training, initialize m=0, m represents the mth training hour.

[0061] Step (3), execute m=m+1, indicating that the gas usage data training for the mth training hour is being performed; if m>24, return to step (2), otherwise execute step (4).

[0062] Step (4), randomly select a training sample I from the training data set E' without duplication, the data length of training sample I is 24, and I is sliced ​​into gas usage period m. For example, if m=3 represents the third training hour, then after slicing training sample I, its data length is 3. Determine the current state s v , the ε-greedy algorithm makes the state s v Choose an action d in Q(s,d) u Execute, determine the reward r obtained, and update Q(s,d) according to formula (7):

[0063]

[0064] Where, l represents the lth training sample in the training dataset E', l=1,2,...,L, L is the total number of training samples in the training dataset E'; m represents the mth training hour; t represents the tth round;

[0065] It represents the Q value of state s taking action d when using the lth training sample in the mth training hour of the tth round;

[0066] It represents the Q value of state s taking action d when using the l+1th training sample in the mth training hour of the tth round;

[0067] Represents the learning rate, which is a hyperparameter between 0 and 1;

[0068] r l+1 It represents the reward obtained by state s after taking action d when using the l+1th training sample, which is used to calculate the Q value when using the l+1th training sample;

[0069] Represents the discount factor, which is a hyperparameter between 0 and 1;

[0070] Since when the state s takes action d when the lth training sample is used, it will reach the next state, that is, it will use the l+1th training sample, so It represents the maximum Q value that can be obtained after state s selects an action d when using the l+1th training sample.

[0071] Step (5): if all training samples in the training data set E' have been trained, return to step (3); otherwise, return to step (4).

[0072] To facilitate understanding of the training process of the Q model, assume that there are 1000 training samples I in the training data set E', then l represents the lth training sample, l=1,2,...,1000; in the mth training hour, steps (4)-(5) will be executed 1000 times, that is, the elements in Q(s,d) will be updated 1000 times, but which element is updated each time is determined by ε, which can be understood as randomly updating any element in Q(s,d) each time; when the training data set E' After all 1000 training samples I are trained, return to step (3), update the training hour m=m+1, and execute steps (4)-(5) 1000 times until m>24, then return to step (2), update the round t=t+1, and redetermine ε and the training data set E`; if there are 1200 training samples in the training data set E` in this round, it will be trained 1200×24 times, and then return to step (2) to update the round plus 1 until t>T, at which point the entire training process ends.

[0073] The ε-greedy algorithm is a strategy for selecting actions during reinforcement learning training. There is a probability of ε to use a random action, and a probability of 1-ε to use the action with the largest corresponding Q value. For example, at this time the state is s 1 , Q(s 1 ,d 1 ) = 1, Q(s 1 ,d 2 ) = 3, Q(s 1 ,d 3 ) = 2. Generate a random number e between 0 and 1. If e < ε, use random actions and randomly select d regardless of the Q value. 1 ,d 2 ,d 3 Otherwise, use the ε-greedy strategy and select the action with the largest Q value, such as d 2 According to the setting strategy of ε here, ε is relatively large in the early stage of training, tending to use random actions and exploring as many rewards as possible for different actions in different states; ε is very small in the later stage of training, tending to use the strategy with the largest Q value, which is conducive to the convergence of the values ​​of the elements in the Q model.

[0074] After the Q model training is completed, the Q model is deployed to the non-volatile memory of the ultrasonic flow terminal and will not be changed later. In actual use, select the corresponding s according to the current period v , for example, if the current time is 2 o'clock, then select s 1 , and then find s from the Q model 1 The corresponding maximum Q value, from the matrix of the Q model, we can see that the first column is s 1 , then find Q(s 1 ,d 1 )、Q(s 1 ,d 2 )、Q(s 1 d 3 ). For example, Q(s 1 ,d 2 ) is the maximum value among them, then d 2 The corresponding p=2 is taken as the p value, As the anomaly detection threshold. If the outlier score c calculated from the current two points is greater than or equal to , it is judged as abnormal gas usage, and the gas intelligent safety valve is cut off at the same time, the electric window opener is linked to open the window, and the gas safety platform is reported; otherwise, the gas usage is judged to be normal.

[0075] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for monitoring abnormal gas usage based on an ultrasonic flow terminal, characterized in that: The following steps are involved: Step 1: The ultrasonic flow terminal obtains the instantaneous flow of natural gas in the user's pipeline through multi-day pre-operation and establishes a user's gas consumption habit table; Step 2: Initialize the gas consumption peak vector table. The ultrasonic flow terminal updates the user's daily hourly peak instantaneous flow into the gas consumption peak vector table. Step 3: Based on the user's gas usage habit vector table and the gas usage peak vector table, use the K nearest neighbor algorithm to determine whether the user's gas usage is abnormal.

2. The method for monitoring abnormal gas consumption based on ultrasonic flow terminal according to claim 1 is characterized in that: The step 1 specifically comprises the following steps: Create a user gas usage habit vector table X and initialize it to: Wherein, [x] represents an element in the user gas usage habit vector table; N represents the vector length of the user gas usage habit vector table X, N=24; M represents the dimension of the user gas usage habit vector table X, M=15.

3. The method for monitoring abnormal gas consumption based on ultrasonic flow terminal according to claim 1 is characterized in that: The step 2 specifically includes the following steps: A gas consumption peak vector table Y is established, which has the same vector length as the user gas consumption habit vector table X and is used to record the daily hourly peak instantaneous flow rate. It is initialized as: Wherein, [y] represents an element in the gas consumption peak vector table; N represents the vector length of the gas consumption peak vector table Y, N=24; M` represents the dimension of the gas consumption peak vector table Y, M`=1; The ultrasonic flow terminal measures the instantaneous flow and updates the peak instantaneous flow of each vector length to the gas consumption peak vector table Y of the current dimension.

4. The method for monitoring abnormal gas usage based on ultrasonic flow terminal according to claim 1 is characterized in that: The step 3 specifically comprises the following steps: Step 3-1, defining the distance between two vectors based on the K nearest neighbor algorithm, thereby calculating the outlier score; Step 3-2, define the state, action, and reward of the Q model; Step 3-3, train the Q model based on the ε-greedy algorithm.

5. The method for monitoring abnormal gas usage based on ultrasonic flow terminal according to claim 4 is characterized in that: The step 3-1 specifically includes the following steps: Use the K nearest neighbor algorithm to define the distance between vector A and vector B: Among them, a i represents the i-th element in vector A, b i represents the i-th element in vector B, i=1,2,...,n, n represents the total number of elements in vector A, and also represents the total number of elements in vector B; p represents a definable parameter; When p=1 is selected, formula (1) is the Manhattan distance, that is: When p=2 is selected, formula (1) is the Euclidean distance, that is: When choosing hour Formula (1) is the Chebyshev distance, that is: Record the current vector length, slice the user's gas usage habit vector table X and the gas usage peak vector table Y to obtain vector X' and vector Y'; calculate the distance between vector X' and vector Y' as , where X` j represents the vector X` corresponding to the jth dimension, j=1,2,..,15; based on Calculate the outlier score: Where c represents the outlier score; K=15.

6. The method for monitoring abnormal gas usage based on ultrasonic flow terminal according to claim 5 is characterized in that: The step 3-2 specifically includes the following steps: Divide the 24 vector lengths into 6 states S=(s1,s2,...,s6) with each 4 vector lengths as a period; Action D=(d1,d2,d3) is used to evaluate the vector distance The p-value in , and the corresponding anomaly detection threshold ; d1 represents the Manhattan distance calculation of the selection formula (2) , that is, choose p=1, and choose the anomaly detection threshold as ; d2 represents the Euclidean distance calculation of the selection formula (3) , that is, choose p=2, and choose the anomaly detection threshold as ; d3 represents the Manhattan distance calculation of the selected formula (4) , i.e. select , and select the anomaly detection threshold as ; Get historical gas consumption data as training data set G, mark the data with normal gas consumption in training data set G as positive samples, and mark the data with abnormal gas consumption as negative samples. The normal gas consumption data set is E, and the abnormal gas consumption data set is F. When the prediction result of the Q model is consistent with the actual label, if the training data set G∈E, then r=0.5; if the training data set G∈F, then r=5; when the prediction result of the Q model is inconsistent with the actual label, if the training data set G∈E, then r=-0.1; if the training data set G∈F, then r=-1; The Q model is a 6×3 matrix: Among them, Q(s,d) represents the matrix of the Q model; Q(s v ,d u ) represents the elements in the Q model, v=1,2,...,6, u=1,2,3.

7. The method for monitoring abnormal gas usage based on ultrasonic flow terminal according to claim 6 is characterized in that: The step 3-3 specifically includes the following steps: Step (1), initialize each element Q(s,d) in the matrix Q(s,d) v ,d u )=0, v=1,...,6, u=1,2,3; initialize the current round t=0; Step (2), t=t+1, if t>T, then end the training, otherwise execute steps (2-a) and (2-b) simultaneously or in no particular order: Step (2-a), calculate ε in the ε-greedy algorithm: Among them, ε represents the search factor, which is used to control the probability of random search actions; T represents the total number of training rounds, and t represents the current training round; Step (2-b), randomly select 15 data from the normal gas usage data set E as the normal gas usage data regularity matrix H, the length of each randomly selected data is 24, execute E`=(EH)∪F, use E` as the training data set for this round of training, initialize m=0, m represents the mth training hour; Step (3), execute m=m+1, indicating that the gas usage data training for the mth training hour is being performed; if m>24, return to step (2), otherwise execute step (4); Step (4), randomly select a training sample I from the training data set E' without duplication, the data length of training sample I is 24, and I is sliced ​​into gas usage period m; determine the current state s v , the ε-greedy algorithm makes the state s v Choose an action d in Q(s,d) u Execute, determine the reward r obtained, and update Q(s,d) according to formula (7): Where, l represents the lth training sample in the training dataset E', l=1,2,...,L, L is the total number of training samples in the training dataset E'; m represents the mth training hour; t represents the tth round; It represents the Q value of state s taking action d when using the lth training sample in the mth training hour of the tth round; It represents the Q value of state s taking action d when using the l+1th training sample in the mth training hour of the tth round; Represents the learning rate, which is a hyperparameter between 0 and 1; r l+1 It represents the reward obtained by state s after taking action d when using the l+1th training sample, which is used to calculate the Q value when using the l+1th training sample; Represents the discount factor, which is a hyperparameter between 0 and 1; Since when the state s takes action d when the lth training sample is used, it will reach the next state, that is, it will use the l+1th training sample, so It represents the maximum Q value that can be obtained after state s selects an action d when using the l+1th training sample; Step (5): if all training samples in the training data set E' have been trained, return to step (3); otherwise, return to step (4).

8. The method for monitoring abnormal gas usage based on ultrasonic flow terminal according to claim 6 is characterized in that: The step 3 also includes: Step 3-4: Use the trained Q model to determine whether the gas consumption data in the current period is abnormal; The steps 3-4 specifically include the following steps: If the current period corresponds to state s v , then find s from the Q model v The corresponding maximum Q value, the d in the maximum Q value u The corresponding p = u is taken as the p value. After selecting formula (5) to calculate the outlier score c, c and d u The corresponding As the anomaly detection threshold; if , it is judged as abnormal gas usage, otherwise it is judged as normal gas usage.

Citation Information

Patent Citations

  • Systems and methods for predictive building energy monitoring

    CA2689035A1

  • Method and system of detection for discovering suspected gas leakage based on abnormal behavior of gas use

    CN105185051A

  • Electric power daily load prediction method and device

    CN111160617A

  • Empty nest user electricity consumption anomaly detection method based on machine learning algorithm

    CN113112374A

  • Gas anomaly detection method based on user portrait

    CN113516313A

Cited By

  • Meter type selection judgment and intelligent recommendation method based on statistical algorithm

    CN119311956A

  • Leakage detection method based on resident gas consumption

    CN121350841A